[dconf-editor] Only search for window one time.



commit b1a6aa0ad40e1402ce085f7f37b38ed81956daa5
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Wed Oct 25 08:03:30 2017 +0200

    Only search for window one time.

 editor/registry-view.vala |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/editor/registry-view.vala b/editor/registry-view.vala
index 843fcc9..820f8f4 100644
--- a/editor/registry-view.vala
+++ b/editor/registry-view.vala
@@ -45,6 +45,15 @@ class RegistryView : Grid, PathElement
     [GtkChild] private SearchEntry search_entry;
     [GtkChild] private Button search_next_button;
 
+    private DConfWindow? _window = null;
+    private DConfWindow window {
+        get {
+            if (_window == null)
+                _window = (DConfWindow) DConfWindow._get_parent (DConfWindow._get_parent (this));
+            return (!) _window;
+        }
+    }
+
     construct
     {
         ulong revealer_reload_handler = revealer.reload.connect (invalidate_popovers);
@@ -140,7 +149,7 @@ class RegistryView : Grid, PathElement
     {
         revealer.path_changed ();
         current_path = path;
-        get_dconf_window ().update_path_elements ();
+        window.update_path_elements ();
         invalidate_popovers ();
     }
 
@@ -179,7 +188,7 @@ class RegistryView : Grid, PathElement
 
         if (!select_folder (folder_name))
         {
-            get_dconf_window ().show_notification (_("Cannot find folder “%s”.").printf (folder_name));
+            window.show_notification (_("Cannot find folder “%s”.").printf (folder_name));
             current_path = "/";
             show_browse_view ("/", null);
             return;
@@ -205,14 +214,14 @@ class RegistryView : Grid, PathElement
             else
             {
                 show_browse_view (folder_name, null);
-                get_dconf_window ().show_notification (_("Cannot find key “%s” here.").printf (object_name));
+                window.show_notification (_("Cannot find key “%s” here.").printf (object_name));
             }
             return;
         }
         if (((!) object) is DConfKey && ((DConfKey) ((!) object)).is_ghost)
         {
             show_browse_view (folder_name, folder_name + object_name);
-            get_dconf_window ().show_notification (_("Key “%s” has been removed.").printf (object_name));
+            window.show_notification (_("Key “%s” has been removed.").printf (object_name));
             return;
         }
 
@@ -276,11 +285,6 @@ class RegistryView : Grid, PathElement
         return directory_exists;
     }
 
-    private DConfWindow get_dconf_window ()
-    {
-        return (DConfWindow) DConfWindow._get_parent (DConfWindow._get_parent (this));
-    }
-
     /*\
     * * Key ListBox
     \*/
@@ -395,7 +399,7 @@ class RegistryView : Grid, PathElement
             row = (ClickableListBoxRow?) rows_possibly_with_popover.get_item (position);
         }
         rows_possibly_with_popover.remove_all ();
-        get_dconf_window ().update_hamburger_menu ();
+        window.update_hamburger_menu ();
     }
 
     [GtkCallback]


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