[nautilus/gnome-3-20] files-view: extract function for handling file changes



commit 2368ea7460f56a0a646afefb4af5cae285bdd6c3
Author: Carlos Soriano <csoriano gnome org>
Date:   Mon Mar 14 22:12:54 2016 +0100

    files-view: extract function for handling file changes
    
    We were handling this case inside the same function that emits the
    signal.
    
    We just want to react to the signal, not to do everything inside the
    function that happen to be the one emitting the signal.

 src/nautilus-files-view.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 76326f2..69bab53 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -3586,6 +3586,15 @@ process_new_files (NautilusFilesView *view)
 }
 
 static void
+on_end_file_changes (NautilusFilesView *view)
+{
+        /* Addition and removal of files modify the empty state */
+        check_empty_states (view);
+        /* If the view is empty, zoom slider and sort menu are insensitive */
+        nautilus_files_view_update_toolbar_menus (view);
+}
+
+static void
 process_old_files (NautilusFilesView *view)
 {
         GList *files_added, *files_changed, *node;
@@ -3616,7 +3625,6 @@ process_old_files (NautilusFilesView *view)
                 }
 
                 g_signal_emit (view, signals[END_FILE_CHANGES], 0);
-                check_empty_states (view);
 
                 if (files_changed != NULL) {
                         selection = nautilus_view_get_selection (NAUTILUS_VIEW (view));
@@ -8107,6 +8115,11 @@ nautilus_files_view_init (NautilusFilesView *view)
         g_signal_connect (view->details->zoom_level_scale, "value-changed",
                           G_CALLBACK (zoom_level_changed), view);
 
+        g_signal_connect (view,
+                          "end-file-changes",
+                          G_CALLBACK (on_end_file_changes),
+                          view);
+
         g_object_unref (builder);
 
         /* Main widgets */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]