[gnome-control-center] wacom: Update from gnome-settings-daemon



commit a760238a67d26b3e4ae8fab4662ac9f49fdd1bcf
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Apr 25 20:00:44 2012 +0100

    wacom: Update from gnome-settings-daemon

 panels/wacom/gsd-input-helper.c |   16 +++++++++-------
 panels/wacom/gsd-wacom-device.c |   16 ++++++++++++++--
 2 files changed, 23 insertions(+), 9 deletions(-)
---
diff --git a/panels/wacom/gsd-input-helper.c b/panels/wacom/gsd-input-helper.c
index 95b1b38..cf9e83d 100644
--- a/panels/wacom/gsd-input-helper.c
+++ b/panels/wacom/gsd-input-helper.c
@@ -433,7 +433,7 @@ run_custom_command (GdkDevice              *device,
 {
         GSettings *settings;
         char *cmd;
-        char *argv[5];
+        char *argv[7];
         int exit_status;
         gboolean rc;
         int id;
@@ -451,10 +451,12 @@ run_custom_command (GdkDevice              *device,
         g_object_get (device, "device-id", &id, NULL);
 
         argv[0] = cmd;
-        argv[1] = g_strdup_printf ("-t %s", custom_command_to_string (command));
-        argv[2] = g_strdup_printf ("-i %d", id);
-        argv[3] = g_strdup_printf ("%s", gdk_device_get_name (device));
-        argv[4] = NULL;
+        argv[1] = "-t";
+        argv[2] = (char *) custom_command_to_string (command);
+        argv[3] = "-i";
+        argv[4] = g_strdup_printf ("%d", id);
+        argv[5] = g_strdup_printf ("%s", gdk_device_get_name (device));
+        argv[6] = NULL;
 
         rc = g_spawn_sync (g_get_home_dir (), argv, NULL, G_SPAWN_SEARCH_PATH,
                            NULL, NULL, NULL, NULL, &exit_status, NULL);
@@ -463,8 +465,8 @@ run_custom_command (GdkDevice              *device,
                 g_warning ("Couldn't execute command '%s', verify that this is a valid command.", cmd);
 
         g_free (argv[0]);
-        g_free (argv[1]);
-        g_free (argv[2]);
+        g_free (argv[4]);
+        g_free (argv[5]);
 
         return (exit_status == 0);
 }
diff --git a/panels/wacom/gsd-wacom-device.c b/panels/wacom/gsd-wacom-device.c
index f995546..0cc4b75 100644
--- a/panels/wacom/gsd-wacom-device.c
+++ b/panels/wacom/gsd-wacom-device.c
@@ -43,7 +43,7 @@
 #define GSD_WACOM_STYLUS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_WACOM_STYLUS, GsdWacomStylusPrivate))
 
 #define WACOM_TABLET_SCHEMA "org.gnome.settings-daemon.peripherals.wacom"
-#define WACOM_DEVICE_CONFIG_BASE "/org/gnome/settings-daemon/peripherals/wacom/%s/"
+#define WACOM_DEVICE_CONFIG_BASE "/org/gnome/settings-daemon/peripherals/wacom/%s-%s/"
 #define WACOM_STYLUS_SCHEMA "org.gnome.settings-daemon.peripherals.wacom.stylus"
 #define WACOM_ERASER_SCHEMA "org.gnome.settings-daemon.peripherals.wacom.eraser"
 #define WACOM_BUTTON_SCHEMA "org.gnome.settings-daemon.peripherals.wacom.tablet-button"
@@ -316,6 +316,7 @@ struct GsdWacomDevicePrivate
 	GsdWacomDeviceType type;
 	char *name;
 	char *path;
+	char *machine_id;
 	const char *icon_name;
 	char *tool_name;
 	gboolean reversible;
@@ -1102,7 +1103,9 @@ gsd_wacom_device_update_from_db (GsdWacomDevice *device,
 {
 	char *settings_path;
 
-	settings_path = g_strdup_printf (WACOM_DEVICE_CONFIG_BASE, libwacom_get_match (wacom_device));
+	settings_path = g_strdup_printf (WACOM_DEVICE_CONFIG_BASE,
+					 device->priv->machine_id,
+					 libwacom_get_match (wacom_device));
 	device->priv->wacom_settings = g_settings_new_with_path (WACOM_TABLET_SCHEMA,
 								 settings_path);
 
@@ -1300,6 +1303,12 @@ gsd_wacom_device_init (GsdWacomDevice *device)
 {
         device->priv = GSD_WACOM_DEVICE_GET_PRIVATE (device);
         device->priv->type = WACOM_TYPE_INVALID;
+
+        if (g_file_get_contents ("/etc/machine-id", &device->priv->machine_id, NULL, NULL) == FALSE)
+                if (g_file_get_contents ("/var/lib/dbus/machine-id", &device->priv->machine_id, NULL, NULL) == FALSE)
+                        device->priv->machine_id = g_strdup ("00000000000000000000000000000000");
+
+        device->priv->machine_id = g_strstrip (device->priv->machine_id);
 }
 
 static void
@@ -1334,6 +1343,9 @@ gsd_wacom_device_finalize (GObject *object)
         g_free (p->path);
         p->path = NULL;
 
+        g_free (p->machine_id);
+        p->machine_id = NULL;
+
         if (p->modes) {
                 g_hash_table_destroy (p->modes);
                 p->modes = NULL;



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