[gtk+/gtk-2-18] Correctly clone the toolbutton's icon-name image widget
- From: Matthias Clasen <matthiasc src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-18] Correctly clone the toolbutton's icon-name image widget
- Date: Sat, 13 Feb 2010 00:35:25 +0000 (UTC)
commit 015476b7706fa28000b1eb8c00dbc264aece576f
Author: Christian Persch <chpe gnome org>
Date: Tue Jan 26 15:41:00 2010 +0100
Correctly clone the toolbutton's icon-name image widget
Bug #608162.
(cherry picked from commit 9497a198f7c6fc528391648f5e85dfa09364fc74)
gtk/gtktoolbutton.c | 6 ++++++
tests/testtoolbar.c | 5 +++++
2 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtktoolbutton.c b/gtk/gtktoolbutton.c
index 5975a51..8707d37 100644
--- a/gtk/gtktoolbutton.c
+++ b/gtk/gtktoolbutton.c
@@ -595,6 +595,12 @@ clone_image_menu_size (GtkImage *image, GtkSettings *settings)
gtk_image_get_stock (image, &stock_id, NULL);
return gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_MENU);
}
+ else if (storage_type == GTK_IMAGE_ICON_NAME)
+ {
+ const gchar *icon_name;
+ gtk_image_get_icon_name (image, &icon_name, NULL);
+ return gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
+ }
else if (storage_type == GTK_IMAGE_ICON_SET)
{
GtkIconSet *icon_set;
diff --git a/tests/testtoolbar.c b/tests/testtoolbar.c
index 42e5fea..af7cbee 100644
--- a/tests/testtoolbar.c
+++ b/tests/testtoolbar.c
@@ -715,6 +715,11 @@ main (gint argc, gchar **argv)
add_item_to_list (store, item, "Video");
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
+ image = gtk_image_new_from_icon_name ("utility-terminal", GTK_ICON_SIZE_LARGE_TOOLBAR);
+ item = gtk_tool_button_new (image, "Terminal");
+ add_item_to_list (store, item, "Terminal");
+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
+
hbox = gtk_hbox_new (FALSE, 5);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
gtk_table_attach (GTK_TABLE (table), hbox,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]