[gnome-control-center] wacom: Only the stylus and eraser tools need to exist



commit 54849a9e97d58ec7536647ab5b5472d85e9f9d41
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Nov 25 16:43:55 2011 +0000

    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.

 panels/wacom/cc-wacom-page.c  |   17 ++++++-----------
 panels/wacom/cc-wacom-page.h  |    3 +--
 panels/wacom/cc-wacom-panel.c |    9 ++-------
 3 files changed, 9 insertions(+), 20 deletions(-)
---
diff --git a/panels/wacom/cc-wacom-page.c b/panels/wacom/cc-wacom-page.c
index 754939a..665932e 100644
--- a/panels/wacom/cc-wacom-page.c
+++ b/panels/wacom/cc-wacom-page.c
@@ -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);
diff --git a/panels/wacom/cc-wacom-page.h b/panels/wacom/cc-wacom-page.h
index 48ecdc0..3d7b748 100644
--- a/panels/wacom/cc-wacom-page.h
+++ b/panels/wacom/cc-wacom-page.h
@@ -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
diff --git a/panels/wacom/cc-wacom-panel.c b/panels/wacom/cc-wacom-panel.c
index 7c67de8..d1df598 100644
--- a/panels/wacom/cc-wacom-panel.c
+++ b/panels/wacom/cc-wacom-panel.c
@@ -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);



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