[gtk/wip/carlosg/drop-search-handle-event: 6/7] icon-browser: Drop usage of gtk_search_bar_handle_event()



commit edccf89020dbae75c130c701ae1765a35a3fa326
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Apr 3 13:18:37 2019 +0200

    icon-browser: Drop usage of gtk_search_bar_handle_event()
    
    Make it capture key events from the toplevel.

 demos/icon-browser/iconbrowserwin.c | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)
---
diff --git a/demos/icon-browser/iconbrowserwin.c b/demos/icon-browser/iconbrowserwin.c
index eb5db7d6e7..b6f3b456e3 100644
--- a/demos/icon-browser/iconbrowserwin.c
+++ b/demos/icon-browser/iconbrowserwin.c
@@ -285,19 +285,6 @@ populate (IconBrowserWindow *win)
   g_strfreev (groups);
 }
 
-static gboolean
-key_event_cb (GtkEventController *controller,
-              guint               keyval,
-              guint               keycode,
-              GdkModifierType     state,
-              gpointer            data)
-{
-  IconBrowserWindow *win = data;
-
-  return gtk_search_bar_handle_event (GTK_SEARCH_BAR (win->searchbar),
-                                      gtk_get_current_event ());
-}
-
 static void
 copy_to_clipboard (GtkButton         *button,
                    IconBrowserWindow *win)
@@ -452,7 +439,6 @@ static void
 icon_browser_window_init (IconBrowserWindow *win)
 {
   GdkContentFormats *list;
-  GtkEventController *controller;
 
   gtk_widget_init_template (GTK_WIDGET (win));
 
@@ -479,13 +465,11 @@ icon_browser_window_init (IconBrowserWindow *win)
 
   g_signal_connect (win->searchbar, "notify::search-mode-enabled",
                     G_CALLBACK (search_mode_toggled), win);
+  gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (win->searchbar),
+                                         GTK_WIDGET (win));
 
   symbolic_toggled (GTK_TOGGLE_BUTTON (win->symbolic_radio), win);
 
-  controller = gtk_event_controller_key_new ();
-  g_signal_connect (controller, "key-pressed", G_CALLBACK (key_event_cb), win);
-  gtk_widget_add_controller (GTK_WIDGET (win), controller);
-
   populate (win);
 }
 


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