[gnome-settings-daemon] wacom: Helper function to get the corresponding stylus



commit 16557d844047a41dbbf97d6b0ee7119857fde17c
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Jan 16 16:46:36 2012 +0000

    wacom: Helper function to get the corresponding stylus
    
    To a particular type.

 plugins/wacom/gsd-wacom-device.c |   17 +++++++++++++++++
 plugins/wacom/gsd-wacom-device.h |    2 ++
 2 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/plugins/wacom/gsd-wacom-device.c b/plugins/wacom/gsd-wacom-device.c
index 3ab124d..8396793 100644
--- a/plugins/wacom/gsd-wacom-device.c
+++ b/plugins/wacom/gsd-wacom-device.c
@@ -681,6 +681,23 @@ gsd_wacom_device_list_styli (GsdWacomDevice *device)
 	return g_list_copy (device->priv->styli);
 }
 
+GsdWacomStylus *
+gsd_wacom_device_get_stylus_for_type (GsdWacomDevice     *device,
+				      GsdWacomStylusType  type)
+{
+	GList *l;
+
+	g_return_val_if_fail (GSD_IS_WACOM_DEVICE (device), NULL);
+
+	for (l = device->priv->styli; l != NULL; l = l->next) {
+		GsdWacomStylus *stylus = l->data;
+
+		if (gsd_wacom_stylus_get_stylus_type (stylus) == type)
+			return stylus;
+	}
+	return NULL;
+}
+
 const char *
 gsd_wacom_device_get_name (GsdWacomDevice *device)
 {
diff --git a/plugins/wacom/gsd-wacom-device.h b/plugins/wacom/gsd-wacom-device.h
index fe5ed1a..4c808b5 100644
--- a/plugins/wacom/gsd-wacom-device.h
+++ b/plugins/wacom/gsd-wacom-device.h
@@ -106,6 +106,8 @@ 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);
+GsdWacomStylus * gsd_wacom_device_get_stylus_for_type (GsdWacomDevice     *device,
+						       GsdWacomStylusType  type);
 
 GsdWacomDeviceType gsd_wacom_device_get_device_type (GsdWacomDevice *device);
 gint           * gsd_wacom_device_get_area          (GsdWacomDevice *device);



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