[gtk/gbsneto/shortcuts-rebased: 35/99] flowbox: Port bindings to use shortcuts
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gbsneto/shortcuts-rebased: 35/99] flowbox: Port bindings to use shortcuts
- Date: Mon, 13 May 2019 19:28:54 +0000 (UTC)
commit e6b45346c06d87ee5051190cdded6bd8014bb4cf
Author: Benjamin Otte <otte redhat com>
Date: Sun Aug 12 03:45:09 2018 +0200
flowbox: Port bindings to use shortcuts
gtk/gtkflowbox.c | 112 +++++++++++++++++++++++++++----------------------------
gtk/gtklistbox.c | 1 -
2 files changed, 55 insertions(+), 58 deletions(-)
---
diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c
index e4bfb813fc..998d65d56b 100644
--- a/gtk/gtkflowbox.c
+++ b/gtk/gtkflowbox.c
@@ -78,7 +78,6 @@
#include "gtkflowbox.h"
#include "gtkadjustment.h"
-#include "gtkbindings.h"
#include "gtkcontainerprivate.h"
#include "gtkcssnodeprivate.h"
#include "gtkgesturedrag.h"
@@ -2964,7 +2963,7 @@ gtk_flow_box_focus (GtkWidget *widget,
}
static void
-gtk_flow_box_add_move_binding (GtkBindingSet *binding_set,
+gtk_flow_box_add_move_binding (GtkWidgetClass *widget_class,
guint keyval,
GdkModifierType modmask,
GtkMovementStep step,
@@ -2975,34 +2974,27 @@ gtk_flow_box_add_move_binding (GtkBindingSet *binding_set,
GdkModifierType modify_mod_mask = GDK_CONTROL_MASK;
display = gdk_display_get_default ();
- if (display)
- {
- extend_mod_mask = gdk_keymap_get_modifier_mask (gdk_display_get_keymap (display),
- GDK_MODIFIER_INTENT_EXTEND_SELECTION);
- modify_mod_mask = gdk_keymap_get_modifier_mask (gdk_display_get_keymap (display),
- 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);
+ extend_mod_mask = gdk_keymap_get_modifier_mask (gdk_display_get_keymap (display),
+ GDK_MODIFIER_INTENT_EXTEND_SELECTION);
+ modify_mod_mask = gdk_keymap_get_modifier_mask (gdk_display_get_keymap (display),
+ GDK_MODIFIER_INTENT_MODIFY_SELECTION);
+
+ 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
@@ -3364,7 +3356,6 @@ gtk_flow_box_class_init (GtkFlowBoxClass *class)
GObjectClass *object_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (class);
- GtkBindingSet *binding_set;
object_class->finalize = gtk_flow_box_finalize;
object_class->get_property = gtk_flow_box_get_property;
@@ -3638,50 +3629,57 @@ gtk_flow_box_class_init (GtkFlowBoxClass *class)
widget_class->activate_signal = signals[ACTIVATE_CURSOR_CHILD];
- binding_set = gtk_binding_set_by_class (class);
- gtk_flow_box_add_move_binding (binding_set, GDK_KEY_Home, 0,
+ gtk_flow_box_add_move_binding (widget_class, GDK_KEY_Home, 0,
GTK_MOVEMENT_BUFFER_ENDS, -1);
- gtk_flow_box_add_move_binding (binding_set, GDK_KEY_KP_Home, 0,
+ gtk_flow_box_add_move_binding (widget_class, GDK_KEY_KP_Home, 0,
GTK_MOVEMENT_BUFFER_ENDS, -1);
- gtk_flow_box_add_move_binding (binding_set, GDK_KEY_End, 0,
+ gtk_flow_box_add_move_binding (widget_class, GDK_KEY_End, 0,
GTK_MOVEMENT_BUFFER_ENDS, 1);
- gtk_flow_box_add_move_binding (binding_set, GDK_KEY_KP_End, 0,
+ gtk_flow_box_add_move_binding (widget_class, GDK_KEY_KP_End, 0,
GTK_MOVEMENT_BUFFER_ENDS, 1);
- gtk_flow_box_add_move_binding (binding_set, GDK_KEY_Up, 0,
+ gtk_flow_box_add_move_binding (widget_class, GDK_KEY_Up, 0,
GTK_MOVEMENT_DISPLAY_LINES, -1);
- gtk_flow_box_add_move_binding (binding_set, GDK_KEY_KP_Up, 0,
+ gtk_flow_box_add_move_binding (widget_class, GDK_KEY_KP_Up, 0,
GTK_MOVEMENT_DISPLAY_LINES, -1);
- gtk_flow_box_add_move_binding (binding_set, GDK_KEY_Down, 0,
+ gtk_flow_box_add_move_binding (widget_class, GDK_KEY_Down, 0,
GTK_MOVEMENT_DISPLAY_LINES, 1);
- gtk_flow_box_add_move_binding (binding_set, GDK_KEY_KP_Down, 0,
+ gtk_flow_box_add_move_binding (widget_class, GDK_KEY_KP_Down, 0,
GTK_MOVEMENT_DISPLAY_LINES, 1);
- gtk_flow_box_add_move_binding (binding_set, GDK_KEY_Page_Up, 0,
+ gtk_flow_box_add_move_binding (widget_class, GDK_KEY_Page_Up, 0,
GTK_MOVEMENT_PAGES, -1);
- gtk_flow_box_add_move_binding (binding_set, GDK_KEY_KP_Page_Up, 0,
+ gtk_flow_box_add_move_binding (widget_class, GDK_KEY_KP_Page_Up, 0,
GTK_MOVEMENT_PAGES, -1);
- gtk_flow_box_add_move_binding (binding_set, GDK_KEY_Page_Down, 0,
+ gtk_flow_box_add_move_binding (widget_class, GDK_KEY_Page_Down, 0,
GTK_MOVEMENT_PAGES, 1);
- gtk_flow_box_add_move_binding (binding_set, GDK_KEY_KP_Page_Down, 0,
+ gtk_flow_box_add_move_binding (widget_class, GDK_KEY_KP_Page_Down, 0,
GTK_MOVEMENT_PAGES, 1);
- gtk_flow_box_add_move_binding (binding_set, GDK_KEY_Right, 0,
+ gtk_flow_box_add_move_binding (widget_class, GDK_KEY_Right, 0,
GTK_MOVEMENT_VISUAL_POSITIONS, 1);
- gtk_flow_box_add_move_binding (binding_set, GDK_KEY_KP_Right, 0,
+ gtk_flow_box_add_move_binding (widget_class, GDK_KEY_KP_Right, 0,
GTK_MOVEMENT_VISUAL_POSITIONS, 1);
- gtk_flow_box_add_move_binding (binding_set, GDK_KEY_Left, 0,
+ gtk_flow_box_add_move_binding (widget_class, GDK_KEY_Left, 0,
GTK_MOVEMENT_VISUAL_POSITIONS, -1);
- gtk_flow_box_add_move_binding (binding_set, GDK_KEY_KP_Left, 0,
+ gtk_flow_box_add_move_binding (widget_class, GDK_KEY_KP_Left, 0,
GTK_MOVEMENT_VISUAL_POSITIONS, -1);
- gtk_binding_entry_add_signal (binding_set, GDK_KEY_space, GDK_CONTROL_MASK,
- "toggle-cursor-child", 0, NULL);
- gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Space, GDK_CONTROL_MASK,
- "toggle-cursor-child", 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-child",
+ NULL);
+ gtk_widget_class_add_binding_signal (widget_class,
+ GDK_KEY_KP_Space, GDK_CONTROL_MASK,
+ "toggle-cursor-child",
+ 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_accessible_type (widget_class, GTK_TYPE_FLOW_BOX_ACCESSIBLE);
gtk_widget_class_set_css_name (widget_class, I_("flowbox"));
diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c
index 5ad3d5950f..54999ca96c 100644
--- a/gtk/gtklistbox.c
+++ b/gtk/gtklistbox.c
@@ -21,7 +21,6 @@
#include "gtkactionhelperprivate.h"
#include "gtkadjustmentprivate.h"
-#include "gtkbindings.h"
#include "gtkbuildable.h"
#include "gtkcontainerprivate.h"
#include "gtkcssnodeprivate.h"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]