[gnome-settings-daemon] wacom: List the current stylus in the printout



commit a3010804486272e4a511f8f7c594be23bb1aadf1
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Dec 13 16:46:32 2011 +0000

    wacom: List the current stylus in the printout

 plugins/wacom/list-wacom.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/plugins/wacom/list-wacom.c b/plugins/wacom/list-wacom.c
index 7675309..c5953b4 100644
--- a/plugins/wacom/list-wacom.c
+++ b/plugins/wacom/list-wacom.c
@@ -23,6 +23,7 @@
 
 #include <gtk/gtk.h>
 
+#include "gsd-input-helper.h"
 #include "gsd-wacom-device.h"
 
 static char *
@@ -71,13 +72,18 @@ list_devices (GList *devices)
 		if (type == WACOM_TYPE_STYLUS ||
 		    type == WACOM_TYPE_ERASER) {
 			GList *styli, *j;
+			GsdWacomStylus *current_stylus;
+
+			g_object_get (device, "last-stylus", &current_stylus, NULL);
 
 			styli = gsd_wacom_device_list_styli (device);
 			for (j = styli; j; j = j->next) {
 				GsdWacomStylus *stylus;
 
 				stylus = j->data;
-				g_message ("\tStylus: '%s'", gsd_wacom_stylus_get_name (stylus));
+				g_message ("\tStylus%s: '%s'",
+					   current_stylus == stylus ? " (current)" : "",
+					   gsd_wacom_stylus_get_name (stylus));
 
 				loc = get_loc (gsd_wacom_stylus_get_settings (stylus));
 				g_message ("\t\tSettings: %s", loc);
@@ -104,12 +110,21 @@ list_actual_devices (void)
 	devices = NULL;
 	for (l = list; l ; l = l->next) {
 		GsdWacomDevice *device;
+		int device_id, tool_id;
 
 		device = gsd_wacom_device_new (l->data);
 		if (gsd_wacom_device_get_device_type (device) == WACOM_TYPE_INVALID) {
 			g_object_unref (device);
 			continue;
 		}
+
+		if (gsd_wacom_device_get_device_type (device) == WACOM_TYPE_STYLUS ||
+		    gsd_wacom_device_get_device_type (device) == WACOM_TYPE_ERASER) {
+			g_object_get (l->data, "device-id", &device_id, NULL);
+			tool_id = xdevice_get_last_tool_id (device_id);
+			gsd_wacom_device_set_current_stylus (device, tool_id);
+		}
+
 		devices = g_list_prepend (devices, device);
 	}
 	g_list_free (list);



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