[gnome-settings-daemon] wacom: Print buttons list in list-wacom



commit 4c639dad80b69a12a4fe8a9c1815af5a3a63e50d
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Feb 7 14:32:49 2012 +0000

    wacom: Print buttons list in list-wacom

 plugins/wacom/list-wacom.c |   42 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/plugins/wacom/list-wacom.c b/plugins/wacom/list-wacom.c
index 6f3b2b0..b053faa 100644
--- a/plugins/wacom/list-wacom.c
+++ b/plugins/wacom/list-wacom.c
@@ -73,6 +73,21 @@ stylus_type_to_string (GsdWacomStylusType type)
 	return NULL;
 }
 
+static const char *
+button_type_to_string (GsdWacomTabletButtonType type)
+{
+	switch (type) {
+	case WACOM_TABLET_BUTTON_TYPE_NORMAL:
+		return "normal";
+	case WACOM_TABLET_BUTTON_TYPE_ELEVATOR:
+		return "elevator";
+	case WACOM_TABLET_BUTTON_TYPE_HARDCODED:
+		return "hard-coded";
+	default:
+		g_assert_not_reached ();
+	}
+}
+
 #define BOOL_AS_STR(x) (x ? "yes" : "no")
 
 static void
@@ -115,6 +130,31 @@ print_stylus (GsdWacomStylus *stylus,
 }
 
 static void
+print_buttons (GsdWacomDevice *device)
+{
+	GList *buttons, *l;
+
+	buttons = gsd_wacom_device_get_buttons (device);
+	if (buttons == NULL)
+		return;
+
+	g_print ("\tButtons:\n");
+	for (l = buttons; l != NULL; l = l->next) {
+		GsdWacomTabletButton *button = l->data;
+
+		g_print ("\t\t%s ('%s', type: %s",
+			 button->name,
+			 button->id,
+			 button_type_to_string (button->type));
+		if (button->group_id > 0)
+			g_print (", group: %d)\n", button->group_id);
+		else
+			g_print (")\n");
+	}
+	g_list_free (buttons);
+}
+
+static void
 last_stylus_changed (GsdWacomDevice  *device,
 		     GParamSpec      *pspec,
 		     gpointer         user_data)
@@ -172,6 +212,8 @@ list_devices (GList *devices)
 			g_list_free (styli);
 		}
 
+		print_buttons (device);
+
 		if (monitor_styli == FALSE)
 			g_object_unref (device);
 	}



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