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:
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);
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);
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);
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);
(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));
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));
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)
{
}
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;
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)
}
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: */
}
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);
}
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)
return result;
}
+#endif
static ModestServerAccountData*
modest_account_mgr_get_server_account_data (ModestAccountMgr *self, const gchar* name)
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.
*
* 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.
* 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
*
* 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:
* 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
/* Add the security settings: */
- modest_server_account_set_option_security (self, name, security);
+ modest_server_account_set_security (self, name, security);
}
cleanup:
#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"
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)
* #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);