* Fixes NB#98417, fixes a crash when trying to move the outbox folder
authorSergio Villar Senin <svillar@igalia.com>
Mon, 19 Jan 2009 14:56:17 +0000 (14:56 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Mon, 19 Jan 2009 14:56:17 +0000 (14:56 +0000)
pmo-trunk-r7185

src/gnome/modest-platform.c
src/hildon2/modest-platform.c
src/maemo/modest-platform.c
src/modest-ui-actions.c

index ba6a536..52f69ea 100644 (file)
@@ -276,17 +276,21 @@ modest_platform_connect_if_remote_and_perform (GtkWindow *parent_window,
                                               gpointer user_data)
 {
        TnyAccount *account = NULL;
-       
-       if (!folder_store) {
+
+       if (!folder_store ||
+           (TNY_IS_MERGE_FOLDER (folder_store) &&
+            (tny_folder_get_folder_type (TNY_FOLDER(folder_store)) == TNY_FOLDER_TYPE_OUTBOX))) {
+
                /* We promise to instantly perform the callback, so ... */
                if (callback) {
-                       callback (FALSE, NULL, parent_window, NULL, user_data);
-               }
-               return; 
-               
-               /* Original comment: Maybe it is something local. */
-               /* PVH's comment: maybe we should KNOW this in stead of assuming? */
-               
+                       GError *error = NULL;
+                       g_set_error (&error, TNY_ERROR_DOMAIN, TNY_SERVICE_ERROR_UNKNOWN,
+                                    "Unable to move or not found folder");
+                       callback (FALSE, error, parent_window, NULL, user_data);
+                       g_error_free (error);
+               }
+               return;
+
        } else if (TNY_IS_FOLDER (folder_store)) {
                /* Get the folder's parent account: */
                account = tny_folder_get_account(TNY_FOLDER (folder_store));
@@ -298,7 +302,7 @@ modest_platform_connect_if_remote_and_perform (GtkWindow *parent_window,
        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), */
index 76df0ae..3ed719f 100644 (file)
@@ -42,6 +42,8 @@
 #include <libosso.h>
 #include <tny-maemo-conic-device.h>
 #include <tny-simple-list.h>
+#include <tny-merge-folder.h>
+#include <tny-error.h>
 #include <tny-folder.h>
 #include <tny-account-store-view.h>
 #include <gtk/gtkicontheme.h>
@@ -2167,12 +2169,19 @@ modest_platform_connect_if_remote_and_perform (GtkWindow *parent_window,
                                               gpointer user_data)
 {
        TnyAccount *account = NULL;
-       
-       if (!folder_store) {
+
+       if (!folder_store ||
+           (TNY_IS_MERGE_FOLDER (folder_store) &&
+            (tny_folder_get_folder_type (TNY_FOLDER(folder_store)) == TNY_FOLDER_TYPE_OUTBOX))) {
+
                /* We promise to instantly perform the callback, so ... */
                if (callback) {
-                       callback (FALSE, NULL, parent_window, NULL, user_data);
-               }
+                       GError *error = NULL;
+                       g_set_error (&error, TNY_ERROR_DOMAIN, TNY_SERVICE_ERROR_UNKNOWN,
+                                    "Unable to move or not found folder");
+                       callback (FALSE, error, parent_window, NULL, user_data);
+                       g_error_free (error);
+               }
                return;
 
        } else if (TNY_IS_FOLDER (folder_store)) {
index 46a0c55..119667e 100644 (file)
@@ -1978,17 +1978,21 @@ modest_platform_connect_if_remote_and_perform (GtkWindow *parent_window,
                                               gpointer user_data)
 {
        TnyAccount *account = NULL;
-       
-       if (!folder_store) {
+
+       if (!folder_store ||
+           (TNY_IS_MERGE_FOLDER (folder_store) &&
+            (tny_folder_get_folder_type (TNY_FOLDER(folder_store)) == TNY_FOLDER_TYPE_OUTBOX))) {
+
                /* We promise to instantly perform the callback, so ... */
                if (callback) {
-                       callback (FALSE, NULL, parent_window, NULL, user_data);
-               }
-               return; 
-               
-               /* Original comment: Maybe it is something local. */
-               /* PVH's comment: maybe we should KNOW this in stead of assuming? */
-               
+                       GError *error = NULL;
+                       g_set_error (&error, TNY_ERROR_DOMAIN, TNY_SERVICE_ERROR_UNKNOWN,
+                                    "Unable to move or not found folder");
+                       callback (FALSE, error, parent_window, NULL, user_data);
+                       g_error_free (error);
+               }
+               return;
+
        } else if (TNY_IS_FOLDER (folder_store)) {
                /* Get the folder's parent account: */
                account = tny_folder_get_account (TNY_FOLDER (folder_store));
index bfbe71f..549854c 100644 (file)
@@ -5453,14 +5453,14 @@ on_move_folder_cb (gboolean canceled, GError *err, GtkWindow *parent_window,
        MoveFolderInfo *info = (MoveFolderInfo*)user_data;
        GtkTreeSelection *sel;
        ModestMailOperation *mail_op = NULL;
-       
+
        if (canceled || err || !MODEST_IS_WINDOW (parent_window)) {
                g_object_unref (G_OBJECT (info->src_folder));
                g_object_unref (G_OBJECT (info->dst_folder));
                g_free (info);
                return;
        }
-       
+
        MoveToHelper *helper = g_new0 (MoveToHelper, 1);
        helper->banner = modest_platform_animation_banner (GTK_WIDGET (parent_window), NULL,
                        _CS("ckct_nw_pasting"));