SF.net SVN: geany:[4753] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Fri Mar 12 11:23:22 UTC 2010
Revision: 4753
http://geany.svn.sourceforge.net/geany/?rev=4753&view=rev
Author: ntrel
Date: 2010-03-12 11:23:22 +0000 (Fri, 12 Mar 2010)
Log Message:
-----------
Fix ui_button_new_with_image() to call gtk_button_set_image() so
that gtk_button_[sg]et_label() work as expected.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/ui_utils.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2010-03-10 16:30:15 UTC (rev 4752)
+++ trunk/ChangeLog 2010-03-12 11:23:22 UTC (rev 4753)
@@ -1,3 +1,10 @@
+2010-03-12 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/ui_utils.c:
+ Fix ui_button_new_with_image() to call gtk_button_set_image() so
+ that gtk_button_[sg]et_label() work as expected.
+
+
2010-03-10 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* doc/geany.txt, doc/geany.html:
Modified: trunk/src/ui_utils.c
===================================================================
--- trunk/src/ui_utils.c 2010-03-10 16:30:15 UTC (rev 4752)
+++ trunk/src/ui_utils.c 2010-03-12 11:23:22 UTC (rev 4753)
@@ -1278,7 +1278,7 @@
}
-/** Create a @c GtkButton with custom text and a stock image, aligned like
+/** Creates a @c GtkButton with custom text and a stock image similar to
* @c gtk_button_new_from_stock().
* @param stock_id A @c GTK_STOCK_NAME string.
* @param text Button label text, can include mnemonics.
@@ -1286,19 +1286,13 @@
*/
GtkWidget *ui_button_new_with_image(const gchar *stock_id, const gchar *text)
{
- GtkWidget *image, *label, *align, *hbox, *button;
+ GtkWidget *image, *button;
- hbox = gtk_hbox_new(FALSE, 2);
+ button = gtk_button_new_with_mnemonic(text);
+ gtk_widget_show(button);
image = gtk_image_new_from_stock(stock_id, GTK_ICON_SIZE_BUTTON);
- label = gtk_label_new_with_mnemonic(text);
- gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0);
- gtk_box_pack_end(GTK_BOX(hbox), label, FALSE, FALSE, 0);
-
- button = gtk_button_new();
- align = gtk_alignment_new(0.5, 0.5, 0.0, 0.0);
- gtk_container_add(GTK_CONTAINER(align), hbox);
- gtk_container_add(GTK_CONTAINER(button), align);
- gtk_widget_show_all(align);
+ gtk_button_set_image(GTK_BUTTON(button), image);
+ /* note: image is shown by gtk */
return button;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list