add new function gimp_stock_button_new() which creates a button with icon

2008-05-17  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpwidgets-constructors.[ch]: add new function
	gimp_stock_button_new() which creates a button with icon and label
	which is *not* the stock_id's label.

	* app/dialogs/preferences-dialog.c (prefs_button_add)
	* app/tools/gimplevelstool.c (gimp_levels_tool_dialog): use it.


svn path=/trunk/; revision=25688
This commit is contained in:
Michael Natterer 2008-05-17 14:29:25 +00:00 committed by Michael Natterer
parent a3bde5d64c
commit 2a38f864f2
5 changed files with 46 additions and 23 deletions

View file

@ -1,3 +1,12 @@
2008-05-17 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpwidgets-constructors.[ch]: add new function
gimp_stock_button_new() which creates a button with icon and label
which is *not* the stock_id's label.
* app/dialogs/preferences-dialog.c (prefs_button_add)
* app/tools/gimplevelstool.c (gimp_levels_tool_dialog): use it.
2008-05-17 Michael Natterer <mitch@gimp.org>
* app/widgets/gimphelp-ids.h: add help IDs for the stuff in the

View file

@ -49,6 +49,7 @@
#include "widgets/gimpprofilechooserdialog.h"
#include "widgets/gimppropwidgets.h"
#include "widgets/gimptemplateeditor.h"
#include "widgets/gimpwidgets-constructors.h"
#include "widgets/gimpwidgets-utils.h"
#include "menus/menus.h"
@ -1070,25 +1071,8 @@ prefs_button_add (const gchar *stock_id,
GtkBox *box)
{
GtkWidget *button;
GtkWidget *hbox;
GtkWidget *image;
GtkWidget *lab;
button = gtk_button_new ();
hbox = gtk_hbox_new (FALSE, 6);
gtk_container_add (GTK_CONTAINER (button), hbox);
gtk_widget_show (hbox);
image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_BUTTON);
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
gtk_widget_show (image);
lab = gtk_label_new_with_mnemonic (label);
gtk_label_set_mnemonic_widget (GTK_LABEL (lab), button);
gtk_box_pack_start (GTK_BOX (hbox), lab, TRUE, TRUE, 0);
gtk_widget_show (lab);
button = gimp_stock_button_new (stock_id, label);
gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0);
gtk_widget_show (button);

View file

@ -45,6 +45,7 @@
#include "widgets/gimphandlebar.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimphistogramview.h"
#include "widgets/gimpwidgets-constructors.h"
#include "display/gimpdisplay.h"
@ -680,9 +681,8 @@ gimp_levels_tool_dialog (GimpImageMapTool *image_map_tool)
G_CALLBACK (gimp_levels_tool_dialog_unmap),
tool);
button = gtk_button_new_from_stock (GIMP_STOCK_TOOL_LEVELS);
gtk_button_set_label (GTK_BUTTON (button),
_("Edit this Settings as Curves"));
button = gimp_stock_button_new (GIMP_STOCK_TOOL_LEVELS,
_("Edit this Settings as Curves"));
gtk_box_pack_start (GTK_BOX (image_map_tool->main_vbox), button,
FALSE, FALSE, 0);
gtk_widget_show (button);

View file

@ -173,6 +173,33 @@ gimp_paint_mode_menu_new (gboolean with_behind_mode,
return combo;
}
GtkWidget *
gimp_stock_button_new (const gchar *stock_id,
const gchar *label)
{
GtkWidget *button;
GtkWidget *hbox;
GtkWidget *image;
GtkWidget *lab;
button = gtk_button_new ();
hbox = gtk_hbox_new (FALSE, 6);
gtk_container_add (GTK_CONTAINER (button), hbox);
gtk_widget_show (hbox);
image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_BUTTON);
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
gtk_widget_show (image);
lab = gtk_label_new_with_mnemonic (label);
gtk_label_set_mnemonic_widget (GTK_LABEL (lab), button);
gtk_box_pack_start (GTK_BOX (hbox), lab, TRUE, TRUE, 0);
gtk_widget_show (lab);
return button;
}
/* private functions */

View file

@ -20,8 +20,11 @@
#define __GIMP_WIDGETS_CONSTRUCTORS_H__
GtkWidget * gimp_paint_mode_menu_new (gboolean with_behind_mode,
gboolean with_replace_modes);
GtkWidget * gimp_paint_mode_menu_new (gboolean with_behind_mode,
gboolean with_replace_modes);
GtkWidget * gimp_stock_button_new (const gchar *stock_id,
const gchar *label);
#endif /* __GIMP_WIDGETS_CONSTRUCTORS_H__ */