[dconf-editor] Do not show reload_search button on copy.



commit dc5b1b5a4e7ab70dc71aee696a46e0c56e4eca20
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Sun Feb 18 09:04:35 2018 +0100

    Do not show reload_search button on copy.

 editor/browser-view.vala |   18 ++++++++++++------
 editor/dconf-model.vala  |    7 +++++--
 editor/dconf-window.vala |   15 ++++++++++-----
 3 files changed, 27 insertions(+), 13 deletions(-)
---
diff --git a/editor/browser-view.vala b/editor/browser-view.vala
index 9f6eb3a..6c86f4d 100644
--- a/editor/browser-view.vala
+++ b/editor/browser-view.vala
@@ -207,19 +207,25 @@ class BrowserView : Grid
             GLib.ListStore? fresh_key_model = model.get_children (path);
             if (fresh_key_model != null && !current_child.check_reload_folder ((!) fresh_key_model))
                 return false;
+            if (show_infobar)
+            {
+                info_bar.show_warning ("hard-reload-folder");
+                return false;
+            }
         }
         else if (type == ViewType.OBJECT)
         {
             Variant? properties = model.get_key_properties (path, last_context);
             if (properties != null && !current_child.check_reload_object ((!) properties))
                 return false;
+            if (show_infobar)
+            {
+                info_bar.show_warning ("hard-reload-object");
+                return false;
+            }
         }
-
-        if (show_infobar && type != ViewType.SEARCH)
-        {
-            info_bar.show_warning (type == ViewType.FOLDER ? "hard-reload-folder" : "hard-reload-object");
-            return false;
-        }
+        else // (type == ViewType.SEARCH)
+            assert_not_reached ();
         return true;
     }
 
diff --git a/editor/dconf-model.vala b/editor/dconf-model.vala
index 10c8c93..759461d 100644
--- a/editor/dconf-model.vala
+++ b/editor/dconf-model.vala
@@ -22,6 +22,7 @@ public class SettingsModel : Object
 
     private DConf.Client client = new DConf.Client ();
     private string? last_change_tag = null;
+    public bool copy_action = false;
 
     public signal void paths_changed (GenericSet<string> modified_path_specs, bool internal_changes);
 
@@ -45,7 +46,7 @@ public class SettingsModel : Object
 
     public void finalize_model ()
     {
-        source_manager.paths_changed.connect ((modified_path_specs) => { paths_changed (modified_path_specs, 
false); });
+        source_manager.paths_changed.connect ((modified_path_specs) => paths_changed (modified_path_specs, 
false));
         source_manager.refresh_schema_source ();
         Timeout.add (3000, () => {
                 if (refresh_source) // TODO better: stops the I/O, but not the wakeup
@@ -54,7 +55,9 @@ public class SettingsModel : Object
             });
 
         client.changed.connect ((client, prefix, changes, tag) => {
-                bool internal_changes = false;
+                bool internal_changes = copy_action;
+                if (copy_action)
+                    copy_action = false;
                 if (last_change_tag != null && tag != null && (!) last_change_tag == (!) tag)
                 {
                     last_change_tag = null;
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index 7cb66c4..83a63b2 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -207,13 +207,14 @@ class DConfWindow : ApplicationWindow
         model.finalize_model ();
 
         model.paths_changed.connect ((_model, modified_path_specs, internal_changes) => {
-                if (browser_view.check_reload (current_type, current_path, !internal_changes))    // handle 
infobars in needed
+                if (current_type == ViewType.SEARCH)
                 {
-                    if (internal_changes)
-                        reload_view ();
-                    else    // search
+                    if (!internal_changes)
                         reload_search_action.set_enabled (true);
                 }
+                else if (browser_view.check_reload (current_type, current_path, !internal_changes))    // 
handle infobars in needed
+                    reload_view ();
+
                 pathbar.update_ghosts (_model.get_fallback_path (pathbar.complete_path), 
search_bar.search_mode_enabled);
             });
     }
@@ -524,6 +525,7 @@ class DConfWindow : ApplicationWindow
 
         if (search_bar.search_mode_enabled)
         {
+            model.copy_action = true;
             string selected_row_text = browser_view.get_copy_path_text () ?? saved_view;
             ((ConfigurationEditor) get_application ()).copy (selected_row_text);
         }
@@ -578,6 +580,7 @@ class DConfWindow : ApplicationWindow
                     cannot_find_folder (full_name);
             }
             request_folder (SettingsModel.get_parent_path (full_name), full_name, false);
+            pathbar.update_ghosts (model.get_fallback_path (pathbar.complete_path), false);
         }
         else
         {
@@ -766,7 +769,9 @@ class DConfWindow : ApplicationWindow
                     return true;
 
                 case "c":
-                    if (focus_is_text_widget && !search_bar.search_mode_enabled)
+                    if (search_bar.search_mode_enabled)
+                        model.copy_action = true;
+                    else if (focus_is_text_widget)
                         return false;
 
                     browser_view.discard_row_popover (); // TODO avoid duplicate get_selected_row () call


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