aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-glib
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-03-30 11:16:56 -0500
committerTed Gould <ted@gould.cx>2012-03-30 11:16:56 -0500
commitc780e1632e57e24233ee374d96b74375c881696b (patch)
tree31e8f59333acc338e4646d70f1b0592890321449 /libdbusmenu-glib
parent89c84d51382ed5ea769d9ff40eed7062c06214fc (diff)
downloadlibdbusmenu-c780e1632e57e24233ee374d96b74375c881696b.tar.gz
libdbusmenu-c780e1632e57e24233ee374d96b74375c881696b.tar.bz2
libdbusmenu-c780e1632e57e24233ee374d96b74375c881696b.zip
Move the actual about-to-show call into the idle incase we get a ton of them (I'm looking at you HUD)
Diffstat (limited to 'libdbusmenu-glib')
-rw-r--r--libdbusmenu-glib/server.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c
index 289a332..2ba45d9 100644
--- a/libdbusmenu-glib/server.c
+++ b/libdbusmenu-glib/server.c
@@ -1764,6 +1764,18 @@ bus_event_group (DbusmenuServer * server, GVariant * params, GDBusMethodInvocati
return;
}
+/* Does the about-to-show in an idle loop so we don't block things */
+/* NOTE: this only works so easily as we don't return the value, if we
+ were to do that it would get more complex. */
+static gboolean
+bus_about_to_show_idle (gpointer user_data)
+{
+ DbusmenuMenuitem * mi = DBUSMENU_MENUITEM(user_data);
+ dbusmenu_menuitem_send_about_to_show(mi, NULL, NULL);
+ g_object_unref(mi);
+ return FALSE;
+}
+
/* Recieve the About To Show function. Pass it to our menu item. */
static void
bus_about_to_show (DbusmenuServer * server, GVariant * params, GDBusMethodInvocation * invocation)
@@ -1791,7 +1803,7 @@ bus_about_to_show (DbusmenuServer * server, GVariant * params, GDBusMethodInvoca
return;
}
- dbusmenu_menuitem_send_about_to_show(mi, NULL, NULL);
+ g_timeout_add(0, bus_about_to_show_idle, g_object_ref(mi));
/* GTK+ does not support about-to-show concept for now */
g_dbus_method_invocation_return_value(invocation,
@@ -1825,7 +1837,7 @@ bus_about_to_show_group (DbusmenuServer * server, GVariant * params, GDBusMethod
while (g_variant_iter_loop(&iter, "(i)", &id)) {
DbusmenuMenuitem * mi = lookup_menuitem_by_id(server, id);
if (mi != NULL) {
- dbusmenu_menuitem_send_about_to_show(mi, NULL, NULL);
+ g_timeout_add(0, bus_about_to_show_idle, g_object_ref(mi));
gotone = TRUE;
} else {
g_variant_builder_add_value(&builder, g_variant_new_int32(id));