aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-glib/client.c
diff options
context:
space:
mode:
authorKen VanDine <ken.vandine@canonical.com>2010-11-17 15:35:34 -0500
committerKen VanDine <ken.vandine@canonical.com>2010-11-17 15:35:34 -0500
commitca1881e6cf5180215a3222f95b387c48f265184c (patch)
tree2075e0d9976ea51c39964137ef5dfca5c2e6e3d0 /libdbusmenu-glib/client.c
parentb353628b2659d06ad6e356cfbf017aa96cb4697e (diff)
parent395db9878504b28778b246ea658be5287e758e1f (diff)
downloadlibdbusmenu-ca1881e6cf5180215a3222f95b387c48f265184c.tar.gz
libdbusmenu-ca1881e6cf5180215a3222f95b387c48f265184c.tar.bz2
libdbusmenu-ca1881e6cf5180215a3222f95b387c48f265184c.zip
* New upstream release.
* Breaking ABI and getting reserved back * Adding build support for GTK2/3 builds * Only force a flush of top level items, allow others to be based on the count. * debian/control, debian/libdbusmenu-glib2.install, debian/libdbusmenu-gtk2.install: Switching package names to match .so bump.
Diffstat (limited to 'libdbusmenu-glib/client.c')
-rw-r--r--libdbusmenu-glib/client.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c
index ca16c9a..dae1dd7 100644
--- a/libdbusmenu-glib/client.c
+++ b/libdbusmenu-glib/client.c
@@ -43,6 +43,10 @@ License version 3 and version 2.1 along with this program. If not, see
#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,
@@ -62,7 +66,6 @@ enum {
static guint signals[LAST_SIGNAL] = { 0 };
-typedef struct _DbusmenuClientPrivate DbusmenuClientPrivate;
struct _DbusmenuClientPrivate
{
DbusmenuMenuitem * root;
@@ -113,8 +116,7 @@ struct _event_data_t {
};
-#define DBUSMENU_CLIENT_GET_PRIVATE(o) \
-(G_TYPE_INSTANCE_GET_PRIVATE ((o), DBUSMENU_TYPE_CLIENT, DbusmenuClientPrivate))
+#define DBUSMENU_CLIENT_GET_PRIVATE(o) (DBUSMENU_CLIENT(o)->priv)
/* GObject Stuff */
static void dbusmenu_client_class_init (DbusmenuClientClass *klass);
@@ -254,6 +256,8 @@ dbusmenu_client_class_init (DbusmenuClientClass *klass)
static void
dbusmenu_client_init (DbusmenuClient *self)
{
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE ((self), DBUSMENU_TYPE_CLIENT, DbusmenuClientPrivate);
+
DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(self);
priv->root = NULL;
@@ -628,6 +632,13 @@ get_properties_globber (DbusmenuClient * client, gint id, const gchar ** propert
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 @@ parse_layout_xml(DbusmenuClient * client, xmlNodePtr node, DbusmenuMenuitem * it
/* 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;