diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2018-06-26 22:35:03 +0200 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2018-07-30 13:14:12 +0200 |
commit | 4d59a00074a083cca45545f4b5496d47de7542da (patch) | |
tree | b106279a187402982b30b9a71610d47b1e43a7ee /demos | |
parent | 2dbb1509d8c434e9371af5d07a418e4b1bc50673 (diff) | |
download | gtk+-4d59a00074a083cca45545f4b5496d47de7542da.tar.gz |
demos: Update search_entry2 demo to use key capturing API
No more GdkEvent juggling.
Diffstat (limited to 'demos')
-rw-r--r-- | demos/gtk-demo/search_entry2.c | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/demos/gtk-demo/search_entry2.c b/demos/gtk-demo/search_entry2.c index 6337ee1938..beb6db4c0a 100644 --- a/demos/gtk-demo/search_entry2.c +++ b/demos/gtk-demo/search_entry2.c @@ -26,17 +26,6 @@ changed_cb (GtkEditable *editable) g_message ("changed: %s", text); } -static gboolean -window_event_cb (GtkWidget *widget, - GdkEvent *event, - GtkSearchBar *bar) -{ - if (gdk_event_get_event_type (event) == GDK_KEY_PRESS) - return gtk_search_bar_handle_event (bar, event); - - return GDK_EVENT_PROPAGATE; -} - static void search_changed (GtkSearchEntry *entry, GtkLabel *label) @@ -102,7 +91,7 @@ do_search_entry2 (GtkWidget *do_widget) gtk_box_pack_start (GTK_BOX (vbox), searchbar); /* Hook the search bar to key presses */ - g_signal_connect (window, "event", G_CALLBACK (window_event_cb), searchbar); + gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (searchbar), window); /* Help */ label = gtk_label_new ("Start Typing to search"); |