2007-04-20 Murray Cumming <murrayc@murrayc.com>
+ * src/maemo/easysetup/modest-easysetup-wizard.c:
+ * src/maemo/modest-account-settings-dialog.c:
+ * src/maemo/modest-connection-specific-smtp-edit-window.c:
+ * src/widgets/Makefile.am:
+ * src/widgets/modest-easysetup-secureauth-combo-box.c:
+ * src/widgets/modest-easysetup-secureauth-combo-box.h:
+ * src/widgets/modest-easysetup-serversecurity-combo-box.c:
+ * src/widgets/modest-easysetup-serversecurity-combo-box.h:
+ * src/widgets/modest-secureauth-combo-box.c:
+ * src/widgets/modest-secureauth-combo-box.h:
+ * src/widgets/modest-serversecurity-combo-box.c:
+ * src/widgets/modest-serversecurity-combo-box.h: Renamed the files and
+ made the GObject names more consistent with the rest of the Modest code.
+
+2007-04-20 Murray Cumming <murrayc@murrayc.com>
+
* src/maemo/easysetup/Makefile.am:
* src/maemo/easysetup/modest-easysetup-secureauth-combo-box.c:
* src/maemo/easysetup/modest-easysetup-secureauth-combo-box.h:
#include "maemo/easysetup/modest-easysetup-country-combo-box.h"
#include "maemo/easysetup/modest-easysetup-provider-combo-box.h"
#include "maemo/easysetup/modest-easysetup-servertype-combo-box.h"
-#include "widgets/modest-easysetup-serversecurity-combo-box.h"
-#include "widgets/modest-easysetup-secureauth-combo-box.h"
+#include "widgets/modest-serversecurity-combo-box.h"
+#include "widgets/modest-secureauth-combo-box.h"
#include "widgets/modest-validating-entry.h"
#include "modest-text-utils.h"
#include "modest-account-mgr.h"
/* Fill the combo with appropriately titled choices for POP or IMAP. */
/* The choices are the same, but the titles are different, as in the UI spec. */
- easysetup_serversecurity_combo_box_fill (
- EASYSETUP_SERVERSECURITY_COMBO_BOX (self->combo_incoming_security), protocol);
+ modest_serversecurity_combo_box_fill (
+ MODEST_SERVERSECURITY_COMBO_BOX (self->combo_incoming_security), protocol);
}
static void on_combo_servertype_changed(GtkComboBox *combobox, gpointer user_data)
/* The secure connection widgets: */
if (!self->combo_incoming_security)
- self->combo_incoming_security = GTK_WIDGET (easysetup_serversecurity_combo_box_new ());
+ self->combo_incoming_security = GTK_WIDGET (modest_serversecurity_combo_box_new ());
update_incoming_server_security_choices (self);
- easysetup_serversecurity_combo_box_set_active_serversecurity (
- EASYSETUP_SERVERSECURITY_COMBO_BOX (self->combo_incoming_security), MODEST_PROTOCOL_SECURITY_NONE);
+ modest_serversecurity_combo_box_set_active_serversecurity (
+ MODEST_SERVERSECURITY_COMBO_BOX (self->combo_incoming_security), MODEST_PROTOCOL_SECURITY_NONE);
caption = hildon_caption_new (sizegroup, _("mcen_li_emailsetup_secure_connection"),
self->combo_incoming_security, NULL, HILDON_CAPTION_OPTIONAL);
gtk_widget_show (self->combo_incoming_security);
/* The secure connection widgets: */
if (!self->combo_outgoing_security)
- self->combo_outgoing_security = GTK_WIDGET (easysetup_serversecurity_combo_box_new ());
- easysetup_serversecurity_combo_box_fill (
- EASYSETUP_SERVERSECURITY_COMBO_BOX (self->combo_outgoing_security), MODEST_PROTOCOL_TRANSPORT_SMTP);
- easysetup_serversecurity_combo_box_set_active_serversecurity (
- EASYSETUP_SERVERSECURITY_COMBO_BOX (self->combo_outgoing_security), MODEST_PROTOCOL_SECURITY_NONE);
+ self->combo_outgoing_security = GTK_WIDGET (modest_serversecurity_combo_box_new ());
+ modest_serversecurity_combo_box_fill (
+ MODEST_SERVERSECURITY_COMBO_BOX (self->combo_outgoing_security), MODEST_PROTOCOL_TRANSPORT_SMTP);
+ modest_serversecurity_combo_box_set_active_serversecurity (
+ MODEST_SERVERSECURITY_COMBO_BOX (self->combo_outgoing_security), MODEST_PROTOCOL_SECURITY_NONE);
caption = hildon_caption_new (sizegroup, _("mcen_li_emailsetup_secure_connection"),
self->combo_outgoing_security, NULL, HILDON_CAPTION_OPTIONAL);
gtk_widget_show (self->combo_outgoing_security);
/* The secure authentication widgets: */
if (!self->combo_outgoing_auth)
- self->combo_outgoing_auth = GTK_WIDGET (easysetup_secureauth_combo_box_new ());
+ self->combo_outgoing_auth = GTK_WIDGET (modest_secureauth_combo_box_new ());
caption = hildon_caption_new (sizegroup, _("mcen_li_emailsetup_secure_authentication"),
self->combo_outgoing_auth, NULL, HILDON_CAPTION_OPTIONAL);
gtk_widget_show (self->combo_outgoing_auth);
protocol_incoming = easysetup_servertype_combo_box_get_active_servertype (
EASYSETUP_SERVERTYPE_COMBO_BOX (self->combo_incoming_servertype));
- protocol_security_incoming = easysetup_serversecurity_combo_box_get_active_serversecurity (
- EASYSETUP_SERVERSECURITY_COMBO_BOX (self->combo_incoming_security));
+ protocol_security_incoming = modest_serversecurity_combo_box_get_active_serversecurity (
+ MODEST_SERVERSECURITY_COMBO_BOX (self->combo_incoming_security));
protocol_authentication_incoming = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->checkbox_incoming_auth))
? MODEST_PROTOCOL_AUTH_PASSWORD
protocol_outgoing = MODEST_PROTOCOL_TRANSPORT_SMTP; /* It's always SMTP for outgoing. */
- protocol_security_outgoing = easysetup_serversecurity_combo_box_get_active_serversecurity (
- EASYSETUP_SERVERSECURITY_COMBO_BOX (self->combo_outgoing_security));
+ protocol_security_outgoing = modest_serversecurity_combo_box_get_active_serversecurity (
+ MODEST_SERVERSECURITY_COMBO_BOX (self->combo_outgoing_security));
- protocol_authentication_outgoing = easysetup_secureauth_combo_box_get_active_secureauth (
- EASYSETUP_SECUREAUTH_COMBO_BOX (self->combo_outgoing_auth));
+ protocol_authentication_outgoing = modest_secureauth_combo_box_get_active_secureauth (
+ MODEST_SECUREAUTH_COMBO_BOX (self->combo_outgoing_auth));
/* TODO:
gboolean specific = gtk_toggle_button_get_active (
#include "maemo/easysetup/modest-easysetup-country-combo-box.h"
#include "maemo/easysetup/modest-easysetup-provider-combo-box.h"
#include "maemo/easysetup/modest-easysetup-servertype-combo-box.h"
-#include "widgets/modest-easysetup-serversecurity-combo-box.h"
-#include "widgets/modest-easysetup-secureauth-combo-box.h"
+#include "widgets/modest-serversecurity-combo-box.h"
+#include "widgets/modest-secureauth-combo-box.h"
#include "widgets/modest-validating-entry.h"
#include "widgets/modest-retrieve-combo-box.h"
#include "widgets/modest-limit-retrieve-combo-box.h"
{
/* Fill the combo with appropriately titled choices for POP or IMAP. */
/* The choices are the same, but the titles are different, as in the UI spec. */
- easysetup_serversecurity_combo_box_fill (
- EASYSETUP_SERVERSECURITY_COMBO_BOX (self->combo_incoming_security), protocol);
+ modest_serversecurity_combo_box_fill (
+ MODEST_SERVERSECURITY_COMBO_BOX (self->combo_incoming_security), protocol);
}
static GtkWidget* create_page_incoming (ModestAccountSettingsDialog *self)
/* The secure connection widgets: */
/* This will be filled by update_incoming_server_security_choices(). */
if (!self->combo_incoming_security)
- self->combo_incoming_security = GTK_WIDGET (easysetup_serversecurity_combo_box_new ());
+ self->combo_incoming_security = GTK_WIDGET (modest_serversecurity_combo_box_new ());
GtkWidget *caption = hildon_caption_new (sizegroup, _("mcen_li_emailsetup_secure_connection"),
self->combo_incoming_security, NULL, HILDON_CAPTION_OPTIONAL);
gtk_widget_show (self->combo_incoming_security);
ModestAccountSettingsDialog *self = MODEST_ACCOUNT_SETTINGS_DIALOG (user_data);
ModestProtocol protocol_security =
- easysetup_secureauth_combo_box_get_active_secureauth (
- EASYSETUP_SECUREAUTH_COMBO_BOX (self->combo_outgoing_auth));
+ modest_secureauth_combo_box_get_active_secureauth (
+ MODEST_SECUREAUTH_COMBO_BOX (self->combo_outgoing_auth));
const gboolean secureauth_used = protocol_security != MODEST_PROTOCOL_AUTH_NONE;
gtk_widget_set_sensitive (self->caption_outgoing_username, secureauth_used);
ModestAccountSettingsDialog *self = MODEST_ACCOUNT_SETTINGS_DIALOG (user_data);
const gint port_number =
- easysetup_serversecurity_combo_box_get_active_serversecurity_port (
- EASYSETUP_SERVERSECURITY_COMBO_BOX (self->combo_outgoing_security));
+ modest_serversecurity_combo_box_get_active_serversecurity_port (
+ MODEST_SERVERSECURITY_COMBO_BOX (self->combo_outgoing_security));
if(port_number != 0) {
gchar* str = g_strdup_printf ("%d", port_number);
ModestAccountSettingsDialog *self = MODEST_ACCOUNT_SETTINGS_DIALOG (user_data);
const gint port_number =
- easysetup_serversecurity_combo_box_get_active_serversecurity_port (
- EASYSETUP_SERVERSECURITY_COMBO_BOX (self->combo_incoming_security));
+ modest_serversecurity_combo_box_get_active_serversecurity_port (
+ MODEST_SERVERSECURITY_COMBO_BOX (self->combo_incoming_security));
if(port_number != 0) {
gchar* str = g_strdup_printf ("%d", port_number);
/* The secure authentication widgets: */
if (!self->combo_outgoing_auth)
- self->combo_outgoing_auth = GTK_WIDGET (easysetup_secureauth_combo_box_new ());
+ self->combo_outgoing_auth = GTK_WIDGET (modest_secureauth_combo_box_new ());
caption = hildon_caption_new (sizegroup, _("mcen_li_emailsetup_secure_authentication"),
self->combo_outgoing_auth, NULL, HILDON_CAPTION_OPTIONAL);
gtk_widget_show (self->combo_outgoing_auth);
gtk_widget_show (self->caption_outgoing_password);
/* The secure connection widgets: */
- /* This will be filled and set with easysetup_serversecurity_combo_box_fill()
- * and easysetup_serversecurity_combo_box_set_active_serversecurity().
+ /* This will be filled and set with modest_serversecurity_combo_box_fill()
+ * and modest_serversecurity_combo_box_set_active_serversecurity().
*/
if (!self->combo_outgoing_security)
- self->combo_outgoing_security = GTK_WIDGET (easysetup_serversecurity_combo_box_new ());
+ self->combo_outgoing_security = GTK_WIDGET (modest_serversecurity_combo_box_new ());
caption = hildon_caption_new (sizegroup, _("mcen_li_emailsetup_secure_connection"),
self->combo_outgoing_security, NULL, HILDON_CAPTION_OPTIONAL);
gtk_widget_show (self->combo_outgoing_security);
const ModestProtocol security = modest_server_account_get_security (
dialog->account_manager, incoming_account->account_name);
- easysetup_serversecurity_combo_box_set_active_serversecurity (
- EASYSETUP_SERVERSECURITY_COMBO_BOX (dialog->combo_incoming_security), security);
+ modest_serversecurity_combo_box_set_active_serversecurity (
+ MODEST_SERVERSECURITY_COMBO_BOX (dialog->combo_incoming_security), security);
const gint port_num = modest_account_mgr_get_int (dialog->account_manager, incoming_account->account_name,
MODEST_ACCOUNT_PORT, TRUE /* server account */);
/* Get the secure-auth setting: */
const ModestProtocol secure_auth = modest_server_account_get_secure_auth(
dialog->account_manager, outgoing_account->account_name);
- easysetup_secureauth_combo_box_set_active_secureauth (
- EASYSETUP_SECUREAUTH_COMBO_BOX (dialog->combo_outgoing_auth), secure_auth);
+ modest_secureauth_combo_box_set_active_secureauth (
+ MODEST_SECUREAUTH_COMBO_BOX (dialog->combo_outgoing_auth), secure_auth);
on_combo_outgoing_auth_changed (GTK_COMBO_BOX (dialog->combo_outgoing_auth), dialog);
- easysetup_serversecurity_combo_box_fill (
- EASYSETUP_SERVERSECURITY_COMBO_BOX (dialog->combo_outgoing_security), outgoing_account->proto);
+ modest_serversecurity_combo_box_fill (
+ MODEST_SERVERSECURITY_COMBO_BOX (dialog->combo_outgoing_security), outgoing_account->proto);
/* Get the security setting: */
const ModestProtocol security = modest_server_account_get_security (
dialog->account_manager, outgoing_account->account_name);
- easysetup_serversecurity_combo_box_set_active_serversecurity (
- EASYSETUP_SERVERSECURITY_COMBO_BOX (dialog->combo_outgoing_security), security);
+ modest_serversecurity_combo_box_set_active_serversecurity (
+ MODEST_SERVERSECURITY_COMBO_BOX (dialog->combo_outgoing_security), security);
const gint port_num = modest_account_mgr_get_int (dialog->account_manager, outgoing_account->account_name,
MODEST_ACCOUNT_PORT, TRUE /* server account */);
: MODEST_PROTOCOL_AUTH_NONE;
modest_server_account_set_secure_auth (dialog->account_manager, incoming_account_name, protocol_authentication_incoming);
- const ModestProtocol protocol_security_incoming = easysetup_serversecurity_combo_box_get_active_serversecurity (
- EASYSETUP_SERVERSECURITY_COMBO_BOX (dialog->combo_incoming_security));
+ const ModestProtocol protocol_security_incoming = modest_serversecurity_combo_box_get_active_serversecurity (
+ MODEST_SERVERSECURITY_COMBO_BOX (dialog->combo_incoming_security));
modest_server_account_set_security (dialog->account_manager, incoming_account_name, protocol_security_incoming);
/* port: */
if (!test)
return FALSE;
- const ModestProtocol protocol_security_outgoing = easysetup_serversecurity_combo_box_get_active_serversecurity (
- EASYSETUP_SERVERSECURITY_COMBO_BOX (dialog->combo_outgoing_security));
+ const ModestProtocol protocol_security_outgoing = modest_serversecurity_combo_box_get_active_serversecurity (
+ MODEST_SERVERSECURITY_COMBO_BOX (dialog->combo_outgoing_security));
modest_server_account_set_security (dialog->account_manager, outgoing_account_name, protocol_security_outgoing);
- const ModestProtocol protocol_authentication_outgoing = easysetup_secureauth_combo_box_get_active_secureauth (
- EASYSETUP_SECUREAUTH_COMBO_BOX (dialog->combo_outgoing_auth));
+ const ModestProtocol protocol_authentication_outgoing = modest_secureauth_combo_box_get_active_secureauth (
+ MODEST_SECUREAUTH_COMBO_BOX (dialog->combo_outgoing_auth));
modest_server_account_set_secure_auth (dialog->account_manager, outgoing_account_name, protocol_authentication_outgoing);
/* port: */
#include "maemo/easysetup/modest-easysetup-country-combo-box.h"
#include "maemo/easysetup/modest-easysetup-provider-combo-box.h"
#include "maemo/easysetup/modest-easysetup-servertype-combo-box.h"
-#include "widgets/modest-easysetup-serversecurity-combo-box.h"
-#include "widgets/modest-easysetup-secureauth-combo-box.h"
+#include "widgets/modest-serversecurity-combo-box.h"
+#include "widgets/modest-secureauth-combo-box.h"
#include "widgets/modest-validating-entry.h"
#include <modest-account-mgr-helpers.h>
#include <gtk/gtkbutton.h>
CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
const gint port_number =
- easysetup_serversecurity_combo_box_get_active_serversecurity_port (
- EASYSETUP_SERVERSECURITY_COMBO_BOX (priv->combo_outgoing_security));
+ modest_serversecurity_combo_box_get_active_serversecurity_port (
+ MODEST_SERVERSECURITY_COMBO_BOX (priv->combo_outgoing_security));
if(port_number != 0) {
gchar* str = g_strdup_printf ("%d", port_number);
/* The secure authentication widgets: */
if (!priv->combo_outgoing_auth)
- priv->combo_outgoing_auth = GTK_WIDGET (easysetup_secureauth_combo_box_new ());
+ 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);
gtk_widget_show (priv->combo_outgoing_auth);
/* The secure connection widgets: */
if (!priv->combo_outgoing_security)
- priv->combo_outgoing_security = GTK_WIDGET (easysetup_serversecurity_combo_box_new ());
- easysetup_serversecurity_combo_box_fill (
- EASYSETUP_SERVERSECURITY_COMBO_BOX (priv->combo_outgoing_security), MODEST_PROTOCOL_TRANSPORT_SMTP);
- easysetup_serversecurity_combo_box_set_active_serversecurity (
- EASYSETUP_SERVERSECURITY_COMBO_BOX (priv->combo_outgoing_security), MODEST_PROTOCOL_SECURITY_NONE);
+ priv->combo_outgoing_security = GTK_WIDGET (modest_serversecurity_combo_box_new ());
+ modest_serversecurity_combo_box_fill (
+ MODEST_SERVERSECURITY_COMBO_BOX (priv->combo_outgoing_security), MODEST_PROTOCOL_TRANSPORT_SMTP);
+ modest_serversecurity_combo_box_set_active_serversecurity (
+ MODEST_SERVERSECURITY_COMBO_BOX (priv->combo_outgoing_security), MODEST_PROTOCOL_SECURITY_NONE);
caption = hildon_caption_new (sizegroup, _("mcen_li_emailsetup_secure_connection"),
priv->combo_outgoing_security, NULL, HILDON_CAPTION_OPTIONAL);
gtk_widget_show (priv->combo_outgoing_security);
gtk_entry_set_text (GTK_ENTRY (priv->entry_user_username), data->username);
gtk_entry_set_text (GTK_ENTRY (priv->entry_user_password), data->password);
- easysetup_serversecurity_combo_box_set_active_serversecurity (
- EASYSETUP_SERVERSECURITY_COMBO_BOX (priv->combo_outgoing_security), data->security);
+ modest_serversecurity_combo_box_set_active_serversecurity (
+ MODEST_SERVERSECURITY_COMBO_BOX (priv->combo_outgoing_security), data->security);
- easysetup_secureauth_combo_box_set_active_secureauth (
- EASYSETUP_SECUREAUTH_COMBO_BOX (priv->combo_outgoing_auth), data->secure_auth);
+ modest_secureauth_combo_box_set_active_secureauth (
+ MODEST_SECUREAUTH_COMBO_BOX (priv->combo_outgoing_auth), data->secure_auth);
/* port: */
gchar * port_str = g_strdup_printf ("%d", data->port);
result->username = g_strdup (gtk_entry_get_text (GTK_ENTRY (priv->entry_user_username)));
result->password = g_strdup (gtk_entry_get_text (GTK_ENTRY (priv->entry_user_password)));
- result->security = easysetup_serversecurity_combo_box_get_active_serversecurity (
- EASYSETUP_SERVERSECURITY_COMBO_BOX (priv->combo_outgoing_security));
+ result->security = modest_serversecurity_combo_box_get_active_serversecurity (
+ MODEST_SERVERSECURITY_COMBO_BOX (priv->combo_outgoing_security));
- result->secure_auth = easysetup_secureauth_combo_box_get_active_secureauth (
- EASYSETUP_SECUREAUTH_COMBO_BOX (priv->combo_outgoing_auth));
+ result->secure_auth = modest_secureauth_combo_box_get_active_secureauth (
+ MODEST_SECUREAUTH_COMBO_BOX (priv->combo_outgoing_auth));
/* port: */
const gchar * port_str = gtk_entry_get_text (GTK_ENTRY (priv->entry_port));
modest-retrieve-combo-box.c \
modest-scroll-text.c \
modest-scroll-text.h \
- modest-easysetup-serversecurity-combo-box.h modest-easysetup-serversecurity-combo-box.c \
- modest-easysetup-secureauth-combo-box.h modest-easysetup-secureauth-combo-box.c \
+ modest-serversecurity-combo-box.h modest-serversecurity-combo-box.c \
+ modest-secureauth-combo-box.h modest-secureauth-combo-box.c \
modest-tny-stream-gtkhtml.c \
modest-tny-stream-gtkhtml.h \
modest-validating-entry.h modest-validating-entry.c \
+++ /dev/null
-/* Copyright (c) 2007, Nokia Corporation
- * All rights reserved.
- *
- */
-
-#include "modest-easysetup-secureauth-combo-box.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 (EasysetupSecureauthComboBox, easysetup_secureauth_combo_box, GTK_TYPE_COMBO_BOX);
-
-#define SECUREAUTH_COMBO_BOX_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), EASYSETUP_TYPE_SECUREAUTH_COMBO_BOX, EasysetupSecureauthComboBoxPrivate))
-
-typedef struct _EasysetupSecureauthComboBoxPrivate EasysetupSecureauthComboBoxPrivate;
-
-struct _EasysetupSecureauthComboBoxPrivate
-{
- GtkTreeModel *model;
-};
-
-static void
-easysetup_secureauth_combo_box_get_property (GObject *object, guint property_id,
- GValue *value, GParamSpec *pspec)
-{
- switch (property_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- }
-}
-
-static void
-easysetup_secureauth_combo_box_set_property (GObject *object, guint property_id,
- const GValue *value, GParamSpec *pspec)
-{
- switch (property_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- }
-}
-
-static void
-easysetup_secureauth_combo_box_dispose (GObject *object)
-{
- if (G_OBJECT_CLASS (easysetup_secureauth_combo_box_parent_class)->dispose)
- G_OBJECT_CLASS (easysetup_secureauth_combo_box_parent_class)->dispose (object);
-}
-
-static void
-easysetup_secureauth_combo_box_finalize (GObject *object)
-{
- EasysetupSecureauthComboBoxPrivate *priv = SECUREAUTH_COMBO_BOX_GET_PRIVATE (object);
-
- g_object_unref (G_OBJECT (priv->model));
-
- G_OBJECT_CLASS (easysetup_secureauth_combo_box_parent_class)->finalize (object);
-}
-
-static void
-easysetup_secureauth_combo_box_class_init (EasysetupSecureauthComboBoxClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- g_type_class_add_private (klass, sizeof (EasysetupSecureauthComboBoxPrivate));
-
- object_class->get_property = easysetup_secureauth_combo_box_get_property;
- object_class->set_property = easysetup_secureauth_combo_box_set_property;
- object_class->dispose = easysetup_secureauth_combo_box_dispose;
- object_class->finalize = easysetup_secureauth_combo_box_finalize;
-}
-
-enum MODEL_COLS {
- MODEL_COL_NAME = 0, /* a string */
- MODEL_COL_ID = 1 /* an int. */
-};
-
-void easysetup_secureauth_combo_box_fill (EasysetupSecureauthComboBox *combobox);
-
-static void
-easysetup_secureauth_combo_box_init (EasysetupSecureauthComboBox *self)
-{
- EasysetupSecureauthComboBoxPrivate *priv = SECUREAUTH_COMBO_BOX_GET_PRIVATE (self);
-
- /* Create a tree model for the combo box,
- * with a string for the name, and an ID for the secureauth.
- * This must match our MODEL_COLS enum constants.
- */
- priv->model = GTK_TREE_MODEL (gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT));
-
- /* Setup the combo box: */
- GtkComboBox *combobox = GTK_COMBO_BOX (self);
- gtk_combo_box_set_model (combobox, priv->model);
-
- /* Secureauth column:
- * The ID model column in not shown in the view. */
- GtkCellRenderer *renderer = gtk_cell_renderer_text_new ();
- gtk_cell_layout_pack_start(GTK_CELL_LAYOUT (combobox), renderer, TRUE);
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer,
- "text", MODEL_COL_NAME, NULL);
-
- easysetup_secureauth_combo_box_fill (self);
-}
-
-EasysetupSecureauthComboBox*
-easysetup_secureauth_combo_box_new (void)
-{
- return g_object_new (EASYSETUP_TYPE_SECUREAUTH_COMBO_BOX, NULL);
-}
-
-/* Fill the combo box with appropriate choices.
- * #combobox: The combo box.
- * @protocol: IMAP or POP.
- */
-void easysetup_secureauth_combo_box_fill (EasysetupSecureauthComboBox *combobox)
-{
- EasysetupSecureauthComboBoxPrivate *priv = SECUREAUTH_COMBO_BOX_GET_PRIVATE (combobox);
-
- /* Remove any existing rows: */
- GtkListStore *liststore = GTK_LIST_STORE (priv->model);
- gtk_list_store_clear (liststore);
-
- GtkTreeIter iter;
- gtk_list_store_append (liststore, &iter);
- gtk_list_store_set (liststore, &iter, MODEL_COL_ID, (gint)MODEST_PROTOCOL_AUTH_NONE, MODEL_COL_NAME, _("mcen_fi_advsetup_smtp_none"), -1);
-
- /* Select the None item: */
- gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox), &iter);
-
- gtk_list_store_append (liststore, &iter);
- gtk_list_store_set (liststore, &iter, MODEL_COL_ID, (gint)MODEST_PROTOCOL_AUTH_PASSWORD, MODEL_COL_NAME, _("mcen_fi_advsetup_smtp_login"), -1);
-
- gtk_list_store_append (liststore, &iter);
- gtk_list_store_set (liststore, &iter, MODEL_COL_ID, (gint)MODEST_PROTOCOL_AUTH_CRAMMD5, MODEL_COL_NAME, _("mcen_fi_advsetup_smtp_cram_md5"), -1);
-}
-
-/**
- * Returns the selected secureauth,
- * or MODEST_PROTOCOL_UNKNOWN if no secureauth was selected.
- */
-ModestProtocol
-easysetup_secureauth_combo_box_get_active_secureauth (EasysetupSecureauthComboBox *combobox)
-{
- GtkTreeIter active;
- const gboolean found = gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combobox), &active);
- if (found) {
- EasysetupSecureauthComboBoxPrivate *priv = SECUREAUTH_COMBO_BOX_GET_PRIVATE (combobox);
-
- ModestProtocol secureauth = MODEST_PROTOCOL_UNKNOWN;
- gtk_tree_model_get (priv->model, &active, MODEL_COL_ID, &secureauth, -1);
- return secureauth;
- }
-
- return MODEST_PROTOCOL_UNKNOWN; /* Failed. */
-}
-
-/* This allows us to pass more than one piece of data to the signal handler,
- * and get a result: */
-typedef struct
-{
- EasysetupSecureauthComboBox* self;
- gint id;
- gboolean found;
-} ForEachData;
-
-static gboolean
-on_model_foreach_select_id(GtkTreeModel *model,
- GtkTreePath *path, GtkTreeIter *iter, gpointer user_data)
-{
- ForEachData *state = (ForEachData*)(user_data);
-
- /* Select the item if it has the matching ID: */
- guint id = 0;
- gtk_tree_model_get (model, iter, MODEL_COL_ID, &id, -1);
- if(id == state->id) {
- gtk_combo_box_set_active_iter (GTK_COMBO_BOX (state->self), iter);
-
- state->found = TRUE;
- return TRUE; /* Stop walking the tree. */
- }
-
- return FALSE; /* Keep walking the tree. */
-}
-
-/**
- * Selects the specified secureauth,
- * or MODEST_PROTOCOL_UNKNOWN if no secureauth was selected.
- */
-gboolean
-easysetup_secureauth_combo_box_set_active_secureauth (EasysetupSecureauthComboBox *combobox, ModestProtocol secureauth)
-{
- EasysetupSecureauthComboBoxPrivate *priv = SECUREAUTH_COMBO_BOX_GET_PRIVATE (combobox);
-
- /* Create a state instance so we can send two items of data to the signal handler: */
- ForEachData *state = g_new0 (ForEachData, 1);
- state->self = combobox;
- 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);
-
- const gboolean result = state->found;
-
- /* Free the state instance: */
- g_free(state);
-
- return result;
-}
-
+++ /dev/null
-/* Copyright (c) 2007, Nokia Corporation
- * All rights reserved.
- *
- */
-
-#ifndef _EASYSETUP_SECUREAUTH_COMBO_BOX
-#define _EASYSETUP_SECUREAUTH_COMBO_BOX
-
-#include <gtk/gtkcombobox.h>
-#include "modest-protocol-info.h"
-
-G_BEGIN_DECLS
-
-#define EASYSETUP_TYPE_SECUREAUTH_COMBO_BOX easysetup_secureauth_combo_box_get_type()
-
-#define EASYSETUP_SECUREAUTH_COMBO_BOX(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- EASYSETUP_TYPE_SECUREAUTH_COMBO_BOX, EasysetupSecureauthComboBox))
-
-#define EASYSETUP_SECUREAUTH_COMBO_BOX_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- EASYSETUP_TYPE_SECUREAUTH_COMBO_BOX, EasysetupSecureauthComboBoxClass))
-
-#define EASYSETUP_IS_SECUREAUTH_COMBO_BOX(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- EASYSETUP_TYPE_SECUREAUTH_COMBO_BOX))
-
-#define EASYSETUP_IS_SECUREAUTH_COMBO_BOX_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- EASYSETUP_TYPE_SECUREAUTH_COMBO_BOX))
-
-#define EASYSETUP_SECUREAUTH_COMBO_BOX_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- EASYSETUP_TYPE_SECUREAUTH_COMBO_BOX, EasysetupSecureauthComboBoxClass))
-
-typedef struct {
- GtkComboBox parent;
-} EasysetupSecureauthComboBox;
-
-typedef struct {
- GtkComboBoxClass parent_class;
-} EasysetupSecureauthComboBoxClass;
-
-GType easysetup_secureauth_combo_box_get_type (void);
-
-EasysetupSecureauthComboBox* easysetup_secureauth_combo_box_new (void);
-
-ModestProtocol easysetup_secureauth_combo_box_get_active_secureauth (EasysetupSecureauthComboBox *combobox);
-
-gboolean easysetup_secureauth_combo_box_set_active_secureauth (EasysetupSecureauthComboBox *combobox, ModestProtocol secureauth);
-
-
-G_END_DECLS
-
-#endif /* _EASYSETUP_PROVIDER_COMBO_BOX */
+++ /dev/null
-/* Copyright (c) 2007, Nokia Corporation
- * All rights reserved.
- *
- */
-
-#include "modest-easysetup-serversecurity-combo-box.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 (EasysetupServersecurityComboBox, easysetup_serversecurity_combo_box, GTK_TYPE_COMBO_BOX);
-
-#define SERVERSECURITY_COMBO_BOX_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), EASYSETUP_TYPE_SERVERSECURITY_COMBO_BOX, EasysetupServersecurityComboBoxPrivate))
-
-typedef struct _EasysetupServersecurityComboBoxPrivate EasysetupServersecurityComboBoxPrivate;
-
-struct _EasysetupServersecurityComboBoxPrivate
-{
- GtkTreeModel *model;
- ModestProtocol protocol;
-};
-
-static void
-easysetup_serversecurity_combo_box_get_property (GObject *object, guint property_id,
- GValue *value, GParamSpec *pspec)
-{
- switch (property_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- }
-}
-
-static void
-easysetup_serversecurity_combo_box_set_property (GObject *object, guint property_id,
- const GValue *value, GParamSpec *pspec)
-{
- switch (property_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- }
-}
-
-static void
-easysetup_serversecurity_combo_box_dispose (GObject *object)
-{
- if (G_OBJECT_CLASS (easysetup_serversecurity_combo_box_parent_class)->dispose)
- G_OBJECT_CLASS (easysetup_serversecurity_combo_box_parent_class)->dispose (object);
-}
-
-static void
-easysetup_serversecurity_combo_box_finalize (GObject *object)
-{
- EasysetupServersecurityComboBoxPrivate *priv = SERVERSECURITY_COMBO_BOX_GET_PRIVATE (object);
-
- g_object_unref (G_OBJECT (priv->model));
-
- G_OBJECT_CLASS (easysetup_serversecurity_combo_box_parent_class)->finalize (object);
-}
-
-static void
-easysetup_serversecurity_combo_box_class_init (EasysetupServersecurityComboBoxClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- g_type_class_add_private (klass, sizeof (EasysetupServersecurityComboBoxPrivate));
-
- object_class->get_property = easysetup_serversecurity_combo_box_get_property;
- object_class->set_property = easysetup_serversecurity_combo_box_set_property;
- object_class->dispose = easysetup_serversecurity_combo_box_dispose;
- object_class->finalize = easysetup_serversecurity_combo_box_finalize;
-}
-
-enum MODEL_COLS {
- MODEL_COL_NAME = 0, /* a string */
- MODEL_COL_ID = 1 /* an int. */
-};
-
-static void
-easysetup_serversecurity_combo_box_init (EasysetupServersecurityComboBox *self)
-{
- EasysetupServersecurityComboBoxPrivate *priv = SERVERSECURITY_COMBO_BOX_GET_PRIVATE (self);
-
- /* Create a tree model for the combo box,
- * with a string for the name, and an ID for the serversecurity.
- * This must match our MODEL_COLS enum constants.
- */
- priv->model = GTK_TREE_MODEL (gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT));
-
- /* Setup the combo box: */
- GtkComboBox *combobox = GTK_COMBO_BOX (self);
- gtk_combo_box_set_model (combobox, priv->model);
-
- /* Serversecurity column:
- * The ID model column in not shown in the view. */
- GtkCellRenderer *renderer = gtk_cell_renderer_text_new ();
- gtk_cell_layout_pack_start(GTK_CELL_LAYOUT (combobox), renderer, TRUE);
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer,
- "text", MODEL_COL_NAME, NULL);
-
- /* The application must call easysetup_serversecurity_combo_box_fill().
- */
-}
-
-EasysetupServersecurityComboBox*
-easysetup_serversecurity_combo_box_new (void)
-{
- return g_object_new (EASYSETUP_TYPE_SERVERSECURITY_COMBO_BOX, NULL);
-}
-
-/* Fill the combo box with appropriate choices.
- * #combobox: The combo box.
- * @protocol: IMAP or POP.
- */
-void easysetup_serversecurity_combo_box_fill (EasysetupServersecurityComboBox *combobox, ModestProtocol protocol)
-{
- EasysetupServersecurityComboBoxPrivate *priv = SERVERSECURITY_COMBO_BOX_GET_PRIVATE (combobox);
- priv->protocol = protocol; /* Remembered for later. */
-
- /* Remove any existing rows: */
- GtkListStore *liststore = GTK_LIST_STORE (priv->model);
- gtk_list_store_clear (liststore);
-
- GtkTreeIter iter;
- gtk_list_store_append (liststore, &iter);
- gtk_list_store_set (liststore, &iter, MODEL_COL_ID, (gint)MODEST_PROTOCOL_SECURITY_NONE, MODEL_COL_NAME, _("mcen_fi_advsetup_other_security_none"), -1);
-
- /* Select the None item: */
- gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox), &iter);
-
- gtk_list_store_append (liststore, &iter);
- gtk_list_store_set (liststore, &iter, MODEL_COL_ID, (gint)MODEST_PROTOCOL_SECURITY_TLS, MODEL_COL_NAME, _("mcen_fi_advsetup_other_security_normal"), -1);
-
- /* Add security choices with protocol-specific names, as in the UI spec:
- * (Note: Changing the title seems pointless. murrayc) */
- if(protocol == MODEST_PROTOCOL_STORE_POP) {
- gtk_list_store_append (liststore, &iter);
- gtk_list_store_set (liststore, &iter, MODEL_COL_ID, (gint)MODEST_PROTOCOL_SECURITY_SSL, MODEL_COL_NAME, _("mcen_fi_advsetup_other_security_securepop3s"), -1);
- } else if(protocol == MODEST_PROTOCOL_STORE_IMAP) {
- gtk_list_store_append (liststore, &iter);
- gtk_list_store_set (liststore, &iter, MODEL_COL_ID, (gint)MODEST_PROTOCOL_SECURITY_SSL, MODEL_COL_NAME, _("mcen_fi_advsetup_other_security_secureimap4"), -1);
- } else if(protocol == MODEST_PROTOCOL_TRANSPORT_SMTP) {
- gtk_list_store_append (liststore, &iter);
- gtk_list_store_set (liststore, &iter, MODEL_COL_ID, (gint)MODEST_PROTOCOL_SECURITY_SSL, MODEL_COL_NAME, _("mcen_fi_advsetup_other_security_ssl"), -1);
- }
-}
-
-static gint get_port_for_security (ModestProtocol protocol, ModestProtocol security)
-{
- /* See the UI spec, section Email Wizards, Incoming Details [MSG-WIZ001]: */
- gint result = 0;
-
- /* Get the default port number for this protocol with this security: */
- if(protocol == MODEST_PROTOCOL_STORE_POP) {
- if ((security == MODEST_PROTOCOL_SECURITY_NONE) || (security == MODEST_PROTOCOL_SECURITY_TLS))
- result = 110;
- else if (security == MODEST_PROTOCOL_SECURITY_SSL)
- result = 995;
- } else if (protocol == MODEST_PROTOCOL_STORE_IMAP) {
- if ((security == MODEST_PROTOCOL_SECURITY_NONE) || (security == MODEST_PROTOCOL_SECURITY_TLS))
- result = 143;
- else if (security == MODEST_PROTOCOL_SECURITY_SSL)
- result = 993;
- } else if (protocol == MODEST_PROTOCOL_TRANSPORT_SMTP) {
- if ((security == MODEST_PROTOCOL_SECURITY_NONE) || (security == MODEST_PROTOCOL_SECURITY_TLS))
- result = 25;
- else if (security == MODEST_PROTOCOL_SECURITY_SSL)
- result = 465;
- }
-
- return result;
-}
-
-/**
- * Returns the selected serversecurity,
- * or MODEST_PROTOCOL_UNKNOWN if no serversecurity was selected.
- */
-ModestProtocol
-easysetup_serversecurity_combo_box_get_active_serversecurity (EasysetupServersecurityComboBox *combobox)
-{
- GtkTreeIter active;
- const gboolean found = gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combobox), &active);
- if (found) {
- EasysetupServersecurityComboBoxPrivate *priv = SERVERSECURITY_COMBO_BOX_GET_PRIVATE (combobox);
-
- ModestProtocol serversecurity = MODEST_PROTOCOL_UNKNOWN;
- gtk_tree_model_get (priv->model, &active, MODEL_COL_ID, &serversecurity, -1);
- return serversecurity;
- }
-
- return MODEST_PROTOCOL_UNKNOWN; /* Failed. */
-}
-
-/**
- * Returns the default port to be used for the selected serversecurity,
- * or 0 if no serversecurity was selected.
- */
-gint
-easysetup_serversecurity_combo_box_get_active_serversecurity_port (EasysetupServersecurityComboBox *combobox)
-{
- EasysetupServersecurityComboBoxPrivate *priv = SERVERSECURITY_COMBO_BOX_GET_PRIVATE (combobox);
-
- const ModestProtocol security = easysetup_serversecurity_combo_box_get_active_serversecurity
- (combobox);
- return get_port_for_security (priv->protocol, security);
-}
-
-/* This allows us to pass more than one piece of data to the signal handler,
- * and get a result: */
-typedef struct
-{
- EasysetupServersecurityComboBox* self;
- gint id;
- gboolean found;
-} ForEachData;
-
-static gboolean
-on_model_foreach_select_id(GtkTreeModel *model,
- GtkTreePath *path, GtkTreeIter *iter, gpointer user_data)
-{
- ForEachData *state = (ForEachData*)(user_data);
-
- /* Select the item if it has the matching ID: */
- guint id = 0;
- gtk_tree_model_get (model, iter, MODEL_COL_ID, &id, -1);
- if(id == state->id) {
- gtk_combo_box_set_active_iter (GTK_COMBO_BOX (state->self), iter);
-
- state->found = TRUE;
- return TRUE; /* Stop walking the tree. */
- }
-
- return FALSE; /* Keep walking the tree. */
-}
-
-/**
- * Selects the specified serversecurity,
- * or MODEST_PROTOCOL_UNKNOWN if no serversecurity was selected.
- */
-gboolean
-easysetup_serversecurity_combo_box_set_active_serversecurity (EasysetupServersecurityComboBox *combobox, ModestProtocol serversecurity)
-{
- EasysetupServersecurityComboBoxPrivate *priv = SERVERSECURITY_COMBO_BOX_GET_PRIVATE (combobox);
-
- /* Create a state instance so we can send two items of data to the signal handler: */
- ForEachData *state = g_new0 (ForEachData, 1);
- state->self = combobox;
- state->id = serversecurity;
- 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);
-
- const gboolean result = state->found;
-
- /* Free the state instance: */
- g_free(state);
-
- return result;
-}
-
+++ /dev/null
-/* Copyright (c) 2007, Nokia Corporation
- * All rights reserved.
- *
- */
-
-#ifndef _EASYSETUP_SERVERSECURITY_COMBO_BOX
-#define _EASYSETUP_SERVERSECURITY_COMBO_BOX
-
-#include <gtk/gtkcombobox.h>
-#include "modest-protocol-info.h"
-
-G_BEGIN_DECLS
-
-#define EASYSETUP_TYPE_SERVERSECURITY_COMBO_BOX easysetup_serversecurity_combo_box_get_type()
-
-#define EASYSETUP_SERVERSECURITY_COMBO_BOX(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- EASYSETUP_TYPE_SERVERSECURITY_COMBO_BOX, EasysetupServersecurityComboBox))
-
-#define EASYSETUP_SERVERSECURITY_COMBO_BOX_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- EASYSETUP_TYPE_SERVERSECURITY_COMBO_BOX, EasysetupServersecurityComboBoxClass))
-
-#define EASYSETUP_IS_SERVERSECURITY_COMBO_BOX(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- EASYSETUP_TYPE_SERVERSECURITY_COMBO_BOX))
-
-#define EASYSETUP_IS_SERVERSECURITY_COMBO_BOX_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- EASYSETUP_TYPE_SERVERSECURITY_COMBO_BOX))
-
-#define EASYSETUP_SERVERSECURITY_COMBO_BOX_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- EASYSETUP_TYPE_SERVERSECURITY_COMBO_BOX, EasysetupServersecurityComboBoxClass))
-
-typedef struct {
- GtkComboBox parent;
-} EasysetupServersecurityComboBox;
-
-typedef struct {
- GtkComboBoxClass parent_class;
-} EasysetupServersecurityComboBoxClass;
-
-GType easysetup_serversecurity_combo_box_get_type (void);
-
-EasysetupServersecurityComboBox* easysetup_serversecurity_combo_box_new (void);
-
-void easysetup_serversecurity_combo_box_fill (EasysetupServersecurityComboBox *combobox, ModestProtocol protocol);
-
-ModestProtocol easysetup_serversecurity_combo_box_get_active_serversecurity (EasysetupServersecurityComboBox *combobox);
-
-gboolean easysetup_serversecurity_combo_box_set_active_serversecurity (EasysetupServersecurityComboBox *combobox, ModestProtocol serversecurity);
-
-gint easysetup_serversecurity_combo_box_get_active_serversecurity_port (EasysetupServersecurityComboBox *combobox);
-
-
-G_END_DECLS
-
-#endif /* _EASYSETUP_PROVIDER_COMBO_BOX */
--- /dev/null
+/* Copyright (c) 2007, Nokia Corporation
+ * All rights reserved.
+ *
+ */
+
+#include "modest-secureauth-combo-box.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 (ModestSecureauthComboBox, modest_secureauth_combo_box, GTK_TYPE_COMBO_BOX);
+
+#define SECUREAUTH_COMBO_BOX_GET_PRIVATE(o) \
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), MODEST_TYPE_SECUREAUTH_COMBO_BOX, ModestSecureauthComboBoxPrivate))
+
+typedef struct _ModestSecureauthComboBoxPrivate ModestSecureauthComboBoxPrivate;
+
+struct _ModestSecureauthComboBoxPrivate
+{
+ GtkTreeModel *model;
+};
+
+static void
+modest_secureauth_combo_box_get_property (GObject *object, guint property_id,
+ GValue *value, GParamSpec *pspec)
+{
+ switch (property_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+modest_secureauth_combo_box_set_property (GObject *object, guint property_id,
+ const GValue *value, GParamSpec *pspec)
+{
+ switch (property_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+modest_secureauth_combo_box_dispose (GObject *object)
+{
+ if (G_OBJECT_CLASS (modest_secureauth_combo_box_parent_class)->dispose)
+ G_OBJECT_CLASS (modest_secureauth_combo_box_parent_class)->dispose (object);
+}
+
+static void
+modest_secureauth_combo_box_finalize (GObject *object)
+{
+ ModestSecureauthComboBoxPrivate *priv = SECUREAUTH_COMBO_BOX_GET_PRIVATE (object);
+
+ g_object_unref (G_OBJECT (priv->model));
+
+ G_OBJECT_CLASS (modest_secureauth_combo_box_parent_class)->finalize (object);
+}
+
+static void
+modest_secureauth_combo_box_class_init (ModestSecureauthComboBoxClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (ModestSecureauthComboBoxPrivate));
+
+ object_class->get_property = modest_secureauth_combo_box_get_property;
+ object_class->set_property = modest_secureauth_combo_box_set_property;
+ object_class->dispose = modest_secureauth_combo_box_dispose;
+ object_class->finalize = modest_secureauth_combo_box_finalize;
+}
+
+enum MODEL_COLS {
+ MODEL_COL_NAME = 0, /* a string */
+ MODEL_COL_ID = 1 /* an int. */
+};
+
+void modest_secureauth_combo_box_fill (ModestSecureauthComboBox *combobox);
+
+static void
+modest_secureauth_combo_box_init (ModestSecureauthComboBox *self)
+{
+ ModestSecureauthComboBoxPrivate *priv = SECUREAUTH_COMBO_BOX_GET_PRIVATE (self);
+
+ /* Create a tree model for the combo box,
+ * with a string for the name, and an ID for the secureauth.
+ * This must match our MODEL_COLS enum constants.
+ */
+ priv->model = GTK_TREE_MODEL (gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT));
+
+ /* Setup the combo box: */
+ GtkComboBox *combobox = GTK_COMBO_BOX (self);
+ gtk_combo_box_set_model (combobox, priv->model);
+
+ /* Secureauth column:
+ * The ID model column in not shown in the view. */
+ GtkCellRenderer *renderer = gtk_cell_renderer_text_new ();
+ gtk_cell_layout_pack_start(GTK_CELL_LAYOUT (combobox), renderer, TRUE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer,
+ "text", MODEL_COL_NAME, NULL);
+
+ modest_secureauth_combo_box_fill (self);
+}
+
+ModestSecureauthComboBox*
+modest_secureauth_combo_box_new (void)
+{
+ return g_object_new (MODEST_TYPE_SECUREAUTH_COMBO_BOX, NULL);
+}
+
+/* Fill the combo box with appropriate choices.
+ * #combobox: The combo box.
+ * @protocol: IMAP or POP.
+ */
+void modest_secureauth_combo_box_fill (ModestSecureauthComboBox *combobox)
+{
+ ModestSecureauthComboBoxPrivate *priv = SECUREAUTH_COMBO_BOX_GET_PRIVATE (combobox);
+
+ /* Remove any existing rows: */
+ GtkListStore *liststore = GTK_LIST_STORE (priv->model);
+ gtk_list_store_clear (liststore);
+
+ GtkTreeIter iter;
+ gtk_list_store_append (liststore, &iter);
+ gtk_list_store_set (liststore, &iter, MODEL_COL_ID, (gint)MODEST_PROTOCOL_AUTH_NONE, MODEL_COL_NAME, _("mcen_fi_advsetup_smtp_none"), -1);
+
+ /* Select the None item: */
+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox), &iter);
+
+ gtk_list_store_append (liststore, &iter);
+ gtk_list_store_set (liststore, &iter, MODEL_COL_ID, (gint)MODEST_PROTOCOL_AUTH_PASSWORD, MODEL_COL_NAME, _("mcen_fi_advsetup_smtp_login"), -1);
+
+ gtk_list_store_append (liststore, &iter);
+ gtk_list_store_set (liststore, &iter, MODEL_COL_ID, (gint)MODEST_PROTOCOL_AUTH_CRAMMD5, MODEL_COL_NAME, _("mcen_fi_advsetup_smtp_cram_md5"), -1);
+}
+
+/**
+ * Returns the selected secureauth,
+ * or MODEST_PROTOCOL_UNKNOWN if no secureauth was selected.
+ */
+ModestProtocol
+modest_secureauth_combo_box_get_active_secureauth (ModestSecureauthComboBox *combobox)
+{
+ GtkTreeIter active;
+ const gboolean found = gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combobox), &active);
+ if (found) {
+ ModestSecureauthComboBoxPrivate *priv = SECUREAUTH_COMBO_BOX_GET_PRIVATE (combobox);
+
+ ModestProtocol secureauth = MODEST_PROTOCOL_UNKNOWN;
+ gtk_tree_model_get (priv->model, &active, MODEL_COL_ID, &secureauth, -1);
+ return secureauth;
+ }
+
+ return MODEST_PROTOCOL_UNKNOWN; /* Failed. */
+}
+
+/* This allows us to pass more than one piece of data to the signal handler,
+ * and get a result: */
+typedef struct
+{
+ ModestSecureauthComboBox* self;
+ gint id;
+ gboolean found;
+} ForEachData;
+
+static gboolean
+on_model_foreach_select_id(GtkTreeModel *model,
+ GtkTreePath *path, GtkTreeIter *iter, gpointer user_data)
+{
+ ForEachData *state = (ForEachData*)(user_data);
+
+ /* Select the item if it has the matching ID: */
+ guint id = 0;
+ gtk_tree_model_get (model, iter, MODEL_COL_ID, &id, -1);
+ if(id == state->id) {
+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX (state->self), iter);
+
+ state->found = TRUE;
+ return TRUE; /* Stop walking the tree. */
+ }
+
+ return FALSE; /* Keep walking the tree. */
+}
+
+/**
+ * Selects the specified secureauth,
+ * or MODEST_PROTOCOL_UNKNOWN if no secureauth was selected.
+ */
+gboolean
+modest_secureauth_combo_box_set_active_secureauth (ModestSecureauthComboBox *combobox, ModestProtocol secureauth)
+{
+ ModestSecureauthComboBoxPrivate *priv = SECUREAUTH_COMBO_BOX_GET_PRIVATE (combobox);
+
+ /* Create a state instance so we can send two items of data to the signal handler: */
+ ForEachData *state = g_new0 (ForEachData, 1);
+ state->self = combobox;
+ 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);
+
+ const gboolean result = state->found;
+
+ /* Free the state instance: */
+ g_free(state);
+
+ return result;
+}
+
--- /dev/null
+/* Copyright (c) 2007, Nokia Corporation
+ * All rights reserved.
+ *
+ */
+
+#ifndef _MODEST_SECUREAUTH_COMBO_BOX
+#define _MODEST_SECUREAUTH_COMBO_BOX
+
+#include <gtk/gtkcombobox.h>
+#include "modest-protocol-info.h"
+
+G_BEGIN_DECLS
+
+#define MODEST_TYPE_SECUREAUTH_COMBO_BOX modest_secureauth_combo_box_get_type()
+
+#define MODEST_SECUREAUTH_COMBO_BOX(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ MODEST_TYPE_SECUREAUTH_COMBO_BOX, ModestSecureauthComboBox))
+
+#define MODEST_SECUREAUTH_COMBO_BOX_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ MODEST_TYPE_SECUREAUTH_COMBO_BOX, ModestSecureauthComboBoxClass))
+
+#define EASYSETUP_IS_SECUREAUTH_COMBO_BOX(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ MODEST_TYPE_SECUREAUTH_COMBO_BOX))
+
+#define EASYSETUP_IS_SECUREAUTH_COMBO_BOX_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ MODEST_TYPE_SECUREAUTH_COMBO_BOX))
+
+#define MODEST_SECUREAUTH_COMBO_BOX_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ MODEST_TYPE_SECUREAUTH_COMBO_BOX, ModestSecureauthComboBoxClass))
+
+typedef struct {
+ GtkComboBox parent;
+} ModestSecureauthComboBox;
+
+typedef struct {
+ GtkComboBoxClass parent_class;
+} ModestSecureauthComboBoxClass;
+
+GType modest_secureauth_combo_box_get_type (void);
+
+ModestSecureauthComboBox* modest_secureauth_combo_box_new (void);
+
+ModestProtocol modest_secureauth_combo_box_get_active_secureauth (ModestSecureauthComboBox *combobox);
+
+gboolean modest_secureauth_combo_box_set_active_secureauth (ModestSecureauthComboBox *combobox, ModestProtocol secureauth);
+
+
+G_END_DECLS
+
+#endif /* _EASYSETUP_PROVIDER_COMBO_BOX */
--- /dev/null
+/* Copyright (c) 2007, Nokia Corporation
+ * All rights reserved.
+ *
+ */
+
+#include "modest-serversecurity-combo-box.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 (ModestServersecurityComboBox, modest_serversecurity_combo_box, GTK_TYPE_COMBO_BOX);
+
+#define SERVERSECURITY_COMBO_BOX_GET_PRIVATE(o) \
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), MODEST_TYPE_SERVERSECURITY_COMBO_BOX, ModestServersecurityComboBoxPrivate))
+
+typedef struct _ModestServersecurityComboBoxPrivate ModestServersecurityComboBoxPrivate;
+
+struct _ModestServersecurityComboBoxPrivate
+{
+ GtkTreeModel *model;
+ ModestProtocol protocol;
+};
+
+static void
+modest_serversecurity_combo_box_get_property (GObject *object, guint property_id,
+ GValue *value, GParamSpec *pspec)
+{
+ switch (property_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+modest_serversecurity_combo_box_set_property (GObject *object, guint property_id,
+ const GValue *value, GParamSpec *pspec)
+{
+ switch (property_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+modest_serversecurity_combo_box_dispose (GObject *object)
+{
+ if (G_OBJECT_CLASS (modest_serversecurity_combo_box_parent_class)->dispose)
+ G_OBJECT_CLASS (modest_serversecurity_combo_box_parent_class)->dispose (object);
+}
+
+static void
+modest_serversecurity_combo_box_finalize (GObject *object)
+{
+ ModestServersecurityComboBoxPrivate *priv = SERVERSECURITY_COMBO_BOX_GET_PRIVATE (object);
+
+ g_object_unref (G_OBJECT (priv->model));
+
+ G_OBJECT_CLASS (modest_serversecurity_combo_box_parent_class)->finalize (object);
+}
+
+static void
+modest_serversecurity_combo_box_class_init (ModestServersecurityComboBoxClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (ModestServersecurityComboBoxPrivate));
+
+ object_class->get_property = modest_serversecurity_combo_box_get_property;
+ object_class->set_property = modest_serversecurity_combo_box_set_property;
+ object_class->dispose = modest_serversecurity_combo_box_dispose;
+ object_class->finalize = modest_serversecurity_combo_box_finalize;
+}
+
+enum MODEL_COLS {
+ MODEL_COL_NAME = 0, /* a string */
+ MODEL_COL_ID = 1 /* an int. */
+};
+
+static void
+modest_serversecurity_combo_box_init (ModestServersecurityComboBox *self)
+{
+ ModestServersecurityComboBoxPrivate *priv = SERVERSECURITY_COMBO_BOX_GET_PRIVATE (self);
+
+ /* Create a tree model for the combo box,
+ * with a string for the name, and an ID for the serversecurity.
+ * This must match our MODEL_COLS enum constants.
+ */
+ priv->model = GTK_TREE_MODEL (gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT));
+
+ /* Setup the combo box: */
+ GtkComboBox *combobox = GTK_COMBO_BOX (self);
+ gtk_combo_box_set_model (combobox, priv->model);
+
+ /* Serversecurity column:
+ * The ID model column in not shown in the view. */
+ GtkCellRenderer *renderer = gtk_cell_renderer_text_new ();
+ gtk_cell_layout_pack_start(GTK_CELL_LAYOUT (combobox), renderer, TRUE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer,
+ "text", MODEL_COL_NAME, NULL);
+
+ /* The application must call modest_serversecurity_combo_box_fill().
+ */
+}
+
+ModestServersecurityComboBox*
+modest_serversecurity_combo_box_new (void)
+{
+ return g_object_new (MODEST_TYPE_SERVERSECURITY_COMBO_BOX, NULL);
+}
+
+/* Fill the combo box with appropriate choices.
+ * #combobox: The combo box.
+ * @protocol: IMAP or POP.
+ */
+void modest_serversecurity_combo_box_fill (ModestServersecurityComboBox *combobox, ModestProtocol protocol)
+{
+ ModestServersecurityComboBoxPrivate *priv = SERVERSECURITY_COMBO_BOX_GET_PRIVATE (combobox);
+ priv->protocol = protocol; /* Remembered for later. */
+
+ /* Remove any existing rows: */
+ GtkListStore *liststore = GTK_LIST_STORE (priv->model);
+ gtk_list_store_clear (liststore);
+
+ GtkTreeIter iter;
+ gtk_list_store_append (liststore, &iter);
+ gtk_list_store_set (liststore, &iter, MODEL_COL_ID, (gint)MODEST_PROTOCOL_SECURITY_NONE, MODEL_COL_NAME, _("mcen_fi_advsetup_other_security_none"), -1);
+
+ /* Select the None item: */
+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox), &iter);
+
+ gtk_list_store_append (liststore, &iter);
+ gtk_list_store_set (liststore, &iter, MODEL_COL_ID, (gint)MODEST_PROTOCOL_SECURITY_TLS, MODEL_COL_NAME, _("mcen_fi_advsetup_other_security_normal"), -1);
+
+ /* Add security choices with protocol-specific names, as in the UI spec:
+ * (Note: Changing the title seems pointless. murrayc) */
+ if(protocol == MODEST_PROTOCOL_STORE_POP) {
+ gtk_list_store_append (liststore, &iter);
+ gtk_list_store_set (liststore, &iter, MODEL_COL_ID, (gint)MODEST_PROTOCOL_SECURITY_SSL, MODEL_COL_NAME, _("mcen_fi_advsetup_other_security_securepop3s"), -1);
+ } else if(protocol == MODEST_PROTOCOL_STORE_IMAP) {
+ gtk_list_store_append (liststore, &iter);
+ gtk_list_store_set (liststore, &iter, MODEL_COL_ID, (gint)MODEST_PROTOCOL_SECURITY_SSL, MODEL_COL_NAME, _("mcen_fi_advsetup_other_security_secureimap4"), -1);
+ } else if(protocol == MODEST_PROTOCOL_TRANSPORT_SMTP) {
+ gtk_list_store_append (liststore, &iter);
+ gtk_list_store_set (liststore, &iter, MODEL_COL_ID, (gint)MODEST_PROTOCOL_SECURITY_SSL, MODEL_COL_NAME, _("mcen_fi_advsetup_other_security_ssl"), -1);
+ }
+}
+
+static gint get_port_for_security (ModestProtocol protocol, ModestProtocol security)
+{
+ /* See the UI spec, section Email Wizards, Incoming Details [MSG-WIZ001]: */
+ gint result = 0;
+
+ /* Get the default port number for this protocol with this security: */
+ if(protocol == MODEST_PROTOCOL_STORE_POP) {
+ if ((security == MODEST_PROTOCOL_SECURITY_NONE) || (security == MODEST_PROTOCOL_SECURITY_TLS))
+ result = 110;
+ else if (security == MODEST_PROTOCOL_SECURITY_SSL)
+ result = 995;
+ } else if (protocol == MODEST_PROTOCOL_STORE_IMAP) {
+ if ((security == MODEST_PROTOCOL_SECURITY_NONE) || (security == MODEST_PROTOCOL_SECURITY_TLS))
+ result = 143;
+ else if (security == MODEST_PROTOCOL_SECURITY_SSL)
+ result = 993;
+ } else if (protocol == MODEST_PROTOCOL_TRANSPORT_SMTP) {
+ if ((security == MODEST_PROTOCOL_SECURITY_NONE) || (security == MODEST_PROTOCOL_SECURITY_TLS))
+ result = 25;
+ else if (security == MODEST_PROTOCOL_SECURITY_SSL)
+ result = 465;
+ }
+
+ return result;
+}
+
+/**
+ * Returns the selected serversecurity,
+ * or MODEST_PROTOCOL_UNKNOWN if no serversecurity was selected.
+ */
+ModestProtocol
+modest_serversecurity_combo_box_get_active_serversecurity (ModestServersecurityComboBox *combobox)
+{
+ GtkTreeIter active;
+ const gboolean found = gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combobox), &active);
+ if (found) {
+ ModestServersecurityComboBoxPrivate *priv = SERVERSECURITY_COMBO_BOX_GET_PRIVATE (combobox);
+
+ ModestProtocol serversecurity = MODEST_PROTOCOL_UNKNOWN;
+ gtk_tree_model_get (priv->model, &active, MODEL_COL_ID, &serversecurity, -1);
+ return serversecurity;
+ }
+
+ return MODEST_PROTOCOL_UNKNOWN; /* Failed. */
+}
+
+/**
+ * Returns the default port to be used for the selected serversecurity,
+ * or 0 if no serversecurity was selected.
+ */
+gint
+modest_serversecurity_combo_box_get_active_serversecurity_port (ModestServersecurityComboBox *combobox)
+{
+ ModestServersecurityComboBoxPrivate *priv = SERVERSECURITY_COMBO_BOX_GET_PRIVATE (combobox);
+
+ const ModestProtocol security = modest_serversecurity_combo_box_get_active_serversecurity
+ (combobox);
+ return get_port_for_security (priv->protocol, security);
+}
+
+/* This allows us to pass more than one piece of data to the signal handler,
+ * and get a result: */
+typedef struct
+{
+ ModestServersecurityComboBox* self;
+ gint id;
+ gboolean found;
+} ForEachData;
+
+static gboolean
+on_model_foreach_select_id(GtkTreeModel *model,
+ GtkTreePath *path, GtkTreeIter *iter, gpointer user_data)
+{
+ ForEachData *state = (ForEachData*)(user_data);
+
+ /* Select the item if it has the matching ID: */
+ guint id = 0;
+ gtk_tree_model_get (model, iter, MODEL_COL_ID, &id, -1);
+ if(id == state->id) {
+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX (state->self), iter);
+
+ state->found = TRUE;
+ return TRUE; /* Stop walking the tree. */
+ }
+
+ return FALSE; /* Keep walking the tree. */
+}
+
+/**
+ * Selects the specified serversecurity,
+ * or MODEST_PROTOCOL_UNKNOWN if no serversecurity was selected.
+ */
+gboolean
+modest_serversecurity_combo_box_set_active_serversecurity (ModestServersecurityComboBox *combobox, ModestProtocol serversecurity)
+{
+ ModestServersecurityComboBoxPrivate *priv = SERVERSECURITY_COMBO_BOX_GET_PRIVATE (combobox);
+
+ /* Create a state instance so we can send two items of data to the signal handler: */
+ ForEachData *state = g_new0 (ForEachData, 1);
+ state->self = combobox;
+ state->id = serversecurity;
+ 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);
+
+ const gboolean result = state->found;
+
+ /* Free the state instance: */
+ g_free(state);
+
+ return result;
+}
+
--- /dev/null
+/* Copyright (c) 2007, Nokia Corporation
+ * All rights reserved.
+ *
+ */
+
+#ifndef _MODEST_SERVERSECURITY_COMBO_BOX
+#define _MODEST_SERVERSECURITY_COMBO_BOX
+
+#include <gtk/gtkcombobox.h>
+#include "modest-protocol-info.h"
+
+G_BEGIN_DECLS
+
+#define MODEST_TYPE_SERVERSECURITY_COMBO_BOX modest_serversecurity_combo_box_get_type()
+
+#define MODEST_SERVERSECURITY_COMBO_BOX(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ MODEST_TYPE_SERVERSECURITY_COMBO_BOX, ModestServersecurityComboBox))
+
+#define MODEST_SERVERSECURITY_COMBO_BOX_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ MODEST_TYPE_SERVERSECURITY_COMBO_BOX, ModestServersecurityComboBoxClass))
+
+#define EASYSETUP_IS_SERVERSECURITY_COMBO_BOX(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ MODEST_TYPE_SERVERSECURITY_COMBO_BOX))
+
+#define EASYSETUP_IS_SERVERSECURITY_COMBO_BOX_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ MODEST_TYPE_SERVERSECURITY_COMBO_BOX))
+
+#define MODEST_SERVERSECURITY_COMBO_BOX_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ MODEST_TYPE_SERVERSECURITY_COMBO_BOX, ModestServersecurityComboBoxClass))
+
+typedef struct {
+ GtkComboBox parent;
+} ModestServersecurityComboBox;
+
+typedef struct {
+ GtkComboBoxClass parent_class;
+} ModestServersecurityComboBoxClass;
+
+GType modest_serversecurity_combo_box_get_type (void);
+
+ModestServersecurityComboBox* modest_serversecurity_combo_box_new (void);
+
+void modest_serversecurity_combo_box_fill (ModestServersecurityComboBox *combobox, ModestProtocol protocol);
+
+ModestProtocol modest_serversecurity_combo_box_get_active_serversecurity (ModestServersecurityComboBox *combobox);
+
+gboolean modest_serversecurity_combo_box_set_active_serversecurity (ModestServersecurityComboBox *combobox, ModestProtocol serversecurity);
+
+gint modest_serversecurity_combo_box_get_active_serversecurity_port (ModestServersecurityComboBox *combobox);
+
+
+G_END_DECLS
+
+#endif /* _EASYSETUP_PROVIDER_COMBO_BOX */