[dconf-editor] Correct KeyEditorChildNumberInt behaviour. (2nd test)
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Correct KeyEditorChildNumberInt behaviour. (2nd test)
- Date: Tue, 5 Jul 2016 01:56:54 +0000 (UTC)
commit 85f9e6b17687d5f7eff640c3a6fdd4616e702987
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Tue Jul 5 03:56:38 2016 +0200
Correct KeyEditorChildNumberInt behaviour. (2nd test)
editor/dconf-view.vala | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/editor/dconf-view.vala b/editor/dconf-view.vala
index 2787cf2..1e538b3 100644
--- a/editor/dconf-view.vala
+++ b/editor/dconf-view.vala
@@ -243,7 +243,7 @@ private class KeyEditorChildNumberDouble : SpinButton, KeyEditorChild
public Variant get_variant ()
{
- return new Variant.double (this.get_value ());
+ return new Variant.double (this.get_value ()); // TODO parse the text instead of getting the value,
or updates when editing manually are buggy
}
public void reload (Variant gvariant)
@@ -323,15 +323,19 @@ private class KeyEditorChildNumberInt : SpinButton, KeyEditorChild
{
switch (key_type)
{
- case "y": return new Variant.byte ((uchar) this.get_value_as_int ()); // TODO uchar or
uint8?
- case "n": return new Variant.int16 ((int16) this.get_value_as_int ());
- case "q": return new Variant.uint16 ((uint16) this.get_value_as_int ());
- case "i": return new Variant.int32 (this.get_value_as_int ());
- case "u": return new Variant.uint32 ((uint32) this.get_value ()); // TODO also use
get_value_as_int?
- case "h": return new Variant.handle (this.get_value_as_int ());
+ case "y": return new Variant.byte ((uchar) get_int64_from_entry ()); // TODO uchar or uint8?
+ case "n": return new Variant.int16 ((int16) get_int64_from_entry ());
+ case "q": return new Variant.uint16 ((uint16) get_int64_from_entry ());
+ case "i": return new Variant.int32 ((int32) get_int64_from_entry ());
+ case "u": return new Variant.uint32 ((uint32) get_int64_from_entry ()); // TODO also use
get_value_as_int?
+ case "h": return new Variant.handle ((int32) get_int64_from_entry ());
default: assert_not_reached ();
}
}
+ private int64 get_int64_from_entry ()
+ {
+ return int64.parse (this.get_text ());
+ }
public void reload (Variant gvariant)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]