diff options
author | Ted Gould <ted@gould.cx> | 2010-02-17 12:31:25 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-02-17 12:31:25 -0600 |
commit | 379d88af9fd622801b4143169ec44c867d5cd533 (patch) | |
tree | e7304e65c7325e0d026ce18594ab57b4df0743c6 | |
parent | cccb9bc5f977a9d11ec3ee9b9055bbee3b2b6738 (diff) | |
download | ayatana-indicator-messages-379d88af9fd622801b4143169ec44c867d5cd533.tar.gz ayatana-indicator-messages-379d88af9fd622801b4143169ec44c867d5cd533.tar.bz2 ayatana-indicator-messages-379d88af9fd622801b4143169ec44c867d5cd533.zip |
Build us some shortcut menuitems
-rw-r--r-- | src/launcher-menu-item.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/launcher-menu-item.c b/src/launcher-menu-item.c index 238c4cf..c186e45 100644 --- a/src/launcher-menu-item.c +++ b/src/launcher-menu-item.c @@ -55,6 +55,7 @@ static void launcher_menu_item_init (LauncherMenuItem *self); static void launcher_menu_item_dispose (GObject *object); static void launcher_menu_item_finalize (GObject *object); static void activate_cb (LauncherMenuItem * self, guint timestamp, gpointer data); +static void nick_activate_cb (LauncherMenuItem * self, guint timestamp, gpointer data); G_DEFINE_TYPE (LauncherMenuItem, launcher_menu_item, DBUSMENU_TYPE_MENUITEM); @@ -151,9 +152,12 @@ launcher_menu_item_new (const gchar * desktop_file) LauncherMenuItemPrivate * priv = LAUNCHER_MENU_ITEM_GET_PRIVATE(self); + /* Parse the desktop file we've been given. */ priv->appinfo = G_APP_INFO(g_desktop_app_info_new_from_filename(desktop_file)); priv->desktop = g_strdup(desktop_file); + /* Set the appropriate values on this menu item based on the + app info that we've parsed */ g_debug("\tName: %s", launcher_menu_item_get_name(self)); dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_TYPE, LAUNCHER_MENUITEM_TYPE); dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), LAUNCHER_MENUITEM_PROP_APP_NAME, launcher_menu_item_get_name(self)); @@ -161,6 +165,21 @@ launcher_menu_item_new (const gchar * desktop_file) g_signal_connect(G_OBJECT(self), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb), NULL); + /* Start to build static shortcuts */ + priv->ids = indicator_desktop_shortcuts_new(priv->desktop, "Messaging Menu"); + const gchar ** nicks = indicator_desktop_shortcuts_get_nicks(priv->ids); + gint i; + for (i = 0; nicks[i] != NULL; i++) { + DbusmenuMenuitem * mi = dbusmenu_menuitem_new(); + g_object_set_data(G_OBJECT(mi), "ids-nick", (gpointer)nicks[i]); + + dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, indicator_desktop_shortcuts_nick_get_name(priv->ids, nicks[i])); + g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(nick_activate_cb), self); + + priv->shortcuts = g_list_append(priv->shortcuts, mi); + } + + /* Check to see if we should be eclipsed */ if (priv->appinfo == NULL) { launcher_menu_item_set_eclipsed(self, TRUE); } @@ -180,6 +199,13 @@ launcher_menu_item_get_name (LauncherMenuItem * appitem) } } +/* Respond to one of the shortcuts getting clicked on. */ +static void +nick_activate_cb (LauncherMenuItem * self, guint timestamp, gpointer data) +{ + +} + /* When the menu item is clicked on it tries to launch the application that is represented by the desktop file */ static void |