2 * This file is a part of hildon examples
4 * Copyright (C) 2008 Nokia Corporation, all rights reserved.
6 * Author: Karl Lattimer <karl.lattimer@nokia.com>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; version 2.1 of
11 * the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
33 #include <X11/Xatom.h>
36 add_window (GtkWidget* w);
39 new_window (gboolean ismain)
41 GtkWidget *window, *hbbox, *add;
45 window = hildon_stackable_window_new ();
48 title = g_strdup ("main window");
50 title = g_strdup_printf ("win%d", count);
52 gtk_window_set_title (GTK_WINDOW (window), title);
57 gtk_container_set_border_width (GTK_CONTAINER (window), 6);
59 hbbox = gtk_hbutton_box_new ();
60 gtk_container_add (GTK_CONTAINER (window), hbbox);
62 add = gtk_button_new_with_label ("Add a window");
63 gtk_box_pack_start (GTK_BOX (hbbox), add, FALSE, FALSE, 0);
65 g_signal_connect (G_OBJECT (add), "clicked", G_CALLBACK (add_window), NULL);
69 GtkWidget *detach, *back;
70 detach = GTK_WIDGET (gtk_button_new_with_label ("Destroy"));
71 gtk_box_pack_end (GTK_BOX (hbbox), detach, FALSE, FALSE, 0);
73 g_signal_connect_swapped (G_OBJECT (detach), "clicked",
74 G_CALLBACK (gtk_widget_destroy),
75 HILDON_STACKABLE_WINDOW (window));
77 back = GTK_WIDGET (gtk_button_new_with_label ("Back to root"));
78 gtk_box_pack_end (GTK_BOX (hbbox), back, FALSE, FALSE, 0);
80 g_signal_connect_swapped (G_OBJECT (back), "clicked",
81 G_CALLBACK (hildon_program_go_to_root_window),
82 hildon_program_get_instance ());
89 add_window (GtkWidget *w)
91 GtkWidget *window = new_window (FALSE);
92 gtk_widget_show_all (window);
103 gtk_init (&argc, &args);
105 g_set_application_name ("stack");
107 window = new_window (TRUE);
109 g_signal_connect (G_OBJECT (window), "delete_event",
110 G_CALLBACK (gtk_main_quit), NULL);
112 gtk_widget_show_all (GTK_WIDGET (window));