ModestSecureauthPicker and updated hildon2 dialogs.
* Small fixes.
pmo-trunk-r5870
modest-osso-state-saving.c \
modest-osso-state-saving.h \
modest-presets.h modest-presets.c \
+ modest-secureauth-picker.h modest-secureauth-picker.c \
modest-selector-picker.h modest-selector-picker.c
if MODEST_USE_DUMMY_ADDRESS_BOOK
#include "modest-runtime.h"
#include "modest-serversecurity-picker.h"
-#include "widgets/modest-secureauth-combo-box.h"
+#include "modest-secureauth-picker.h"
#include "widgets/modest-validating-entry.h"
#include <gtk/gtkbutton.h>
#include <gtk/gtkhbox.h>
struct _ModestConnectionSpecificSmtpEditWindowPrivate
{
GtkWidget *entry_outgoingserver;
- GtkWidget *combo_outgoing_auth;
+ GtkWidget *outgoing_auth_picker;
GtkWidget *entry_user_username;
GtkWidget *entry_user_password;
GtkWidget *outgoing_security_picker;
gtk_widget_show (caption);
/* The secure authentication widgets: */
- if (!priv->combo_outgoing_auth)
- priv->combo_outgoing_auth = GTK_WIDGET (modest_secureauth_combo_box_new ());
- caption = hildon_caption_new (sizegroup, _("mcen_li_emailsetup_secure_authentication"),
- priv->combo_outgoing_auth, NULL, HILDON_CAPTION_OPTIONAL);
- g_signal_connect (G_OBJECT (priv->combo_outgoing_auth), "changed", G_CALLBACK(on_change), self);
- gtk_widget_show (priv->combo_outgoing_auth);
- gtk_box_pack_start (GTK_BOX (vbox), caption, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_widget_show (caption);
+ if (!priv->outgoing_auth_picker) {
+ priv->outgoing_auth_picker = GTK_WIDGET (modest_secureauth_picker_new ());
+ hildon_button_set_title (HILDON_BUTTON (priv->outgoing_auth_picker), _("mcen_li_emailsetup_secure_authentication"));
+ }
+ g_signal_connect (G_OBJECT (priv->outgoing_auth_picker), "value-changed", G_CALLBACK(on_change), self);
+ gtk_widget_show (priv->outgoing_auth_picker);
+ gtk_box_pack_start (GTK_BOX (vbox), priv->outgoing_auth_picker, FALSE, FALSE, MODEST_MARGIN_HALF);
/* The username widgets: */
priv->entry_user_username = GTK_WIDGET (modest_validating_entry_new ());
MODEST_SERVERSECURITY_PICKER (priv->outgoing_security_picker),
modest_server_account_settings_get_security_protocol (server_settings));
- modest_secureauth_combo_box_set_active_secureauth (
- MODEST_SECUREAUTH_COMBO_BOX (priv->combo_outgoing_auth),
+ modest_secureauth_picker_set_active_secureauth (
+ MODEST_SECUREAUTH_PICKER (priv->outgoing_auth_picker),
modest_server_account_settings_get_auth_protocol (server_settings));
/* port: */
modest_serversecurity_picker_get_active_serversecurity (
MODEST_SERVERSECURITY_PICKER (priv->outgoing_security_picker)));
modest_server_account_settings_set_auth_protocol (server_settings,
- modest_secureauth_combo_box_get_active_secureauth (
- MODEST_SECUREAUTH_COMBO_BOX (priv->combo_outgoing_auth)));
+ modest_secureauth_picker_get_active_secureauth (
+ MODEST_SECUREAUTH_PICKER (priv->outgoing_auth_picker)));
modest_server_account_settings_set_account_name (server_settings,
priv->account_name);
void
modest_country_picker_load_data(ModestCountryPicker *self)
{
+ GtkCellRenderer *renderer;
+ GtkWidget *selector;
GtkListStore *model;
/* Create a tree model for the combo box,
/* Country column:
* The ID model column in not shown in the view. */
- GtkCellRenderer *renderer = gtk_cell_renderer_text_new ();
+ renderer = gtk_cell_renderer_text_new ();
g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
- GtkWidget *selector = hildon_touch_selector_new ();
+ selector = hildon_touch_selector_new ();
hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (self), HILDON_TOUCH_SELECTOR (selector));
hildon_touch_selector_append_column (HILDON_TOUCH_SELECTOR (selector), GTK_TREE_MODEL (model),
renderer, "text", MODEL_COL_NAME, NULL);
#include "widgets/modest-ui-constants.h"
#include "widgets/modest-validating-entry.h"
#include "modest-serversecurity-picker.h"
-#include "widgets/modest-secureauth-combo-box.h"
-#ifdef MODEST_HAVE_HILDON0_WIDGETS
-#include <hildon-widgets/hildon-caption.h>
-#include <hildon-widgets/hildon-number-editor.h>
-#else
+#include "modest-secureauth-picker.h"
#include <hildon/hildon-caption.h>
#include <hildon/hildon-number-editor.h>
-#endif /*MODEST_HAVE_HILDON0_WIDGETS*/
#define PORT_MIN 1
#define PORT_MAX 65535
static void on_entry_changed (GtkEditable *editable, gpointer user_data);
-/* Tracks changes in the incoming security combo box */
+/* Tracks changes in the incoming security picker */
static void
on_security_changed (GtkWidget *widget,
ModestMaemoSecurityOptionsView *self)
ModestMaemoSecurityOptionsView *self)
{
ModestSecurityOptionsViewPrivate* ppriv;
- ModestSecureauthComboBox *combo;
+ ModestSecureauthPicker *picker;
ModestProtocolRegistry *protocol_registry;
ModestProtocolType auth_proto;
gboolean secureauth_used;
ppriv = MODEST_SECURITY_OPTIONS_VIEW_GET_PRIVATE (self);
protocol_registry = modest_runtime_get_protocol_registry ();
- combo = MODEST_SECUREAUTH_COMBO_BOX (ppriv->auth_view);
+ picker = MODEST_SECUREAUTH_PICKER (ppriv->auth_view);
- auth_proto = modest_secureauth_combo_box_get_active_secureauth (combo);
+ auth_proto = modest_secureauth_picker_get_active_secureauth (picker);
secureauth_used = modest_protocol_registry_protocol_type_is_secure (protocol_registry,
auth_proto);
}
/*
- * TODO: call this whenever the auth combo changes. If we set it
+ * TODO: call this whenever the auth picker changes. If we set it
* explicitely at the beggining to a value then there is no need to
* call this handler directly at the beginning
*/
ModestSecurityOptionsView* self;
ModestSecurityOptionsViewPrivate *ppriv;
ModestProtocolType auth_proto;
- ModestSecureauthComboBox *combo;
+ ModestSecureauthPicker *picker;
gboolean is_secure, missing;
ModestProtocolRegistry *protocol_registry;
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);
+ 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);
GtkSizeGroup *size_group)
{
ModestSecurityOptionsViewPrivate *ppriv;
- GtkWidget *auth_caption, *user_caption = NULL;
+ GtkWidget *user_caption = NULL;
GtkWidget *pwd_caption = NULL, *port_caption = NULL;
ppriv = MODEST_SECURITY_OPTIONS_VIEW_GET_PRIVATE (self);
hildon_button_set_title (HILDON_BUTTON (ppriv->security_view), _("mcen_li_emailsetup_secure_connection"));
/* The secure authentication widgets */
- ppriv->auth_view = GTK_WIDGET (modest_secureauth_combo_box_new ());
- auth_caption = hildon_caption_new (size_group, _("mcen_li_emailsetup_secure_authentication"),
- ppriv->auth_view, NULL, HILDON_CAPTION_OPTIONAL);
+ ppriv->auth_view = GTK_WIDGET (modest_secureauth_picker_new ());
+ hildon_button_set_title (HILDON_BUTTON (ppriv->auth_view), _("mcen_li_emailsetup_secure_authentication"));
if (ppriv->full) {
gchar *user_label;
modest_serversecurity_picker_set_active_serversecurity (
MODEST_SERVERSECURITY_PICKER (ppriv->security_view),
MODEST_PROTOCOLS_CONNECTION_NONE);
- modest_secureauth_combo_box_set_active_secureauth (
- MODEST_SECUREAUTH_COMBO_BOX (ppriv->auth_view),
+ modest_secureauth_picker_set_active_secureauth (
+ MODEST_SECUREAUTH_PICKER (ppriv->auth_view),
MODEST_PROTOCOLS_AUTH_NONE);
/* Pack into container */
if (ppriv->full) {
- gtk_box_pack_start (GTK_BOX (self), auth_caption, FALSE, FALSE, MODEST_MARGIN_HALF);
+ 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);
} else {
/* The order is different */
gtk_box_pack_start (GTK_BOX (self), ppriv->security_view, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_box_pack_start (GTK_BOX (self), auth_caption, FALSE, FALSE, MODEST_MARGIN_HALF);
+ gtk_box_pack_start (GTK_BOX (self), ppriv->auth_view, FALSE, FALSE, MODEST_MARGIN_HALF);
}
/* Show widgets */
}
gtk_widget_show (ppriv->security_view);
gtk_widget_show (ppriv->auth_view);
- gtk_widget_show (auth_caption);
}
GtkWidget *
#include <modest-text-utils.h>
#include <modest-account-mgr-helpers.h>
#include "modest-progress-bar.h"
+#include "hildon/hildon-pannable-area.h"
#include "modest-defs.h"
#include "modest-hildon-includes.h"
#include "modest-ui-dimming-manager.h"
priv->msg_view = GTK_WIDGET (tny_platform_factory_new_msg_view (modest_tny_platform_factory_get_instance ()));
modest_msg_view_set_shadow_type (MODEST_MSG_VIEW (priv->msg_view), GTK_SHADOW_NONE);
main_vbox = gtk_vbox_new (FALSE, 6);
-
+#ifdef MODEST_TOOLKIT_HILDON2
+ priv->main_scroll = hildon_pannable_area_new ();
+ gtk_container_add (GTK_CONTAINER (priv->main_scroll), priv->msg_view);
+#else
#ifdef MODEST_USE_MOZEMBED
priv->main_scroll = priv->msg_view;
gtk_widget_set_size_request (priv->msg_view, -1, 1600);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (priv->main_scroll), GTK_SHADOW_NONE);
modest_maemo_set_thumbable_scrollbar (GTK_SCROLLED_WINDOW(priv->main_scroll), TRUE);
+#endif
gtk_box_pack_start (GTK_BOX(main_vbox), priv->main_scroll, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER(obj), main_vbox);
--- /dev/null
+/* Copyright (c) 2007, 2008, Nokia Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the Nokia Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "modest-secureauth-picker.h"
+#include <modest-runtime.h>
+#include <gtk/gtkliststore.h>
+#include <gtk/gtkcelllayout.h>
+#include <gtk/gtkcellrenderertext.h>
+#include <glib/gi18n.h>
+
+#include <stdlib.h>
+#include <string.h> /* For memcpy() */
+
+/* Include config.h so that _() works: */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+G_DEFINE_TYPE (ModestSecureauthPicker, modest_secureauth_picker, HILDON_TYPE_PICKER_BUTTON);
+
+#define MODEST_SECUREAUTH_PICKER_GET_PRIVATE(o) \
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), MODEST_TYPE_SECUREAUTH_PICKER, ModestSecureauthPickerPrivate))
+
+typedef struct _ModestSecureauthPickerPrivate ModestSecureauthPickerPrivate;
+
+struct _ModestSecureauthPickerPrivate
+{
+ GtkTreeModel *model;
+};
+
+static void
+modest_secureauth_picker_finalize (GObject *object)
+{
+ ModestSecureauthPickerPrivate *priv = MODEST_SECUREAUTH_PICKER_GET_PRIVATE (object);
+
+ g_object_unref (G_OBJECT (priv->model));
+
+ G_OBJECT_CLASS (modest_secureauth_picker_parent_class)->finalize (object);
+}
+
+static void
+modest_secureauth_picker_class_init (ModestSecureauthPickerClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (ModestSecureauthPickerPrivate));
+
+ object_class->finalize = modest_secureauth_picker_finalize;
+}
+
+enum MODEL_COLS {
+ MODEL_COL_NAME = 0, /* a string */
+ MODEL_COL_ID = 1 /* an int. */
+};
+
+void modest_secureauth_picker_fill (ModestSecureauthPicker *picker);
+
+static gchar *
+touch_selector_print_func (HildonTouchSelector *selector)
+{
+ GtkTreeIter iter;
+ if (hildon_touch_selector_get_selected (HILDON_TOUCH_SELECTOR (selector), 0, &iter)) {
+ GtkTreeModel *model;
+ GValue value = {0,};
+
+ model = hildon_touch_selector_get_model (HILDON_TOUCH_SELECTOR (selector), 0);
+ gtk_tree_model_get_value (model, &iter, MODEL_COL_NAME, &value);
+ return g_value_dup_string (&value);
+ }
+ return NULL;
+}
+
+static void
+modest_secureauth_picker_init (ModestSecureauthPicker *self)
+{
+ ModestSecureauthPickerPrivate *priv = MODEST_SECUREAUTH_PICKER_GET_PRIVATE (self);
+
+ priv->model = NULL;
+}
+
+ModestSecureauthPicker*
+modest_secureauth_picker_new (void)
+{
+ ModestSecureauthPicker *self;
+ ModestSecureauthPickerPrivate *priv;
+ GtkCellRenderer *renderer;
+ GtkWidget *selector;
+
+ self = g_object_new (MODEST_TYPE_SECUREAUTH_PICKER,
+ "arrangement", HILDON_BUTTON_ARRANGEMENT_VERTICAL,
+ "size", HILDON_SIZE_AUTO,
+ NULL);
+ priv = MODEST_SECUREAUTH_PICKER_GET_PRIVATE (self);
+
+ /* Create a tree model,
+ * with a string for the name, and an ID for the servertype.
+ * This must match our MODEL_COLS enum constants.
+ */
+ priv->model = GTK_TREE_MODEL (gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT));
+ renderer = gtk_cell_renderer_text_new ();
+ g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+
+ selector = hildon_touch_selector_new ();
+ hildon_touch_selector_append_column (HILDON_TOUCH_SELECTOR (selector), GTK_TREE_MODEL (priv->model),
+ renderer, "text", MODEL_COL_NAME, NULL);
+
+ hildon_touch_selector_set_model (HILDON_TOUCH_SELECTOR (selector), 0, GTK_TREE_MODEL (priv->model));
+ hildon_touch_selector_set_print_func (HILDON_TOUCH_SELECTOR (selector), touch_selector_print_func);
+
+ hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (self), HILDON_TOUCH_SELECTOR (selector));
+
+ modest_secureauth_picker_fill (self);
+
+ return self;
+}
+
+/* Fill the combo box with appropriate choices.
+ * #picker: The combo box.
+ * @protocol: IMAP or POP.
+ */
+void modest_secureauth_picker_fill (ModestSecureauthPicker *picker)
+{
+ ModestSecureauthPickerPrivate *priv;
+ GtkListStore *liststore;
+ ModestProtocolRegistry *protocol_registry;
+ GSList *protocols, *node;
+ GtkTreeIter iter;
+
+ priv = MODEST_SECUREAUTH_PICKER_GET_PRIVATE (picker);
+
+ /* Remove any existing rows: */
+ liststore = GTK_LIST_STORE (priv->model);
+ gtk_list_store_clear (liststore);
+
+ protocol_registry = modest_runtime_get_protocol_registry ();
+ protocols = modest_protocol_registry_get_by_tag (protocol_registry, MODEST_PROTOCOL_REGISTRY_AUTH_PROTOCOLS);
+
+ for (node = protocols; node != NULL; node = g_slist_next (node)) {
+ ModestProtocol *protocol;
+ protocol = (ModestProtocol *) node->data;
+
+ gtk_list_store_append (liststore, &iter);
+ gtk_list_store_set (liststore, &iter,
+ MODEL_COL_ID, (gint)modest_protocol_get_type_id (protocol),
+ MODEL_COL_NAME, modest_protocol_get_display_name (protocol),
+ -1);
+ }
+}
+
+/**
+ * Returns the selected secureauth,
+ * or MODEST_PROTOCOL_REGISTRY_TYPE_INVALID if no secureauth was selected.
+ */
+ModestProtocolType
+modest_secureauth_picker_get_active_secureauth (ModestSecureauthPicker *picker)
+{
+ GtkTreeIter active;
+ gboolean found;
+ GtkWidget *selector;
+
+ selector = GTK_WIDGET (hildon_picker_button_get_selector (HILDON_PICKER_BUTTON (picker)));
+
+ found = hildon_touch_selector_get_selected (HILDON_TOUCH_SELECTOR (selector), 0, &active);
+ if (found) {
+ ModestSecureauthPickerPrivate *priv = MODEST_SECUREAUTH_PICKER_GET_PRIVATE (picker);
+
+ ModestProtocolType secure_auth = MODEST_PROTOCOLS_AUTH_NONE;
+ gtk_tree_model_get (priv->model, &active, MODEL_COL_ID, &secure_auth, -1);
+ return secure_auth;
+ }
+
+ return MODEST_PROTOCOL_REGISTRY_TYPE_INVALID; /* Failed. */
+}
+
+/* This allows us to pass more than one piece of data to the signal handler,
+ * and get a result: */
+typedef struct
+{
+ ModestSecureauthPicker* self;
+ ModestProtocolType id;
+ gboolean found;
+} ForEachData;
+
+static gboolean
+on_model_foreach_select_id(GtkTreeModel *model,
+ GtkTreePath *path, GtkTreeIter *iter, gpointer user_data)
+{
+ ForEachData *state;
+ ModestProtocolType id = MODEST_PROTOCOL_REGISTRY_TYPE_INVALID;
+
+ state = (ForEachData*)(user_data);
+
+ /* Select the item if it has the matching ID: */
+ gtk_tree_model_get (model, iter, MODEL_COL_ID, &id, -1);
+ if(id == state->id) {
+ GtkWidget *selector;
+ selector = GTK_WIDGET (hildon_picker_button_get_selector (HILDON_PICKER_BUTTON (state->self)));
+ hildon_touch_selector_select_iter (HILDON_TOUCH_SELECTOR (selector), 0, iter, TRUE);
+ hildon_button_set_value (HILDON_BUTTON (state->self),
+ hildon_touch_selector_get_current_text (HILDON_TOUCH_SELECTOR (selector)));
+
+ state->found = TRUE;
+ return TRUE; /* Stop walking the tree. */
+ }
+
+ return FALSE; /* Keep walking the tree. */
+}
+
+/**
+ * Selects the specified secureauth,
+ * or MODEST_PROTOCOL_REGISTRY_TYPE_INVALID if no secureauth was selected.
+ */
+gboolean
+modest_secureauth_picker_set_active_secureauth (ModestSecureauthPicker *picker, ModestProtocolType secureauth)
+{
+ ModestSecureauthPickerPrivate *priv;
+ ForEachData *state;
+ gboolean result;
+
+ priv = MODEST_SECUREAUTH_PICKER_GET_PRIVATE (picker);
+
+ /* Create a state instance so we can send two items of data to the signal handler: */
+ state = g_new0 (ForEachData, 1);
+ state->self = picker;
+ state->id = secureauth;
+ state->found = FALSE;
+
+ /* Look at each item, and select the one with the correct ID: */
+ gtk_tree_model_foreach (priv->model, &on_model_foreach_select_id, state);
+
+ result = state->found;
+
+ /* Free the state instance: */
+ g_free(state);
+
+ return result;
+}
+
--- /dev/null
+/* Copyright (c) 2007, 2008, Nokia Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the Nokia Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _MODEST_SECUREAUTH_PICKER
+#define _MODEST_SECUREAUTH_PICKER
+
+#include <hildon/hildon-picker-button.h>
+#include "modest-protocol-registry.h"
+
+G_BEGIN_DECLS
+
+#define MODEST_TYPE_SECUREAUTH_PICKER modest_secureauth_picker_get_type()
+
+#define MODEST_SECUREAUTH_PICKER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ MODEST_TYPE_SECUREAUTH_PICKER, ModestSecureauthPicker))
+
+#define MODEST_SECUREAUTH_PICKER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ MODEST_TYPE_SECUREAUTH_PICKER, ModestSecureauthPickerClass))
+
+#define MODEST_IS_SECUREAUTH_PICKER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ MODEST_TYPE_SECUREAUTH_PICKER))
+
+#define MODEST_IS_SECUREAUTH_PICKER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ MODEST_TYPE_SECUREAUTH_PICKER))
+
+#define MODEST_SECUREAUTH_PICKER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ MODEST_TYPE_SECUREAUTH_PICKER, ModestSecureauthPickerClass))
+
+typedef struct {
+ HildonPickerButton parent;
+} ModestSecureauthPicker;
+
+typedef struct {
+ HildonPickerButtonClass parent_class;
+} ModestSecureauthPickerClass;
+
+GType modest_secureauth_picker_get_type (void);
+
+ModestSecureauthPicker* modest_secureauth_picker_new (void);
+
+ModestProtocolType modest_secureauth_picker_get_active_secureauth (ModestSecureauthPicker *picker);
+
+gboolean modest_secureauth_picker_set_active_secureauth (ModestSecureauthPicker *picker,
+ ModestProtocolType secureauth);
+
+
+G_END_DECLS
+
+#endif /* _MODEST_SECUREAUTH_PICKER */
#include "modest-security-options-view-priv.h"
#ifdef MODEST_TOOLKIT_HILDON2
#include "modest-serversecurity-picker.h"
+#include "modest-secureauth-picker.h"
#else
#include "widgets/modest-serversecurity-combo-box.h"
-#endif
#include "widgets/modest-secureauth-combo-box.h"
+#endif
/* list my signals */
enum {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->auth_view),
TRUE);
} else {
+#ifdef MODEST_TOOLKIT_HILDON2
+ modest_secureauth_picker_set_active_secureauth (
+ MODEST_SECUREAUTH_PICKER (priv->auth_view), secure_auth);
+#else
modest_secureauth_combo_box_set_active_secureauth (
MODEST_SECUREAUTH_COMBO_BOX (priv->auth_view), secure_auth);
+#endif
}
MODEST_SECURITY_OPTIONS_VIEW_GET_CLASS (self)->load_settings (self, settings);
}
}
} else {
+#ifdef MODEST_TOOLKIT_HILDON2
+ auth_protocol = modest_secureauth_picker_get_active_secureauth (
+ MODEST_SECUREAUTH_PICKER (priv->auth_view));
+#else
auth_protocol = modest_secureauth_combo_box_get_active_secureauth (
- MODEST_SECUREAUTH_COMBO_BOX (priv->auth_view));
+ MODEST_SECUREAUTH_COMBO_BOX (priv->auth_view));
+#endif
}
/* Save settings */
/* Get auth */
if (self->type == MODEST_SECURITY_OPTIONS_OUTGOING) {
+#ifdef MODEST_TOOLKIT_HILDON2
+ state->auth = modest_secureauth_picker_get_active_secureauth (MODEST_SECUREAUTH_PICKER (priv->auth_view));
+#else
state->auth = modest_secureauth_combo_box_get_active_secureauth (MODEST_SECUREAUTH_COMBO_BOX (priv->auth_view));
+#endif
if (priv->full) {
}
} else {