* Fixes NB#84551, allow changes in the outbox server authentication methods while...
[modest] / src / widgets / modest-header-view.c
index 3080d94..cee8ad6 100644 (file)
@@ -155,6 +155,7 @@ struct _ModestHeaderViewPrivate {
 
        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;
@@ -389,12 +390,15 @@ modest_header_view_set_columns (ModestHeaderView *self, const GList *columns, Tn
        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),
@@ -562,6 +566,7 @@ modest_header_view_init (ModestHeaderView *obj)
 
        priv->status  = HEADER_VIEW_INIT;
        priv->status_timeout = 0;
+       priv->notify_status = TRUE;
 
        priv->observer_list_lock = g_mutex_new();
        priv->observer_list = NULL;
@@ -1180,6 +1185,13 @@ folder_refreshed_cb (ModestMailOperation *mail_op,
        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);
@@ -1194,9 +1206,13 @@ refresh_folder_error_handler (ModestMailOperation *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"));
+               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"));
+               }
        }
 }
 
@@ -1242,6 +1258,9 @@ modest_header_view_set_folder (ModestHeaderView *self,
                /* 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);
@@ -1975,7 +1994,7 @@ filter_row (GtkTreeModel *model,
        
        /* 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));
@@ -1987,7 +2006,7 @@ filter_row (GtkTreeModel *model,
  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)
@@ -2061,7 +2080,7 @@ on_account_removed (TnyAccountStore *self,
                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);
        }
 }