Fixes NB#63571
[modest] / src / maemo / modest-platform.c
index 5fe2b68..8ee6646 100644 (file)
@@ -1181,39 +1181,6 @@ modest_platform_connect_and_wait_if_network_folderstore (GtkWindow *parent_windo
        return result;
 }
 
-gboolean 
-modest_platform_is_network_folderstore (TnyFolderStore *folder_store)
-{
-        TnyAccount *account = NULL;
-        gboolean result = TRUE;
-
-        g_return_val_if_fail(TNY_IS_FOLDER_STORE(folder_store), FALSE);
-
-        if (TNY_IS_FOLDER (folder_store)) {
-                /* Get the folder's parent account: */
-                account = tny_folder_get_account(TNY_FOLDER(folder_store));
-        } else if (TNY_IS_ACCOUNT (folder_store)) {
-                account = TNY_ACCOUNT(folder_store);
-                g_object_ref(account);
-        }
-
-        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;
-                        }
-                }
-                g_object_unref (account);
-        } else {
-                result = FALSE;
-        }
-
-        return result;
-}
-
 void
 modest_platform_run_sort_dialog (GtkWindow *parent_window,
                                 ModestSortDialogType type)
@@ -1990,43 +1957,16 @@ modest_platform_connect_and_perform (GtkWindow *parent_window,
        
        return;
 }
-void 
-modest_platform_connect_and_perform_if_network_account (GtkWindow *parent_window, 
-                                                       TnyAccount *account,
-                                                       ModestConnectedPerformer callback, 
-                                                       gpointer user_data)
-{
-       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 IS a local account like a maildir account, which does not require 
-                        * a connection. (original comment had a vague assumption in its language
-                        * usage. There's no assuming needed, this IS what it IS: a local account), */
-                       /* We promise to instantly perform the callback, so ... */
-                       if (callback) {
-                               callback (FALSE, NULL, parent_window, account, user_data);
-                       }
-                       
-                       return;
-               }
-       }
-       modest_platform_connect_and_perform (parent_window, account, callback, user_data);
-       return;
-}
+
 void
-modest_platform_connect_and_perform_if_network_folderstore (GtkWindow *parent_window, 
+modest_platform_connect_if_remote_and_perform (GtkWindow *parent_window, 
                                                            TnyFolderStore *folder_store, 
                                                            ModestConnectedPerformer callback, 
                                                            gpointer user_data)
 {
-       if (!folder_store) {
+       TnyAccount *account = NULL;
+       
+       if (!folder_store) {
                /* We promise to instantly perform the callback, so ... */
                if (callback) {
                        callback (FALSE, NULL, parent_window, NULL, user_data);
@@ -2036,19 +1976,32 @@ modest_platform_connect_and_perform_if_network_folderstore (GtkWindow *parent_wi
                /* Original comment: Maybe it is something local. */
                /* PVH's comment: maybe we should KNOW this in stead of assuming? */
                
-       }
-       
-       if (TNY_IS_FOLDER (folder_store)) {
+       } else if (TNY_IS_FOLDER (folder_store)) {
                /* Get the folder's parent account: */
-               TnyAccount *account = tny_folder_get_account(TNY_FOLDER (folder_store));
-               if (account != NULL) {
-                       modest_platform_connect_and_perform_if_network_account (NULL, account, callback, user_data);
-                       g_object_unref (account);
-               }
+               account = tny_folder_get_account(TNY_FOLDER (folder_store));
        } else if (TNY_IS_ACCOUNT (folder_store)) {
                /* Use the folder store as an account: */
-               modest_platform_connect_and_perform_if_network_account (NULL, TNY_ACCOUNT (folder_store), callback, user_data);
+               account = TNY_ACCOUNT (folder_store);
        }
  
+       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 IS a local account like a maildir account, which does not require 
+                        * a connection. (original comment had a vague assumption in its language
+                        * usage. There's no assuming needed, this IS what it IS: a local account), */
+                       /* We promise to instantly perform the callback, so ... */
+                       if (callback) {
+                               callback (FALSE, NULL, parent_window, account, user_data);
+                       }
+                       
+                       return;
+               }
+       }
+       modest_platform_connect_and_perform (parent_window, account, callback, user_data);
        return;
 }