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, see <http://www.gnu.org/licenses/>.
20 /* various combinations of use_underline and use_stock */
22 int main (int argc, char *argv[])
24 GtkWidget *window, *box, *button, *hbox;
26 gboolean use_underline, use_stock;
27 GtkWidget *image, *label;
29 gtk_init (&argc, &argv);
31 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
33 box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
35 gtk_container_add (GTK_CONTAINER (window), box);
37 hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
38 gtk_container_add (GTK_CONTAINER (box), hbox);
39 button = gtk_button_new_from_stock (GTK_STOCK_SAVE);
40 gtk_container_add (GTK_CONTAINER (hbox), button);
44 "use-stock", &use_stock,
45 "use-underline", &use_underline,
48 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");
49 label = gtk_label_new (text);
51 gtk_container_add (GTK_CONTAINER (hbox), label);
53 hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
54 gtk_container_add (GTK_CONTAINER (box), hbox);
55 button = g_object_new (GTK_TYPE_BUTTON,
56 "label", "document-save",
59 gtk_container_add (GTK_CONTAINER (hbox), button);
63 "use-stock", &use_stock,
64 "use-underline", &use_underline,
67 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");
68 label = gtk_label_new (text);
70 gtk_container_add (GTK_CONTAINER (hbox), label);
72 hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
73 gtk_container_add (GTK_CONTAINER (box), hbox);
74 button = gtk_button_new_with_label ("_Save");
75 gtk_container_add (GTK_CONTAINER (hbox), button);
79 "use-stock", &use_stock,
80 "use-underline", &use_underline,
83 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");
84 label = gtk_label_new (text);
86 gtk_container_add (GTK_CONTAINER (hbox), label);
88 hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
89 gtk_container_add (GTK_CONTAINER (box), hbox);
90 button = gtk_button_new_with_mnemonic ("_Save");
91 gtk_container_add (GTK_CONTAINER (hbox), button);
95 "use-stock", &use_stock,
96 "use-underline", &use_underline,
99 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");
100 label = gtk_label_new (text);
102 gtk_container_add (GTK_CONTAINER (hbox), label);
104 hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
105 gtk_container_add (GTK_CONTAINER (box), hbox);
106 button = gtk_button_new_with_label ("_Save");
107 gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_stock (GTK_STOCK_ABOUT, GTK_ICON_SIZE_BUTTON));
108 gtk_container_add (GTK_CONTAINER (hbox), button);
110 g_object_get (button,
112 "use-stock", &use_stock,
113 "use-underline", &use_underline,
116 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");
117 label = gtk_label_new (text);
119 gtk_container_add (GTK_CONTAINER (hbox), label);
121 hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
122 gtk_container_add (GTK_CONTAINER (box), hbox);
123 button = gtk_button_new_with_mnemonic ("_Save");
124 gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_stock (GTK_STOCK_ABOUT, GTK_ICON_SIZE_BUTTON));
125 gtk_container_add (GTK_CONTAINER (hbox), button);
126 g_object_get (button,
128 "use-stock", &use_stock,
129 "use-underline", &use_underline,
132 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");
133 label = gtk_label_new (text);
135 gtk_container_add (GTK_CONTAINER (hbox), label);
137 gtk_widget_show_all (window);