[PATCH] Use normal stock button in filechooser



While checking out the new setting to not use images in stock buttons,
I noticed the Add and Remove buttons in the file chooser ignore the
setting. The function button_new() does little more than would calling
gtk_button_new_from_stock(). Is there a reason to not use the standard
stock button?  If not, a patch is attached.

Cheers,
Greg
Index: gtk/gtkfilechooserdefault.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkfilechooserdefault.c,v
retrieving revision 1.137
diff -p -u -r1.137 gtkfilechooserdefault.c
--- gtk/gtkfilechooserdefault.c	11 Mar 2004 06:24:15 -0000	1.137
+++ gtk/gtkfilechooserdefault.c	11 Mar 2004 11:48:18 -0000
@@ -1441,44 +1441,6 @@ filter_create (GtkFileChooserDefault *im
   return impl->filter_combo;
 }
 
-static GtkWidget *
-button_new (GtkFileChooserDefault *impl,
-	    const char *text,
-	    const char *stock_id,
-	    gboolean    sensitive,
-	    gboolean    show,
-	    GCallback   callback)
-{
-  GtkWidget *button;
-  GtkWidget *hbox;
-  GtkWidget *widget;
-  GtkWidget *align;
-
-  button = gtk_button_new ();
-  hbox = gtk_hbox_new (FALSE, 2);
-  align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
-
-  gtk_container_add (GTK_CONTAINER (button), align);
-  gtk_container_add (GTK_CONTAINER (align), hbox);
-  widget = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_BUTTON);
-
-  gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
-
-  widget = gtk_label_new_with_mnemonic (text);
-  gtk_label_set_mnemonic_widget (GTK_LABEL (widget), GTK_WIDGET (button));
-  gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
-
-  gtk_widget_set_sensitive (button, sensitive);
-  g_signal_connect (button, "clicked", callback, impl);
-
-  gtk_widget_show_all (align);
-
-  if (show)
-    gtk_widget_show (button);
-
-  return button;
-}
-
 /* Looks for a path among the shortcuts; returns its index or -1 if it doesn't exist */
 static int
 shortcut_find_position (GtkFileChooserDefault *impl,
@@ -2429,22 +2391,20 @@ shortcuts_pane_create (GtkFileChooserDef
 
   /* Add bookmark button */
 
-  impl->browse_shortcuts_add_button = button_new (impl,
-						  _("_Add"),
-						  GTK_STOCK_ADD,
-						  FALSE,
-						  TRUE,
-						  G_CALLBACK (add_bookmark_button_clicked_cb));
+  impl->browse_shortcuts_add_button = gtk_button_new_from_stock (GTK_STOCK_ADD);
+  gtk_widget_set_sensitive (impl->browse_shortcuts_add_button, FALSE);
+  g_signal_connect (impl->browse_shortcuts_add_button, "clicked",
+		    G_CALLBACK (add_bookmark_button_clicked_cb), impl);
+  gtk_widget_show (impl->browse_shortcuts_add_button);
   gtk_box_pack_start (GTK_BOX (hbox), impl->browse_shortcuts_add_button, TRUE, TRUE, 0);
 
   /* Remove bookmark button */
 
-  impl->browse_shortcuts_remove_button = button_new (impl,
-						     _("_Remove"),
-						     GTK_STOCK_REMOVE,
-						     FALSE,
-						     TRUE,
-						     G_CALLBACK (remove_bookmark_button_clicked_cb));
+  impl->browse_shortcuts_remove_button = gtk_button_new_from_stock (GTK_STOCK_REMOVE);
+  gtk_widget_set_sensitive (impl->browse_shortcuts_remove_button, FALSE);
+  g_signal_connect (impl->browse_shortcuts_remove_button, "clicked",
+		    G_CALLBACK (remove_bookmark_button_clicked_cb), impl);
+  gtk_widget_show (impl->browse_shortcuts_remove_button);
   gtk_box_pack_start (GTK_BOX (hbox), impl->browse_shortcuts_remove_button, TRUE, TRUE, 0);
 
   return vbox;


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