2007-04-18 Murray Cumming <murrayc@murrayc.com>
authorMurray Cumming <murrayc@murrayc.com>
Wed, 18 Apr 2007 12:06:49 +0000 (12:06 +0000)
committerMurray Cumming <murrayc@murrayc.com>
Wed, 18 Apr 2007 12:06:49 +0000 (12:06 +0000)
* src/modest-defs.h:

        * src/modest-account-mgr-helpers.h:
        * src/modest-account-mgr-helpers.c:
        Store the security account setting in a single conf key instead of using
        the options list, so that the list is left for just the to-be-removed camel hack,
        and because gconf_client_set_list() is failing for some reason.

        * src/modest-account-mgr.c:
        (modest_account_mgr_add_server_account):
        * src/maemo/modest-account-settings-dialog.c:
        (modest_account_settings_dialog_set_account_name),
        (save_configuration): Use the renamed functions.

pmo-trunk-r1583

ChangeLog2
src/maemo/modest-account-settings-dialog.c
src/modest-account-mgr-helpers.c
src/modest-account-mgr-helpers.h
src/modest-account-mgr.c
src/modest-defs.h
src/widgets/modest-limit-retrieve-combo-box.c

index 0b229bc..70319b0 100644 (file)
@@ -1,5 +1,22 @@
 2007-04-18  Murray Cumming  <murrayc@murrayc.com>
 
+       * src/modest-defs.h:
+
+       * src/modest-account-mgr-helpers.h:
+       * src/modest-account-mgr-helpers.c:
+       Store the security account setting in a single conf key instead of using 
+       the options list, so that the list is left for just the to-be-removed camel hack, 
+       and because gconf_client_set_list() is failing for some reason.
+
+       * src/modest-account-mgr.c:
+       (modest_account_mgr_add_server_account):
+       * src/maemo/modest-account-settings-dialog.c:
+       (modest_account_settings_dialog_set_account_name),
+       (save_configuration): Use the renamed functions.
+
+
+2007-04-18  Murray Cumming  <murrayc@murrayc.com>
+
        * src/widgets/Makefile.am:
        * src/widgets/modest-limit-retrieve-combo-box.c:
        * src/widgets/modest-limit-retrieve-combo-box.h:
index 201b83f..e270231 100644 (file)
@@ -867,7 +867,7 @@ void modest_account_settings_dialog_set_account_name (ModestAccountSettingsDialo
                gtk_entry_set_text( GTK_ENTRY (dialog->entry_incomingserver), 
                        incoming_account->hostname ? incoming_account->hostname : "");
                        
-               const ModestProtocol secure_auth = modest_server_account_get_option_secure_auth(
+               const ModestProtocol secure_auth = modest_server_account_get_secure_auth(
                        dialog->account_manager, incoming_account->account_name);
                gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (dialog->checkbox_incoming_auth), 
                        secure_auth == MODEST_PROTOCOL_AUTH_PASSWORD);
@@ -875,7 +875,8 @@ void modest_account_settings_dialog_set_account_name (ModestAccountSettingsDialo
                update_incoming_server_title (dialog, incoming_account->proto);
                update_incoming_server_security_choices (dialog, incoming_account->proto);
                
-               const ModestProtocol security = modest_server_account_data_get_option_security (incoming_account);
+               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);
                
@@ -906,7 +907,7 @@ void modest_account_settings_dialog_set_account_name (ModestAccountSettingsDialo
                        outgoing_account->password ? outgoing_account->password : "");
                
                /* Get the secure-auth setting: */
-               const ModestProtocol secure_auth = modest_server_account_get_option_secure_auth(
+               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);
@@ -916,7 +917,8 @@ void modest_account_settings_dialog_set_account_name (ModestAccountSettingsDialo
                        EASYSETUP_SERVERSECURITY_COMBO_BOX (dialog->combo_outgoing_security), outgoing_account->proto);
                
                /* Get the security setting: */
-               const ModestProtocol security = modest_server_account_data_get_option_security (outgoing_account);
+               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);
                
@@ -999,11 +1001,11 @@ save_configuration (ModestAccountSettingsDialog *dialog)
                (GTK_TOGGLE_BUTTON (dialog->checkbox_incoming_auth)) 
                        ? MODEST_PROTOCOL_AUTH_PASSWORD
                        : MODEST_PROTOCOL_AUTH_NONE;
-       modest_server_account_set_option_secure_auth (dialog->account_manager, incoming_account_name, protocol_authentication_incoming);
+       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));
-       modest_server_account_set_option_security (dialog->account_manager, incoming_account_name, protocol_security_incoming);
+       modest_server_account_set_security (dialog->account_manager, incoming_account_name, protocol_security_incoming);
        
        /* port: */
        const gchar* port_str = gtk_entry_get_text (GTK_ENTRY (dialog->entry_incoming_port));
@@ -1040,11 +1042,11 @@ save_configuration (ModestAccountSettingsDialog *dialog)
        
        const ModestProtocol protocol_security_outgoing = easysetup_serversecurity_combo_box_get_active_serversecurity (
                EASYSETUP_SERVERSECURITY_COMBO_BOX (dialog->combo_outgoing_security));
-       modest_server_account_set_option_security (dialog->account_manager, outgoing_account_name, protocol_security_outgoing);
+       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));
-       modest_server_account_set_option_secure_auth (dialog->account_manager, outgoing_account_name, protocol_authentication_outgoing);        
+       modest_server_account_set_secure_auth (dialog->account_manager, outgoing_account_name, protocol_authentication_outgoing);       
                
        /* port: */
        port_str = gtk_entry_get_text (GTK_ENTRY (dialog->entry_outgoing_port));
index 49b02be..9a71436 100644 (file)
@@ -47,6 +47,7 @@ modest_account_mgr_get_enabled (ModestAccountMgr *self, const gchar* name)
        return modest_account_mgr_get_bool (self, name, MODEST_ACCOUNT_ENABLED, FALSE);
 }
 
+#if 0 /* Not needed, but works. */
 static gint
 compare_option_strings_for_name (const gchar* a, const gchar* b)
 {
@@ -75,7 +76,7 @@ compare_option_strings_for_name (const gchar* a, const gchar* b)
 }
            
 gchar*
-modest_server_account_data_get_option_value (GSList* options_list, const gchar* option_name)
+modest_server_account_data_get_option_string (GSList* options_list, const gchar* option_name)
 {
        if (!options_list)
                return NULL;
@@ -118,13 +119,14 @@ modest_server_account_data_get_option_bool (GSList* options_list, const gchar* o
                
        return result;
 }
+#endif
 
 ModestProtocol
-modest_server_account_get_option_secure_auth (ModestAccountMgr *self, 
+modest_server_account_get_secure_auth (ModestAccountMgr *self, 
        const gchar* account_name)
 {
        ModestProtocol result = MODEST_PROTOCOL_AUTH_NONE;
-       gchar* value =modest_account_mgr_get_string (self, account_name, MODEST_ACCOUNT_AUTH_MECH, 
+       gchar* value = modest_account_mgr_get_string (self, account_name, MODEST_ACCOUNT_AUTH_MECH, 
                TRUE /* server account */);
        if (value) {
                if (strcmp(value, MODEST_ACCOUNT_AUTH_MECH_VALUE_NONE) == 0)
@@ -141,7 +143,7 @@ modest_server_account_get_option_secure_auth (ModestAccountMgr *self,
 }
 
 void
-modest_server_account_set_option_secure_auth (ModestAccountMgr *self, 
+modest_server_account_set_secure_auth (ModestAccountMgr *self, 
        const gchar* account_name, ModestProtocol secure_auth)
 {
        /* Get the conf string for the enum value: */
@@ -158,17 +160,18 @@ modest_server_account_set_option_secure_auth (ModestAccountMgr *self,
 }
 
 ModestProtocol
-modest_server_account_data_get_option_security (ModestServerAccountData *account_data)
+modest_server_account_get_security (ModestAccountMgr *self, 
+       const gchar* account_name)
 {
        ModestProtocol result = MODEST_PROTOCOL_SECURITY_NONE;
-       gchar* value = modest_server_account_data_get_option_value (account_data->options, 
-               MODEST_ACCOUNT_OPTION_SECURITY);
+       gchar* value = modest_account_mgr_get_string (self, account_name, MODEST_ACCOUNT_SECURITY, 
+               TRUE /* server account */);
        if (value) {
-               if (strcmp(value, MODEST_ACCOUNT_OPTION_SECURITY_VALUE_NONE) == 0)
+               if (strcmp(value, MODEST_ACCOUNT_SECURITY_VALUE_NONE) == 0)
                        result = MODEST_PROTOCOL_SECURITY_NONE;
-               else if (strcmp(value, MODEST_ACCOUNT_OPTION_SECURITY_VALUE_NORMAL) == 0)
+               else if (strcmp(value, MODEST_ACCOUNT_SECURITY_VALUE_NORMAL) == 0)
                        result = MODEST_PROTOCOL_SECURITY_TLS;
-               else if (strcmp(value, MODEST_ACCOUNT_OPTION_SECURITY_VALUE_SSL) == 0)
+               else if (strcmp(value, MODEST_ACCOUNT_SECURITY_VALUE_SSL) == 0)
                        result = MODEST_PROTOCOL_SECURITY_SSL;
                        
                g_free (value);
@@ -178,44 +181,23 @@ modest_server_account_data_get_option_security (ModestServerAccountData *account
 }
 
 void
-modest_server_account_set_option_security (ModestAccountMgr *self, 
+modest_server_account_set_security (ModestAccountMgr *self, 
        const gchar* account_name, ModestProtocol security)
 {
-       GSList *options_list = modest_account_mgr_get_list (self, account_name, MODEST_ACCOUNT_OPTIONS,
-                                                    MODEST_CONF_VALUE_STRING, TRUE);
-
-       if(options_list) {
-               /* Remove the item if it exists already: */
-               GSList* option = NULL;
-               do {
-                       g_slist_find_custom(options_list, MODEST_ACCOUNT_OPTION_SECURITY, (GCompareFunc)compare_option_strings_for_name);
-                       if(option)
-                               options_list = g_slist_remove (options_list, option->data);
-               } while(option);
-       }
-               
-       /* Add the new item to the list: */
+       /* Get the conf string for the enum value: */
        const gchar* str_value = NULL;
        if (security == MODEST_PROTOCOL_SECURITY_NONE)
-               str_value = MODEST_ACCOUNT_OPTION_SECURITY_VALUE_NONE;
+               str_value = MODEST_ACCOUNT_SECURITY_VALUE_NONE;
        else if (security == MODEST_PROTOCOL_SECURITY_TLS)
-               str_value = MODEST_ACCOUNT_OPTION_SECURITY_VALUE_NORMAL;
+               str_value = MODEST_ACCOUNT_SECURITY_VALUE_NORMAL;
        else if (security == MODEST_PROTOCOL_SECURITY_SSL)
-               str_value = MODEST_ACCOUNT_OPTION_SECURITY_VALUE_SSL;
-       
-       if (str_value) {
-               gchar* pair = g_strdup_printf(MODEST_ACCOUNT_OPTION_SECURITY "=%s", str_value);
-               options_list = g_slist_append(options_list, pair);
-       }
+               str_value = MODEST_ACCOUNT_SECURITY_VALUE_SSL;
        
        /* Set it in the configuration: */
-       modest_account_mgr_set_list (self, account_name, MODEST_ACCOUNT_OPTIONS, options_list,
-                                                    MODEST_CONF_VALUE_STRING, TRUE);
-       
-       /* TODO: Should we free the items too, or just the list? */
-       g_slist_free (options_list);
+       modest_account_mgr_set_string (self, account_name, MODEST_ACCOUNT_SECURITY, str_value, TRUE);
 }
-                                         
+                    
+#if 0                     
 gchar*
 modest_account_mgr_get_server_account_option (ModestAccountMgr *self, 
        const gchar* account_name, const gchar* option_name)
@@ -232,6 +214,7 @@ modest_account_mgr_get_server_account_option (ModestAccountMgr *self,
                
        return result;
 }
+#endif
 
 static ModestServerAccountData*
 modest_account_mgr_get_server_account_data (ModestAccountMgr *self, const gchar* name)
index 8a09475..4833182 100644 (file)
@@ -138,7 +138,7 @@ gboolean modest_account_mgr_set_enabled (ModestAccountMgr *self, const gchar* na
 gboolean modest_account_mgr_get_enabled (ModestAccountMgr *self, const gchar* name);
 
 /**
- * modest_server_account_get_option_secure_auth:
+ * modest_server_account_get_secure_auth:
  * @self: a ModestAccountMgr instance
  * @account_name: The name of a server account.
  *
@@ -147,10 +147,10 @@ gboolean modest_account_mgr_get_enabled (ModestAccountMgr *self, const gchar* na
  * Returns: The secure authentication enum value.
  */
 ModestProtocol
-modest_server_account_get_option_secure_auth (ModestAccountMgr *self, const gchar* account_name);
+modest_server_account_get_secure_auth (ModestAccountMgr *self, const gchar* account_name);
 
 /**
- * modest_server_account_data_get_option_secure_auth:
+ * modest_server_account_data_get_secure_auth:
  * @self: a ModestAccountMgr instance
  * @account_name: The name of a server account.
  * @secure_auth: The secure authentication enum value.
@@ -158,31 +158,33 @@ modest_server_account_get_option_secure_auth (ModestAccountMgr *self, const gcha
  * Gets the secure authentication method for this server account.
  */
 void
-modest_server_account_set_option_secure_auth (ModestAccountMgr *self, const gchar* account_name, 
+modest_server_account_set_secure_auth (ModestAccountMgr *self, const gchar* account_name, 
        ModestProtocol secure_auth);
        
 /**
- * modest_server_account_data_get_option_security:
- * @account_data: a ModestAccountData instance.
+ * modest_server_account_data_get_security:
+ * @self: a ModestAccountMgr instance
+ * @account_name: The name of a server account.
  *
  * Gets the security method for this server account.
  *
  * Returns: The security enum value.
  */
 ModestProtocol
-modest_server_account_data_get_option_security (ModestServerAccountData *account_data);
+modest_server_account_get_security (ModestAccountMgr *self, const gchar* account_name);
 
 /**
- * modest_server_account_set_option_security:
+ * modest_server_account_set_security:
  * @self: a ModestAccountMgr instance
  * @secure_auth: The security enum value.
  *
  * Gets the security method for this server account.
  */
 void
-modest_server_account_set_option_security (ModestAccountMgr *self, const gchar* account_name, 
+modest_server_account_set_security (ModestAccountMgr *self, const gchar* account_name, 
        ModestProtocol security);
 
+#if 0
 /**
  * modest_account_mgr_get_account_option:
  * @self: a ModestAccountMgr instance
@@ -201,7 +203,7 @@ gchar* modest_account_mgr_get_server_account_option (ModestAccountMgr *self,
  *
  * Returns: The account option value. This must be freed with g_free().
  */
-gchar* modest_server_account_data_get_option_value (GSList* options_list, const gchar* option_name);
+gchar* modest_server_account_data_get_option_string (GSList* options_list, const gchar* option_name);
 
 /**
  * modest_server_account_data_get_option_bool:
@@ -211,7 +213,7 @@ gchar* modest_server_account_data_get_option_value (GSList* options_list, const
  * Returns: Whether the account option is present.
  */
 gboolean modest_server_account_data_get_option_bool (GSList* options_list, const gchar* option_name);
-
+#endif
 
 /**
  * modest_account_mgr_get_from_string
index 9d8ed49..89a3d5b 100644 (file)
@@ -441,7 +441,7 @@ modest_account_mgr_add_server_account (ModestAccountMgr * self,
                
                
                /* Add the security settings: */
-               modest_server_account_set_option_security (self, name, security);
+               modest_server_account_set_security (self, name, security);
        }
 
 cleanup:
index 57550cb..782170c 100644 (file)
 
 #define MODEST_ACCOUNT_LIMIT_RETRIEVE   "limit-retrieve"            /* int */
 
-/* Keys and values used in the text items in the options GSList: */
-#define MODEST_ACCOUNT_OPTION_SECURITY "security"
-#define MODEST_ACCOUNT_OPTION_SECURITY_VALUE_NONE "none"
-#define MODEST_ACCOUNT_OPTION_SECURITY_VALUE_NORMAL "normal"
-#define MODEST_ACCOUNT_OPTION_SECURITY_VALUE_SSL "ssl"
+#define MODEST_ACCOUNT_SECURITY "security"
+#define MODEST_ACCOUNT_SECURITY_VALUE_NONE "none"
+#define MODEST_ACCOUNT_SECURITY_VALUE_NORMAL "normal"
+#define MODEST_ACCOUNT_SECURITY_VALUE_SSL "ssl"
 
 
 /* Options keys that correspond directly to camel options.
  * These probably should not be written to user configuration, 
  * because they are specific API implementation details. */
+/* Keys and values used in the text items in the options GSList: */
 #define MODEST_ACCOUNT_OPTION_SSL "use_ssl"
 #define MODEST_ACCOUNT_OPTION_SSL_NEVER "never"
 #define MODEST_ACCOUNT_OPTION_SSL_ALWAYS "always"
index 46c922f..c8681b3 100644 (file)
@@ -84,7 +84,7 @@ enum MODEL_COLS {
        MODEL_COL_NUM = 1 /* an int */
 };
 
-void modest_limit_retrieve_combo_box_fill (ModestLimitRetrieveComboBox *combobox);
+static void modest_limit_retrieve_combo_box_fill (ModestLimitRetrieveComboBox *combobox);
 
 static void
 modest_limit_retrieve_combo_box_init (ModestLimitRetrieveComboBox *self)
@@ -121,7 +121,7 @@ modest_limit_retrieve_combo_box_new (void)
  * #combobox: The combo box.
  * @protocol: IMAP or POP.
  */
-void modest_limit_retrieve_combo_box_fill (ModestLimitRetrieveComboBox *combobox)
+static void modest_limit_retrieve_combo_box_fill (ModestLimitRetrieveComboBox *combobox)
 {      
        ModestLimitRetrieveComboBoxPrivate *priv = LIMIT_RETRIEVE_COMBO_BOX_GET_PRIVATE (combobox);