[Xfce4-commits] [xfce/thunar] 01/01: Remember and restore file selection on view changes

noreply at xfce.org noreply at xfce.org
Wed Apr 1 13:04:52 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 07bb05707192f56eecdc46a9b976093540fd90b3
Author: Harald Judt <h.judt at gmx.at>
Date:   Wed Apr 1 13:03:04 2015 +0200

    Remember and restore file selection on view changes
---
 thunar/thunar-window.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c
index 146ed91..b25e638 100644
--- a/thunar/thunar-window.c
+++ b/thunar/thunar-window.c
@@ -2686,6 +2686,7 @@ thunar_window_action_view_changed (GtkRadioAction *action,
   ThunarFile *file = NULL;
   ThunarFile *current_directory = NULL;
   GtkWidget  *old_view;
+  GList      *selected_files = NULL;
 
   /* drop the previous view (if any) */
   old_view = window->view;
@@ -2700,6 +2701,9 @@ thunar_window_action_view_changed (GtkRadioAction *action,
       if (current_directory != NULL)
         g_object_ref (current_directory);
 
+      /* remember the file selection */
+      selected_files = thunar_g_file_list_copy (thunar_component_get_selected_files (THUNAR_COMPONENT (old_view)));
+
       /* update the UI (else GtkUIManager will crash on merging) */
       gtk_ui_manager_ensure_update (window->ui_manager);
     }
@@ -2732,6 +2736,10 @@ thunar_window_action_view_changed (GtkRadioAction *action,
   if (old_view != NULL)
     gtk_widget_destroy (old_view);
 
+  /* restore the file selection */
+  thunar_component_set_selected_files (THUNAR_COMPONENT (window->view), selected_files);
+  thunar_g_file_list_free (selected_files);
+
   /* remember the setting */
   if (gtk_widget_get_visible (GTK_WIDGET (window)))
     g_object_set (G_OBJECT (window->preferences), "last-view", g_type_name (window->view_type), NULL);

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


More information about the Xfce4-commits mailing list