[Rawstudio-commit] r1993 - trunk/src

Anders Brander anders at brander.dk
Sun Sep 14 21:41:23 CEST 2008


Author: abrander
Date: 2008-09-14 21:41:22 +0200 (Sun, 14 Sep 2008)
New Revision: 1993

Modified:
   trunk/src/gtk-helper.c
   trunk/src/gtk-helper.h
Log:
Added gui_button_new_from_stock_with_label().

Modified: trunk/src/gtk-helper.c
===================================================================
--- trunk/src/gtk-helper.c	2008-09-14 19:13:49 UTC (rev 1992)
+++ trunk/src/gtk-helper.c	2008-09-14 19:41:22 UTC (rev 1993)
@@ -1094,3 +1094,25 @@
 
 	return(dialog);
 }
+
+/**
+ * Creates a new GtkButton widget.
+ * @param stock_id A stock id registered with GTK+
+ * @param label The text to show besides the icon
+ * @return a new GtkButton
+ */
+GtkWidget *
+gui_button_new_from_stock_with_label(const gchar *stock_id, const gchar *label)
+{
+	GtkWidget *button;
+	GtkWidget *stock;
+
+	g_assert(stock_id);
+	g_assert(label);
+
+	stock = gtk_image_new_from_stock(stock_id, GTK_ICON_SIZE_BUTTON);
+	button = gtk_button_new_with_label(label);
+	gtk_button_set_image(GTK_BUTTON(button), stock);
+
+	return button;
+}

Modified: trunk/src/gtk-helper.h
===================================================================
--- trunk/src/gtk-helper.h	2008-09-14 19:13:49 UTC (rev 1992)
+++ trunk/src/gtk-helper.h	2008-09-14 19:41:22 UTC (rev 1993)
@@ -62,3 +62,11 @@
 
 extern GtkWidget *gui_dialog_make_from_text(const gchar *stock_id, gchar *primary_text, gchar *secondary_text);
 extern GtkWidget *gui_dialog_make_from_widget(const gchar *stock_id, gchar *primary_text, GtkWidget *widget);
+
+/**
+ * Creates a new GtkButton widget.
+ * @param stock_id A stock id registered with GTK+
+ * @param label The text to show besides the icon
+ * @return a new GtkButton
+ */
+extern GtkWidget *gui_button_new_from_stock_with_label(const gchar *stock_id, const gchar *label);




More information about the Rawstudio-commit mailing list