[dconf-editor] Use GSettings in BookmarksList.



commit bcdef3141245202630f3eccff81705379f326304
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Sun Oct 21 05:30:58 2018 +0200

    Use GSettings in BookmarksList.

 editor/bookmarks-list.vala    | 173 +++++++++++++++++++++++++++++-----
 editor/bookmarks.ui           |   5 +-
 editor/bookmarks.vala         | 214 +++++++++++++-----------------------------
 editor/browser-headerbar.vala |   2 +-
 4 files changed, 221 insertions(+), 173 deletions(-)
---
diff --git a/editor/bookmarks-list.vala b/editor/bookmarks-list.vala
index c7eb2ee..aa5044e 100644
--- a/editor/bookmarks-list.vala
+++ b/editor/bookmarks-list.vala
@@ -33,6 +33,44 @@ private class BookmarksList : Overlay
     private Bookmark? last_row = null;
     private uint n_bookmarks = 0;
 
+    private string schema_id = "ca.desrt.dconf-editor.Bookmarks";   // TODO move in a library
+    private GLib.Settings settings;
+    ulong bookmarks_changed_handler = 0;
+
+    public string schema_path
+    {
+        internal set
+        {
+            settings = new GLib.Settings.with_path (schema_id, value);
+
+            bookmarks_changed_handler = settings.changed ["bookmarks"].connect (on_bookmarks_changed);
+            create_bookmark_rows (settings.get_value ("bookmarks"));
+
+            ulong bookmarks_writable_handler = settings.writable_changed ["bookmarks"].connect 
(on_writability_changed);
+
+            bookmarks_changed (settings.get_value ("bookmarks"), settings.is_writable ("bookmarks"));
+
+            destroy.connect (() => {
+                    settings.disconnect (bookmarks_changed_handler);
+                    settings.disconnect (bookmarks_writable_handler);
+                });
+        }
+    }
+
+    internal signal void bookmarks_changed (Variant bookmarks_variant, bool writable);
+    private void on_bookmarks_changed (GLib.Settings _settings, string key)
+    {
+        Variant bookmarks_variant = _settings.get_value (key);
+        create_bookmark_rows (bookmarks_variant);
+        bookmarks_changed (bookmarks_variant, _settings.is_writable (key));
+    }
+
+    internal signal void writability_changed (bool writable);
+    private void on_writability_changed (GLib.Settings _settings, string key)
+    {
+        writability_changed (_settings.is_writable (key));
+    }
+
     internal signal void selection_changed ();
 
     internal enum SelectionState {
@@ -96,11 +134,24 @@ private class BookmarksList : Overlay
         return give_focus_to_switch;
     }
 
-    internal string [] get_bookmarks ()
+    internal Variant get_bookmarks_as_variant ()
     {
-        string [] bookmarks = new string [0];
-        bookmarks_list_box.@foreach ((widget) => { bookmarks += ((Bookmark) widget).bookmark_name; });
-        return bookmarks;
+        return settings.get_value ("bookmarks");
+    }
+
+    internal string [] get_bookmarks_as_array ()
+    {
+        string [] all_bookmarks = settings.get_strv ("bookmarks");
+        string [] unduplicated_bookmarks = {};
+        foreach (string bookmark in all_bookmarks)
+        {
+            if (DConfWindow.is_path_invalid (bookmark))
+                continue;
+            if (bookmark in unduplicated_bookmarks)
+                continue;
+            unduplicated_bookmarks += bookmark;
+        }
+        return unduplicated_bookmarks;
     }
 
     private bool has_empty_list_class = false;
@@ -254,17 +305,18 @@ private class BookmarksList : Overlay
     * * remote action entries
     \*/
 
-    internal void trash_bookmark (out string [] bookmarks_to_remove)
+    internal signal void update_bookmarks_icons (Variant bookmarks_variant);
+    internal void trash_bookmark ()
     {
         ListBoxRow? row = (ListBoxRow?) bookmarks_list_box.get_focus_child ();
         bool focused_row_will_survive = row != null && !((!) row).is_selected ();
 
-        string [] _bookmarks_to_remove = new string [0];
+        string [] bookmarks_to_remove = new string [0];
         int upper_index = int.MAX;
         bookmarks_list_box.selected_foreach ((_list_box, selected_row) => {
                 if (!(selected_row is Bookmark))
                     assert_not_reached ();
-                _bookmarks_to_remove += ((Bookmark) selected_row).bookmark_name;
+                bookmarks_to_remove += ((Bookmark) selected_row).bookmark_name;
 
                 if (focused_row_will_survive)
                     return;
@@ -289,23 +341,24 @@ private class BookmarksList : Overlay
         if (row != null)
             bookmarks_list_box.select_row ((!) row);
 
-        bookmarks_to_remove = _bookmarks_to_remove;
+        remove_bookmarks (settings, bookmarks_to_remove);
+        update_bookmarks_icons (settings.get_value ("bookmarks"));
     }
 
-    internal bool move_top ()
+    internal void move_top ()
     {
 //        bookmarks_list_box.selected_foreach ((_list_box, selected_row) => {
 
         ListBoxRow? row = bookmarks_list_box.get_selected_row ();
         if (row == null)
-            return true; // TODO assert_not_reached?
+            return; // TODO assert_not_reached?
 
         int index = ((!) row).get_index ();
         if (index < 0)
             assert_not_reached ();
 
         if (index == 0)
-            return true;
+            return;
         bookmarks_list_box.remove ((!) row);
         bookmarks_list_box.prepend ((!) row);
         select_row_for_real ((!) row);
@@ -313,21 +366,21 @@ private class BookmarksList : Overlay
         Adjustment adjustment = bookmarks_list_box.get_adjustment ();
         adjustment.set_value (adjustment.get_lower ());
 
-        return false;
+        update_bookmarks_after_move ();
     }
 
-    internal bool move_up ()
+    internal void move_up ()
     {
         ListBoxRow? row = bookmarks_list_box.get_selected_row ();
         if (row == null)
-            return true; // TODO assert_not_reached?
+            return; // TODO assert_not_reached?
 
         int index = ((!) row).get_index ();
         if (index < 0)
             assert_not_reached ();
 
         if (index == 0)
-            return true;
+            return;
 
         ListBoxRow? prev_row = bookmarks_list_box.get_row_at_index (index - 1);
         if (prev_row == null)
@@ -352,14 +405,14 @@ private class BookmarksList : Overlay
         bookmarks_list_box.insert ((!) prev_row, index);
         bookmarks_list_box.select_row ((!) row);
 
-        return false;
+        update_bookmarks_after_move ();
     }
 
-    internal bool move_down ()
+    internal void move_down ()
     {
         ListBoxRow? row = bookmarks_list_box.get_selected_row ();
         if (row == null)
-            return true; // TODO assert_not_reached?
+            return; // TODO assert_not_reached?
 
         int index = ((!) row).get_index ();
         if (index < 0)
@@ -367,7 +420,7 @@ private class BookmarksList : Overlay
 
         ListBoxRow? next_row = bookmarks_list_box.get_row_at_index (index + 1);
         if (next_row == null)
-            return true;
+            return;
 
         Allocation list_allocation, row_allocation;
         scrolled.get_allocation (out list_allocation);
@@ -388,16 +441,16 @@ private class BookmarksList : Overlay
         bookmarks_list_box.insert ((!) next_row, index);
         bookmarks_list_box.select_row ((!) row);
 
-        return false;
+        update_bookmarks_after_move ();
     }
 
-    internal bool move_bottom ()
+    internal void move_bottom ()
     {
 //        bookmarks_list_box.selected_foreach ((_list_box, selected_row) => {
 
         ListBoxRow? row = bookmarks_list_box.get_selected_row ();
         if (row == null)
-            return true; // TODO assert_not_reached?
+            return; // TODO assert_not_reached?
 
         int index = ((!) row).get_index ();
         if (index < 0)
@@ -410,7 +463,7 @@ private class BookmarksList : Overlay
         Adjustment adjustment = bookmarks_list_box.get_adjustment ();
         adjustment.set_value (adjustment.get_upper ());
 
-        return false;
+        update_bookmarks_after_move ();
     }
 
     private void select_row_for_real (ListBoxRow row)   // ahem...
@@ -441,6 +494,80 @@ private class BookmarksList : Overlay
         else
             edit_mode_box.show ();
     }
+    /*\
+    * * Bookmarks management
+    \*/
+
+    private void update_bookmarks_after_move ()
+    {
+        string [] new_bookmarks = get_bookmarks_list (ref bookmarks_list_box);
+
+        string [] old_bookmarks = settings.get_strv ("bookmarks");  // be cool :-)
+        foreach (string bookmark in old_bookmarks)
+            if (!(bookmark in new_bookmarks))
+                new_bookmarks += bookmark;
+
+        SignalHandler.block (settings, bookmarks_changed_handler);
+        settings.set_strv ("bookmarks", new_bookmarks);
+        GLib.Settings.sync ();   // TODO better? really needed?
+        SignalHandler.unblock (settings, bookmarks_changed_handler);
+    }
+    private static string [] get_bookmarks_list (ref ListBox bookmarks_list_box)
+    {
+        string [] bookmarks = new string [0];
+        bookmarks_list_box.@foreach ((widget) => { bookmarks += ((Bookmark) widget).bookmark_name; });
+        return bookmarks;
+    }
+
+    internal void append_bookmark (string bookmark, ViewType type)
+    {
+        _append_bookmark (settings, get_bookmark_name (bookmark, type));
+    }
+    private static void _append_bookmark (GLib.Settings settings, string bookmark_name)
+    {
+        string [] bookmarks = settings.get_strv ("bookmarks");
+        if (bookmark_name in bookmarks)
+            return;
+
+        bookmarks += bookmark_name;
+        settings.set_strv ("bookmarks", bookmarks);
+    }
+
+    internal void remove_bookmark (string bookmark, ViewType type)
+    {
+        _remove_bookmark (settings, get_bookmark_name (bookmark, type));
+    }
+    private static void _remove_bookmark (GLib.Settings settings, string bookmark_name)
+    {
+        string [] old_bookmarks = settings.get_strv ("bookmarks");
+        if (!(bookmark_name in old_bookmarks))
+            return;
+
+        string [] new_bookmarks = new string [0];
+        foreach (string bookmark in old_bookmarks)
+            if (bookmark != bookmark_name && !(bookmark in new_bookmarks))
+                new_bookmarks += bookmark;
+        settings.set_strv ("bookmarks", new_bookmarks);
+    }
+
+    private static void remove_bookmarks (GLib.Settings settings, string [] bookmarks_to_remove)
+    {
+        string [] old_bookmarks = settings.get_strv ("bookmarks");
+
+        string [] new_bookmarks = new string [0];
+        foreach (string bookmark in old_bookmarks)
+            if (!(bookmark in bookmarks_to_remove) && !(bookmark in new_bookmarks))
+                new_bookmarks += bookmark;
+        settings.set_strv ("bookmarks", new_bookmarks);
+    }
+
+    internal static inline string get_bookmark_name (string path, ViewType type)
+    {
+        if (type == ViewType.SEARCH)
+            return "?" + path;
+        else
+            return path;
+    }
 }
 
 [GtkTemplate (ui = "/ca/desrt/dconf-editor/ui/bookmark.ui")]
diff --git a/editor/bookmarks.ui b/editor/bookmarks.ui
index ff11b84..020e6bd 100644
--- a/editor/bookmarks.ui
+++ b/editor/bookmarks.ui
@@ -89,7 +89,10 @@
             <property name="visible">True</property>
             <property name="allow-edit">True</property>
             <property name="big-placeholder">False</property>
-            <signal name="selection-changed" handler="on_selection_changed"/>
+            <signal name="writability-changed" handler="on_writability_changed"/>
+            <signal name="bookmarks-changed"   handler="on_bookmarks_changed"/>
+            <signal name="selection-changed"   handler="on_selection_changed"/>
+            <signal name="update_bookmarks_icons" handler="on_update_bookmarks_icons"/>
           </object>
         </child>
       </object>
diff --git a/editor/bookmarks.vala b/editor/bookmarks.vala
index 64a1acd..4f5c031 100644
--- a/editor/bookmarks.vala
+++ b/editor/bookmarks.vala
@@ -44,11 +44,43 @@ private class Bookmarks : MenuButton
     private ViewType current_type = ViewType.FOLDER;
 
     private string schema_id = "ca.desrt.dconf-editor.Bookmarks";   // TODO move in a library
-    public string schema_path { private get; internal construct; }
-    private GLib.Settings settings;
-    ulong bookmarks_changed_handler = 0;
+    GLib.Settings settings;
+    public string schema_path
+    {
+        construct
+        {
+            bookmarks_list.schema_path = value;
+
+            settings = new GLib.Settings.with_path (schema_id, value);
+
+            StyleContext context = bookmarks_popover.get_style_context ();
+            bool has_small_bookmarks_rows_class = false;
+            ulong small_bookmarks_rows_handler = settings.changed ["small-bookmarks-rows"].connect (() => {
+                    bool small_bookmarks_rows = settings.get_boolean ("small-bookmarks-rows");
+                    if (small_bookmarks_rows)
+                    {
+                        if (!has_small_bookmarks_rows_class) context.add_class ("small-bookmarks-rows");
+                    }
+                    else if (has_small_bookmarks_rows_class) context.remove_class ("small-bookmarks-rows");
+                    has_small_bookmarks_rows_class = small_bookmarks_rows;
+                    bookmarks_controller.update_rows_size_button_icon (small_bookmarks_rows);
+                });
+
+            has_small_bookmarks_rows_class = settings.get_boolean ("small-bookmarks-rows");
+            if (has_small_bookmarks_rows_class)
+                context.add_class ("small-bookmarks-rows");
+            bookmarks_controller.update_rows_size_button_icon (has_small_bookmarks_rows_class);
+
+            destroy.connect (() => settings.disconnect (small_bookmarks_rows_handler));
+        }
+    }
 
     internal signal void update_bookmarks_icons (Variant bookmarks_variant);
+    [GtkCallback]
+    private void on_update_bookmarks_icons (Variant bookmarks_variant)
+    {
+        update_bookmarks_icons (bookmarks_variant);
+    }
 
     construct
     {
@@ -56,57 +88,34 @@ private class Bookmarks : MenuButton
 
         install_action_entries ();
 
-        settings = new GLib.Settings.with_path (schema_id, schema_path);
-        set_css_classes ();
-
-        bookmarks_changed_handler = settings.changed ["bookmarks"].connect (on_bookmarks_changed);
-        update_bookmarks (settings.get_value ("bookmarks"));
-
-        ulong bookmarks_writable_handler = settings.writable_changed ["bookmarks"].connect 
(set_switch_sensitivity);
-        set_switch_sensitivity ();
-
-        ulong clicked_handler = clicked.connect (() => { if (active) bookmarked_switch.grab_focus (); });
-
-        destroy.connect (() => {
-                settings.disconnect (small_bookmarks_rows_handler);
-                settings.disconnect (bookmarks_changed_handler);
-                settings.disconnect (bookmarks_writable_handler);
-                disconnect (clicked_handler);
-            });
+        clicked.connect (() => { if (active) bookmarked_switch.grab_focus (); });
     }
 
-    private ulong small_bookmarks_rows_handler = 0;
-    private bool has_small_bookmarks_rows_class = false;
-    private void set_css_classes ()
+    [GtkCallback]
+    private void on_bookmarks_changed (Variant bookmarks_variant, bool writable)
     {
-        StyleContext context = bookmarks_popover.get_style_context ();
-        small_bookmarks_rows_handler = settings.changed ["small-bookmarks-rows"].connect (() => {
-                bool small_bookmarks_rows = settings.get_boolean ("small-bookmarks-rows");
-                if (small_bookmarks_rows)
-                {
-                    if (!has_small_bookmarks_rows_class) context.add_class ("small-bookmarks-rows");
-                }
-                else if (has_small_bookmarks_rows_class) context.remove_class ("small-bookmarks-rows");
-                has_small_bookmarks_rows_class = small_bookmarks_rows;
-                bookmarks_controller.update_rows_size_button_icon (small_bookmarks_rows);
-            });
-        has_small_bookmarks_rows_class = settings.get_boolean ("small-bookmarks-rows");
-        if (has_small_bookmarks_rows_class)
-            context.add_class ("small-bookmarks-rows");
-        bookmarks_controller.update_rows_size_button_icon (has_small_bookmarks_rows_class);
+        set_detailed_action_name ("ui.update-bookmarks-icons(" + bookmarks_variant.print (true) + ")");  // 
TODO disable action on popover closed
+
+        if (bookmarks_variant.get_strv ().length == 0)
+        {
+            string? visible_child_name = edit_mode_stack.get_visible_child_name (); // do it like that
+            if (visible_child_name != null && (!) visible_child_name == "edit-mode-on")
+                leave_edit_mode ();
+        }
+
+        update_icon_and_switch (bookmarks_variant);
+        set_switch_sensitivity (writable);
     }
 
-    private void on_bookmarks_changed (GLib.Settings _settings, string key)
+    [GtkCallback]
+    private void on_writability_changed (bool writable)
     {
-        Variant bookmarks_variant = _settings.get_value ("bookmarks");
-        update_bookmarks (bookmarks_variant);
-        update_icon_and_switch (bookmarks_variant);
-        set_switch_sensitivity ();
+        set_switch_sensitivity (writable);
     }
 
-    private void set_switch_sensitivity ()
+    private void set_switch_sensitivity (bool writable)
     {
-        if (settings.is_writable ("bookmarks"))
+        if (writable)
         {
             string? visible_child_name = edit_mode_stack.get_visible_child_name (); // do it like that
             if (visible_child_name != null && (!) visible_child_name == "edit-mode-disabled")
@@ -177,23 +186,13 @@ private class Bookmarks : MenuButton
         current_path = path;
         current_type = type;
 
-        update_icon_and_switch (settings.get_value ("bookmarks"));
+        update_icon_and_switch (bookmarks_list.get_bookmarks_as_variant ());
     }
 
     // for search
     internal string [] get_bookmarks ()
     {
-        string [] all_bookmarks = settings.get_strv ("bookmarks");
-        string [] unduplicated_bookmarks = {};
-        foreach (string bookmark in all_bookmarks)
-        {
-            if (DConfWindow.is_path_invalid (bookmark))
-                continue;
-            if (bookmark in unduplicated_bookmarks)
-                continue;
-            unduplicated_bookmarks += bookmark;
-        }
-        return unduplicated_bookmarks;
+        return bookmarks_list.get_bookmarks_as_array ();
     }
 
     // keyboard call
@@ -214,14 +213,14 @@ private class Bookmarks : MenuButton
     {
         if (bookmarked_switch.get_active ())
             return;
-        append_bookmark (settings, get_bookmark_name (current_path, current_type));
+        bookmarks_list.append_bookmark (current_path, current_type);
     }
 
     internal void unbookmark_current_path ()
     {
         if (!bookmarked_switch.get_active ())
             return;
-        remove_bookmark (settings, get_bookmark_name (current_path, current_type));
+        bookmarks_list.remove_bookmark (current_path, current_type);
     }
 
     internal void update_bookmark_icon (string bookmark, BookmarkIcon icon)
@@ -342,11 +341,7 @@ private class Bookmarks : MenuButton
 
     private void trash_bookmark (/* SimpleAction action, Variant? variant */)
     {
-        string [] bookmarks_to_remove;
-        bookmarks_list.trash_bookmark (out bookmarks_to_remove);
-
-        remove_bookmarks (settings, bookmarks_to_remove);
-        update_bookmarks_icons (settings.get_value ("bookmarks"));
+        bookmarks_list.trash_bookmark ();
     }
 
     private void set_small_rows (/* SimpleAction action, Variant? variant */)
@@ -356,30 +351,22 @@ private class Bookmarks : MenuButton
 
     private void move_top       (/* SimpleAction action, Variant? variant */)
     {
-        if (bookmarks_list.move_top ())
-            return;
-        update_bookmarks_after_move ();
+        bookmarks_list.move_top ();
     }
 
     private void move_up        (/* SimpleAction action, Variant? variant */)
     {
-        if (bookmarks_list.move_up ())
-            return;
-        update_bookmarks_after_move ();
+        bookmarks_list.move_up ();
     }
 
     private void move_down      (/* SimpleAction action, Variant? variant */)
     {
-        if (bookmarks_list.move_down ())
-            return;
-        update_bookmarks_after_move ();
+        bookmarks_list.move_down ();
     }
 
     private void move_bottom    (/* SimpleAction action, Variant? variant */)
     {
-        if (bookmarks_list.move_bottom ())
-            return;
-        update_bookmarks_after_move ();
+        bookmarks_list.move_bottom ();
     }
 
     private void bookmark (SimpleAction action, Variant? path_variant)
@@ -390,7 +377,7 @@ private class Bookmarks : MenuButton
         string bookmark;
         uint8 type;
         ((!) path_variant).@get ("(sy)", out bookmark, out type);
-        append_bookmark (settings, get_bookmark_name (bookmark, ViewType.from_byte (type)));
+        bookmarks_list.append_bookmark (bookmark, ViewType.from_byte (type));
     }
 
     private void unbookmark (SimpleAction action, Variant? path_variant)
@@ -401,28 +388,13 @@ private class Bookmarks : MenuButton
         string bookmark;
         uint8 type;
         ((!) path_variant).@get ("(sy)", out bookmark, out type);
-        remove_bookmark (settings, get_bookmark_name (bookmark, ViewType.from_byte (type)));
+        bookmarks_list.remove_bookmark (bookmark, ViewType.from_byte (type));
     }
 
     /*\
     * * Bookmarks management
     \*/
 
-    private void update_bookmarks_after_move ()
-    {
-        string [] new_bookmarks = bookmarks_list.get_bookmarks ();
-
-        string [] old_bookmarks = settings.get_strv ("bookmarks");  // be cool :-)
-        foreach (string bookmark in old_bookmarks)
-            if (!(bookmark in new_bookmarks))
-                new_bookmarks += bookmark;
-
-        SignalHandler.block (settings, bookmarks_changed_handler);
-        settings.set_strv ("bookmarks", new_bookmarks);
-        GLib.Settings.sync ();   // TODO better? really needed?
-        SignalHandler.unblock (settings, bookmarks_changed_handler);
-    }
-
     private const string bookmark_this_search_text = _("Bookmark this Search");
     private const string bookmark_this_location_text = _("Bookmark this Location");
     private static void update_switch_label (ViewType old_type, ViewType new_type, ref Label switch_label)
@@ -436,7 +408,7 @@ private class Bookmarks : MenuButton
     private void update_icon_and_switch (Variant bookmarks_variant)
     {
         Variant variant = new Variant ("(sy)", current_path, ViewType.to_byte (current_type));
-        string bookmark_name = get_bookmark_name (current_path, current_type);
+        string bookmark_name = BookmarksList.get_bookmark_name (current_path, current_type);
         if (bookmark_name in bookmarks_variant.get_strv ())
         {
             if (bookmarks_icon.icon_name != "starred-symbolic")
@@ -459,58 +431,4 @@ private class Bookmarks : MenuButton
         bookmarked_switch.set_detailed_action_name ("ui.empty(('',byte 255))");
         bookmarked_switch.active = bookmarked;
     }
-
-    private void update_bookmarks (Variant bookmarks_variant)
-    {
-        set_detailed_action_name ("ui.update-bookmarks-icons(" + bookmarks_variant.print (true) + ")");  // 
TODO disable action on popover closed
-        bool no_bookmarks = bookmarks_list.create_bookmark_rows (bookmarks_variant);
-        if (no_bookmarks)
-        {
-            string? visible_child_name = edit_mode_stack.get_visible_child_name (); // do it like that
-            if (visible_child_name != null && (!) visible_child_name == "edit-mode-on")
-                leave_edit_mode ();
-        }
-    }
-
-    private static void append_bookmark (GLib.Settings settings, string bookmark_name)
-    {
-        string [] bookmarks = settings.get_strv ("bookmarks");
-        if (bookmark_name in bookmarks)
-            return;
-
-        bookmarks += bookmark_name;
-        settings.set_strv ("bookmarks", bookmarks);
-    }
-
-    private static void remove_bookmark (GLib.Settings settings, string bookmark_name)
-    {
-        string [] old_bookmarks = settings.get_strv ("bookmarks");
-        if (!(bookmark_name in old_bookmarks))
-            return;
-
-        string [] new_bookmarks = new string [0];
-        foreach (string bookmark in old_bookmarks)
-            if (bookmark != bookmark_name && !(bookmark in new_bookmarks))
-                new_bookmarks += bookmark;
-        settings.set_strv ("bookmarks", new_bookmarks);
-    }
-
-    private static void remove_bookmarks (GLib.Settings settings, string [] bookmarks_to_remove)
-    {
-        string [] old_bookmarks = settings.get_strv ("bookmarks");
-
-        string [] new_bookmarks = new string [0];
-        foreach (string bookmark in old_bookmarks)
-            if (!(bookmark in bookmarks_to_remove) && !(bookmark in new_bookmarks))
-                new_bookmarks += bookmark;
-        settings.set_strv ("bookmarks", new_bookmarks);
-    }
-
-    internal static inline string get_bookmark_name (string path, ViewType type)
-    {
-        if (type == ViewType.SEARCH)
-            return "?" + path;
-        else
-            return path;
-    }
 }
diff --git a/editor/browser-headerbar.vala b/editor/browser-headerbar.vala
index 3d65ee5..0d62871 100644
--- a/editor/browser-headerbar.vala
+++ b/editor/browser-headerbar.vala
@@ -236,7 +236,7 @@ private class BrowserHeaderBar : HeaderBar, AdaptativeWidget
         else if (current_type != ViewType.SEARCH) */
 
         if (extra_small_window)
-            append_bookmark_section (current_type, current_path, Bookmarks.get_bookmark_name (current_path, 
current_type) in get_bookmarks (), in_window_bookmarks, ref menu);
+            append_bookmark_section (current_type, current_path, BookmarksList.get_bookmark_name 
(current_path, current_type) in get_bookmarks (), in_window_bookmarks, ref menu);
 
         if (!in_window_bookmarks)
             append_or_not_delay_mode_section (delay_mode, current_type == ViewType.FOLDER, current_path, ref 
menu);


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