* examples/Makefile.am: Add below examples.
* examples/hildon-date-button-example.c:
* examples/hildon-picker-button-example.c:
* examples/hildon-picker-button-multicolumn-example.c:
* examples/hildon-time-button-example.c:
* examples/hildon-touch-picker-example.c:
Add examples for the reciently added touch pickers,
picker dialogs, and picker button widgets.
+2008-07-29 Claudio Saavedra <csaavedra@igalia.com>
+
+ * examples/Makefile.am: Add below examples.
+ * examples/hildon-date-button-example.c:
+ * examples/hildon-picker-button-example.c:
+ * examples/hildon-picker-button-multicolumn-example.c:
+ * examples/hildon-time-button-example.c:
+ * examples/hildon-touch-picker-example.c:
+
+ Add examples for the reciently added touch pickers,
+ picker dialogs, and picker button widgets.
+
2008-07-29 Alberto Garcia <agarcia@igalia.com>
* src/hildon-button.c: Add some API documentation
hildon-app-menu-example \
hildon-stackable-window-example \
hildon-button-example \
- hildon-dialog-example
+ hildon-dialog-example \
+ hildon-date-button-example \
+ hildon-picker-button-example \
+ hildon-picker-button-multicolumn-example \
+ hildon-time-button-example \
+ hildon-touch-picker-example
+
# Hildon window
hildon_window_example_LDADD = $(HILDON_OBJ_LIBS)
hildon_window_example_CFLAGS = $(HILDON_OBJ_CFLAGS)
hildon_dialog_example_CFLAGS = $(HILDON_OBJ_CFLAGS)
hildon_dialog_example_SOURCES = hildon-dialog-example.c
+# Hildon date button
+hildon_date_button_example_LDADD = $(HILDON_OBJ_LIBS)
+hildon_date_button_example_CFLAGS = $(HILDON_OBJ_CFLAGS)
+hildon_date_button_example_SOURCES = hildon-date-button-example.c
+
+# Hildon picker button
+hildon_picker_button_example_LDADD = $(HILDON_OBJ_LIBS)
+hildon_picker_button_example_CFLAGS = $(HILDON_OBJ_CFLAGS)
+hildon_picker_button_example_SOURCES = hildon-picker-button-example.c
+
+# Hildon picker button with multicolumn picker
+hildon_picker_button_multicolumn_example_LDADD = $(HILDON_OBJ_LIBS)
+hildon_picker_button_multicolumn_example_CFLAGS = $(HILDON_OBJ_CFLAGS)
+hildon_picker_button_multicolumn_example_SOURCES= hildon-picker-button-multicolumn-example.c
+
+# Hildon time button
+hildon_time_button_example_LDADD = $(HILDON_OBJ_LIBS)
+hildon_time_button_example_CFLAGS = $(HILDON_OBJ_CFLAGS)
+hildon_time_button_example_SOURCES = hildon-time-button-example.c
+
+# Hildon touch picker with multiselection
+hildon_touch_picker_example_LDADD = $(HILDON_OBJ_LIBS)
+hildon_touch_picker_example_CFLAGS = $(HILDON_OBJ_CFLAGS)
+hildon_touch_picker_example_SOURCES = hildon-touch-picker-example.c
+
endif
--- /dev/null
+#include <glib.h>
+#include <gtk/gtk.h>
+
+#include "hildon-program.h"
+#include "hildon-stackable-window.h"
+
+#include "hildon-picker-button.h"
+#include "hildon-date-button.h"
+
+static void
+on_picker_value_changed (HildonPickerButton * button, gpointer data)
+{
+ g_print ("Newly selected value: %s\n",
+ hildon_button_get_value (HILDON_BUTTON (button)));
+}
+
+int
+main (int argc, char **args)
+{
+ HildonProgram *program = NULL;
+ GtkWidget *window = NULL;
+ GtkWidget *button;
+
+ gtk_init (&argc, &args);
+
+ program = hildon_program_get_instance ();
+ g_set_application_name ("hildon-date-button-example");
+
+ window = hildon_stackable_window_new ();
+ gtk_window_set_default_size (GTK_WINDOW (window), 300, 200);
+ hildon_program_add_window (program, HILDON_WINDOW (window));
+
+ button = hildon_date_button_new (HILDON_BUTTON_WITH_VERTICAL_VALUE);
+ g_signal_connect (G_OBJECT (button), "value-changed",
+ G_CALLBACK (on_picker_value_changed), NULL);
+
+ gtk_container_add (GTK_CONTAINER (window), button);
+
+ g_signal_connect (G_OBJECT (window), "delete-event",
+ G_CALLBACK (gtk_main_quit), NULL);
+
+ gtk_widget_show_all (window);
+
+ gtk_main ();
+
+ return 0;
+}
--- /dev/null
+/*
+ * This file is a part of hildon
+ *
+ * Copyright (C) 2008 Nokia Corporation, all rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser Public License as published by
+ * the Free Software Foundation; version 2 of the license.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser Public License for more details.
+ *
+ */
+
+#include <glib.h>
+#include <gtk/gtk.h>
+
+#include "hildon-program.h"
+#include "hildon-stackable-window.h"
+
+#include "hildon-picker-button.h"
+
+static void
+on_picker_value_changed (HildonPickerButton * button, gpointer data)
+{
+ g_print ("Newly selected value: %s\n",
+ hildon_button_get_value (HILDON_BUTTON (button)));
+}
+
+int
+main (int argc, char **args)
+{
+ HildonProgram *program = NULL;
+ GtkWidget *window = NULL;
+ GtkWidget *button;
+
+ gtk_init (&argc, &args);
+
+ program = hildon_program_get_instance ();
+ g_set_application_name ("hildon-picker-button-example");
+
+ window = hildon_stackable_window_new ();
+ gtk_window_set_default_size (GTK_WINDOW (window), 300, 200);
+ hildon_program_add_window (program, HILDON_WINDOW (window));
+
+ button = hildon_picker_button_new_text (HILDON_BUTTON_WITH_VERTICAL_VALUE);
+ hildon_button_set_title (HILDON_BUTTON (button), "Continent");
+
+ hildon_picker_button_append_text (HILDON_PICKER_BUTTON (button), "America");
+ hildon_picker_button_append_text (HILDON_PICKER_BUTTON (button), "Europe");
+ hildon_picker_button_append_text (HILDON_PICKER_BUTTON (button), "Asia");
+ hildon_picker_button_append_text (HILDON_PICKER_BUTTON (button), "Africa");
+ hildon_picker_button_append_text (HILDON_PICKER_BUTTON (button),
+ "Australia");
+
+ g_signal_connect (G_OBJECT (button), "value-changed",
+ G_CALLBACK (on_picker_value_changed), NULL);
+
+ gtk_container_add (GTK_CONTAINER (window), button);
+
+ g_signal_connect (G_OBJECT (window), "delete-event",
+ G_CALLBACK (gtk_main_quit), NULL);
+
+ gtk_widget_show_all (window);
+
+ gtk_main ();
+
+ return 0;
+}
--- /dev/null
+/*
+ * This file is a part of hildon
+ *
+ * Copyright (C) 2008 Nokia Corporation, all rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser Public License as published by
+ * the Free Software Foundation; version 2 of the license.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser Public License for more details.
+ *
+ */
+
+#include <glib.h>
+#include <gtk/gtk.h>
+
+#include "hildon-program.h"
+#include "hildon-stackable-window.h"
+
+#include "hildon-picker-button.h"
+
+GtkWidget *
+create_touch_picker (void)
+{
+ GtkWidget *picker;
+ GtkListStore *model;
+ GtkTreeIter iter;
+
+ picker = hildon_touch_picker_new ();
+
+ model = gtk_list_store_new (1, G_TYPE_STRING);
+
+ gtk_list_store_append (model, &iter);
+ gtk_list_store_set (model, &iter, 0, "IMAP", -1);
+
+ gtk_list_store_append (model, &iter);
+ gtk_list_store_set (model, &iter, 0, "IMAP4", -1);
+
+ gtk_list_store_append (model, &iter);
+ gtk_list_store_set (model, &iter, 0, "POP3", -1);
+
+ gtk_list_store_append (model, &iter);
+ gtk_list_store_set (model, &iter, 0, "Mailbox", -1);
+
+ hildon_touch_picker_append_text_column (HILDON_TOUCH_PICKER (picker),
+ GTK_TREE_MODEL (model));
+
+ model = gtk_list_store_new (1, G_TYPE_STRING);
+
+ gtk_list_store_append (model, &iter);
+ gtk_list_store_set (model, &iter, 0, "SMTP", -1);
+
+ gtk_list_store_append (model, &iter);
+ gtk_list_store_set (model, &iter, 0, "SMTPS", -1);
+
+ gtk_list_store_append (model, &iter);
+ gtk_list_store_set (model, &iter, 0, "Smoke signals", -1);
+
+ hildon_touch_picker_append_text_column (HILDON_TOUCH_PICKER (picker),
+ GTK_TREE_MODEL (model));
+ return picker;
+}
+
+static void
+on_picker_value_changed (HildonPickerButton * button, gpointer data)
+{
+ g_print ("Newly selected value: %s\n",
+ hildon_button_get_value (HILDON_BUTTON (button)));
+}
+
+int
+main (int argc, char **args)
+{
+ HildonProgram *program = NULL;
+ GtkWidget *window = NULL;
+ GtkWidget *button;
+ GtkWidget *picker;
+
+ gtk_init (&argc, &args);
+
+ program = hildon_program_get_instance ();
+ g_set_application_name ("hildon-picker-button-example");
+
+ window = hildon_stackable_window_new ();
+ gtk_window_set_default_size (GTK_WINDOW (window), 300, 200);
+ hildon_program_add_window (program, HILDON_WINDOW (window));
+ picker = create_touch_picker ();
+
+ button = hildon_picker_button_new (HILDON_BUTTON_WITH_VERTICAL_VALUE);
+ hildon_button_set_title (HILDON_BUTTON (button), "Protocol");
+ hildon_picker_button_set_picker (HILDON_PICKER_BUTTON (button),
+ HILDON_TOUCH_PICKER (picker));
+ g_signal_connect (G_OBJECT (button), "value-changed",
+ G_CALLBACK (on_picker_value_changed), NULL);
+
+ gtk_container_add (GTK_CONTAINER (window), button);
+
+ gtk_widget_show_all (window);
+
+ g_signal_connect (G_OBJECT (window), "destroy",
+ G_CALLBACK (gtk_main_quit), NULL);
+ gtk_widget_show_all (GTK_WIDGET (window));
+
+ gtk_main ();
+
+ return 0;
+}
--- /dev/null
+#include <glib.h>
+#include <gtk/gtk.h>
+
+#include "hildon-program.h"
+#include "hildon-stackable-window.h"
+
+#include "hildon-picker-button.h"
+#include "hildon-time-button.h"
+
+static void
+on_picker_value_changed (HildonPickerButton * button, gpointer data)
+{
+ g_print ("Newly selected value: %s\n",
+ hildon_button_get_value (HILDON_BUTTON (button)));
+}
+
+int
+main (int argc, char **args)
+{
+ HildonProgram *program = NULL;
+ GtkWidget *window = NULL;
+ GtkWidget *button;
+
+ gtk_init (&argc, &args);
+
+ program = hildon_program_get_instance ();
+ g_set_application_name ("hildon-time-button-example");
+
+ window = hildon_stackable_window_new ();
+ gtk_window_set_default_size (GTK_WINDOW (window), 300, 200);
+ hildon_program_add_window (program, HILDON_WINDOW (window));
+
+ button = hildon_time_button_new (HILDON_BUTTON_WITH_VERTICAL_VALUE);
+ g_signal_connect (G_OBJECT (button), "value-changed",
+ G_CALLBACK (on_picker_value_changed), NULL);
+
+ gtk_container_add (GTK_CONTAINER (window), button);
+
+ g_signal_connect (G_OBJECT (window), "delete-event",
+ G_CALLBACK (gtk_main_quit), NULL);
+
+ gtk_widget_show_all (window);
+
+ gtk_main ();
+
+ return 0;
+}
--- /dev/null
+/*
+ * This file is a part of hildon examples
+ *
+ * Copyright (C) 2008 Nokia Corporation, all rights reserved.
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include <glib.h>
+#include <gtk/gtk.h>
+
+#include "hildon-program.h"
+#include "hildon-stackable-window.h"
+
+#include "hildon-touch-picker.h"
+#include "hildon-picker-dialog.h"
+#include "hildon-picker-button.h"
+
+static GtkWidget *create_picker ();
+static GtkWidget *get_visible_content (GtkWidget * window);
+
+static GtkWindow *parent_window = NULL;
+
+static GtkWidget *label = NULL;
+
+static void
+value_changed (HildonPickerButton * button,
+ gpointer user_data)
+{
+ HildonTouchPicker *picker;
+ gchar *aux_string = NULL;
+
+ picker = hildon_picker_button_get_picker (button);
+ aux_string = hildon_touch_picker_get_current_text (picker);
+ gtk_label_set_text (GTK_LABEL (label), aux_string);
+ g_free (aux_string);
+}
+
+static GtkWidget *
+create_picker ()
+{
+ GtkWidget *picker = NULL;
+ GSList *icon_list = NULL;
+ GtkListStore *store_icons = NULL;
+ GSList *item = NULL;
+ GtkCellRenderer *renderer = NULL;
+ GValue val = { 0, };
+ GValue val2 = { 0, };
+
+ picker = hildon_touch_picker_new ();
+
+ icon_list = gtk_stock_list_ids ();
+
+ store_icons = gtk_list_store_new (1, G_TYPE_STRING);
+ for (item = icon_list; item; item = g_slist_next (item)) {
+ GtkTreeIter iter;
+ gchar *label = item->data;
+
+ gtk_list_store_append (store_icons, &iter);
+ gtk_list_store_set (store_icons, &iter, 0, label, -1);
+ g_free (label);
+ }
+ g_slist_free (icon_list);
+
+ renderer = gtk_cell_renderer_pixbuf_new ();
+ g_value_init (&val, G_TYPE_INT);
+ g_value_set_int (&val, 100);
+ g_object_set_property (G_OBJECT (renderer), "height", &val);
+ g_value_init (&val2, G_TYPE_STRING);
+ g_value_set_string (&val2, "orange");
+ g_object_set_property (G_OBJECT (renderer), "cell-background", &val2);
+
+ hildon_touch_picker_append_column (HILDON_TOUCH_PICKER (picker),
+ GTK_TREE_MODEL (store_icons),
+ renderer, "stock-id", 0, NULL);
+
+ hildon_touch_picker_set_column_selection_mode (HILDON_TOUCH_PICKER (picker),
+ HILDON_TOUCH_PICKER_SELECTION_MODE_MULTIPLE);
+
+ return picker;
+}
+
+static GtkWidget *
+get_visible_content (GtkWidget * window)
+{
+ GtkWidget *result = NULL;
+ GtkWidget *button = NULL;
+ GtkWidget *picker;
+
+ label = gtk_label_new ("Here we are going to put the picker selection");
+
+ button = hildon_picker_button_new (HILDON_BUTTON_WITH_VERTICAL_VALUE);
+ hildon_button_set_title (HILDON_BUTTON (button), "Click me..");
+ picker = create_picker ();
+ hildon_picker_button_set_picker (HILDON_PICKER_BUTTON (button),
+ HILDON_TOUCH_PICKER (picker));
+
+ g_signal_connect (G_OBJECT (button), "value-changed",
+ G_CALLBACK (value_changed), window);
+
+ result = gtk_vbox_new (FALSE, 6);
+
+ gtk_container_add (GTK_CONTAINER (result), button);
+ gtk_container_add (GTK_CONTAINER (result), label);
+
+ return result;
+}
+
+int
+main (int argc, char **args)
+{
+ HildonProgram *program = NULL;
+ GtkWidget *window = NULL;
+
+ gtk_init (&argc, &args);
+
+ program = hildon_program_get_instance ();
+ g_set_application_name
+ ("hildon-touch-picker cell renderer example program");
+
+ window = hildon_stackable_window_new ();
+ parent_window = GTK_WINDOW (window);
+ hildon_program_add_window (program, HILDON_WINDOW (window));
+
+ gtk_container_set_border_width (GTK_CONTAINER (window), 6);
+
+ gtk_rc_parse_string ("style \"fremantle-widget\" {\n"
+ " GtkWidget::hildon-mode = 1 \n"
+ "} widget \"*.fremantle-widget\" style \"fremantle-widget\"\n");
+
+
+ GtkWidget *vbox = get_visible_content (window);
+
+ gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (vbox));
+
+ g_signal_connect (G_OBJECT (window), "destroy",
+ G_CALLBACK (gtk_main_quit), NULL);
+ gtk_widget_show_all (GTK_WIDGET (window));
+
+ gtk_main ();
+
+ return 0;
+}