Merge lp:~mardy/gnome-control-center-signon/invalid-providers-1287640 into lp:gnome-control-center-signon

Proposed by Alberto Mardegan
Status: Merged
Approved by: David Barth
Approved revision: 182
Merged at revision: 180
Proposed branch: lp:~mardy/gnome-control-center-signon/invalid-providers-1287640
Merge into: lp:gnome-control-center-signon
Diff against target: 176 lines (+58/-13)
8 files modified
configure.ac (+1/-1)
debian/changelog (+7/-0)
debian/libaccount-plugin-1.0-0.symbols (+1/-0)
libaccount-plugin/AccountPlugin.vapi (+2/-0)
libaccount-plugin/client.c (+42/-11)
libaccount-plugin/client.h (+1/-0)
src/cc-credentials-accounts-model.vala (+1/-1)
src/cc-credentials-providers-model.vala (+3/-0)
To merge this branch: bzr merge lp:~mardy/gnome-control-center-signon/invalid-providers-1287640
Reviewer Review Type Date Requested Status
Online Accounts Pending
Review via email: mp+279278@code.launchpad.net

Commit message

Filter out invalid plugins

Also fixes a typo which was possibly causing unneeded reauthentications.

Description of the change

Filter out invalid plugins

Also fixes a typo which was possibly causing unneeded reauthentications.

To post a comment you must log in.
182. By Alberto Mardegan

On account creation, filter out providers without valid plugins from the
providers list (LP: #1287640)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'configure.ac'
2--- configure.ac 2014-01-09 12:11:48 +0000
3+++ configure.ac 2015-12-08 10:10:33 +0000
4@@ -96,7 +96,7 @@
5 $UNITY_CONTROL_CENTER_REQUIRED])
6
7 # libaccount-plugin variables.
8-AC_SUBST([LIBACCOUNT_PLUGIN_SO_VERSION], [0:0:0])
9+AC_SUBST([LIBACCOUNT_PLUGIN_SO_VERSION], [1:0:1])
10 AC_SUBST([LIBACCOUNT_PLUGIN_API_VERSION], [1.0])
11 LIBACCOUNT_PLUGIN_DIR="$libdir/libaccount-plugin-$LIBACCOUNT_PLUGIN_API_VERSION"
12 AC_SUBST(LIBACCOUNT_PLUGIN_DIR)
13
14=== modified file 'debian/changelog'
15--- debian/changelog 2014-08-14 10:20:07 +0000
16+++ debian/changelog 2015-12-08 10:10:33 +0000
17@@ -1,3 +1,10 @@
18+gnome-control-center-signon (0.1.8-0ubuntu1) UNRELEASED; urgency=medium
19+
20+ * On account creation, filter out providers without valid plugins from the
21+ providers list (LP: #1287640)
22+
23+ -- Alberto Mardegan <alberto.mardegan@canonical.com> Tue, 08 Dec 2015 12:03:07 +0200
24+
25 gnome-control-center-signon (0.1.7~+14.10.20140814-0ubuntu1) utopic; urgency=low
26
27 [ Ubuntu daily release ]
28
29=== modified file 'debian/libaccount-plugin-1.0-0.symbols'
30--- debian/libaccount-plugin-1.0-0.symbols 2012-11-14 16:12:55 +0000
31+++ debian/libaccount-plugin-1.0-0.symbols 2015-12-08 10:10:33 +0000
32@@ -6,6 +6,7 @@
33 ap_application_plugin_get_error@Base 0.0.2
34 ap_application_plugin_get_type@Base 0.0.2
35 ap_application_plugin_set_error@Base 0.0.2
36+ ap_client_has_plugin@Base 0.1.8
37 ap_client_load_application_plugin@Base 0.0.2
38 ap_client_load_plugin@Base 0.0.1
39 ap_oauth_plugin_get_type@Base 0.0.1
40
41=== modified file 'libaccount-plugin/AccountPlugin.vapi'
42--- libaccount-plugin/AccountPlugin.vapi 2012-07-18 08:06:52 +0000
43+++ libaccount-plugin/AccountPlugin.vapi 2015-12-08 10:10:33 +0000
44@@ -64,6 +64,8 @@
45 [CCode (cheader_filename = "libaccount-plugin/account-plugin.h", cname = "AP_PLUGIN_CREDENTIALS_ID_FIELD")]
46 public const string PLUGIN_CREDENTIALS_ID_FIELD;
47 [CCode (cheader_filename = "libaccount-plugin/account-plugin.h")]
48+ public static bool client_has_plugin (Ag.Provider provider);
49+ [CCode (cheader_filename = "libaccount-plugin/account-plugin.h")]
50 public static Ap.ApplicationPlugin client_load_application_plugin (Ag.Application application, Ag.Account account);
51 [CCode (cheader_filename = "libaccount-plugin/account-plugin.h")]
52 public static Ap.Plugin client_load_plugin (Ag.Account account);
53
54=== modified file 'libaccount-plugin/client.c'
55--- libaccount-plugin/client.c 2013-01-09 11:21:31 +0000
56+++ libaccount-plugin/client.c 2015-12-08 10:10:33 +0000
57@@ -36,6 +36,23 @@
58 #include <libaccounts-glib/ag-manager.h>
59 #include <libaccounts-glib/ag-provider.h>
60
61+static gchar *
62+get_module_path (AgProvider *provider)
63+{
64+ const gchar *plugin_name;
65+ const gchar *plugin_dir;
66+
67+ plugin_name = ag_provider_get_plugin_name (provider);
68+ if (plugin_name == NULL)
69+ plugin_name = ag_provider_get_name (provider);
70+
71+ plugin_dir = g_getenv ("AP_PROVIDER_PLUGIN_DIR");
72+ if (plugin_dir == NULL)
73+ plugin_dir = LIBACCOUNT_PLUGIN_DIR "/providers";
74+
75+ return g_module_build_path (plugin_dir, plugin_name);
76+}
77+
78 /**
79 * ap_client_load_plugin:
80 * @account: the #AgAccount to be created/edited.
81@@ -49,8 +66,6 @@
82 ap_client_load_plugin (AgAccount *account)
83 {
84 const gchar *provider_name;
85- const gchar *plugin_name;
86- const gchar *plugin_dir;
87 gchar *module_path;
88 AgManager *manager;
89 AgProvider *provider;
90@@ -75,15 +90,7 @@
91 provider = ag_manager_get_provider (manager, provider_name);
92 g_return_val_if_fail (provider != NULL, NULL);
93
94- plugin_name = ag_provider_get_plugin_name (provider);
95- if (plugin_name == NULL)
96- plugin_name = provider_name;
97-
98- plugin_dir = g_getenv ("AP_PROVIDER_PLUGIN_DIR");
99- if (plugin_dir == NULL)
100- plugin_dir = LIBACCOUNT_PLUGIN_DIR "/providers";
101-
102- module_path = g_module_build_path (plugin_dir, plugin_name);
103+ module_path = get_module_path (provider);
104 module = g_module_open (module_path, 0);
105 if (G_UNLIKELY (module == NULL))
106 {
107@@ -133,6 +140,30 @@
108 }
109
110 /**
111+ * ap_client_has_plugin:
112+ * @provider: the account provider.
113+ *
114+ * Checks if there is a valid account plugin for creating accounts having
115+ * @provider as provider.
116+ *
117+ * Returns: %TRUE if a plugin is found, %FALSE otherwise.
118+ */
119+gboolean
120+ap_client_has_plugin (AgProvider *provider)
121+{
122+ gchar *module_path;
123+ gboolean exists;
124+
125+ module_path = get_module_path (provider);
126+ if (!module_path)
127+ return FALSE;
128+
129+ exists = g_file_test (module_path, G_FILE_TEST_EXISTS);
130+ g_free (module_path);
131+ return exists;
132+}
133+
134+/**
135 * ap_client_load_application_plugin:
136 * @application: the #AgApplication.
137 * @account: the #AgAccount to be edited.
138
139=== modified file 'libaccount-plugin/client.h'
140--- libaccount-plugin/client.h 2012-05-14 11:55:10 +0000
141+++ libaccount-plugin/client.h 2015-12-08 10:10:33 +0000
142@@ -33,6 +33,7 @@
143 typedef struct _ApApplicationPlugin ApApplicationPlugin;
144
145 ApPlugin *ap_client_load_plugin (AgAccount *account);
146+gboolean ap_client_has_plugin (AgProvider *provider);
147
148 ApApplicationPlugin *
149 ap_client_load_application_plugin (AgApplication *application,
150
151=== modified file 'src/cc-credentials-accounts-model.vala'
152--- src/cc-credentials-accounts-model.vala 2013-02-11 11:53:25 +0000
153+++ src/cc-credentials-accounts-model.vala 2015-12-08 10:10:33 +0000
154@@ -284,7 +284,7 @@
155 string property_name;
156 change.get ("{sv}", out property_name, null);
157
158- if (property_name == "Failures");
159+ if (property_name == "Failures")
160 {
161 on_indicator_notify_failures ();
162 }
163
164=== modified file 'src/cc-credentials-providers-model.vala'
165--- src/cc-credentials-providers-model.vala 2013-06-05 09:00:55 +0000
166+++ src/cc-credentials-providers-model.vala 2015-12-08 10:10:33 +0000
167@@ -174,6 +174,9 @@
168 {
169 Icon provider_icon = null;
170
171+ if (!Ap.client_has_plugin (provider))
172+ return;
173+
174 try
175 {
176 provider_icon = Icon.new_for_string (provider.get_icon_name ());

Subscribers

People subscribed via source and target branches