aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-glib
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-04-03 11:22:36 -0500
committerTed Gould <ted@gould.cx>2012-04-03 11:22:36 -0500
commit8c3fd4afb6b87184abb15567a93a7f426e6ecd41 (patch)
tree1cb531dc8f7dfb918f4f133e8600460a2e670452 /libdbusmenu-glib
parenta16815864fb248612e23d231b791422eb295b67d (diff)
downloadlibdbusmenu-8c3fd4afb6b87184abb15567a93a7f426e6ecd41.tar.gz
libdbusmenu-8c3fd4afb6b87184abb15567a93a7f426e6ecd41.tar.bz2
libdbusmenu-8c3fd4afb6b87184abb15567a93a7f426e6ecd41.zip
Setup our idle if we're grouping the events
Diffstat (limited to 'libdbusmenu-glib')
-rw-r--r--libdbusmenu-glib/client.c45
1 files changed, 37 insertions, 8 deletions
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c
index e570272..2ee081d 100644
--- a/libdbusmenu-glib/client.c
+++ b/libdbusmenu-glib/client.c
@@ -1852,6 +1852,19 @@ about_to_show_finish_pntr (gpointer data, gpointer user_data)
return about_to_show_finish((about_to_show_t *)data, GPOINTER_TO_INT(user_data));
}
+/* Function that gets called with all the queued about_to_show messages, let's
+ get these guys on the bus! */
+static gboolean
+about_to_show_idle (gpointer user_data)
+{
+ DbusmenuClient * client = DBUSMENU_CLIENT(user_data);
+ DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client);
+
+ priv->about_to_show_idle = 0;
+
+ return FALSE;
+}
+
/* Reports errors and responds to update request that were a result
of sending the about to show signal. */
static void
@@ -1896,14 +1909,30 @@ dbusmenu_client_send_about_to_show(DbusmenuClient * client, gint id, void (*cb)(
data->cb_data = cb_data;
g_object_ref(client);
- g_dbus_proxy_call(priv->menuproxy,
- "AboutToShow",
- g_variant_new("(i)", id),
- G_DBUS_CALL_FLAGS_NONE,
- -1, /* timeout */
- NULL, /* cancellable */
- about_to_show_cb,
- data);
+ if (priv->group_events) {
+ priv->about_to_show_to_go = g_list_prepend(priv->about_to_show_to_go, data);
+
+ if (priv->about_to_show_idle == 0) {
+ priv->about_to_show_idle = g_idle_add(about_to_show_idle, client);
+ }
+ } else {
+ /* If there's no callback we don't need this data, let's
+ clean it up in a consistent way */
+ if (cb == NULL) {
+ about_to_show_finish(data, FALSE);
+ data = NULL;
+ }
+
+ g_dbus_proxy_call(priv->menuproxy,
+ "AboutToShow",
+ g_variant_new("(i)", id),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1, /* timeout */
+ NULL, /* cancellable */
+ about_to_show_cb,
+ data);
+ }
+
return;
}