wacom: Only the stylus and eraser tools need to exist

And then again, not even sure about the eraser. But there
are devices we support that don't need the pad tool, such as the
Thinkpad X201 tablet.
This commit is contained in:
Bastien Nocera 2011-11-25 16:43:55 +00:00
parent d17cc86ce9
commit 54849a9e97
3 changed files with 9 additions and 20 deletions

View file

@ -40,7 +40,7 @@ G_DEFINE_TYPE (CcWacomPage, cc_wacom_page, GTK_TYPE_BOX)
struct _CcWacomPagePrivate
{
GsdWacomDevice *pad, *stylus, *eraser;
GsdWacomDevice *stylus, *eraser;
GtkBuilder *builder;
GSettings *wacom_settings;
GSettings *stylus_settings;
@ -466,16 +466,12 @@ set_first_stylus_icon (CcWacomPage *page)
}
GtkWidget *
cc_wacom_page_new (GsdWacomDevice *pad,
GsdWacomDevice *stylus,
cc_wacom_page_new (GsdWacomDevice *stylus,
GsdWacomDevice *eraser)
{
CcWacomPage *page;
CcWacomPagePrivate *priv;
g_return_val_if_fail (GSD_IS_WACOM_DEVICE (pad), NULL);
g_return_val_if_fail (gsd_wacom_device_get_device_type (pad) == WACOM_TYPE_PAD, NULL);
g_return_val_if_fail (GSD_IS_WACOM_DEVICE (stylus), NULL);
g_return_val_if_fail (gsd_wacom_device_get_device_type (stylus) == WACOM_TYPE_STYLUS, NULL);
@ -485,19 +481,18 @@ cc_wacom_page_new (GsdWacomDevice *pad,
page = g_object_new (CC_TYPE_WACOM_PAGE, NULL);
priv = page->priv;
priv->pad = pad;
priv->stylus = stylus;
priv->eraser = eraser;
/* FIXME move this to construct */
priv->wacom_settings = gsd_wacom_device_get_settings (pad);
priv->wacom_settings = gsd_wacom_device_get_settings (stylus);
set_mode_from_gsettings (GTK_COMBO_BOX (WID ("combo-tabletmode")), page);
/* Tablet name */
gtk_label_set_text (GTK_LABEL (WID ("label-tabletmodel")), gsd_wacom_device_get_name (pad));
gtk_label_set_text (GTK_LABEL (WID ("label-tabletmodel")), gsd_wacom_device_get_name (stylus));
/* Left-handedness */
if (gsd_wacom_device_reversible (pad) == FALSE) {
if (gsd_wacom_device_reversible (stylus) == FALSE) {
gtk_widget_hide (WID ("label-left-handed"));
gtk_widget_hide (WID ("switch-left-handed"));
} else {
@ -505,7 +500,7 @@ cc_wacom_page_new (GsdWacomDevice *pad,
}
/* Tablet icon */
set_icon_name (page, "image-tablet", gsd_wacom_device_get_icon_name (pad));
set_icon_name (page, "image-tablet", gsd_wacom_device_get_icon_name (stylus));
/* Stylus/Eraser */
priv->stylus_settings = get_first_stylus_setting (stylus);

View file

@ -68,8 +68,7 @@ struct _CcWacomPageClass
GType cc_wacom_page_get_type (void) G_GNUC_CONST;
GtkWidget * cc_wacom_page_new (GsdWacomDevice *pad,
GsdWacomDevice *stylus,
GtkWidget * cc_wacom_page_new (GsdWacomDevice *stylus,
GsdWacomDevice *eraser);
G_END_DECLS

View file

@ -49,7 +49,6 @@ struct _CcWacomPanelPrivate
typedef struct {
const char *name;
GsdWacomDevice *pad;
GsdWacomDevice *stylus;
GsdWacomDevice *eraser;
} Tablet;
@ -179,9 +178,6 @@ update_current_page (CcWacomPanel *self)
}
switch (gsd_wacom_device_get_device_type (device)) {
case WACOM_TYPE_PAD:
tablet->pad = device;
break;
case WACOM_TYPE_STYLUS:
tablet->stylus = device;
break;
@ -202,8 +198,7 @@ update_current_page (CcWacomPanel *self)
Tablet *tablet;
tablet = l->data;
if (tablet->pad == NULL ||
tablet->stylus == NULL ||
if (tablet->stylus == NULL ||
tablet->eraser == NULL) {
GtkWidget *page;
@ -219,7 +214,7 @@ update_current_page (CcWacomPanel *self)
if (g_hash_table_lookup (priv->pages, tablet->name) == NULL) {
GtkWidget *page;
page = cc_wacom_page_new (tablet->pad, tablet->stylus, tablet->eraser);
page = cc_wacom_page_new (tablet->stylus, tablet->eraser);
gtk_widget_show (page);
gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), page, NULL);
g_hash_table_insert (priv->pages, g_strdup (tablet->name), page);