diff options
author | Ted Gould <ted@gould.cx> | 2010-11-11 16:57:22 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-11-11 16:57:22 -0600 |
commit | 9f0ec1f915156311d8de7a629782252a4bce6e41 (patch) | |
tree | caa7344c54a2dc3dd5a26aa0d082887069be5bab | |
parent | 8eb4f8efd00978a1680ac7ebdd1907aa55eaba30 (diff) | |
download | libayatana-appindicator-9f0ec1f915156311d8de7a629782252a4bce6e41.tar.gz libayatana-appindicator-9f0ec1f915156311d8de7a629782252a4bce6e41.tar.bz2 libayatana-appindicator-9f0ec1f915156311d8de7a629782252a4bce6e41.zip |
Start to flesh out the nicks side of building the menu items
-rw-r--r-- | src/app-indicator.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/app-indicator.c b/src/app-indicator.c index 1805bd5..dc88e9b 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -37,6 +37,8 @@ License version 3 and version 2.1 along with this program. If not, see #include <libdbusmenu-glib/server.h> #include <libdbusmenu-gtk/client.h> +#include <libindicator/indicator-desktop-shortcuts.h> + #include "app-indicator.h" #include "app-indicator-enum-types.h" #include "application-service-marshal.h" @@ -2106,6 +2108,18 @@ app_indicator_get_ordering_index (AppIndicator *self) } } +#define APP_INDICATOR_SHORTY_NICK "app-indicator-shorty-nick" + +/* Callback when an item from the desktop shortcuts gets + called. */ +static void +shorty_activated_cb (DbusmenuMenuitem * mi, guint timestamp, gpointer user_data) +{ + + + return; +} + /** app_indicator_build_menu_from_desktop: @self: The #AppIndicator object to use @@ -2118,6 +2132,30 @@ void app_indicator_build_menu_from_desktop (AppIndicator * self, const gchar * desktop_file, const gchar * desktop_profile) { + /* Build a new shortcuts object */ + IndicatorDesktopShortcuts * shorties = indicator_desktop_shortcuts_new(desktop_file, desktop_profile); + g_return_if_fail(shorties != NULL); + const gchar ** nicks = indicator_desktop_shortcuts_get_nicks(shorties); + int nick_num; + /* Place the items on a dbusmenu */ + DbusmenuMenuitem * root = dbusmenu_menuitem_new(); + + for (nick_num = 0; nicks[nick_num] != NULL; nick_num++) { + DbusmenuMenuitem * item = dbusmenu_menuitem_new(); + g_object_set_data(G_OBJECT(item), APP_INDICATOR_SHORTY_NICK, (gpointer)nicks[nick_num]); + + gchar * name = indicator_desktop_shortcuts_nick_get_name(shorties, nicks[nick_num]); + dbusmenu_menuitem_property_set(item, DBUSMENU_MENUITEM_PROP_LABEL, name); + g_free(name); + + g_signal_connect(G_OBJECT(item), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(shorty_activated_cb), self); + + dbusmenu_menuitem_child_append(root, item); + } + + /* Swap it if needed */ + + return; } |