X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fhildon2%2Fmodest-maemo-security-options-view.c;h=ef66fd8d7f7d4ec7663b74ddc6f3185d55c4c6f4;hp=069372cdc396ca995da50dbd145dc0e26f4fb0ed;hb=ec98b6e930e0b781d77b277db25bbf638083c9cf;hpb=8dc8912c82789e6cd205d92667366a3008c601d3 diff --git a/src/hildon2/modest-maemo-security-options-view.c b/src/hildon2/modest-maemo-security-options-view.c index 069372c..ef66fd8 100644 --- a/src/hildon2/modest-maemo-security-options-view.c +++ b/src/hildon2/modest-maemo-security-options-view.c @@ -35,7 +35,6 @@ #include "modest-account-protocol.h" #include "widgets/modest-ui-constants.h" #include "widgets/modest-validating-entry.h" -#include "modest-serversecurity-picker.h" #include "modest-secureauth-picker.h" #include "modest-maemo-utils.h" #include "modest-hildon-includes.h" @@ -73,7 +72,6 @@ on_security_changed (GtkWidget *widget, ModestMaemoSecurityOptionsView *self) { ModestSecurityOptionsViewPrivate* ppriv; - ModestServersecurityPicker *picker; ModestProtocolType proto_type; ModestProtocolRegistry *proto_registry; gboolean is_secure; @@ -81,8 +79,7 @@ on_security_changed (GtkWidget *widget, ppriv = MODEST_SECURITY_OPTIONS_VIEW_GET_PRIVATE (self); proto_registry = modest_runtime_get_protocol_registry (); - picker = MODEST_SERVERSECURITY_PICKER (ppriv->security_view); - proto_type = modest_serversecurity_picker_get_active_serversecurity (picker); + proto_type = modest_serversecurity_selector_get_active_serversecurity (ppriv->security_view); is_secure = modest_protocol_registry_protocol_type_has_tag (proto_registry, proto_type, MODEST_PROTOCOL_REGISTRY_SECURE_PROTOCOLS); @@ -98,7 +95,7 @@ on_security_changed (GtkWidget *widget, if (ppriv->full) { gint port_number = - modest_serversecurity_picker_get_active_serversecurity_port (MODEST_SERVERSECURITY_PICKER (ppriv->security_view)); + modest_serversecurity_selector_get_active_serversecurity_port (ppriv->security_view); if(port_number) { modest_number_entry_set_value (ppriv->port_view, @@ -148,26 +145,35 @@ create_incoming_security (ModestSecurityOptionsView* self, ppriv = MODEST_SECURITY_OPTIONS_VIEW_GET_PRIVATE (self); - /* Create widgets for incoming security */ - ppriv->security_view = GTK_WIDGET (modest_serversecurity_picker_new (MODEST_EDITABLE_SIZE, - HILDON_BUTTON_ARRANGEMENT_HORIZONTAL)); - modest_serversecurity_picker_fill (MODEST_SERVERSECURITY_PICKER (ppriv->security_view), - modest_protocol_registry_get_pop_type_id ()); - modest_maemo_utils_set_hbutton_layout (title_size_group, - value_size_group, - _("mcen_li_emailsetup_secure_connection"), - ppriv->security_view); - ppriv->auth_view = modest_toolkit_factory_create_check_button (modest_runtime_get_toolkit_factory (), _("mcen_li_emailsetup_secure_authentication")); + gtk_box_pack_start (GTK_BOX (self), ppriv->auth_view, FALSE, FALSE, 0); - /* Track changes in UI */ - g_signal_connect (G_OBJECT (ppriv->security_view), "value-changed", - G_CALLBACK (on_security_changed), self); + /* Create widgets for incoming security */ + ppriv->security_view = modest_toolkit_factory_create_serversecurity_selector (modest_runtime_get_toolkit_factory ()); + modest_serversecurity_selector_fill (ppriv->security_view, + modest_protocol_registry_get_pop_type_id ()); + if (GTK_IS_COMBO_BOX (ppriv->security_view)) { + GtkWidget *captioned; + + captioned = modest_maemo_utils_create_captioned (title_size_group, value_size_group, + _("mcen_li_emailsetup_secure_connection"), FALSE, + ppriv->security_view); + g_signal_connect (G_OBJECT (ppriv->security_view), "changed", + G_CALLBACK (on_security_changed), self); + gtk_box_pack_start (GTK_BOX (self), captioned, FALSE, FALSE, 0); + gtk_widget_show (captioned); + } else { + modest_maemo_utils_set_hbutton_layout (title_size_group, + value_size_group, + _("mcen_li_emailsetup_secure_connection"), + ppriv->security_view); + g_signal_connect (G_OBJECT (ppriv->security_view), "value-changed", + G_CALLBACK (on_security_changed), self); + gtk_box_pack_start (GTK_BOX (self), ppriv->security_view, FALSE, FALSE, 0); + } /* Pack into container & show */ - 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_widget_show (ppriv->security_view); gtk_widget_show (ppriv->auth_view); @@ -267,20 +273,26 @@ create_outgoing_security (ModestSecurityOptionsView* self, GtkSizeGroup *value_size_group) { ModestSecurityOptionsViewPrivate *ppriv; - GtkWidget *user_caption = NULL; + GtkWidget *user_caption = NULL, *security_caption = NULL; GtkWidget *pwd_caption = NULL, *port_caption = NULL; ppriv = MODEST_SECURITY_OPTIONS_VIEW_GET_PRIVATE (self); /* The secure connection widgets */ - ppriv->security_view = GTK_WIDGET (modest_serversecurity_picker_new (MODEST_EDITABLE_SIZE, - HILDON_BUTTON_ARRANGEMENT_HORIZONTAL)); - modest_serversecurity_picker_fill (MODEST_SERVERSECURITY_PICKER (ppriv->security_view), + ppriv->security_view = modest_toolkit_factory_create_serversecurity (modest_runtime_get_toolkit_factory ()); + modest_serversecurity_selector_fill (ppriv->security_view, MODEST_PROTOCOLS_TRANSPORT_SMTP); - modest_maemo_utils_set_hbutton_layout (title_size_group, - value_size_group, - _("mcen_li_emailsetup_secure_connection"), - ppriv->security_view); + if (GTK_IS_COMBO_BOX (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); + } else { + modest_maemo_utils_set_hbutton_layout (title_size_group, + value_size_group, + _("mcen_li_emailsetup_secure_connection"), + ppriv->security_view); + security_caption = ppriv->security_view; + } /* The secure authentication widgets */ ppriv->auth_view = GTK_WIDGET (modest_secureauth_picker_new (MODEST_EDITABLE_SIZE, @@ -297,8 +309,10 @@ create_outgoing_security (ModestSecurityOptionsView* self, ppriv->user_entry = GTK_WIDGET (modest_validating_entry_new ()); /* Auto-capitalization is the default, so let's turn it off: */ +#ifdef MODEST_TOOLKIT_HILDON2 hildon_gtk_entry_set_input_mode (GTK_ENTRY (ppriv->user_entry), HILDON_GTK_INPUT_MODE_FULL); +#endif user_label = g_strdup_printf("%s*", _("mail_fi_username")); user_caption = modest_maemo_utils_create_captioned_with_size_type (title_size_group, @@ -321,9 +335,11 @@ create_outgoing_security (ModestSecurityOptionsView* self, ppriv->pwd_entry = modest_toolkit_factory_create_entry (modest_runtime_get_toolkit_factory ()); /* Auto-capitalization is the default, so let's turn it off */ +#ifdef MODEST_TOOLKIT_HILDON2 hildon_gtk_entry_set_input_mode (GTK_ENTRY (ppriv->pwd_entry), HILDON_GTK_INPUT_MODE_FULL | HILDON_GTK_INPUT_MODE_INVISIBLE); +#endif gtk_entry_set_visibility (GTK_ENTRY (ppriv->pwd_entry), FALSE); pwd_caption = @@ -345,9 +361,14 @@ create_outgoing_security (ModestSecurityOptionsView* self, MODEST_EDITABLE_SIZE); } - /* Track changes in UI */ - g_signal_connect (G_OBJECT (ppriv->security_view), "value-changed", - G_CALLBACK (on_security_changed), self); + /* Track changes in UI */ + if (GTK_IS_COMBO_BOX (ppriv->security_view)) { + g_signal_connect (G_OBJECT (ppriv->security_view), "changed", + G_CALLBACK (on_security_changed), self); + } else { + g_signal_connect (G_OBJECT (ppriv->security_view), "value-changed", + 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); @@ -360,8 +381,8 @@ create_outgoing_security (ModestSecurityOptionsView* self, } /* Initialize widgets */ - modest_serversecurity_picker_set_active_serversecurity ( - MODEST_SERVERSECURITY_PICKER (ppriv->security_view), + 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), @@ -473,7 +494,7 @@ modest_maemo_security_options_view_save_settings (ModestSecurityOptionsView* sel if (ppriv->full) { server_port = modest_number_entry_get_value (ppriv->port_view); } else { - server_port = modest_serversecurity_picker_get_active_serversecurity_port (MODEST_SERVERSECURITY_PICKER (ppriv->security_view)); + server_port = modest_serversecurity_selector_get_active_serversecurity_port (ppriv->security_view); } modest_server_account_settings_set_port (server_settings, server_port);