[dconf-editor] Make current_path almost private.
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Make current_path almost private.
- Date: Wed, 10 Jan 2018 11:03:57 +0000 (UTC)
commit 36c7a414170ce563b08d7185cde87e126a2cbf1f
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Wed Jan 10 12:03:19 2018 +0100
Make current_path almost private.
editor/browser-view.vala | 17 +++++++----------
editor/dconf-window.vala | 11 +++++------
2 files changed, 12 insertions(+), 16 deletions(-)
---
diff --git a/editor/browser-view.vala b/editor/browser-view.vala
index 7044165..a155eb1 100644
--- a/editor/browser-view.vala
+++ b/editor/browser-view.vala
@@ -28,8 +28,6 @@ public enum Behaviour {
[GtkTemplate (ui = "/ca/desrt/dconf-editor/ui/browser-view.ui")]
class BrowserView : Grid
{
- public string current_path { get; private set; default = "/"; }
-
private GLib.Settings settings = new GLib.Settings ("ca.desrt.dconf-editor.Settings");
[GtkChild] private BrowserInfoBar info_bar;
@@ -99,12 +97,12 @@ class BrowserView : Grid
return null;
}
- public void prepare_browse_view (GLib.ListStore key_model, string full_name, bool
warning_multiple_schemas)
+ public void prepare_browse_view (GLib.ListStore key_model, bool is_ancestor, bool
warning_multiple_schemas)
{
sorting_options.sort_key_model (key_model);
browse_view.set_key_model (key_model);
- stack.set_transition_type (current_path.has_prefix (full_name) && pre_search_view == null ?
StackTransitionType.CROSSFADE : StackTransitionType.NONE);
+ stack.set_transition_type (is_ancestor && pre_search_view == null ? StackTransitionType.CROSSFADE :
StackTransitionType.NONE);
pre_search_view = null;
hide_reload_warning ();
browse_view.show_multiple_schemas_warning (warning_multiple_schemas);
@@ -120,14 +118,14 @@ class BrowserView : Grid
properties_view.clean ();
}
- public void prepare_properties_view (Key key, string path, bool warning_multiple_schemas)
+ public void prepare_properties_view (Key key, bool is_parent, bool warning_multiple_schemas)
{
properties_view.populate_properties_list_box (key, warning_multiple_schemas);
hide_reload_warning ();
browse_view.show_multiple_schemas_warning (false);
- stack.set_transition_type (current_path == SettingsModel.get_parent_path (path) && pre_search_view
== null ? StackTransitionType.CROSSFADE : StackTransitionType.NONE);
+ stack.set_transition_type (is_parent && pre_search_view == null ? StackTransitionType.CROSSFADE :
StackTransitionType.NONE);
pre_search_view = null;
}
@@ -164,7 +162,6 @@ class BrowserView : Grid
stack.set_visible_child (properties_view);
modifications_handler.path_changed ();
- current_path = path;
}
public string? get_copy_text ()
@@ -252,18 +249,18 @@ class BrowserView : Grid
search_results_view.reload_search ();
}
- public bool check_reload ()
+ public bool check_reload (string path)
{
SettingsModel model = modifications_handler.model;
if (current_view_is_properties_view ())
{
- Key? fresh_key = (Key?) model.get_object (current_path);
+ Key? fresh_key = (Key?) model.get_object (path);
if (fresh_key != null && !properties_view.check_reload ((!) fresh_key, model.get_key_value ((!)
fresh_key)))
return false;
}
else if (current_view_is_browse_view ())
{
- Directory? fresh_dir = (Directory?) model.get_directory (current_path);
+ Directory? fresh_dir = (Directory?) model.get_directory (path);
GLib.ListStore? fresh_key_model = model.get_children (fresh_dir);
if (fresh_key_model != null && !browse_view.check_reload ((!) fresh_dir, (!) fresh_key_model))
return false;
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index a7fe406..fddd8f7 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -20,7 +20,7 @@ using Gtk;
[GtkTemplate (ui = "/ca/desrt/dconf-editor/ui/dconf-editor.ui")]
class DConfWindow : ApplicationWindow
{
- public string current_path { get; set; default = "/"; } // not synced bidi, needed for saving on
destroy, even after child destruction
+ public string current_path { get; private set; default = "/"; }
private SettingsModel model;
private ModificationsHandler modifications_handler;
@@ -76,7 +76,7 @@ class DConfWindow : ApplicationWindow
modifications_handler_reload_handler = modifications_handler.reload.connect (invalidate_popovers);
model.paths_changed.connect ((_model, modified_path_specs, internal_changes) => {
- bool need_reload = browser_view.check_reload ();
+ bool need_reload = browser_view.check_reload (current_path);
if (need_reload)
{
if (internal_changes)
@@ -123,8 +123,6 @@ class DConfWindow : ApplicationWindow
search_bar.connect_entry (search_entry);
search_bar.notify ["search-mode-enabled"].connect (search_changed);
- browser_view.bind_property ("current-path", this, "current-path"); // TODO in UI file?
-
settings.bind ("mouse-use-extra-buttons", this, "mouse-extra-buttons",
SettingsBindFlags.GET|SettingsBindFlags.NO_SENSITIVITY);
settings.bind ("mouse-back-button", this, "mouse-back-button",
SettingsBindFlags.GET|SettingsBindFlags.NO_SENSITIVITY);
settings.bind ("mouse-forward-button", this, "mouse-forward-button",
SettingsBindFlags.GET|SettingsBindFlags.NO_SENSITIVITY);
@@ -376,7 +374,7 @@ class DConfWindow : ApplicationWindow
if (found_object is Key)
{
Directory parent_directory = (!) model.get_directory (SettingsModel.get_parent_path (full_name));
- browser_view.prepare_properties_view ((Key) found_object, full_name,
parent_directory.warning_multiple_schemas);
+ browser_view.prepare_properties_view ((Key) found_object, current_path ==
SettingsModel.get_parent_path (full_name), parent_directory.warning_multiple_schemas);
update_current_path (full_name);
}
else
@@ -398,7 +396,7 @@ class DConfWindow : ApplicationWindow
GLib.ListStore? key_model = model.get_children (directory);
if (key_model == null)
return;
- browser_view.prepare_browse_view ((!) key_model, directory.full_name,
directory.warning_multiple_schemas);
+ browser_view.prepare_browse_view ((!) key_model, current_path.has_prefix (directory.full_name),
directory.warning_multiple_schemas);
update_current_path (directory.full_name);
browser_view.select_row (selected);
}
@@ -428,6 +426,7 @@ class DConfWindow : ApplicationWindow
private void update_current_path (string path)
{
+ current_path = path;
browser_view.set_path (path);
bookmarks_button.set_path (path);
pathbar.set_path (path);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]