[dconf-editor] Rework KeyEditorChildNumberInt constructor.
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Rework KeyEditorChildNumberInt constructor.
- Date: Thu, 1 Feb 2018 01:20:27 +0000 (UTC)
commit 874627ae5027b4bfdd034930521e7622ab2565a9
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Thu Feb 1 01:36:47 2018 +0100
Rework KeyEditorChildNumberInt constructor.
editor/dconf-view.vala | 14 +++++++-------
editor/registry-info.vala | 14 ++++++++------
2 files changed, 15 insertions(+), 13 deletions(-)
---
diff --git a/editor/dconf-view.vala b/editor/dconf-view.vala
index a1b61b0..3d6764c 100644
--- a/editor/dconf-view.vala
+++ b/editor/dconf-view.vala
@@ -337,23 +337,23 @@ private class KeyEditorChildNumberInt : SpinButton, KeyEditorChild
private ulong deleted_text_handler = 0;
private ulong inserted_text_handler = 0;
- public KeyEditorChildNumberInt (Key key, Variant initial_value)
- requires (key.type_string == "y" || key.type_string == "n" || key.type_string == "q" ||
key.type_string == "i" || key.type_string == "u" || key.type_string == "h") // TODO key.type_string ==
"x" || key.type_string == "t" ||
+ public KeyEditorChildNumberInt (Variant initial_value, string type_string, Variant?
range_content_or_null)
+ requires (type_string == "y" || type_string == "n" || type_string == "q" || type_string == "i" ||
type_string == "u" || type_string == "h") // TODO type_string == "x" || type_string == "t" ||
{
- this.key_type = key.type_string;
+ this.key_type = type_string;
this.visible = true;
this.hexpand = true;
this.halign = Align.START;
double min, max;
- if (key is GSettingsKey && ((GSettingsKey) key).range_type == "range")
+ if (range_content_or_null != null)
{
- min = get_variant_as_double (((GSettingsKey) key).range_content.get_child_value (0));
- max = get_variant_as_double (((GSettingsKey) key).range_content.get_child_value (1));
+ min = get_variant_as_double (((!) range_content_or_null).get_child_value (0));
+ max = get_variant_as_double (((!) range_content_or_null).get_child_value (1));
}
else
- get_min_and_max_double (out min, out max, key.type_string);
+ get_min_and_max_double (out min, out max, type_string);
Adjustment adjustment = new Adjustment (get_variant_as_double (initial_value), min, max, 1.0, 5.0,
0.0);
this.configure (adjustment, 1.0, 0);
diff --git a/editor/registry-info.vala b/editor/registry-info.vala
index abc460b..8a282d6 100644
--- a/editor/registry-info.vala
+++ b/editor/registry-info.vala
@@ -282,24 +282,26 @@ class RegistryInfo : Grid, BrowsableView
case "i":
case "h":
// TODO "x" is not working in spinbuttons (double-based)
+ Variant? range = null;
if (has_schema && (((GSettingsKey) key).range_type == "range"))
{
- Variant range = ((GSettingsKey) key).range_content;
- if (Key.get_variant_as_int64 (range.get_child_value (0)) == Key.get_variant_as_int64
(range.get_child_value (1)))
+ range = ((GSettingsKey) key).range_content;
+ if (Key.get_variant_as_int64 (((!) range).get_child_value (0)) ==
Key.get_variant_as_int64 (((!) range).get_child_value (1)))
return (KeyEditorChild) new KeyEditorChildSingle (model.get_key_value (key),
model.get_key_value (key).print (false));
}
- return (KeyEditorChild) new KeyEditorChildNumberInt (key, initial_value);
+ return (KeyEditorChild) new KeyEditorChildNumberInt (initial_value, key.type_string, range);
case "y":
case "q":
case "u":
// TODO "t" is not working in spinbuttons (double-based)
+ Variant? range = null;
if (has_schema && (((GSettingsKey) key).range_type == "range"))
{
- Variant range = ((GSettingsKey) key).range_content;
- if (Key.get_variant_as_uint64 (range.get_child_value (0)) == Key.get_variant_as_uint64
(range.get_child_value (1)))
+ range = ((GSettingsKey) key).range_content;
+ if (Key.get_variant_as_uint64 (((!) range).get_child_value (0)) ==
Key.get_variant_as_uint64 (((!) range).get_child_value (1)))
return (KeyEditorChild) new KeyEditorChildSingle (model.get_key_value (key),
model.get_key_value (key).print (false));
}
- return (KeyEditorChild) new KeyEditorChildNumberInt (key, initial_value);
+ return (KeyEditorChild) new KeyEditorChildNumberInt (initial_value, key.type_string, range);
case "d":
return (KeyEditorChild) new KeyEditorChildNumberDouble (initial_value);
case "mb":
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]