aboutsummaryrefslogtreecommitdiff
path: root/src/app-section.c
diff options
context:
space:
mode:
authorLars Uebernickel <lars.uebernickel@canonical.com>2012-06-02 16:50:37 +0200
committerLars Uebernickel <lars.uebernickel@canonical.com>2012-06-02 16:50:37 +0200
commit7989e5c7bb1e012d3703716bfd54e20586bd412c (patch)
tree084b83d63e8e92344d8e83c8af0fb1e0836d31b6 /src/app-section.c
parent21f3cac4cb191430abf89b7cebd0093952c827b0 (diff)
downloadayatana-indicator-messages-7989e5c7bb1e012d3703716bfd54e20586bd412c.tar.gz
ayatana-indicator-messages-7989e5c7bb1e012d3703716bfd54e20586bd412c.tar.bz2
ayatana-indicator-messages-7989e5c7bb1e012d3703716bfd54e20586bd412c.zip
Listen to menus exported by applications
Diffstat (limited to 'src/app-section.c')
-rw-r--r--src/app-section.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/app-section.c b/src/app-section.c
index 6d00cf1..9a905bc 100644
--- a/src/app-section.c
+++ b/src/app-section.c
@@ -42,6 +42,8 @@ struct _AppSectionPrivate
GMenu *menu;
GSimpleActionGroup *static_shortcuts;
+
+ GMenuModel *remote_menu;
GActionGroup *actions;
guint name_watch_id;
@@ -158,12 +160,14 @@ app_section_dispose (GObject *object)
g_clear_object (&priv->menu);
g_clear_object (&priv->static_shortcuts);
- if (priv->actions) {
- g_clear_object (&priv->actions);
+ if (priv->name_watch_id) {
g_bus_unwatch_name (priv->name_watch_id);
priv->name_watch_id = 0;
}
+ g_clear_object (&priv->actions);
+ g_clear_object (&priv->remote_menu);
+
if (priv->ids != NULL) {
g_object_unref(priv->ids);
priv->ids = NULL;
@@ -366,12 +370,14 @@ app_section_set_object_path (AppSection *self,
{
AppSectionPrivate *priv = APP_SECTION_GET_PRIVATE (self);
- if (priv->actions) {
- g_clear_object (&priv->actions);
+ if (priv->remote_menu)
g_bus_unwatch_name (priv->name_watch_id);
- }
+ g_clear_object (&priv->actions);
+ g_clear_object (&priv->remote_menu);
priv->actions = G_ACTION_GROUP (g_dbus_action_group_get (bus, bus_name, object_path));
+ priv->remote_menu = G_MENU_MODEL (g_dbus_menu_model_get (bus, bus_name, object_path));
+
priv->name_watch_id = g_bus_watch_name_on_connection (bus, bus_name, 0,
NULL, application_vanished,
self, NULL);
@@ -390,9 +396,9 @@ app_section_unset_object_path (AppSection *self)
{
AppSectionPrivate *priv = APP_SECTION_GET_PRIVATE (self);
- if (priv->actions) {
- g_clear_object (&priv->actions);
+ if (priv->remote_menu)
g_bus_unwatch_name (priv->name_watch_id);
- }
+ g_clear_object (&priv->actions);
+ g_clear_object (&priv->remote_menu);
}