[gtk/gbsneto/shortcuts-rebased: 48/105] menu: Port bindings to use shortcuts



commit 7c91b36f5d754639a594cb25104febe749899c04
Author: Benjamin Otte <otte redhat com>
Date:   Sun Aug 12 16:20:34 2018 +0200

    menu: Port bindings to use shortcuts

 gtk/gtkmenu.c | 147 +++++++++++++++++++++++++---------------------------------
 1 file changed, 64 insertions(+), 83 deletions(-)
---
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index 7d457e7703..34fe1b5959 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -92,7 +92,6 @@
 #include "gtkaccellabel.h"
 #include "gtkaccelmap.h"
 #include "gtkadjustment.h"
-#include "gtkbindings.h"
 #include "gtkbox.h"
 #include "gtkcheckmenuitemprivate.h"
 #include "gtkcssnodeprivate.h"
@@ -404,7 +403,6 @@ gtk_menu_class_init (GtkMenuClass *class)
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
   GtkContainerClass *container_class = GTK_CONTAINER_CLASS (class);
   GtkMenuShellClass *menu_shell_class = GTK_MENU_SHELL_CLASS (class);
-  GtkBindingSet *binding_set;
   
   gobject_class->set_property = gtk_menu_set_property;
   gobject_class->get_property = gtk_menu_get_property;
@@ -686,87 +684,70 @@ gtk_menu_class_init (GtkMenuClass *class)
                                                       G_PARAM_STATIC_BLURB |
                                                       G_PARAM_EXPLICIT_NOTIFY));
 
-  binding_set = gtk_binding_set_by_class (class);
-  gtk_binding_entry_add_signal (binding_set,
-                                GDK_KEY_Up, 0,
-                                I_("move-current"), 1,
-                                GTK_TYPE_MENU_DIRECTION_TYPE,
-                                GTK_MENU_DIR_PREV);
-  gtk_binding_entry_add_signal (binding_set,
-                                GDK_KEY_KP_Up, 0,
-                                "move-current", 1,
-                                GTK_TYPE_MENU_DIRECTION_TYPE,
-                                GTK_MENU_DIR_PREV);
-  gtk_binding_entry_add_signal (binding_set,
-                                GDK_KEY_Down, 0,
-                                "move-current", 1,
-                                GTK_TYPE_MENU_DIRECTION_TYPE,
-                                GTK_MENU_DIR_NEXT);
-  gtk_binding_entry_add_signal (binding_set,
-                                GDK_KEY_KP_Down, 0,
-                                "move-current", 1,
-                                GTK_TYPE_MENU_DIRECTION_TYPE,
-                                GTK_MENU_DIR_NEXT);
-  gtk_binding_entry_add_signal (binding_set,
-                                GDK_KEY_Left, 0,
-                                "move-current", 1,
-                                GTK_TYPE_MENU_DIRECTION_TYPE,
-                                GTK_MENU_DIR_PARENT);
-  gtk_binding_entry_add_signal (binding_set,
-                                GDK_KEY_KP_Left, 0,
-                                "move-current", 1,
-                                GTK_TYPE_MENU_DIRECTION_TYPE,
-                                GTK_MENU_DIR_PARENT);
-  gtk_binding_entry_add_signal (binding_set,
-                                GDK_KEY_Right, 0,
-                                "move-current", 1,
-                                GTK_TYPE_MENU_DIRECTION_TYPE,
-                                GTK_MENU_DIR_CHILD);
-  gtk_binding_entry_add_signal (binding_set,
-                                GDK_KEY_KP_Right, 0,
-                                "move-current", 1,
-                                GTK_TYPE_MENU_DIRECTION_TYPE,
-                                GTK_MENU_DIR_CHILD);
-  gtk_binding_entry_add_signal (binding_set,
-                                GDK_KEY_Home, 0,
-                                "move-scroll", 1,
-                                GTK_TYPE_SCROLL_TYPE,
-                                GTK_SCROLL_START);
-  gtk_binding_entry_add_signal (binding_set,
-                                GDK_KEY_KP_Home, 0,
-                                "move-scroll", 1,
-                                GTK_TYPE_SCROLL_TYPE,
-                                GTK_SCROLL_START);
-  gtk_binding_entry_add_signal (binding_set,
-                                GDK_KEY_End, 0,
-                                "move-scroll", 1,
-                                GTK_TYPE_SCROLL_TYPE,
-                                GTK_SCROLL_END);
-  gtk_binding_entry_add_signal (binding_set,
-                                GDK_KEY_KP_End, 0,
-                                "move-scroll", 1,
-                                GTK_TYPE_SCROLL_TYPE,
-                                GTK_SCROLL_END);
-  gtk_binding_entry_add_signal (binding_set,
-                                GDK_KEY_Page_Up, 0,
-                                "move-scroll", 1,
-                                GTK_TYPE_SCROLL_TYPE,
-                                GTK_SCROLL_PAGE_UP);
-  gtk_binding_entry_add_signal (binding_set,
-                                GDK_KEY_KP_Page_Up, 0,
-                                "move-scroll", 1,
-                                GTK_TYPE_SCROLL_TYPE,
-                                GTK_SCROLL_PAGE_UP);
-  gtk_binding_entry_add_signal (binding_set,
-                                GDK_KEY_Page_Down, 0,
-                                "move-scroll", 1,
-                                GTK_TYPE_SCROLL_TYPE,
-                                GTK_SCROLL_PAGE_DOWN);
-  gtk_binding_entry_add_signal (binding_set,
-                                GDK_KEY_KP_Page_Down, 0,
-                                "move-scroll", 1,
-                                GTK_TYPE_SCROLL_TYPE,
-                                GTK_SCROLL_PAGE_DOWN);
+  gtk_widget_class_add_binding_signal (widget_class,
+                                       GDK_KEY_Up, 0,
+                                       I_("move-current"),
+                                       "(i)", GTK_MENU_DIR_PREV);
+  gtk_widget_class_add_binding_signal (widget_class,
+                                       GDK_KEY_KP_Up, 0,
+                                       "move-current",
+                                       "(i)", GTK_MENU_DIR_PREV);
+  gtk_widget_class_add_binding_signal (widget_class,
+                                       GDK_KEY_Down, 0,
+                                       "move-current",
+                                       "(i)", GTK_MENU_DIR_NEXT);
+  gtk_widget_class_add_binding_signal (widget_class,
+                                       GDK_KEY_KP_Down, 0,
+                                       "move-current",
+                                       "(i)", GTK_MENU_DIR_NEXT);
+  gtk_widget_class_add_binding_signal (widget_class,
+                                       GDK_KEY_Left, 0,
+                                       "move-current",
+                                       "(i)", GTK_MENU_DIR_PARENT);
+  gtk_widget_class_add_binding_signal (widget_class,
+                                       GDK_KEY_KP_Left, 0,
+                                       "move-current",
+                                       "(i)", GTK_MENU_DIR_PARENT);
+  gtk_widget_class_add_binding_signal (widget_class,
+                                       GDK_KEY_Right, 0,
+                                       "move-current",
+                                       "(i)", GTK_MENU_DIR_CHILD);
+  gtk_widget_class_add_binding_signal (widget_class,
+                                       GDK_KEY_KP_Right, 0,
+                                       "move-current",
+                                       "(i)", GTK_MENU_DIR_CHILD);
+  gtk_widget_class_add_binding_signal (widget_class,
+                                       GDK_KEY_Home, 0,
+                                       "move-scroll",
+                                       "(i)", GTK_SCROLL_START);
+  gtk_widget_class_add_binding_signal (widget_class,
+                                       GDK_KEY_KP_Home, 0,
+                                       "move-scroll",
+                                       "(i)", GTK_SCROLL_START);
+  gtk_widget_class_add_binding_signal (widget_class,
+                                       GDK_KEY_End, 0,
+                                       "move-scroll",
+                                       "(i)", GTK_SCROLL_END);
+  gtk_widget_class_add_binding_signal (widget_class,
+                                       GDK_KEY_KP_End, 0,
+                                       "move-scroll",
+                                       "(i)", GTK_SCROLL_END);
+  gtk_widget_class_add_binding_signal (widget_class,
+                                       GDK_KEY_Page_Up, 0,
+                                       "move-scroll",
+                                       "(i)", GTK_SCROLL_PAGE_UP);
+  gtk_widget_class_add_binding_signal (widget_class,
+                                       GDK_KEY_KP_Page_Up, 0,
+                                       "move-scroll",
+                                       "(i)", GTK_SCROLL_PAGE_UP);
+  gtk_widget_class_add_binding_signal (widget_class,
+                                       GDK_KEY_Page_Down, 0,
+                                       "move-scroll",
+                                       "(i)", GTK_SCROLL_PAGE_DOWN);
+  gtk_widget_class_add_binding_signal (widget_class,
+                                       GDK_KEY_KP_Page_Down, 0,
+                                       "move-scroll",
+                                       "(i)", GTK_SCROLL_PAGE_DOWN);
 
   gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_MENU_ACCESSIBLE);
   gtk_widget_class_set_css_name (widget_class, I_("menu"));


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