[gtk/shortcuts-rebased-again: 28/91] listbox: Port bindings to use shortcuts
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/shortcuts-rebased-again: 28/91] listbox: Port bindings to use shortcuts
- Date: Wed, 19 Jun 2019 04:32:44 +0000 (UTC)
commit 98357f015f5abda4b8c07e3f7d27982b25a9f258
Author: Benjamin Otte <otte redhat com>
Date: Sun Aug 12 16:47:58 2018 +0200
listbox: Port bindings to use shortcuts
gtk/gtklistbox.c | 96 +++++++++++++++++++++++++++++---------------------------
1 file changed, 49 insertions(+), 47 deletions(-)
---
diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c
index 3783dd3ece..68b551015c 100644
--- a/gtk/gtklistbox.c
+++ b/gtk/gtklistbox.c
@@ -226,7 +226,7 @@ static GSequenceIter * gtk_list_box_get_next_visible (GtkListBo
GSequenceIter *iter);
static void gtk_list_box_apply_filter (GtkListBox *box,
GtkListBoxRow *row);
-static void gtk_list_box_add_move_binding (GtkBindingSet *binding_set,
+static void gtk_list_box_add_move_binding (GtkWidgetClass *widget_class,
guint keyval,
GdkModifierType modmask,
GtkMovementStep step,
@@ -432,9 +432,6 @@ gtk_list_box_class_init (GtkListBoxClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
- GtkBindingSet *binding_set;
-
- gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_LIST_BOX_ACCESSIBLE);
object_class->get_property = gtk_list_box_get_property;
object_class->set_property = gtk_list_box_set_property;
@@ -608,43 +605,52 @@ gtk_list_box_class_init (GtkListBoxClass *klass)
widget_class->activate_signal = signals[ACTIVATE_CURSOR_ROW];
- binding_set = gtk_binding_set_by_class (klass);
- gtk_list_box_add_move_binding (binding_set, GDK_KEY_Home, 0,
+ gtk_list_box_add_move_binding (widget_class, GDK_KEY_Home, 0,
GTK_MOVEMENT_BUFFER_ENDS, -1);
- gtk_list_box_add_move_binding (binding_set, GDK_KEY_KP_Home, 0,
+ gtk_list_box_add_move_binding (widget_class, GDK_KEY_KP_Home, 0,
GTK_MOVEMENT_BUFFER_ENDS, -1);
- gtk_list_box_add_move_binding (binding_set, GDK_KEY_End, 0,
+ gtk_list_box_add_move_binding (widget_class, GDK_KEY_End, 0,
GTK_MOVEMENT_BUFFER_ENDS, 1);
- gtk_list_box_add_move_binding (binding_set, GDK_KEY_KP_End, 0,
+ gtk_list_box_add_move_binding (widget_class, GDK_KEY_KP_End, 0,
GTK_MOVEMENT_BUFFER_ENDS, 1);
- gtk_list_box_add_move_binding (binding_set, GDK_KEY_Up, 0,
+ gtk_list_box_add_move_binding (widget_class, GDK_KEY_Up, 0,
GTK_MOVEMENT_DISPLAY_LINES, -1);
- gtk_list_box_add_move_binding (binding_set, GDK_KEY_KP_Up, 0,
+ gtk_list_box_add_move_binding (widget_class, GDK_KEY_KP_Up, 0,
GTK_MOVEMENT_DISPLAY_LINES, -1);
- gtk_list_box_add_move_binding (binding_set, GDK_KEY_Down, 0,
+ gtk_list_box_add_move_binding (widget_class, GDK_KEY_Down, 0,
GTK_MOVEMENT_DISPLAY_LINES, 1);
- gtk_list_box_add_move_binding (binding_set, GDK_KEY_KP_Down, 0,
+ gtk_list_box_add_move_binding (widget_class, GDK_KEY_KP_Down, 0,
GTK_MOVEMENT_DISPLAY_LINES, 1);
- gtk_list_box_add_move_binding (binding_set, GDK_KEY_Page_Up, 0,
+ gtk_list_box_add_move_binding (widget_class, GDK_KEY_Page_Up, 0,
GTK_MOVEMENT_PAGES, -1);
- gtk_list_box_add_move_binding (binding_set, GDK_KEY_KP_Page_Up, 0,
+ gtk_list_box_add_move_binding (widget_class, GDK_KEY_KP_Page_Up, 0,
GTK_MOVEMENT_PAGES, -1);
- gtk_list_box_add_move_binding (binding_set, GDK_KEY_Page_Down, 0,
+ gtk_list_box_add_move_binding (widget_class, GDK_KEY_Page_Down, 0,
GTK_MOVEMENT_PAGES, 1);
- gtk_list_box_add_move_binding (binding_set, GDK_KEY_KP_Page_Down, 0,
+ gtk_list_box_add_move_binding (widget_class, GDK_KEY_KP_Page_Down, 0,
GTK_MOVEMENT_PAGES, 1);
- gtk_binding_entry_add_signal (binding_set, GDK_KEY_space, GDK_CONTROL_MASK,
- "toggle-cursor-row", 0, NULL);
- gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Space, GDK_CONTROL_MASK,
- "toggle-cursor-row", 0, NULL);
-
- gtk_binding_entry_add_signal (binding_set, GDK_KEY_a, GDK_CONTROL_MASK,
- "select-all", 0);
- gtk_binding_entry_add_signal (binding_set, GDK_KEY_a, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
- "unselect-all", 0);
+ gtk_widget_class_add_binding_signal (widget_class,
+ GDK_KEY_space, GDK_CONTROL_MASK,
+ "toggle-cursor-row",
+ NULL);
+ gtk_widget_class_add_binding_signal (widget_class,
+ GDK_KEY_KP_Space, GDK_CONTROL_MASK,
+ "toggle-cursor-row",
+ NULL);
+
+ gtk_widget_class_add_binding_signal (widget_class,
+ GDK_KEY_a, GDK_CONTROL_MASK,
+ "select-all",
+ NULL);
+ gtk_widget_class_add_binding_signal (widget_class,
+ GDK_KEY_a, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
+ "unselect-all",
+ NULL);
gtk_widget_class_set_css_name (widget_class, I_("list"));
+
+ gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_LIST_BOX_ACCESSIBLE);
}
static void
@@ -1432,7 +1438,7 @@ gtk_list_box_set_accept_unpaired_release (GtkListBox *box,
}
static void
-gtk_list_box_add_move_binding (GtkBindingSet *binding_set,
+gtk_list_box_add_move_binding (GtkWidgetClass *widget_class,
guint keyval,
GdkModifierType modmask,
GtkMovementStep step,
@@ -1451,26 +1457,22 @@ gtk_list_box_add_move_binding (GtkBindingSet *binding_set,
GDK_MODIFIER_INTENT_MODIFY_SELECTION);
}
- gtk_binding_entry_add_signal (binding_set, keyval, modmask,
- "move-cursor", 2,
- GTK_TYPE_MOVEMENT_STEP, step,
- G_TYPE_INT, count,
- NULL);
- gtk_binding_entry_add_signal (binding_set, keyval, modmask | extend_mod_mask,
- "move-cursor", 2,
- GTK_TYPE_MOVEMENT_STEP, step,
- G_TYPE_INT, count,
- NULL);
- gtk_binding_entry_add_signal (binding_set, keyval, modmask | modify_mod_mask,
- "move-cursor", 2,
- GTK_TYPE_MOVEMENT_STEP, step,
- G_TYPE_INT, count,
- NULL);
- gtk_binding_entry_add_signal (binding_set, keyval, modmask | extend_mod_mask | modify_mod_mask,
- "move-cursor", 2,
- GTK_TYPE_MOVEMENT_STEP, step,
- G_TYPE_INT, count,
- NULL);
+ gtk_widget_class_add_binding_signal (widget_class,
+ keyval, modmask,
+ "move-cursor",
+ "(ii)", step, count);
+ gtk_widget_class_add_binding_signal (widget_class,
+ keyval, modmask | extend_mod_mask,
+ "move-cursor",
+ "(ii)", step, count);
+ gtk_widget_class_add_binding_signal (widget_class,
+ keyval, modmask | modify_mod_mask,
+ "move-cursor",
+ "(ii)", step, count);
+ gtk_widget_class_add_binding_signal (widget_class,
+ keyval, modmask | extend_mod_mask | modify_mod_mask,
+ "move-cursor",
+ "(ii)", step, count);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]