diff options
author | Matthias Clasen <mclasen@redhat.com> | 2014-12-02 19:54:33 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2014-12-02 21:00:24 -0500 |
commit | 5438e53f5cbd2775e01660c31cb36c6f0a1f070e (patch) | |
tree | 9b0a29f697cc20002413d01d6baadabf77fbdc47 /examples | |
parent | 6f10ed2711646b103c2994fef4677337f47a0298 (diff) | |
download | gtk+-5438e53f5cbd2775e01660c31cb36c6f0a1f070e.tar.gz |
Use resources for icons
This fixes icons after the recent directory reshuffling, and
is just the right thing to do, since these icons are in resources
anyway.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/bp/bloatpad.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/examples/bp/bloatpad.c b/examples/bp/bloatpad.c index 01a699842e..13efdcb7eb 100644 --- a/examples/bp/bloatpad.c +++ b/examples/bp/bloatpad.c @@ -257,6 +257,7 @@ new_window (GApplication *app, label = gtk_label_new ("Fullscreen:"); gtk_container_add (GTK_CONTAINER (box), label); sw = gtk_switch_new (); + gtk_widget_set_valign (sw, GTK_ALIGN_CENTER); gtk_actionable_set_action_name (GTK_ACTIONABLE (sw), "win.fullscreen"); gtk_container_add (GTK_CONTAINER (box), sw); gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (button)); @@ -518,12 +519,11 @@ bloat_pad_startup (GApplication *application) GtkApplication *app = GTK_APPLICATION (application); GMenu *menu; GMenuItem *item; + GBytes *bytes; GIcon *icon; GIcon *icon2; GEmblem *emblem; GFile *file; - gchar *data; - gsize size; gint i; struct { const gchar *action_and_target; @@ -548,7 +548,7 @@ bloat_pad_startup (GApplication *application) menu = gtk_application_get_menu_by_id (GTK_APPLICATION (application), "icon-menu"); - file = g_file_new_for_path (SRCDIR "/../../gtk/resources/icons/16x16/actions/gtk-select-color.png"); + file = g_file_new_for_uri ("resource:///org/gtk/libgtk/icons/16x16/actions/gtk-select-color.png"); icon = g_file_icon_new (file); item = g_menu_item_new ("File Icon", NULL); g_menu_item_set_icon (item, icon); @@ -564,31 +564,28 @@ bloat_pad_startup (GApplication *application) g_object_unref (item); g_object_unref (icon); - if (g_file_get_contents (SRCDIR "/../../gtk/resources/icons/16x16/actions/gtk-select-font.png", &data, &size, NULL)) - { - GBytes *bytes = g_bytes_new_take (data, size); - icon = g_bytes_icon_new (bytes); - item = g_menu_item_new ("Bytes Icon", NULL); - g_menu_item_set_icon (item, icon); - g_menu_append_item (menu, item); - g_object_unref (item); - g_object_unref (icon); - g_bytes_unref (bytes); - } + bytes = g_resources_lookup_data ("/org/gtk/libgtk/icons/16x16/actions/gtk-select-font.png", 0, NULL); + icon = g_bytes_icon_new (bytes); + item = g_menu_item_new ("Bytes Icon", NULL); + g_menu_item_set_icon (item, icon); + g_menu_append_item (menu, item); + g_object_unref (item); + g_object_unref (icon); + g_bytes_unref (bytes); - icon = G_ICON (gdk_pixbuf_new_from_file (SRCDIR "/../../gtk/resources/icons/16x16/actions/gtk-preferences.png", NULL)); + icon = G_ICON (gdk_pixbuf_new_from_resource ("/org/gtk/libgtk/icons/16x16/actions/gtk-preferences.png", NULL)); item = g_menu_item_new ("Pixbuf", NULL); g_menu_item_set_icon (item, icon); g_menu_append_item (menu, item); g_object_unref (item); g_object_unref (icon); - file = g_file_new_for_path (SRCDIR "/../../gtk/resources/icons/16x16/actions/gtk-page-setup.png"); + file = g_file_new_for_uri ("resource:///org/gtk/libgtk/icons/16x16/actions/gtk-page-setup.png"); icon = g_file_icon_new (file); emblem = g_emblem_new (icon); g_object_unref (icon); g_object_unref (file); - file = g_file_new_for_path (SRCDIR "/../../gtk/resources/icons/16x16/actions/gtk-orientation-reverse-portrait.png"); + file = g_file_new_for_uri ("resource:///org/gtk/libgtk/icons/16x16/actions/gtk-orientation-reverse-portrait.png"); icon2 = g_file_icon_new (file); icon = g_emblemed_icon_new (icon2, emblem); item = g_menu_item_new ("Emblemed Icon", NULL); |