aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-03-30 12:03:34 -0500
committerTed Gould <ted@gould.cx>2012-03-30 12:03:34 -0500
commitaa9f1edc44962334c34429d7c1fe30da79bcb557 (patch)
treeb9ba52feaf38106969d179becdb5ae8a67c0a882
parentcca3468ea7fcb8d4e96fb7af9b10ba9e23f49a25 (diff)
downloadlibdbusmenu-aa9f1edc44962334c34429d7c1fe30da79bcb557.tar.gz
libdbusmenu-aa9f1edc44962334c34429d7c1fe30da79bcb557.tar.bz2
libdbusmenu-aa9f1edc44962334c34429d7c1fe30da79bcb557.zip
Handle the case of sending to the idle.
-rw-r--r--libdbusmenu-glib/client.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c
index 3fb5e2c..5492d5b 100644
--- a/libdbusmenu-glib/client.c
+++ b/libdbusmenu-glib/client.c
@@ -1538,6 +1538,15 @@ menuitem_call_cb (GObject * proxy, GAsyncResult * res, gpointer userdata)
return;
}
+/* Group all the events into a single Dbus message and send
+ that out */
+static gboolean
+event_idle_cb (gpointer user_data)
+{
+ /* TODO: DO IT! */
+ return FALSE;
+}
+
/* Sends the event over DBus to the server on the other side
of the bus. */
void
@@ -1557,6 +1566,25 @@ dbusmenu_client_send_event (DbusmenuClient * client, gint id, const gchar * name
variant = g_variant_new_int32(0);
}
+ /* We want to collect as many events as we can */
+ if (priv->group_events) {
+ if (priv->event_idle == 0) {
+ priv->event_idle = g_idle_add(event_idle_cb, client);
+ g_variant_builder_init(&priv->events_to_go, G_VARIANT_TYPE("a(isvu)"));
+ }
+
+ GVariantBuilder tuple;
+ g_variant_builder_init(&tuple, G_VARIANT_TYPE_TUPLE);
+
+ g_variant_builder_add_value(&tuple, g_variant_new_int32(id));
+ g_variant_builder_add_value(&tuple, g_variant_new_string(name));
+ g_variant_builder_add_value(&tuple, variant);
+ g_variant_builder_add_value(&tuple, g_variant_new_uint32(timestamp));
+
+ g_variant_builder_add_value(&priv->events_to_go, g_variant_builder_end(&tuple));
+ return;
+ }
+
/* Don't bother with the reply handling if nobody is watching... */
if (!g_signal_has_handler_pending (client, signals[EVENT_RESULT], 0, TRUE)) {
g_dbus_proxy_call(priv->menuproxy,