1 /* Copyright (c) 2006, Nokia Corporation
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of the Nokia Corporation nor the names of its
14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
18 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
21 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #include <glib/gi18n.h>
31 #include "modest-global-settings-dialog.h"
32 #include "modest-defs.h"
33 #include "modest-ui-constants.h"
34 /* include other impl specific header files */
36 /* 'private'/'protected' functions */
37 static void modest_global_settings_dialog_class_init (ModestGlobalSettingsDialogClass *klass);
38 static void modest_global_settings_dialog_init (ModestGlobalSettingsDialog *obj);
39 static void modest_global_settings_dialog_finalize (GObject *obj);
47 static GtkWidget* create_updating_page (void);
48 static GtkWidget* create_composing_page (void);
50 typedef struct _ModestGlobalSettingsDialogPrivate ModestGlobalSettingsDialogPrivate;
51 struct _ModestGlobalSettingsDialogPrivate {
53 GtkWidget *updating_page;
54 GtkWidget *composing_page;
57 #define MODEST_GLOBAL_SETTINGS_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
58 MODEST_TYPE_GLOBAL_SETTINGS_DIALOG, \
59 ModestGlobalSettingsDialogPrivate))
61 static GtkDialogClass *parent_class = NULL;
63 /* uncomment the following if you have defined any signals */
64 /* static guint signals[LAST_SIGNAL] = {0}; */
67 modest_global_settings_dialog_get_type (void)
69 static GType my_type = 0;
71 static const GTypeInfo my_info = {
72 sizeof(ModestGlobalSettingsDialogClass),
74 NULL, /* base finalize */
75 (GClassInitFunc) modest_global_settings_dialog_class_init,
76 NULL, /* class finalize */
77 NULL, /* class data */
78 sizeof(ModestGlobalSettingsDialog),
80 (GInstanceInitFunc) modest_global_settings_dialog_init,
83 my_type = g_type_register_static (GTK_TYPE_DIALOG,
84 "ModestGlobalSettingsDialog",
91 modest_global_settings_dialog_class_init (ModestGlobalSettingsDialogClass *klass)
93 GObjectClass *gobject_class;
94 gobject_class = (GObjectClass*) klass;
96 parent_class = g_type_class_peek_parent (klass);
97 gobject_class->finalize = modest_global_settings_dialog_finalize;
99 g_type_class_add_private (gobject_class, sizeof(ModestGlobalSettingsDialogPrivate));
101 /* signal definitions go here, e.g.: */
102 /* signals[MY_SIGNAL_1] = */
103 /* g_signal_new ("my_signal_1",....); */
104 /* signals[MY_SIGNAL_2] = */
105 /* g_signal_new ("my_signal_2",....); */
110 modest_global_settings_dialog_init (ModestGlobalSettingsDialog *self)
112 ModestGlobalSettingsDialogPrivate *priv;
114 priv = MODEST_GLOBAL_SETTINGS_DIALOG_GET_PRIVATE (self);
116 priv->modified = FALSE;
117 priv->notebook = gtk_notebook_new ();
118 priv->updating_page = create_updating_page ();
119 priv->composing_page = create_composing_page ();
121 /* Add the notebook pages: */
122 gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), priv->updating_page,
123 gtk_label_new (_("mcen_ti_options_updating")));
124 gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), priv->composing_page,
125 gtk_label_new (_("mcen_ti_options_composing")));
127 gtk_container_add (GTK_CONTAINER (GTK_DIALOG (self)->vbox), priv->notebook);
128 gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (self)->vbox), MODEST_MARGIN_HALF);
129 gtk_widget_show (priv->notebook);
131 /* Add the buttons: */
132 gtk_dialog_add_button (GTK_DIALOG (self), GTK_STOCK_OK, GTK_RESPONSE_OK);
133 gtk_dialog_add_button (GTK_DIALOG (self), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
135 /* /\* Connect to the dialog's response signal: *\/ */
136 /* /\* We use connect-before */
137 /* * so we can stop the signal emission, */
138 /* * to stop the default signal handler from closing the dialog. */
140 /* g_signal_connect (G_OBJECT (self), "response", */
141 /* G_CALLBACK (on_response), self); */
144 gtk_window_set_title (GTK_WINDOW (self), _("mcen_ti_options"));
148 modest_global_settings_dialog_finalize (GObject *obj)
150 /* free/unref instance resources here */
151 G_OBJECT_CLASS(parent_class)->finalize (obj);
155 modest_global_settings_dialog_new (void)
157 return GTK_WIDGET(g_object_new(MODEST_TYPE_GLOBAL_SETTINGS_DIALOG, NULL));
160 /* insert many other interesting function implementations */
161 /* such as modest_global_settings_dialog_do_something, or modest_global_settings_dialog_has_foo */
164 create_updating_page (void)
168 box = gtk_vbox_new (FALSE, MODEST_MARGIN_NONE);
174 create_composing_page (void)
176 GtkWidget *box = gtk_vbox_new (FALSE, MODEST_MARGIN_NONE);
178 box = gtk_vbox_new (FALSE, MODEST_MARGIN_NONE);