[nautilus/wip/antoniof/experimental-gtk4-build: 39/55] general: Replace GtkBindingSet with GtkShortcut
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/experimental-gtk4-build: 39/55] general: Replace GtkBindingSet with GtkShortcut
- Date: Sat, 1 Jan 2022 21:47:02 +0000 (UTC)
commit 3a30b7abfaa5a7652c65cfb1e882d080177ca5ff
Author: António Fernandes <antoniof gnome org>
Date: Fri Dec 24 01:15:28 2021 +0000
general: Replace GtkBindingSet with GtkShortcut
As per porting guide.
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 f0ab92a5d..89da15bb5 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -5305,7 +5305,6 @@ select_image_button_callback (GtkWidget *widget,
static void
nautilus_properties_window_class_init (NautilusPropertiesWindowClass *klass)
{
- GtkBindingSet *binding_set;
GtkWidgetClass *widget_class;
GObjectClass *oclass;
@@ -5314,15 +5313,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");
@@ -5415,5 +5408,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]