* src/modest-ui-actions.c:
[modest] / src / widgets / modest-header-view.c
index ead0760..0d93336 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>
@@ -40,7 +41,7 @@
 #include <modest-tny-folder.h>
 #include <modest-debug.h>
 #include <modest-main-window.h>
-
+#include <modest-ui-actions.h>
 #include <modest-marshal.h>
 #include <modest-text-utils.h>
 #include <modest-icon-names.h>
@@ -284,7 +285,7 @@ modest_header_view_class_init (ModestHeaderViewClass *klass)
 static void
 tny_folder_observer_init (TnyFolderObserverIface *klass)
 {
-       klass->update_func = folder_monitor_update;
+       klass->update = folder_monitor_update;
 }
 
 static GtkTreeViewColumn*
@@ -1184,6 +1185,25 @@ 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) {
+               ModestMailOperationStatus st = modest_mail_operation_get_status (mail_op);
+               /* If the mail op has been cancelled then it's not an error: don't show any message */
+               if (st != MODEST_MAIL_OPERATION_STATUS_CANCELED) {
+                       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 +1262,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);
 
@@ -1300,7 +1322,12 @@ on_header_row_activated (GtkTreeView *treeview, GtkTreePath *path,
 
        /* Dont open DELETED messages */
        if (flags & TNY_HEADER_FLAG_DELETED) {
-               modest_platform_information_banner (NULL, NULL, _("mcen_ib_message_already_deleted"));
+               GtkWidget *win;
+               gchar *msg;
+               win = gtk_widget_get_ancestor (GTK_WIDGET (treeview), GTK_TYPE_WINDOW);
+               msg = modest_ui_actions_get_msg_already_deleted_error_msg (MODEST_WINDOW (win));
+               modest_platform_information_banner (NULL, NULL, msg);
+               g_free (msg);
                goto frees;
        }
 
@@ -1931,8 +1958,9 @@ filter_row (GtkTreeModel *model,
        header = (TnyHeader *) g_value_get_object (&value);
        g_value_unset (&value);
        
-       /* Hide mark as deleted heders */
-       if (flags & TNY_HEADER_FLAG_DELETED) {
+       /* Hide deleted and mark as deleted heders */
+       if (flags & TNY_HEADER_FLAG_DELETED ||
+           flags & TNY_HEADER_FLAG_EXPUNGED) {
                visible = FALSE;
                goto frees;
        }