[dconf-editor] Remove _get_parent().



commit 35b65a5c0b77f12df3ee142646c24ec04d622c99
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Thu Jan 11 01:06:19 2018 +0100

    Remove _get_parent().

 editor/browser-view.vala    |    4 ++--
 editor/dconf-window.vala    |    8 --------
 editor/registry-search.vala |   21 ++++++---------------
 editor/registry-view.vala   |    9 ---------
 4 files changed, 8 insertions(+), 34 deletions(-)
---
diff --git a/editor/browser-view.vala b/editor/browser-view.vala
index 063fa37..cf62f0f 100644
--- a/editor/browser-view.vala
+++ b/editor/browser-view.vala
@@ -131,7 +131,7 @@ class BrowserView : Grid
 
     public void show_search_view (string term, string current_path, string [] bookmarks)
     {
-        search_results_view.start_search (term, current_path, bookmarks);
+        search_results_view.start_search (term, current_path, bookmarks, sorting_options);
         if (pre_search_view == null)
         {
             pre_search_view = stack.visible_child;
@@ -246,7 +246,7 @@ class BrowserView : Grid
     public void reload_search (string current_path, string [] bookmarks)
     {
         hide_reload_warning ();
-        search_results_view.reload_search (current_path, bookmarks);
+        search_results_view.reload_search (current_path, bookmarks, sorting_options);
     }
 
     public bool check_reload (string path)
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index c470a62..130bb47 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -188,14 +188,6 @@ class DConfWindow : ApplicationWindow
         request_path ((!) first_path, true, strict);
     }
 
-    public static Widget _get_parent (Widget widget)
-    {
-        Widget? parent = widget.get_parent ();
-        if (parent == null)
-            assert_not_reached ();
-        return (!) parent;
-    }
-
     /*\
     * * Window management callbacks
     \*/
diff --git a/editor/registry-search.vala b/editor/registry-search.vala
index 41200e1..115417e 100644
--- a/editor/registry-search.vala
+++ b/editor/registry-search.vala
@@ -46,15 +46,6 @@ class RegistrySearch : Grid, BrowsableView
 
     public ModificationsHandler modifications_handler { private get; set; }
 
-    private BrowserView? _browser_view = null;
-    private BrowserView browser_view {
-        get {
-            if (_browser_view == null)
-                _browser_view = (BrowserView) DConfWindow._get_parent (DConfWindow._get_parent (this));
-            return (!) _browser_view;
-        }
-    }
-
     private GLib.ListStore search_results_model = new GLib.ListStore (typeof (SettingObject));
 
     construct
@@ -371,7 +362,7 @@ class RegistrySearch : Grid, BrowsableView
         old_term = null;
     }
 
-    public void start_search (string term, string _current_path, string [] bookmarks)
+    public void start_search (string term, string _current_path, string [] bookmarks, SortingOptions 
sorting_options)
     {
         current_path = _current_path;
 
@@ -404,7 +395,7 @@ class RegistrySearch : Grid, BrowsableView
             post_local = -1;
             post_folders = -1;
 
-            local_search (model, SettingsModel.get_base_path (current_path), term);
+            local_search (model, sorting_options, SettingsModel.get_base_path (current_path), term);
             bookmark_search (model, current_path, term, bookmarks);
             key_list_box.bind_model (search_results_model, new_list_box_row);
 
@@ -464,9 +455,9 @@ class RegistrySearch : Grid, BrowsableView
         }
     }
 
-    private bool local_search (SettingsModel model, string current_path, string term)
+    private bool local_search (SettingsModel model, SortingOptions sorting_options, string current_path, 
string term)
     {
-        SettingComparator comparator = browser_view.sorting_options.get_comparator ();
+        SettingComparator comparator = sorting_options.get_comparator ();
         GLib.CompareDataFunc compare = (a, b) => comparator.compare((SettingObject) a, (SettingObject) b);
 
         if (!SettingsModel.is_key_path (current_path))
@@ -600,10 +591,10 @@ class RegistrySearch : Grid, BrowsableView
         row.set_header (header);
     }
 
-    public void reload_search (string current_path, string [] bookmarks)
+    public void reload_search (string current_path, string [] bookmarks, SortingOptions sorting_options)
     {
         string term = old_term ?? "";
         stop_search ();
-        start_search (term, current_path, bookmarks);
+        start_search (term, current_path, bookmarks, sorting_options);
     }
 }
diff --git a/editor/registry-view.vala b/editor/registry-view.vala
index 58fdcac..586a3a0 100644
--- a/editor/registry-view.vala
+++ b/editor/registry-view.vala
@@ -47,15 +47,6 @@ class RegistryView : Grid, BrowsableView
 
     public ModificationsHandler modifications_handler { private get; set; }
 
-    private BrowserView? _browser_view = null;
-    private BrowserView browser_view {
-        get {
-            if (_browser_view == null)
-                _browser_view = (BrowserView) DConfWindow._get_parent (DConfWindow._get_parent (this));
-            return (!) _browser_view;
-        }
-    }
-
     construct
     {
         info_bar.add_label ("multiple-schemas-folder", _("Multiple schemas are installed at this path. This 
could lead to problems if it hasn’t been done carefully. Only one schema is displayed here. Edit values at 
your own risk."));


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