[dconf-editor] Hide boolean switches in delayed mode.
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Hide boolean switches in delayed mode.
- Date: Wed, 10 Jan 2018 10:07:09 +0000 (UTC)
commit f5bf5329584b1e9f5184dcb1ced9002ad0ed873d
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Wed Jan 10 01:52:45 2018 +0100
Hide boolean switches in delayed mode.
editor/browser-view.vala | 30 +-----------------------------
editor/dconf-window.vala | 27 +++++++++++++++++++++++++--
editor/key-list-box-row.vala | 2 +-
3 files changed, 27 insertions(+), 32 deletions(-)
---
diff --git a/editor/browser-view.vala b/editor/browser-view.vala
index 07cacff..7044165 100644
--- a/editor/browser-view.vala
+++ b/editor/browser-view.vala
@@ -64,19 +64,6 @@ class BrowserView : Grid
search_results_view.modifications_handler = value;
settings.bind ("behaviour", modifications_handler, "behaviour",
SettingsBindFlags.GET|SettingsBindFlags.NO_SENSITIVITY);
- ulong modifications_handler_reload_handler = modifications_handler.reload.connect
(invalidate_popovers);
- destroy.connect (() => {
- modifications_handler.disconnect (modifications_handler_reload_handler);
- });
- }
- }
-
- private DConfWindow? _main_window = null;
- private DConfWindow main_window {
- get {
- if (_main_window == null)
- _main_window = (DConfWindow) DConfWindow._get_parent (DConfWindow._get_parent
(DConfWindow._get_parent (this)));
- return (!) _main_window;
}
}
@@ -87,7 +74,6 @@ class BrowserView : Grid
info_bar.add_label ("hard-reload", _("This content has changed. Do you want to reload the view?"),
_("Reload"), "ui.reload");
- ulong behaviour_changed_handler = settings.changed ["behaviour"].connect (invalidate_popovers);
settings.bind ("behaviour", browse_view, "behaviour",
SettingsBindFlags.GET|SettingsBindFlags.NO_SENSITIVITY);
sorting_options = new SortingOptions ();
@@ -102,11 +88,6 @@ class BrowserView : Grid
show_soft_reload_warning ();
// TODO reload search results too
});
-
- destroy.connect (() => {
- settings.disconnect (behaviour_changed_handler);
- base.destroy ();
- });
}
public string? get_selected_row_name ()
@@ -184,7 +165,6 @@ class BrowserView : Grid
modifications_handler.path_changed ();
current_path = path;
- invalidate_popovers ();
}
public string? get_copy_text ()
@@ -225,11 +205,10 @@ class BrowserView : Grid
search_results_view.discard_row_popover ();
}
- private void invalidate_popovers ()
+ public void invalidate_popovers ()
{
browse_view.invalidate_popovers ();
search_results_view.invalidate_popovers ();
- main_window.update_hamburger_menu ();
}
public bool current_view_is_browse_view ()
@@ -328,7 +307,6 @@ class BrowserView : Grid
public void reset_objects (GLib.ListStore? objects, bool recursively)
{
- enter_delay_mode ();
reset_generic (objects, recursively);
revealer.warn_if_no_planned_changes ();
}
@@ -364,12 +342,6 @@ class BrowserView : Grid
modifications_handler.add_delayed_setting ((Key) setting_object, null);
}
}
-
- public void enter_delay_mode ()
- {
- modifications_handler.enter_delay_mode ();
- invalidate_popovers ();
- }
}
public interface BrowsableView
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index 1b26f0a..c30c577 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -71,6 +71,8 @@ class DConfWindow : ApplicationWindow
}
}
+ private ulong behaviour_changed_handler = 0;
+ private ulong modifications_handler_reload_handler = 0;
private ulong small_keys_list_rows_handler = 0;
private ulong small_bookmarks_rows_handler = 0;
@@ -84,6 +86,8 @@ class DConfWindow : ApplicationWindow
pathbar.model = model;
modifications_handler = new ModificationsHandler (model);
browser_view.modifications_handler = modifications_handler;
+ 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 ();
if (need_reload)
@@ -96,6 +100,8 @@ class DConfWindow : ApplicationWindow
pathbar.set_path (current_path); // update "ghost" status
});
+ behaviour_changed_handler = settings.changed ["behaviour"].connect (invalidate_popovers);
+
if (!disable_warning && settings.get_boolean ("show-warning"))
show.connect (show_initial_warning);
@@ -275,6 +281,9 @@ class DConfWindow : ApplicationWindow
{
((ConfigurationEditor) get_application ()).clean_copy_notification ();
+ modifications_handler.disconnect (modifications_handler_reload_handler);
+
+ settings.disconnect (behaviour_changed_handler);
settings.disconnect (small_keys_list_rows_handler);
settings.disconnect (small_bookmarks_rows_handler);
@@ -367,9 +376,10 @@ class DConfWindow : ApplicationWindow
browser_view.set_path (path);
bookmarks_button.set_path (path);
pathbar.set_path (path);
+ invalidate_popovers_without_reload ();
}
- public void update_hamburger_menu ()
+ private void update_hamburger_menu ()
{
GLib.Menu section;
@@ -405,6 +415,17 @@ class DConfWindow : ApplicationWindow
info_button.set_menu_model ((MenuModel) menu);
}
+ private void invalidate_popovers ()
+ {
+ invalidate_popovers_without_reload ();
+ reload_view (false); // TODO better
+ }
+ private void invalidate_popovers_without_reload ()
+ {
+ browser_view.invalidate_popovers ();
+ update_hamburger_menu ();
+ }
+
/*\
* * Action entries
\*/
@@ -445,12 +466,14 @@ class DConfWindow : ApplicationWindow
private void reset_path (string path, bool recursively)
{
+ enter_delay_mode ();
browser_view.reset_objects (model.get_children (model.get_directory (path)), recursively);
}
private void enter_delay_mode (/* SimpleAction action, Variant? path_variant */)
{
- browser_view.enter_delay_mode ();
+ modifications_handler.enter_delay_mode ();
+ invalidate_popovers ();
}
/*\
diff --git a/editor/key-list-box-row.vala b/editor/key-list-box-row.vala
index 8638c2c..3a7d10c 100644
--- a/editor/key-list-box-row.vala
+++ b/editor/key-list-box-row.vala
@@ -233,7 +233,7 @@ private abstract class KeyListBoxRow : ClickableListBoxRow
construct
{
- if (abstract_key.type_string == "b") // TODO not with “always delay” behaviour, nor in “delay
mode”
+ if (abstract_key.type_string == "b" && !modifications_handler.get_current_delay_mode ())
{
boolean_switch = new Switch ();
((!) boolean_switch).can_focus = false;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]