[dconf-editor] Remove current_view_is_ functions.
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Remove current_view_is_ functions.
- Date: Fri, 16 Feb 2018 09:35:00 +0000 (UTC)
commit 7a25508c29a3d5eff8178edccfe35fe8f1778700
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Fri Feb 16 10:29:55 2018 +0100
Remove current_view_is_ functions.
editor/browser-stack.vala | 25 +++----------------------
editor/browser-view.vala | 17 +++++++----------
editor/dconf-window.vala | 8 ++++----
3 files changed, 14 insertions(+), 36 deletions(-)
---
diff --git a/editor/browser-stack.vala b/editor/browser-stack.vala
index d43aa9f..e4aaaf9 100644
--- a/editor/browser-stack.vala
+++ b/editor/browser-stack.vala
@@ -25,6 +25,9 @@ class BrowserStack : Grid
[GtkChild] private RegistryInfo properties_view;
[GtkChild] private RegistrySearch search_results_view;
+ public ViewType current_view { get; private set; default = ViewType.FOLDER; }
+ private ViewType pre_search_view = ViewType.SEARCH; // means "not in search"
+
public bool small_keys_list_rows
{
set
@@ -44,28 +47,6 @@ class BrowserStack : Grid
}
/*\
- * * View type
- \*/
-
- private ViewType current_view = ViewType.FOLDER;
- private ViewType pre_search_view = ViewType.SEARCH; // means "not in search"
-
- public bool current_view_is_browse_view ()
- {
- return current_view == ViewType.FOLDER;
- }
-
- public bool current_view_is_properties_view ()
- {
- return current_view == ViewType.OBJECT;
- }
-
- public bool current_view_is_search_results_view ()
- {
- return current_view == ViewType.SEARCH;
- }
-
- /*\
* * Views
\*/
diff --git a/editor/browser-view.vala b/editor/browser-view.vala
index 7cb44f4..e8b0e94 100644
--- a/editor/browser-view.vala
+++ b/editor/browser-view.vala
@@ -52,7 +52,7 @@ class BrowserView : Grid
_("Reload"), "ui.reload-object"); // TODO also for key
removing?
sorting_options.notify.connect (() => {
- if (!current_view_is_browse_view ())
+ if (current_view != ViewType.FOLDER)
return;
if (key_model != null && !sorting_options.is_key_model_sorted ((!) key_model))
@@ -205,7 +205,7 @@ class BrowserView : Grid
private void show_hard_reload_warning ()
{
- info_bar.show_warning (current_view_is_browse_view () ? "hard-reload-folder" : "hard-reload-object");
+ info_bar.show_warning (current_view == ViewType.FOLDER ? "hard-reload-folder" :
"hard-reload-object");
}
public void reload_search (string current_path, string [] bookmarks)
@@ -218,20 +218,20 @@ class BrowserView : Grid
{
SettingsModel model = modifications_handler.model;
- if (current_view_is_browse_view ())
+ if (current_view == ViewType.FOLDER)
{
GLib.ListStore? fresh_key_model = model.get_children (path);
if (fresh_key_model != null && !current_child.check_reload_folder ((!) fresh_key_model))
return false;
}
- else if (current_view_is_properties_view ())
+ else if (current_view == 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 && !current_view_is_search_results_view ())
+ if (show_infobar && current_view != ViewType.SEARCH)
{
show_hard_reload_warning ();
return false;
@@ -243,15 +243,12 @@ class BrowserView : Grid
* * Proxy calls
\*/
+ public ViewType current_view { get { return current_child.current_view; }}
+
// popovers invalidation
public void discard_row_popover () { current_child.discard_row_popover (); }
public void invalidate_popovers () { current_child.invalidate_popovers (); }
- // questionning view
- public bool current_view_is_browse_view () { return current_child.current_view_is_browse_view
(); }
- public bool current_view_is_properties_view () { return
current_child.current_view_is_properties_view (); }
- public bool current_view_is_search_results_view () { return
current_child.current_view_is_search_results_view (); }
-
// keyboard
public bool return_pressed () { return current_child.return_pressed (); }
public bool up_pressed () { return current_child.up_pressed (); }
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index 4fd5e6b..3799ab4 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -586,11 +586,11 @@ class DConfWindow : ApplicationWindow
private void reload_view ()
{
- if (browser_view.current_view_is_browse_view ())
+ if (browser_view.current_view == ViewType.FOLDER)
request_folder_path (current_path, browser_view.get_selected_row_name ());
- else if (browser_view.current_view_is_properties_view ())
+ else if (browser_view.current_view == ViewType.OBJECT)
request_object_path (current_path, "", false);
- else if (browser_view.current_view_is_search_results_view ())
+ else if (browser_view.current_view == ViewType.SEARCH)
browser_view.reload_search (current_path, bookmarks_button.get_bookmarks ());
}
@@ -862,7 +862,7 @@ class DConfWindow : ApplicationWindow
return browser_view.down_pressed ();
if ((name == "Return" || name == "KP_Enter")
- && browser_view.current_view_is_search_results_view ()
+ && browser_view.current_view == ViewType.SEARCH
&& search_entry.has_focus
&& browser_view.return_pressed ())
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]