コード例 #1
0
static void
add_styli (CcWacomPage *page)
{
	GList *styli, *l;
	CcWacomPagePrivate *priv;

	priv = page->priv;

	styli = csd_wacom_device_list_styli (priv->stylus);

	for (l = styli; l; l = l->next) {
		CsdWacomStylus *stylus, *eraser;
		GtkWidget *page;

		stylus = l->data;

		if (csd_wacom_stylus_get_stylus_type (stylus) == WACOM_STYLUS_TYPE_PUCK)
			continue;

		if (csd_wacom_stylus_get_has_eraser (stylus)) {
			CsdWacomDeviceType type;
			type = csd_wacom_stylus_get_stylus_type (stylus);
			eraser = csd_wacom_device_get_stylus_for_type (priv->eraser, type);
		} else {
			eraser = NULL;
		}

		page = cc_wacom_stylus_page_new (stylus, eraser);
		cc_wacom_stylus_page_set_navigation (CC_WACOM_STYLUS_PAGE (page), GTK_NOTEBOOK (priv->notebook));
		gtk_widget_show (page);
		gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), page, NULL);
	}
	g_list_free (styli);
}
コード例 #2
0
static void
list_devices (GList *devices)
{
	GList *l;

	for (l = devices; l ; l = l->next) {
		CsdWacomDevice *device;
		CsdWacomDeviceType type;
		char *loc;

		device = l->data;

		g_signal_connect (G_OBJECT (device), "notify::last-stylus",
				  G_CALLBACK (last_stylus_changed), NULL);

		g_print ("Device '%s' (type: %s)\n",
			 csd_wacom_device_get_name (device),
			 csd_wacom_device_type_to_string (csd_wacom_device_get_device_type (device)));
		g_print ("\tReversible: %s\n", BOOL_AS_STR (csd_wacom_device_reversible (device)));
		g_print ("\tScreen Tablet: %s\n", BOOL_AS_STR (csd_wacom_device_is_screen_tablet (device)));
		g_print ("\tIntegrated Device: %s\n", BOOL_AS_STR (csd_wacom_device_is_isd (device)));
		g_print ("\tUnknown (fallback) device: %s\n", BOOL_AS_STR(csd_wacom_device_is_fallback (device)));

		loc = get_loc (csd_wacom_device_get_settings (device));
		g_print ("\tGeneric settings: %s\n", loc);
		g_free (loc);

		type = csd_wacom_device_get_device_type (device);
		if (type == WACOM_TYPE_STYLUS ||
		    type == WACOM_TYPE_ERASER) {
			GList *styli, *j;
			CsdWacomStylus *current_stylus;

			g_object_get (device, "last-stylus", &current_stylus, NULL);

			styli = csd_wacom_device_list_styli (device);
			for (j = styli; j; j = j->next) {
				CsdWacomStylus *stylus;

				stylus = j->data;
				print_stylus (stylus, current_stylus == stylus);
			}
			g_list_free (styli);
		}

		print_buttons (device);

		if (monitor_styli == FALSE)
			g_object_unref (device);
	}
	g_list_free (devices);
}