[file-roller/wip/iainl/keypress-fixes: 310/312] fr-window: Use GtkSearchEntry::stop-search instead of handling manually
- From: Jan Tojnar <jtojnar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [file-roller/wip/iainl/keypress-fixes: 310/312] fr-window: Use GtkSearchEntry::stop-search instead of handling manually
- Date: Wed, 30 Mar 2022 18:51:14 +0000 (UTC)
commit f7e8ae6d5c2a71335a62dc21b1b9d6c5bbd6d400
Author: Iain Lane <iainl gnome org>
Date: Tue Apr 23 12:31:55 2019 +0100
fr-window: Use GtkSearchEntry::stop-search instead of handling manually
This is a bit of technical debt cleanup. We don't need to handle
cancelling the search entry at the low level key handler layer any more.
Requires GTK 3.16.
src/fr-window.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
---
diff --git a/src/fr-window.c b/src/fr-window.c
index 4aa5445d..3478a321 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -4802,17 +4802,8 @@ key_press_cb (GtkWidget *widget,
if (gtk_widget_has_focus (window->priv->location_entry))
return GDK_EVENT_PROPAGATE;
- if (gtk_widget_has_focus (window->priv->filter_entry)) {
- switch (event->keyval) {
- case GDK_KEY_Escape:
- fr_window_deactivate_filter (window);
- retval = GDK_EVENT_STOP;
- break;
- default:
- break;
- }
- return retval;
- }
+ if (gtk_widget_has_focus (window->priv->filter_entry))
+ return GDK_EVENT_PROPAGATE;
alt = (event->state & GDK_MOD1_MASK) == GDK_MOD1_MASK;
@@ -5416,6 +5407,12 @@ filter_entry_search_changed_cb (GtkEntry *entry,
fr_window_activate_filter (window);
}
+static void
+filter_entry_stop_search_cb (GtkSearchEntry *entry,
+ FrWindow *window)
+{
+ fr_window_deactivate_filter (window);
+}
static void
fr_window_attach (FrWindow *window,
@@ -5701,6 +5698,10 @@ fr_window_construct (FrWindow *window)
"search-changed",
G_CALLBACK (filter_entry_search_changed_cb),
window);
+ g_signal_connect (G_OBJECT (window->priv->filter_entry),
+ "stop-search",
+ G_CALLBACK (filter_entry_stop_search_cb),
+ window);
gtk_search_bar_connect_entry (GTK_SEARCH_BAR (window->priv->filter_bar), GTK_ENTRY
(window->priv->filter_entry));
gtk_container_add (GTK_CONTAINER (window->priv->filter_bar), filter_box);
gtk_box_pack_start (GTK_BOX (filter_box), window->priv->filter_entry, TRUE, TRUE, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]