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