[dconf-editor] Move reset_objects in ModificationsRevealer.
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Move reset_objects in ModificationsRevealer.
- Date: Thu, 11 Jan 2018 01:58:42 +0000 (UTC)
commit 6c1587a7af6f1f9296d689b11a274394a00d8a95
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Thu Jan 11 02:57:48 2018 +0100
Move reset_objects in ModificationsRevealer.
editor/browser-view.vala | 36 ----------------------------
editor/dconf-window.vala | 3 +-
editor/modifications-revealer.vala | 45 ++++++++++++++++++++++++++++++++++-
3 files changed, 44 insertions(+), 40 deletions(-)
---
diff --git a/editor/browser-view.vala b/editor/browser-view.vala
index 58d27dc..a409f1d 100644
--- a/editor/browser-view.vala
+++ b/editor/browser-view.vala
@@ -294,42 +294,6 @@ class BrowserView : Grid
return search_results_view.up_or_down_pressed (true);
return false;
}
-
- /*\
- * * Delay mode actions
- \*/
-
- public void reset_objects (GLib.ListStore? objects, bool recursively)
- {
- SettingsModel model = modifications_handler.model;
- if (objects == null)
- return;
-
- for (uint position = 0;; position++)
- {
- Object? object = ((!) objects).get_object (position);
- if (object == null)
- return;
-
- SettingObject setting_object = (SettingObject) ((!) object);
- if (setting_object is Directory)
- {
- if (recursively) {
- GLib.ListStore? children = model.get_children ((Directory) setting_object);
- if (children != null)
- reset_objects ((!) children, true);
- }
- continue;
- }
- if (setting_object is DConfKey)
- {
- if (!model.is_key_ghost ((DConfKey) setting_object))
- modifications_handler.add_delayed_setting ((Key) setting_object, null);
- }
- else if (!model.is_key_default ((GSettingsKey) setting_object))
- modifications_handler.add_delayed_setting ((Key) setting_object, null);
- }
- }
}
public interface BrowsableView
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index 592111f..31a16de 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -330,8 +330,7 @@ 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);
- revealer.warn_if_no_planned_changes ();
+ revealer.reset_objects (model.get_children (model.get_directory (path)), recursively);
}
private void enter_delay_mode (/* SimpleAction action, Variant? path_variant */)
diff --git a/editor/modifications-revealer.vala b/editor/modifications-revealer.vala
index 08956ab..05eb71d 100644
--- a/editor/modifications-revealer.vala
+++ b/editor/modifications-revealer.vala
@@ -79,13 +79,54 @@ class ModificationsRevealer : Revealer
modifications_handler.dismiss_delayed_settings ();
}
- public void warn_if_no_planned_changes ()
+ /*\
+ * * Reseting objects
+ \*/
+
+ public void reset_objects (GLib.ListStore? objects, bool recursively)
+ {
+ _reset_objects (objects, recursively);
+ warn_if_no_planned_changes ();
+ }
+
+ private void _reset_objects (GLib.ListStore? objects, bool recursively)
+ {
+ SettingsModel model = modifications_handler.model;
+ if (objects == null)
+ return;
+
+ for (uint position = 0;; position++)
+ {
+ Object? object = ((!) objects).get_object (position);
+ if (object == null)
+ return;
+
+ SettingObject setting_object = (SettingObject) ((!) object);
+ if (setting_object is Directory)
+ {
+ if (recursively) {
+ GLib.ListStore? children = model.get_children ((Directory) setting_object);
+ if (children != null)
+ _reset_objects ((!) children, true);
+ }
+ continue;
+ }
+ if (setting_object is DConfKey)
+ {
+ if (!model.is_key_ghost ((DConfKey) setting_object))
+ modifications_handler.add_delayed_setting ((Key) setting_object, null);
+ }
+ else if (!model.is_key_default ((GSettingsKey) setting_object))
+ modifications_handler.add_delayed_setting ((Key) setting_object, null);
+ }
+ }
+
+ private void warn_if_no_planned_changes ()
{
if (modifications_handler.dconf_changes_count == 0 && modifications_handler.gsettings_changes_count
== 0)
label.set_text (_("Nothing to reset."));
}
-
/*\
* * Utilities
\*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]