[gnome-settings-daemon] wacom: Add icon-name property to styli



commit 1c9d3357923b0e855e6e4e22717b80e3a0b30da2
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Nov 25 14:06:07 2011 +0000

    wacom: Add icon-name property to styli

 plugins/wacom/gsd-wacom-device.c |   25 ++++++++++++++++++++-----
 plugins/wacom/gsd-wacom-device.h |    1 +
 2 files changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/plugins/wacom/gsd-wacom-device.c b/plugins/wacom/gsd-wacom-device.c
index b566613..e47e51f 100644
--- a/plugins/wacom/gsd-wacom-device.c
+++ b/plugins/wacom/gsd-wacom-device.c
@@ -39,6 +39,7 @@ struct GsdWacomStylusPrivate
 {
 	GsdWacomDevice *device;
 	char *name;
+	char *icon_name;
 	GSettings *settings;
 };
 
@@ -87,13 +88,17 @@ gsd_wacom_stylus_finalize (GObject *object)
         g_free (p->name);
         p->name = NULL;
 
+        g_free (p->icon_name);
+        p->icon_name = NULL;
+
         G_OBJECT_CLASS (gsd_wacom_stylus_parent_class)->finalize (object);
 }
 
 static GsdWacomStylus *
 gsd_wacom_stylus_new (GsdWacomDevice *device,
 		      GSettings *settings,
-		      const char *name)
+		      const char *name,
+		      const char *icon_name)
 {
 	GsdWacomStylus *stylus;
 
@@ -105,6 +110,7 @@ gsd_wacom_stylus_new (GsdWacomDevice *device,
 	stylus->priv->device = device;
 	stylus->priv->name = g_strdup (name);
 	stylus->priv->settings = settings;
+	stylus->priv->icon_name = g_strdup (icon_name);
 
 	return stylus;
 }
@@ -125,6 +131,14 @@ gsd_wacom_stylus_get_name (GsdWacomStylus *stylus)
 	return stylus->priv->name;
 }
 
+const char *
+gsd_wacom_stylus_get_icon_name (GsdWacomStylus *stylus)
+{
+	g_return_val_if_fail (GSD_IS_WACOM_STYLUS (stylus), NULL);
+
+	return stylus->priv->icon_name;
+}
+
 GsdWacomDevice *
 gsd_wacom_stylus_get_device (GsdWacomStylus *stylus)
 {
@@ -293,12 +307,13 @@ gsd_wacom_device_constructor (GType                     type,
 		GsdWacomStylus *stylus;
 		GSettings *settings;
 
-		if (device->priv->type == WACOM_TYPE_STYLUS)
+		if (device->priv->type == WACOM_TYPE_STYLUS) {
 			settings = g_settings_new (SETTINGS_WACOM_DIR "." SETTINGS_STYLUS_DIR);
-		else
+			stylus = gsd_wacom_stylus_new (device, settings, _("Stylus"), "wacom-stylus");
+		} else {
 			settings = g_settings_new (SETTINGS_WACOM_DIR "." SETTINGS_ERASER_DIR);
-
-		stylus = gsd_wacom_stylus_new (device, settings, _("Stylus"));
+			stylus = gsd_wacom_stylus_new (device, settings, NULL, NULL);
+		}
 		device->priv->styli = g_list_append (NULL, stylus);
 	}
 
diff --git a/plugins/wacom/gsd-wacom-device.h b/plugins/wacom/gsd-wacom-device.h
index adc8891..3b701b8 100644
--- a/plugins/wacom/gsd-wacom-device.h
+++ b/plugins/wacom/gsd-wacom-device.h
@@ -69,6 +69,7 @@ typedef struct
 GType            gsd_wacom_stylus_get_type     (void);
 GSettings      * gsd_wacom_stylus_get_settings (GsdWacomStylus *stylus);
 const char     * gsd_wacom_stylus_get_name     (GsdWacomStylus *stylus);
+const char     * gsd_wacom_stylus_get_icon_name(GsdWacomStylus *stylus);
 GsdWacomDevice * gsd_wacom_stylus_get_device   (GsdWacomStylus *stylus);
 
 /* Device types to apply a setting to */



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