[Xfce4-commits] [xfce/thunar] 02/06: Restore selection only when rows-reordered signal is received (bug #11855)

noreply at xfce.org noreply at xfce.org
Sun May 3 15:00:14 CEST 2015


This is an automated email from the git hooks/post-receive script.

hjudt pushed a commit to branch master
in repository xfce/thunar.

commit 8ed38783d6a831cdc70a34d90a7f82fe4350ff74
Author: Harald Judt <h.judt at gmx.at>
Date:   Fri May 1 12:37:31 2015 +0200

    Restore selection only when rows-reordered signal is received (bug #11855)
    
    Commit 4d19f45feb198b "Restore selection on row changes too (bug #9886)"
    forced the file selection to be restored on row changes, which has the
    negative side effect that the view will also scroll to the selected
    file(s) whenever such a change happens, e.g. when thumbnailing finishes.
    
    The better fix is to listen to the rows-reordered signal which no view
    listens to at the moment. This commit implements this.
---
 thunar/thunar-standard-view.c |   38 +++++++++++++++++++++++++++++---------
 1 file changed, 29 insertions(+), 9 deletions(-)

diff --git a/thunar/thunar-standard-view.c b/thunar/thunar-standard-view.c
index ecd7efb..550545c 100644
--- a/thunar/thunar-standard-view.c
+++ b/thunar/thunar-standard-view.c
@@ -264,13 +264,18 @@ static void                 thunar_standard_view_drag_end                   (Gtk
 static void                 thunar_standard_view_row_deleted                (ThunarListModel          *model,
                                                                              GtkTreePath              *path,
                                                                              ThunarStandardView       *standard_view);
+static void                 thunar_standard_view_select_after_row_deleted   (ThunarListModel          *model,
+                                                                             GtkTreePath              *path,
+                                                                             ThunarStandardView       *standard_view);
 static gboolean             thunar_standard_view_restore_selection_idle     (ThunarStandardView       *standard_view);
 static void                 thunar_standard_view_row_changed                (ThunarListModel          *model,
                                                                              GtkTreePath              *path,
                                                                              GtkTreeIter              *iter,
                                                                              ThunarStandardView       *standard_view);
-static void                 thunar_standard_view_select_after_row_deleted   (ThunarListModel          *model,
+static void                 thunar_standard_view_rows_reordered             (ThunarListModel          *tree_model,
                                                                              GtkTreePath              *path,
+                                                                             GtkTreeIter              *iter,
+                                                                             gpointer                  new_order,
                                                                              ThunarStandardView       *standard_view);
 static void                 thunar_standard_view_error                      (ThunarListModel          *model,
                                                                              const GError             *error,
@@ -691,8 +696,9 @@ thunar_standard_view_init (ThunarStandardView *standard_view)
   /* setup the list model */
   standard_view->model = thunar_list_model_new ();
   g_signal_connect (G_OBJECT (standard_view->model), "row-deleted", G_CALLBACK (thunar_standard_view_row_deleted), standard_view);
-  standard_view->priv->row_changed_id = g_signal_connect (G_OBJECT (standard_view->model), "row-changed", G_CALLBACK (thunar_standard_view_row_changed), standard_view);
   g_signal_connect_after (G_OBJECT (standard_view->model), "row-deleted", G_CALLBACK (thunar_standard_view_select_after_row_deleted), standard_view);
+  standard_view->priv->row_changed_id = g_signal_connect (G_OBJECT (standard_view->model), "row-changed", G_CALLBACK (thunar_standard_view_row_changed), standard_view);
+  g_signal_connect (G_OBJECT (standard_view->model), "rows-reordered", G_CALLBACK (thunar_standard_view_rows_reordered), standard_view);
   g_signal_connect (G_OBJECT (standard_view->model), "error", G_CALLBACK (thunar_standard_view_error), standard_view);
   exo_binding_new (G_OBJECT (standard_view->preferences), "misc-case-sensitive", G_OBJECT (standard_view->model), "case-sensitive");
   exo_binding_new (G_OBJECT (standard_view->preferences), "misc-date-style", G_OBJECT (standard_view->model), "date-style");
@@ -3678,15 +3684,13 @@ thunar_standard_view_restore_selection_idle (ThunarStandardView *standard_view)
 
 
 static void
-thunar_standard_view_row_changed (ThunarListModel    *model,
-                                  GtkTreePath        *path,
-                                  GtkTreeIter        *iter,
-                                  ThunarStandardView *standard_view)
+thunar_standard_view_rows_reordered (ThunarListModel    *tree_model,
+                                     GtkTreePath        *path,
+                                     GtkTreeIter        *iter,
+                                     gpointer            new_order,
+                                     ThunarStandardView *standard_view)
 {
-  ThunarFile *file;
-
   _thunar_return_if_fail (THUNAR_IS_LIST_MODEL (model));
-  _thunar_return_if_fail (path != NULL);
   _thunar_return_if_fail (THUNAR_IS_STANDARD_VIEW (standard_view));
   _thunar_return_if_fail (standard_view->model == model);
 
@@ -3698,6 +3702,22 @@ thunar_standard_view_row_changed (ThunarListModel    *model,
       g_timeout_add (50,
                      (GSourceFunc) thunar_standard_view_restore_selection_idle,
                      standard_view);
+}
+
+
+
+static void
+thunar_standard_view_row_changed (ThunarListModel    *model,
+                                  GtkTreePath        *path,
+                                  GtkTreeIter        *iter,
+                                  ThunarStandardView *standard_view)
+{
+  ThunarFile *file;
+
+  _thunar_return_if_fail (THUNAR_IS_LIST_MODEL (model));
+  _thunar_return_if_fail (path != NULL);
+  _thunar_return_if_fail (THUNAR_IS_STANDARD_VIEW (standard_view));
+  _thunar_return_if_fail (standard_view->model == model);
 
   if (standard_view->priv->thumbnail_request != 0)
     return;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list