aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-glib
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-03-30 10:32:36 -0500
committerTed Gould <ted@gould.cx>2012-03-30 10:32:36 -0500
commit37c153112c49f04f44cf1781ee49d369ac3ea84c (patch)
tree33973fd40a78994171f629b425ceb9c2f288af66 /libdbusmenu-glib
parentc02a1c5a7461c0df16428c6f5d0880c4cc502f38 (diff)
downloadlibdbusmenu-37c153112c49f04f44cf1781ee49d369ac3ea84c.tar.gz
libdbusmenu-37c153112c49f04f44cf1781ee49d369ac3ea84c.tar.bz2
libdbusmenu-37c153112c49f04f44cf1781ee49d369ac3ea84c.zip
Fleshing out the event group function
Diffstat (limited to 'libdbusmenu-glib')
-rw-r--r--libdbusmenu-glib/server.c49
1 files changed, 48 insertions, 1 deletions
diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c
index 04b9b68..ab1e0bc 100644
--- a/libdbusmenu-glib/server.c
+++ b/libdbusmenu-glib/server.c
@@ -1712,7 +1712,54 @@ bus_event (DbusmenuServer * server, GVariant * params, GDBusMethodInvocation * i
static void
bus_event_group (DbusmenuServer * server, GVariant * params, GDBusMethodInvocation * invocation)
{
- /* TODO: DO THIS */
+ DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server);
+
+ if (priv->root == NULL) {
+ g_dbus_method_invocation_return_error(invocation,
+ error_quark(),
+ NO_VALID_LAYOUT,
+ "There currently isn't a layout in this server");
+ return;
+ }
+
+ gint32 id;
+ gchar *etype;
+ GVariant *data;
+ guint32 ts;
+ GVariantIter iter;
+ GVariantBuilder builder;
+
+ g_variant_iter_init(&iter, params);
+ g_variant_builder_init(&builder, G_VARIANT_TYPE("ai"));
+ gboolean gotone = FALSE;
+
+ while (g_variant_iter_loop(&iter, "(isvu)", &id, &etype, &data, &ts)) {
+ if (bus_event_core(server, id, etype, data, ts)) {
+ gotone = TRUE;
+ } else {
+ g_variant_builder_add_value(&builder, g_variant_new_int32(id));
+ }
+ }
+
+ GVariant * errors = g_variant_builder_end(&builder);
+ g_variant_ref_sink(errors);
+
+ if (gotone) {
+ if (~g_dbus_message_get_flags (g_dbus_method_invocation_get_message (invocation)) & G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED) {
+ g_dbus_method_invocation_return_value(invocation, g_variant_new_tuple(&errors, 1));
+ }
+ } else {
+ gchar * ids = g_variant_print(errors, FALSE);
+ g_dbus_method_invocation_return_error(invocation,
+ error_quark(),
+ INVALID_MENUITEM_ID,
+ "The IDs supplied '%s' do not refer to any menu items we have",
+ ids);
+ g_free(ids);
+ }
+
+ g_variant_unref(errors);
+
return;
}