[gnome-settings-daemon] wacom: Implement per-device and per-stylus settings
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] wacom: Implement per-device and per-stylus settings
- Date: Mon, 12 Dec 2011 18:19:46 +0000 (UTC)
commit 830e02b0b9d5d0e39f1f3ba9285ab39d6aee2157
Author: Bastien Nocera <hadess hadess net>
Date: Mon Dec 12 17:46:51 2011 +0000
wacom: Implement per-device and per-stylus settings
Though stylus settings are currently wrongly applied.
...ings-daemon.peripherals.wacom.gschema.xml.in.in | 6 ++--
plugins/wacom/gsd-wacom-device.c | 22 ++++++++++++++-----
2 files changed, 19 insertions(+), 9 deletions(-)
---
diff --git a/data/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in.in b/data/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in.in
index 66efde2..84bf398 100644
--- a/data/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in.in
+++ b/data/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in.in
@@ -11,7 +11,7 @@
<_description>Priority to use for this plugin in gnome-settings-daemon startup queue</_description>
</key>
</schema>
- <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.settings-daemon.peripherals.wacom" path="/org/gnome/settings-daemon/peripherals/wacom/">
+ <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.settings-daemon.peripherals.wacom">
<child name="stylus" schema="org.gnome.settings-daemon.peripherals.wacom.stylus"/>
<child name="eraser" schema="org.gnome.settings-daemon.peripherals.wacom.eraser"/>
@@ -48,7 +48,7 @@
<_description>Set this to the logical button mapping.</_description>
</key>
</schema>
- <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.settings-daemon.peripherals.wacom.stylus" path="/org/gnome/settings-daemon/peripherals/wacom/stylus/">
+ <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.settings-daemon.peripherals.wacom.stylus">
<key name="pressurecurve" type="ai">
<default>[0, 0, 100, 100]</default>
<_summary>Wacom stylus pressure curve</_summary>
@@ -65,7 +65,7 @@
<_description>Set this to the pressure value at which a stylus click event is generated.</_description>
</key>
</schema>
- <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.settings-daemon.peripherals.wacom.eraser" path="/org/gnome/settings-daemon/peripherals/wacom/eraser/">
+ <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.settings-daemon.peripherals.wacom.eraser">
<key name="pressurecurve" type="ai">
<default>[0, 0, 100, 100]</default>
<_summary>Wacom eraser pressure curve</_summary>
diff --git a/plugins/wacom/gsd-wacom-device.c b/plugins/wacom/gsd-wacom-device.c
index 9ea02eb..0728bbb 100644
--- a/plugins/wacom/gsd-wacom-device.c
+++ b/plugins/wacom/gsd-wacom-device.c
@@ -38,6 +38,11 @@
#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_STYLUS_SCHEMA "org.gnome.settings-daemon.peripherals.wacom.stylus"
+#define WACOM_ERASER_SCHEMA "org.gnome.settings-daemon.peripherals.wacom.eraser"
+
static WacomDeviceDatabase *db = NULL;
struct GsdWacomStylusPrivate
@@ -278,9 +283,11 @@ gsd_wacom_device_update_from_db (GsdWacomDevice *device,
WacomDevice *wacom_device,
const char *identifier)
{
- /* FIXME
- * Those should have their own unique path based on a unique property */
- device->priv->wacom_settings = g_settings_new (SETTINGS_WACOM_DIR);
+ char *settings_path;
+
+ settings_path = g_strdup_printf (WACOM_DEVICE_CONFIG_BASE, libwacom_get_match (wacom_device));
+ device->priv->wacom_settings = g_settings_new_with_path (WACOM_TABLET_SCHEMA,
+ settings_path);
device->priv->name = get_device_name (wacom_device);
device->priv->reversible = libwacom_is_reversible (wacom_device);
@@ -307,6 +314,7 @@ gsd_wacom_device_update_from_db (GsdWacomDevice *device,
wstylus = libwacom_stylus_get_for_id (db, ids[i]);
if (wstylus) {
GsdWacomStylus *stylus;
+ char *stylus_settings_path;
GSettings *settings;
if (device->priv->type == WACOM_TYPE_STYLUS &&
@@ -316,19 +324,21 @@ gsd_wacom_device_update_from_db (GsdWacomDevice *device,
libwacom_stylus_is_eraser (wstylus) == FALSE)
continue;
- //FIXME settings path!
+ stylus_settings_path = g_strdup_printf ("%s/0x%x", settings_path, ids[i]);
if (device->priv->type == WACOM_TYPE_STYLUS) {
- settings = g_settings_new (SETTINGS_WACOM_DIR "." SETTINGS_STYLUS_DIR);
+ settings = g_settings_new_with_path (WACOM_STYLUS_SCHEMA, stylus_settings_path);
stylus = gsd_wacom_stylus_new (device, wstylus, settings);
} else {
- settings = g_settings_new (SETTINGS_WACOM_DIR "." SETTINGS_ERASER_DIR);
+ settings = g_settings_new_with_path (WACOM_ERASER_SCHEMA, stylus_settings_path);
stylus = gsd_wacom_stylus_new (device, wstylus, settings);
}
+ g_free (stylus_settings_path);
device->priv->styli = g_list_prepend (device->priv->styli, stylus);
}
}
device->priv->styli = g_list_reverse (device->priv->styli);
}
+ g_free (settings_path);
}
static GObject *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]