Make sure that all timeouts in HildonBanner are removed
[hildon] / examples / hildon-date-button-example.c
1 /*
2  * This file is a part of hildon examples
3  *
4  * Copyright (C) 2005, 2008 Nokia Corporation, all rights reserved.
5  *
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * as published by the Free Software Foundation; version 2.1 of
10  * the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  *
22  */
23 #include                                        <glib.h>
24 #include                                        <gtk/gtk.h>
25 #include                                        <hildon/hildon.h>
26
27 static void
28 on_picker_value_changed (HildonPickerButton * button, gpointer data)
29 {
30   g_print ("Newly selected value: %s\n",
31            hildon_button_get_value (HILDON_BUTTON (button)));
32 }
33
34 int
35 main (int argc, char **argv)
36 {
37   HildonProgram *program = NULL;
38   GtkWidget *window = NULL;
39   GtkWidget *button;
40
41   hildon_gtk_init (&argc, &argv);
42
43   program = hildon_program_get_instance ();
44   g_set_application_name ("hildon-date-button-example");
45
46   window = hildon_stackable_window_new ();
47   gtk_window_set_default_size (GTK_WINDOW (window), 300, 200);
48   hildon_program_add_window (program, HILDON_WINDOW (window));
49
50   button = hildon_date_button_new_with_year_range (HILDON_SIZE_AUTO,
51                                                    HILDON_BUTTON_ARRANGEMENT_VERTICAL,
52                                                    1990, 2020);
53   g_signal_connect (G_OBJECT (button), "value-changed",
54                     G_CALLBACK (on_picker_value_changed), NULL);
55
56   gtk_container_add (GTK_CONTAINER (window), button);
57
58   g_signal_connect (G_OBJECT (window), "delete-event", 
59                     G_CALLBACK (gtk_main_quit), NULL);
60
61   gtk_widget_show_all (window);
62
63   gtk_main ();
64
65   return 0;
66 }