[PATCH] Show icons for trash, cd burner and computer



Hi,


Now:
* The CD burner menuitem does not have an icon and the window just has a folder icon.
* The computer window has a folder icon.
* Trash menuitem has no icon
After attached patch is applied:
* They have an appropriate icon
Especially the window icons are a big help finding back the burn or the computer window.

Only weird thing is that the trash icon looks a bit funny in the menu. The trash can (at least with the default gnome icons) seems a bit to slim, when you compare it with the icon on the desktop. It looks like that not both axes are scaled with the same amount (the other attachment shows this). It is I guess also caused by the fact that the 48x48 trash icon is actually 58x44 (Anybody knows why???)

I think that the wrong scaling is not caused by my patch or nautilus but
somewhere in GTK, where the gtkactionentries are assigned to the menus.
However I got a bit lost when looking for the place where this happened. (I'm relatively new to gnome programming)

leaving out the trash can could also be an option.


Jaap

Bug report can also be found here http://bugzilla.gnome.org/show_bug.cgi?id=162750
Index: nautilus-main.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-main.c,v
retrieving revision 1.138
diff -u -r1.138 nautilus-main.c
--- nautilus-main.c	22 Nov 2004 15:24:37 -0000	1.138
+++ nautilus-main.c	2 Jan 2005 21:42:38 -0000
@@ -135,30 +135,34 @@
 	GtkIconSource *source;
 	GtkIconSet *set;
 	GtkIconFactory *factory;
+	const char *icons_to_register[] = {"gnome-fs-client", "gnome-fs-trash-empty", "gnome-dev-cdrom"};
+	int i;
 
 	icon_theme = nautilus_icon_factory_get_icon_theme ();
-	info = gtk_icon_theme_lookup_icon (icon_theme, "gnome-fs-client", 48,
-					   0);
-	if (info != NULL) {
-		icon = gtk_icon_info_get_filename (info);
-		factory = gtk_icon_factory_new ();
-		gtk_icon_factory_add_default (factory);
-		
-		source = gtk_icon_source_new ();
-		gtk_icon_source_set_filename (source, icon);
+
+	factory = gtk_icon_factory_new ();
+	gtk_icon_factory_add_default (factory);
+	for (i = 0; i < G_N_ELEMENTS(icons_to_register); i++) {
+
+		info = gtk_icon_theme_lookup_icon (icon_theme, icons_to_register[i], 48, 0);
+
+		if (info != NULL) {
+			icon = gtk_icon_info_get_filename (info);		
+			source = gtk_icon_source_new ();
+			gtk_icon_source_set_filename (source, icon);
 		
-		set = gtk_icon_set_new ();
-		gtk_icon_set_add_source (set, source);
+			set = gtk_icon_set_new ();
+			gtk_icon_set_add_source (set, source);
 
-		gtk_icon_factory_add (factory, "gnome-fs-client", set);
-		gtk_icon_set_unref (set);
+			gtk_icon_factory_add (factory, icons_to_register[i], set);
+			gtk_icon_set_unref (set);
 		
-		gtk_icon_source_free (source);
+			gtk_icon_source_free (source);
 
-		gtk_icon_info_free (info);
-		g_object_unref (factory);
+			gtk_icon_info_free (info);
+		}
 	}
-	
+	g_object_unref (factory);	
 	g_object_unref (icon_theme);
 	
 }
Index: nautilus-window-menus.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window-menus.c,v
retrieving revision 1.274
diff -u -r1.274 nautilus-window-menus.c
--- nautilus-window-menus.c	22 Nov 2004 15:24:37 -0000	1.274
+++ nautilus-window-menus.c	2 Jan 2005 21:42:39 -0000
@@ -638,11 +638,11 @@
     N_("T_emplates"), NULL,           /* label, accelerator */
     N_("Go to the templates folder"),                                  /* tooltip */ 
     G_CALLBACK (action_go_to_templates_callback) },
-  { "Go to Trash", NULL,                        /* name, stock id */
+  { "Go to Trash", "gnome-fs-trash-empty",                        /* name, stock id */
     N_("_Trash"), NULL,           /* label, accelerator */
     N_("Go to the trash folder"),                                  /* tooltip */ 
     G_CALLBACK (action_go_to_trash_callback) },
-  { "Go to Burn CD", NULL,                        /* name, stock id */
+  { "Go to Burn CD", "gnome-dev-cdrom",                        /* name, stock id */
     N_("CD _Creator"), NULL,           /* label, accelerator */
     N_("Go to the CD/DVD Creator"),                                  /* tooltip */ 
     G_CALLBACK (action_go_to_burn_cd_callback) },
Index: nautilus-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window.c,v
retrieving revision 1.438
diff -u -r1.438 nautilus-window.c
--- nautilus-window.c	22 Nov 2004 15:24:37 -0000	1.438
+++ nautilus-window.c	2 Jan 2005 21:42:40 -0000
@@ -1103,6 +1103,7 @@
 {
 	GdkPixbuf *pixbuf;
         GtkIconTheme *icon_theme;
+	char *uri;
 
 	pixbuf = NULL;
 	
@@ -1114,10 +1115,30 @@
 						   0, NULL);
                 g_object_unref(icon_theme);
 
-	} else {
-		pixbuf = nautilus_icon_factory_get_pixbuf_for_file (window->details->viewed_file,
-								    "open",
-								    NAUTILUS_ICON_SIZE_STANDARD);
+	} else if (window->details->viewed_file != NULL){
+
+		uri = nautilus_file_get_uri(window->details->viewed_file);
+
+		if (strcmp (uri, "computer:///") == 0) {
+                	icon_theme = nautilus_icon_factory_get_icon_theme ();
+                	pixbuf = gtk_icon_theme_load_icon (icon_theme,
+						   	   "gnome-fs-client", 48,
+						   	   0, NULL);
+                	g_object_unref(icon_theme);
+
+		} else if (strcmp (uri, "burn:///") == 0) {
+                	icon_theme = nautilus_icon_factory_get_icon_theme ();
+                	pixbuf = gtk_icon_theme_load_icon (icon_theme,
+						   	   "gnome-dev-cdrom", 48,
+						   	   0, NULL);
+                	g_object_unref(icon_theme);
+                } else {
+			pixbuf = nautilus_icon_factory_get_pixbuf_for_file (window->details->viewed_file,
+								    	    "open",
+								            NAUTILUS_ICON_SIZE_STANDARD);
+		}
+		g_free (uri); 
+
 	}
 
 	if (pixbuf != NULL) {

PNG image



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