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