[gnome-contacts] Allow escape key to cancel custom type entry



commit 01004bc7cfd0ad590a853be120bbb1895ff02888
Author: Alexander Larsson <alexl redhat com>
Date:   Wed Aug 31 12:41:14 2011 +0200

    Allow escape key to cancel custom type entry

 src/contacts-types.vala |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/contacts-types.vala b/src/contacts-types.vala
index 2c4b3c0..590252c 100644
--- a/src/contacts-types.vala
+++ b/src/contacts-types.vala
@@ -375,6 +375,7 @@ public class Contacts.TypeCombo : Grid  {
     combo.changed.connect (combo_changed);
     entry.focus_out_event.connect (entry_focus_out_event);
     entry.activate.connect (entry_activate);
+    entry.key_release_event.connect (entry_key_release);
   }
 
   private void finish_custom () {
@@ -402,6 +403,14 @@ public class Contacts.TypeCombo : Grid  {
     finish_custom ();
   }
 
+  private bool entry_key_release (Gdk.EventKey event) {
+    if (event.keyval == Gdk.keyval_from_name ("Escape")) {
+      entry.set_text ("");
+      finish_custom ();
+    }
+    return true;
+  }
+
   private bool entry_focus_out_event (Gdk.EventFocus event) {
     finish_custom ();
     return false;



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