Secure auth selector
authorJose Dapena Paz <jdapena@igalia.com>
Tue, 17 Nov 2009 16:58:06 +0000 (17:58 +0100)
committerJose Dapena Paz <jdapena@igalia.com>
Tue, 17 Nov 2009 16:59:13 +0000 (17:59 +0100)
src/hildon2/modest-connection-specific-smtp-edit-window.c
src/hildon2/modest-default-account-settings-dialog.c
src/hildon2/modest-maemo-security-options-view.c
src/widgets/modest-gtk-security-options-view.c
src/widgets/modest-security-options-view.c
src/widgets/modest-toolkit-factory.c
src/widgets/modest-toolkit-factory.h

index 32c2c45..2f5a6ec 100644 (file)
@@ -32,7 +32,6 @@
 #include "modest-hildon-includes.h"
 #include "modest-runtime.h"
 
 #include "modest-hildon-includes.h"
 #include "modest-runtime.h"
 
-#include "modest-secureauth-picker.h"
 #include "widgets/modest-validating-entry.h"
 #include <modest-scrollable.h>
 #include <hildon/hildon-entry.h>
 #include "widgets/modest-validating-entry.h"
 #include <modest-scrollable.h>
 #include <hildon/hildon-entry.h>
@@ -64,7 +63,7 @@ typedef struct _ModestConnectionSpecificSmtpEditWindowPrivate ModestConnectionSp
 struct _ModestConnectionSpecificSmtpEditWindowPrivate
 {
        GtkWidget *entry_outgoingserver;
 struct _ModestConnectionSpecificSmtpEditWindowPrivate
 {
        GtkWidget *entry_outgoingserver;
-       GtkWidget *outgoing_auth_picker;
+       GtkWidget *outgoing_auth_selector;
        GtkWidget *entry_user_username;
        GtkWidget *entry_user_password;
        GtkWidget *outgoing_security_selector;
        GtkWidget *entry_user_username;
        GtkWidget *entry_user_password;
        GtkWidget *outgoing_security_selector;
@@ -162,7 +161,7 @@ on_mandatory_entry_changed (GtkWidget* widget, ModestConnectionSpecificSmtpEditW
        /* Check all mandatory entries */
        on_change (widget, self);
 
        /* Check all mandatory entries */
        on_change (widget, self);
 
-       auth_proto = modest_secureauth_picker_get_active_secureauth (MODEST_SECUREAUTH_PICKER (priv->outgoing_auth_picker));
+       auth_proto = modest_secureauth_selector_get_active_secureauth (priv->outgoing_auth_selector);
        if (modest_protocol_registry_protocol_type_is_secure (modest_runtime_get_protocol_registry (),
                                                              auth_proto)) {
                text = modest_entry_get_text (priv->entry_user_username);
        if (modest_protocol_registry_protocol_type_is_secure (modest_runtime_get_protocol_registry (),
                                                              auth_proto)) {
                text = modest_entry_get_text (priv->entry_user_username);
@@ -312,12 +311,12 @@ on_security_selector_changed (GtkWidget *widget, gpointer user_data)
 }
 
 static void
 }
 
 static void
-auth_picker_set_sensitive (ModestConnectionSpecificSmtpEditWindowPrivate *priv)
+auth_selector_set_sensitive (ModestConnectionSpecificSmtpEditWindowPrivate *priv)
 {
        ModestProtocolType auth_proto;
 
        auth_proto =
 {
        ModestProtocolType auth_proto;
 
        auth_proto =
-               modest_secureauth_picker_get_active_secureauth (MODEST_SECUREAUTH_PICKER (priv->outgoing_auth_picker));
+               modest_secureauth_selector_get_active_secureauth (priv->outgoing_auth_selector);
 
        if (auth_proto == modest_protocol_registry_get_none_auth_type_id ()) {
                gtk_widget_set_sensitive (priv->entry_user_username, FALSE);
 
        if (auth_proto == modest_protocol_registry_get_none_auth_type_id ()) {
                gtk_widget_set_sensitive (priv->entry_user_username, FALSE);
@@ -330,7 +329,7 @@ auth_picker_set_sensitive (ModestConnectionSpecificSmtpEditWindowPrivate *priv)
 }
 
 static void
 }
 
 static void
-on_auth_picker_changed (HildonPickerButton *widget, gpointer user_data)
+on_auth_selector_changed (GtkWidget *widget, gpointer user_data)
 {
        ModestConnectionSpecificSmtpEditWindow *self;
        ModestConnectionSpecificSmtpEditWindowPrivate *priv;
 {
        ModestConnectionSpecificSmtpEditWindow *self;
        ModestConnectionSpecificSmtpEditWindowPrivate *priv;
@@ -341,7 +340,7 @@ on_auth_picker_changed (HildonPickerButton *widget, gpointer user_data)
        on_change (GTK_WIDGET(widget), self);
 
        /* Enable/disable username and password fields */
        on_change (GTK_WIDGET(widget), self);
 
        /* Enable/disable username and password fields */
-       auth_picker_set_sensitive (priv);
+       auth_selector_set_sensitive (priv);
 
        /* Check missing mandatory data */
        on_mandatory_entry_changed (priv->entry_user_username, self);
 
        /* Check missing mandatory data */
        on_mandatory_entry_changed (priv->entry_user_username, self);
@@ -391,16 +390,24 @@ modest_connection_specific_smtp_edit_window_init (ModestConnectionSpecificSmtpEd
        gtk_widget_show (captioned);
        
        /* The secure authentication widgets: */
        gtk_widget_show (captioned);
        
        /* The secure authentication widgets: */
-       if (!priv->outgoing_auth_picker) {
-               priv->outgoing_auth_picker = 
-                       GTK_WIDGET (modest_secureauth_picker_new (MODEST_EDITABLE_SIZE,
-                                                                 HILDON_BUTTON_ARRANGEMENT_HORIZONTAL));
+       if (!priv->outgoing_auth_selector) {
+               priv->outgoing_auth_selector = 
+                       modest_toolkit_factory_create_secureauth_selector (modest_runtime_get_toolkit_factory ());
        }
        }
-       modest_maemo_utils_set_hbutton_layout (title_sizegroup, value_sizegroup,
-                                              _("mcen_li_emailsetup_secure_authentication"),
-                                              priv->outgoing_auth_picker);
-       gtk_widget_show (priv->outgoing_auth_picker);
-       gtk_box_pack_start (GTK_BOX (vbox), priv->outgoing_auth_picker, FALSE, FALSE, 0);
+       if (GTK_IS_COMBO_BOX (priv->outgoing_auth_selector)) {
+               GtkWidget *captioned;
+               captioned = modest_maemo_utils_create_captioned (title_sizegroup, value_sizegroup,
+                                                                _("mcen_li_emailsetup_secure_authentication"), FALSE,
+                                                                priv->outgoing_auth_selector);
+               gtk_widget_show (captioned);
+               gtk_box_pack_start (GTK_BOX (vbox), captioned, FALSE, FALSE, 0);
+       } else {
+               modest_maemo_utils_set_hbutton_layout (title_sizegroup, value_sizegroup,
+                                                      _("mcen_li_emailsetup_secure_authentication"),
+                                                      priv->outgoing_auth_selector);
+               gtk_box_pack_start (GTK_BOX (vbox), priv->outgoing_auth_selector, FALSE, FALSE, 0);
+       }
+       gtk_widget_show (priv->outgoing_auth_selector);
        
        /* The username widgets: */     
        priv->entry_user_username = GTK_WIDGET (modest_validating_entry_new ());
        
        /* The username widgets: */     
        priv->entry_user_username = GTK_WIDGET (modest_validating_entry_new ());
@@ -499,7 +506,7 @@ modest_connection_specific_smtp_edit_window_init (ModestConnectionSpecificSmtpEd
                modest_runtime_get_window_mgr (), GTK_WINDOW (self)); 
 
        /* Refresh view with current settings */
                modest_runtime_get_window_mgr (), GTK_WINDOW (self)); 
 
        /* Refresh view with current settings */
-       auth_picker_set_sensitive (priv);
+       auth_selector_set_sensitive (priv);
        security_selector_set_port (priv);
 
        /* Connect signals to track changes */
        security_selector_set_port (priv);
 
        /* Connect signals to track changes */
@@ -514,10 +521,17 @@ modest_connection_specific_smtp_edit_window_init (ModestConnectionSpecificSmtpEd
                                  (GCallback) on_security_selector_changed,
                                  self);
        }
                                  (GCallback) on_security_selector_changed,
                                  self);
        }
-       g_signal_connect (G_OBJECT (priv->outgoing_auth_picker),
-                         "value-changed",
-                         (GCallback) on_auth_picker_changed,
-                         self);
+       if (GTK_IS_COMBO_BOX (priv->outgoing_auth_selector)) {
+               g_signal_connect (G_OBJECT (priv->outgoing_auth_selector),
+                                 "changed",
+                                 (GCallback) on_auth_selector_changed,
+                                 self);
+       } else {
+               g_signal_connect (G_OBJECT (priv->outgoing_auth_selector),
+                                 "value-changed",
+                                 (GCallback) on_auth_selector_changed,
+                                 self);
+       }
        g_signal_connect(G_OBJECT(priv->entry_port),
                         "range-error",
                         G_CALLBACK(on_range_error),
        g_signal_connect(G_OBJECT(priv->entry_port),
                         "range-error",
                         G_CALLBACK(on_range_error),
@@ -565,9 +579,8 @@ modest_connection_specific_smtp_edit_window_set_connection (
                        (priv->outgoing_security_selector, 
                         modest_server_account_settings_get_security_protocol (server_settings));
        
                        (priv->outgoing_security_selector, 
                         modest_server_account_settings_get_security_protocol (server_settings));
        
-               modest_secureauth_picker_set_active_secureauth (
-               MODEST_SECUREAUTH_PICKER (priv->outgoing_auth_picker), 
-               modest_server_account_settings_get_auth_protocol (server_settings));
+               modest_secureauth_selector_set_active_secureauth (priv->outgoing_auth_selector,
+                                                                 modest_server_account_settings_get_auth_protocol (server_settings));
                
                /* port: */
                modest_number_entry_set_value (
                
                /* port: */
                modest_number_entry_set_value (
@@ -610,9 +623,9 @@ modest_connection_specific_smtp_edit_window_get_settings (ModestConnectionSpecif
        modest_server_account_settings_set_security_protocol (server_settings, 
                                                              modest_serversecurity_selector_get_active_serversecurity (
                                                                      priv->outgoing_security_selector));
        modest_server_account_settings_set_security_protocol (server_settings, 
                                                              modest_serversecurity_selector_get_active_serversecurity (
                                                                      priv->outgoing_security_selector));
-       modest_server_account_settings_set_auth_protocol (server_settings,
-                                                         modest_secureauth_picker_get_active_secureauth (
-                                                         MODEST_SECUREAUTH_PICKER (priv->outgoing_auth_picker)));
+       modest_server_account_settings_set_auth_protocol 
+               (server_settings,
+                modest_secureauth_selector_get_active_secureauth (priv->outgoing_auth_selector));
        modest_server_account_settings_set_account_name (server_settings,
                                                         priv->account_name);
        
        modest_server_account_settings_set_account_name (server_settings,
                                                         priv->account_name);
        
index d1fa2fb..725d593 100644 (file)
@@ -38,7 +38,6 @@
 #include "modest-hildon-includes.h"
 #include "modest-default-account-settings-dialog.h"
 #include "modest-account-mgr.h"
 #include "modest-hildon-includes.h"
 #include "modest-default-account-settings-dialog.h"
 #include "modest-account-mgr.h"
-#include "modest-secureauth-picker.h"
 #include "widgets/modest-validating-entry.h"
 #include "modest-text-utils.h"
 #include "modest-account-mgr.h"
 #include "widgets/modest-validating-entry.h"
 #include "modest-text-utils.h"
 #include "modest-account-mgr.h"
index ef66fd8..c3553f3 100644 (file)
@@ -35,7 +35,6 @@
 #include "modest-account-protocol.h"
 #include "widgets/modest-ui-constants.h"
 #include "widgets/modest-validating-entry.h"
 #include "modest-account-protocol.h"
 #include "widgets/modest-ui-constants.h"
 #include "widgets/modest-validating-entry.h"
-#include "modest-secureauth-picker.h"
 #include "modest-maemo-utils.h"
 #include "modest-hildon-includes.h"
 
 #include "modest-maemo-utils.h"
 #include "modest-hildon-includes.h"
 
@@ -109,7 +108,6 @@ on_auth_changed (GtkWidget *widget,
                 ModestMaemoSecurityOptionsView *self)
 {
        ModestSecurityOptionsViewPrivate* ppriv;
                 ModestMaemoSecurityOptionsView *self)
 {
        ModestSecurityOptionsViewPrivate* ppriv;
-       ModestSecureauthPicker *picker;
        ModestProtocolRegistry *protocol_registry;
        ModestProtocolType auth_proto;
        gboolean secureauth_used;
        ModestProtocolRegistry *protocol_registry;
        ModestProtocolType auth_proto;
        gboolean secureauth_used;
@@ -117,9 +115,8 @@ on_auth_changed (GtkWidget *widget,
 
        ppriv = MODEST_SECURITY_OPTIONS_VIEW_GET_PRIVATE (self);
        protocol_registry = modest_runtime_get_protocol_registry ();
 
        ppriv = MODEST_SECURITY_OPTIONS_VIEW_GET_PRIVATE (self);
        protocol_registry = modest_runtime_get_protocol_registry ();
-       picker = MODEST_SECUREAUTH_PICKER (ppriv->auth_view);
 
 
-       auth_proto = modest_secureauth_picker_get_active_secureauth (picker);
+       auth_proto = modest_secureauth_selector_get_active_secureauth (ppriv->auth_view);
        secureauth_used = modest_protocol_registry_protocol_type_is_secure (protocol_registry, 
                                                                            auth_proto);
 
        secureauth_used = modest_protocol_registry_protocol_type_is_secure (protocol_registry, 
                                                                            auth_proto);
 
@@ -220,7 +217,6 @@ on_entry_changed (GtkEditable *editable,
        ModestSecurityOptionsView* self;
        ModestMaemoSecurityOptionsViewPrivate *priv;
        ModestSecurityOptionsViewPrivate *ppriv;
        ModestSecurityOptionsView* self;
        ModestMaemoSecurityOptionsViewPrivate *priv;
        ModestSecurityOptionsViewPrivate *ppriv;
-       ModestSecureauthPicker *picker;
        gboolean is_secure = FALSE;
        ModestProtocolRegistry *protocol_registry;
 
        gboolean is_secure = FALSE;
        ModestProtocolRegistry *protocol_registry;
 
@@ -230,10 +226,9 @@ on_entry_changed (GtkEditable *editable,
        protocol_registry = modest_runtime_get_protocol_registry ();
 
        /* Check if it's a secure protocol */
        protocol_registry = modest_runtime_get_protocol_registry ();
 
        /* Check if it's a secure protocol */
-       if (MODEST_IS_SECUREAUTH_PICKER (ppriv->auth_view)) {
+       if (modest_is_secureauth_selector (ppriv->auth_view)) {
                ModestProtocolType auth_proto;
                ModestProtocolType auth_proto;
-               picker = MODEST_SECUREAUTH_PICKER (ppriv->auth_view);
-               auth_proto = modest_secureauth_picker_get_active_secureauth (picker);
+               auth_proto = modest_secureauth_selector_get_active_secureauth (ppriv->auth_view);
                is_secure = modest_protocol_registry_protocol_type_is_secure (protocol_registry,
                                                                              auth_proto);
        } else if (modest_is_togglable (ppriv->auth_view)) {
                is_secure = modest_protocol_registry_protocol_type_is_secure (protocol_registry,
                                                                              auth_proto);
        } else if (modest_is_togglable (ppriv->auth_view)) {
@@ -273,7 +268,7 @@ create_outgoing_security (ModestSecurityOptionsView* self,
                          GtkSizeGroup *value_size_group)
 {
        ModestSecurityOptionsViewPrivate *ppriv;
                          GtkSizeGroup *value_size_group)
 {
        ModestSecurityOptionsViewPrivate *ppriv;
-       GtkWidget *user_caption = NULL, *security_caption = NULL;
+       GtkWidget *user_caption = NULL, *security_caption = NULL, *auth_caption = NULL;
        GtkWidget *pwd_caption = NULL, *port_caption = NULL;
 
        ppriv = MODEST_SECURITY_OPTIONS_VIEW_GET_PRIVATE (self);
        GtkWidget *pwd_caption = NULL, *port_caption = NULL;
 
        ppriv = MODEST_SECURITY_OPTIONS_VIEW_GET_PRIVATE (self);
@@ -286,6 +281,7 @@ create_outgoing_security (ModestSecurityOptionsView* self,
                security_caption = modest_maemo_utils_create_captioned (title_size_group, value_size_group,
                                                                 _("mcen_li_emailsetup_secure_connection"), FALSE,
                                                                 ppriv->security_view);
                security_caption = modest_maemo_utils_create_captioned (title_size_group, value_size_group,
                                                                 _("mcen_li_emailsetup_secure_connection"), FALSE,
                                                                 ppriv->security_view);
+               gtk_widget_show (security_caption);
        } else {
                modest_maemo_utils_set_hbutton_layout (title_size_group,
                                                       value_size_group,
        } else {
                modest_maemo_utils_set_hbutton_layout (title_size_group,
                                                       value_size_group,
@@ -295,12 +291,19 @@ create_outgoing_security (ModestSecurityOptionsView* self,
        }
        
        /* The secure authentication widgets */
        }
        
        /* The secure authentication widgets */
-       ppriv->auth_view = GTK_WIDGET (modest_secureauth_picker_new (MODEST_EDITABLE_SIZE,
-                                                                    HILDON_BUTTON_ARRANGEMENT_HORIZONTAL));
-       modest_maemo_utils_set_hbutton_layout (title_size_group,
-                                              value_size_group,
-                                              _("mcen_li_emailsetup_secure_authentication"), 
-                                              ppriv->auth_view);
+       ppriv->auth_view = modest_toolkit_factory_create_secureauth_selector (modest_runtime_get_toolkit_factory ());
+       if (GTK_IS_COMBO_BOX (ppriv->auth_view)) {
+               auth_caption = modest_maemo_utils_create_captioned (title_size_group, value_size_group,
+                                                                   _("mcen_li_emailsetup_secure_authentication"), FALSE,
+                                                                   ppriv->auth_view);
+               gtk_widget_show (auth_caption);
+       } else {
+               modest_maemo_utils_set_hbutton_layout (title_size_group,
+                                                      value_size_group,
+                                                      _("mcen_li_emailsetup_secure_authentication"), 
+                                                      ppriv->auth_view);
+               auth_caption = ppriv->auth_view;
+       }
 
        if (ppriv->full) {
                gchar *user_label;
 
        if (ppriv->full) {
                gchar *user_label;
@@ -370,8 +373,13 @@ create_outgoing_security (ModestSecurityOptionsView* self,
                                  G_CALLBACK (on_security_changed), self);
        }
        if (ppriv->full) {
                                  G_CALLBACK (on_security_changed), self);
        }
        if (ppriv->full) {
-               g_signal_connect (G_OBJECT (ppriv->auth_view), "value-changed",
-                                 G_CALLBACK (on_auth_changed), self);
+               if (GTK_IS_COMBO_BOX (ppriv->auth_view)) {
+                       g_signal_connect (G_OBJECT (ppriv->auth_view), "changed",
+                                         G_CALLBACK (on_auth_changed), self);
+               } else {
+                       g_signal_connect (G_OBJECT (ppriv->auth_view), "value-changed",
+                                         G_CALLBACK (on_auth_changed), self);
+               }
                g_signal_connect (G_OBJECT (ppriv->user_entry), "changed",
                                  G_CALLBACK (on_entry_changed), self);
 #ifdef MODEST_NUMBER_ENTRY_SUPPORT_VALID_CHANGED
                g_signal_connect (G_OBJECT (ppriv->user_entry), "changed",
                                  G_CALLBACK (on_entry_changed), self);
 #ifdef MODEST_NUMBER_ENTRY_SUPPORT_VALID_CHANGED
@@ -384,20 +392,20 @@ create_outgoing_security (ModestSecurityOptionsView* self,
        modest_serversecurity_selector_set_active_serversecurity (
                ppriv->security_view,
                MODEST_PROTOCOLS_CONNECTION_NONE);
        modest_serversecurity_selector_set_active_serversecurity (
                ppriv->security_view,
                MODEST_PROTOCOLS_CONNECTION_NONE);
-       modest_secureauth_picker_set_active_secureauth (
-          MODEST_SECUREAUTH_PICKER (ppriv->auth_view),
+       modest_secureauth_selector_set_active_secureauth (
+          ppriv->auth_view,
           MODEST_PROTOCOLS_AUTH_NONE);
 
        /* Pack into container */
        if (ppriv->full) {
           MODEST_PROTOCOLS_AUTH_NONE);
 
        /* Pack into container */
        if (ppriv->full) {
-               gtk_box_pack_start (GTK_BOX (self), ppriv->auth_view, FALSE, FALSE, 0);
+               gtk_box_pack_start (GTK_BOX (self), auth_caption, FALSE, FALSE, 0);
                gtk_box_pack_start (GTK_BOX (self), user_caption, FALSE, FALSE, 0);
                gtk_box_pack_start (GTK_BOX (self), pwd_caption, FALSE, FALSE, 0);
                gtk_box_pack_start (GTK_BOX (self), user_caption, FALSE, FALSE, 0);
                gtk_box_pack_start (GTK_BOX (self), pwd_caption, FALSE, FALSE, 0);
-               gtk_box_pack_start (GTK_BOX (self), ppriv->security_view, FALSE, FALSE, 0);
+               gtk_box_pack_start (GTK_BOX (self), security_caption, FALSE, FALSE, 0);
                gtk_box_pack_start (GTK_BOX (self), port_caption, FALSE, FALSE, 0);
        } else {
                gtk_box_pack_start (GTK_BOX (self), port_caption, FALSE, FALSE, 0);
        } else {
-               gtk_box_pack_start (GTK_BOX (self), ppriv->auth_view, FALSE, FALSE, 0);
-               gtk_box_pack_start (GTK_BOX (self), ppriv->security_view, FALSE, FALSE, 0);
+               gtk_box_pack_start (GTK_BOX (self), auth_caption, FALSE, FALSE, 0);
+               gtk_box_pack_start (GTK_BOX (self), security_caption, FALSE, FALSE, 0);
        }
 
        /* Show widgets */
        }
 
        /* Show widgets */
index aaabee8..25bd7c3 100644 (file)
@@ -35,7 +35,6 @@
 #include "modest-account-protocol.h"
 #include "widgets/modest-ui-constants.h"
 #include "widgets/modest-validating-entry.h"
 #include "modest-account-protocol.h"
 #include "widgets/modest-ui-constants.h"
 #include "widgets/modest-validating-entry.h"
-#include "widgets/modest-secureauth-combo-box.h"
 
 #define PORT_MIN 1
 #define PORT_MAX 65535
 
 #define PORT_MIN 1
 #define PORT_MAX 65535
@@ -103,7 +102,6 @@ on_auth_changed (GtkWidget *widget,
                 ModestGtkSecurityOptionsView *self)
 {
        ModestSecurityOptionsViewPrivate* ppriv;
                 ModestGtkSecurityOptionsView *self)
 {
        ModestSecurityOptionsViewPrivate* ppriv;
-       ModestSecureauthComboBox *combo;
        ModestProtocolRegistry *protocol_registry;
        ModestProtocolType auth_proto;
        gboolean secureauth_used;
        ModestProtocolRegistry *protocol_registry;
        ModestProtocolType auth_proto;
        gboolean secureauth_used;
@@ -111,9 +109,8 @@ on_auth_changed (GtkWidget *widget,
 
        ppriv = MODEST_SECURITY_OPTIONS_VIEW_GET_PRIVATE (self);
        protocol_registry = modest_runtime_get_protocol_registry ();
 
        ppriv = MODEST_SECURITY_OPTIONS_VIEW_GET_PRIVATE (self);
        protocol_registry = modest_runtime_get_protocol_registry ();
-       combo = MODEST_SECUREAUTH_COMBO_BOX (ppriv->auth_view);
 
 
-       auth_proto = modest_secureauth_combo_box_get_active_secureauth (combo);
+       auth_proto = modest_secureauth_selector_get_active_secureauth (ppriv->auth_view);
        secureauth_used = modest_protocol_registry_protocol_type_is_secure (protocol_registry, 
                                                                            auth_proto);
 
        secureauth_used = modest_protocol_registry_protocol_type_is_secure (protocol_registry, 
                                                                            auth_proto);
 
@@ -203,7 +200,6 @@ on_entry_changed (GtkEditable *editable,
        ModestGtkSecurityOptionsViewPrivate *priv;
        ModestSecurityOptionsViewPrivate *ppriv;
        ModestProtocolType auth_proto;
        ModestGtkSecurityOptionsViewPrivate *priv;
        ModestSecurityOptionsViewPrivate *ppriv;
        ModestProtocolType auth_proto;
-       ModestSecureauthComboBox *combo;
        gboolean is_secure;
        ModestProtocolRegistry *protocol_registry;
 
        gboolean is_secure;
        ModestProtocolRegistry *protocol_registry;
 
@@ -213,8 +209,7 @@ on_entry_changed (GtkEditable *editable,
        protocol_registry = modest_runtime_get_protocol_registry ();
 
        /* Outgoing username is mandatory if outgoing auth is secure */
        protocol_registry = modest_runtime_get_protocol_registry ();
 
        /* Outgoing username is mandatory if outgoing auth is secure */
-       combo = MODEST_SECUREAUTH_COMBO_BOX (ppriv->auth_view);
-       auth_proto = modest_secureauth_combo_box_get_active_secureauth (combo);
+       auth_proto = modest_secureauth_selector_get_active_secureauth (ppriv->auth_view);
        is_secure = modest_protocol_registry_protocol_type_is_secure (protocol_registry,
                                                                      auth_proto);
 
        is_secure = modest_protocol_registry_protocol_type_is_secure (protocol_registry,
                                                                      auth_proto);
 
@@ -249,7 +244,7 @@ create_outgoing_security (ModestSecurityOptionsView* self,
                                                           ppriv->security_view);
        
        /* The secure authentication widgets */
                                                           ppriv->security_view);
        
        /* The secure authentication widgets */
-       ppriv->auth_view = GTK_WIDGET (modest_secureauth_combo_box_new ());
+       ppriv->auth_view = modest_toolkit_factory_create_secureauth_selector (modest_runtime_get_toolkit_factory ());
        auth_caption = modest_maemo_utils_create_captioned (title_size_group, value_size_group,
                                                            _("mcen_li_emailsetup_secure_authentication"), FALSE,
                                                            ppriv->auth_view);
        auth_caption = modest_maemo_utils_create_captioned (title_size_group, value_size_group,
                                                            _("mcen_li_emailsetup_secure_authentication"), FALSE,
                                                            ppriv->auth_view);
@@ -309,8 +304,13 @@ create_outgoing_security (ModestSecurityOptionsView* self,
                                  G_CALLBACK (on_security_changed), self);
        }
        if (ppriv->full) {
                                  G_CALLBACK (on_security_changed), self);
        }
        if (ppriv->full) {
-               g_signal_connect (G_OBJECT (ppriv->auth_view), "changed",
-                                 G_CALLBACK (on_auth_changed), self);
+               if (GTK_IS_COMBO_BOX (ppriv->auth_view)) {
+                       g_signal_connect (G_OBJECT (ppriv->auth_view), "changed",
+                                         G_CALLBACK (on_auth_changed), self);
+               } else {
+                       g_signal_connect (G_OBJECT (ppriv->auth_view), "value-changed",
+                                         G_CALLBACK (on_auth_changed), self);
+               }
                g_signal_connect (G_OBJECT (ppriv->user_entry), "changed",
                                  G_CALLBACK (on_entry_changed), self);
        }
                g_signal_connect (G_OBJECT (ppriv->user_entry), "changed",
                                  G_CALLBACK (on_entry_changed), self);
        }
@@ -319,8 +319,8 @@ create_outgoing_security (ModestSecurityOptionsView* self,
        modest_serversecurity_selector_set_active_serversecurity (
                ppriv->security_view,
                MODEST_PROTOCOLS_CONNECTION_NONE);
        modest_serversecurity_selector_set_active_serversecurity (
                ppriv->security_view,
                MODEST_PROTOCOLS_CONNECTION_NONE);
-       modest_secureauth_combo_box_set_active_secureauth (
-          MODEST_SECUREAUTH_COMBO_BOX (ppriv->auth_view),
+       modest_secureauth_selector_set_active_secureauth (
+          ppriv->auth_view,
           MODEST_PROTOCOLS_AUTH_NONE);
 
        /* Pack into container */
           MODEST_PROTOCOLS_AUTH_NONE);
 
        /* Pack into container */
index a03cdfc..7e59adf 100644 (file)
 #include "modest-security-options-view.h"
 #include "modest-security-options-view-priv.h"
 #ifdef MODEST_TOOLKIT_HILDON2
 #include "modest-security-options-view.h"
 #include "modest-security-options-view-priv.h"
 #ifdef MODEST_TOOLKIT_HILDON2
-#include "modest-secureauth-picker.h"
 #include <modest-hildon-includes.h>
 #endif
 #include <modest-hildon-includes.h>
 #endif
-#include "widgets/modest-secureauth-combo-box.h"
 
 /* list my signals */
 enum {
 
 /* list my signals */
 enum {
@@ -101,15 +99,8 @@ modest_security_options_view_load_settings (ModestSecurityOptionsView* self,
                        modest_togglable_set_active (priv->auth_view,
                                                     TRUE);
        } else {
                        modest_togglable_set_active (priv->auth_view,
                                                     TRUE);
        } else {
-               if (MODEST_IS_SECUREAUTH_COMBO_BOX (priv->auth_view)) {
-                       modest_secureauth_combo_box_set_active_secureauth (
-                               MODEST_SECUREAUTH_COMBO_BOX (priv->auth_view), secure_auth);
-               } else {
-#ifdef MODEST_TOOLKIT_HILDON2
-                       modest_secureauth_picker_set_active_secureauth (
-                               MODEST_SECUREAUTH_PICKER (priv->auth_view), secure_auth);
-#endif
-               }
+               modest_secureauth_selector_set_active_secureauth (
+                       priv->auth_view, secure_auth);
        }
 
        MODEST_SECURITY_OPTIONS_VIEW_GET_CLASS (self)->load_settings (self, settings);
        }
 
        MODEST_SECURITY_OPTIONS_VIEW_GET_CLASS (self)->load_settings (self, settings);
@@ -154,15 +145,7 @@ modest_security_options_view_save_settings (ModestSecurityOptionsView* self,
                        }
                }
        } else {
                        }
                }
        } else {
-               if  (MODEST_IS_SECUREAUTH_COMBO_BOX (priv->auth_view)) {
-                       auth_protocol = modest_secureauth_combo_box_get_active_secureauth (
-                               MODEST_SECUREAUTH_COMBO_BOX (priv->auth_view));
-               } else {
-#ifdef MODEST_TOOLKIT_HILDON2
-                       auth_protocol = modest_secureauth_picker_get_active_secureauth (
-                               MODEST_SECUREAUTH_PICKER (priv->auth_view));
-#endif
-               }
+               auth_protocol = modest_secureauth_selector_get_active_secureauth (priv->auth_view);
        }
 
        /* Save settings */
        }
 
        /* Save settings */
@@ -218,13 +201,7 @@ get_current_state (ModestSecurityOptionsView* self,
 
        /* Get auth */
        if (self->type == MODEST_SECURITY_OPTIONS_OUTGOING) {
 
        /* Get auth */
        if (self->type == MODEST_SECURITY_OPTIONS_OUTGOING) {
-               if (MODEST_IS_SECUREAUTH_COMBO_BOX (priv->auth_view)) {
-                       state->auth = modest_secureauth_combo_box_get_active_secureauth (MODEST_SECUREAUTH_COMBO_BOX (priv->auth_view));
-               } else {
-#ifdef MODEST_TOOLKIT_HILDON2
-                       state->auth = modest_secureauth_picker_get_active_secureauth (MODEST_SECUREAUTH_PICKER (priv->auth_view));
-#endif
-               }
+               state->auth = modest_secureauth_selector_get_active_secureauth (priv->auth_view);
                if (priv->full) {
                }
        } else {
                if (priv->full) {
                }
        } else {
index f83bd32..78e770e 100644 (file)
@@ -45,6 +45,7 @@
 #define USE_GTK_FILE_CHOOSER
 #define USE_COUNTRY_COMBOBOX
 #define USE_SERVERSECURITY_COMBOBOX
 #define USE_GTK_FILE_CHOOSER
 #define USE_COUNTRY_COMBOBOX
 #define USE_SERVERSECURITY_COMBOBOX
+#define USE_SECUREAUTH_COMBOBOX
 #define USE_GTK_SECURITY_OPTIONS_VIEW
 #endif
 
 #define USE_GTK_SECURITY_OPTIONS_VIEW
 #endif
 
 #include <modest-serversecurity-picker.h>
 #endif
 
 #include <modest-serversecurity-picker.h>
 #endif
 
+#ifdef USE_SECUREAUTH_COMBOBOX
+#include <modest-secureauth-combo-box.h>
+#else
+#include <modest-secureauth-picker.h>
+#endif
+
 #ifdef USE_GTK_SECURITY_OPTIONS_VIEW
 #include <modest-gtk-security-options-view.h>
 #else
 #ifdef USE_GTK_SECURITY_OPTIONS_VIEW
 #include <modest-gtk-security-options-view.h>
 #else
@@ -114,6 +121,12 @@ static GtkWidget * modest_toolkit_factory_create_provider_selector_default    (M
 static GtkWidget * modest_toolkit_factory_create_servertype_selector_default  (ModestToolkitFactory *self,
                                                                               gboolean filter_providers);
 static GtkWidget * modest_toolkit_factory_create_serversecurity_selector_default (ModestToolkitFactory *self);
 static GtkWidget * modest_toolkit_factory_create_servertype_selector_default  (ModestToolkitFactory *self,
                                                                               gboolean filter_providers);
 static GtkWidget * modest_toolkit_factory_create_serversecurity_selector_default (ModestToolkitFactory *self);
+static GtkWidget * modest_toolkit_factory_create_secureauth_selector_default (ModestToolkitFactory *self);
+static GtkWidget * modest_toolkit_factory_create_security_options_view_default (ModestToolkitFactory *self, 
+                                                                               ModestSecurityOptionsType type,
+                                                                               gboolean full, 
+                                                                               GtkSizeGroup *title_size_group,
+                                                                               GtkSizeGroup *value_size_group);
 /* globals */
 static GObjectClass *parent_class = NULL;
 
 /* globals */
 static GObjectClass *parent_class = NULL;
 
@@ -145,6 +158,8 @@ modest_toolkit_factory_class_init (ModestToolkitFactoryClass *klass)
        klass->create_provider_selector = modest_toolkit_factory_create_provider_selector_default;
        klass->create_servertype_selector = modest_toolkit_factory_create_servertype_selector_default;
        klass->create_serversecurity_selector = modest_toolkit_factory_create_serversecurity_selector_default;
        klass->create_provider_selector = modest_toolkit_factory_create_provider_selector_default;
        klass->create_servertype_selector = modest_toolkit_factory_create_servertype_selector_default;
        klass->create_serversecurity_selector = modest_toolkit_factory_create_serversecurity_selector_default;
+       klass->create_secureauth_selector = modest_toolkit_factory_create_secureauth_selector_default;
+       klass->create_security_options_view = modest_toolkit_factory_create_security_options_view_default;
 }
 
 static void
 }
 
 static void
@@ -471,7 +486,7 @@ modest_toolkit_factory_create_provider_selector_default (ModestToolkitFactory *s
 {
        GtkWidget *result;
 #ifdef USE_PROVIDER_COMBOBOX
 {
        GtkWidget *result;
 #ifdef USE_PROVIDER_COMBOBOX
-       result = modest_provider_combo_box_new ();
+       result = GTK_WIDGET (modest_provider_combo_box_new ());
 #else
        result = GTK_WIDGET (modest_provider_picker_new (MODEST_EDITABLE_SIZE, 
                                                         HILDON_BUTTON_ARRANGEMENT_HORIZONTAL));
 #else
        result = GTK_WIDGET (modest_provider_picker_new (MODEST_EDITABLE_SIZE, 
                                                         HILDON_BUTTON_ARRANGEMENT_HORIZONTAL));
@@ -623,7 +638,7 @@ static GtkWidget *
 modest_toolkit_factory_create_serversecurity_selector_default (ModestToolkitFactory *self)
 {
        GtkWidget *result;
 modest_toolkit_factory_create_serversecurity_selector_default (ModestToolkitFactory *self)
 {
        GtkWidget *result;
-#ifdef USE_PROVIDER_COMBOBOX
+#ifdef USE_SERVERSECURITY_COMBOBOX
        result = GTK_WIDGET (modest_serversecurity_combo_box_new ());
 #else
        result = GTK_WIDGET (modest_serversecurity_picker_new (MODEST_EDITABLE_SIZE, 
        result = GTK_WIDGET (modest_serversecurity_combo_box_new ());
 #else
        result = GTK_WIDGET (modest_serversecurity_picker_new (MODEST_EDITABLE_SIZE, 
@@ -679,12 +694,75 @@ modest_serversecurity_selector_get_active_serversecurity_port (GtkWidget *combob
 }
 
 GtkWidget *
 }
 
 GtkWidget *
+modest_toolkit_factory_create_secureauth_selector (ModestToolkitFactory *self)
+{
+       return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_secureauth_selector (self);
+}
+
+static GtkWidget *
+modest_toolkit_factory_create_secureauth_selector_default (ModestToolkitFactory *self)
+{
+       GtkWidget *result;
+#ifdef USE_SECUREAUTH_COMBOBOX
+       result = GTK_WIDGET (modest_secureauth_combo_box_new ());
+#else
+       result = GTK_WIDGET (modest_secureauth_picker_new (MODEST_EDITABLE_SIZE, 
+                                                          HILDON_BUTTON_ARRANGEMENT_HORIZONTAL));
+#endif
+       return result;
+}
+
+ModestProtocolType
+modest_secureauth_selector_get_active_secureauth (GtkWidget *widget)
+{
+#ifdef USE_SECUREAUTH_COMBOBOX
+       return modest_secureauth_combo_box_get_active_secureauth (MODEST_SECUREAUTH_COMBO_BOX (widget));
+#else
+       return modest_secureauth_picker_get_active_secureauth (MODEST_SECUREAUTH_PICKER (widget));
+#endif
+}
+
+gboolean
+modest_secureauth_selector_set_active_secureauth (GtkWidget *widget,
+                                                 ModestProtocolType secureauth)
+{
+#ifdef USE_SECUREAUTH_COMBOBOX
+       return modest_secureauth_combo_box_set_active_secureauth (MODEST_SECUREAUTH_COMBO_BOX (widget),
+                                                                 secureauth);
+#else
+       return modest_secureauth_picker_set_active_secureauth (MODEST_SECUREAUTH_PICKER (widget),
+                                                              secureauth);
+#endif
+}
+
+gboolean
+modest_is_secureauth_selector (GtkWidget *widget)
+{
+#ifdef USE_SECUREAUTH_COMBOBOX
+       return MODEST_IS_SECUREAUTH_COMBO_BOX (widget);
+#else
+       return MODEST_IS_SECUREAUTH_PICKER (widget);
+#endif
+}
+
+GtkWidget *
 modest_toolkit_factory_create_security_options_view (ModestToolkitFactory *self, 
                                                     ModestSecurityOptionsType type,
                                                     gboolean full, 
                                                     GtkSizeGroup *title_size_group, 
                                                     GtkSizeGroup *value_size_group)
 {
 modest_toolkit_factory_create_security_options_view (ModestToolkitFactory *self, 
                                                     ModestSecurityOptionsType type,
                                                     gboolean full, 
                                                     GtkSizeGroup *title_size_group, 
                                                     GtkSizeGroup *value_size_group)
 {
+       return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_security_options_view (self, type, full, 
+                                                                                     title_size_group, value_size_group);
+}
+
+static GtkWidget *
+modest_toolkit_factory_create_security_options_view_default (ModestToolkitFactory *self, 
+                                                            ModestSecurityOptionsType type,
+                                                            gboolean full, 
+                                                            GtkSizeGroup *title_size_group, 
+                                                            GtkSizeGroup *value_size_group)
+{
        GtkWidget *result;
 #ifdef USE_GTK_SECURITY_OPTIONS_VIEW
        result = GTK_WIDGET (modest_gtk_security_options_view_new (type, full, title_size_group, value_size_group));
        GtkWidget *result;
 #ifdef USE_GTK_SECURITY_OPTIONS_VIEW
        result = GTK_WIDGET (modest_gtk_security_options_view_new (type, full, title_size_group, value_size_group));
index b263347..7cddab2 100644 (file)
@@ -49,6 +49,7 @@ struct                                          _ModestToolkitFactoryClass
        GtkWidget * (*create_provider_selector) (ModestToolkitFactory *self);
        GtkWidget * (*create_servertype_selector) (ModestToolkitFactory *self, gboolean filter_providers);
        GtkWidget * (*create_serversecurity_selector) (ModestToolkitFactory *self);
        GtkWidget * (*create_provider_selector) (ModestToolkitFactory *self);
        GtkWidget * (*create_servertype_selector) (ModestToolkitFactory *self, gboolean filter_providers);
        GtkWidget * (*create_serversecurity_selector) (ModestToolkitFactory *self);
+       GtkWidget * (*create_secureauth_selector) (ModestToolkitFactory *self);
        GtkWidget * (*create_security_options_view) (ModestToolkitFactory *self, ModestSecurityOptionsType type,
                                                     gboolean full, GtkSizeGroup *title_size_group, GtkSizeGroup *value_size_group);
 };
        GtkWidget * (*create_security_options_view) (ModestToolkitFactory *self, ModestSecurityOptionsType type,
                                                     gboolean full, GtkSizeGroup *title_size_group, GtkSizeGroup *value_size_group);
 };
@@ -100,6 +101,9 @@ GtkWidget *
 modest_toolkit_factory_create_serversecurity_selector (ModestToolkitFactory *self);
 
 GtkWidget *
 modest_toolkit_factory_create_serversecurity_selector (ModestToolkitFactory *self);
 
 GtkWidget *
+modest_toolkit_factory_create_secureauth_selector (ModestToolkitFactory *self);
+
+GtkWidget *
 modest_toolkit_factory_create_security_options_view (ModestToolkitFactory *self, ModestSecurityOptionsType type,
                                                     gboolean full, GtkSizeGroup *title_size_group, GtkSizeGroup *value_size_group);
 
 modest_toolkit_factory_create_security_options_view (ModestToolkitFactory *self, ModestSecurityOptionsType type,
                                                     gboolean full, GtkSizeGroup *title_size_group, GtkSizeGroup *value_size_group);
 
@@ -182,6 +186,15 @@ gboolean modest_serversecurity_selector_set_active_serversecurity (GtkWidget *co
 
 gint modest_serversecurity_selector_get_active_serversecurity_port (GtkWidget *combobox);
 
 
 gint modest_serversecurity_selector_get_active_serversecurity_port (GtkWidget *combobox);
 
+ModestProtocolType
+modest_secureauth_selector_get_active_secureauth (GtkWidget *widget);
+
+gboolean
+modest_secureauth_selector_set_active_secureauth (GtkWidget *widget,
+                                                 ModestProtocolType secureauth);
+
+gboolean
+modest_is_secureauth_selector (GtkWidget *widget);
 
 #ifndef MODEST_TOOLKIT_HILDON2
 #define USE_PROVIDER_COMBOBOX
 
 #ifndef MODEST_TOOLKIT_HILDON2
 #define USE_PROVIDER_COMBOBOX