* add some new windows to the gtk2 backend. very experimental
[modest] / src / gtk2 / modest-account-wizard.c
1 /* modest-account-wizard.c */
2
3 /* insert (c)/licensing information) */
4
5 #include "modest-account-wizard.h"
6 /* include other impl specific header files */
7
8 /* 'private'/'protected' functions */
9 static void                       modest_account_wizard_class_init    (ModestAccountWizardClass *klass);
10 static void                       modest_account_wizard_init          (ModestAccountWizard *obj);
11 static void                       modest_account_wizard_finalize      (GObject *obj);
12
13 /* list my signals */
14 enum {
15         /* MY_SIGNAL_1, */
16         /* MY_SIGNAL_2, */
17         LAST_SIGNAL
18 };
19
20 typedef struct _ModestAccountWizardPrivate ModestAccountWizardPrivate;
21 struct _ModestAccountWizardPrivate {
22         /* my private members go here, eg. */
23         /* gboolean frobnicate_mode; */
24 };
25 #define MODEST_ACCOUNT_WIZARD_GET_PRIVATE(o)      (G_TYPE_INSTANCE_GET_PRIVATE((o), \
26                                                    MODEST_TYPE_ACCOUNT_WIZARD, \
27                                                    ModestAccountWizardPrivate))
28 /* globals */
29 static GtkAssistantClass *parent_class = NULL;
30
31 /* uncomment the following if you have defined any signals */
32 /* static guint signals[LAST_SIGNAL] = {0}; */
33
34 GType
35 modest_account_wizard_get_type (void)
36 {
37         static GType my_type = 0;
38         if (!my_type) {
39                 static const GTypeInfo my_info = {
40                         sizeof(ModestAccountWizardClass),
41                         NULL,           /* base init */
42                         NULL,           /* base finalize */
43                         (GClassInitFunc) modest_account_wizard_class_init,
44                         NULL,           /* class finalize */
45                         NULL,           /* class data */
46                         sizeof(ModestAccountWizard),
47                         1,              /* n_preallocs */
48                         (GInstanceInitFunc) modest_account_wizard_init,
49                 };
50                 my_type = g_type_register_static (GTK_TYPE_ASSISTANT,
51                                                   "ModestAccountWizard",
52                                                   &my_info, 0);
53         }
54         return my_type;
55 }
56
57 static void
58 modest_account_wizard_class_init (ModestAccountWizardClass *klass)
59 {
60         GObjectClass *gobject_class;
61         gobject_class = (GObjectClass*) klass;
62
63         parent_class            = g_type_class_peek_parent (klass);
64         gobject_class->finalize = modest_account_wizard_finalize;
65
66         g_type_class_add_private (gobject_class, sizeof(ModestAccountWizardPrivate));
67
68         /* signal definitions go here, e.g.: */
69 /*      signals[MY_SIGNAL_1] = */
70 /*              g_signal_new ("my_signal_1",....); */
71 /*      signals[MY_SIGNAL_2] = */
72 /*              g_signal_new ("my_signal_2",....); */
73 /*      etc. */
74 }
75
76
77
78 static GtkWidget*
79 first_page ()
80 {
81         GtkWidget *label;
82
83         const gchar* txt =
84                 _("Welcome to the Modest Setup Wizard\n\n"
85                   "This wizard will help you to set up email accounts.\n"
86                   "Push the 'Next'-button to start");
87
88         label = gtk_label_new (NULL);
89         gtk_label_set_markup (GTK_LABEL(label), txt);
90
91         return label;
92 }
93
94
95
96
97 static void
98 modest_account_wizard_init (ModestAccountWizard *obj)
99 {
100         GtkWidget *page1;
101         int pageno;
102         
103         page1 = first_page ();
104         pageno = gtk_assistant_append_page (GTK_ASSISTANT(obj), page1);
105
106         gtk_assistant_set_page_type (GTK_ASSISTANT(obj),
107                                      page1,
108                                      GTK_ASSISTANT_PAGE_INTRO);
109         gtk_assistant_set_page_title (GTK_ASSISTANT(obj),
110                                       page1, _("Account Wizard"));
111
112         gtk_assistant_set_page_complete  (GTK_ASSISTANT(obj), page1, TRUE);
113         
114         /* without this next one, we crash...
115          * http://bugzilla.gnome.org/show_bug.cgi?id=347048
116          */
117         //k_assistant_set_current_page (GTK_ASSISTANT(obj), pageno);
118
119         
120 }
121
122 static void
123 modest_account_wizard_finalize (GObject *obj)
124 {
125 /*      free/unref instance resources here */
126 }
127
128 GtkWidget*
129 modest_account_wizard_new (void)
130 {
131         return GTK_WIDGET(g_object_new(MODEST_TYPE_ACCOUNT_WIZARD, NULL));
132 }