[gnome-builder/wip/chergert/shortcuts: 15/28] shortcuts: add gestures



commit 34b505a304230b36f092714073ad5779b858cec5
Author: Christian Hergert <christian hergert me>
Date:   Wed Aug 26 22:11:09 2015 -0700

    shortcuts: add gestures

 src/keybindings/gb-shortcuts-window.c    |   45 +++++++++++++++++++++++++++++-
 src/keybindings/gb-shortcuts-window.defs |    4 +-
 2 files changed, 46 insertions(+), 3 deletions(-)
---
diff --git a/src/keybindings/gb-shortcuts-window.c b/src/keybindings/gb-shortcuts-window.c
index 5238097..e312ba7 100644
--- a/src/keybindings/gb-shortcuts-window.c
+++ b/src/keybindings/gb-shortcuts-window.c
@@ -20,6 +20,7 @@
 
 #include "gb-accel-label.h"
 #include "gb-shortcuts-window.h"
+#include "gb-widget.h"
 
 struct _GbShortcutsWindow
 {
@@ -188,7 +189,49 @@ gb_shortcuts_window_build (GbShortcutsWindow *self)
                          NULL); \
     gtk_container_add (GTK_CONTAINER (shortcut), GTK_WIDGET (desc)); \
   }
-#define GESTURE(_accel, _title, _subtitle)
+#define GESTURE(_accel, _title, _subtitle) \
+  { \
+    GtkBox *gesture; \
+    GtkLabel *primary; \
+    GtkLabel *subtitle; \
+    GtkImage *image; \
+    gesture = g_object_new (GTK_TYPE_GRID, \
+                            "column-spacing", 12, \
+                            "visible", TRUE, \
+                            NULL); \
+    gtk_container_add (GTK_CONTAINER (group), GTK_WIDGET (gesture)); \
+    image = g_object_new (GTK_TYPE_IMAGE, \
+                          "resource", "/org/gnome/builder/icons/scalable/actions/gesture-"_accel".svg", \
+                          "halign", GTK_ALIGN_CENTER, \
+                          "valign", GTK_ALIGN_CENTER, \
+                          "visible", TRUE, \
+                          NULL); \
+    gtk_container_add_with_properties (GTK_CONTAINER (gesture), GTK_WIDGET (image), \
+                                       "height", 2, \
+                                       NULL); \
+    primary = g_object_new (GTK_TYPE_LABEL, \
+                            "label", _title, \
+                            "visible", TRUE, \
+                            "valign", GTK_ALIGN_END, \
+                            "xalign", 0.0f, \
+                            "hexpand", TRUE, \
+                            NULL); \
+    gtk_container_add_with_properties (GTK_CONTAINER (gesture), GTK_WIDGET (primary), \
+                                       "left-attach", 1, \
+                                       NULL); \
+    subtitle = g_object_new (GTK_TYPE_LABEL, \
+                             "label", _subtitle, \
+                             "visible", TRUE, \
+                             "valign", GTK_ALIGN_START, \
+                             "xalign", 0.0f, \
+                             "hexpand", TRUE, \
+                             NULL); \
+    gb_widget_add_style_class (GTK_WIDGET (subtitle), "dim-label"); \
+    gtk_container_add_with_properties (GTK_CONTAINER (gesture), GTK_WIDGET (subtitle), \
+                                       "top-attach", 1, \
+                                       "left-attach", 1, \
+                                       NULL); \
+  }
 
 
 #include "gb-shortcuts-window.defs"
diff --git a/src/keybindings/gb-shortcuts-window.defs b/src/keybindings/gb-shortcuts-window.defs
index cd80a07..70ea444 100644
--- a/src/keybindings/gb-shortcuts-window.defs
+++ b/src/keybindings/gb-shortcuts-window.defs
@@ -16,8 +16,8 @@ VIEWS (
         GENERAL_GROUP
         GROUP (
           _("Touchpad gestures"),
-          GESTURE ("swipe-right", _("Switch to the next document"), _("Two-finger swipe right"))
-          GESTURE ("swipe-left", _("Switch to the previous document"), _("Two-finger swipe left"))
+          GESTURE ("two-finger-swipe-right", _("Switch to the next document"), _("Two-finger swipe right"))
+          GESTURE ("two-finger-swipe-left", _("Switch to the previous document"), _("Two-finger swipe left"))
         )
       )
       COLUMN (


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