[dconf-editor] Allow KeyEditorChildArray TextView activation.



commit dba318995e02e53d40a93c1c1491e99f110088ae
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Sun Dec 3 16:30:16 2017 +0100

    Allow KeyEditorChildArray TextView activation.

 editor/dconf-view.vala |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/editor/dconf-view.vala b/editor/dconf-view.vala
index bc10f67..551280c 100644
--- a/editor/dconf-view.vala
+++ b/editor/dconf-view.vala
@@ -468,6 +468,17 @@ private class KeyEditorChildArray : Frame, KeyEditorChild
         text_view.expand = true;
         text_view.wrap_mode = WrapMode.WORD;
         text_view.monospace = true;
+        text_view.key_press_event.connect ((event) => {
+                string keyval_name = (!) (Gdk.keyval_name (event.keyval) ?? "");
+                if ((keyval_name == "Return" || keyval_name == "KP_Enter")
+                && ((event.state & Gdk.ModifierType.MODIFIER_MASK) == 0)
+                && (test_value ()))
+                {
+                    child_activated ();
+                    return true;
+                }
+                return base.key_press_event (event);
+            });
         // https://bugzilla.gnome.org/show_bug.cgi?id=789676
         text_view.button_press_event.connect_after (() => Gdk.EVENT_STOP);
         text_view.button_release_event.connect_after (() => Gdk.EVENT_STOP);
@@ -504,12 +515,6 @@ private class KeyEditorChildArray : Frame, KeyEditorChild
 
     private bool test_value ()
     {
-        if (variant_type == "s")
-        {
-            variant = new Variant.string (text_view.buffer.text);
-            return true;
-        }
-
         string tmp_text = text_view.buffer.text; // don't put in the try{} for correct C code
         try
         {


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