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