[polari] joinDialog: Handle Escape in name entry



commit 321640b95f5905cf58c5010671b4ff2b87f2dca4
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Feb 16 23:08:06 2017 +0100

    joinDialog: Handle Escape in name entry
    
    Now that the entry has been changed to a SearchEntry, it consumes
    Escape key presses itself for the ::stop-search keybinding signal
    rather than letting it bubble up to the dialog. Not being able to
    dismiss the dialog via keyboard is inconvenient, so handle Escape
    manually to clear the entry if it contains any text, or dismiss
    the dialog otherwise.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=778797

 src/joinDialog.js |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/joinDialog.js b/src/joinDialog.js
index abc321e..2b6c992 100644
--- a/src/joinDialog.js
+++ b/src/joinDialog.js
@@ -113,6 +113,13 @@ const JoinDialog = new Lang.Class({
 
         this._nameEntry.connect('changed',
                                 Lang.bind(this, this._updateCanJoin));
+        this._nameEntry.connect('stop-search', Lang.bind(this,
+            function() {
+                if (this._nameEntry.text.length > 0)
+                    this._nameEntry.text = '';
+                else
+                    this.response(Gtk.ResponseType.CANCEL);
+            }));
         this._serverRoomList.connect('notify::can-join',
                                      Lang.bind(this, this._updateCanJoin));
         this._serverRoomList.bind_property('loading', this._spinner, 'active',


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