[nautilus] window: Add tablet pad controller for common actions
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] window: Add tablet pad controller for common actions
- Date: Mon, 7 Aug 2017 15:52:45 +0000 (UTC)
commit aae95a43be1afdccd703529c2594716d90e6aeaf
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Jul 26 00:17:12 2017 +0200
window: Add tablet pad controller for common actions
Since nautilus is an important tool in the workflow of designers
and other users of graphics tablets, make tablet pads useful by
mapping a sensible set of actions that are not directly accessible
with the stylus nor immediately require keyboard input.
Tablet pads may vary a lot between devices, from 4 to 10+ buttons,
besides rings/strips and multiple modes. It doesn't make a lot of
sense for nautilus to handle those in detail, so this patch provides
a mile-high support that should work reasonably well across the
range of devices. Actions are made to apply on all modes, and the
most sensible/less reachable options are assigned to lower button
numbers.
https://bugzilla.gnome.org/show_bug.cgi?id=785443
src/nautilus-window.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index bdfc024..951059a 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -143,6 +143,8 @@ typedef struct
guint bookmarks_id;
GQueue *tab_data_queue;
+
+ GtkPadController *pad_controller;
} NautilusWindowPrivate;
enum
@@ -186,6 +188,15 @@ static const struct
#endif
};
+static const GtkPadActionEntry pad_actions[] = {
+ { GTK_PAD_ACTION_BUTTON, 0, -1, N_("Parent folder"), "up" },
+ { GTK_PAD_ACTION_BUTTON, 1, -1, N_("Home"), "go-home" },
+ { GTK_PAD_ACTION_BUTTON, 2, -1, N_("New tab"), "new-tab" },
+ { GTK_PAD_ACTION_BUTTON, 3, -1, N_("Close current view"), "close-current-view" },
+ { GTK_PAD_ACTION_BUTTON, 4, -1, N_("Back"), "back" },
+ { GTK_PAD_ACTION_BUTTON, 5, -1, N_("Forward"), "forward" },
+};
+
static void
action_close_current_view (GSimpleAction *action,
GVariant *state,
@@ -2586,6 +2597,8 @@ nautilus_window_finalize (GObject *object)
g_queue_foreach (priv->tab_data_queue, (GFunc) free_restore_tab_data, NULL);
g_queue_free (priv->tab_data_queue);
+ g_object_unref (priv->pad_controller);
+
/* nautilus_window_close() should have run */
g_assert (priv->slots == NULL);
@@ -2917,6 +2930,12 @@ nautilus_window_init (NautilusWindow *window)
g_object_unref (window_group);
priv->tab_data_queue = g_queue_new();
+
+ priv->pad_controller = gtk_pad_controller_new (GTK_WINDOW (window),
+ G_ACTION_GROUP (window),
+ NULL);
+ gtk_pad_controller_set_action_entries (priv->pad_controller,
+ pad_actions, G_N_ELEMENTS (pad_actions));
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]