[nautilus] Only save zoom level if the user has updated it



commit f11846898bd37f8886a278276b20258f131a4a4d
Author: Mike Gorse <mgorse suse com>
Date:   Mon Jun 20 11:31:26 2016 -0500

    Only save zoom level if the user has updated it
    
    Don't write the zoom level to gsettings if the user has not made a
    change from the system default. This allows an update to be installed
    and then rolled back without a system default from the update having
    been written to the user's configuration.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=767878

 src/nautilus-canvas-view.c |    9 ++++++---
 src/nautilus-list-view.c   |    9 ++++++---
 2 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/src/nautilus-canvas-view.c b/src/nautilus-canvas-view.c
index e41c55a..9cd3f34 100644
--- a/src/nautilus-canvas-view.c
+++ b/src/nautilus-canvas-view.c
@@ -958,9 +958,12 @@ action_zoom_to_level (GSimpleAction *action,
        nautilus_canvas_view_zoom_to_level (view, zoom_level);
 
        g_simple_action_set_state (G_SIMPLE_ACTION (action), state);
-       g_settings_set_enum (nautilus_icon_view_preferences,
-                             NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL,
-                             zoom_level);
+       if (g_settings_get_enum (nautilus_icon_view_preferences,
+                             NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL) != zoom_level) {
+               g_settings_set_enum (nautilus_icon_view_preferences,
+                                     NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL,
+                                     zoom_level);
+       }
 }
 
 static void
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index f23f4ce..ea5645b 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -2505,9 +2505,12 @@ action_zoom_to_level (GSimpleAction *action,
        nautilus_list_view_zoom_to_level (view, zoom_level);
 
        g_simple_action_set_state (G_SIMPLE_ACTION (action), state);
-       g_settings_set_enum (nautilus_list_view_preferences,
-                             NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL,
-                             zoom_level);
+       if (g_settings_get_enum (nautilus_list_view_preferences,
+                                 NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL) != zoom_level) {
+               g_settings_set_enum (nautilus_list_view_preferences,
+                                     NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL,
+                                     zoom_level);
+       }
 }
 
 static void


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