← Back to team overview

ayatana-commits team mailing list archive

[Merge] lp:~ted/dbusmenu/only-top-first into lp:dbusmenu

 

Ted Gould has proposed merging lp:~ted/dbusmenu/only-top-first into lp:dbusmenu.

Requested reviews:
  DBus Menu Team (dbusmenu-team)


This switches around the way we break up property requests.  Currently we do it based on every level of the tree.  That makes some sense, but it probably broken up more than we need.  This changes it to force a flush at the top level, but then only every 100 menu entries after that.  This should reduce the number of dbus calls, but still get us the top level quickly.
-- 
https://code.launchpad.net/~ted/dbusmenu/only-top-first/+merge/38369
Your team ayatana-commits is subscribed to branch lp:dbusmenu.
=== modified file 'libdbusmenu-glib/client.c'
--- libdbusmenu-glib/client.c	2010-10-12 21:24:07 +0000
+++ libdbusmenu-glib/client.c	2010-10-13 20:52:50 +0000
@@ -43,6 +43,10 @@
 #include "server-marshal.h"
 #include "client-marshal.h"
 
+/* How many property requests should we queue before
+   sending the message on dbus */
+#define MAX_PROPERTIES_TO_QUEUE  100
+
 /* Properties */
 enum {
 	PROP_0,
@@ -628,6 +632,13 @@
 		priv->delayed_idle = g_idle_add(get_properties_idle, client);
 	}
 
+	/* Look at how many proprites we have queued up and
+	   make it so that we don't leave too many in one
+	   request. */
+	if (priv->delayed_property_listeners->len == MAX_PROPERTIES_TO_QUEUE) {
+		get_properties_flush(client);
+	}
+
 	return;
 }
 
@@ -1283,8 +1294,10 @@
 
 	/* We've got everything built up at this node and reconcilled */
 
-	/* Flush the properties requests */
-	get_properties_flush(client);
+	/* Flush the properties requests if this is the first level */
+	if (dbusmenu_menuitem_get_id(parent) == 0) {
+		get_properties_flush(client);
+	}
 
 	/* now it's time to recurse down the tree. */
 	children = node->children;


Follow ups