summaryrefslogtreecommitdiffstats
path: root/0001-Update-to-GDBus-API-change.patch
blob: 2e1ed5bad90f0c78fcb67599d4e006c81eb953b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
From eb9b57ea502c268f2e4eddacc1c2cfb5283a407d Mon Sep 17 00:00:00 2001
From: Carlos Garcia Campos <carlosgc@gnome.org>
Date: Fri, 18 Jun 2010 12:17:26 +0200
Subject: [PATCH 1/3] Update to GDBus API change

Fixes bug #621766.
---
 configure.in                                       |    2 +-
 .../panel-applet-container.c                       |   64 ++++++++++----------
 2 files changed, 32 insertions(+), 34 deletions(-)

diff --git a/configure.in b/configure.in
index ba108b0..f3b3fbd 100644
--- a/configure.in
+++ b/configure.in
@@ -57,7 +57,7 @@ AC_CHECK_FUNCS(_NSGetEnviron)
 LIBGNOME_DESKTOP_REQUIRED=2.24.0
 GDK_PIXBUF_REQUIRED=2.7.1
 PANGO_REQUIRED=1.15.4
-GLIB_REQUIRED=2.25.7
+GLIB_REQUIRED=2.25.9
 GTK_REQUIRED=2.19.7
 LIBWNCK_REQUIRED=2.19.5
 GCONF_REQUIRED=2.6.1
diff --git a/gnome-panel/libpanel-applet-private/panel-applet-container.c b/gnome-panel/libpanel-applet-private/panel-applet-container.c
index ad5eeaf..96d4aa4 100644
--- a/gnome-panel/libpanel-applet-private/panel-applet-container.c
+++ b/gnome-panel/libpanel-applet-private/panel-applet-container.c
@@ -27,7 +27,6 @@
 struct _PanelAppletContainerPrivate {
 	GDBusProxy *applet_proxy;
 
-	guint       proxy_watcher_id;
 	guint       name_watcher_id;
 	gchar      *bus_name;
 
@@ -142,11 +141,6 @@ panel_applet_container_dispose (GObject *object)
 		container->priv->name_watcher_id = 0;
 	}
 
-	if (container->priv->proxy_watcher_id > 0) {
-		g_bus_unwatch_proxy (container->priv->proxy_watcher_id);
-		container->priv->proxy_watcher_id = 0;
-	}
-
 	if (container->priv->applet_proxy) {
 		g_object_unref (container->priv->applet_proxy);
 		container->priv->applet_proxy = NULL;
@@ -255,10 +249,6 @@ panel_applet_container_plug_removed (PanelAppletContainer *container)
 		g_bus_unwatch_name (container->priv->name_watcher_id);
 		container->priv->name_watcher_id = 0;
 	}
-	if (container->priv->proxy_watcher_id > 0) {
-		g_bus_unwatch_proxy (container->priv->proxy_watcher_id);
-		container->priv->proxy_watcher_id = 0;
-	}
 
 	g_object_unref (container->priv->applet_proxy);
 	container->priv->applet_proxy = NULL;
@@ -322,23 +312,33 @@ on_property_changed (GDBusConnection      *connection,
 }
 
 static void
-on_proxy_appeared (GDBusConnection *connection,
-		   const gchar     *name,
-		   const gchar     *name_owner,
-		   GDBusProxy      *proxy,
-		   gpointer         user_data)
+on_proxy_appeared (GObject      *source_object,
+		   GAsyncResult *res,
+		   gpointer      user_data)
 {
 	GSimpleAsyncResult   *result = G_SIMPLE_ASYNC_RESULT (user_data);
 	PanelAppletContainer *container;
+	GDBusProxy           *proxy;
+	GError               *error = NULL;
+
+	proxy = g_dbus_proxy_new_finish (res, &error);
+	if (!proxy) {
+		g_simple_async_result_set_from_error (result, error);
+		g_error_free (error);
+		g_simple_async_result_complete (result);
+		g_object_unref (result);
+
+		return;
+	}
 
 	container = PANEL_APPLET_CONTAINER (g_async_result_get_source_object (G_ASYNC_RESULT (result)));
 
-	container->priv->applet_proxy = g_object_ref (proxy);
+	container->priv->applet_proxy = proxy;
 	g_signal_connect (container->priv->applet_proxy, "g-signal",
 			  G_CALLBACK (panel_applet_container_child_signal),
 			  container);
-	g_dbus_connection_signal_subscribe (connection,
-					    name_owner,
+	g_dbus_connection_signal_subscribe (g_dbus_proxy_get_connection (proxy),
+					    g_dbus_proxy_get_name (proxy),
 					    "org.freedesktop.DBus.Properties",
 					    "PropertiesChanged",
 					    g_dbus_proxy_get_object_path (proxy),
@@ -384,18 +384,16 @@ get_applet_cb (GObject      *source_object,
 	container = PANEL_APPLET_CONTAINER (g_async_result_get_source_object (G_ASYNC_RESULT (result)));
 	g_variant_get (retvals, "(&ou)", &applet_path, &container->priv->xid);
 
-	container->priv->proxy_watcher_id =
-		g_bus_watch_proxy_on_connection (connection,
-						 container->priv->bus_name,
-						 G_BUS_NAME_WATCHER_FLAGS_NONE,
-						 applet_path,
-						 PANEL_APPLET_INTERFACE,
-						 G_TYPE_DBUS_PROXY,
-						 G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
-						 (GBusProxyAppearedCallback) on_proxy_appeared,
-						 NULL,
-						 result,
-						 NULL);
+	g_dbus_proxy_new (connection,
+			  G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
+			  NULL,
+			  container->priv->bus_name,
+			  applet_path,
+			  PANEL_APPLET_INTERFACE,
+			  NULL,
+			  (GAsyncReadyCallback) on_proxy_appeared,
+			  result);
+
 	g_variant_unref (retvals);
 
 	/* g_async_result_get_source_object returns new ref */
@@ -601,7 +599,7 @@ panel_applet_container_child_set (PanelAppletContainer *container,
 	g_hash_table_insert (container->priv->pending_ops, result, cancellable);
 
 	g_dbus_connection_call (g_dbus_proxy_get_connection (proxy),
-				g_dbus_proxy_get_unique_bus_name (proxy),
+				g_dbus_proxy_get_name (proxy),
 				g_dbus_proxy_get_object_path (proxy),
 				"org.freedesktop.DBus.Properties",
 				"Set",
@@ -701,7 +699,7 @@ panel_applet_container_child_get (PanelAppletContainer *container,
 	g_hash_table_insert (container->priv->pending_ops, result, cancellable);
 
 	g_dbus_connection_call (g_dbus_proxy_get_connection (proxy),
-				g_dbus_proxy_get_unique_bus_name (proxy),
+				g_dbus_proxy_get_name (proxy),
 				g_dbus_proxy_get_object_path (proxy),
 				"org.freedesktop.DBus.Properties",
 				"Get",
@@ -772,7 +770,7 @@ panel_applet_container_child_popup_menu (PanelAppletContainer *container,
 					    panel_applet_container_child_popup_menu);
 
 	g_dbus_connection_call (g_dbus_proxy_get_connection (proxy),
-				g_dbus_proxy_get_unique_bus_name (proxy),
+				g_dbus_proxy_get_name (proxy),
 				g_dbus_proxy_get_object_path (proxy),
 				PANEL_APPLET_INTERFACE,
 				"PopupMenu",
-- 
1.7.1