Fixed a compilation issue
[modest] / src / hildon2 / modest-maemo-security-options-view.c
1 /* Copyright (c) 2008, Nokia Corporation
2  * All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  *
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.
16  *
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.
28  */
29
30 #include "modest-runtime.h"
31 #include "modest-security-options-view-priv.h"
32 #include "modest-maemo-security-options-view.h"
33 #include "modest-text-utils.h"
34 #include "modest-platform.h"
35 #include "modest-account-protocol.h"
36 #include "widgets/modest-ui-constants.h"
37 #include "widgets/modest-validating-entry.h"
38 #include "modest-serversecurity-picker.h"
39 #include "modest-secureauth-picker.h"
40 #include "modest-maemo-utils.h"
41 #include <modest-number-editor.h>
42 #include <hildon/hildon-check-button.h>
43 #include "modest-hildon-includes.h"
44
45 #define PORT_MIN 1
46 #define PORT_MAX 65535
47
48 typedef struct _ModestMaemoSecurityOptionsViewPrivate ModestMaemoSecurityOptionsViewPrivate;
49 struct _ModestMaemoSecurityOptionsViewPrivate {
50         gboolean missing_data;
51 };
52
53 #define MODEST_MAEMO_SECURITY_OPTIONS_VIEW_GET_PRIVATE(o) \
54         (G_TYPE_INSTANCE_GET_PRIVATE((o), \
55                                      MODEST_TYPE_MAEMO_SECURITY_OPTIONS_VIEW, \
56                                      ModestMaemoSecurityOptionsViewPrivate))
57
58 static void modest_maemo_security_options_view_init (ModestMaemoSecurityOptionsView *obj);
59 static void modest_maemo_security_options_view_finalize (GObject *obj);
60 static void modest_maemo_security_options_view_class_init (ModestMaemoSecurityOptionsViewClass *klass);
61
62 G_DEFINE_TYPE (ModestMaemoSecurityOptionsView, 
63                modest_maemo_security_options_view, 
64                MODEST_TYPE_SECURITY_OPTIONS_VIEW);
65
66 static void on_entry_changed (GtkEditable *editable, gpointer user_data);
67
68 static void on_valid_changed (ModestNumberEditor *editor, gboolean valid, ModestSecurityOptionsView *self);
69
70 /* Tracks changes in the incoming security picker */
71 static void
72 on_security_changed (GtkWidget *widget, 
73                      ModestMaemoSecurityOptionsView *self)
74 {
75         ModestSecurityOptionsViewPrivate* ppriv;
76         ModestServersecurityPicker *picker;
77         ModestProtocolType proto_type;
78         ModestProtocolRegistry *proto_registry;
79         gboolean is_secure;
80
81         ppriv = MODEST_SECURITY_OPTIONS_VIEW_GET_PRIVATE (self);
82
83         proto_registry = modest_runtime_get_protocol_registry ();
84         picker = MODEST_SERVERSECURITY_PICKER (ppriv->security_view);
85         proto_type = modest_serversecurity_picker_get_active_serversecurity (picker);
86
87         is_secure = modest_protocol_registry_protocol_type_has_tag (proto_registry, proto_type, 
88                                                                     MODEST_PROTOCOL_REGISTRY_SECURE_PROTOCOLS);
89
90         if (MODEST_SECURITY_OPTIONS_VIEW (self)->type == MODEST_SECURITY_OPTIONS_INCOMING) {
91                 /* Activate and dim checkbutton if it's secure */
92                 hildon_check_button_set_active (HILDON_CHECK_BUTTON (ppriv->auth_view), 
93                                                 is_secure);
94                 gtk_widget_set_sensitive (ppriv->auth_view, !is_secure);
95         } else {
96
97         }
98
99         if (ppriv->full) {
100                 gint port_number = 
101                         modest_serversecurity_picker_get_active_serversecurity_port (MODEST_SERVERSECURITY_PICKER (ppriv->security_view));
102                 
103                 if(port_number) {
104                         modest_number_editor_set_value (MODEST_NUMBER_EDITOR (ppriv->port_view), 
105                                                         port_number);
106                 }
107         }
108 }
109
110 static void
111 on_auth_changed (GtkWidget *widget, 
112                  ModestMaemoSecurityOptionsView *self)
113 {
114         ModestSecurityOptionsViewPrivate* ppriv;
115         ModestSecureauthPicker *picker;
116         ModestProtocolRegistry *protocol_registry;
117         ModestProtocolType auth_proto;
118         gboolean secureauth_used;
119         GtkWidget *user_caption, *pwd_caption;
120
121         ppriv = MODEST_SECURITY_OPTIONS_VIEW_GET_PRIVATE (self);
122         protocol_registry = modest_runtime_get_protocol_registry ();
123         picker = MODEST_SECUREAUTH_PICKER (ppriv->auth_view);
124
125         auth_proto = modest_secureauth_picker_get_active_secureauth (picker);
126         secureauth_used = modest_protocol_registry_protocol_type_is_secure (protocol_registry, 
127                                                                             auth_proto);
128
129         /* Get captions, well dimm the whole widget */
130         user_caption = gtk_widget_get_parent (ppriv->user_entry);
131         pwd_caption = gtk_widget_get_parent (ppriv->pwd_entry);
132         
133         /* Enable / disable */
134         gtk_widget_set_sensitive (user_caption, secureauth_used);
135         gtk_widget_set_sensitive (pwd_caption, secureauth_used);
136
137         /* Check if mandatory data is missing */
138         on_entry_changed (GTK_EDITABLE (ppriv->user_entry), (gpointer) self);
139 }
140
141 static void
142 create_incoming_security (ModestSecurityOptionsView* self,
143                           GtkSizeGroup *title_size_group,
144                           GtkSizeGroup *value_size_group)
145 {
146         ModestSecurityOptionsViewPrivate *ppriv;
147         GtkWidget *entry_caption = NULL;
148
149         ppriv = MODEST_SECURITY_OPTIONS_VIEW_GET_PRIVATE (self);
150
151         /* Create widgets for incoming security */
152         ppriv->security_view = GTK_WIDGET (modest_serversecurity_picker_new (MODEST_EDITABLE_SIZE,
153                                                                              HILDON_BUTTON_ARRANGEMENT_HORIZONTAL));
154         modest_serversecurity_picker_fill (MODEST_SERVERSECURITY_PICKER (ppriv->security_view), 
155                                            modest_protocol_registry_get_pop_type_id ());
156         modest_maemo_utils_set_hbutton_layout (title_size_group,
157                                                value_size_group,
158                                                _("mcen_li_emailsetup_secure_connection"), 
159                                                ppriv->security_view);
160
161         ppriv->auth_view = hildon_check_button_new (MODEST_EDITABLE_SIZE);
162         gtk_button_set_label (GTK_BUTTON (ppriv->auth_view), _("mcen_li_emailsetup_secure_authentication"));
163         gtk_button_set_alignment (GTK_BUTTON (ppriv->auth_view), 0.0, 0.5);
164
165         /* Track changes in UI */
166         g_signal_connect (G_OBJECT (ppriv->security_view), "value-changed",
167                           G_CALLBACK (on_security_changed), self);
168
169         /* Pack into container & show */
170         gtk_box_pack_start (GTK_BOX (self), ppriv->auth_view, FALSE, FALSE, 0);
171         gtk_box_pack_start (GTK_BOX (self), ppriv->security_view, FALSE, FALSE, 0);
172         gtk_widget_show (ppriv->security_view);
173         gtk_widget_show (ppriv->auth_view);
174
175         if (ppriv->full) {
176                 ppriv->port_view = GTK_WIDGET (modest_number_editor_new (PORT_MIN, PORT_MAX));
177                 entry_caption =
178                         modest_maemo_utils_create_captioned_with_size_type (title_size_group,
179                                                                             value_size_group,
180                                                                             _("mcen_fi_emailsetup_port"),
181                                                                             FALSE,
182                                                                             ppriv->port_view,
183                                                                             MODEST_EDITABLE_SIZE);
184                 /* Pack & show widgets */
185                 gtk_box_pack_start (GTK_BOX (self), entry_caption, FALSE, FALSE, 0);
186                 gtk_widget_show (ppriv->port_view);
187                 gtk_widget_show (entry_caption);
188
189                 /* Track changes in UI */
190                 g_signal_connect (G_OBJECT (ppriv->port_view), "valid-changed",
191                                             G_CALLBACK (on_valid_changed), self);
192         }
193 }
194
195 static void
196 on_entry_max (ModestValidatingEntry *self, 
197               gpointer user_data)
198 {
199         modest_platform_information_banner (GTK_WIDGET (self), NULL, 
200                                             _CS("ckdg_ib_maximum_characters_reached"));
201 }
202
203 /*
204  * TODO: call this whenever the auth picker changes. If we set it
205  * explicitely at the beggining to a value then there is no need to
206  * call this handler directly at the beginning
207  */
208 static void
209 on_entry_changed (GtkEditable *editable, 
210                   gpointer user_data)
211 {
212         ModestSecurityOptionsView* self;
213         ModestMaemoSecurityOptionsViewPrivate *priv;
214         ModestSecurityOptionsViewPrivate *ppriv;
215         ModestSecureauthPicker *picker;
216         gboolean is_secure = FALSE;
217         ModestProtocolRegistry *protocol_registry;
218
219         self = MODEST_SECURITY_OPTIONS_VIEW (user_data);
220         priv = MODEST_MAEMO_SECURITY_OPTIONS_VIEW_GET_PRIVATE (self);
221         ppriv = MODEST_SECURITY_OPTIONS_VIEW_GET_PRIVATE (self);
222         protocol_registry = modest_runtime_get_protocol_registry ();
223
224         /* Check if it's a secure protocol */
225         if (MODEST_IS_SECUREAUTH_PICKER (ppriv->auth_view)) {
226                 ModestProtocolType auth_proto;
227                 picker = MODEST_SECUREAUTH_PICKER (ppriv->auth_view);
228                 auth_proto = modest_secureauth_picker_get_active_secureauth (picker);
229                 is_secure = modest_protocol_registry_protocol_type_is_secure (protocol_registry,
230                                                                               auth_proto);
231         } else if (HILDON_IS_CHECK_BUTTON (ppriv->auth_view)) {
232                 is_secure = hildon_check_button_get_active (HILDON_CHECK_BUTTON (ppriv->auth_view));
233         }
234
235         if (is_secure &&
236             !g_strcmp0 (hildon_entry_get_text (HILDON_ENTRY (ppriv->user_entry)), "")) {
237                 priv->missing_data = TRUE;
238         } else {
239                 priv->missing_data = FALSE;
240         }
241
242         if (!priv->missing_data &&
243             ppriv->full &&
244             !modest_number_editor_is_valid (MODEST_NUMBER_EDITOR (ppriv->port_view)))
245                 priv->missing_data = TRUE;
246
247         /* Emit a signal to notify if mandatory data is missing */
248         g_signal_emit_by_name (G_OBJECT (self), "missing_mandatory_data",
249                                priv->missing_data, NULL);
250 }
251
252 static void
253 on_valid_changed (ModestNumberEditor *editor,
254                   gboolean valid,
255                   ModestSecurityOptionsView *self)
256 {
257         on_entry_changed (NULL, (gpointer) self);
258 }
259
260 static void
261 create_outgoing_security (ModestSecurityOptionsView* self,
262                           GtkSizeGroup *title_size_group,
263                           GtkSizeGroup *value_size_group)
264 {
265         ModestSecurityOptionsViewPrivate *ppriv;
266         GtkWidget *user_caption = NULL;
267         GtkWidget *pwd_caption = NULL, *port_caption = NULL;
268
269         ppriv = MODEST_SECURITY_OPTIONS_VIEW_GET_PRIVATE (self);
270         
271         /* The secure connection widgets */
272         ppriv->security_view = GTK_WIDGET (modest_serversecurity_picker_new (MODEST_EDITABLE_SIZE,
273                                                                              HILDON_BUTTON_ARRANGEMENT_HORIZONTAL));
274         modest_serversecurity_picker_fill (MODEST_SERVERSECURITY_PICKER (ppriv->security_view), 
275                                               MODEST_PROTOCOLS_TRANSPORT_SMTP);
276         modest_maemo_utils_set_hbutton_layout (title_size_group,
277                                                value_size_group,
278                                                _("mcen_li_emailsetup_secure_connection"), 
279                                                ppriv->security_view);
280         
281         /* The secure authentication widgets */
282         ppriv->auth_view = GTK_WIDGET (modest_secureauth_picker_new (MODEST_EDITABLE_SIZE,
283                                                                      HILDON_BUTTON_ARRANGEMENT_HORIZONTAL));
284         modest_maemo_utils_set_hbutton_layout (title_size_group,
285                                                value_size_group,
286                                                _("mcen_li_emailsetup_secure_authentication"), 
287                                                ppriv->auth_view);
288
289         if (ppriv->full) {
290                 gchar *user_label;
291
292                 /* Username widgets */
293                 ppriv->user_entry = GTK_WIDGET (modest_validating_entry_new ());
294
295                 /* Auto-capitalization is the default, so let's turn it off: */
296                 hildon_gtk_entry_set_input_mode (GTK_ENTRY (ppriv->user_entry), 
297                                                  HILDON_GTK_INPUT_MODE_FULL);
298
299                 user_label = g_strdup_printf("%s*", _("mail_fi_username"));
300                 user_caption = modest_maemo_utils_create_captioned_with_size_type (title_size_group,
301                                                                                    value_size_group,
302                                                                                    user_label,
303                                                                                    FALSE,
304                                                                                    ppriv->user_entry,
305                                                                                    MODEST_EDITABLE_SIZE);
306                 g_free (user_label);
307         
308                 /* Prevent the use of some characters. Limit the max
309                    length as well */
310                 modest_validating_entry_set_unallowed_characters_whitespace (
311                      MODEST_VALIDATING_ENTRY (ppriv->user_entry));      
312                 gtk_entry_set_max_length (GTK_ENTRY (ppriv->user_entry), 64);
313                 modest_validating_entry_set_max_func (MODEST_VALIDATING_ENTRY (ppriv->user_entry),
314                                                       on_entry_max, self);
315                 
316                 /* Password widgets */
317                 ppriv->pwd_entry = hildon_entry_new (MODEST_EDITABLE_SIZE);
318
319                 /* Auto-capitalization is the default, so let's turn it off */
320                 hildon_gtk_entry_set_input_mode (GTK_ENTRY (ppriv->pwd_entry),
321                                                  HILDON_GTK_INPUT_MODE_FULL | 
322                                                  HILDON_GTK_INPUT_MODE_INVISIBLE);
323                 gtk_entry_set_visibility (GTK_ENTRY (ppriv->pwd_entry), FALSE);
324
325                 pwd_caption =
326                         modest_maemo_utils_create_captioned_with_size_type (title_size_group,
327                                                                             value_size_group,
328                                                                             _("mail_fi_password"),
329                                                                             FALSE,
330                                                                             ppriv->pwd_entry,
331                                                                             MODEST_EDITABLE_SIZE);
332
333                 ppriv->port_view = GTK_WIDGET (modest_number_editor_new (PORT_MIN, PORT_MAX));
334                 port_caption =
335                         modest_maemo_utils_create_captioned_with_size_type (title_size_group,
336                                                                             value_size_group,
337                                                                             _("mcen_fi_emailsetup_port"),
338                                                                             FALSE,
339                                                                             ppriv->port_view,
340                                                                             MODEST_EDITABLE_SIZE);
341         }
342
343         /* Track changes in UI */       
344         g_signal_connect (G_OBJECT (ppriv->security_view), "value-changed",
345                           G_CALLBACK (on_security_changed), self);
346         if (ppriv->full) {
347                 g_signal_connect (G_OBJECT (ppriv->auth_view), "value-changed",
348                                   G_CALLBACK (on_auth_changed), self);
349                 g_signal_connect (G_OBJECT (ppriv->user_entry), "changed",
350                                   G_CALLBACK (on_entry_changed), self);
351                 g_signal_connect (G_OBJECT (ppriv->port_view), "valid-changed",
352                                             G_CALLBACK (on_valid_changed), self);
353         }
354
355         /* Initialize widgets */
356         modest_serversecurity_picker_set_active_serversecurity (
357                 MODEST_SERVERSECURITY_PICKER (ppriv->security_view), 
358                 MODEST_PROTOCOLS_CONNECTION_NONE);
359         modest_secureauth_picker_set_active_secureauth (
360            MODEST_SECUREAUTH_PICKER (ppriv->auth_view),
361            MODEST_PROTOCOLS_AUTH_NONE);
362
363         /* Pack into container */
364         if (ppriv->full) {
365                 gtk_box_pack_start (GTK_BOX (self), ppriv->auth_view, FALSE, FALSE, 0);
366                 gtk_box_pack_start (GTK_BOX (self), user_caption, FALSE, FALSE, 0);
367                 gtk_box_pack_start (GTK_BOX (self), pwd_caption, FALSE, FALSE, 0);
368                 gtk_box_pack_start (GTK_BOX (self), ppriv->security_view, FALSE, FALSE, 0);
369                 gtk_box_pack_start (GTK_BOX (self), port_caption, FALSE, FALSE, 0);
370         } else {
371                 gtk_box_pack_start (GTK_BOX (self), ppriv->auth_view, FALSE, FALSE, 0);
372                 gtk_box_pack_start (GTK_BOX (self), ppriv->security_view, FALSE, FALSE, 0);
373         }
374
375         /* Show widgets */
376         if (ppriv->full) {
377                 gtk_widget_show (ppriv->pwd_entry);
378                 gtk_widget_show (ppriv->user_entry);
379                 gtk_widget_show (ppriv->port_view);
380                 gtk_widget_show (pwd_caption);
381                 gtk_widget_show (user_caption);
382                 gtk_widget_show (port_caption);
383         }
384         gtk_widget_show (ppriv->security_view);
385         gtk_widget_show (ppriv->auth_view);
386 }
387
388 GtkWidget *    
389 modest_maemo_security_options_view_new  (ModestSecurityOptionsType type,
390                                          gboolean full,
391                                          GtkSizeGroup *title_size_group,
392                                          GtkSizeGroup *value_size_group)
393 {
394         ModestSecurityOptionsView* self;
395         ModestSecurityOptionsViewPrivate *ppriv;
396
397         self = (ModestSecurityOptionsView *)
398                 g_object_new (MODEST_TYPE_MAEMO_SECURITY_OPTIONS_VIEW, NULL);
399         ppriv = MODEST_SECURITY_OPTIONS_VIEW_GET_PRIVATE (self);
400
401         ppriv->full = full;
402         self->type = type;
403         if (self->type == MODEST_SECURITY_OPTIONS_INCOMING)
404                 create_incoming_security (self, title_size_group, value_size_group);
405         else
406                 create_outgoing_security (self, title_size_group, value_size_group);
407
408         return (GtkWidget *) self;
409 }
410
411 gboolean
412 modest_security_options_view_has_missing_mandatory_data (ModestSecurityOptionsView* self)
413 {
414         ModestMaemoSecurityOptionsViewPrivate *priv;
415
416         priv = MODEST_MAEMO_SECURITY_OPTIONS_VIEW_GET_PRIVATE (self);
417
418         return priv->missing_data;
419 }
420
421 static void
422 modest_maemo_security_options_view_load_settings (ModestSecurityOptionsView* self,
423                                                   ModestAccountSettings *settings)
424 {
425         ModestSecurityOptionsViewPrivate *ppriv;
426         ModestServerAccountSettings *server_settings;
427         gint port_number;
428
429         ppriv = MODEST_SECURITY_OPTIONS_VIEW_GET_PRIVATE (self);
430
431         if (self->type == MODEST_SECURITY_OPTIONS_INCOMING)
432                 server_settings = modest_account_settings_get_store_settings (settings);
433         else
434                 server_settings = modest_account_settings_get_transport_settings (settings);
435         port_number = modest_server_account_settings_get_port (server_settings);
436
437         if (port_number == 0) {
438                 /* Show the appropriate port number */
439                 on_security_changed (ppriv->security_view, 
440                                      MODEST_MAEMO_SECURITY_OPTIONS_VIEW (self));
441         } else if (ppriv->full) {
442                 /* Keep the user-entered port-number, or the
443                  * already-appropriate automatic port number */
444                 modest_number_editor_set_value (MODEST_NUMBER_EDITOR (ppriv->port_view), 
445                                                 port_number);
446         }
447         /* Frees */
448         g_object_unref (server_settings);
449 }
450
451 static void
452 modest_maemo_security_options_view_save_settings (ModestSecurityOptionsView* self, 
453                                                   ModestAccountSettings *settings)
454 {
455         ModestServerAccountSettings *server_settings;
456         ModestSecurityOptionsViewPrivate *ppriv;
457         gint server_port;
458
459         ppriv = MODEST_SECURITY_OPTIONS_VIEW_GET_PRIVATE (self);
460
461         if (self->type == MODEST_SECURITY_OPTIONS_INCOMING)
462                 server_settings = modest_account_settings_get_store_settings (settings);
463         else
464                 server_settings = modest_account_settings_get_transport_settings (settings);
465
466         if (ppriv->full) {
467                 server_port = modest_number_editor_get_value (MODEST_NUMBER_EDITOR (ppriv->port_view));
468         } else {
469                 server_port = modest_serversecurity_picker_get_active_serversecurity_port (MODEST_SERVERSECURITY_PICKER (ppriv->security_view));
470         }
471
472         modest_server_account_settings_set_port (server_settings, server_port);
473
474         /* Frees */
475         g_object_unref (server_settings);
476 }
477
478 static gboolean 
479 modest_maemo_security_options_view_changed (ModestSecurityOptionsView* self,
480                                             ModestAccountSettings *settings)
481 {
482         ModestServerAccountSettings *server_settings;
483         ModestSecurityOptionsViewPrivate *ppriv;
484         gint server_port;
485
486         ppriv = MODEST_SECURITY_OPTIONS_VIEW_GET_PRIVATE (self);
487         
488         /* If we're not showing the port number then it never changes */
489         if (!ppriv->full)
490                 return FALSE;
491
492         if (self->type == MODEST_SECURITY_OPTIONS_INCOMING)
493                 server_settings = modest_account_settings_get_store_settings (settings);
494         else
495                 server_settings = modest_account_settings_get_transport_settings (settings);
496         
497         server_port = 
498                 modest_number_editor_get_value (MODEST_NUMBER_EDITOR (ppriv->port_view));
499
500         /* Frees */
501         g_object_unref (server_settings);
502
503         if (server_port != ppriv->initial_state.port)
504                 return TRUE;
505         else
506                 return FALSE;
507 }
508
509 static void
510 modest_maemo_security_options_view_init (ModestMaemoSecurityOptionsView *obj)
511 {
512 }
513
514 static void
515 modest_maemo_security_options_view_finalize (GObject *obj)
516 {
517         G_OBJECT_CLASS (modest_maemo_security_options_view_parent_class)->finalize (obj);
518 }
519
520
521 static void     
522 modest_maemo_security_options_view_class_init (ModestMaemoSecurityOptionsViewClass *klass)
523 {
524         GObjectClass *gobject_class = (GObjectClass*) klass;
525
526         modest_maemo_security_options_view_parent_class = g_type_class_peek_parent (klass);
527
528         g_type_class_add_private (gobject_class, sizeof (ModestMaemoSecurityOptionsViewPrivate));
529         gobject_class->finalize = modest_maemo_security_options_view_finalize;
530
531         MODEST_SECURITY_OPTIONS_VIEW_CLASS (klass)->load_settings = 
532                 modest_maemo_security_options_view_load_settings;
533         MODEST_SECURITY_OPTIONS_VIEW_CLASS (klass)->save_settings = 
534                 modest_maemo_security_options_view_save_settings;
535         MODEST_SECURITY_OPTIONS_VIEW_CLASS (klass)->changed = 
536                 modest_maemo_security_options_view_changed;
537 }