2 * Copyright (C) 2010 Red Hat, Inc.
3 * Authors: Cosimo Cecchi
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
27 GdkPixbuf *pixbuf, *otherpix;
28 GtkWidget *image, *image2, *hbox, *vbox, *label, *toplevel;
33 gtk_init (&argc, &argv);
35 pixbuf = gdk_pixbuf_new_from_file ("apple-red.png", NULL);
36 toplevel = gtk_window_new (GTK_WINDOW_TOPLEVEL);
37 hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
38 gtk_container_add (GTK_CONTAINER (toplevel), hbox);
40 vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
41 gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
43 image = gtk_image_new_from_gicon (G_ICON (pixbuf), GTK_ICON_SIZE_DIALOG);
44 gtk_box_pack_start (GTK_BOX (vbox), image, FALSE, FALSE, 0);
46 label = gtk_label_new (NULL);
47 str = g_strdup_printf ("Normal icon, hash %u", g_icon_hash (G_ICON (pixbuf)));
48 gtk_label_set_label (GTK_LABEL (label), str);
49 gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
51 otherpix = gdk_pixbuf_new_from_file ("gnome-textfile.png", NULL);
52 emblem = g_emblem_new (G_ICON (otherpix));
53 emblemed = g_emblemed_icon_new (G_ICON (pixbuf), emblem);
55 vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
56 gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
58 image2 = gtk_image_new_from_gicon (emblemed, GTK_ICON_SIZE_DIALOG);
59 gtk_box_pack_start (GTK_BOX (vbox), image2, FALSE, FALSE, 0);
61 label = gtk_label_new (NULL);
62 str = g_strdup_printf ("Emblemed icon, hash %u", g_icon_hash (emblemed));
63 gtk_label_set_label (GTK_LABEL (label), str);
64 gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
66 gtk_widget_show_all (toplevel);
68 g_signal_connect (toplevel, "delete-event",
69 G_CALLBACK (gtk_main_quit), NULL);