#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>
#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>
gulong selection_changed_handler;
gulong acc_removed_handler;
- HeaderViewStatus status;
GList *drag_begin_cached_selected_rows;
+
+ HeaderViewStatus status;
+ guint status_timeout;
};
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->observers_lock = g_mutex_new ();
priv->status = HEADER_VIEW_INIT;
+ priv->status_timeout = 0;
priv->observer_list_lock = g_mutex_new();
priv->observer_list = NULL;
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,
}
if (priv->folder) {
+ if (priv->status_timeout)
+ g_source_remove (priv->status_timeout);
+
g_mutex_lock (priv->observers_lock);
tny_folder_remove_observer (priv->folder, TNY_FOLDER_OBSERVER (self));
g_object_unref (priv->folder);
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);
/* 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;
}
g_object_unref (headers);
}
+typedef struct {
+ ModestHeaderView *self;
+ TnyFolder *folder;
+} NotifyFilterInfo;
+
+static gboolean
+notify_filter_change (gpointer data)
+{
+ NotifyFilterInfo *info = (NotifyFilterInfo *) data;
+
+ g_signal_emit (info->self,
+ signals[MSG_COUNT_CHANGED_SIGNAL],
+ 0, info->folder, NULL);
+
+ return FALSE;
+}
+
+static void
+notify_filter_change_destroy (gpointer data)
+{
+ NotifyFilterInfo *info = (NotifyFilterInfo *) data;
+ g_object_unref (info->self);
+ g_object_unref (info->folder);
+ g_slice_free (NotifyFilterInfo, info);
+}
static gboolean
filter_row (GtkTreeModel *model,
gboolean visible = TRUE;
gboolean found = FALSE;
GValue value = {0,};
-
+ HeaderViewStatus old_status;
+
g_return_val_if_fail (MODEST_IS_HEADER_VIEW (user_data), FALSE);
priv = MODEST_HEADER_VIEW_GET_PRIVATE (user_data);
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;
}
}
frees:
+ old_status = priv->status;
priv->status = ((gboolean) priv->status) && !visible;
-
+ if (priv->status != old_status) {
+ NotifyFilterInfo *info;
+
+ if (priv->status_timeout)
+ g_source_remove (priv->status_timeout);
+
+ info = g_slice_new0 (NotifyFilterInfo);
+ info->self = g_object_ref (G_OBJECT (user_data));
+ info->folder = tny_header_get_folder (header);
+ priv->status_timeout = g_timeout_add_full (G_PRIORITY_DEFAULT, 1000,
+ notify_filter_change,
+ info,
+ notify_filter_change_destroy);
+ }
+
return visible;
}