[gnome-control-center] wacom: Populate button mapping dialog
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] wacom: Populate button mapping dialog
- Date: Fri, 4 Nov 2016 22:41:31 +0000 (UTC)
commit 143b7ac84975f8e1cbcf59a669c739a1e67dc602
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Jun 23 16:52:35 2016 +0200
wacom: Populate button mapping dialog
We now use the CcWacomDevice API for this.
panels/wacom/cc-wacom-page.c | 50 ++++++++++++++++--------------------------
1 files changed, 19 insertions(+), 31 deletions(-)
---
diff --git a/panels/wacom/cc-wacom-page.c b/panels/wacom/cc-wacom-page.c
index f1d0d2c..2ee0487 100644
--- a/panels/wacom/cc-wacom-page.c
+++ b/panels/wacom/cc-wacom-page.c
@@ -132,6 +132,7 @@ get_layout_type (CcWacomDevice *device)
return layout;
}
+#if 0
static void
set_calibration (GsdWacomDevice *device,
const gint display_width,
@@ -167,8 +168,6 @@ set_calibration (GsdWacomDevice *device,
display_width, display_height);
}
-#if 0
-
static void
finish_calibration (CalibArea *area,
gpointer user_data)
@@ -322,21 +321,21 @@ calibrate_button_clicked_cb (GtkButton *button,
* gnome-control-center has been used, and we load up an
* old one, as the action type if unknown to the old g-c-c */
static gboolean
-action_type_is_valid (GsdWacomActionType type)
+action_type_is_valid (GDesktopPadButtonAction action)
{
- if (type >= G_N_ELEMENTS(action_table))
+ if (action >= G_N_ELEMENTS (action_table))
return FALSE;
return TRUE;
}
static void
-create_row_from_button (GtkWidget *list_box,
- GsdWacomTabletButton *button,
- GtkDirectionType dir)
+create_row_from_button (GtkWidget *list_box,
+ guint button,
+ GSettings *settings)
{
GtkWidget *row;
- row = cc_wacom_button_row_new (button, dir);
+ row = cc_wacom_button_row_new (button, settings);
gtk_container_add (GTK_CONTAINER (list_box), row);
gtk_widget_show (row);
}
@@ -344,37 +343,26 @@ create_row_from_button (GtkWidget *list_box,
static void
setup_button_mapping (CcWacomPage *page)
{
-#if 0
- CcWacomPagePrivate *priv;
- GList *list, *l;
- GtkWidget *list_box = NULL;
+ CcWacomPagePrivate *priv = page->priv;
+ GDesktopPadButtonAction action;
+ GtkWidget *list_box;
+ guint i, n_buttons;
+ GSettings *settings;
- priv = page->priv;
list_box = MWID ("shortcuts_list");
- list = gsd_wacom_device_get_buttons (priv->pad);
-
- for (l = list; l != NULL; l = l->next) {
- GsdWacomTabletButton *button = l->data;
- GsdWacomActionType action_type;
-
- if (button->type == WACOM_TABLET_BUTTON_TYPE_HARDCODED)
- continue;
+ n_buttons = cc_wacom_device_get_num_buttons (priv->pad);
- action_type = g_settings_get_enum (button->settings, "action-type");
- if (!action_type_is_valid (action_type))
+ for (i = 0; i < n_buttons; i++) {
+ settings = cc_wacom_device_get_button_settings (priv->pad, i);
+ if (!settings)
continue;
- if (button->type == WACOM_TABLET_BUTTON_TYPE_STRIP ||
- button->type == WACOM_TABLET_BUTTON_TYPE_RING) {
- create_row_from_button (list_box, button, GTK_DIR_UP);
- create_row_from_button (list_box, button, GTK_DIR_DOWN);
+ action = g_settings_get_enum (settings, "action");
+ if (!action_type_is_valid (action))
continue;
- }
- create_row_from_button (list_box, button, 0);
+ create_row_from_button (list_box, i, settings);
}
- g_list_free (list);
-#endif
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]