diff options
author | Mohammed Sadiq <sadiq@sadiqpk.org> | 2018-06-14 23:23:14 +0530 |
---|---|---|
committer | Mohammed Sadiq <sadiq@sadiqpk.org> | 2018-06-14 23:23:17 +0530 |
commit | b2db7bb95b2043f880bbc575ce6cc56e9bac8253 (patch) | |
tree | 861b8c638c8ddd9fde6624dda359367ad70fb06b /examples | |
parent | bdf3b6f64d864815b891cd9bb00bd47c3e546c7c (diff) | |
download | gtk+-b2db7bb95b2043f880bbc575ce6cc56e9bac8253.tar.gz |
examples: Simplify handling events in search-bar
In search-bar example, we can use gtk_search_bar_set_key_capture_widget()
which would simplify handling keyboard events.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/search-bar.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/examples/search-bar.c b/examples/search-bar.c index c2a6f2d805..e75056e70f 100644 --- a/examples/search-bar.c +++ b/examples/search-bar.c @@ -20,7 +20,6 @@ activate_cb (GtkApplication *app, GtkWidget *box; GtkWidget *entry; GtkWidget *menu_button; - GtkEventController *controller; window = gtk_application_window_new (app); gtk_widget_show (window); @@ -41,12 +40,7 @@ activate_cb (GtkApplication *app, gtk_box_pack_start (GTK_BOX (box), menu_button); gtk_search_bar_connect_entry (GTK_SEARCH_BAR (search_bar), GTK_ENTRY (entry)); - - controller = gtk_event_controller_key_new (); - g_object_set_data_full (G_OBJECT (window), "controller", controller, g_object_unref); - g_signal_connect (controller, "key-pressed", - G_CALLBACK (window_key_pressed), search_bar); - gtk_widget_add_controller (window, controller); + gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (search_bar), window); } gint |