X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-tny-account.c;h=7128471198111cf35e14bc4c81ecc22917d07fb6;hp=63e87ec45bfbe466e56919972777ede5cfbc85d2;hb=4d39841513a3a7f7aa9d38ab97cb9fcc9171e80b;hpb=f6d386ff93e929092ba105385a29d760aeba9ff7 diff --git a/src/modest-tny-account.c b/src/modest-tny-account.c index 63e87ec..7128471 100644 --- a/src/modest-tny-account.c +++ b/src/modest-tny-account.c @@ -28,6 +28,7 @@ */ #include +#include #include #include #include @@ -117,9 +118,9 @@ modest_tny_account_get_special_folder (TnyAccount *account, /* There is no need to do this _async, as these are local folders. */ /* TODO: However, this seems to fail sometimes when the network is busy, * returning an empty list. murrayc. */ - tny_folder_store_get_folders (TNY_FOLDER_STORE (local_account), folders, NULL, &error); + tny_folder_store_get_folders (TNY_FOLDER_STORE (local_account), folders, NULL, FALSE, &error); if (error) { - g_warning ("%s: tny_folder_store_get_folders() failed:%s\n", __FUNCTION__, error->message); + g_debug ("%s: tny_folder_store_get_folders() failed:%s\n", __FUNCTION__, error->message); g_error_free (error); goto cleanup; } @@ -345,7 +346,6 @@ modest_tny_account_new_from_server_account_name (ModestAccountMgr *account_mgr, ModestServerAccountSettings *server_settings; TnyAccount *tny_account; ModestProtocolRegistry *protocol_registry; - TnyConnectionPolicy *policy; g_return_val_if_fail (session, NULL); g_return_val_if_fail (server_account_name, NULL); @@ -362,6 +362,7 @@ modest_tny_account_new_from_server_account_name (ModestAccountMgr *account_mgr, ModestProtocol *protocol; const gchar* proto_name = NULL; tny_account_set_id (tny_account, server_account_name); + tny_account_set_name (tny_account, server_account_name); tny_camel_account_set_session (TNY_CAMEL_ACCOUNT (tny_account), session); protocol = modest_protocol_registry_get_protocol_by_type (protocol_registry, modest_server_account_settings_get_protocol (server_settings)); proto_name = modest_protocol_get_name (protocol); @@ -369,20 +370,25 @@ modest_tny_account_new_from_server_account_name (ModestAccountMgr *account_mgr, modest_tny_account_set_parent_modest_account_name_for_server_account (tny_account, server_account_name); } - if (!tny_account) + if (!tny_account) { g_warning ("%s: failed to create tny_account", __FUNCTION__); - else if (!update_tny_account (tny_account, server_settings)) - g_warning ("%s: failed to initialize tny_account", __FUNCTION__); - else { - tny_account_set_forget_pass_func (tny_account, - forget_pass_func ? forget_pass_func : forget_pass_dummy); - tny_account_set_pass_func (tny_account, - get_pass_func ? get_pass_func: get_pass_dummy); - } + } else { + TnyConnectionPolicy *policy; - policy = modest_default_connection_policy_new (); - tny_account_set_connection_policy (tny_account, policy); - g_object_unref (policy); + if (!update_tny_account (tny_account, server_settings)) { + g_warning ("%s: failed to initialize tny_account", __FUNCTION__); + } else { + + tny_account_set_forget_pass_func (tny_account, + forget_pass_func ? forget_pass_func : forget_pass_dummy); + tny_account_set_pass_func (tny_account, + get_pass_func ? get_pass_func: get_pass_dummy); + + } + policy = modest_default_connection_policy_new (); + tny_account_set_connection_policy (tny_account, policy); + g_object_unref (policy); + } g_object_unref (server_settings); @@ -420,7 +426,7 @@ set_online_callback (TnyCamelAccount *account, gboolean canceled, GError *err, g TNY_ACCOUNT (account), TNY_ALERT_TYPE_ERROR, FALSE, err); } - g_warning ("err: %s", err->message); + g_debug ("err: %s", err->message); } } @@ -601,7 +607,7 @@ on_modest_file_system_info (HildonFileSystemInfoHandle *handle, GetMmcAccountNameData *callback_data = (GetMmcAccountNameData*)data; if (error) { - g_warning ("%s: error=%s", __FUNCTION__, error->message); + g_debug ("%s: error=%s", __FUNCTION__, error->message); } TnyAccount *account = TNY_ACCOUNT (callback_data->account); @@ -633,11 +639,13 @@ on_modest_file_system_info (HildonFileSystemInfoHandle *handle, void modest_tny_account_get_mmc_account_name (TnyStoreAccount* self, ModestTnyAccountGetMmcAccountNameCallback callback, gpointer user_data) { #ifndef MODEST_TOOLKIT_GTK - /* Just use the hard-coded path for the single memory card, + /* Just use the path for the single memory card, * rather than try to figure out the path to the specific card by * looking at the maildir URI: */ - const gchar *uri_real = MODEST_MCC1_VOLUMEPATH_URI; + gchar *uri_real = g_strconcat (MODEST_MMC1_VOLUMEPATH_URI_PREFIX, + g_getenv (MODEST_MMC1_VOLUMEPATH_ENV), + NULL); /* gchar* uri = tny_account_get_url_string (TNY_ACCOUNT (self)); @@ -667,7 +675,7 @@ void modest_tny_account_get_mmc_account_name (TnyStoreAccount* self, ModestTnyAc hildon_file_system_info_async_new(uri_real, on_modest_file_system_info, callback_data /* user_data */); - /* g_free (uri_real); */ + g_free (uri_real); } /* g_free (uri); */ @@ -726,7 +734,7 @@ modest_tny_account_new_for_local_folders (ModestAccountMgr *account_mgr, TnySess * via a derived TnyCamelStoreAccount ? */ const gboolean is_mmc = location_filepath && - (strcmp (location_filepath, MODEST_MCC1_VOLUMEPATH) == 0); + (strcmp (location_filepath, g_getenv (MODEST_MMC1_VOLUMEPATH_ENV)) == 0); /* The name of memory card locations will be updated asynchronously. * This is just a default: */ @@ -903,7 +911,7 @@ recurse_folders_async_cb (TnyFolderStore *folder_store, if (!TNY_IS_MERGE_FOLDER (folder) && (TNY_IS_FOLDER (folder) && tny_folder_get_folder_type (TNY_FOLDER (folder)) != TNY_FOLDER_TYPE_OUTBOX)) - tny_folder_store_get_folders_async (folder, folders, NULL, + tny_folder_store_get_folders_async (folder, folders, NULL, FALSE, recurse_folders_async_cb, NULL, helper); g_object_unref (folders); @@ -953,7 +961,7 @@ modest_tny_folder_store_get_folder_stats (TnyFolderStore *self, folders = tny_simple_list_new (); tny_folder_store_get_folders_async (TNY_FOLDER_STORE (self), - folders, NULL, + folders, NULL, FALSE, recurse_folders_async_cb, NULL, helper); g_object_unref (folders); @@ -1018,12 +1026,20 @@ modest_tny_folder_store_is_remote (TnyFolderStore *folder_store) if (account != NULL) { if (tny_account_get_account_type (account) == TNY_ACCOUNT_TYPE_STORE) { - if (!TNY_IS_CAMEL_POP_STORE_ACCOUNT (account) && - !TNY_IS_CAMEL_IMAP_STORE_ACCOUNT (account)) { - /* This must be a maildir account, which does - * not require a connection: */ - result = FALSE; - } + ModestProtocolType proto_type; + const gchar *tag; + ModestProtocolRegistry *registry; + + proto_type = modest_tny_account_get_protocol_type (account); + registry = modest_runtime_get_protocol_registry (); + tag = MODEST_PROTOCOL_REGISTRY_REMOTE_STORE_PROTOCOLS; + if (modest_protocol_registry_protocol_type_has_tag (registry, + proto_type, + tag)) { + result = TRUE; + } else { + result = FALSE; + } } g_object_unref (account); } else {