[gnome-settings-daemon] wacom: Call out to LED helper when switching modes
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] wacom: Call out to LED helper when switching modes
- Date: Sun, 4 Mar 2012 14:46:28 +0000 (UTC)
commit 4dc60b056bfa8bae9df00b339be83891edc3a9ee
Author: Bastien Nocera <hadess hadess net>
Date: Sun Mar 4 14:42:07 2012 +0000
wacom: Call out to LED helper when switching modes
Call the LED setting helper, a small PolicyKit helper
to set the LED depending on the mode of operation.
https://bugzilla.gnome.org/show_bug.cgi?id=670905
plugins/wacom/Makefile.am | 1 +
plugins/wacom/gsd-wacom-manager.c | 35 +++++++++++++++++++++++++++++++----
2 files changed, 32 insertions(+), 4 deletions(-)
---
diff --git a/plugins/wacom/Makefile.am b/plugins/wacom/Makefile.am
index a3086c3..8e40b59 100644
--- a/plugins/wacom/Makefile.am
+++ b/plugins/wacom/Makefile.am
@@ -75,6 +75,7 @@ test_wacom_CPPFLAGS = \
-DPIXMAPDIR=\""$(pkgdatadir)"\" \
-DGTKBUILDERDIR=\""$(pkgdatadir)"\" \
-DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \
+ -DLIBEXECDIR=\""$(libexecdir)"\" \
$(AM_CPPFLAGS)
test_wacom_CFLAGS = \
diff --git a/plugins/wacom/gsd-wacom-manager.c b/plugins/wacom/gsd-wacom-manager.c
index 134ee4c..6df9090 100644
--- a/plugins/wacom/gsd-wacom-manager.c
+++ b/plugins/wacom/gsd-wacom-manager.c
@@ -381,8 +381,35 @@ set_led (GsdWacomDevice *device,
int group_id,
int index)
{
- /* FIXME implement */
- g_message ("Switched group ID %d to index %d", group_id, index);
+ GError *error = NULL;
+ const char *path;
+ char *command;
+ gboolean ret;
+
+#ifndef HAVE_GUDEV
+ /* Not implemented on non-Linux systems */
+ return;
+#endif
+ g_return_if_fail (index >= 1);
+
+ path = gsd_wacom_device_get_path (device);
+
+ g_debug ("Switching group ID %d to index %d for device %s", group_id, index, path);
+
+ command = g_strdup_printf ("pkexec " LIBEXECDIR "/gsd-wacom-led-helper --path %s --group %d --led %d",
+ path, group_id - 1, index - 1);
+ ret = g_spawn_command_line_sync (command,
+ NULL,
+ NULL,
+ NULL,
+ &error);
+
+ if (ret == FALSE) {
+ g_debug ("Failed to launch '%s': %s", command, error->message);
+ g_error_free (error);
+ }
+
+ g_free (command);
}
struct DefaultButtons {
@@ -490,8 +517,8 @@ reset_pad_buttons (GsdWacomDevice *device)
/* Reset all the LEDs */
/* FIXME, get the number of modes somewhere else */
- for (i = 0; i < 4; i++)
- set_led (device, i, 0);
+ for (i = 1; i <= 4; i++)
+ set_led (device, i, 1);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]