Merge lp:~mardy/gnome-control-center-signon/lp1066917 into lp:gnome-control-center-signon

Proposed by Alberto Mardegan
Status: Merged
Approved by: David King
Approved revision: 113
Merged at revision: 112
Proposed branch: lp:~mardy/gnome-control-center-signon/lp1066917
Merge into: lp:gnome-control-center-signon
Diff against target: 83 lines (+22/-9)
2 files modified
configure.ac (+2/-6)
libaccount-plugin/oauth-plugin.c (+20/-3)
To merge this branch: bzr merge lp:~mardy/gnome-control-center-signon/lp1066917
Reviewer Review Type Date Requested Status
David King (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+130037@code.launchpad.net

Description of the change

Pack the cookies into a GVariant

Instead of directly passing the cookies GHashTable as a GValue (which the
recent versions of libsignon-glib cannot handle anymore), repack it into a
GVariant and put that into a GValue.
As a nice side-effect, we can now remove the dbus-glib dependency which is no
longer needed.

To post a comment you must log in.
Revision history for this message
David King (amigadave) wrote :

Looks fine.

review: Approve
Revision history for this message
David King (amigadave) wrote :

Actually, if this is because of a change is libsignon-glib behaviour, please update the configure check for libsignon-glib to the requisite version.

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
113. By Alberto Mardegan

Depend on the latest libsignon-glib.

Revision history for this message
Alberto Mardegan (mardy) wrote :

I updated the needed version in configure.ac.

But now it will be a bit more difficult to test the fix, since libsignon-glib 1.7 has not been released yet.

Revision history for this message
David King (amigadave) :
review: Approve

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 2012-10-11 14:14:38 +0000
3+++ configure.ac 2012-10-17 07:37:19 +0000
4@@ -42,13 +42,10 @@
5
6 # Libraries
7 LIBACCOUNTS_GLIB_REQUIRED="libaccounts-glib"
8-LIBSIGNON_GLIB_REQUIRED="libsignon-glib"
9+LIBSIGNON_GLIB_REQUIRED="libsignon-glib >= 1.7"
10 GLIB_REQUIRED="glib-2.0 gio-2.0 gio-unix-2.0 >= 2.29.5"
11 GTK_REQUIRED="gtk+-3.0 >= 3.0.0"
12 GNOME_CONTROL_CENTER_REQUIRED="libgnome-control-center"
13-# Unfortunately we need this in order to store the cookies (D-Bus signature
14-# a{ss}) into a GValue
15-DBUS_GLIB_REQUIRED="dbus-glib-1"
16
17 PKG_CHECK_MODULES([CREDENTIALS_PANEL],
18 [$LIBACCOUNTS_GLIB_REQUIRED
19@@ -65,8 +62,7 @@
20
21 # libaccount-plugin dependencies.
22 PKG_CHECK_MODULES([LIBACCOUNT_PLUGIN],
23- [$DBUS_GLIB_REQUIRED
24- $LIBACCOUNTS_GLIB_REQUIRED
25+ [$LIBACCOUNTS_GLIB_REQUIRED
26 $LIBSIGNON_GLIB_REQUIRED
27 $GLIB_REQUIRED
28 $GTK_REQUIRED])
29
30=== modified file 'libaccount-plugin/oauth-plugin.c'
31--- libaccount-plugin/oauth-plugin.c 2012-09-26 14:28:37 +0000
32+++ libaccount-plugin/oauth-plugin.c 2012-10-17 07:37:19 +0000
33@@ -32,7 +32,6 @@
34
35 #include "oauth-plugin.h"
36
37-#include <dbus/dbus-glib.h>
38 #include <glib/gi18n.h>
39 #include <gtk/gtkx.h>
40 #include <libaccounts-glib/ag-manager.h>
41@@ -319,6 +318,23 @@
42 }
43 }
44
45+static GVariant *
46+cookies_to_variant (GHashTable *cookies)
47+{
48+ GVariantBuilder builder;
49+ GHashTableIter iter;
50+ const gchar *key, *value;
51+
52+ g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{ss}"));
53+ g_hash_table_iter_init (&iter, cookies);
54+ while (g_hash_table_iter_next (&iter, (gpointer)&key, (gpointer)&value))
55+ {
56+ g_variant_builder_add (&builder, "{ss}", key, value);
57+ }
58+
59+ return g_variant_builder_end (&builder);
60+}
61+
62 static void
63 start_authentication_process (ApOAuthPlugin *self)
64 {
65@@ -346,8 +362,8 @@
66 if (cookies != NULL &&
67 !ap_plugin_get_ignore_cookies ((ApPlugin *)self))
68 {
69- g_value_init (&v_cookies, DBUS_TYPE_G_STRING_STRING_HASHTABLE);
70- g_value_set_static_boxed (&v_cookies, cookies);
71+ g_value_init (&v_cookies, G_TYPE_VARIANT);
72+ g_value_set_variant (&v_cookies, cookies_to_variant (cookies));
73 g_hash_table_insert (session_data, "Cookies", &v_cookies);
74 }
75
76@@ -373,6 +389,7 @@
77 priv->mechanism,
78 auth_session_process_cb, self);
79 g_hash_table_unref (session_data);
80+ g_value_unset (&v_cookies);
81 }
82
83 static void

Subscribers

People subscribed via source and target branches