* Fixes NB60606, "Device memory full" information note is now shown when there is...
authorSergio Villar Senin <svillar@igalia.com>
Tue, 29 Jan 2008 17:03:10 +0000 (17:03 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Tue, 29 Jan 2008 17:03:10 +0000 (17:03 +0000)
pmo-trunk-r4103

src/modest-mail-operation.c
src/modest-ui-actions.c
src/widgets/modest-header-view.c

index 27f62c4..a15ea5d 100644 (file)
@@ -2161,10 +2161,15 @@ get_msg_async_cb (TnyFolder *folder,
        /* Check errors */
        if (canceled || err) {
                priv->status = MODEST_MAIL_OPERATION_STATUS_FINISHED_WITH_ERRORS;
-               if (!priv->error)
+               if (err) {
+                       priv->error = g_error_copy ((const GError *) err);
+                       priv->error->domain = MODEST_MAIL_OPERATION_ERROR;
+               }
+               if (!priv->error) {
                        g_set_error (&(priv->error), MODEST_MAIL_OPERATION_ERROR,
                                     MODEST_MAIL_OPERATION_ERROR_ITEM_NOT_FOUND,
                                     err->message);
+               }
        } else if (finished && priv->status == MODEST_MAIL_OPERATION_STATUS_IN_PROGRESS) {
                /* Set the success status before calling the user callback */
                priv->status = MODEST_MAIL_OPERATION_STATUS_SUCCESS;
index eaa9bc5..5355be5 100644 (file)
@@ -1000,14 +1000,18 @@ modest_ui_actions_get_msgs_full_error_handler (ModestMailOperation *mail_op,
 {
        const GError *error;
        GObject *win = NULL;
-       const gchar *err_msg = (const gchar *) user_data;
 
        win = modest_mail_operation_get_source (mail_op);
        error = modest_mail_operation_get_error (mail_op);
 
        /* Show error */
-       if (err_msg)
-               modest_platform_run_information_dialog ((GtkWindow *) win, err_msg);
+       if (error->code == TNY_SYSTEM_ERROR_MEMORY ||
+           error->code == TNY_IO_ERROR_WRITE ||
+           error->code == TNY_IO_ERROR_READ) {
+               modest_platform_information_banner ((GtkWidget *) win, 
+                                                   NULL, dgettext("ke-recv", 
+                                                                  "cerm_device_memory_full"));
+       }
 
        if (win)
                g_object_unref (win);
index 9b169b8..3080d94 100644 (file)
@@ -32,6 +32,7 @@
 #include <tny-simple-list.h>
 #include <tny-folder-monitor.h>
 #include <tny-folder-change.h>
+#include <tny-error.h>
 #include <string.h>
 
 #include <modest-header-view.h>
@@ -1184,6 +1185,21 @@ folder_refreshed_cb (ModestMailOperation *mail_op,
        g_free (info);
 }
 
+static void
+refresh_folder_error_handler (ModestMailOperation *mail_op, 
+                             gpointer user_data)
+{
+       const GError *error = modest_mail_operation_get_error (mail_op);
+
+       if (error->code == TNY_SYSTEM_ERROR_MEMORY ||
+           error->code == TNY_IO_ERROR_WRITE ||
+           error->code == TNY_IO_ERROR_READ) {
+               modest_platform_information_banner (NULL, NULL, 
+                                                   dgettext("ke-recv", 
+                                                            "cerm_device_memory_full"));
+       }
+}
+
 void
 modest_header_view_set_folder (ModestHeaderView *self, 
                               TnyFolder *folder,
@@ -1242,7 +1258,9 @@ modest_header_view_set_folder (ModestHeaderView *self,
                info->user_data = user_data;
 
                /* Create the mail operation (source will be the parent widget) */
-               mail_op = modest_mail_operation_new (G_OBJECT(main_win));
+               mail_op = modest_mail_operation_new_with_error_handling (G_OBJECT(main_win),
+                                                                        refresh_folder_error_handler,
+                                                                        NULL, NULL);
                modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
                                                 mail_op);