← Back to team overview

ayatana-commits team mailing list archive

[Branch ~dbusmenu-team/dbusmenu/trunk] Rev 186: Signal an update layout when the object comes on the bus.

 

Merge authors:
  Chris Coulson (chrisccoulson)
  Ted Gould (ted)
Related merge proposals:
  https://code.launchpad.net/~ted/dbusmenu/signal-on-new-menu/+merge/46657
  proposed by: Ted Gould (ted)
  review: Approve - Mikkel Kamstrup Erlandsen (kamstrup)
------------------------------------------------------------
revno: 186 [merge]
committer: Ted Gould <ted@xxxxxxxx>
branch nick: trunk
timestamp: Wed 2011-01-19 09:14:11 -0600
message:
  Signal an update layout when the object comes on the bus.
modified:
  libdbusmenu-glib/client.c
  libdbusmenu-glib/server.c


--
lp:dbusmenu
https://code.launchpad.net/~dbusmenu-team/dbusmenu/trunk

Your team ayatana-commits is subscribed to branch lp:dbusmenu.
To unsubscribe from this branch go to https://code.launchpad.net/~dbusmenu-team/dbusmenu/trunk/+edit-subscription
=== modified file 'libdbusmenu-glib/client.c'
--- libdbusmenu-glib/client.c	2011-01-13 15:53:15 +0000
+++ libdbusmenu-glib/client.c	2011-01-19 14:55:37 +0000
@@ -1538,6 +1538,14 @@
 static void
 update_layout_cb (GObject * proxy, GAsyncResult * res, gpointer data)
 {
+	DbusmenuClient * client = DBUSMENU_CLIENT(data);
+	DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client);
+
+	if (priv->layoutcall != NULL) {
+		g_object_unref(priv->layoutcall);
+		priv->layoutcall = NULL;
+	}
+
 	GError * error = NULL;
 	GVariant * params = NULL;
 
@@ -1554,9 +1562,6 @@
 	g_variant_get(params, "(us)", &rev, &xml);
 	g_variant_unref(params);
 
-	DbusmenuClient * client = DBUSMENU_CLIENT(data);
-	DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client);
-
 	guint parseable = parse_layout(client, xml);
 	g_free(xml);
 
@@ -1567,10 +1572,6 @@
 
 	priv->my_revision = rev;
 	/* g_debug("Root is now: 0x%X", (unsigned int)priv->root); */
-	if (priv->layoutcall != NULL) {
-		g_object_unref(priv->layoutcall);
-		priv->layoutcall = NULL;
-	}
 	#ifdef MASSIVEDEBUGGING
 	g_debug("Client signaling layout has changed.");
 	#endif 

=== modified file 'libdbusmenu-glib/server.c'
--- libdbusmenu-glib/server.c	2011-01-14 15:56:07 +0000
+++ libdbusmenu-glib/server.c	2011-01-18 18:39:57 +0000
@@ -506,6 +506,19 @@
 	if (error != NULL) {
 		g_warning("Unable to register object on bus: %s", error->message);
 		g_error_free(error);
+		return;
+	}
+
+	/* If we've got it registered let's tell everyone about it */
+	g_signal_emit(G_OBJECT(server), signals[LAYOUT_UPDATED], 0, priv->layout_revision, 0, TRUE);
+	if (priv->dbusobject != NULL && priv->bus != NULL) {
+		g_dbus_connection_emit_signal(priv->bus,
+		                              NULL,
+		                              priv->dbusobject,
+		                              DBUSMENU_INTERFACE,
+		                              "LayoutUpdated",
+		                              g_variant_new("(ui)", priv->layout_revision, 0),
+		                              NULL);
 	}
 
 	return;