[Xfce4-commits] [xfce/thunar] 01/01: Let row changes accumulate a bit before restoring selection
noreply at xfce.org
noreply at xfce.org
Sat Apr 18 14:12:11 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 871e25002387fd30e37d0055b748eb41b099b600
Author: Harald Judt <h.judt at gmx.at>
Date: Sat Apr 18 11:32:02 2015 +0200
Let row changes accumulate a bit before restoring selection
With the changes introduced in 4d19f45feb198 "Restore selection on row
changes too (bug #9886)", slight flicker can be noticed when navigating
with forward/back actions. This is because row-changed events sometimes
cause a restore of the selection multiple times.
To solve this, this commit adds a short timeout for restoring the
selection in a similar way as for the status bar text updates.
---
thunar/thunar-standard-view.c | 27 +++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
diff --git a/thunar/thunar-standard-view.c b/thunar/thunar-standard-view.c
index ea96b3b..5c8e7cd 100644
--- a/thunar/thunar-standard-view.c
+++ b/thunar/thunar-standard-view.c
@@ -263,6 +263,7 @@ static void thunar_standard_view_drag_end (Gtk
static void thunar_standard_view_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,
@@ -373,6 +374,7 @@ struct _ThunarStandardViewPrivate
/* selected_files support */
GList *selected_files;
+ guint restore_selection_idle_id;
/* support for generating thumbnails */
ThunarThumbnailer *thumbnailer;
@@ -904,6 +906,10 @@ thunar_standard_view_finalize (GObject *object)
g_signal_handlers_disconnect_matched (G_OBJECT (standard_view->model), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, standard_view);
g_object_unref (G_OBJECT (standard_view->model));
+ /* remove selection restore timeout */
+ if (standard_view->priv->restore_selection_idle_id != 0)
+ g_source_remove (standard_view->priv->restore_selection_idle_id);
+
/* free the statusbar text (if any) */
if (standard_view->priv->statusbar_text_idle_id != 0)
g_source_remove (standard_view->priv->statusbar_text_idle_id);
@@ -3657,6 +3663,18 @@ thunar_standard_view_row_deleted (ThunarListModel *model,
+static gboolean
+thunar_standard_view_restore_selection_idle (ThunarStandardView *standard_view)
+{
+ _thunar_return_if_fail (THUNAR_IS_STANDARD_VIEW (standard_view));
+
+ thunar_component_restore_selection (THUNAR_COMPONENT (standard_view));
+ standard_view->priv->restore_selection_idle_id = 0;
+ return FALSE;
+}
+
+
+
static void
thunar_standard_view_row_changed (ThunarListModel *model,
GtkTreePath *path,
@@ -3671,8 +3689,13 @@ thunar_standard_view_row_changed (ThunarListModel *model,
_thunar_return_if_fail (standard_view->model == model);
/* the order of the paths might have changed, but the selection
- stayed the same, so restore the selection of the proper files */
- thunar_component_restore_selection (THUNAR_COMPONENT (standard_view));
+ * stayed the same, so restore the selection of the proper files
+ * after letting row changes accumulate a bit */
+ if (standard_view->priv->restore_selection_idle_id == 0)
+ standard_view->priv->restore_selection_idle_id =
+ g_timeout_add (50,
+ (GSourceFunc) thunar_standard_view_restore_selection_idle,
+ standard_view);
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