#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>
HeaderViewStatus status;
guint status_timeout;
+ gboolean notify_status; /* whether or not the filter_row should notify about changes in the filtering */
};
typedef struct _HeadersCountChangedHelper HeadersCountChangedHelper;
static void
tny_folder_observer_init (TnyFolderObserverIface *klass)
{
- klass->update_func = folder_monitor_update;
+ klass->update = folder_monitor_update;
}
static GtkTreeViewColumn*
g_object_set (G_OBJECT (renderer_subject),
"ellipsize", PANGO_ELLIPSIZE_END, "yalign", 1.0,
NULL);
+ gtk_cell_renderer_text_set_fixed_height_from_font (GTK_CELL_RENDERER_TEXT (renderer_subject), 1);
g_object_set (G_OBJECT (renderer_recpt),
"ellipsize", PANGO_ELLIPSIZE_END, "yalign", 0.0,
NULL);
+ gtk_cell_renderer_text_set_fixed_height_from_font (GTK_CELL_RENDERER_TEXT (renderer_recpt), 1);
g_object_set(G_OBJECT(renderer_compact_date_or_status),
"xalign", 1.0, "yalign", 0.0,
NULL);
+ gtk_cell_renderer_text_set_fixed_height_from_font (GTK_CELL_RENDERER_TEXT (renderer_compact_date_or_status), 1);
g_object_set (G_OBJECT (renderer_priority),
"yalign", 1.0, NULL);
g_object_set (G_OBJECT (renderer_attach),
priv->status = HEADER_VIEW_INIT;
priv->status_timeout = 0;
+ priv->notify_status = TRUE;
priv->observer_list_lock = g_mutex_new();
priv->observer_list = NULL;
g_signal_emit (G_OBJECT (info->header_view),
signals[UPDATING_MSG_LIST_SIGNAL], 0, FALSE, NULL);
+ /* Allow filtering notifications from now on if the current
+ folder is still the same (if not then the user has selected
+ another one to refresh, we should wait until that refresh
+ finishes) */
+ if (priv->folder == folder)
+ priv->notify_status = TRUE;
+
/* Frees */
g_object_unref (info->header_view);
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,
/* Pick my reference. Nothing to do with the mail operation */
priv->folder = g_object_ref (folder);
+ /* Do not notify about filterings until the refresh finishes */
+ priv->notify_status = FALSE;
+
/* Clear the selection if exists */
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(self));
gtk_tree_selection_unselect_all(selection);
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);
/* Check hiding */
if (priv->hidding_ids != NULL) {
- id = g_strdup(tny_header_get_message_id (header));
+ id = tny_header_dup_message_id (header);
for (i=0; i < priv->n_selected && !found; i++)
if (priv->hidding_ids[i] != NULL && id != NULL)
found = (!strcmp (priv->hidding_ids[i], id));
frees:
old_status = priv->status;
priv->status = ((gboolean) priv->status) && !visible;
- if (priv->status != old_status) {
+ if ((priv->notify_status) && (priv->status != old_status)) {
NotifyFilterInfo *info;
if (priv->status_timeout)
my_account = tny_folder_get_account (priv->folder);
if (my_account == account)
modest_header_view_clear (MODEST_HEADER_VIEW (user_data));
- g_object_unref (account);
+ g_object_unref (my_account);
}
}