[gtk/emoji-chooser-fixes: 2/3] emoji chooser: Make Escape work again



commit 6fe203d0e207acfcaf5845098386ba9d690dac74
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat May 4 16:55:52 2019 +0000

    emoji chooser: Make Escape work again
    
    Escape is expected to close the Emoji chooser.

 gtk/gtkemojichooser.c     | 8 ++++++++
 gtk/ui/gtkemojichooser.ui | 1 +
 2 files changed, 9 insertions(+)
---
diff --git a/gtk/gtkemojichooser.c b/gtk/gtkemojichooser.c
index 0f8763c4f0..bd3760d8bf 100644
--- a/gtk/gtkemojichooser.c
+++ b/gtk/gtkemojichooser.c
@@ -609,6 +609,13 @@ search_changed (GtkEntry *entry,
   update_headings (chooser);
 }
 
+static void
+stop_search (GtkEntry *entry,
+             gpointer  data)
+{
+  gtk_popover_popdown (GTK_POPOVER (data));
+}
+
 static void
 setup_section (GtkEmojiChooser *chooser,
                EmojiSection   *section,
@@ -760,6 +767,7 @@ gtk_emoji_chooser_class_init (GtkEmojiChooserClass *klass)
 
   gtk_widget_class_bind_template_callback (widget_class, emoji_activated);
   gtk_widget_class_bind_template_callback (widget_class, search_changed);
+  gtk_widget_class_bind_template_callback (widget_class, stop_search);
   gtk_widget_class_bind_template_callback (widget_class, pressed_cb);
   gtk_widget_class_bind_template_callback (widget_class, long_pressed_cb);
 }
diff --git a/gtk/ui/gtkemojichooser.ui b/gtk/ui/gtkemojichooser.ui
index 1f7a2e9485..e32d977526 100644
--- a/gtk/ui/gtkemojichooser.ui
+++ b/gtk/ui/gtkemojichooser.ui
@@ -10,6 +10,7 @@
         <child>
           <object class="GtkSearchEntry" id="search_entry">
             <signal name="search-changed" handler="search_changed"/>
+            <signal name="stop-search" handler="stop_search"/>
           </object>
         </child>
         <child>


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