Put demo window in another process to prevent some bugs of gtk+.
[lxde/lxappearance.git] / src / demo-ui.c
1 /*
2 * DO NOT EDIT THIS FILE - it is generated by Glade.
3 */
4
5 #ifdef HAVE_CONFIG_H
6 # include <config.h>
7 #endif
8
9 #include <sys/types.h>
10 #include <sys/stat.h>
11 #include <unistd.h>
12 #include <string.h>
13 #include <stdio.h>
14
15 #include <gdk/gdkkeysyms.h>
16 #include <gtk/gtk.h>
17
18 #include "demo.h"
19 #include "demo-ui.h"
20 #include "glade-support.h"
21
22 #define GLADE_HOOKUP_OBJECT(component,widget,name) \
23 g_object_set_data_full (G_OBJECT (component), name, \
24 gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)
25
26 #define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
27 g_object_set_data (G_OBJECT (component), name, widget)
28
29 GtkWidget*
30 create_demo_window (void)
31 {
32 GtkWidget *demo_window;
33 GtkWidget *top_vbox;
34 GtkWidget *menubar1;
35 GtkWidget *menuitem1;
36 GtkWidget *menuitem1_menu;
37 GtkWidget *new1;
38 GtkWidget *open1;
39 GtkWidget *save1;
40 GtkWidget *save_as1;
41 GtkWidget *separatormenuitem1;
42 GtkWidget *quit1;
43 GtkWidget *menuitem2;
44 GtkWidget *menuitem2_menu;
45 GtkWidget *cut1;
46 GtkWidget *copy1;
47 GtkWidget *paste1;
48 GtkWidget *delete1;
49 GtkWidget *menuitem4;
50 GtkWidget *menuitem4_menu;
51 GtkWidget *about1;
52 GtkWidget *handlebox1;
53 GtkWidget *toolbar1;
54 GtkIconSize tmp_toolbar_icon_size;
55 GtkWidget *toolbutton1;
56 GtkWidget *toolbutton2;
57 GtkWidget *toolbutton3;
58 GtkWidget *notebook2;
59 GtkWidget *scrolledwindow4;
60 GtkWidget *icon_view;
61 GtkWidget *label12;
62 GtkWidget *hbox2;
63 GtkWidget *frame2;
64 GtkWidget *alignment2;
65 GtkWidget *vbox6;
66 GtkWidget *radiobutton1;
67 GSList *radiobutton1_group = NULL;
68 GtkWidget *radiobutton2;
69 GtkWidget *hseparator1;
70 GtkWidget *checkbutton1;
71 GtkWidget *entry1;
72 GtkWidget *label16;
73 GtkWidget *vbox7;
74 GtkWidget *progressbar1;
75 GtkWidget *hscale1;
76 GtkWidget *hbox3;
77 GtkObject *spinbutton1_adj;
78 GtkWidget *spinbutton1;
79 GtkWidget *button1;
80 GtkWidget *combobox2;
81 GtkWidget *label13;
82 GtkWidget *scrolledwindow5;
83 GtkWidget *text_view;
84 GtkWidget *label14;
85 GtkWidget *scrolledwindow6;
86 GtkWidget *demo_treeview;
87 GtkWidget *label17;
88 GtkWidget *statusbar1;
89 GtkAccelGroup *accel_group;
90 GtkTooltips *tooltips;
91
92 tooltips = gtk_tooltips_new ();
93
94 accel_group = gtk_accel_group_new ();
95 /*
96 demo_window = gtk_window_new (GTK_WINDOW_POPUP);
97 gtk_widget_set_events (demo_window, GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
98 gtk_window_set_decorated (GTK_WINDOW (demo_window), FALSE);
99 */
100 top_vbox = gtk_vbox_new (FALSE, 0);
101 gtk_widget_show (top_vbox);
102 demo_window = top_vbox;
103
104 /*
105 gtk_container_add (GTK_CONTAINER (demo_window), top_vbox);
106 */
107
108 menubar1 = gtk_menu_bar_new ();
109 gtk_widget_show (menubar1);
110 gtk_box_pack_start (GTK_BOX (top_vbox), menubar1, FALSE, FALSE, 0);
111
112 menuitem1 = gtk_menu_item_new_with_mnemonic (_("_File"));
113 gtk_widget_show (menuitem1);
114 gtk_container_add (GTK_CONTAINER (menubar1), menuitem1);
115
116 menuitem1_menu = gtk_menu_new ();
117 gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem1), menuitem1_menu);
118
119 new1 = gtk_image_menu_item_new_from_stock ("gtk-new", accel_group);
120 gtk_widget_show (new1);
121 gtk_container_add (GTK_CONTAINER (menuitem1_menu), new1);
122
123 open1 = gtk_image_menu_item_new_from_stock ("gtk-open", accel_group);
124 gtk_widget_show (open1);
125 gtk_container_add (GTK_CONTAINER (menuitem1_menu), open1);
126
127 save1 = gtk_image_menu_item_new_from_stock ("gtk-save", accel_group);
128 gtk_widget_show (save1);
129 gtk_container_add (GTK_CONTAINER (menuitem1_menu), save1);
130
131 save_as1 = gtk_image_menu_item_new_from_stock ("gtk-save-as", accel_group);
132 gtk_widget_show (save_as1);
133 gtk_container_add (GTK_CONTAINER (menuitem1_menu), save_as1);
134
135 separatormenuitem1 = gtk_separator_menu_item_new ();
136 gtk_widget_show (separatormenuitem1);
137 gtk_container_add (GTK_CONTAINER (menuitem1_menu), separatormenuitem1);
138 gtk_widget_set_sensitive (separatormenuitem1, FALSE);
139
140 quit1 = gtk_image_menu_item_new_from_stock ("gtk-quit", accel_group);
141 gtk_widget_show (quit1);
142 gtk_container_add (GTK_CONTAINER (menuitem1_menu), quit1);
143
144 menuitem2 = gtk_menu_item_new_with_mnemonic (_("_Edit"));
145 gtk_widget_show (menuitem2);
146 gtk_container_add (GTK_CONTAINER (menubar1), menuitem2);
147
148 menuitem2_menu = gtk_menu_new ();
149 gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem2), menuitem2_menu);
150
151 cut1 = gtk_image_menu_item_new_from_stock ("gtk-cut", accel_group);
152 gtk_widget_show (cut1);
153 gtk_container_add (GTK_CONTAINER (menuitem2_menu), cut1);
154
155 copy1 = gtk_image_menu_item_new_from_stock ("gtk-copy", accel_group);
156 gtk_widget_show (copy1);
157 gtk_container_add (GTK_CONTAINER (menuitem2_menu), copy1);
158
159 paste1 = gtk_image_menu_item_new_from_stock ("gtk-paste", accel_group);
160 gtk_widget_show (paste1);
161 gtk_container_add (GTK_CONTAINER (menuitem2_menu), paste1);
162
163 delete1 = gtk_image_menu_item_new_from_stock ("gtk-delete", accel_group);
164 gtk_widget_show (delete1);
165 gtk_container_add (GTK_CONTAINER (menuitem2_menu), delete1);
166
167 menuitem4 = gtk_menu_item_new_with_mnemonic (_("_Help"));
168 gtk_widget_show (menuitem4);
169 gtk_container_add (GTK_CONTAINER (menubar1), menuitem4);
170
171 menuitem4_menu = gtk_menu_new ();
172 gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem4), menuitem4_menu);
173
174 about1 = gtk_image_menu_item_new_from_stock ("gtk-about", accel_group);
175 gtk_widget_show (about1);
176 gtk_container_add (GTK_CONTAINER (menuitem4_menu), about1);
177
178 handlebox1 = gtk_handle_box_new ();
179 gtk_widget_show (handlebox1);
180 gtk_box_pack_start (GTK_BOX (top_vbox), handlebox1, FALSE, FALSE, 0);
181
182 toolbar1 = gtk_toolbar_new ();
183 gtk_widget_show (toolbar1);
184 gtk_container_add (GTK_CONTAINER (handlebox1), toolbar1);
185 gtk_toolbar_set_style (GTK_TOOLBAR (toolbar1), GTK_TOOLBAR_BOTH);
186 gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar1), FALSE);
187 tmp_toolbar_icon_size = gtk_toolbar_get_icon_size (GTK_TOOLBAR (toolbar1));
188
189 toolbutton1 = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-go-back");
190 gtk_widget_show (toolbutton1);
191 gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton1);
192 gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton1), tooltips, _("Back"), NULL);
193
194 toolbutton2 = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-go-forward");
195 gtk_widget_show (toolbutton2);
196 gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton2);
197 gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton2), tooltips, _("Forward"), NULL);
198
199 toolbutton3 = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-stop");
200 gtk_widget_show (toolbutton3);
201 gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton3);
202 gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton3), tooltips, _("Stop"), NULL);
203
204 notebook2 = gtk_notebook_new ();
205 gtk_widget_show (notebook2);
206 gtk_box_pack_start (GTK_BOX (top_vbox), notebook2, TRUE, TRUE, 0);
207
208 scrolledwindow4 = gtk_scrolled_window_new (NULL, NULL);
209 gtk_widget_show (scrolledwindow4);
210 gtk_container_add (GTK_CONTAINER (notebook2), scrolledwindow4);
211 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow4), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
212 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow4), GTK_SHADOW_IN);
213
214 icon_view = gtk_icon_view_new ();
215 gtk_widget_show (icon_view);
216 gtk_container_add (GTK_CONTAINER (scrolledwindow4), icon_view);
217
218 label12 = gtk_label_new (_("Tab1"));
219 gtk_widget_show (label12);
220 gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook2), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook2), 0), label12);
221
222 hbox2 = gtk_hbox_new (FALSE, 0);
223 gtk_widget_show (hbox2);
224 gtk_container_add (GTK_CONTAINER (notebook2), hbox2);
225
226 frame2 = gtk_frame_new (NULL);
227 gtk_widget_show (frame2);
228 gtk_box_pack_start (GTK_BOX (hbox2), frame2, TRUE, TRUE, 0);
229 gtk_container_set_border_width (GTK_CONTAINER (frame2), 4);
230
231 alignment2 = gtk_alignment_new (0.5, 0.5, 1, 1);
232 gtk_widget_show (alignment2);
233 gtk_container_add (GTK_CONTAINER (frame2), alignment2);
234 gtk_alignment_set_padding (GTK_ALIGNMENT (alignment2), 0, 4, 4, 0);
235
236 vbox6 = gtk_vbox_new (FALSE, 4);
237 gtk_widget_show (vbox6);
238 gtk_container_add (GTK_CONTAINER (alignment2), vbox6);
239
240 radiobutton1 = gtk_radio_button_new_with_mnemonic (NULL, _("Radio Button"));
241 gtk_widget_show (radiobutton1);
242 gtk_box_pack_start (GTK_BOX (vbox6), radiobutton1, FALSE, FALSE, 0);
243 gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton1), radiobutton1_group);
244 radiobutton1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton1));
245
246 radiobutton2 = gtk_radio_button_new_with_mnemonic (NULL, _("Radio Button"));
247 gtk_widget_show (radiobutton2);
248 gtk_box_pack_start (GTK_BOX (vbox6), radiobutton2, FALSE, FALSE, 0);
249 gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton2), radiobutton1_group);
250 radiobutton1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton2));
251
252 hseparator1 = gtk_hseparator_new ();
253 gtk_widget_show (hseparator1);
254 gtk_box_pack_start (GTK_BOX (vbox6), hseparator1, FALSE, TRUE, 0);
255
256 checkbutton1 = gtk_check_button_new_with_mnemonic (_("Check Button"));
257 gtk_widget_show (checkbutton1);
258 gtk_box_pack_start (GTK_BOX (vbox6), checkbutton1, FALSE, FALSE, 0);
259
260 entry1 = gtk_entry_new ();
261 gtk_widget_show (entry1);
262 gtk_box_pack_start (GTK_BOX (vbox6), entry1, FALSE, FALSE, 0);
263 gtk_entry_set_invisible_char (GTK_ENTRY (entry1), 9679);
264
265 label16 = gtk_label_new (_("Demo"));
266 gtk_widget_show (label16);
267 gtk_frame_set_label_widget (GTK_FRAME (frame2), label16);
268 gtk_label_set_use_markup (GTK_LABEL (label16), TRUE);
269
270 vbox7 = gtk_vbox_new (FALSE, 0);
271 gtk_widget_show (vbox7);
272 gtk_box_pack_start (GTK_BOX (hbox2), vbox7, TRUE, TRUE, 0);
273 gtk_container_set_border_width (GTK_CONTAINER (vbox7), 4);
274
275 progressbar1 = gtk_progress_bar_new ();
276 gtk_widget_show (progressbar1);
277 gtk_box_pack_start (GTK_BOX (vbox7), progressbar1, FALSE, FALSE, 0);
278 gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progressbar1), 0.6);
279 gtk_progress_bar_set_text (GTK_PROGRESS_BAR (progressbar1), "60 %");
280
281 hscale1 = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 0, 0, 0, 0)));
282 gtk_widget_show (hscale1);
283 gtk_box_pack_start (GTK_BOX (vbox7), hscale1, FALSE, TRUE, 0);
284
285 hbox3 = gtk_hbox_new (FALSE, 0);
286 gtk_widget_show (hbox3);
287 gtk_box_pack_start (GTK_BOX (vbox7), hbox3, FALSE, TRUE, 0);
288
289 spinbutton1_adj = gtk_adjustment_new (1, 0, 100, 1, 10, 10);
290 spinbutton1 = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton1_adj), 1, 0);
291 gtk_widget_show (spinbutton1);
292 gtk_box_pack_start (GTK_BOX (hbox3), spinbutton1, TRUE, TRUE, 0);
293
294 button1 = gtk_button_new_with_mnemonic (_("button1"));
295 gtk_widget_show (button1);
296 gtk_box_pack_start (GTK_BOX (hbox3), button1, FALSE, FALSE, 0);
297
298 combobox2 = gtk_combo_box_new_text ();
299 gtk_widget_show (combobox2);
300 gtk_box_pack_start (GTK_BOX (vbox7), combobox2, FALSE, TRUE, 0);
301 gtk_combo_box_append_text (GTK_COMBO_BOX (combobox2), _("Test Item 1"));
302 gtk_combo_box_append_text (GTK_COMBO_BOX (combobox2), _("Test Item 2"));
303 gtk_combo_box_append_text (GTK_COMBO_BOX (combobox2), _("Test Item 3"));
304
305 label13 = gtk_label_new (_("Tab2"));
306 gtk_widget_show (label13);
307 gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook2), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook2), 1), label13);
308
309 scrolledwindow5 = gtk_scrolled_window_new (NULL, NULL);
310 gtk_widget_show (scrolledwindow5);
311 gtk_container_add (GTK_CONTAINER (notebook2), scrolledwindow5);
312 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow5), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
313 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow5), GTK_SHADOW_IN);
314
315 text_view = gtk_text_view_new ();
316 gtk_widget_show (text_view);
317 gtk_container_add (GTK_CONTAINER (scrolledwindow5), text_view);
318 gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view)), _("Type some characters here to test currently selected font."), -1);
319
320 label14 = gtk_label_new (_("Tab3"));
321 gtk_widget_show (label14);
322 gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook2), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook2), 2), label14);
323
324 scrolledwindow6 = gtk_scrolled_window_new (NULL, NULL);
325 gtk_widget_show (scrolledwindow6);
326 gtk_container_add (GTK_CONTAINER (notebook2), scrolledwindow6);
327 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow6), GTK_SHADOW_IN);
328
329 demo_treeview = gtk_tree_view_new ();
330 gtk_widget_show (demo_treeview);
331 gtk_container_add (GTK_CONTAINER (scrolledwindow6), demo_treeview);
332 gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (demo_treeview), TRUE);
333
334 label17 = gtk_label_new (_("Tab4"));
335 gtk_widget_show (label17);
336 gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook2), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook2), 3), label17);
337
338 statusbar1 = gtk_statusbar_new ();
339 gtk_widget_show (statusbar1);
340 gtk_box_pack_start (GTK_BOX (top_vbox), statusbar1, FALSE, FALSE, 0);
341
342 g_signal_connect ((gpointer) top_vbox, "destroy",
343 G_CALLBACK (gtk_main_quit),
344 NULL);
345
346 /* Store pointers to all widgets, for use by lookup_widget(). */
347
348 /*
349 GLADE_HOOKUP_OBJECT_NO_REF (demo_window, demo_window, "demo_window");
350 GLADE_HOOKUP_OBJECT (demo_window, top_vbox, "top_vbox");
351 GLADE_HOOKUP_OBJECT (demo_window, menubar1, "menubar1");
352 GLADE_HOOKUP_OBJECT (demo_window, menuitem1, "menuitem1");
353 GLADE_HOOKUP_OBJECT (demo_window, menuitem1_menu, "menuitem1_menu");
354 GLADE_HOOKUP_OBJECT (demo_window, new1, "new1");
355 GLADE_HOOKUP_OBJECT (demo_window, open1, "open1");
356 GLADE_HOOKUP_OBJECT (demo_window, save1, "save1");
357 GLADE_HOOKUP_OBJECT (demo_window, save_as1, "save_as1");
358 GLADE_HOOKUP_OBJECT (demo_window, separatormenuitem1, "separatormenuitem1");
359 GLADE_HOOKUP_OBJECT (demo_window, quit1, "quit1");
360 GLADE_HOOKUP_OBJECT (demo_window, menuitem2, "menuitem2");
361 GLADE_HOOKUP_OBJECT (demo_window, menuitem2_menu, "menuitem2_menu");
362 GLADE_HOOKUP_OBJECT (demo_window, cut1, "cut1");
363 GLADE_HOOKUP_OBJECT (demo_window, copy1, "copy1");
364 GLADE_HOOKUP_OBJECT (demo_window, paste1, "paste1");
365 GLADE_HOOKUP_OBJECT (demo_window, delete1, "delete1");
366 GLADE_HOOKUP_OBJECT (demo_window, menuitem4, "menuitem4");
367 GLADE_HOOKUP_OBJECT (demo_window, menuitem4_menu, "menuitem4_menu");
368 GLADE_HOOKUP_OBJECT (demo_window, about1, "about1");
369 GLADE_HOOKUP_OBJECT (demo_window, handlebox1, "handlebox1");
370 GLADE_HOOKUP_OBJECT (demo_window, toolbar1, "toolbar1");
371 GLADE_HOOKUP_OBJECT (demo_window, toolbutton1, "toolbutton1");
372 GLADE_HOOKUP_OBJECT (demo_window, toolbutton2, "toolbutton2");
373 GLADE_HOOKUP_OBJECT (demo_window, toolbutton3, "toolbutton3");
374 GLADE_HOOKUP_OBJECT (demo_window, notebook2, "notebook2");
375 GLADE_HOOKUP_OBJECT (demo_window, scrolledwindow4, "scrolledwindow4");
376 */
377 GLADE_HOOKUP_OBJECT (demo_window, icon_view, "icon_view");
378 /*
379 GLADE_HOOKUP_OBJECT (demo_window, label12, "label12");
380 GLADE_HOOKUP_OBJECT (demo_window, hbox2, "hbox2");
381 GLADE_HOOKUP_OBJECT (demo_window, frame2, "frame2");
382 GLADE_HOOKUP_OBJECT (demo_window, alignment2, "alignment2");
383 GLADE_HOOKUP_OBJECT (demo_window, vbox6, "vbox6");
384 GLADE_HOOKUP_OBJECT (demo_window, radiobutton1, "radiobutton1");
385 GLADE_HOOKUP_OBJECT (demo_window, radiobutton2, "radiobutton2");
386 GLADE_HOOKUP_OBJECT (demo_window, hseparator1, "hseparator1");
387 GLADE_HOOKUP_OBJECT (demo_window, checkbutton1, "checkbutton1");
388 GLADE_HOOKUP_OBJECT (demo_window, entry1, "entry1");
389 GLADE_HOOKUP_OBJECT (demo_window, label16, "label16");
390 GLADE_HOOKUP_OBJECT (demo_window, vbox7, "vbox7");
391 GLADE_HOOKUP_OBJECT (demo_window, progressbar1, "progressbar1");
392 GLADE_HOOKUP_OBJECT (demo_window, hscale1, "hscale1");
393 GLADE_HOOKUP_OBJECT (demo_window, hbox3, "hbox3");
394 GLADE_HOOKUP_OBJECT (demo_window, spinbutton1, "spinbutton1");
395 GLADE_HOOKUP_OBJECT (demo_window, button1, "button1");
396 GLADE_HOOKUP_OBJECT (demo_window, combobox2, "combobox2");
397 GLADE_HOOKUP_OBJECT (demo_window, label13, "label13");
398 GLADE_HOOKUP_OBJECT (demo_window, scrolledwindow5, "scrolledwindow5");
399 GLADE_HOOKUP_OBJECT (demo_window, text_view, "text_view");
400 GLADE_HOOKUP_OBJECT (demo_window, label14, "label14");
401 GLADE_HOOKUP_OBJECT (demo_window, scrolledwindow6, "scrolledwindow6");
402 */
403 GLADE_HOOKUP_OBJECT (demo_window, demo_treeview, "demo_treeview");
404 /*
405 GLADE_HOOKUP_OBJECT (demo_window, label17, "label17");
406 GLADE_HOOKUP_OBJECT (demo_window, statusbar1, "statusbar1");
407 GLADE_HOOKUP_OBJECT_NO_REF (demo_window, tooltips, "tooltips");
408
409 gtk_window_add_accel_group (GTK_WINDOW (demo_window), accel_group);
410 */
411 return demo_window;
412 }
413