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); }
static void print_stylus (CsdWacomStylus *stylus, gboolean is_current) { CsdWacomDevice *device; char *loc; device = csd_wacom_stylus_get_device (stylus); g_print ("\t%sStylus: '%s' (Type: %s, ID: 0x%x)\n", is_current ? "*** " : "", csd_wacom_stylus_get_name (stylus), stylus_type_to_string (csd_wacom_stylus_get_stylus_type (stylus)), csd_wacom_stylus_get_id (stylus)); loc = get_loc (csd_wacom_stylus_get_settings (stylus)); g_print ("\t\tSettings: %s\n", loc); g_free (loc); g_print ("\t\tIcon name: %s\n", csd_wacom_stylus_get_icon_name (stylus)); if (csd_wacom_device_get_device_type (device) == WACOM_TYPE_STYLUS) { int num_buttons; char *buttons; g_print ("\t\tHas Eraser: %s\n", BOOL_AS_STR(csd_wacom_stylus_get_has_eraser (stylus))); num_buttons = csd_wacom_stylus_get_num_buttons (stylus); if (num_buttons < 0) num_buttons = 2; if (num_buttons > 0) buttons = g_strdup_printf ("%d buttons", num_buttons); else buttons = g_strdup ("no button"); g_print ("\t\tButtons: %s\n", buttons); g_free (buttons); } }