[gnome-clocks] Port event controllers



commit 9ea704008335243067f8243474db46eaa1fac4f4
Author: Maximiliano Sandoval R <msandova gnome org>
Date:   Mon Dec 13 15:27:40 2021 +0100

    Port event controllers

 src/application.vala           | 10 +++++-----
 src/world-location-dialog.vala |  7 +------
 2 files changed, 6 insertions(+), 11 deletions(-)
---
diff --git a/src/application.vala b/src/application.vala
index 337b6018..606e6a7c 100644
--- a/src/application.vala
+++ b/src/application.vala
@@ -98,11 +98,11 @@ public class Application : Gtk.Application {
         var win = ensure_window ();
         win.present ();
 
-        // TODO GTK 4
-        // win.focus_in_event.connect (() => {
-        //     withdraw_notifications ();
-        //     return false;
-        // });
+        var controller = new Gtk.EventControllerFocus ();
+        controller.enter.connect (() => {
+                withdraw_notifications ();
+            });
+        ((Gtk.Widget) win).add_controller (controller);
     }
 
     private void update_theme (Gtk.Settings settings) {
diff --git a/src/world-location-dialog.vala b/src/world-location-dialog.vala
index aefdf9ef..6ec88fd7 100644
--- a/src/world-location-dialog.vala
+++ b/src/world-location-dialog.vala
@@ -58,12 +58,7 @@ private class LocationDialog : Gtk.Window {
     public LocationDialog (Gtk.Window parent, Face world_face) {
         Object (transient_for: parent);
 
-        // TODO GTK 4
-        // key_press_event.connect ((event) => {
-        //     if (event.keyval == Gdk.Key.Tab)
-        //         return Gdk.EVENT_PROPAGATE;
-        //     return location_entry.handle_event (event);
-        // });
+        location_entry.set_key_capture_widget (this);
 
         world = world_face;
 


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