* src/widgets/modest-attachment-view.c:
[modest] / src / widgets / modest-header-view.c
index ce0fd9b..097c2e6 100644 (file)
@@ -31,6 +31,7 @@
 #include <tny-list.h>
 #include <tny-simple-list.h>
 #include <tny-folder-monitor.h>
+#include <tny-folder-change.h>
 #include <string.h>
 
 #include <modest-header-view.h>
@@ -990,7 +991,7 @@ typedef struct {
 } SetFolderHelper;
 
 static void
-folder_refreshed_cb (const GObject *obj, 
+folder_refreshed_cb (ModestMailOperation *mail_op,
                     TnyFolder *folder, 
                     gpointer user_data)
 {
@@ -1003,7 +1004,7 @@ folder_refreshed_cb (const GObject *obj,
 
        /* User callback */
        if (info->cb)
-               info->cb (obj, folder, info->user_data);
+               info->cb (mail_op, folder, info->user_data);
 
        /* Start the folder count changes observer. We do not need it
           before the refresh. Note that the monitor could still be
@@ -1040,6 +1041,7 @@ modest_header_view_set_folder (ModestHeaderView *self,
 
        if (folder) {
                ModestMailOperation *mail_op = NULL;
+                GtkTreeSelection *selection;
 
                /* Get main window to use it as source of mail operation */
                mgr = modest_runtime_get_window_mgr ();
@@ -1059,6 +1061,10 @@ modest_header_view_set_folder (ModestHeaderView *self,
                info->cb = callback;
                info->user_data = user_data;
 
+               /* bug 57631: Clear the selection if exists */
+               selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(self));
+               gtk_tree_selection_unselect_all(selection);
+
                /* Create the mail operation (source will be the parent widget) */
                mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_TYPE_RECEIVE, source);
                modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
@@ -1271,6 +1277,7 @@ drag_data_get_cb (GtkWidget *widget, GdkDragContext *context,
        GtkTreeModel *model = NULL;
        GtkTreeIter iter;
        GtkTreePath *source_row = NULL;
+       GtkTreeSelection *sel = NULL;   
        
        source_row = get_selected_row (GTK_TREE_VIEW (widget), &model);
        if ((source_row == NULL) || (!gtk_tree_model_get_iter(model, &iter, source_row))) return;
@@ -1293,6 +1300,11 @@ drag_data_get_cb (GtkWidget *widget, GdkDragContext *context,
                g_message ("%s: default switch case.", __FUNCTION__);
        }
 
+       /* Set focus on next header */
+       sel = gtk_tree_view_get_selection(GTK_TREE_VIEW (widget));
+       gtk_tree_path_next (source_row);
+       gtk_tree_selection_select_path (sel, source_row);
+
        gtk_tree_path_free (source_row);
 }
 
@@ -1474,7 +1486,7 @@ folder_monitor_update (TnyFolderObserver *self,
 
        /* Check folder count */
        if ((changed & TNY_FOLDER_CHANGE_CHANGED_ADDED_HEADERS) ||
-           (changed & TNY_FOLDER_CHANGE_CHANGED_REMOVED_HEADERS)) {
+           (changed & TNY_FOLDER_CHANGE_CHANGED_EXPUNGED_HEADERS)) {
                helper = g_slice_new0 (HeadersCountChangedHelper);
                helper->self = MODEST_HEADER_VIEW(self);
                helper->change = g_object_ref(change);