2 * This file is a part of hildon
4 * Copyright (C) 2008 Nokia Corporation, all rights reserved.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser Public License as published by
8 * the Free Software Foundation; version 2 of the license.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser Public License for more details.
20 #include "hildon-program.h"
21 #include "hildon-stackable-window.h"
23 #include "hildon-picker-button.h"
26 on_picker_value_changed (HildonPickerButton * button, gpointer data)
28 g_print ("Newly selected value: %s\n",
29 hildon_button_get_value (HILDON_BUTTON (button)));
33 main (int argc, char **args)
35 HildonProgram *program = NULL;
36 GtkWidget *window = NULL;
39 gtk_init (&argc, &args);
41 program = hildon_program_get_instance ();
42 g_set_application_name ("hildon-picker-button-example");
44 window = hildon_stackable_window_new ();
45 gtk_window_set_default_size (GTK_WINDOW (window), 300, 200);
46 hildon_program_add_window (program, HILDON_WINDOW (window));
48 button = hildon_picker_button_new_text (HILDON_BUTTON_WITH_VERTICAL_VALUE);
49 hildon_button_set_title (HILDON_BUTTON (button), "Continent");
51 hildon_picker_button_append_text (HILDON_PICKER_BUTTON (button), "America");
52 hildon_picker_button_append_text (HILDON_PICKER_BUTTON (button), "Europe");
53 hildon_picker_button_append_text (HILDON_PICKER_BUTTON (button), "Asia");
54 hildon_picker_button_append_text (HILDON_PICKER_BUTTON (button), "Africa");
55 hildon_picker_button_append_text (HILDON_PICKER_BUTTON (button),
58 g_signal_connect (G_OBJECT (button), "value-changed",
59 G_CALLBACK (on_picker_value_changed), NULL);
61 gtk_container_add (GTK_CONTAINER (window), button);
63 g_signal_connect (G_OBJECT (window), "delete-event",
64 G_CALLBACK (gtk_main_quit), NULL);
66 gtk_widget_show_all (window);