[dconf-editor] Clean views during set_path.
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Clean views during set_path.
- Date: Sun, 18 Feb 2018 10:01:53 +0000 (UTC)
commit 54986d67f42ecc6e5bcd22c54a2964189ea8f1c7
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Sun Feb 18 11:00:28 2018 +0100
Clean views during set_path.
editor/browser-stack.vala | 19 ++++++++++++-------
editor/browser-view.vala | 1 +
editor/registry-search.vala | 4 ++--
editor/registry-view.vala | 6 ++++--
4 files changed, 19 insertions(+), 11 deletions(-)
---
diff --git a/editor/browser-stack.vala b/editor/browser-stack.vala
index 4ba1907..3064009 100644
--- a/editor/browser-stack.vala
+++ b/editor/browser-stack.vala
@@ -66,13 +66,12 @@ class BrowserStack : Grid
}
public void select_row (string selected, string last_context)
+ requires (current_view == ViewType.FOLDER)
{
- bool grab_focus = true; // unused, for now
- if (selected != "")
- browse_view.select_row_named (selected, last_context, grab_focus);
+ if (selected == "")
+ browse_view.select_first_row ();
else
- browse_view.select_first_row (grab_focus);
- properties_view.clean ();
+ browse_view.select_row_named (selected, last_context);
}
public void prepare_properties_view (Key key, bool is_parent)
@@ -84,8 +83,9 @@ class BrowserStack : Grid
public void set_path (ViewType type, string path)
{
- if (current_view == ViewType.SEARCH && type != ViewType.SEARCH)
- search_results_view.stop_search ();
+ // might become “bool clear = type != current_view”, one day…
+ bool clean_object_view = type == ViewType.FOLDER; // note: not on search
+ bool clean_search_view = current_view == ViewType.SEARCH && type != ViewType.SEARCH;
current_view = type;
if (type == ViewType.FOLDER)
@@ -98,6 +98,11 @@ class BrowserStack : Grid
stack.set_transition_type (StackTransitionType.NONE);
stack.set_visible_child (search_results_view);
}
+
+ if (clean_object_view)
+ properties_view.clean ();
+ if (clean_search_view)
+ search_results_view.clean ();
}
public string? get_copy_text ()
diff --git a/editor/browser-view.vala b/editor/browser-view.vala
index 6c86f4d..d7602f6 100644
--- a/editor/browser-view.vala
+++ b/editor/browser-view.vala
@@ -160,6 +160,7 @@ class BrowserView : Grid
}
public void select_row (string selected)
+ requires (current_view == ViewType.FOLDER)
{
current_child.select_row (selected, last_context);
}
diff --git a/editor/registry-search.vala b/editor/registry-search.vala
index e2d7112..b530451 100644
--- a/editor/registry-search.vala
+++ b/editor/registry-search.vala
@@ -229,7 +229,7 @@ class RegistrySearch : RegistryList
private uint? search_source = null;
private GLib.Queue<Directory> search_nodes = new GLib.Queue<Directory> ();
- public void stop_search ()
+ public void clean ()
{
key_list_box.bind_model (null, null);
stop_global_search ();
@@ -468,7 +468,7 @@ class RegistrySearch : RegistryList
public void set_search_parameters (string current_path, string [] bookmarks, SortingOptions
sorting_options)
{
- stop_search ();
+ clean ();
this.current_path = current_path;
this.bookmarks = bookmarks;
this.sorting_options = sorting_options;
diff --git a/editor/registry-view.vala b/editor/registry-view.vala
index aa9daa4..449552c 100644
--- a/editor/registry-view.vala
+++ b/editor/registry-view.vala
@@ -182,16 +182,18 @@ class RegistryView : RegistryList
return false;
}
- public void select_row_named (string selected, string context, bool grab_focus)
+ public void select_row_named (string selected, string context)
{
+ bool grab_focus = true; // unused, for now
check_resize ();
ListBoxRow? row = key_list_box.get_row_at_index (get_row_position (selected, context));
if (row == null)
assert_not_reached ();
scroll_to_row ((!) row, grab_focus);
}
- public void select_first_row (bool grab_focus)
+ public void select_first_row ()
{
+ bool grab_focus = true; // unused, for now
ListBoxRow? row = key_list_box.get_row_at_index (0);
if (row != null)
scroll_to_row ((!) row, grab_focus);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]