#include "modest-serversecurity-picker.h"
#include "modest-secureauth-picker.h"
#include "modest-maemo-utils.h"
-#include <modest-number-editor.h>
-#include <hildon/hildon-check-button.h>
#include "modest-hildon-includes.h"
#define PORT_MIN 1
static void on_entry_changed (GtkEditable *editable, gpointer user_data);
+#ifdef MODEST_NUMBER_ENTRY_SUPPORT_VALID_CHANGED
+static void on_valid_changed (ModestNumberEditor *editor, gboolean valid, ModestSecurityOptionsView *self);
+#endif
+
/* Tracks changes in the incoming security picker */
static void
on_security_changed (GtkWidget *widget,
if (MODEST_SECURITY_OPTIONS_VIEW (self)->type == MODEST_SECURITY_OPTIONS_INCOMING) {
/* Activate and dim checkbutton if it's secure */
- hildon_check_button_set_active (HILDON_CHECK_BUTTON (ppriv->auth_view),
- is_secure);
+ modest_togglable_set_active (ppriv->auth_view,
+ is_secure);
gtk_widget_set_sensitive (ppriv->auth_view, !is_secure);
} else {
modest_serversecurity_picker_get_active_serversecurity_port (MODEST_SERVERSECURITY_PICKER (ppriv->security_view));
if(port_number) {
- modest_number_editor_set_value (MODEST_NUMBER_EDITOR (ppriv->port_view),
- port_number);
+ modest_number_entry_set_value (ppriv->port_view,
+ port_number);
}
}
}
_("mcen_li_emailsetup_secure_connection"),
ppriv->security_view);
- ppriv->auth_view = hildon_check_button_new (MODEST_EDITABLE_SIZE);
- gtk_button_set_label (GTK_BUTTON (ppriv->auth_view), _("mcen_li_emailsetup_secure_authentication"));
- gtk_button_set_alignment (GTK_BUTTON (ppriv->auth_view), 0.0, 0.5);
+ ppriv->auth_view = modest_toolkit_factory_create_check_button (modest_runtime_get_toolkit_factory (),
+ _("mcen_li_emailsetup_secure_authentication"));
/* Track changes in UI */
g_signal_connect (G_OBJECT (ppriv->security_view), "value-changed",
gtk_widget_show (ppriv->auth_view);
if (ppriv->full) {
- ppriv->port_view = GTK_WIDGET (modest_number_editor_new (PORT_MIN, PORT_MAX));
- entry_caption = modest_maemo_utils_create_captioned (title_size_group,
- value_size_group,
- _("mcen_fi_emailsetup_port"),
- FALSE,
- ppriv->port_view);
+ ppriv->port_view = modest_toolkit_factory_create_number_entry (modest_runtime_get_toolkit_factory (),
+ PORT_MIN, PORT_MAX);
+ entry_caption =
+ modest_maemo_utils_create_captioned_with_size_type (title_size_group,
+ value_size_group,
+ _("mcen_fi_emailsetup_port"),
+ FALSE,
+ ppriv->port_view,
+ MODEST_EDITABLE_SIZE);
/* Pack & show widgets */
gtk_box_pack_start (GTK_BOX (self), entry_caption, FALSE, FALSE, 0);
gtk_widget_show (ppriv->port_view);
gtk_widget_show (entry_caption);
+
+ /* Track changes in UI */
+#ifdef MODEST_NUMBER_ENTRY_SUPPORT_VALID_CHANGED
+ g_signal_connect (G_OBJECT (ppriv->port_view), "valid-changed",
+ G_CALLBACK (on_valid_changed), self);
+#endif
}
}
ModestSecurityOptionsView* self;
ModestMaemoSecurityOptionsViewPrivate *priv;
ModestSecurityOptionsViewPrivate *ppriv;
- ModestProtocolType auth_proto;
ModestSecureauthPicker *picker;
- gboolean is_secure;
+ gboolean is_secure = FALSE;
ModestProtocolRegistry *protocol_registry;
self = MODEST_SECURITY_OPTIONS_VIEW (user_data);
ppriv = MODEST_SECURITY_OPTIONS_VIEW_GET_PRIVATE (self);
protocol_registry = modest_runtime_get_protocol_registry ();
- /* Outgoing username is mandatory if outgoing auth is secure */
- picker = MODEST_SECUREAUTH_PICKER (ppriv->auth_view);
- auth_proto = modest_secureauth_picker_get_active_secureauth (picker);
- is_secure = modest_protocol_registry_protocol_type_is_secure (protocol_registry,
- auth_proto);
+ /* Check if it's a secure protocol */
+ if (MODEST_IS_SECUREAUTH_PICKER (ppriv->auth_view)) {
+ ModestProtocolType auth_proto;
+ picker = MODEST_SECUREAUTH_PICKER (ppriv->auth_view);
+ auth_proto = modest_secureauth_picker_get_active_secureauth (picker);
+ is_secure = modest_protocol_registry_protocol_type_is_secure (protocol_registry,
+ auth_proto);
+ } else if (modest_is_togglable (ppriv->auth_view)) {
+ is_secure = modest_togglable_get_active (ppriv->auth_view);
+ }
if (is_secure &&
- !g_ascii_strcasecmp (hildon_entry_get_text (HILDON_ENTRY (ppriv->user_entry)), "")) {
+ !g_strcmp0 (modest_entry_get_text (ppriv->user_entry), "")) {
priv->missing_data = TRUE;
} else {
priv->missing_data = FALSE;
if (!priv->missing_data &&
ppriv->full &&
- !modest_number_editor_is_valid (MODEST_NUMBER_EDITOR (ppriv->port_view)))
+ !modest_number_entry_is_valid (ppriv->port_view))
priv->missing_data = TRUE;
/* Emit a signal to notify if mandatory data is missing */
priv->missing_data, NULL);
}
-void
+#ifdef MODEST_NUMBER_ENTRY_SUPPORT_VALID_CHANGED
+static void
on_valid_changed (ModestNumberEditor *editor,
gboolean valid,
ModestSecurityOptionsView *self)
{
on_entry_changed (NULL, (gpointer) self);
}
+#endif
static void
create_outgoing_security (ModestSecurityOptionsView* self,
HILDON_GTK_INPUT_MODE_FULL);
user_label = g_strdup_printf("%s*", _("mail_fi_username"));
- user_caption = modest_maemo_utils_create_captioned (title_size_group,
- value_size_group,
- user_label,
- FALSE,
- ppriv->user_entry);
+ user_caption = modest_maemo_utils_create_captioned_with_size_type (title_size_group,
+ value_size_group,
+ user_label,
+ FALSE,
+ ppriv->user_entry,
+ MODEST_EDITABLE_SIZE);
g_free (user_label);
/* Prevent the use of some characters. Limit the max
on_entry_max, self);
/* Password widgets */
- ppriv->pwd_entry = hildon_entry_new (MODEST_EDITABLE_SIZE);
+ ppriv->pwd_entry = modest_toolkit_factory_create_entry (modest_runtime_get_toolkit_factory ());
/* Auto-capitalization is the default, so let's turn it off */
hildon_gtk_entry_set_input_mode (GTK_ENTRY (ppriv->pwd_entry),
HILDON_GTK_INPUT_MODE_INVISIBLE);
gtk_entry_set_visibility (GTK_ENTRY (ppriv->pwd_entry), FALSE);
- pwd_caption = modest_maemo_utils_create_captioned (title_size_group,
- value_size_group,
- _("mail_fi_password"),
- FALSE,
- ppriv->pwd_entry);
-
- ppriv->port_view = GTK_WIDGET (modest_number_editor_new (PORT_MIN, PORT_MAX));
- port_caption = modest_maemo_utils_create_captioned (title_size_group,
- value_size_group,
- _("mcen_fi_emailsetup_port"),
- FALSE,
- ppriv->port_view);
+ pwd_caption =
+ modest_maemo_utils_create_captioned_with_size_type (title_size_group,
+ value_size_group,
+ _("mail_fi_password"),
+ FALSE,
+ ppriv->pwd_entry,
+ MODEST_EDITABLE_SIZE);
+
+ ppriv->port_view = modest_toolkit_factory_create_number_entry (modest_runtime_get_toolkit_factory (),
+ PORT_MIN, PORT_MAX);
+ port_caption =
+ modest_maemo_utils_create_captioned_with_size_type (title_size_group,
+ value_size_group,
+ _("mcen_fi_emailsetup_port"),
+ FALSE,
+ ppriv->port_view,
+ MODEST_EDITABLE_SIZE);
}
/* Track changes in UI */
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->port_view), "valid-changed",
G_CALLBACK (on_valid_changed), self);
+#endif
}
/* Initialize widgets */
/* Pack into container */
if (ppriv->full) {
- gtk_box_pack_start (GTK_BOX (self), ppriv->auth_view, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_box_pack_start (GTK_BOX (self), user_caption, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_box_pack_start (GTK_BOX (self), pwd_caption, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_box_pack_start (GTK_BOX (self), ppriv->security_view, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_box_pack_start (GTK_BOX (self), port_caption, FALSE, FALSE, MODEST_MARGIN_HALF);
+ gtk_box_pack_start (GTK_BOX (self), ppriv->auth_view, 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), port_caption, FALSE, FALSE, 0);
} else {
- gtk_box_pack_start (GTK_BOX (self), ppriv->auth_view, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_box_pack_start (GTK_BOX (self), ppriv->security_view, FALSE, FALSE, MODEST_MARGIN_HALF);
+ 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);
}
/* Show widgets */
} else if (ppriv->full) {
/* Keep the user-entered port-number, or the
* already-appropriate automatic port number */
- modest_number_editor_set_value (MODEST_NUMBER_EDITOR (ppriv->port_view),
- port_number);
+ modest_number_entry_set_value (ppriv->port_view,
+ port_number);
}
/* Frees */
g_object_unref (server_settings);
server_settings = modest_account_settings_get_transport_settings (settings);
if (ppriv->full) {
- server_port = modest_number_editor_get_value (MODEST_NUMBER_EDITOR (ppriv->port_view));
+ 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_settings = modest_account_settings_get_transport_settings (settings);
server_port =
- modest_number_editor_get_value (MODEST_NUMBER_EDITOR (ppriv->port_view));
+ modest_number_entry_get_value (ppriv->port_view);
/* Frees */
g_object_unref (server_settings);