ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #00993
[Branch ~indicator-applet-developers/indicator-messages/trunk] Rev 165: Changing the applications to have icons.
Merge authors:
Ted Gould (ted)
------------------------------------------------------------
revno: 165 [merge]
committer: Ted Gould <ted@xxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-02-18 11:23:29 -0600
message:
Changing the applications to have icons.
modified:
src/app-menu-item.c
src/dbus-data.h
src/indicator-messages.c
src/launcher-menu-item.c
src/launcher-menu-item.h
--
lp:indicator-messages
https://code.launchpad.net/~indicator-applet-developers/indicator-messages/trunk
Your team ayatana-commits is subscribed to branch lp:indicator-messages.
To unsubscribe from this branch go to https://code.launchpad.net/~indicator-applet-developers/indicator-messages/trunk/+edit-subscription.
=== modified file 'src/app-menu-item.c'
--- src/app-menu-item.c 2010-02-18 14:41:56 +0000
+++ src/app-menu-item.c 2010-02-18 17:23:29 +0000
@@ -307,6 +307,12 @@
priv->desktop = g_strdup(value);
update_label(self);
+
+ GIcon * icon = g_app_info_get_icon(priv->appinfo);
+ gchar * iconstr = g_icon_to_string(icon);
+ dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_ICON_NAME, iconstr);
+ g_free(iconstr);
+
g_signal_emit(G_OBJECT(self), signals[NAME_CHANGED], 0, app_menu_item_get_name(self), TRUE);
return;
=== modified file 'src/dbus-data.h'
--- src/dbus-data.h 2009-09-04 22:14:23 +0000
+++ src/dbus-data.h 2010-02-18 03:36:33 +0000
@@ -8,10 +8,6 @@
#define INDICATOR_MESSAGES_DBUS_SERVICE_OBJECT "/org/ayatana/indicator/messages/service"
#define INDICATOR_MESSAGES_DBUS_SERVICE_INTERFACE "org.ayatana.indicator.messages.service"
-#define LAUNCHER_MENUITEM_TYPE "launcher-item"
-#define LAUNCHER_MENUITEM_PROP_APP_NAME "application-name"
-#define LAUNCHER_MENUITEM_PROP_APP_DESC "application-description"
-
#define APPLICATION_MENUITEM_TYPE "application-item"
#define APPLICATION_MENUITEM_PROP_NAME "app-name"
#define APPLICATION_MENUITEM_PROP_COUNT "app-count"
=== modified file 'src/indicator-messages.c'
--- src/indicator-messages.c 2009-12-18 21:43:41 +0000
+++ src/indicator-messages.c 2010-02-18 03:36:33 +0000
@@ -337,40 +337,6 @@
return TRUE;
}
-static gboolean
-new_launcher_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client)
-{
- g_return_val_if_fail(DBUSMENU_IS_MENUITEM(newitem), FALSE);
- g_return_val_if_fail(DBUSMENU_IS_GTKCLIENT(client), FALSE);
- /* Note: not checking parent, it's reasonable for it to be NULL */
-
- GtkMenuItem * gmi = GTK_MENU_ITEM(gtk_menu_item_new());
-
- GtkWidget * vbox = gtk_vbox_new(TRUE, 2);
-
- GtkWidget * app_label = gtk_label_new(dbusmenu_menuitem_property_get(newitem, LAUNCHER_MENUITEM_PROP_APP_NAME));
- gtk_misc_set_alignment(GTK_MISC(app_label), 0.0, 0.5);
- GtkWidget * dsc_label = gtk_label_new("");
- gtk_misc_set_alignment(GTK_MISC(dsc_label), 0.0, 0.5);
- gtk_label_set_ellipsize(GTK_LABEL(dsc_label), PANGO_ELLIPSIZE_END);
- gtk_widget_set_size_request(dsc_label, 200, -1);
- gchar * markup = g_markup_printf_escaped("<span font-size=\"smaller\">%s</span>", dbusmenu_menuitem_property_get(newitem, LAUNCHER_MENUITEM_PROP_APP_DESC));
- gtk_label_set_markup(GTK_LABEL(dsc_label), markup);
- g_free(markup);
-
- gtk_box_pack_start(GTK_BOX(vbox), app_label, FALSE, FALSE, 0);
- gtk_widget_show(app_label);
- gtk_box_pack_start(GTK_BOX(vbox), dsc_label, FALSE, FALSE, 0);
- gtk_widget_show(dsc_label);
-
- gtk_container_add(GTK_CONTAINER(gmi), GTK_WIDGET(vbox));
- gtk_widget_show(GTK_WIDGET(vbox));
-
- dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, gmi, parent);
-
- return TRUE;
-}
-
static GtkImage *
get_icon (IndicatorObject * io)
{
@@ -409,7 +375,6 @@
DbusmenuGtkMenu * menu = dbusmenu_gtkmenu_new(INDICATOR_MESSAGES_DBUS_NAME, INDICATOR_MESSAGES_DBUS_OBJECT);
DbusmenuGtkClient * client = dbusmenu_gtkmenu_get_client(menu);
- dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), LAUNCHER_MENUITEM_TYPE, new_launcher_item);
dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), INDICATOR_MENUITEM_TYPE, new_indicator_item);
return GTK_MENU(menu);
=== modified file 'src/launcher-menu-item.c'
--- src/launcher-menu-item.c 2010-02-17 19:40:20 +0000
+++ src/launcher-menu-item.c 2010-02-18 17:23:29 +0000
@@ -161,9 +161,10 @@
/* 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));
- 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);
dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
g_signal_connect(G_OBJECT(self), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb), NULL);
@@ -223,6 +224,20 @@
return;
}
+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
=== modified file 'src/launcher-menu-item.h'
--- src/launcher-menu-item.h 2010-02-17 17:56:03 +0000
+++ src/launcher-menu-item.h 2010-02-18 17:23:29 +0000
@@ -57,6 +57,7 @@
const gchar * launcher_menu_item_get_name (LauncherMenuItem * appitem);
const gchar * launcher_menu_item_get_desktop (LauncherMenuItem * launchitem);
const gchar * launcher_menu_item_get_description (LauncherMenuItem * li);
+gchar * launcher_menu_item_get_icon (LauncherMenuItem * appitem);
void launcher_menu_item_set_eclipsed (LauncherMenuItem * li, gboolean eclipsed);
gboolean launcher_menu_item_get_eclipsed (LauncherMenuItem * li);
GList * launcher_menu_item_get_items (LauncherMenuItem * li);