Re: [Nautilus-list] toolbar icons patch



On Wed, 20 Feb 2002, Darin Adler wrote:

> > For the standard up button it's enough to adapt the new gtk naming scheme.
> > The setup function for special toolbar buttons (like back and forward)
> > falls back to the gtk stock icons if the theme doesn't provide own icons.
> > Unfourtunately this would require renaming the Back|Up|Forward.png theme
> > images to Go-Back|Go-Up|Go-Forward.png. Again, this is to be compatible
> > with the new gtk naming scheme.
> >
> > Is it ok to commit the patch in this form?
>
> I'm not really comfortable with the use of the deprecated g_strdown, and
> prepending "gtk-".
>
> Instead, lets just add a parameter to the set_up_bonobo_button functions for
> the name of the stock icon to be used if an icon file can't be found.

So, are you more comfortable with this revised patch? :)

I've leaved the need for renaming the icons in the patch. For the
Up.png image its neccessary and for the sake of consistency I think it's a
good idea to rename the other both too.

Regards,

   Jens


-- 
"Wer die Freiheit aufgibt, um Sicherheit zu gewinnen, wird am Ende beides
verlieren." -- Benjamin Franklin
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.5007
diff -u -p -r1.5007 ChangeLog
--- ChangeLog	2002/02/20 18:20:36	1.5007
+++ ChangeLog	2002/02/20 18:32:04
@@ -1,5 +1,13 @@
 2002-02-20  Jens Finke <jens triq net>
 
+	* src/nautilus-window-toolbars.c (set_up_special_bonobo_button):
+	Consider gtk stock items if there is no image with such a
+	filename.
+	(set_up_toolbar_images): Use Go-Up, Go-Back and Go-Forward as icon
+	names to fit into the new gtk stock naming scheme.
+
+2002-02-20  Jens Finke <jens triq net>
+
 	* src/file-manager/fm-desktop-icon-view.c
 	(change_background_callback): Call gnome2 background setting
 	program.
Index: src/nautilus-window-toolbars.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window-toolbars.c,v
retrieving revision 1.92
diff -u -p -r1.92 nautilus-window-toolbars.c
--- src/nautilus-window-toolbars.c	2002/02/14 23:21:58	1.92
+++ src/nautilus-window-toolbars.c	2002/02/20 18:32:04
@@ -252,22 +252,32 @@ static void
 set_up_special_bonobo_button (NautilusWindow            *window,
 			      BonoboUIToolbarButtonItem *item,
 			      const char                *control_path,
-			      const char                *icon_name)
+			      const char                *icon_name,
+			      const char                *stock_item_fallback)
 {
-	char *icon_file_name;
-	GdkPixbuf *pixbuf;	
+	char *icon_file_name = NULL;
+	gpointer image;
+	GtkStockItem stock_item;
 
 	icon_file_name = get_file_name_from_icon_name (icon_name, FALSE);
 
 	if (icon_file_name == NULL) {
-		return;
+		
+		if (gtk_stock_lookup (stock_item_fallback, &stock_item)) {
+			image = gtk_image_new_from_stock (stock_item_fallback, 
+							  GTK_ICON_SIZE_BUTTON);
+			if (image == NULL) return;
+			g_object_ref (image);
+		} else {
+			return;
+		}
+	} else {
+		image = gdk_pixbuf_new_from_file (icon_file_name, NULL);
+		g_free (icon_file_name);
 	}
-
-	pixbuf = gdk_pixbuf_new_from_file (icon_file_name, NULL);
-	g_free (icon_file_name);
 	
-	bonobo_ui_toolbar_button_item_set_image (item, pixbuf);
-	g_object_unref (pixbuf);
+	bonobo_ui_toolbar_button_item_set_image (item, image);
+	g_object_unref (image);
 }			      
 
 static void
@@ -277,10 +287,10 @@ set_up_toolbar_images (NautilusWindow *w
 
 	bonobo_ui_component_freeze (window->details->shell_ui, NULL);
 
-	set_up_special_bonobo_button (window, window->details->back_button_item, "/Toolbar/BackWrapper", "Back");
-	set_up_special_bonobo_button (window, window->details->forward_button_item, "/Toolbar/ForwardWrapper", "Forward");
+	set_up_special_bonobo_button (window, window->details->back_button_item, "/Toolbar/BackWrapper", "Go-Back", GTK_STOCK_GO_BACK);
+	set_up_special_bonobo_button (window, window->details->forward_button_item, "/Toolbar/ForwardWrapper", "Go-Forward", GTK_STOCK_GO_FORWARD);
 	
-	set_up_standard_bonobo_button (window, "/Toolbar/Up", "Up", FALSE);
+	set_up_standard_bonobo_button (window, "/Toolbar/Up", "Go-Up", FALSE);
 	set_up_standard_bonobo_button (window, "/Toolbar/Home", "Home", FALSE);
 	set_up_standard_bonobo_button (window, "/Toolbar/Reload", "Refresh", FALSE);
 	set_up_standard_bonobo_button (window, "/Toolbar/Toggle Find Mode", "Search", FALSE);


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