069372cdc396ca995da50dbd145dc0e26f4fb0ed
[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-hildon-includes.h"
42
43 #define PORT_MIN 1
44 #define PORT_MAX 65535
45
46 typedef struct _ModestMaemoSecurityOptionsViewPrivate ModestMaemoSecurityOptionsViewPrivate;
47 struct _ModestMaemoSecurityOptionsViewPrivate {
48         gboolean missing_data;
49 };
50
51 #define MODEST_MAEMO_SECURITY_OPTIONS_VIEW_GET_PRIVATE(o) \
52         (G_TYPE_INSTANCE_GET_PRIVATE((o), \
53                                      MODEST_TYPE_MAEMO_SECURITY_OPTIONS_VIEW, \
54                                      ModestMaemoSecurityOptionsViewPrivate))
55
56 static void modest_maemo_security_options_view_init (ModestMaemoSecurityOptionsView *obj);
57 static void modest_maemo_security_options_view_finalize (GObject *obj);
58 static void modest_maemo_security_options_view_class_init (ModestMaemoSecurityOptionsViewClass *klass);
59
60 G_DEFINE_TYPE (ModestMaemoSecurityOptionsView, 
61                modest_maemo_security_options_view, 
62                MODEST_TYPE_SECURITY_OPTIONS_VIEW);
63
64 static void on_entry_changed (GtkEditable *editable, gpointer user_data);
65
66 #ifdef MODEST_NUMBER_ENTRY_SUPPORT_VALID_CHANGED
67 static void on_valid_changed (ModestNumberEditor *editor, gboolean valid, ModestSecurityOptionsView *self);
68 #endif
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                 modest_togglable_set_active (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_entry_set_value (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 = modest_toolkit_factory_create_check_button (modest_runtime_get_toolkit_factory (),
162                                                                        _("mcen_li_emailsetup_secure_authentication"));
163
164         /* Track changes in UI */
165         g_signal_connect (G_OBJECT (ppriv->security_view), "value-changed",
166                           G_CALLBACK (on_security_changed), self);
167
168         /* Pack into container & show */
169         gtk_box_pack_start (GTK_BOX (self), ppriv->auth_view, FALSE, FALSE, 0);
170         gtk_box_pack_start (GTK_BOX (self), ppriv->security_view, FALSE, FALSE, 0);
171         gtk_widget_show (ppriv->security_view);
172         gtk_widget_show (ppriv->auth_view);
173
174         if (ppriv->full) {
175                 ppriv->port_view = modest_toolkit_factory_create_number_entry (modest_runtime_get_toolkit_factory (),
176                                                                                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 #ifdef MODEST_NUMBER_ENTRY_SUPPORT_VALID_CHANGED
191                 g_signal_connect (G_OBJECT (ppriv->port_view), "valid-changed",
192                                             G_CALLBACK (on_valid_changed), self);
193 #endif
194         }
195 }
196
197 static void
198 on_entry_max (ModestValidatingEntry *self, 
199               gpointer user_data)
200 {
201         modest_platform_information_banner (GTK_WIDGET (self), NULL, 
202                                             _CS("ckdg_ib_maximum_characters_reached"));
203 }
204
205 /*
206  * TODO: call this whenever the auth picker changes. If we set it
207  * explicitely at the beggining to a value then there is no need to
208  * call this handler directly at the beginning
209  */
210 static void
211 on_entry_changed (GtkEditable *editable, 
212                   gpointer user_data)
213 {
214         ModestSecurityOptionsView* self;
215         ModestMaemoSecurityOptionsViewPrivate *priv;
216         ModestSecurityOptionsViewPrivate *ppriv;
217         ModestSecureauthPicker *picker;
218         gboolean is_secure = FALSE;
219         ModestProtocolRegistry *protocol_registry;
220
221         self = MODEST_SECURITY_OPTIONS_VIEW (user_data);
222         priv = MODEST_MAEMO_SECURITY_OPTIONS_VIEW_GET_PRIVATE (self);
223         ppriv = MODEST_SECURITY_OPTIONS_VIEW_GET_PRIVATE (self);
224         protocol_registry = modest_runtime_get_protocol_registry ();
225
226         /* Check if it's a secure protocol */
227         if (MODEST_IS_SECUREAUTH_PICKER (ppriv->auth_view)) {
228                 ModestProtocolType auth_proto;
229                 picker = MODEST_SECUREAUTH_PICKER (ppriv->auth_view);
230                 auth_proto = modest_secureauth_picker_get_active_secureauth (picker);
231                 is_secure = modest_protocol_registry_protocol_type_is_secure (protocol_registry,
232                                                                               auth_proto);
233         } else if (modest_is_togglable (ppriv->auth_view)) {
234                 is_secure = modest_togglable_get_active (ppriv->auth_view);
235         }
236
237         if (is_secure &&
238             !g_strcmp0 (modest_entry_get_text (ppriv->user_entry), "")) {
239                 priv->missing_data = TRUE;
240         } else {
241                 priv->missing_data = FALSE;
242         }
243
244         if (!priv->missing_data &&
245             ppriv->full &&
246             !modest_number_entry_is_valid (ppriv->port_view))
247                 priv->missing_data = TRUE;
248
249         /* Emit a signal to notify if mandatory data is missing */
250         g_signal_emit_by_name (G_OBJECT (self), "missing_mandatory_data",
251                                priv->missing_data, NULL);
252 }
253
254 #ifdef MODEST_NUMBER_ENTRY_SUPPORT_VALID_CHANGED
255 static void
256 on_valid_changed (ModestNumberEditor *editor,
257                   gboolean valid,
258                   ModestSecurityOptionsView *self)
259 {
260         on_entry_changed (NULL, (gpointer) self);
261 }
262 #endif
263
264 static void
265 create_outgoing_security (ModestSecurityOptionsView* self,
266                           GtkSizeGroup *title_size_group,
267                           GtkSizeGroup *value_size_group)
268 {
269         ModestSecurityOptionsViewPrivate *ppriv;
270         GtkWidget *user_caption = NULL;
271         GtkWidget *pwd_caption = NULL, *port_caption = NULL;
272
273         ppriv = MODEST_SECURITY_OPTIONS_VIEW_GET_PRIVATE (self);
274         
275         /* The secure connection widgets */
276         ppriv->security_view = GTK_WIDGET (modest_serversecurity_picker_new (MODEST_EDITABLE_SIZE,
277                                                                              HILDON_BUTTON_ARRANGEMENT_HORIZONTAL));
278         modest_serversecurity_picker_fill (MODEST_SERVERSECURITY_PICKER (ppriv->security_view), 
279                                               MODEST_PROTOCOLS_TRANSPORT_SMTP);
280         modest_maemo_utils_set_hbutton_layout (title_size_group,
281                                                value_size_group,
282                                                _("mcen_li_emailsetup_secure_connection"), 
283                                                ppriv->security_view);
284         
285         /* The secure authentication widgets */
286         ppriv->auth_view = GTK_WIDGET (modest_secureauth_picker_new (MODEST_EDITABLE_SIZE,
287                                                                      HILDON_BUTTON_ARRANGEMENT_HORIZONTAL));
288         modest_maemo_utils_set_hbutton_layout (title_size_group,
289                                                value_size_group,
290                                                _("mcen_li_emailsetup_secure_authentication"), 
291                                                ppriv->auth_view);
292
293         if (ppriv->full) {
294                 gchar *user_label;
295
296                 /* Username widgets */
297                 ppriv->user_entry = GTK_WIDGET (modest_validating_entry_new ());
298
299                 /* Auto-capitalization is the default, so let's turn it off: */
300                 hildon_gtk_entry_set_input_mode (GTK_ENTRY (ppriv->user_entry), 
301                                                  HILDON_GTK_INPUT_MODE_FULL);
302
303                 user_label = g_strdup_printf("%s*", _("mail_fi_username"));
304                 user_caption = modest_maemo_utils_create_captioned_with_size_type (title_size_group,
305                                                                                    value_size_group,
306                                                                                    user_label,
307                                                                                    FALSE,
308                                                                                    ppriv->user_entry,
309                                                                                    MODEST_EDITABLE_SIZE);
310                 g_free (user_label);
311         
312                 /* Prevent the use of some characters. Limit the max
313                    length as well */
314                 modest_validating_entry_set_unallowed_characters_whitespace (
315                      MODEST_VALIDATING_ENTRY (ppriv->user_entry));      
316                 gtk_entry_set_max_length (GTK_ENTRY (ppriv->user_entry), 64);
317                 modest_validating_entry_set_max_func (MODEST_VALIDATING_ENTRY (ppriv->user_entry),
318                                                       on_entry_max, self);
319                 
320                 /* Password widgets */
321                 ppriv->pwd_entry = modest_toolkit_factory_create_entry (modest_runtime_get_toolkit_factory ());
322
323                 /* Auto-capitalization is the default, so let's turn it off */
324                 hildon_gtk_entry_set_input_mode (GTK_ENTRY (ppriv->pwd_entry),
325                                                  HILDON_GTK_INPUT_MODE_FULL | 
326                                                  HILDON_GTK_INPUT_MODE_INVISIBLE);
327                 gtk_entry_set_visibility (GTK_ENTRY (ppriv->pwd_entry), FALSE);
328
329                 pwd_caption =
330                         modest_maemo_utils_create_captioned_with_size_type (title_size_group,
331                                                                             value_size_group,
332                                                                             _("mail_fi_password"),
333                                                                             FALSE,
334                                                                             ppriv->pwd_entry,
335                                                                             MODEST_EDITABLE_SIZE);
336
337                 ppriv->port_view = modest_toolkit_factory_create_number_entry (modest_runtime_get_toolkit_factory (),
338                                                                                PORT_MIN, PORT_MAX);
339                 port_caption =
340                         modest_maemo_utils_create_captioned_with_size_type (title_size_group,
341                                                                             value_size_group,
342                                                                             _("mcen_fi_emailsetup_port"),
343                                                                             FALSE,
344                                                                             ppriv->port_view,
345                                                                             MODEST_EDITABLE_SIZE);
346         }
347
348         /* Track changes in UI */       
349         g_signal_connect (G_OBJECT (ppriv->security_view), "value-changed",
350                           G_CALLBACK (on_security_changed), self);
351         if (ppriv->full) {
352                 g_signal_connect (G_OBJECT (ppriv->auth_view), "value-changed",
353                                   G_CALLBACK (on_auth_changed), self);
354                 g_signal_connect (G_OBJECT (ppriv->user_entry), "changed",
355                                   G_CALLBACK (on_entry_changed), self);
356 #ifdef MODEST_NUMBER_ENTRY_SUPPORT_VALID_CHANGED
357                 g_signal_connect (G_OBJECT (ppriv->port_view), "valid-changed",
358                                             G_CALLBACK (on_valid_changed), self);
359 #endif
360         }
361
362         /* Initialize widgets */
363         modest_serversecurity_picker_set_active_serversecurity (
364                 MODEST_SERVERSECURITY_PICKER (ppriv->security_view), 
365                 MODEST_PROTOCOLS_CONNECTION_NONE);
366         modest_secureauth_picker_set_active_secureauth (
367            MODEST_SECUREAUTH_PICKER (ppriv->auth_view),
368            MODEST_PROTOCOLS_AUTH_NONE);
369
370         /* Pack into container */
371         if (ppriv->full) {
372                 gtk_box_pack_start (GTK_BOX (self), ppriv->auth_view, FALSE, FALSE, 0);
373                 gtk_box_pack_start (GTK_BOX (self), user_caption, FALSE, FALSE, 0);
374                 gtk_box_pack_start (GTK_BOX (self), pwd_caption, FALSE, FALSE, 0);
375                 gtk_box_pack_start (GTK_BOX (self), ppriv->security_view, FALSE, FALSE, 0);
376                 gtk_box_pack_start (GTK_BOX (self), port_caption, FALSE, FALSE, 0);
377         } else {
378                 gtk_box_pack_start (GTK_BOX (self), ppriv->auth_view, FALSE, FALSE, 0);
379                 gtk_box_pack_start (GTK_BOX (self), ppriv->security_view, FALSE, FALSE, 0);
380         }
381
382         /* Show widgets */
383         if (ppriv->full) {
384                 gtk_widget_show (ppriv->pwd_entry);
385                 gtk_widget_show (ppriv->user_entry);
386                 gtk_widget_show (ppriv->port_view);
387                 gtk_widget_show (pwd_caption);
388                 gtk_widget_show (user_caption);
389                 gtk_widget_show (port_caption);
390         }
391         gtk_widget_show (ppriv->security_view);
392         gtk_widget_show (ppriv->auth_view);
393 }
394
395 GtkWidget *    
396 modest_maemo_security_options_view_new  (ModestSecurityOptionsType type,
397                                          gboolean full,
398                                          GtkSizeGroup *title_size_group,
399                                          GtkSizeGroup *value_size_group)
400 {
401         ModestSecurityOptionsView* self;
402         ModestSecurityOptionsViewPrivate *ppriv;
403
404         self = (ModestSecurityOptionsView *)
405                 g_object_new (MODEST_TYPE_MAEMO_SECURITY_OPTIONS_VIEW, NULL);
406         ppriv = MODEST_SECURITY_OPTIONS_VIEW_GET_PRIVATE (self);
407
408         ppriv->full = full;
409         self->type = type;
410         if (self->type == MODEST_SECURITY_OPTIONS_INCOMING)
411                 create_incoming_security (self, title_size_group, value_size_group);
412         else
413                 create_outgoing_security (self, title_size_group, value_size_group);
414
415         return (GtkWidget *) self;
416 }
417
418 gboolean
419 modest_security_options_view_has_missing_mandatory_data (ModestSecurityOptionsView* self)
420 {
421         ModestMaemoSecurityOptionsViewPrivate *priv;
422
423         priv = MODEST_MAEMO_SECURITY_OPTIONS_VIEW_GET_PRIVATE (self);
424
425         return priv->missing_data;
426 }
427
428 static void
429 modest_maemo_security_options_view_load_settings (ModestSecurityOptionsView* self,
430                                                   ModestAccountSettings *settings)
431 {
432         ModestSecurityOptionsViewPrivate *ppriv;
433         ModestServerAccountSettings *server_settings;
434         gint port_number;
435
436         ppriv = MODEST_SECURITY_OPTIONS_VIEW_GET_PRIVATE (self);
437
438         if (self->type == MODEST_SECURITY_OPTIONS_INCOMING)
439                 server_settings = modest_account_settings_get_store_settings (settings);
440         else
441                 server_settings = modest_account_settings_get_transport_settings (settings);
442         port_number = modest_server_account_settings_get_port (server_settings);
443
444         if (port_number == 0) {
445                 /* Show the appropriate port number */
446                 on_security_changed (ppriv->security_view, 
447                                      MODEST_MAEMO_SECURITY_OPTIONS_VIEW (self));
448         } else if (ppriv->full) {
449                 /* Keep the user-entered port-number, or the
450                  * already-appropriate automatic port number */
451                 modest_number_entry_set_value (ppriv->port_view,
452                                                port_number);
453         }
454         /* Frees */
455         g_object_unref (server_settings);
456 }
457
458 static void
459 modest_maemo_security_options_view_save_settings (ModestSecurityOptionsView* self, 
460                                                   ModestAccountSettings *settings)
461 {
462         ModestServerAccountSettings *server_settings;
463         ModestSecurityOptionsViewPrivate *ppriv;
464         gint server_port;
465
466         ppriv = MODEST_SECURITY_OPTIONS_VIEW_GET_PRIVATE (self);
467
468         if (self->type == MODEST_SECURITY_OPTIONS_INCOMING)
469                 server_settings = modest_account_settings_get_store_settings (settings);
470         else
471                 server_settings = modest_account_settings_get_transport_settings (settings);
472
473         if (ppriv->full) {
474                 server_port = modest_number_entry_get_value (ppriv->port_view);
475         } else {
476                 server_port = modest_serversecurity_picker_get_active_serversecurity_port (MODEST_SERVERSECURITY_PICKER (ppriv->security_view));
477         }
478
479         modest_server_account_settings_set_port (server_settings, server_port);
480
481         /* Frees */
482         g_object_unref (server_settings);
483 }
484
485 static gboolean 
486 modest_maemo_security_options_view_changed (ModestSecurityOptionsView* self,
487                                             ModestAccountSettings *settings)
488 {
489         ModestServerAccountSettings *server_settings;
490         ModestSecurityOptionsViewPrivate *ppriv;
491         gint server_port;
492
493         ppriv = MODEST_SECURITY_OPTIONS_VIEW_GET_PRIVATE (self);
494         
495         /* If we're not showing the port number then it never changes */
496         if (!ppriv->full)
497                 return FALSE;
498
499         if (self->type == MODEST_SECURITY_OPTIONS_INCOMING)
500                 server_settings = modest_account_settings_get_store_settings (settings);
501         else
502                 server_settings = modest_account_settings_get_transport_settings (settings);
503         
504         server_port = 
505                 modest_number_entry_get_value (ppriv->port_view);
506
507         /* Frees */
508         g_object_unref (server_settings);
509
510         if (server_port != ppriv->initial_state.port)
511                 return TRUE;
512         else
513                 return FALSE;
514 }
515
516 static void
517 modest_maemo_security_options_view_init (ModestMaemoSecurityOptionsView *obj)
518 {
519 }
520
521 static void
522 modest_maemo_security_options_view_finalize (GObject *obj)
523 {
524         G_OBJECT_CLASS (modest_maemo_security_options_view_parent_class)->finalize (obj);
525 }
526
527
528 static void     
529 modest_maemo_security_options_view_class_init (ModestMaemoSecurityOptionsViewClass *klass)
530 {
531         GObjectClass *gobject_class = (GObjectClass*) klass;
532
533         modest_maemo_security_options_view_parent_class = g_type_class_peek_parent (klass);
534
535         g_type_class_add_private (gobject_class, sizeof (ModestMaemoSecurityOptionsViewPrivate));
536         gobject_class->finalize = modest_maemo_security_options_view_finalize;
537
538         MODEST_SECURITY_OPTIONS_VIEW_CLASS (klass)->load_settings = 
539                 modest_maemo_security_options_view_load_settings;
540         MODEST_SECURITY_OPTIONS_VIEW_CLASS (klass)->save_settings = 
541                 modest_maemo_security_options_view_save_settings;
542         MODEST_SECURITY_OPTIONS_VIEW_CLASS (klass)->changed = 
543                 modest_maemo_security_options_view_changed;
544 }