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, see <http://www.gnu.org/licenses/>.
25 GdkPixbuf *pixbuf, *otherpix;
26 GtkWidget *image, *image2, *hbox, *vbox, *label, *toplevel;
31 gtk_init (&argc, &argv);
33 pixbuf = gdk_pixbuf_new_from_file ("apple-red.png", NULL);
34 toplevel = gtk_window_new (GTK_WINDOW_TOPLEVEL);
35 hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
36 gtk_container_add (GTK_CONTAINER (toplevel), hbox);
38 vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
39 gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
41 image = gtk_image_new_from_gicon (G_ICON (pixbuf), GTK_ICON_SIZE_DIALOG);
42 gtk_box_pack_start (GTK_BOX (vbox), image, FALSE, FALSE, 0);
44 label = gtk_label_new (NULL);
45 str = g_strdup_printf ("Normal icon, hash %u", g_icon_hash (G_ICON (pixbuf)));
46 gtk_label_set_label (GTK_LABEL (label), str);
47 gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
49 otherpix = gdk_pixbuf_new_from_file ("gnome-textfile.png", NULL);
50 emblem = g_emblem_new (G_ICON (otherpix));
51 emblemed = g_emblemed_icon_new (G_ICON (pixbuf), emblem);
53 vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
54 gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
56 image2 = gtk_image_new_from_gicon (emblemed, GTK_ICON_SIZE_DIALOG);
57 gtk_box_pack_start (GTK_BOX (vbox), image2, FALSE, FALSE, 0);
59 label = gtk_label_new (NULL);
60 str = g_strdup_printf ("Emblemed icon, hash %u", g_icon_hash (emblemed));
61 gtk_label_set_label (GTK_LABEL (label), str);
62 gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
64 gtk_widget_show_all (toplevel);
66 g_signal_connect (toplevel, "delete-event",
67 G_CALLBACK (gtk_main_quit), NULL);