Fix ui_button_new_with_image() to call gtk_button_set_image() so
that gtk_button_[sg]et_label() work as expected. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@4753 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
31cedd30ba
commit
c5b2588e4f
@ -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>
|
2010-03-10 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
||||||
|
|
||||||
* doc/geany.txt, doc/geany.html:
|
* doc/geany.txt, doc/geany.html:
|
||||||
|
@ -1278,7 +1278,7 @@ GtkWidget *ui_dialog_vbox_new(GtkDialog *dialog)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** 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().
|
* @c gtk_button_new_from_stock().
|
||||||
* @param stock_id A @c GTK_STOCK_NAME string.
|
* @param stock_id A @c GTK_STOCK_NAME string.
|
||||||
* @param text Button label text, can include mnemonics.
|
* @param text Button label text, can include mnemonics.
|
||||||
@ -1286,19 +1286,13 @@ GtkWidget *ui_dialog_vbox_new(GtkDialog *dialog)
|
|||||||
*/
|
*/
|
||||||
GtkWidget *ui_button_new_with_image(const gchar *stock_id, const gchar *text)
|
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);
|
image = gtk_image_new_from_stock(stock_id, GTK_ICON_SIZE_BUTTON);
|
||||||
label = gtk_label_new_with_mnemonic(text);
|
gtk_button_set_image(GTK_BUTTON(button), image);
|
||||||
gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0);
|
/* note: image is shown by gtk */
|
||||||
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);
|
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user