[gtk/wip/ebassi/shortcut: 23/85] filechooserwidget: Port bindings to use shortcuts
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/ebassi/shortcut: 23/85] filechooserwidget: Port bindings to use shortcuts
- Date: Fri, 31 Jan 2020 16:01:45 +0000 (UTC)
commit 810716e01ec9c1604e52b7d498e12ae161ff7f78
Author: Benjamin Otte <otte redhat com>
Date: Sun Aug 12 03:15:00 2018 +0200
filechooserwidget: Port bindings to use shortcuts
gtk/gtkfilechooserwidget.c | 121 ++++++++++++++++++++++-----------------------
1 file changed, 59 insertions(+), 62 deletions(-)
---
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index 12988b498c..a93640e18c 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -23,7 +23,6 @@
#include "gtkfilechooserwidgetprivate.h"
#include "gtkbookmarksmanagerprivate.h"
-#include "gtkbindings.h"
#include "gtkbutton.h"
#include "gtkcelllayout.h"
#include "gtkcellrendererpixbuf.h"
@@ -7910,18 +7909,20 @@ show_hidden_handler (GtkFileChooserWidget *impl)
}
static void
-add_normal_and_shifted_binding (GtkBindingSet *binding_set,
+add_normal_and_shifted_binding (GtkWidgetClass *widget_class,
guint keyval,
GdkModifierType modifiers,
const gchar *signal_name)
{
- gtk_binding_entry_add_signal (binding_set,
- keyval, modifiers,
- signal_name, 0);
+ gtk_widget_class_add_binding_signal (widget_class,
+ keyval, modifiers,
+ signal_name,
+ NULL);
- gtk_binding_entry_add_signal (binding_set,
- keyval, modifiers | GDK_SHIFT_MASK,
- signal_name, 0);
+ gtk_widget_class_add_binding_signal (widget_class,
+ keyval, modifiers | GDK_SHIFT_MASK,
+ signal_name,
+ NULL);
}
static void
@@ -7932,7 +7933,6 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
};
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
- GtkBindingSet *binding_set;
gint i;
gobject_class->finalize = gtk_file_chooser_widget_finalize;
@@ -8213,71 +8213,68 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
NULL,
G_TYPE_NONE, 0);
- binding_set = gtk_binding_set_by_class (class);
-
- gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_l, GDK_CONTROL_MASK,
- "location-toggle-popup",
- 0);
+ gtk_widget_class_add_binding_signal (widget_class,
+ GDK_KEY_l, GDK_CONTROL_MASK,
+ "location-toggle-popup",
+ NULL);
- gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_v, GDK_CONTROL_MASK,
- "location-popup-on-paste",
- 0);
+ gtk_widget_class_add_binding_signal (widget_class,
+ GDK_KEY_v, GDK_CONTROL_MASK,
+ "location-popup-on-paste",
+ NULL);
- add_normal_and_shifted_binding (binding_set,
+ add_normal_and_shifted_binding (widget_class,
GDK_KEY_Up, GDK_MOD1_MASK,
"up-folder");
-
- add_normal_and_shifted_binding (binding_set,
+ add_normal_and_shifted_binding (widget_class,
GDK_KEY_KP_Up, GDK_MOD1_MASK,
"up-folder");
- add_normal_and_shifted_binding (binding_set,
+ add_normal_and_shifted_binding (widget_class,
GDK_KEY_Down, GDK_MOD1_MASK,
"down-folder");
- add_normal_and_shifted_binding (binding_set,
+ add_normal_and_shifted_binding (widget_class,
GDK_KEY_KP_Down, GDK_MOD1_MASK,
"down-folder");
- gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_Home, GDK_MOD1_MASK,
- "home-folder",
- 0);
- gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_KP_Home, GDK_MOD1_MASK,
- "home-folder",
- 0);
- gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_d, GDK_MOD1_MASK,
- "desktop-folder",
- 0);
- gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_h, GDK_CONTROL_MASK,
- "show-hidden",
- 0);
- gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_s, GDK_MOD1_MASK,
- "search-shortcut",
- 0);
- gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_f, GDK_CONTROL_MASK,
- "search-shortcut",
- 0);
- gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_r, GDK_MOD1_MASK,
- "recent-shortcut",
- 0);
- gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_p, GDK_MOD1_MASK,
- "places-shortcut",
- 0);
-
- for (i = 0; i < 10; i++)
- gtk_binding_entry_add_signal (binding_set,
- quick_bookmark_keyvals[i], GDK_MOD1_MASK,
- "quick-bookmark",
- 1, G_TYPE_INT, i);
+ gtk_widget_class_add_binding_signal (widget_class,
+ GDK_KEY_Home, GDK_MOD1_MASK,
+ "home-folder",
+ NULL);
+ gtk_widget_class_add_binding_signal (widget_class,
+ GDK_KEY_KP_Home, GDK_MOD1_MASK,
+ "home-folder",
+ NULL);
+ gtk_widget_class_add_binding_signal (widget_class,
+ GDK_KEY_d, GDK_MOD1_MASK,
+ "desktop-folder",
+ NULL);
+ gtk_widget_class_add_binding_signal (widget_class,
+ GDK_KEY_h, GDK_CONTROL_MASK,
+ "show-hidden",
+ NULL);
+ gtk_widget_class_add_binding_signal (widget_class,
+ GDK_KEY_s, GDK_MOD1_MASK,
+ "search-shortcut",
+ NULL);
+ gtk_widget_class_add_binding_signal (widget_class,
+ GDK_KEY_f, GDK_CONTROL_MASK,
+ "search-shortcut",
+ NULL);
+ gtk_widget_class_add_binding_signal (widget_class,
+ GDK_KEY_r, GDK_MOD1_MASK,
+ "recent-shortcut",
+ NULL);
+ gtk_widget_class_add_binding_signal (widget_class,
+ GDK_KEY_p, GDK_MOD1_MASK,
+ "places-shortcut",
+ NULL);
+
+ for (i = 0; i < G_N_ELEMENTS (quick_bookmark_keyvals); i++)
+ gtk_widget_class_add_binding_signal (widget_class,
+ quick_bookmark_keyvals[i], GDK_MOD1_MASK,
+ "quick-bookmark",
+ "(i)", i);
g_object_class_install_property (gobject_class, PROP_SEARCH_MODE,
g_param_spec_boolean ("search-mode",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]