From cac9ec783a2fd4a15635ebf015eb5a775711ed78 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 17 Feb 2010 21:33:57 -0600 Subject: Switch to having a launcher be a standard item with an icon. --- src/launcher-menu-item.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'src/launcher-menu-item.c') diff --git a/src/launcher-menu-item.c b/src/launcher-menu-item.c index 50e8ce6..1573367 100644 --- a/src/launcher-menu-item.c +++ b/src/launcher-menu-item.c @@ -131,9 +131,10 @@ launcher_menu_item_new (const gchar * desktop_file) priv->desktop = g_strdup(desktop_file); 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)); - dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), LAUNCHER_MENUITEM_PROP_APP_DESC, launcher_menu_item_get_description(self)); + dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_LABEL, launcher_menu_item_get_name(self)); + gchar * iconstr = launcher_menu_item_get_icon(self); + dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_ICON_NAME, iconstr); + g_free(iconstr); g_signal_connect(G_OBJECT(self), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb), NULL); @@ -156,6 +157,20 @@ launcher_menu_item_get_name (LauncherMenuItem * appitem) } } +gchar * +launcher_menu_item_get_icon (LauncherMenuItem * appitem) +{ + LauncherMenuItemPrivate * priv = LAUNCHER_MENU_ITEM_GET_PRIVATE(appitem); + + if (priv->appinfo == NULL) { + return NULL; + } else { + GIcon * icon = g_app_info_get_icon(priv->appinfo); + gchar * iconstr = g_icon_to_string(icon); + return iconstr; + } +} + /* When the menu item is clicked on it tries to launch the application that is represented by the desktop file */ static void -- cgit v1.2.3