diff options
Diffstat (limited to 'src/im-desktop-menu.c')
-rw-r--r-- | src/im-desktop-menu.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/src/im-desktop-menu.c b/src/im-desktop-menu.c index 1040d62..834a8c9 100644 --- a/src/im-desktop-menu.c +++ b/src/im-desktop-menu.c @@ -18,6 +18,7 @@ */ #include "im-desktop-menu.h" +#include "indicator-desktop-shortcuts.h" #include <glib/gi18n.h> typedef ImMenuClass ImDesktopMenuClass; @@ -66,21 +67,28 @@ im_desktop_menu_app_added (ImApplicationList *applist, } /* application actions */ -#if 0 { - const gchar *const *actions; + const gchar * filename = NULL; + IndicatorDesktopShortcuts * shortcuts = NULL; + const gchar ** nicks = {NULL}; - for (actions = g_desktop_app_info_list_actions (app_info); *actions; actions++) - { - gchar *label; + filename = g_desktop_app_info_get_filename(app_info); + if (filename != NULL) + shortcuts = indicator_desktop_shortcuts_new(filename, "Messaging Menu"); - label = g_desktop_app_info_get_action_name (app_info, *actions); - g_menu_append (app_section, label, *actions); + if (shortcuts != NULL) + for (nicks = indicator_desktop_shortcuts_get_nicks(shortcuts); *nicks; nicks++) + { + gchar *label; - g_free (label); - } + label = indicator_desktop_shortcuts_nick_get_name (shortcuts, *nicks); + g_menu_append (app_section, label, *nicks); + + g_free (label); + } + + g_clear_object(&shortcuts); } -#endif source_section = g_menu_new (); @@ -89,7 +97,7 @@ im_desktop_menu_app_added (ImApplicationList *applist, g_menu_append_section (section, NULL, G_MENU_MODEL (source_section)); namespace = g_strconcat ("indicator.", app_id, NULL); - im_menu_insert_section (IM_MENU (menu), -1, namespace, G_MENU_MODEL (section)); + im_menu_insert_section (IM_MENU (menu), g_app_info_get_name(G_APP_INFO(app_info)), namespace, G_MENU_MODEL (section)); g_hash_table_insert (menu->source_sections, g_strdup (app_id), source_section); g_free (namespace); @@ -114,7 +122,8 @@ im_desktop_menu_source_added (ImApplicationList *applist, g_return_if_fail (source_section != NULL); action = g_strconcat ("src.", source_id, NULL); - item = g_menu_item_new (label, action); + item = g_menu_item_new (label, NULL); + g_menu_item_set_action_and_target_value(item, action, NULL); g_menu_item_set_attribute (item, "x-canonical-type", "s", "com.canonical.indicator.messages.source"); if (icon && *icon) g_menu_item_set_attribute (item, "icon", "s", icon); @@ -227,7 +236,7 @@ im_desktop_menu_constructed (GObject *object) GMenu *clear_section; clear_section = g_menu_new (); - g_menu_append (clear_section, "Clear", "indicator.remove-all"); + g_menu_append (clear_section, _("Clear"), "indicator.remove-all"); im_menu_append_section (IM_MENU (menu), G_MENU_MODEL (clear_section)); g_object_unref (clear_section); |