[gnome-settings-daemon] wacom: Add index to mode buttons
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] wacom: Add index to mode buttons
- Date: Thu, 23 Feb 2012 14:51:42 +0000 (UTC)
commit c8d37695cb6fd63b15faafc04c81869ee1378cef
Author: Bastien Nocera <hadess hadess net>
Date: Thu Feb 23 14:19:00 2012 +0100
wacom: Add index to mode buttons
plugins/wacom/gsd-wacom-device.c | 16 +++++++++-------
plugins/wacom/gsd-wacom-device.h | 2 +-
2 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/plugins/wacom/gsd-wacom-device.c b/plugins/wacom/gsd-wacom-device.c
index e7507a2..50a5269 100644
--- a/plugins/wacom/gsd-wacom-device.c
+++ b/plugins/wacom/gsd-wacom-device.c
@@ -245,7 +245,8 @@ gsd_wacom_tablet_button_new (const char *name,
const char *id,
const char *settings_path,
GsdWacomTabletButtonType type,
- int group_id)
+ int group_id,
+ int idx)
{
GsdWacomTabletButton *ret;
@@ -260,6 +261,7 @@ gsd_wacom_tablet_button_new (const char *name,
g_free (button_settings_path);
}
ret->group_id = group_id;
+ ret->idx = idx;
ret->type = type;
return ret;
@@ -881,14 +883,14 @@ gsd_wacom_device_add_ring_modes (WacomDevice *wacom_device,
for (i = 1; i <= num_modes; i++) {
name = g_strdup_printf (_("Left Ring Mode #%d"), i);
id = g_strdup_printf ("left-ring-mode-%d", i);
- l = g_list_append (l, gsd_wacom_tablet_button_new (name, id, settings_path, WACOM_TABLET_BUTTON_TYPE_ELEVATOR, flags_to_group (WACOM_BUTTON_RING_MODESWITCH)));
+ l = g_list_append (l, gsd_wacom_tablet_button_new (name, id, settings_path, WACOM_TABLET_BUTTON_TYPE_ELEVATOR, flags_to_group (WACOM_BUTTON_RING_MODESWITCH), i - 1));
}
} else if ((direction & WACOM_BUTTON_POSITION_RIGHT) && libwacom_has_ring2 (wacom_device)) {
num_modes = libwacom_get_ring2_num_modes (wacom_device);
for (i = 1; i <= num_modes; i++) {
name = g_strdup_printf (_("Right Ring Mode #%d"), i);
id = g_strdup_printf ("right-ring-mode-%d", i);
- l = g_list_append (l, gsd_wacom_tablet_button_new (name, id, settings_path, WACOM_TABLET_BUTTON_TYPE_ELEVATOR, flags_to_group (WACOM_BUTTON_RING2_MODESWITCH)));
+ l = g_list_append (l, gsd_wacom_tablet_button_new (name, id, settings_path, WACOM_TABLET_BUTTON_TYPE_ELEVATOR, flags_to_group (WACOM_BUTTON_RING2_MODESWITCH), i - 1));
}
}
@@ -916,14 +918,14 @@ gsd_wacom_device_add_strip_modes (WacomDevice *wacom_device,
for (i = 1; i <= num_modes; i++) {
name = g_strdup_printf (_("Left Touchstrip Mode #%d"), i);
id = g_strdup_printf ("left-strip-mode-%d", i);
- l = g_list_append (l, gsd_wacom_tablet_button_new (name, id, settings_path, WACOM_TABLET_BUTTON_TYPE_ELEVATOR, flags_to_group (WACOM_BUTTON_TOUCHSTRIP_MODESWITCH)));
+ l = g_list_append (l, gsd_wacom_tablet_button_new (name, id, settings_path, WACOM_TABLET_BUTTON_TYPE_ELEVATOR, flags_to_group (WACOM_BUTTON_TOUCHSTRIP_MODESWITCH), i - 1));
}
} else if ((direction & WACOM_BUTTON_POSITION_RIGHT) && num_strips >= 2) {
num_modes = libwacom_get_strips_num_modes (wacom_device);
for (i = 1; i <= num_modes; i++) {
name = g_strdup_printf (_("Right Touchstrip Mode #%d"), i);
id = g_strdup_printf ("right-strip-mode-%d", i);
- l = g_list_append (l, gsd_wacom_tablet_button_new (name, id, settings_path, WACOM_TABLET_BUTTON_TYPE_ELEVATOR, flags_to_group (WACOM_BUTTON_TOUCHSTRIP2_MODESWITCH)));
+ l = g_list_append (l, gsd_wacom_tablet_button_new (name, id, settings_path, WACOM_TABLET_BUTTON_TYPE_ELEVATOR, flags_to_group (WACOM_BUTTON_TOUCHSTRIP2_MODESWITCH), i - 1));
}
}
@@ -977,7 +979,7 @@ gsd_wacom_device_add_buttons_dir (WacomDevice *wacom_device,
name = g_strdup_printf (button_str, button_num++);
id = g_strdup_printf ("%s%c", button_str_id, i);
- l = g_list_append (l, gsd_wacom_tablet_button_new (name, id, settings_path, WACOM_TABLET_BUTTON_TYPE_NORMAL, flags_to_group (flags)));
+ l = g_list_append (l, gsd_wacom_tablet_button_new (name, id, settings_path, WACOM_TABLET_BUTTON_TYPE_NORMAL, flags_to_group (flags), -1));
g_free (name);
g_free (id);
}
@@ -995,7 +997,7 @@ gsd_wacom_device_add_buttons_dir (WacomDevice *wacom_device,
name = gsd_wacom_device_modeswitch_name (flags, button_num++);
id = g_strdup_printf ("%s%c", button_str_id, i);
- l = g_list_append (l, gsd_wacom_tablet_button_new (name, id, settings_path, WACOM_TABLET_BUTTON_TYPE_HARDCODED, flags_to_group (flags)));
+ l = g_list_append (l, gsd_wacom_tablet_button_new (name, id, settings_path, WACOM_TABLET_BUTTON_TYPE_HARDCODED, flags_to_group (flags), -1));
g_free (name);
g_free (id);
diff --git a/plugins/wacom/gsd-wacom-device.h b/plugins/wacom/gsd-wacom-device.h
index ce2d40a..c07f48d 100644
--- a/plugins/wacom/gsd-wacom-device.h
+++ b/plugins/wacom/gsd-wacom-device.h
@@ -104,7 +104,7 @@ typedef struct
char *id;
GSettings *settings;
GsdWacomTabletButtonType type;
- int group_id;
+ int group_id, idx;
} GsdWacomTabletButton;
void gsd_wacom_tablet_button_free (GsdWacomTabletButton *button);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]