[Xfce4-commits] <ristretto:master> Add application-icon to the app-menu-item (used in the open-with menu)

Stephan Arts noreply at xfce.org
Thu Oct 8 22:56:01 CEST 2009


Updating branch refs/heads/master
         to 90722c427ac74f24eeaa67a9e0b6b5c526e8ca9f (commit)
       from e579136365068c799c6964dedf4ab2532a4e38e4 (commit)

commit 90722c427ac74f24eeaa67a9e0b6b5c526e8ca9f
Author: Stephan Arts <stephan at xfce.org>
Date:   Thu Oct 8 22:55:26 2009 +0200

    Add application-icon to the app-menu-item (used in the open-with menu)

 ChangeLog           |    5 +++++
 src/app_menu_item.c |   17 +++++++++++++----
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 520caea..e939b92 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-10-08  Stephan Arts <stephan at xfce.org>
+
+	* src/app_menu_item.c: Add application-icon to application-menu-item, used
+	  in the open-with menu.
+
 2009-10-03  Stephan Arts <stephan at xfce.org>
 
 	* src/main_window.c: Check if a desktop-manager is running before making
diff --git a/src/app_menu_item.c b/src/app_menu_item.c
index 5ef2f65..9b5c35f 100644
--- a/src/app_menu_item.c
+++ b/src/app_menu_item.c
@@ -37,7 +37,7 @@ static void
 rstto_app_menu_item_finalize(GObject *object);
 
 static void
-rstto_app_menu_item_activate (GObject *object);
+rstto_app_menu_item_activate (GtkMenuItem *object);
 
 GType
 rstto_app_menu_item_get_type (void)
@@ -105,14 +105,14 @@ rstto_app_menu_item_finalize(GObject *object)
 }
 
 static void
-rstto_app_menu_item_activate (GObject *object)
+rstto_app_menu_item_activate (GtkMenuItem *object)
 {
-    RsttoAppMenuItem *app_menu_item = RSTTO_APP_MENU_ITEM(object);
+    RsttoAppMenuItem *app_menu_item = RSTTO_APP_MENU_ITEM (object);
     GList *files = g_list_append (NULL, app_menu_item->priv->file);
 
     g_app_info_launch (app_menu_item->priv->app_info, files, NULL, NULL);
 
-    GTK_MENU_ITEM_CLASS(parent_class)->activate (RSTTO_APP_MENU_ITEM (object));
+    GTK_MENU_ITEM_CLASS(parent_class)->activate (GTK_MENU_ITEM (object));
 }
 
 
@@ -120,6 +120,8 @@ GtkWidget *
 rstto_app_menu_item_new (GAppInfo *app_info, GFile *file)
 {
     RsttoAppMenuItem *menu_item;
+    GtkWidget *image = NULL;
+    GIcon *icon = NULL;
 
     g_return_val_if_fail (app_info != NULL, NULL);
 
@@ -131,7 +133,14 @@ rstto_app_menu_item_new (GAppInfo *app_info, GFile *file)
     menu_item->priv->file = file;
     g_object_ref (file);
 
+    icon = g_app_info_get_icon (app_info);
+    if (icon)
+    {
+        image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_MENU);
+    }
+
     gtk_menu_item_set_label (GTK_MENU_ITEM (menu_item), g_app_info_get_name (app_info));
+    gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item), image);
 
     return GTK_WIDGET (menu_item);
 }



More information about the Xfce4-commits mailing list