[gedit] Show icons in the recent files menuitems always. Fixes bug #590661.



commit 36eef75144209a835250968f8d5ebe6bb4401b3f
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Fri Jul 29 11:30:31 2011 +0200

    Show icons in the recent files menuitems always. Fixes bug #590661.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=590661

 gedit/gedit-window.c |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index 7d546ab..97c57a5 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -1392,6 +1392,9 @@ update_recent_files_menu (GeditWindow *window)
 		GtkAction *action;
 		GtkRecentInfo *info = l->data;
 		GFile *location;
+		const gchar *mime_type;
+		gchar *content_type;
+		GIcon *icon = NULL;
 
 		/* clamp */
 		if (i >= max_recents)
@@ -1430,10 +1433,20 @@ update_recent_files_menu (GeditWindow *window)
 		tip = g_strdup_printf (_("Open '%s'"), ruri);
 		g_free (ruri);
 
-		action = gtk_action_new (action_name,
-					 label,
-					 tip,
-					 NULL);
+		mime_type = gtk_recent_info_get_mime_type (info);
+		content_type = g_content_type_from_mime_type (mime_type);
+		if (content_type != NULL)
+		{
+			icon = g_content_type_get_icon (content_type);
+			g_free (content_type);
+		}
+
+		action = g_object_new (GTK_TYPE_ACTION,
+		                       "name", action_name,
+		                       "label", label,
+		                       "gicon", icon,
+		                       "always-show-image", TRUE,
+		                       NULL);
 
 		g_object_set_data_full (G_OBJECT (action),
 					"gtk-recent-info",



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]