2007-05-15 Murray Cumming <murrayc@murrayc.com>
authorMurray Cumming <murrayc@murrayc.com>
Tue, 15 May 2007 13:55:43 +0000 (13:55 +0000)
committerMurray Cumming <murrayc@murrayc.com>
Tue, 15 May 2007 13:55:43 +0000 (13:55 +0000)
* src/modest-protocol-info.c:
        * src/modest-protocol-info.h: Adde enum-specific get functions,
        instead of using a ModestProtocolType enum parameter.

        * src/gnome/modest-account-assistant.c:
        * src/gnome/modest-store-widget.c:
        * src/gnome/modest-store-widget.h:
        * src/gnome/modest-transport-widget.c:
        * src/gnome/modest-transport-widget.h:
        * src/maemo/easysetup/modest-easysetup-servertype-combo-box.c:
        * src/maemo/easysetup/modest-easysetup-servertype-combo-box.h:
        * src/maemo/easysetup/modest-easysetup-wizard.c:
        * src/maemo/modest-account-settings-dialog.c:
        * src/maemo/modest-account-settings-dialog.h:
        * src/maemo/modest-store-widget.c:
        * src/maemo/modest-store-widget.h:
        * src/maemo/modest-transport-widget.c:
        * src/maemo/modest-transport-widget.h:
        * src/modest-account-mgr-helpers.c:
        * src/modest-account-mgr-helpers.h:
        * src/modest-account-mgr.c:
        * src/modest-account-mgr.h:
        * src/modest-tny-account.c:
        * src/modest-tny-folder.c:
        * src/widgets/modest-account-view.c:
        * src/widgets/modest-retrieve-combo-box.c:
        * src/widgets/modest-retrieve-combo-box.h:
        * src/widgets/modest-secureauth-combo-box.c:
        * src/widgets/modest-serversecurity-combo-box.c:
        * src/widgets/modest-serversecurity-combo-box.h:
        * tests/check_account-mgr.c:
        Use the specific functions, and use the re-renamed enum values for GNOME too.

pmo-trunk-r1874

30 files changed:
ChangeLog2
src/gnome/modest-account-assistant.c
src/gnome/modest-store-widget.c
src/gnome/modest-store-widget.h
src/gnome/modest-transport-widget.c
src/gnome/modest-transport-widget.h
src/maemo/easysetup/modest-easysetup-servertype-combo-box.c
src/maemo/easysetup/modest-easysetup-servertype-combo-box.h
src/maemo/easysetup/modest-easysetup-wizard.c
src/maemo/modest-account-settings-dialog.c
src/maemo/modest-account-settings-dialog.h
src/maemo/modest-store-widget.c
src/maemo/modest-store-widget.h
src/maemo/modest-transport-widget.c
src/maemo/modest-transport-widget.h
src/modest-account-mgr-helpers.c
src/modest-account-mgr-helpers.h
src/modest-account-mgr.c
src/modest-account-mgr.h
src/modest-protocol-info.c
src/modest-protocol-info.h
src/modest-tny-account.c
src/modest-tny-folder.c
src/widgets/modest-account-view.c
src/widgets/modest-retrieve-combo-box.c
src/widgets/modest-retrieve-combo-box.h
src/widgets/modest-secureauth-combo-box.c
src/widgets/modest-serversecurity-combo-box.c
src/widgets/modest-serversecurity-combo-box.h
tests/check_account-mgr.c

index 6176f62..f6b93dd 100644 (file)
@@ -1,5 +1,40 @@
 2007-05-15  Murray Cumming  <murrayc@murrayc.com>
 
+       * src/modest-protocol-info.c:
+       * src/modest-protocol-info.h: Adde enum-specific get functions, 
+       instead of using a ModestProtocolType enum parameter.
+       
+       * src/gnome/modest-account-assistant.c:
+       * src/gnome/modest-store-widget.c:
+       * src/gnome/modest-store-widget.h:
+       * src/gnome/modest-transport-widget.c:
+       * src/gnome/modest-transport-widget.h:
+       * src/maemo/easysetup/modest-easysetup-servertype-combo-box.c:
+       * src/maemo/easysetup/modest-easysetup-servertype-combo-box.h:
+       * src/maemo/easysetup/modest-easysetup-wizard.c:
+       * src/maemo/modest-account-settings-dialog.c:
+       * src/maemo/modest-account-settings-dialog.h:
+       * src/maemo/modest-store-widget.c:
+       * src/maemo/modest-store-widget.h:
+       * src/maemo/modest-transport-widget.c:
+       * src/maemo/modest-transport-widget.h:
+       * src/modest-account-mgr-helpers.c:
+       * src/modest-account-mgr-helpers.h:
+       * src/modest-account-mgr.c:
+       * src/modest-account-mgr.h:
+       * src/modest-tny-account.c:
+       * src/modest-tny-folder.c: 
+       * src/widgets/modest-account-view.c:
+       * src/widgets/modest-retrieve-combo-box.c:
+       * src/widgets/modest-retrieve-combo-box.h:
+       * src/widgets/modest-secureauth-combo-box.c:
+       * src/widgets/modest-serversecurity-combo-box.c:
+       * src/widgets/modest-serversecurity-combo-box.h:
+       * tests/check_account-mgr.c: 
+       Use the specific functions, and use the re-renamed enum values for GNOME too.
+
+2007-05-15  Murray Cumming  <murrayc@murrayc.com>
+
        * src/modest-pair.h: 
        * src/modest-pair.c: Added modest_pair_list_find_by_first_as_string(),
        so we can get the second based on the first.
index af0e8e1..3ee5f5f 100644 (file)
@@ -260,7 +260,7 @@ on_receiving_combo_box_changed (GtkComboBox *combo, ModestAccountAssistant *self
 {
        ModestAccountAssistantPrivate *priv;
        gchar *chosen;
-       ModestProtocol proto;
+       ModestTransportStoreProtocol proto;
        
        priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE(self);
        chosen = gtk_combo_box_get_active_text (GTK_COMBO_BOX(combo));
@@ -268,7 +268,7 @@ on_receiving_combo_box_changed (GtkComboBox *combo, ModestAccountAssistant *self
                gtk_container_remove (GTK_CONTAINER(priv->store_holder),
                                      priv->store_widget);
 
-       proto = modest_protocol_info_get_protocol (chosen);
+       proto = modest_protocol_info_get_transport_store_protocol (chosen);
        
        /* FIXME: we could have these widgets cached instead of
           creating them every time */
@@ -308,7 +308,7 @@ add_receiving_page (ModestAccountAssistant *self)
                            gtk_label_new(_("Server type")),
                            FALSE,FALSE,6);
 
-       protos = modest_protocol_info_get_protocol_pair_list (MODEST_PROTOCOL_TYPE_STORE);
+       protos = modest_protocol_info_get_transport_store_protocol_pair_list (MODEST_PROTOCOL_TYPE_STORE);
        combo = modest_combo_box_new (protos, g_str_equal);
        modest_pair_list_free (protos);
        
@@ -355,7 +355,7 @@ on_sending_combo_box_changed (GtkComboBox *combo, ModestAccountAssistant *self)
                gtk_container_remove (GTK_CONTAINER(priv->transport_holder),
                                      priv->transport_widget);
        priv->transport_widget =
-               modest_transport_widget_new (modest_protocol_info_get_protocol(chosen));
+               modest_transport_widget_new (modest_protocol_info_get_transport_store_protocol(chosen));
 
        gtk_container_add (GTK_CONTAINER(priv->transport_holder),
                           priv->transport_widget);
@@ -384,7 +384,7 @@ add_sending_page (ModestAccountAssistant *self)
                            gtk_label_new(_("Server type")),
                            FALSE,FALSE,0);
        
-       protos = modest_protocol_info_get_protocol_pair_list (MODEST_PROTOCOL_TYPE_TRANSPORT);
+       protos = modest_protocol_info_get_transport_store_protocol_pair_list (MODEST_PROTOCOL_TYPE_TRANSPORT);
        combo = modest_combo_box_new (protos, g_str_equal);
        modest_pair_list_free (protos);
 
@@ -562,7 +562,7 @@ on_close (ModestAccountAssistant *self, gpointer user_data)
  * somewhere else
  */
 static gchar*
-get_account_uri (ModestProtocol proto, const gchar* path)
+get_account_uri (ModestTransportStoreProtocol proto, const gchar* path)
 {
        CamelURL *url;
        gchar *uri;
@@ -583,7 +583,7 @@ get_account_uri (ModestProtocol proto, const gchar* path)
 }
 
 static gchar*
-get_new_server_account_name (ModestAccountMgr* acc_mgr, ModestProtocol proto,
+get_new_server_account_name (ModestAccountMgr* acc_mgr, ModestTransportStoreProtocol proto,
                             const gchar* username, const gchar *servername)
 {
        gchar *name;
@@ -591,7 +591,7 @@ get_new_server_account_name (ModestAccountMgr* acc_mgr, ModestProtocol proto,
        
        while (TRUE) {
                name = g_strdup_printf ("%s:%d",
-                                       modest_protocol_info_get_protocol_name(proto), i++);
+                                       modest_protocol_info_get_transport_store_protocol_name(proto), i++);
                if (modest_account_mgr_account_exists (acc_mgr, name, TRUE))
                        g_free (name);
                else
@@ -605,9 +605,9 @@ static void
 on_apply (ModestAccountAssistant *self, gpointer user_data)
 {
        ModestAccountAssistantPrivate *priv;
-       ModestProtocol proto = MODEST_PROTOCOL_UNKNOWN;
-       ModestSecureConnection security = MODEST_PROTOCOL_SECURITY_NONE;
-       ModestSecureAuthentication auth = MODEST_PROTOCOL_AUTH_NONE;
+       ModestTransportStoreProtocol proto = MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN;
+       ModestAuthProtocol security = MODEST_PROTOCOL_SECURITY_NONE;
+       ModestConnectionProtocol auth = MODEST_PROTOCOL_AUTH_NONE;
        gchar *store_name, *transport_name;
        const gchar *account_name, *username, *servername, *path;
        ModestStoreWidget *store;
index f41090b..27918d2 100644 (file)
@@ -52,7 +52,7 @@ struct _ModestStoreWidgetPrivate {
        GtkWidget *auth;
        GtkWidget *chooser;
 
-       ModestProtocol proto;
+       ModestTransportStoreProtocol proto;
 };
 #define MODEST_STORE_WIDGET_GET_PRIVATE(o)      (G_TYPE_INSTANCE_GET_PRIVATE((o), \
                                                  MODEST_TYPE_STORE_WIDGET, \
@@ -115,7 +115,7 @@ modest_store_widget_init (ModestStoreWidget *obj)
        ModestStoreWidgetPrivate *priv;
        
        priv = MODEST_STORE_WIDGET_GET_PRIVATE(obj); 
-       priv->proto = MODEST_PROTOCOL_UNKNOWN;
+       priv->proto = MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN;
 }
 
 
@@ -226,7 +226,7 @@ imap_pop_configuration (ModestStoreWidget *self)
        gtk_label_set_markup (GTK_LABEL(label),_("<b>Security</b>"));
        gtk_box_pack_start (GTK_BOX(box), label, FALSE, FALSE, 0);
 
-       protos = modest_protocol_info_get_protocol_pair_list (MODEST_PROTOCOL_TYPE_SECURITY);
+       protos = modest_protocol_info_get_connection_protocol_pair_list ();
        priv->security = modest_combo_box_new (protos, g_str_equal);
        modest_pair_list_free (protos);
        
@@ -243,7 +243,7 @@ imap_pop_configuration (ModestStoreWidget *self)
        gtk_label_set_text (GTK_LABEL(label),_("Authentication:"));
        gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 6);
        
-       protos = modest_protocol_info_get_protocol_pair_list (MODEST_PROTOCOL_TYPE_AUTH);
+       protos = modest_protocol_info_get_auth_protocol_pair_list (;
        priv->auth =  modest_combo_box_new (protos, g_str_equal);
        modest_pair_list_free (protos);
 
@@ -268,7 +268,7 @@ modest_store_widget_finalize (GObject *obj)
 
 
 GtkWidget*
-modest_store_widget_new (ModestProtocol proto)
+modest_store_widget_new (ModestTransportStoreProtocol proto)
 {
        GObject *obj;
        GtkWidget *w;
@@ -327,12 +327,12 @@ modest_store_widget_get_servername (ModestStoreWidget *self)
 }
 
 
-ModestProtocol
+ModestTransportStoreProtocol
 modest_store_widget_get_proto (ModestStoreWidget *self)
 {
        ModestStoreWidgetPrivate *priv;
 
-       g_return_val_if_fail (self, MODEST_PROTOCOL_UNKNOWN);
+       g_return_val_if_fail (self, MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN);
        priv = MODEST_STORE_WIDGET_GET_PRIVATE(self);
 
        return priv->proto;
@@ -344,7 +344,7 @@ modest_store_widget_get_path (ModestStoreWidget *self)
 {
        ModestStoreWidgetPrivate *priv;
        
-       g_return_val_if_fail (self, MODEST_PROTOCOL_UNKNOWN);
+       g_return_val_if_fail (self, NULL);
        priv = MODEST_STORE_WIDGET_GET_PRIVATE(self);
 
        if (GTK_IS_FILE_CHOOSER(priv->chooser))
@@ -359,31 +359,31 @@ get_value_from_combo (GtkWidget *combo)
        gchar *chosen;
 
        if (!combo)
-               return MODEST_PROTOCOL_UNKNOWN;
+               return -1;
 
        chosen = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combo));
 
-       return modest_protocol_info_get_protocol (chosen);
+       return modest_protocol_info_get_transport_store_protocol (chosen);
 
 }
 
-ModestSecureAuthentication
+ModestAuthProtocol
 modest_store_widget_get_auth (ModestStoreWidget *self)
 {
        ModestStoreWidgetPrivate *priv; 
 
-       g_return_val_if_fail (self, MODEST_PROTOCOL_UNKNOWN);
+       g_return_val_if_fail (self, MODEST_PROTOCOL_AUTH_NONE);
        priv = MODEST_STORE_WIDGET_GET_PRIVATE(self);
 
        return get_value_from_combo (priv->auth);
 }
 
-ModestSecureConnection
+ModestConnectionProtocol
 modest_store_widget_get_security (ModestStoreWidget *self)
 {
        ModestStoreWidgetPrivate *priv; 
 
-       g_return_val_if_fail (self, MODEST_PROTOCOL_UNKNOWN);
+       g_return_val_if_fail (self, MODEST_PROTOCOL_CONNECTION_NORMAL);
        priv = MODEST_STORE_WIDGET_GET_PRIVATE(self);
 
        return get_value_from_combo (priv->security);
index b4bc8a9..0037daf 100644 (file)
@@ -34,14 +34,14 @@ struct _ModestStoreWidgetClass {
 /* member functions */
 GType           modest_store_widget_get_type    (void) G_GNUC_CONST;
 
-GtkWidget*      modest_store_widget_new         (ModestProtocol proto);
+GtkWidget*      modest_store_widget_new         (ModestTransportStoreProtocol proto);
 
 const gchar*    modest_store_widget_get_username          (ModestStoreWidget *self);
 const gchar*    modest_store_widget_get_servername        (ModestStoreWidget *self);
-ModestProtocol  modest_store_widget_get_proto             (ModestStoreWidget *self);
+ModestTransportStoreProtocol  modest_store_widget_get_proto             (ModestStoreWidget *self);
 gchar *         modest_store_widget_get_path              (ModestStoreWidget *self);
-ModestSecureAuthentication  modest_store_widget_get_auth              (ModestStoreWidget *self);
-ModestSecureConnection  modest_store_widget_get_security          (ModestStoreWidget *self);
+ModestConnectionProtocol  modest_store_widget_get_auth              (ModestStoreWidget *self);
+ModestAuthProtocol  modest_store_widget_get_security          (ModestStoreWidget *self);
 
 G_END_DECLS
 
index 69e900e..aec1ab5 100644 (file)
@@ -24,7 +24,7 @@ enum {
 
 typedef struct _ModestTransportWidgetPrivate ModestTransportWidgetPrivate;
 struct _ModestTransportWidgetPrivate {
-       ModestProtocol proto;
+       ModestTransportStoreProtocol proto;
        GtkWidget *servername;
        GtkWidget *username;
        GtkWidget *auth;
@@ -88,7 +88,7 @@ modest_transport_widget_init (ModestTransportWidget *obj)
        ModestTransportWidgetPrivate *priv;
        priv = MODEST_TRANSPORT_WIDGET_GET_PRIVATE(obj); 
        
-       priv->proto = MODEST_PROTOCOL_UNKNOWN;
+       priv->proto = MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN;
 }
 
 static void
@@ -160,7 +160,7 @@ smtp_configuration (ModestTransportWidget *self)
        gtk_label_set_text (GTK_LABEL(label),_("Connection type:"));
        gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 0);
 
-       protos = modest_protocol_info_get_protocol_pair_list (MODEST_PROTOCOL_TYPE_AUTH);
+       protos = modest_protocol_info_get_auth_protocol_pair_list ();
        combo  = modest_combo_box_new (protos, g_str_equal);
        modest_pair_list_free (protos);
        
@@ -173,7 +173,7 @@ smtp_configuration (ModestTransportWidget *self)
        gtk_label_set_text (GTK_LABEL(label),_("Authentication:"));
        gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 6);
 
-       protos = modest_protocol_info_get_protocol_pair_list (MODEST_PROTOCOL_TYPE_AUTH);
+       protos = modest_protocol_info_get_auth_protocol_pair_list ();
        combo  = modest_combo_box_new (protos, g_str_equal);
        modest_pair_list_free (protos);
        
@@ -187,7 +187,7 @@ smtp_configuration (ModestTransportWidget *self)
 
 
 GtkWidget*
-modest_transport_widget_new (ModestProtocol proto)
+modest_transport_widget_new (ModestTransportStoreProtocol proto)
 {
        GObject *obj;
        GtkWidget *w;
@@ -259,12 +259,12 @@ modest_transport_widget_get_servername (ModestTransportWidget *self)
 }
 
 
-ModestProtocol
+ModestTransportStoreProtocol
 modest_transport_widget_get_proto (ModestTransportWidget *self)
 {
        ModestTransportWidgetPrivate *priv;
 
-       g_return_val_if_fail (self, MODEST_PROTOCOL_UNKNOWN);
+       g_return_val_if_fail (self, MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN);
        priv = MODEST_TRANSPORT_WIDGET_GET_PRIVATE(self);
 
        return priv->proto;
index 73417ee..964cbd9 100644 (file)
@@ -33,13 +33,13 @@ struct _ModestTransportWidgetClass {
 /* member functions */
 GType        modest_transport_widget_get_type    (void) G_GNUC_CONST;
 
-GtkWidget*   modest_transport_widget_new         (ModestProtocol proto);
+GtkWidget*   modest_transport_widget_new         (ModestTransportStoreProtocol proto);
 
 gboolean        modest_transport_widget_get_remember_password (ModestTransportWidget *self);
 gboolean        modest_transport_widget_get_requires_auth     (ModestTransportWidget *self);
 const gchar*    modest_transport_widget_get_username          (ModestTransportWidget *self);
 const gchar*    modest_transport_widget_get_servername        (ModestTransportWidget *self);
-ModestProtocol  modest_transport_widget_get_proto             (ModestTransportWidget *self);
+ModestTransportStoreProtocol  modest_transport_widget_get_proto             (ModestTransportWidget *self);
 
 G_END_DECLS
 
index f7ea654..772651c 100644 (file)
@@ -139,9 +139,9 @@ void easysetup_servertype_combo_box_fill (EasysetupServertypeComboBox *combobox)
 
 /**
  * Returns the selected servertype, 
- * or MODEST_PROTOCOL_UNKNOWN if no servertype was selected.
+ * or MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN if no servertype was selected.
  */
-ModestProtocol
+ModestTransportStoreProtocol
 easysetup_servertype_combo_box_get_active_servertype (EasysetupServertypeComboBox *combobox)
 {
        GtkTreeIter active;
@@ -149,12 +149,12 @@ easysetup_servertype_combo_box_get_active_servertype (EasysetupServertypeComboBo
        if (found) {
                EasysetupServertypeComboBoxPrivate *priv = SERVERTYPE_COMBO_BOX_GET_PRIVATE (combobox);
 
-               ModestProtocol servertype = MODEST_PROTOCOL_UNKNOWN;
+               ModestTransportStoreProtocol servertype = MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN;
                gtk_tree_model_get (priv->model, &active, MODEL_COL_ID, &servertype, -1);
                return servertype;      
        }
 
-       return MODEST_PROTOCOL_UNKNOWN; /* Failed. */
+       return MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN; /* Failed. */
 }
 
 /* This allows us to pass more than one piece of data to the signal handler,
@@ -187,10 +187,10 @@ on_model_foreach_select_id(GtkTreeModel *model,
 
 /**
  * Selects the specified servertype, 
- * or MODEST_PROTOCOL_UNKNOWN if no servertype was selected.
+ * or MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN if no servertype was selected.
  */
 gboolean
-easysetup_servertype_combo_box_set_active_servertype (EasysetupServertypeComboBox *combobox, ModestProtocol servertype)
+easysetup_servertype_combo_box_set_active_servertype (EasysetupServertypeComboBox *combobox, ModestTransportStoreProtocol servertype)
 {
        EasysetupServertypeComboBoxPrivate *priv = SERVERTYPE_COMBO_BOX_GET_PRIVATE (combobox);
        
index a4b97ea..7051a36 100644 (file)
@@ -45,9 +45,9 @@ GType easysetup_servertype_combo_box_get_type (void);
 
 EasysetupServertypeComboBox* easysetup_servertype_combo_box_new (void);
 
-ModestProtocol easysetup_servertype_combo_box_get_active_servertype (EasysetupServertypeComboBox *combobox);
+ModestTransportStoreProtocol easysetup_servertype_combo_box_get_active_servertype (EasysetupServertypeComboBox *combobox);
 
-gboolean easysetup_servertype_combo_box_set_active_servertype (EasysetupServertypeComboBox *combobox, ModestProtocol servertype);
+gboolean easysetup_servertype_combo_box_set_active_servertype (EasysetupServertypeComboBox *combobox, ModestTransportStoreProtocol servertype);
 
 
 G_END_DECLS
index 24d353b..ed848a3 100644 (file)
@@ -510,7 +510,7 @@ static GtkWidget* create_page_complete_easysetup (ModestEasysetupWizardDialog *s
  */
 static void update_incoming_server_title (ModestEasysetupWizardDialog *self)
 {
-       const ModestProtocol protocol = easysetup_servertype_combo_box_get_active_servertype (
+       const ModestTransportStoreProtocol protocol = easysetup_servertype_combo_box_get_active_servertype (
                EASYSETUP_SERVERTYPE_COMBO_BOX (self->combo_incoming_servertype));
        const gchar* type = 
                (protocol == MODEST_PROTOCOL_STORE_POP ? 
@@ -531,7 +531,7 @@ static void update_incoming_server_title (ModestEasysetupWizardDialog *self)
  */
 static void update_incoming_server_security_choices (ModestEasysetupWizardDialog *self)
 {
-       const ModestProtocol protocol = easysetup_servertype_combo_box_get_active_servertype (
+       const ModestTransportStoreProtocol protocol = easysetup_servertype_combo_box_get_active_servertype (
                EASYSETUP_SERVERTYPE_COMBO_BOX (self->combo_incoming_servertype));
        
        /* Fill the combo with appropriately titled choices for POP or IMAP. */
@@ -1031,7 +1031,7 @@ static void create_subsequent_pages (ModestEasysetupWizardDialog *self)
 
 
 static gchar*
-util_get_default_servername_from_email_address (const gchar* email_address, ModestProtocol servertype)
+util_get_default_servername_from_email_address (const gchar* email_address, ModestTransportStoreProtocol servertype)
 {
        if (!email_address)
                return NULL;
@@ -1069,7 +1069,7 @@ static void set_default_custom_servernames (ModestEasysetupWizardDialog *account
        const gchar* incoming_existing = gtk_entry_get_text (GTK_ENTRY (account_wizard->entry_incomingserver));
        if ((!incoming_existing || (strlen(incoming_existing) == 0)) 
            && account_wizard->entry_user_email) {
-               const ModestProtocol protocol = easysetup_servertype_combo_box_get_active_servertype (
+               const ModestTransportStoreProtocol protocol = easysetup_servertype_combo_box_get_active_servertype (
                        EASYSETUP_SERVERTYPE_COMBO_BOX (account_wizard->combo_incoming_servertype));
                const gchar* email_address = gtk_entry_get_text (GTK_ENTRY(account_wizard->entry_user_email));
                
@@ -1309,10 +1309,10 @@ create_account (ModestEasysetupWizardDialog *self, gboolean enabled)
        const gchar* password = gtk_entry_get_text (GTK_ENTRY (self->entry_user_password));
        
        /* Incoming server: */
-       /* Note: We need something as default for the ModestProtocol* values, 
+       /* Note: We need something as default for the ModestTransportStoreProtocol* values, 
         * or modest_account_mgr_add_server_account will fail. */
        gchar* servername_incoming = NULL;
-       ModestProtocol protocol_incoming = MODEST_PROTOCOL_STORE_POP;
+       ModestTransportStoreProtocol protocol_incoming = MODEST_PROTOCOL_STORE_POP;
        ModestConnectionProtocol protocol_security_incoming = MODEST_PROTOCOL_CONNECTION_NORMAL;
        ModestAuthProtocol protocol_authentication_incoming = MODEST_PROTOCOL_AUTH_NONE;
        
@@ -1404,7 +1404,7 @@ create_account (ModestEasysetupWizardDialog *self, gboolean enabled)
        
        /* Outgoing server: */
        gchar* servername_outgoing = NULL;
-       ModestProtocol protocol_outgoing = MODEST_PROTOCOL_STORE_POP;
+       ModestTransportStoreProtocol protocol_outgoing = MODEST_PROTOCOL_STORE_POP;
        ModestConnectionProtocol protocol_security_outgoing = MODEST_PROTOCOL_CONNECTION_NORMAL;
        ModestAuthProtocol protocol_authentication_outgoing = MODEST_PROTOCOL_AUTH_NONE;
        
index 1f17530..a2df31a 100644 (file)
@@ -481,7 +481,7 @@ create_page_user_details (ModestAccountSettingsDialog *self)
 /** Change the caption title for the incoming server, 
  * as specified in the UI spec:
  */
-static void update_incoming_server_title (ModestAccountSettingsDialog *self, ModestProtocol protocol)
+static void update_incoming_server_title (ModestAccountSettingsDialog *self, ModestTransportStoreProtocol protocol)
 {
        const gchar* type = 
                (protocol == MODEST_PROTOCOL_STORE_POP ? 
@@ -500,7 +500,7 @@ static void update_incoming_server_title (ModestAccountSettingsDialog *self, Mod
 /** Change the caption title for the incoming server, 
  * as specified in the UI spec:
  */
-static void update_incoming_server_security_choices (ModestAccountSettingsDialog *self, ModestProtocol protocol)
+static void update_incoming_server_security_choices (ModestAccountSettingsDialog *self, ModestTransportStoreProtocol protocol)
 {
        /* 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. */
@@ -1119,7 +1119,7 @@ void modest_account_settings_dialog_set_account_name (ModestAccountSettingsDialo
        dialog->modified = FALSE;
 }
 
-static GList* get_supported_secure_authentication_methods (ModestProtocol proto, 
+static GList* get_supported_secure_authentication_methods (ModestTransportStoreProtocol proto, 
        const gchar* hostname, gint port, GtkWindow *parent_window);
 
 static gboolean
@@ -1414,7 +1414,7 @@ on_camel_account_get_supported_secure_authentication (
                ModestPair *matching = modest_pair_list_find_by_first_as_string (pairs, 
                        auth_name);
                if (matching)
-                       g_list_append (result, GINT_TO_POINTER((ModestSecureAuthentication)matching->second));
+                       g_list_append (result, GINT_TO_POINTER((ModestConnectionProtocol)matching->second));
                                
                iter = g_list_next (iter);      
        }
@@ -1429,14 +1429,14 @@ on_camel_account_get_supported_secure_authentication (
 #endif
 
 
-static GList* get_supported_secure_authentication_methods (ModestProtocol proto, 
+static GList* get_supported_secure_authentication_methods (ModestTransportStoreProtocol proto, 
        const gchar* hostname, gint port, GtkWindow *parent_window)
 {
        return NULL;
        
 /* TODO: Enable this when tinymail has the API: */
 #if 0
-       g_return_val_if_fail (proto != MODEST_PROTOCOL_UNKNOWN, NULL);
+       g_return_val_if_fail (proto != MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN, NULL);
        
        /*
        result = g_list_append (result, GINT_TO_POINTER (MODEST_PROTOCOL_AUTH_CRAMMD5));
@@ -1469,7 +1469,7 @@ static GList* get_supported_secure_authentication_methods (ModestProtocol proto,
         * set_session(): */
         /* TODO: Why isn't this done in account_new()? */
        tny_account_set_proto (tny_account,
-                              modest_protocol_info_get_protocol_name(proto));
+                              modest_protocol_info_get_transport_store_protocol_name(proto));
                               
        /* Set the session for the account, so we can use it: */
        ModestTnyAccountStore *account_store = modest_runtime_get_account_store ();
index 2ce1a01..83c0fc4 100644 (file)
@@ -43,8 +43,8 @@ typedef struct {
        
        gboolean modified;
        gchar * account_name; /* This may not change. It is not user visible. */
-       ModestProtocol incoming_protocol; /* This may not change. */
-       ModestProtocol outgoing_protocol; /* This may not change. */
+       ModestTransportStoreProtocol incoming_protocol; /* This may not change. */
+       ModestTransportStoreProtocol outgoing_protocol; /* This may not change. */
        gchar * original_account_title;
        
        GtkWidget *page_account_details;
index 3488edb..6a14a0c 100644 (file)
@@ -53,7 +53,7 @@ struct _ModestStoreWidgetPrivate {
        GtkWidget *chooser;
        GtkWidget *remember_pwd;
 
-       ModestProtocol proto;
+       ModestTransportStoreProtocol proto;
 };
 #define MODEST_STORE_WIDGET_GET_PRIVATE(o)      (G_TYPE_INSTANCE_GET_PRIVATE((o), \
                                                  MODEST_TYPE_STORE_WIDGET, \
@@ -116,7 +116,7 @@ modest_store_widget_init (ModestStoreWidget *obj)
        ModestStoreWidgetPrivate *priv;
        
        priv = MODEST_STORE_WIDGET_GET_PRIVATE(obj); 
-       priv->proto = MODEST_PROTOCOL_UNKNOWN;
+       priv->proto = MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN;
 }
 
 
@@ -228,7 +228,7 @@ imap_pop_configuration (ModestStoreWidget *self)
        gtk_label_set_markup (GTK_LABEL(label),_("<b>Security</b>"));
        gtk_box_pack_start (GTK_BOX(box), label, FALSE, FALSE, 0);
 
-       protos = modest_protocol_info_get_protocol_pair_list (MODEST_CONNECTION_PROTOCOL);
+       protos = modest_protocol_info_get_connection_protocol_pair_list ();
        priv->security = modest_combo_box_new (protos, g_str_equal);
        modest_pair_list_free (protos);
        
@@ -245,7 +245,7 @@ imap_pop_configuration (ModestStoreWidget *self)
        gtk_label_set_text (GTK_LABEL(label),_("Authentication:"));
        gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 6);
        
-       protos = modest_protocol_info_get_protocol_pair_list (MODEST_AUTH_PROTOCOL);
+       protos = modest_protocol_info_get_transport_store_protocol_pair_list ();
        combo =  modest_combo_box_new (protos, g_str_equal);
        modest_pair_list_free (protos);
 
@@ -274,7 +274,7 @@ modest_store_widget_finalize (GObject *obj)
 
 
 GtkWidget*
-modest_store_widget_new (ModestProtocol proto)
+modest_store_widget_new (ModestTransportStoreProtocol proto)
 {
        GObject *obj;
        GtkWidget *w;
@@ -347,12 +347,12 @@ modest_store_widget_get_servername (ModestStoreWidget *self)
 }
 
 
-ModestProtocol
+ModestTransportStoreProtocol
 modest_store_widget_get_proto (ModestStoreWidget *self)
 {
        ModestStoreWidgetPrivate *priv;
 
-       g_return_val_if_fail (self, MODEST_PROTOCOL_UNKNOWN);
+       g_return_val_if_fail (self, MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN);
        priv = MODEST_STORE_WIDGET_GET_PRIVATE(self);
 
        return priv->proto;
index 4fced5c..ca47c11 100644 (file)
@@ -60,12 +60,12 @@ struct _ModestStoreWidgetClass {
 /* member functions */
 GType        modest_store_widget_get_type    (void) G_GNUC_CONST;
 
-GtkWidget*   modest_store_widget_new         (ModestProtocol proto);
+GtkWidget*   modest_store_widget_new         (ModestTransportStoreProtocol proto);
 
 gboolean        modest_store_widget_get_remember_password (ModestStoreWidget *self);
 const gchar*    modest_store_widget_get_username          (ModestStoreWidget *self);
 const gchar*    modest_store_widget_get_servername        (ModestStoreWidget *self);
-ModestProtocol  modest_store_widget_get_proto             (ModestStoreWidget *self);
+ModestTransportStoreProtocol  modest_store_widget_get_proto             (ModestStoreWidget *self);
 gchar *         modest_store_widget_get_path              (ModestStoreWidget *self);
 
 
index 450b2fc..7465483 100644 (file)
@@ -49,7 +49,7 @@ enum {
 
 typedef struct _ModestTransportWidgetPrivate ModestTransportWidgetPrivate;
 struct _ModestTransportWidgetPrivate {
-       ModestProtocol proto;
+       ModestTransportStoreProtocol proto;
        GtkWidget *servername;
        GtkWidget *username;
        GtkWidget *auth;
@@ -113,7 +113,7 @@ modest_transport_widget_init (ModestTransportWidget *obj)
        ModestTransportWidgetPrivate *priv;
        priv = MODEST_TRANSPORT_WIDGET_GET_PRIVATE(obj); 
        
-       priv->proto = MODEST_PROTOCOL_UNKNOWN;
+       priv->proto = MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN;
 }
 
 static void
@@ -185,7 +185,7 @@ smtp_configuration (ModestTransportWidget *self)
        gtk_label_set_text (GTK_LABEL(label),_("Connection type:"));
        gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 0);
 
-       protos = modest_protocol_info_get_protocol_pair_list (MODEST_CONNECTION_PROTOCOL);
+       protos = modest_protocol_info_get_transport_store_protocol_pair_list ();
        combo  = modest_combo_box_new (protos, g_str_equal);
        modest_pair_list_free (protos);
        
@@ -198,7 +198,7 @@ smtp_configuration (ModestTransportWidget *self)
        gtk_label_set_text (GTK_LABEL(label),_("Authentication:"));
        gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 6);
 
-       protos = modest_protocol_info_get_protocol_pair_list (MODEST_AUTH_PROTOCOL);
+       protos = modest_protocol_info_get_auth_protocol_pair_list ();
        combo  = modest_combo_box_new (protos, g_str_equal);
        modest_pair_list_free (protos);
        
@@ -212,7 +212,7 @@ smtp_configuration (ModestTransportWidget *self)
 
 
 GtkWidget*
-modest_transport_widget_new (ModestProtocol proto)
+modest_transport_widget_new (ModestTransportStoreProtocol proto)
 {
        GObject *obj;
        GtkWidget *w;
@@ -284,12 +284,12 @@ modest_transport_widget_get_servername (ModestTransportWidget *self)
 }
 
 
-ModestProtocol
+ModestTransportStoreProtocol
 modest_transport_widget_get_proto (ModestTransportWidget *self)
 {
        ModestTransportWidgetPrivate *priv;
 
-       g_return_val_if_fail (self, MODEST_PROTOCOL_UNKNOWN);
+       g_return_val_if_fail (self, MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN);
        priv = MODEST_TRANSPORT_WIDGET_GET_PRIVATE(self);
 
        return priv->proto;
index c42a353..fb886f4 100644 (file)
@@ -60,13 +60,13 @@ struct _ModestTransportWidgetClass {
 /* member functions */
 GType        modest_transport_widget_get_type    (void) G_GNUC_CONST;
 
-GtkWidget*   modest_transport_widget_new         (ModestProtocol proto);
+GtkWidget*   modest_transport_widget_new         (ModestTransportStoreProtocol proto);
 
 gboolean        modest_transport_widget_get_remember_password (ModestTransportWidget *self);
 gboolean        modest_transport_widget_get_requires_auth     (ModestTransportWidget *self);
 const gchar*    modest_transport_widget_get_username          (ModestTransportWidget *self);
 const gchar*    modest_transport_widget_get_servername        (ModestTransportWidget *self);
-ModestProtocol  modest_transport_widget_get_proto             (ModestTransportWidget *self);
+ModestTransportStoreProtocol  modest_transport_widget_get_proto             (ModestTransportWidget *self);
 
 G_END_DECLS
 
index d2859c2..c994b55 100644 (file)
@@ -345,7 +345,7 @@ modest_account_mgr_get_server_account_data (ModestAccountMgr *self, const gchar*
        data->hostname     = modest_account_mgr_get_string (self, name, MODEST_ACCOUNT_HOSTNAME,TRUE);
        data->username     = modest_account_mgr_get_string (self, name, MODEST_ACCOUNT_USERNAME,TRUE);  
        proto              = modest_account_mgr_get_string (self, name, MODEST_ACCOUNT_PROTO, TRUE);
-       data->proto        = modest_protocol_info_get_protocol (proto, MODEST_TRANSPORT_STORE_PROTOCOL);
+       data->proto        = modest_protocol_info_get_transport_store_protocol (proto);
        g_free (proto);
 
        data->port         = modest_account_mgr_get_int (self, name, MODEST_ACCOUNT_PORT, TRUE);
index 1c40224..8b69d2c 100644 (file)
@@ -45,7 +45,7 @@ typedef struct {
        gchar            *hostname;
        gchar            *username;
        gchar            *uri; /*< Only for mbox and maildir accounts. */
-       ModestProtocol    proto; /*< The store or transport. Not ORed. */
+       ModestTransportStoreProtocol    proto; /*< The store or transport. Not ORed. */
        gchar            *password;
        time_t            last_updated;
        gint             port; /* Or 0, if the default should be used. */
index b0b7910..44b09a2 100644 (file)
@@ -306,7 +306,7 @@ gboolean
 modest_account_mgr_add_server_account (ModestAccountMgr * self,
                                       const gchar * name, const gchar *hostname,
                                       const gchar * username, const gchar * password,
-                                      ModestProtocol proto,
+                                      ModestTransportStoreProtocol proto,
                                       ModestConnectionProtocol security,
                                       ModestAuthProtocol auth)
 {
@@ -369,8 +369,7 @@ modest_account_mgr_add_server_account (ModestAccountMgr * self,
        /* proto */
        key = _modest_account_mgr_get_account_keyname (name, MODEST_ACCOUNT_PROTO, TRUE);
        ok = modest_conf_set_string (priv->modest_conf, key,
-                                    modest_protocol_info_get_protocol_name(proto,
-                                                                           MODEST_TRANSPORT_STORE_PROTOCOL),
+                                    modest_protocol_info_get_transport_store_protocol_name(proto),
                                     &err);
        if (err) {
                g_printerr ("modest: failed to set %s: %s\n", key, err->message);
@@ -384,8 +383,7 @@ modest_account_mgr_add_server_account (ModestAccountMgr * self,
        /* auth mechanism */
        key = _modest_account_mgr_get_account_keyname (name, MODEST_ACCOUNT_AUTH_MECH, TRUE);
        ok = modest_conf_set_string (priv->modest_conf, key,
-                                    modest_protocol_info_get_protocol_name (auth,
-                                                                            MODEST_AUTH_PROTOCOL),
+                                    modest_protocol_info_get_auth_protocol_name (auth),
                                     &err);
        if (err) {
                g_printerr ("modest: failed to set %s: %s\n", key, err->message);
@@ -415,7 +413,7 @@ cleanup:
  */
 gboolean
 modest_account_mgr_add_server_account_uri (ModestAccountMgr * self,
-                                          const gchar *name, ModestProtocol proto,
+                                          const gchar *name, ModestTransportStoreProtocol proto,
                                           const gchar *uri)
 {
        ModestAccountMgrPrivate *priv;
@@ -433,7 +431,7 @@ modest_account_mgr_add_server_account_uri (ModestAccountMgr * self,
        /* proto */
        key = _modest_account_mgr_get_account_keyname (name, MODEST_ACCOUNT_PROTO, TRUE);
        ok = modest_conf_set_string (priv->modest_conf, key,
-                                    modest_protocol_info_get_protocol_name(proto, MODEST_TRANSPORT_STORE_PROTOCOL),
+                                    modest_protocol_info_get_transport_store_protocol_name(proto),
                                     NULL);
        g_free (key);
 
@@ -537,12 +535,12 @@ strip_prefix_from_elements (GSList * lst, guint n)
        }
 }
 
-
+#if 0
+/* Not used. */
 GSList*
 modest_account_mgr_search_server_accounts (ModestAccountMgr * self,
                                           const gchar * account_name,
-                                          ModestProtocolType type,
-                                          ModestProtocol proto)
+                                          ModestTransportStoreProtocol proto)
 {
        GSList *accounts;
        GSList *cursor;
@@ -571,9 +569,9 @@ modest_account_mgr_search_server_accounts (ModestAccountMgr * self,
        while (cursor) { 
                gchar *account   = _modest_account_mgr_account_from_key ((gchar*)cursor->data, NULL, NULL);
                gchar *acc_proto = modest_account_mgr_get_string (self, account, MODEST_ACCOUNT_PROTO,TRUE);
-               ModestProtocol     this_proto = modest_protocol_info_get_protocol (acc_proto,
-                                                                                  MODEST_TRANSPORT_STORE_PROTOCOL);
-               if (this_proto != MODEST_PROTOCOL_UNKNOWN && this_proto != proto) {
+               ModestTransportStoreProtocol this_proto = 
+                       modest_protocol_info_get_transport_store_protocol (acc_proto);
+               if (this_proto != MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN && this_proto != proto) {
                        GSList *nxt = cursor->next;
                        accounts = g_slist_delete_link (accounts, cursor);
                        cursor = nxt;
@@ -588,7 +586,7 @@ modest_account_mgr_search_server_accounts (ModestAccountMgr * self,
        strip_prefix_from_elements (accounts, strlen(key)+1);
        return accounts;        
 }
-
+#endif
 
 GSList*
 modest_account_mgr_account_names (ModestAccountMgr * self, gboolean only_enabled)
index b5e02f8..3241b72 100644 (file)
@@ -123,7 +123,7 @@ gboolean modest_account_mgr_add_server_account    (ModestAccountMgr *self,
                                                   const gchar *hostname,
                                                   const gchar *username,
                                                   const gchar *password,
-                                                  ModestProtocol proto,
+                                                  ModestTransportStoreProtocol proto,
                                                   ModestConnectionProtocol security,
                                                   ModestAuthProtocol auth);
 
@@ -141,7 +141,7 @@ gboolean modest_account_mgr_add_server_account    (ModestAccountMgr *self,
  */
 gboolean modest_account_mgr_add_server_account_uri    (ModestAccountMgr *self,
                                                       const gchar *name,
-                                                      ModestProtocol proto,
+                                                      ModestTransportStoreProtocol proto,
                                                       const gchar* uri);
 
 /**
@@ -180,13 +180,14 @@ gboolean        modest_account_mgr_remove_account         (ModestAccountMgr *sel
 GSList*                modest_account_mgr_account_names    (ModestAccountMgr *self,
                                                     gboolean only_enabled);
 
-
+#if 0
+/* Not used. */
 /**
  * modest_account_mgr_search_server_account:
  * @self: a ModestAccountMgr instance
  * @account_name: get only server accounts for @account_name, or NULL for any
  * @type: get only server accounts from protocol type @type, or MODEST_PROTOCOL_TYPE_UNKNOWN
- * @proto: get only server account with protocol @proto, or MODEST_PROTOCOL_UNKNOWN for any
+ * @proto: get only server account with protocol @proto, or MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN for any
  * 
  * List all the server account names, optionally narrowing the result down to one account.
  *
@@ -196,7 +197,8 @@ GSList*             modest_account_mgr_account_names    (ModestAccountMgr *self,
 GSList*  modest_account_mgr_search_server_accounts  (ModestAccountMgr *self,
                                                     const gchar*       account_name,
                                                     ModestProtocolType type,
-                                                    ModestProtocol     proto);
+                                                    ModestTransportStoreProtocol     proto);
+#endif
 
 /**
  * modest_account_mgr_account_exists:
index 89baa11..7c3a4c7 100644 (file)
@@ -34,7 +34,7 @@
 
 
 typedef struct {
-       ModestProtocol   proto;
+       gint   proto;
        const gchar*     name;
        const gchar*     display_name;
 } ProtocolInfo;
@@ -63,43 +63,13 @@ static const ProtocolInfo AuthProtocolMap[] = {
 };
 
 
-
-static const ProtocolInfo*
-get_map (ModestProtocolType proto_type, guint *size)
+static ModestPairList*
+get_protocol_pair_list (const ProtocolInfo* map, guint size)
 {
-       const ProtocolInfo *map = NULL;
-       
-       switch (proto_type) {
-       case MODEST_TRANSPORT_STORE_PROTOCOL:
-               map   = TransportStoreProtocolMap;
-               *size = G_N_ELEMENTS(TransportStoreProtocolMap);
-               break;
-       case MODEST_CONNECTION_PROTOCOL:
-               map   = ConnectionProtocolMap;
-               *size = G_N_ELEMENTS(ConnectionProtocolMap);
-               break;
-       case MODEST_AUTH_PROTOCOL:
-               map   = AuthProtocolMap;
-               *size = G_N_ELEMENTS(AuthProtocolMap);
-               break;
-       default:
-               g_printerr ("modest: invalide protocol type %d", proto_type);
-       }
-       return map;
-}
-
+       g_return_val_if_fail (map, NULL);
 
-ModestPairList*
-modest_protocol_info_get_protocol_pair_list (ModestProtocolType proto_type)
-{
-       const ProtocolInfo *map;
-       ModestPairList *proto_list = NULL;
-       guint size;
+       ModestPairList *proto_list = NULL;      
        int i;
-
-       map = get_map (proto_type, &size);
-       g_return_val_if_fail (map, NULL);
-       
        for (i = 0; i != size; ++i) {
                const ProtocolInfo info = map[i];
                proto_list = g_slist_append (proto_list,
@@ -112,17 +82,38 @@ modest_protocol_info_get_protocol_pair_list (ModestProtocolType proto_type)
 }
 
 
-ModestProtocol
-modest_protocol_info_get_protocol (const gchar* name, ModestProtocolType proto_type)
+ModestPairList*
+modest_protocol_info_get_transport_store_protocol_pair_list ()
 {
-       const ProtocolInfo *map;
-       guint size;
+       return get_protocol_pair_list (TransportStoreProtocolMap,
+               G_N_ELEMENTS(TransportStoreProtocolMap));
+}
+
+ModestPairList*
+modest_protocol_info_get_auth_protocol_pair_list ()
+{
+       return get_protocol_pair_list (AuthProtocolMap,
+               G_N_ELEMENTS(AuthProtocolMap));
+}
+
+ModestPairList*
+modest_protocol_info_get_connection_protocol_pair_list ()
+{
+       return get_protocol_pair_list (ConnectionProtocolMap,
+               G_N_ELEMENTS(ConnectionProtocolMap));
+}
+       
+
+ModestTransportStoreProtocol
+modest_protocol_info_get_transport_store_protocol (const gchar* name)
+{
+       const ProtocolInfo *map = TransportStoreProtocolMap;
+       const guint size = G_N_ELEMENTS(TransportStoreProtocolMap);
        int i;
        
-       g_return_val_if_fail (name, MODEST_PROTOCOL_UNKNOWN);
+       g_return_val_if_fail (name, MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN);
        
-       map = get_map (proto_type, &size);
-       g_return_val_if_fail (map, MODEST_PROTOCOL_UNKNOWN);
+       g_return_val_if_fail (map, MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN);
 
        for (i = 0; i != size; ++i) {
                const ProtocolInfo info = map[i];
@@ -130,22 +121,18 @@ modest_protocol_info_get_protocol (const gchar* name, ModestProtocolType proto_t
                        return info.proto;
        }
        
-       return MODEST_PROTOCOL_UNKNOWN;
+       return MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN;
 }
 
 
 
 /* get either the name or the display_name for the protocol */
 static const gchar*
-get_protocol_string (ModestProtocol proto, gboolean get_name, ModestProtocolType proto_type)
+get_protocol_string (gint proto, const ProtocolInfo* map, guint size, gboolean get_name)
 {
-       const ProtocolInfo *map;
-       guint size;
-       int i;
-               
-       map = get_map (proto_type, &size);
        g_return_val_if_fail (map, NULL);
        
+       int i;
        for (i = 0; i != size; ++i) {
                ProtocolInfo info = map[i];
                if (info.proto == proto)
@@ -155,16 +142,24 @@ get_protocol_string (ModestProtocol proto, gboolean get_name, ModestProtocolType
 }
 
 const gchar*
-modest_protocol_info_get_protocol_name (ModestProtocol proto, ModestProtocolType proto_type)
+modest_protocol_info_get_transport_store_protocol_name (ModestTransportStoreProtocol proto)
 {
-       return get_protocol_string (proto, TRUE, proto_type);
+       return get_protocol_string (proto, TransportStoreProtocolMap,
+               G_N_ELEMENTS(TransportStoreProtocolMap), TRUE);
 }
 
+const gchar*
+modest_protocol_info_get_auth_protocol_name (ModestAuthProtocol proto)
+{
+       return get_protocol_string (proto, AuthProtocolMap,
+               G_N_ELEMENTS(AuthProtocolMap), TRUE);
+}
 
 const gchar*
-modest_protocol_info_get_protocol_display_name (ModestProtocol proto, ModestProtocolType proto_type)
+modest_protocol_info_get_connection_protocol_name (ModestAuthProtocol proto)
 {
-       return get_protocol_string (proto, FALSE, proto_type);
+       return get_protocol_string (proto, ConnectionProtocolMap,
+               G_N_ELEMENTS(ConnectionProtocolMap), TRUE);
 }
 
 
index 6683536..52e9737 100644 (file)
@@ -35,7 +35,9 @@
 
 G_BEGIN_DECLS
 
+/** Transport and Store protocols. */
 typedef enum {
+       MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN,
        MODEST_PROTOCOL_TRANSPORT_SENDMAIL,
        MODEST_PROTOCOL_TRANSPORT_SMTP,
 
@@ -44,7 +46,8 @@ typedef enum {
        MODEST_PROTOCOL_STORE_MAILDIR,
        MODEST_PROTOCOL_STORE_MBOX
 } ModestTransportStoreProtocol;
-       
+
+/** Secure connection methods. */
 typedef enum {    
        MODEST_PROTOCOL_CONNECTION_NORMAL,
        MODEST_PROTOCOL_CONNECTION_SSL,   
@@ -52,26 +55,31 @@ typedef enum {
        MODEST_PROTOCOL_CONNECTION_TLS_OP
 } ModestConnectionProtocol;
 
+/** Secure authentication methods. */
 typedef enum {    
        MODEST_PROTOCOL_AUTH_NONE,
        MODEST_PROTOCOL_AUTH_PASSWORD,
        MODEST_PROTOCOL_AUTH_CRAMMD5
 } ModestAuthProtocol;
 
-typedef enum {
-       MODEST_TRANSPORT_STORE_PROTOCOL,
-       MODEST_CONNECTION_PROTOCOL,
-       MODEST_AUTH_PROTOCOL
-} ModestProtocolType;
 
 
-typedef guint ModestProtocol;
 
-#define MODEST_PROTOCOL_UNKNOWN 666
+/**
+ * modest_protocol_info_get_transport_store_protocol_pair_list:
+ * 
+ * return the list of <protocol,display-name>-tupels of protocols.
+ * The elements of the returned list are ModestPairs
+ * This is a convenience function for use with ModestComboBox
+ *  
+ * Returns: a list of protocols. After use, it should be freed
+ * with modest_pair_list_free
+ */
+ModestPairList*
+modest_protocol_info_get_transport_store_protocol_pair_list ();
 
 /**
- * modest_protocol_info_get_protocol_pair_list:
- * @proto_type: the type of protocol you want to have
+ * modest_protocol_info_get_auth_protocol_pair_list:
  * 
  * return the list of <protocol,display-name>-tupels of protocols.
  * The elements of the returned list are ModestPairs
@@ -80,44 +88,68 @@ typedef guint ModestProtocol;
  * Returns: a list of protocols. After use, it should be freed
  * with modest_pair_list_free
  */
-ModestPairList*   modest_protocol_info_get_protocol_pair_list (ModestProtocolType proto_type);
+ModestPairList*
+modest_protocol_info_get_auth_protocol_pair_list ();
+
 
 /**
- * modest_protocol_info_get_protocol_type:
- * @name: the name of the  ModestProtocol
+ * modest_protocol_info_get_connection_protocol_pair_list:
+ * 
+ * return the list of <protocol,display-name>-tupels of protocols.
+ * The elements of the returned list are ModestPairs
+ * This is a convenience function for use with ModestComboBox
+ *  
+ * Returns: a list of protocols. After use, it should be freed
+ * with modest_pair_list_free
+ */
+ModestPairList*
+modest_protocol_info_get_connection_protocol_pair_list ();
+       
+       
+/**
+ * modest_protocol_info_get_transport_store_protocol:
+ * @name: the name of the  ModestTransportStoreProtocol
  * @proto_type: the type of protocol you want to have
  *
  * return the id of the protocol with the given name
  *  
- * Returns: the id of the protocol or MODEST_PROTOCOL_UNKNOWN
+ * Returns: the id of the protocol or MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN
  */
-ModestProtocol modest_protocol_info_get_protocol (const gchar* name, ModestProtocolType proto_type);
+ModestTransportStoreProtocol
+modest_protocol_info_get_transport_store_protocol (const gchar* name);
 
 /**
- * modest_protocol_info_get_protocol_name:
+ * modest_protocol_info_get_transport_store_protocol_name:
  * @proto: the protocol you are looking for
- * @proto_type: the type of protocol you want to have
  * 
- * return the string id of the proto (such as "imap", or "tls")
+ * return the string id of the proto (such as "imap", or "smtp")
  *  
  * Returns: string id of the proto as a constant string, that should NOT be modified or freed
  */
-const gchar* modest_protocol_info_get_protocol_name (ModestProtocol proto,
-                                                    ModestProtocolType proto_type);
+const gchar*
+modest_protocol_info_get_transport_store_protocol_name (ModestTransportStoreProtocol proto);
 
 /**
- * modest_protocol_info_get_protocol_display_name:
+ * modest_protocol_info_get_auth_protocol_name:
  * @proto: the protocol you are looking for
- * @proto_type: the type of protocol you want to have
- *
- * return the string id of the proto (such as "imap", or "tls")
+ * 
+ * return the string id of the proto (such as "password", or "cram-md5")
  *  
  * Returns: string id of the proto as a constant string, that should NOT be modified or freed
- *
  */
-const gchar* modest_protocol_info_get_protocol_display_name (ModestProtocol proto,
-                                                            ModestProtocolType proto_type);
+const gchar*
+modest_protocol_info_get_auth_protocol_name (ModestAuthProtocol proto);
 
+/**
+ * modest_protocol_info_get_auth_protocol_name:
+ * @proto: the protocol you are looking for
+ * 
+ * return the string id of the proto (such as "ssl", or "tls")
+ *   
+ * Returns: string id of the proto as a constant string, that should NOT be modified or freed
+ */
+const gchar*
+modest_protocol_info_get_connection_protocol_name (ModestAuthProtocol proto);
 
 
 /**
index 841d624..d2a9f20 100644 (file)
@@ -138,7 +138,7 @@ modest_tny_account_new_from_server_account (ModestAccountMgr *account_mgr,
        g_return_val_if_fail (account_data, NULL);
 
        /* sanity checks */
-       if (account_data->proto == MODEST_PROTOCOL_UNKNOWN) {
+       if (account_data->proto == MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN) {
                g_printerr ("modest: '%s' does not provide a protocol\n",
                            account_data->account_name);
                return NULL;
@@ -168,9 +168,8 @@ modest_tny_account_new_from_server_account (ModestAccountMgr *account_mgr,
        tny_account_set_id (tny_account, account_data->account_name);
 
        /* Proto */
-       tny_account_set_proto (tny_account,
-                              modest_protocol_info_get_protocol_name(account_data->proto,
-                                                                     MODEST_TRANSPORT_STORE_PROTOCOL));
+       const gchar* proto_name = modest_protocol_info_get_transport_store_protocol_name(account_data->proto);
+       tny_account_set_proto (tny_account, proto_name);
 
               
        /* mbox and maildir accounts use a URI instead of the rest: */
index 62438ab..10e77e5 100644 (file)
@@ -131,14 +131,13 @@ modest_tny_folder_get_rules   (const TnyFolder *folder)
                        rules |= MODEST_FOLDER_RULES_FOLDER_NON_RENAMEABLE;
                }
        } else {
-               ModestProtocol proto;
+               ModestTransportStoreProtocol proto;
                TnyAccount *account =
                        tny_folder_get_account ((TnyFolder*)folder);
                if (!account)
                        return -1; /* no account: nothing is allowed */
                
-               proto = modest_protocol_info_get_protocol (tny_account_get_proto (account),
-                                                          MODEST_TRANSPORT_STORE_PROTOCOL);
+               proto = modest_protocol_info_get_transport_store_protocol (tny_account_get_proto (account));
 
                if (proto == MODEST_PROTOCOL_STORE_IMAP) {
                        rules = 0;
index 814aff1..0ad2462 100644 (file)
@@ -214,8 +214,7 @@ update_account_view (ModestAccountMgr *account_mgr, ModestAccountView *view)
                                        MODEST_ACCOUNT_VIEW_IS_DEFAULT_COLUMN,    account_data->is_default,
        
                                        MODEST_ACCOUNT_VIEW_PROTO_COLUMN,
-                                       modest_protocol_info_get_protocol_name  (account_data->store_account->proto,
-                                                                                MODEST_TRANSPORT_STORE_PROTOCOL),
+                                       modest_protocol_info_get_transport_store_protocol_name (account_data->store_account->proto),
        
                                        MODEST_ACCOUNT_VIEW_LAST_UPDATED_COLUMN,  last_updated_string,
                                        -1);
index e7fde86..9653284 100644 (file)
@@ -85,7 +85,7 @@ enum MODEL_COLS {
        MODEL_COL_CONF_NAME = 1 /* a string */
 };
 
-void modest_retrieve_combo_box_fill (ModestRetrieveComboBox *combobox, ModestProtocol protocol);
+void modest_retrieve_combo_box_fill (ModestRetrieveComboBox *combobox, ModestTransportStoreProtocol protocol);
 
 static void
 modest_retrieve_combo_box_init (ModestRetrieveComboBox *self)
@@ -124,7 +124,7 @@ modest_retrieve_combo_box_new (void)
  * #combobox: The combo box.
  * @protocol: IMAP or POP.
  */
-void modest_retrieve_combo_box_fill (ModestRetrieveComboBox *combobox, ModestProtocol protocol)
+void modest_retrieve_combo_box_fill (ModestRetrieveComboBox *combobox, ModestTransportStoreProtocol protocol)
 {      
        ModestRetrieveComboBoxPrivate *priv = RETRIEVE_COMBO_BOX_GET_PRIVATE (combobox);
        
index 61e5403..eba023a 100644 (file)
@@ -45,7 +45,7 @@ GType modest_retrieve_combo_box_get_type (void);
 
 ModestRetrieveComboBox* modest_retrieve_combo_box_new (void);
 
-void modest_retrieve_combo_box_fill (ModestRetrieveComboBox *combobox, ModestProtocol protocol);
+void modest_retrieve_combo_box_fill (ModestRetrieveComboBox *combobox, ModestTransportStoreProtocol protocol);
 
 gchar* modest_retrieve_combo_box_get_active_retrieve_conf (ModestRetrieveComboBox *combobox);
 
index 99de063..b18c2a0 100644 (file)
@@ -158,7 +158,7 @@ modest_secureauth_combo_box_get_active_secureauth (ModestSecureauthComboBox *com
        if (found) {
                ModestSecureauthComboBoxPrivate *priv = SECUREAUTH_COMBO_BOX_GET_PRIVATE (combobox);
 
-               ModestProtocol secureauth = MODEST_PROTOCOL_AUTH_NONE;
+               ModestAuthProtocol secureauth = MODEST_PROTOCOL_AUTH_NONE;
                gtk_tree_model_get (priv->model, &active, MODEL_COL_ID, &secureauth, -1);
                return secureauth;      
        }
@@ -196,7 +196,7 @@ on_model_foreach_select_id(GtkTreeModel *model,
 
 /**
  * Selects the specified secureauth, 
- * or MODEST_PROTOCOL_UNKNOWN if no secureauth was selected.
+ * or MODEST_PROTOCOL_AUTH_NONE if no secureauth was selected.
  */
 gboolean
 modest_secureauth_combo_box_set_active_secureauth (ModestSecureauthComboBox *combobox, ModestAuthProtocol secureauth)
index c5e39c2..77d392b 100644 (file)
@@ -52,7 +52,7 @@ typedef struct _ModestServersecurityComboBoxPrivate ModestServersecurityComboBox
 struct _ModestServersecurityComboBoxPrivate
 {
        GtkTreeModel *model;
-       ModestProtocol protocol;
+       ModestConnectionProtocol protocol;
 };
 
 static void
@@ -146,8 +146,8 @@ modest_serversecurity_combo_box_new (void)
  * #combobox: The combo box.
  * @protocol: IMAP or POP.
  */
-void modest_serversecurity_combo_box_fill (ModestServersecurityComboBox *combobox, ModestProtocol protocol)
-{      
+void modest_serversecurity_combo_box_fill (ModestServersecurityComboBox *combobox, ModestTransportStoreProtocol protocol)
+{
        ModestServersecurityComboBoxPrivate *priv = SERVERSECURITY_COMBO_BOX_GET_PRIVATE (combobox);
        priv->protocol = protocol; /* Remembered for later. */
        
@@ -179,7 +179,7 @@ void modest_serversecurity_combo_box_fill (ModestServersecurityComboBox *combobo
        }
 }
 
-static gint get_port_for_security (ModestProtocol protocol, ModestConnectionProtocol security)
+static gint get_port_for_security (ModestTransportStoreProtocol protocol, ModestConnectionProtocol security)
 {
        /* See the UI spec, section Email Wizards, Incoming Details [MSG-WIZ001]: */
        gint result = 0;
@@ -269,7 +269,7 @@ on_model_foreach_select_id(GtkTreeModel *model,
 
 /**
  * Selects the specified serversecurity, 
- * or MODEST_PROTOCOL_UNKNOWN if no serversecurity was selected.
+ * or MODEST_PROTOCOL_CONNECTION_NORMAL if no serversecurity was selected.
  */
 gboolean
 modest_serversecurity_combo_box_set_active_serversecurity (ModestServersecurityComboBox *combobox,
index 4e13cfd..f47f6ea 100644 (file)
@@ -45,7 +45,7 @@ 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);
+void modest_serversecurity_combo_box_fill (ModestServersecurityComboBox *combobox, ModestTransportStoreProtocol protocol);
 
 ModestConnectionProtocol modest_serversecurity_combo_box_get_active_serversecurity (ModestServersecurityComboBox *combobox);
 
index ee7db6a..6c00667 100644 (file)
@@ -104,7 +104,7 @@ START_TEST (test_add_exists_remove_account_regular)
        gchar *hostname = NULL;
        gchar *username = NULL;
        gchar *password = NULL;
-       ModestProtocol proto;
+       ModestTransportStoreProtocol proto;
        gboolean result;
        
        name = g_strdup (TEST_MODEST_ACCOUNT_NAME);