* src/hildon-pannable-area.c: (hildon_pannable_area_refresh), (hildon_pannable_area_m...
[hildon] / examples / hildon-wizard-dialog-example.c
1 /*
2  * This file is a part of hildon examples
3  *
4  * Copyright (C) 2005, 2006, 2007 Nokia Corporation, all rights reserved.
5  *
6  * Author: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation; version 2.1 of
11  * the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21  * 02110-1301 USA
22  *
23  */
24
25 #include                                        <stdio.h>
26 #include                                        <stdlib.h>
27 #include                                        <glib.h>
28 #include                                        <gtk/gtk.h>
29 #include                                        "hildon.h"
30
31 gboolean
32 on_page_switch (GtkNotebook *notebook, 
33                 GtkNotebookPage *page, 
34                 guint num,
35                 HildonWizardDialog *dialog);
36
37 gboolean
38 on_page_switch (GtkNotebook *notebook, 
39                 GtkNotebookPage *page, 
40                 guint num,
41                 HildonWizardDialog *dialog)
42 {
43     g_debug ("Page %d", num);
44
45     if (num == 1) {
46         g_debug ("Making next insensitive! %d", num);
47         gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), HILDON_WIZARD_DIALOG_NEXT, FALSE);
48     }
49     
50     return TRUE;
51 }
52
53 int
54 main (int argc, char **args)
55 {
56     gtk_init (&argc, &args);
57    
58     GtkWidget *notebook = gtk_notebook_new ();
59     GtkWidget *label_1 = gtk_label_new ("Page 1");
60     GtkWidget *label_2 = gtk_label_new ("Page 2");
61     GtkWidget *label_3 = gtk_label_new ("Page 3");
62
63     gtk_notebook_append_page (GTK_NOTEBOOK (notebook), label_1, NULL);
64     gtk_notebook_append_page (GTK_NOTEBOOK (notebook), label_2, NULL);
65     gtk_notebook_append_page (GTK_NOTEBOOK (notebook), label_3, NULL);
66
67     GtkWidget *dialog = hildon_wizard_dialog_new (NULL, "Wizard", GTK_NOTEBOOK (notebook));
68     g_signal_connect (G_OBJECT (notebook), "switch-page", G_CALLBACK (on_page_switch), dialog);
69
70     gtk_widget_show_all (dialog);
71     gtk_dialog_run (GTK_DIALOG (dialog));
72     
73     return 0;
74 }
75
76