← Back to team overview

ayatana-commits team mailing list archive

[Branch ~dbusmenu-team/dbusmenu/trunk] Rev 168: Only force a flush for the top level of items.

 

Merge authors:
  Ted Gould (ted)
Related merge proposals:
  https://code.launchpad.net/~ted/dbusmenu/only-top-first/+merge/38369
  proposed by: Ted Gould (ted)
  review: Approve - Cody Russell (bratsche)
------------------------------------------------------------
revno: 168 [merge]
committer: Ted Gould <ted@xxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-10-14 08:57:10 -0500
message:
  Only force a flush for the top level of items.
modified:
  libdbusmenu-glib/client.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	2010-10-12 21:24:07 +0000
+++ libdbusmenu-glib/client.c	2010-10-14 13:57:10 +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;