[gnome-settings-daemon] wacom: Add work-around for configs on NFS shared homes



commit d756fff137a27992b8151bafc8f83d50dea0feff
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Jan 27 15:08:44 2014 +0100

    wacom: Add work-around for configs on NFS shared homes
    
    When sharing the same home directory over NFS, it might be convenient
    to share device configurations as well, so that the "Wacom Intuos X" on
    machine A has the same configuration as "Wacom Intuos X" on machine B
    for that user.
    
    The work-around makes the machine-id be all zeroes when
    ~/.config/gnome-settings-daemon/no-per-machine-config
    and as such, should not be applied during a running GNOME session.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=723099

 plugins/wacom/README.config-storage |   18 +++++++++++++++---
 plugins/wacom/gsd-wacom-device.c    |   15 ++++++++++++++-
 2 files changed, 29 insertions(+), 4 deletions(-)
---
diff --git a/plugins/wacom/README.config-storage b/plugins/wacom/README.config-storage
index 645865e..bb99214 100644
--- a/plugins/wacom/README.config-storage
+++ b/plugins/wacom/README.config-storage
@@ -8,15 +8,27 @@ possible to use the same device, with same configuration on 2 machines
 with a shared home directory, or replace a malfunctioning device with the
 same model and have the same configuration.
 
-It does not allow having 2 separate tablets of the same model to have different
-configurations, whether on a single machine, or using a shared home directory.
+It does not allow [1] having 2 separate tablets of the same model to have
+different configurations, whether on a single machine, or using a shared
+home directory.
 
 The configuration scheme is:
 schema: org.gnome.settings-daemon.peripherals.wacom
 path: /org/gnome/settings-daemon/peripherals/wacom/<machine ID>-<device ID>/
 
 where <machine ID> is the D-Bus machine-id for the machine, and
-<device ID> is a unique identifier for the tablet.
+<device ID> is a unique identifier for the tablet model.
+
+[1]: If you're using NFS shared home directories, you can share configurations
+between different machines by creating an empty
+~/.config/gnome-settings-daemon/no-per-machine-config file.
+$ mkdir -p ~/.config/gnome-settings-daemon/
+$ touch  ~/.config/gnome-settings-daemon/no-per-machine-config
+
+Note that this needs to happen without any gnome-settings-daemon
+running (otherwise half of the configuration would be done in a per-machine
+way and half in a generic way), and that previous machine-specific
+configurations will be lost.
 
 Stylus
 ------
diff --git a/plugins/wacom/gsd-wacom-device.c b/plugins/wacom/gsd-wacom-device.c
index 12204e1..14c3a21 100644
--- a/plugins/wacom/gsd-wacom-device.c
+++ b/plugins/wacom/gsd-wacom-device.c
@@ -1603,14 +1603,27 @@ gsd_wacom_device_class_init (GsdWacomDeviceClass *klass)
 static void
 gsd_wacom_device_init (GsdWacomDevice *device)
 {
+        char *per_user_config;
+
         device->priv = GSD_WACOM_DEVICE_GET_PRIVATE (device);
         device->priv->type = WACOM_TYPE_INVALID;
 
+        per_user_config = g_build_filename (g_get_user_config_dir (), "gnome-settings-daemon", 
"no-per-machine-config", NULL);
+        if (g_file_test (per_user_config, G_FILE_TEST_EXISTS)) {
+                g_free (per_user_config);
+                goto fallback;
+        }
+        g_free (per_user_config);
+
         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");
+                        goto fallback;
 
         device->priv->machine_id = g_strstrip (device->priv->machine_id);
+        return;
+
+fallback:
+        device->priv->machine_id = g_strdup ("00000000000000000000000000000000");
 }
 
 static void


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