[glib/wip/menus: 12/35] GActionGroupExporter: fixup signal emission
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/menus: 12/35] GActionGroupExporter: fixup signal emission
- Date: Sat, 22 Oct 2011 02:54:11 +0000 (UTC)
commit c7d96a6cc56fd59c670f8f0d0f701ade23ef0f89
Author: Ryan Lortie <desrt desrt ca>
Date: Thu Aug 25 11:51:26 2011 -0400
GActionGroupExporter: fixup signal emission
There were some bugs in the code that emits signals when the
GActionGroup changes. Fix those up.
gio/gactiongroupexporter.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/gio/gactiongroupexporter.c b/gio/gactiongroupexporter.c
index 0bdc5a8..0b77e01 100644
--- a/gio/gactiongroupexporter.c
+++ b/gio/gactiongroupexporter.c
@@ -158,9 +158,8 @@ g_action_group_exporter_dispatch_events (gpointer user_data)
/* Adds and removes are incompatible with enabled or state
* changes, but we must report at least one event.
*/
- g_assert (((ACTION_ENABLED_CHANGED_EVENT |
- ACTION_STATE_CHANGED_EVENT) == 0) !=
- ((ACTION_REMOVED_EVENT | ACTION_ADDED_EVENT) == 0));
+ g_assert (((events & (ACTION_ENABLED_CHANGED_EVENT | ACTION_STATE_CHANGED_EVENT)) == 0) !=
+ ((events & (ACTION_REMOVED_EVENT | ACTION_ADDED_EVENT)) == 0));
if (events & ACTION_REMOVED_EVENT)
g_variant_builder_add (&removes, "s", name);
@@ -187,10 +186,12 @@ g_action_group_exporter_dispatch_events (gpointer user_data)
GVariant *description;
description = g_action_group_describe_action (exporter->action_group, name);
- g_variant_builder_add (&state_changes, "{s@(bgav)}", name, description);
+ g_variant_builder_add (&adds, "{s@(bgav)}", name, description);
}
}
+ g_hash_table_remove_all (exporter->pending_changes);
+
g_dbus_connection_emit_signal (exporter->connection, NULL, exporter->object_path,
"org.gtk.Actions", "Changed",
g_variant_new ("(asa{sb}a{sv}a{s(bgav)})",
@@ -313,6 +314,8 @@ g_action_group_exporter_action_state_changed (GActionGroup *action_group,
*/
if (~event_mask & ACTION_ADDED_EVENT)
event_mask |= ACTION_STATE_CHANGED_EVENT;
+
+ g_action_group_exporter_set_events (exporter, action_name, event_mask);
}
static void
@@ -332,6 +335,8 @@ g_action_group_exporter_action_enabled_changed (GActionGroup *action_group,
if (~event_mask & ACTION_ADDED_EVENT)
event_mask |= ACTION_ENABLED_CHANGED_EVENT;
+
+ g_action_group_exporter_set_events (exporter, action_name, event_mask);
}
static void
@@ -513,6 +518,7 @@ g_action_group_exporter_export (GDBusConnection *connection,
}
g_hash_table_insert (exported_groups, action_group, exporter);
+ exporter->pending_changes = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
exporter->action_group = g_object_ref (action_group);
exporter->connection = g_object_ref (connection);
exporter->object_path = g_strdup (object_path);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]