modest_server_account_get_username_has_succeeded (ModestAccountMgr *self, const gchar* account_name)
{
return modest_account_mgr_get_bool (self, account_name, MODEST_ACCOUNT_USERNAME_HAS_SUCCEEDED,
- TRUE /* server account */);
+ TRUE /* server account */);
}
void
gboolean succeeded)
{
modest_account_mgr_set_bool (self, account_name, MODEST_ACCOUNT_USERNAME_HAS_SUCCEEDED,
- succeeded, TRUE /* server account */);
+ succeeded, TRUE /* server account */);
}
void
modest_server_account_set_password (ModestAccountMgr *self, const gchar* account_name,
- const gchar* password)
+ const gchar* password)
{
modest_account_mgr_set_string (self, account_name, MODEST_ACCOUNT_PASSWORD,
- password, TRUE /* server account */);
+ password, TRUE /* server account */);
}
gchar*
return NULL;
}
- /* Make sure that at least one account is always the default, if possible:
- * (It would be meaningless to have enabled accounts but no default account. */
- if (!account) {
- modest_account_mgr_set_first_account_as_default (self);
- account = modest_conf_get_string (conf, MODEST_CONF_DEFAULT_ACCOUNT, &err);
- }
-
/* sanity check */
if (account && !modest_account_mgr_account_exists (self, account, FALSE)) {
g_printerr ("modest: default account does not exist\n");
FALSE);
conf = MODEST_ACCOUNT_MGR_GET_PRIVATE (self)->modest_conf;
-
+
return modest_conf_set_string (conf, MODEST_CONF_DEFAULT_ACCOUNT,
account, NULL);
return g_utf8_collate((const gchar*)a, (const gchar*)b);
}
+
+static void
+free_element (gpointer data, gpointer user_data)
+{
+ g_free (data);
+}
+
gboolean
modest_account_mgr_set_first_account_as_default (ModestAccountMgr *self)
{
gboolean result = FALSE;
GSList *account_names = modest_account_mgr_account_names (self, TRUE /* only enabled */);
-
+
/* Get the first one, alphabetically, by title: */
GSList* list_sorted = g_slist_sort (account_names,
on_accounts_list_sort_by_title);
- if(list_sorted)
- {
+ if(list_sorted) {
const gchar* account_name = (const gchar*)list_sorted->data;
if (account_name)
result = modest_account_mgr_set_default_account (self, account_name);
}
- /* TODO: Free the strings too? */
+ g_slist_foreach (account_names, free_element, NULL);
g_slist_free (account_names);
return result;
ModestTnyAccountStore *self = MODEST_TNY_ACCOUNT_STORE(user_data);
TnyAccount *store_account;
+ g_warning ("removing account %s", account);
+
/* Clear the account cache */
store_account =
modest_tny_account_store_get_server_account (self,
if (store_account) {
tny_store_account_delete_cache (TNY_STORE_ACCOUNT (store_account));
g_object_unref (store_account);
- }
-
+ } else
+ g_printerr ("modest: cannot find server account for %s", account);
+
/* FIXME: make this more finegrained; changes do not
* really affect _all_ accounts, and some do not
* affect tny accounts at all (such as 'last_update')
{
ModestTnyAccountStore *self = MODEST_TNY_ACCOUNT_STORE(user_data);
+
+ g_warning ("updating account %s (%d change(s))", account, g_slist_length((GSList*)keys));
/* Ignore the change if it's a change in the last_updated value */
if (g_slist_length ((GSList *)keys) == 1 &&
}
} else {
ModestAccountData *account_data;
-
account_data = modest_account_mgr_get_account_data (priv->account_mgr, account_name);
if (!account_data) {
- g_printerr ("modest: %s: cannot get account data for account '%s'\n", __FUNCTION__, account_name);
+ g_printerr ("modest: %s: cannot get account data for account '%s'\n", __FUNCTION__,
+ account_name);
return NULL;
}
return account;
}
-gboolean modest_tny_account_is_virtual_local_folders (TnyAccount *self)
+gboolean
+modest_tny_account_is_virtual_local_folders (TnyAccount *self)
{
/* We should make this more sophisticated if we ever use ModestTnyLocalFoldersAccount
* for anything else. */
return MODEST_IS_TNY_LOCAL_FOLDERS_ACCOUNT (self);
}
-TnyAccount* modest_tny_account_store_get_local_folders_account (TnyAccountStore *self)
+TnyAccount*
+modest_tny_account_store_get_local_folders_account (TnyAccountStore *self)
{
TnyAccount *account = NULL;
ModestTnyAccountStorePrivate *priv;
* g_object_unref when it's no longer needed
*/
TnyAccount* modest_tny_account_store_get_server_account (ModestTnyAccountStore *self,
- const gchar *account_name,
- TnyAccountType type);
-
+ const gchar *account_name,
+ TnyAccountType type);
+
/**
* modest_tny_account_store_get_transport_account_for_open_connection
* @self: a ModestTnyAccountStore instance
* g_object_unref when it's no longer needed
*/
TnyAccount* modest_tny_account_store_get_transport_account_for_open_connection (ModestTnyAccountStore *self,
- const gchar *account_name);
+ const gchar *account_name);
/**
* tny_account_store_get_session