2 * Copyright (C) 2009 Red Hat, Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
22 /* various combinations of use_underline and use_stock */
24 int main (int argc, char *argv[])
26 GtkWidget *window, *box, *button, *hbox;
28 gboolean use_underline, use_stock;
29 GtkWidget *image, *label;
31 gtk_init (&argc, &argv);
33 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
35 box = gtk_vbox_new (0, FALSE);
37 gtk_container_add (GTK_CONTAINER (window), box);
39 hbox = gtk_hbox_new (0, FALSE);
40 gtk_container_add (GTK_CONTAINER (box), hbox);
41 button = gtk_button_new_from_stock (GTK_STOCK_SAVE);
42 gtk_container_add (GTK_CONTAINER (hbox), button);
46 "use-stock", &use_stock,
47 "use-underline", &use_underline,
50 text = g_strdup_printf ("label: \"%s\" image: %p use-stock: %s use-underline: %s\n", text, image, use_stock ? "TRUE" : "FALSE", use_underline ? "TRUE" : "FALSE");
51 label = gtk_label_new (text);
53 gtk_container_add (GTK_CONTAINER (hbox), label);
55 hbox = gtk_hbox_new (0, FALSE);
56 gtk_container_add (GTK_CONTAINER (box), hbox);
57 button = g_object_new (GTK_TYPE_BUTTON,
58 "label", "document-save",
61 gtk_container_add (GTK_CONTAINER (hbox), button);
65 "use-stock", &use_stock,
66 "use-underline", &use_underline,
69 text = g_strdup_printf ("label: \"%s\" image: %p use-stock: %s use-underline: %s\n", text, image, use_stock ? "TRUE" : "FALSE", use_underline ? "TRUE" : "FALSE");
70 label = gtk_label_new (text);
72 gtk_container_add (GTK_CONTAINER (hbox), label);
74 hbox = gtk_hbox_new (0, FALSE);
75 gtk_container_add (GTK_CONTAINER (box), hbox);
76 button = gtk_button_new_with_label ("_Save");
77 gtk_container_add (GTK_CONTAINER (hbox), button);
81 "use-stock", &use_stock,
82 "use-underline", &use_underline,
85 text = g_strdup_printf ("label: \"%s\" image: %p use-stock: %s use-underline: %s\n", text, image, use_stock ? "TRUE" : "FALSE", use_underline ? "TRUE" : "FALSE");
86 label = gtk_label_new (text);
88 gtk_container_add (GTK_CONTAINER (hbox), label);
90 hbox = gtk_hbox_new (0, FALSE);
91 gtk_container_add (GTK_CONTAINER (box), hbox);
92 button = gtk_button_new_with_mnemonic ("_Save");
93 gtk_container_add (GTK_CONTAINER (hbox), button);
97 "use-stock", &use_stock,
98 "use-underline", &use_underline,
101 text = g_strdup_printf ("label: \"%s\" image: %p use-stock: %s use-underline: %s\n", text, image, use_stock ? "TRUE" : "FALSE", use_underline ? "TRUE" : "FALSE");
102 label = gtk_label_new (text);
104 gtk_container_add (GTK_CONTAINER (hbox), label);
106 hbox = gtk_hbox_new (0, FALSE);
107 gtk_container_add (GTK_CONTAINER (box), hbox);
108 button = gtk_button_new_with_label ("_Save");
109 gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_stock (GTK_STOCK_ABOUT, GTK_ICON_SIZE_BUTTON));
110 gtk_container_add (GTK_CONTAINER (hbox), button);
112 g_object_get (button,
114 "use-stock", &use_stock,
115 "use-underline", &use_underline,
118 text = g_strdup_printf ("label: \"%s\" image: %p use-stock: %s use-underline: %s\n", text, image, use_stock ? "TRUE" : "FALSE", use_underline ? "TRUE" : "FALSE");
119 label = gtk_label_new (text);
121 gtk_container_add (GTK_CONTAINER (hbox), label);
123 hbox = gtk_hbox_new (0, FALSE);
124 gtk_container_add (GTK_CONTAINER (box), hbox);
125 button = gtk_button_new_with_mnemonic ("_Save");
126 gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_stock (GTK_STOCK_ABOUT, GTK_ICON_SIZE_BUTTON));
127 gtk_container_add (GTK_CONTAINER (hbox), button);
128 g_object_get (button,
130 "use-stock", &use_stock,
131 "use-underline", &use_underline,
134 text = g_strdup_printf ("label: \"%s\" image: %p use-stock: %s use-underline: %s\n", text, image, use_stock ? "TRUE" : "FALSE", use_underline ? "TRUE" : "FALSE");
135 label = gtk_label_new (text);
137 gtk_container_add (GTK_CONTAINER (hbox), label);
139 gtk_widget_show_all (window);