[epiphany/gnome-3-20] Emit close Signal to GtkDialog if GtkSearchEntry is focused
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/gnome-3-20] Emit close Signal to GtkDialog if GtkSearchEntry is focused
- Date: Sun, 3 Apr 2016 22:33:08 +0000 (UTC)
commit d996d897323186a1ce9d1f535b0943168d20685c
Author: Günther Wutz <info gunibert de>
Date: Thu Mar 31 12:52:47 2016 +0200
Emit close Signal to GtkDialog if GtkSearchEntry is focused
https://bugzilla.gnome.org/show_bug.cgi?id=764408
src/ephy-history-window.c | 14 ++++++++++++++
src/resources/history-dialog.ui | 1 +
2 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c
index 544e666..3fcd7c3 100644
--- a/src/ephy-history-window.c
+++ b/src/ephy-history-window.c
@@ -522,6 +522,19 @@ on_search_entry_changed (GtkSearchEntry *entry,
filter_now (self);
}
+static gboolean
+on_search_key_press_event (GtkWidget *widget,
+ GdkEventKey *event,
+ EphyHistoryWindow *self)
+{
+ if (event->keyval == GDK_KEY_Escape) {
+ g_signal_emit_by_name (self, "close", NULL);
+ return GDK_EVENT_STOP;
+ }
+
+ return GDK_EVENT_PROPAGATE;
+}
+
static void
update_selection_actions (GActionGroup *action_group,
gboolean has_selection)
@@ -713,6 +726,7 @@ ephy_history_window_class_init (EphyHistoryWindowClass *klass)
gtk_widget_class_bind_template_callback (widget_class, on_treeview_selection_changed);
gtk_widget_class_bind_template_callback (widget_class, on_treeview_column_clicked_event);
gtk_widget_class_bind_template_callback (widget_class, on_search_entry_changed);
+ gtk_widget_class_bind_template_callback (widget_class, on_search_key_press_event);
}
static void
diff --git a/src/resources/history-dialog.ui b/src/resources/history-dialog.ui
index 86425a4..ef6b226 100644
--- a/src/resources/history-dialog.ui
+++ b/src/resources/history-dialog.ui
@@ -70,6 +70,7 @@
<property name="primary_icon_sensitive">False</property>
<property name="placeholder_text" translatable="yes">Search history</property>
<signal name="search-changed" handler="on_search_entry_changed"/>
+ <signal name="key-press-event" handler="on_search_key_press_event"/>
</object>
</child>
<child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]