aboutsummaryrefslogtreecommitdiff
path: root/src/messages-service.c
diff options
context:
space:
mode:
authorLars Uebernickel <lars.uebernickel@canonical.com>2012-06-03 12:59:43 +0200
committerLars Uebernickel <lars.uebernickel@canonical.com>2012-06-03 12:59:43 +0200
commit98538a540ba7a741a68b4cff6d3e192a43d61077 (patch)
tree170fe2cc8c1168ac1497d2731f2cbb32710e54a4 /src/messages-service.c
parent76b172f49929b8feb1375df830042f6d47121f67 (diff)
downloadayatana-indicator-messages-98538a540ba7a741a68b4cff6d3e192a43d61077.tar.gz
ayatana-indicator-messages-98538a540ba7a741a68b4cff6d3e192a43d61077.tar.bz2
ayatana-indicator-messages-98538a540ba7a741a68b4cff6d3e192a43d61077.zip
Reexport application actions
Diffstat (limited to 'src/messages-service.c')
-rw-r--r--src/messages-service.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/messages-service.c b/src/messages-service.c
index ec12cbe..e302219 100644
--- a/src/messages-service.c
+++ b/src/messages-service.c
@@ -64,6 +64,22 @@ g_app_info_get_simple_id (GAppInfo *appinfo)
return g_strdup (id);
}
+static void
+actions_changed (GObject *object,
+ GParamSpec *pspec,
+ gpointer user_data)
+{
+ AppSection *section = APP_SECTION (object);
+ gchar *id;
+ GActionGroup *actions;
+
+ id = g_app_info_get_simple_id (app_section_get_app_info (section));
+ actions = app_section_get_actions (section);
+
+ g_action_muxer_insert (action_muxer, id, actions);
+ g_free (id);
+}
+
static AppSection *
add_application (const gchar *desktop_id)
{
@@ -86,6 +102,10 @@ add_application (const gchar *desktop_id)
section = app_section_new(appinfo);
g_hash_table_insert (applications, g_strdup (id), section);
+ g_action_muxer_insert (action_muxer, id, app_section_get_actions (section));
+ g_signal_connect (section, "notify::actions",
+ G_CALLBACK (actions_changed), NULL);
+
item = app_section_create_menu_item (section);
/* TODO insert it at the right position (alphabetically by application name) */
g_menu_insert_item (menu, 2, item);
@@ -137,6 +157,7 @@ remove_application (const char *desktop_id)
int pos = g_menu_find_section (menu, app_section_get_menu (section));
if (pos >= 0)
g_menu_remove (menu, pos);
+ g_action_muxer_remove (action_muxer, id);
}
else {
g_warning ("could not remove '%s', it's not registered", desktop_id);