Make sure that all timeouts in HildonBanner are removed
[hildon] / examples / hildon-touch-selector-entry-example.c
1 /*
2  * This file is a part of hildon
3  *
4  * Copyright (C) 2008 Nokia Corporation.
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
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version. or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but 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
18  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  */
20
21 #include                                        <glib.h>
22 #include                                        <gtk/gtk.h>
23
24 #include                                        <hildon/hildon.h>
25
26 static const gchar* artists [] = {
27   "AC/DC",
28   "Aerosmith",
29   "Alice in Chains",
30   "Black Sabbath",
31   "Carcass",
32   "Danzig",
33   "Deep Purple",
34   "Dream Theater",
35   "Eric Clapton",
36   "Focus",
37   "Frank Gambale",
38   "Guns n' Roses",
39   "Gus Gus",
40   "Hearth",
41   "Helloween",
42   "Hole",
43   "Jerry Cantrell",
44   "Jethro Tull",
45   "Jimi Hendrix",
46   "Jim Morrison",
47   "Joe Satriani",
48   "John Lennon",
49   "King Diamond",
50   "Lacuna Coil",
51   "Led Zeppelin",
52   "Lynyrd Skynyrd",
53   "Metallica",
54   "Megadeth",
55   "Nirvana",
56   "Nine Inch Nails",
57   "No Doubt",
58   NULL
59 };
60
61 int
62 main (int argc, char **argv)
63 {
64   HildonProgram *program = NULL;
65   GtkWidget *window = NULL;
66   GtkWidget *button;
67   GtkWidget *selector;
68   gint i;
69
70   hildon_gtk_init (&argc, &argv);
71
72   program = hildon_program_get_instance ();
73   g_set_application_name
74     ("hildon-touch-picker cell renderer example program");
75
76   window = hildon_stackable_window_new ();
77   hildon_program_add_window (program, HILDON_WINDOW (window));
78
79   gtk_container_set_border_width (GTK_CONTAINER (window), 6);
80
81   button = hildon_picker_button_new (HILDON_SIZE_AUTO, HILDON_BUTTON_ARRANGEMENT_VERTICAL);
82   hildon_button_set_title (HILDON_BUTTON (button), "Pick a band!");
83   selector = hildon_touch_selector_entry_new_text ();
84   for (i = 0; artists [i] != NULL; i++) {
85     hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector),
86                                        artists[i]);
87   }
88   hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (button),
89                                      HILDON_TOUCH_SELECTOR (selector));
90
91   gtk_container_add (GTK_CONTAINER (window), button);
92   g_signal_connect (G_OBJECT (window), "destroy",
93                     G_CALLBACK (gtk_main_quit), NULL);
94   gtk_widget_show_all (GTK_WIDGET (window));
95
96   gtk_main ();
97
98   return 0;
99 }