[dconf-editor] Correct KeyEditorChildNumber* behaviour.



commit fa08f2f6827f797af3d2145ff2937c3e72e744ea
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Sat Jul 2 17:22:37 2016 +0200

    Correct KeyEditorChildNumber* behaviour.

 editor/dconf-view.vala |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/editor/dconf-view.vala b/editor/dconf-view.vala
index 2787cf2..30b3d5a 100644
--- a/editor/dconf-view.vala
+++ b/editor/dconf-view.vala
@@ -207,7 +207,7 @@ private class KeyEditorChildBool : Grid, KeyEditorChild // might be managed by a
 
 private class KeyEditorChildNumberDouble : SpinButton, KeyEditorChild
 {
-    private uint locked = 0;
+    private bool locked = false;
 
     public KeyEditorChildNumberDouble (Key key)
         requires (key.type_string == "d")
@@ -236,8 +236,7 @@ private class KeyEditorChildNumberDouble : SpinButton, KeyEditorChild
         this.input_purpose = InputPurpose.NUMBER;
         this.width_chars = 30;
 
-        this.buffer.deleted_text.connect (() => { if (locked > 0) locked -= 1; else value_has_changed (true, 
true); });     // TODO test value for
-        this.buffer.inserted_text.connect (() => { if (locked > 0) locked -= 1; else value_has_changed 
(true, true); });    //   non-numeric chars
+        this.value_changed.connect (() => { if (locked) locked = false; else value_has_changed (true, true); 
});   // TODO test value for non-numeric chars
         this.activate.connect (() => { update (); child_activated (); });
     }
 
@@ -248,7 +247,7 @@ private class KeyEditorChildNumberDouble : SpinButton, KeyEditorChild
 
     public void reload (Variant gvariant)
     {
-        locked = 2;
+        locked = true;
         this.set_value (gvariant.get_double ());
         value_has_changed (false);  // set disable_revealer_for_value to false, might be useful for corner 
cases
     }
@@ -257,7 +256,7 @@ private class KeyEditorChildNumberDouble : SpinButton, KeyEditorChild
 private class KeyEditorChildNumberInt : SpinButton, KeyEditorChild
 {
     private string key_type;
-    private uint locked = 0;
+    private bool locked = false;
 
     public KeyEditorChildNumberInt (Key key)
         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" ||
@@ -286,8 +285,7 @@ private class KeyEditorChildNumberInt : SpinButton, KeyEditorChild
         this.input_purpose = InputPurpose.NUMBER;   // TODO could be DIGITS for UnsignedInt
         this.width_chars = 30;
 
-        this.buffer.deleted_text.connect (() => { if (locked > 0) locked -= 1; else value_has_changed (true, 
true); });     // TODO test value for
-        this.buffer.inserted_text.connect (() => { if (locked > 0) locked -= 1; else value_has_changed 
(true, true); });    //   non-numeric chars
+        this.value_changed.connect (() => { if (locked) locked = false; else value_has_changed (true, true); 
});   // TODO test value for non-numeric chars
         this.activate.connect (() => { update (); child_activated (); });
     }
 
@@ -335,7 +333,7 @@ private class KeyEditorChildNumberInt : SpinButton, KeyEditorChild
 
     public void reload (Variant gvariant)
     {
-        locked = 2;
+        locked = true;
         this.set_value (get_variant_as_double (gvariant));
         value_has_changed (false);  // set disable_revealer_for_value to false, might be useful for corner 
cases
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]