[nautilus/wip/antoniof/experimental-gtk4-build: 40/52] GtkBindingSet -> GtkShortcut




commit 16e360ba0fbee058b8809f1914f12895129f0f08
Author: António Fernandes <antoniof gnome org>
Date:   Fri Dec 24 01:15:28 2021 +0000

    GtkBindingSet -> GtkShortcut

 src/nautilus-location-entry.c    |  8 ++++----
 src/nautilus-properties-window.c | 14 +++-----------
 src/nautilus-query-editor.c      |  9 ++++-----
 3 files changed, 11 insertions(+), 20 deletions(-)
---
diff --git a/src/nautilus-location-entry.c b/src/nautilus-location-entry.c
index 0333b4ab4..73fda840f 100644
--- a/src/nautilus-location-entry.c
+++ b/src/nautilus-location-entry.c
@@ -818,8 +818,7 @@ nautilus_location_entry_class_init (NautilusLocationEntryClass *class)
 {
     GObjectClass *gobject_class;
     GtkEntryClass *entry_class;
-    GtkBindingSet *binding_set;
-
+    g_autoptr (GtkShortcut) shortcut = NULL;
 
     gobject_class = G_OBJECT_CLASS (class);
     gobject_class->dispose = nautilus_location_entry_dispose;
@@ -848,8 +847,9 @@ nautilus_location_entry_class_init (NautilusLocationEntryClass *class)
                                     g_cclosure_marshal_generic,
                                     G_TYPE_NONE, 1, G_TYPE_OBJECT);
 
-    binding_set = gtk_binding_set_by_class (class);
-    gtk_binding_entry_add_signal (binding_set, GDK_KEY_Escape, 0, "cancel", 0);
+    shortcut = gtk_shortcut_new (gtk_keyval_trigger_new (GDK_KEY_Escape, 0),
+                                 gtk_signal_action_new ("cancel"));
+    gtk_widget_class_add_shortcut (GTK_WIDGET_CLASS (class), shortcut);
 }
 
 void
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index b3f02b3ac..e92cba9f8 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -5297,7 +5297,6 @@ select_image_button_callback (GtkWidget                *widget,
 static void
 nautilus_properties_window_class_init (NautilusPropertiesWindowClass *klass)
 {
-    GtkBindingSet *binding_set;
     GtkWidgetClass *widget_class;
     GObjectClass *oclass;
 
@@ -5306,15 +5305,9 @@ nautilus_properties_window_class_init (NautilusPropertiesWindowClass *klass)
     oclass->dispose = real_dispose;
     oclass->finalize = real_finalize;
 
-    binding_set = gtk_binding_set_by_class (klass);
-    g_signal_new ("close",
-                  G_OBJECT_CLASS_TYPE (klass),
-                  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-                  0, NULL, NULL,
-                  g_cclosure_marshal_VOID__VOID,
-                  G_TYPE_NONE, 0);
-    gtk_binding_entry_add_signal (binding_set, GDK_KEY_Escape, 0,
-                                  "close", 0);
+    gtk_widget_class_add_binding (widget_class,
+                                  GDK_KEY_Escape, 0,
+                                  (GtkShortcutFunc) gtk_window_close, NULL);
 
     gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/nautilus/ui/nautilus-properties-window.ui");
 
@@ -5407,5 +5400,4 @@ static void
 nautilus_properties_window_init (NautilusPropertiesWindow *self)
 {
     gtk_widget_init_template (GTK_WIDGET (self));
-    g_signal_connect (self, "close", G_CALLBACK (gtk_window_close), NULL);
 }
diff --git a/src/nautilus-query-editor.c b/src/nautilus-query-editor.c
index dcb6e5e59..a4b67809e 100644
--- a/src/nautilus-query-editor.c
+++ b/src/nautilus-query-editor.c
@@ -252,6 +252,7 @@ nautilus_query_editor_class_init (NautilusQueryEditorClass *class)
 {
     GObjectClass *gobject_class;
     GtkWidgetClass *widget_class;
+    g_autoptr (GtkShortcut) shortcut = NULL;
 
     gobject_class = G_OBJECT_CLASS (class);
     gobject_class->finalize = nautilus_query_editor_finalize;
@@ -298,11 +299,9 @@ nautilus_query_editor_class_init (NautilusQueryEditorClass *class)
                       g_cclosure_marshal_VOID__VOID,
                       G_TYPE_NONE, 0);
 
-    gtk_binding_entry_add_signal (gtk_binding_set_by_class (class),
-                                  GDK_KEY_Down,
-                                  0,
-                                  "focus-view",
-                                  0);
+    shortcut = gtk_shortcut_new (gtk_keyval_trigger_new (GDK_KEY_Down, 0),
+                                 gtk_signal_action_new ("focus-view"));
+    gtk_widget_class_add_shortcut (widget_class, shortcut);
 
     /**
      * NautilusQueryEditor::location:


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