[dconf-editor] Rework KeyEditorChildNullableBool constructor.
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Rework KeyEditorChildNullableBool constructor.
- Date: Thu, 1 Feb 2018 01:20:22 +0000 (UTC)
commit 3be0eab7961c25b32fcb110f2303fb71a78f2392
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Thu Feb 1 00:53:05 2018 +0100
Rework KeyEditorChildNullableBool constructor.
editor/dconf-view.vala | 13 ++-----------
editor/registry-info.vala | 7 ++++++-
2 files changed, 8 insertions(+), 12 deletions(-)
---
diff --git a/editor/dconf-view.vala b/editor/dconf-view.vala
index da67c1f..a1b61b0 100644
--- a/editor/dconf-view.vala
+++ b/editor/dconf-view.vala
@@ -155,8 +155,7 @@ private class KeyEditorChildNullableBool : MenuButton, KeyEditorChild
private Variant? maybe_variant;
private GLib.Action action;
- public KeyEditorChildNullableBool (Key key, Variant initial_value, ModificationsHandler
modifications_handler)
- requires (key.type_string == "mb")
+ public KeyEditorChildNullableBool (Variant initial_value, bool delay_mode, bool has_planned_change,
Variant? range_content_or_null)
{
this.visible = true;
this.hexpand = true;
@@ -165,15 +164,7 @@ private class KeyEditorChildNullableBool : MenuButton, KeyEditorChild
this.width_request = 100;
ContextPopover popover = new ContextPopover ();
- Variant? range_content_or_null = null;
- if (key is GSettingsKey)
- range_content_or_null = ((GSettingsKey) key).range_content;
- action = popover.create_buttons_list (false,
- modifications_handler.get_current_delay_mode (),
- modifications_handler.key_has_planned_change (key.full_name),
- "mb",
- modifications_handler.get_key_custom_value (key),
- range_content_or_null);
+ action = popover.create_buttons_list (false, delay_mode, has_planned_change, "mb", initial_value,
range_content_or_null);
popover.set_relative_to (this);
popover.value_changed.connect ((gvariant) => {
diff --git a/editor/registry-info.vala b/editor/registry-info.vala
index e033936..abc460b 100644
--- a/editor/registry-info.vala
+++ b/editor/registry-info.vala
@@ -303,7 +303,12 @@ class RegistryInfo : Grid, BrowsableView
case "d":
return (KeyEditorChild) new KeyEditorChildNumberDouble (initial_value);
case "mb":
- return (KeyEditorChild) new KeyEditorChildNullableBool (key, initial_value,
modifications_handler);
+ bool delay_mode = modifications_handler.get_current_delay_mode ();
+ bool has_planned_change = modifications_handler.key_has_planned_change (key.full_name);
+ Variant? range_content_or_null = null;
+ if (key is GSettingsKey)
+ range_content_or_null = ((GSettingsKey) key).range_content;
+ return (KeyEditorChild) new KeyEditorChildNullableBool (initial_value, delay_mode,
has_planned_change, range_content_or_null);
default:
if ("a" in key.type_string)
return (KeyEditorChild) new KeyEditorChildArray (key.type_string, initial_value);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]