[gnome-settings-daemon] wacom: Add code to set the last used stylus by ID



commit 56189c269ae52cd44a43cf3d4d47bab867ab55d6
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Dec 13 16:46:06 2011 +0000

    wacom: Add code to set the last used stylus by ID

 plugins/wacom/gsd-wacom-device.c |   21 +++++++++++++++++++++
 plugins/wacom/gsd-wacom-device.h |    2 ++
 2 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/plugins/wacom/gsd-wacom-device.c b/plugins/wacom/gsd-wacom-device.c
index 91ee703..af6f545 100644
--- a/plugins/wacom/gsd-wacom-device.c
+++ b/plugins/wacom/gsd-wacom-device.c
@@ -603,6 +603,27 @@ gsd_wacom_device_get_settings (GsdWacomDevice *device)
 	return device->priv->wacom_settings;
 }
 
+void
+gsd_wacom_device_set_current_stylus (GsdWacomDevice *device,
+				     int             stylus_id)
+{
+	GList *l;
+
+	g_return_if_fail (GSD_IS_WACOM_DEVICE (device));
+
+	for (l = device->priv->styli; l; l = l->next) {
+		GsdWacomStylus *stylus = l->data;
+
+		if (stylus->priv->id == stylus_id) {
+			g_object_set (device, "last-stylus", stylus, NULL);
+			g_object_notify (G_OBJECT (device), "last-stylus");
+			return;
+		}
+	}
+
+	g_warning ("Could not find stylus ID 0x%x for tablet '%s'", stylus_id, device->priv->name);
+}
+
 GsdWacomDeviceType
 gsd_wacom_device_get_device_type (GsdWacomDevice *device)
 {
diff --git a/plugins/wacom/gsd-wacom-device.h b/plugins/wacom/gsd-wacom-device.h
index ecea0ae..235e75a 100644
--- a/plugins/wacom/gsd-wacom-device.h
+++ b/plugins/wacom/gsd-wacom-device.h
@@ -92,6 +92,8 @@ const char     * gsd_wacom_device_get_tool_name    (GsdWacomDevice *device);
 gboolean         gsd_wacom_device_reversible       (GsdWacomDevice *device);
 gboolean         gsd_wacom_device_is_screen_tablet (GsdWacomDevice *device);
 GSettings      * gsd_wacom_device_get_settings     (GsdWacomDevice *device);
+void             gsd_wacom_device_set_current_stylus (GsdWacomDevice *device,
+						      int             stylus_id);
 
 GsdWacomDeviceType gsd_wacom_device_get_device_type (GsdWacomDevice *device);
 const char     * gsd_wacom_device_type_to_string   (GsdWacomDeviceType type);



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