[dconf-editor] Do not update bookmarks if they didn't change.



commit efaada78885ce8ed2796e227d4ad4f90a192c266
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Fri Jul 8 00:28:51 2016 +0200

    Do not update bookmarks if they didn't change.

 editor/bookmarks.vala |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/editor/bookmarks.vala b/editor/bookmarks.vala
index b366bed..a22897d 100644
--- a/editor/bookmarks.vala
+++ b/editor/bookmarks.vala
@@ -31,15 +31,18 @@ public class Bookmarks : MenuButton
     private GLib.Settings settings;
     private GLib.ListStore bookmarks_model;
 
+    private string [] current_bookmarks;
+
     public signal bool bookmark_activated (string bookmark);
 
     construct
     {
         settings = new GLib.Settings (schema_id);
+        current_bookmarks = settings.get_strv ("bookmarks");
         settings.changed ["bookmarks"].connect (update_bookmarks);
         settings.changed ["bookmarks"].connect (update_icon_and_switch);    // TODO updates switch if switch 
changed settings...
         notify ["current-path"].connect (update_icon_and_switch);
-        bookmarked_switch.notify ["active"].connect (switch_changed_cb);    // TODO activated when 
current_path changes...
+        bookmarked_switch.notify ["active"].connect (switch_changed_cb);    // TODO activated when 
current_path changes; see current_bookmarks
         update_bookmarks ();
         bookmarked_switch.grab_focus ();
     }
@@ -69,6 +72,9 @@ public class Bookmarks : MenuButton
         bookmarks_popover.closed ();
 
         string [] bookmarks = settings.get_strv ("bookmarks");
+        if (bookmarks == current_bookmarks)
+            return;
+
         if (!bookmarked_switch.get_active ())
             remove_bookmark (current_path);
         else if (!(current_path in bookmarks))


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