[nautilus/wip/gbsneto/cleanups: 3/3] view: only change setting when action value changes



commit 0b7d2c7e6041c41da6f7a82a3c928163596da69f
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Jul 29 09:50:32 2015 -0300

    view: only change setting when action value changes
    
    Commit 2e1ac98 introduced the new behavior of persistently
    storing the show-hidden setting whenever it changes.
    
    This, however, caused an update cycle, since NautilusView
    was watching for any modifications on show-hidden settings
    and, on changes, it saves the value again. By blindly saving
    the value, without checking if it differs from the current,
    it enters in a cycle of update & save cycle.
    
    Fix that by only storing the show-hidden setting when it
    differs from the current one.

 src/nautilus-view.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/nautilus-view.c b/src/nautilus-view.c
index 3f8025c..56f7f57 100644
--- a/src/nautilus-view.c
+++ b/src/nautilus-view.c
@@ -2284,6 +2284,11 @@ nautilus_view_set_show_hidden_files (NautilusView *view,
 
        if (show_hidden != view->details->show_hidden_files) {
                view->details->show_hidden_files = show_hidden;
+
+                g_settings_set_boolean (gtk_filechooser_preferences,
+                                        NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES,
+                                        show_hidden);
+
                if (view->details->model != NULL) {
                        load_directory (view, view->details->model);
                }
@@ -2305,9 +2310,6 @@ action_show_hidden_files (GSimpleAction *action,
 
        nautilus_view_set_show_hidden_files (view, show_hidden);
 
-        g_settings_set_boolean (gtk_filechooser_preferences,
-                                NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES,
-                                show_hidden);
        g_simple_action_set_state (action, state);
 }
 


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