Make sure that all timeouts in HildonBanner are removed
[hildon] / examples / hildon-progress-indicator-example.c
1 /*
2  * This file is a part of hildon examples
3  *
4  * Copyright (C) 2008 Nokia Corporation, all rights reserved.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public License
8  * as published by the Free Software Foundation; version 2.1 of
9  * the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19  * 02110-1301 USA
20  *
21  */
22
23 #include                                        <hildon/hildon.h>
24
25 HildonTextView *textview;
26 GtkTextBuffer *buffer;
27
28 static void
29 show_progress_button_clicked                    (GtkWidget *button,
30                                                  GtkWindow *window)
31 {
32     g_debug ("Showing progress indicator...");
33     hildon_gtk_window_set_progress_indicator (window, 1);
34 }
35
36 static void
37 hide_progress_button_clicked                    (GtkWidget *button,
38                                                  GtkWindow *window)
39 {
40     g_debug ("Hiding progress indicator...");
41     hildon_gtk_window_set_progress_indicator (window, 0);
42 }
43
44 int
45 main                                            (int    argc,
46                                                  char **argv)
47 {
48     GtkWidget *win;
49     GtkWidget *showprogressbutton, *hideprogressbutton;
50     GtkBox *vbox;
51
52     hildon_gtk_init (&argc, &argv);
53
54     /* Window and vbox to pack everything */
55     win = hildon_stackable_window_new ();
56     vbox = GTK_BOX (gtk_vbox_new (FALSE, 10));
57
58     /* Buttons */
59     showprogressbutton = hildon_gtk_button_new (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH);
60     gtk_button_set_label (GTK_BUTTON (showprogressbutton), "Show progress indicator");
61
62     hideprogressbutton = hildon_gtk_button_new (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH);
63     gtk_button_set_label (GTK_BUTTON (hideprogressbutton), "Hide progress indicator");
64
65     /* Pack all widgets */
66     gtk_box_pack_start (GTK_BOX (vbox), showprogressbutton, TRUE, TRUE, 0);
67     gtk_box_pack_start (GTK_BOX (vbox), hideprogressbutton, TRUE, TRUE, 0);
68
69     gtk_container_set_border_width (GTK_CONTAINER (win), 20);
70     gtk_container_add (GTK_CONTAINER (win), GTK_WIDGET (vbox));
71
72     /* Connect signals */
73     g_signal_connect (win, "destroy", G_CALLBACK (gtk_main_quit), NULL);
74     g_signal_connect (showprogressbutton, "clicked",
75                       G_CALLBACK (show_progress_button_clicked), win);
76     g_signal_connect (hideprogressbutton, "clicked",
77                       G_CALLBACK (hide_progress_button_clicked), win);
78
79     /* Run example */
80     gtk_widget_show_all (win);
81     gtk_main ();
82
83     return 0;
84 }