Commit b87add63 authored by Matthias Clasen's avatar Matthias Clasen

Properly create a menu proxy from a GIcon. Patch by Christian Persch


       * gtk/gtktoolbutton.c: Properly create a menu proxy from a GIcon.
        Patch by Christian Persch

        * tests/testtoolbar.c: Add an example with a GIcon


svn path=/trunk/; revision=22084
parent ca2cfa09
2009-01-11 Matthias Clasen <mclasen@redhat.com>
Bug 567024 – gtktoolbutton doesn't create right proxy menu item
image with GIcon
* gtk/gtktoolbutton.c: Properly create a menu proxy from a GIcon.
Patch by Christian Persch
* tests/testtoolbar.c: Add an example with a GIcon
2009-01-09 Christian Dywan <christian@imendio.com> 2009-01-09 Christian Dywan <christian@imendio.com>
Fail in gdk_window_new if _gdk_window_new failed Fail in gdk_window_new if _gdk_window_new failed
......
...@@ -579,6 +579,12 @@ clone_image_menu_size (GtkImage *image, GtkSettings *settings) ...@@ -579,6 +579,12 @@ clone_image_menu_size (GtkImage *image, GtkSettings *settings)
gtk_image_get_icon_set (image, &icon_set, NULL); gtk_image_get_icon_set (image, &icon_set, NULL);
return gtk_image_new_from_icon_set (icon_set, GTK_ICON_SIZE_MENU); return gtk_image_new_from_icon_set (icon_set, GTK_ICON_SIZE_MENU);
} }
else if (storage_type == GTK_IMAGE_GICON)
{
GIcon *icon;
gtk_image_get_gicon (image, &icon, NULL);
return gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_MENU);
}
else if (storage_type == GTK_IMAGE_PIXBUF) else if (storage_type == GTK_IMAGE_PIXBUF)
{ {
gint width, height; gint width, height;
......
...@@ -511,6 +511,7 @@ main (gint argc, gchar **argv) ...@@ -511,6 +511,7 @@ main (gint argc, gchar **argv)
GtkWidget *menuitem; GtkWidget *menuitem;
GtkWidget *button; GtkWidget *button;
GtkWidget *label; GtkWidget *label;
GIcon *gicon;
GSList *group; GSList *group;
gtk_init (&argc, &argv); gtk_init (&argc, &argv);
...@@ -706,7 +707,14 @@ main (gint argc, gchar **argv) ...@@ -706,7 +707,14 @@ main (gint argc, gchar **argv)
add_item_to_list (store, item, "Apple"); add_item_to_list (store, item, "Apple");
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
gtk_tool_button_set_use_underline (GTK_TOOL_BUTTON (item), TRUE); gtk_tool_button_set_use_underline (GTK_TOOL_BUTTON (item), TRUE);
gicon = g_content_type_get_icon ("video/ogg");
image = gtk_image_new_from_gicon (gicon, GTK_ICON_SIZE_LARGE_TOOLBAR);
g_object_unref (gicon);
item = gtk_tool_button_new (image, "Video");
add_item_to_list (store, item, "Video");
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
hbox = gtk_hbox_new (FALSE, 5); hbox = gtk_hbox_new (FALSE, 5);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 5); gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
gtk_table_attach (GTK_TABLE (table), hbox, gtk_table_attach (GTK_TABLE (table), hbox,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment