[gnome-control-center] wacom: Add "pad" argument to cc_wacom_page_new()



commit 9df8c7cf62caa1b59672a9f3025016769bb099df
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Feb 14 18:30:34 2012 +0000

    wacom: Add "pad" argument to cc_wacom_page_new()

 panels/wacom/cc-wacom-page.c  |   11 +++++++++--
 panels/wacom/cc-wacom-page.h  |    3 ++-
 panels/wacom/cc-wacom-panel.c |    6 +++++-
 3 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/panels/wacom/cc-wacom-page.c b/panels/wacom/cc-wacom-page.c
index 570bd5a..9959b09 100644
--- a/panels/wacom/cc-wacom-page.c
+++ b/panels/wacom/cc-wacom-page.c
@@ -45,7 +45,7 @@ G_DEFINE_TYPE (CcWacomPage, cc_wacom_page, GTK_TYPE_BOX)
 struct _CcWacomPagePrivate
 {
 	CcWacomPanel   *panel;
-	GsdWacomDevice *stylus, *eraser;
+	GsdWacomDevice *stylus, *eraser, *pad;
 	GtkBuilder     *builder;
 	GtkWidget      *nav;
 	GtkWidget      *notebook;
@@ -506,6 +506,8 @@ update_tablet_ui (CcWacomPage *page,
 
 	priv = page->priv;
 
+	/* FIXME Handle ->pad being NULL and hide the pad buttons */
+
 	switch (layout) {
 	case LAYOUT_NORMAL:
 		remove_left_handed (page->priv);
@@ -540,7 +542,8 @@ update_tablet_ui (CcWacomPage *page,
 GtkWidget *
 cc_wacom_page_new (CcWacomPanel   *panel,
 		   GsdWacomDevice *stylus,
-		   GsdWacomDevice *eraser)
+		   GsdWacomDevice *eraser,
+		   GsdWacomDevice *pad)
 {
 	CcWacomPage *page;
 	CcWacomPagePrivate *priv;
@@ -552,12 +555,16 @@ cc_wacom_page_new (CcWacomPanel   *panel,
 	g_return_val_if_fail (GSD_IS_WACOM_DEVICE (eraser), NULL);
 	g_return_val_if_fail (gsd_wacom_device_get_device_type (eraser) == WACOM_TYPE_ERASER, NULL);
 
+	if (pad != NULL)
+		g_return_val_if_fail (gsd_wacom_device_get_device_type (pad) == WACOM_TYPE_PAD, NULL);
+
 	page = g_object_new (CC_TYPE_WACOM_PAGE, NULL);
 
 	priv = page->priv;
 	priv->panel = panel;
 	priv->stylus = stylus;
 	priv->eraser = eraser;
+	priv->pad = pad;
 
 	/* FIXME move this to construct */
 	priv->wacom_settings  = gsd_wacom_device_get_settings (stylus);
diff --git a/panels/wacom/cc-wacom-page.h b/panels/wacom/cc-wacom-page.h
index 8e05822..7b8fc2d 100644
--- a/panels/wacom/cc-wacom-page.h
+++ b/panels/wacom/cc-wacom-page.h
@@ -71,7 +71,8 @@ GType cc_wacom_page_get_type (void) G_GNUC_CONST;
 
 GtkWidget * cc_wacom_page_new (CcWacomPanel   *panel,
 			       GsdWacomDevice *stylus,
-			       GsdWacomDevice *eraser);
+			       GsdWacomDevice *eraser,
+			       GsdWacomDevice *pad);
 
 void cc_wacom_page_set_navigation (CcWacomPage *page,
 				   GtkNotebook *notebook,
diff --git a/panels/wacom/cc-wacom-panel.c b/panels/wacom/cc-wacom-panel.c
index e21be1e..1cfdd5a 100644
--- a/panels/wacom/cc-wacom-panel.c
+++ b/panels/wacom/cc-wacom-panel.c
@@ -51,6 +51,7 @@ typedef struct {
 	const char *name;
 	GsdWacomDevice *stylus;
 	GsdWacomDevice *eraser;
+	GsdWacomDevice *pad;
 } Tablet;
 
 enum {
@@ -184,6 +185,9 @@ update_current_page (CcWacomPanel *self)
 		case WACOM_TYPE_ERASER:
 			tablet->eraser = device;
 			break;
+		case WACOM_TYPE_PAD:
+			tablet->pad = device;
+			break;
 		default:
 			/* Nothing */
 			;
@@ -214,7 +218,7 @@ update_current_page (CcWacomPanel *self)
 
 		if (g_hash_table_lookup (priv->pages, tablet->name) == NULL) {
 			GtkWidget *page;
-			page = cc_wacom_page_new (self, tablet->stylus, tablet->eraser);
+			page = cc_wacom_page_new (self, tablet->stylus, tablet->eraser, tablet->pad);
 			cc_wacom_page_set_navigation (CC_WACOM_PAGE (page), GTK_NOTEBOOK (priv->notebook), TRUE);
 			gtk_widget_show (page);
 			gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), page, NULL);



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