[gnome-color-manager] trivial: expose the default colorspaces on the session DBus interface



commit 5f6dfc6cc689491ed70338d2c5c578c79d5de43a
Author: Richard Hughes <richard hughsie com>
Date:   Wed Jan 6 14:42:29 2010 +0000

    trivial: expose the default colorspaces on the session DBus interface

 src/gcm-dbus.c                 |   66 ++++++++++++++++++++-------------------
 src/gcm-inspect.c              |   13 +++++++-
 src/org.gnome.ColorManager.xml |   22 +++++++++++++
 3 files changed, 67 insertions(+), 34 deletions(-)
---
diff --git a/src/gcm-dbus.c b/src/gcm-dbus.c
index 13ca8f0..7bbb86b 100644
--- a/src/gcm-dbus.c
+++ b/src/gcm-dbus.c
@@ -43,12 +43,16 @@ struct GcmDbusPrivate
 	GTimer			*timer;
 	gchar			*rendering_intent_display;
 	gchar			*rendering_intent_softproof;
+	gchar			*colorspace_rgb;
+	gchar			*colorspace_cmyk;
 };
 
 enum {
 	PROP_0,
 	PROP_RENDERING_INTENT_DISPLAY,
 	PROP_RENDERING_INTENT_SOFTPROOF,
+	PROP_COLORSPACE_RGB,
+	PROP_COLORSPACE_CMYK,
 	PROP_LAST
 };
 
@@ -107,6 +111,12 @@ gcm_dbus_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec
 	case PROP_RENDERING_INTENT_DISPLAY:
 		g_value_set_string (value, dbus->priv->rendering_intent_display);
 		break;
+	case PROP_COLORSPACE_RGB:
+		g_value_set_string (value, dbus->priv->colorspace_rgb);
+		break;
+	case PROP_COLORSPACE_CMYK:
+		g_value_set_string (value, dbus->priv->colorspace_cmyk);
+		break;
 	case PROP_RENDERING_INTENT_SOFTPROOF:
 		g_value_set_string (value, dbus->priv->rendering_intent_softproof);
 		break;
@@ -125,17 +135,7 @@ gcm_dbus_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec
 static void
 gcm_dbus_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
 {
-	GcmDbus *dbus = GCM_DBUS (object);
-
 	switch (prop_id) {
-	case PROP_RENDERING_INTENT_DISPLAY:
-		g_free (dbus->priv->rendering_intent_display);
-		dbus->priv->rendering_intent_display = g_strdup (g_value_get_string (value));
-		break;
-	case PROP_RENDERING_INTENT_SOFTPROOF:
-		g_free (dbus->priv->rendering_intent_softproof);
-		dbus->priv->rendering_intent_softproof = g_strdup (g_value_get_string (value));
-		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 		break;
@@ -412,6 +412,24 @@ gcm_dbus_class_init (GcmDbusClass *klass)
 							      NULL, NULL,
 							      NULL,
 							      G_PARAM_READABLE));
+	/**
+	 * GcmDbus:colorspace-rgb:
+	 */
+	g_object_class_install_property (object_class,
+					 PROP_COLORSPACE_RGB,
+					 g_param_spec_string ("colorspace-rgb",
+							      NULL, NULL,
+							      NULL,
+							      G_PARAM_READABLE));
+	/**
+	 * GcmDbus:colorspace-cmyk:
+	 */
+	g_object_class_install_property (object_class,
+					 PROP_COLORSPACE_CMYK,
+					 g_param_spec_string ("colorspace-cmyk",
+							      NULL, NULL,
+							      NULL,
+							      G_PARAM_READABLE));
 }
 
 /**
@@ -447,28 +465,10 @@ gcm_dbus_init (GcmDbus *dbus)
 				 dbus, NULL, NULL);
 
 	/* coldplug */
-	dbus->priv->rendering_intent_display = gconf_client_get_string (dbus->priv->gconf_client, GCM_SETTINGS_RENDERING_INTENT_DISPLAY, &error);
-	if (dbus->priv->rendering_intent_display == NULL) {
-		if (error != NULL) {
-			egg_warning ("failed to get intent: %s", error->message);
-			g_clear_error (&error);
-		}
-
-		/* set defaults as GConf isn't sure */
-		dbus->priv->rendering_intent_display = g_strdup ("unknown");
-	}
-
-	/* coldplug */
-	dbus->priv->rendering_intent_softproof = gconf_client_get_string (dbus->priv->gconf_client, GCM_SETTINGS_RENDERING_INTENT_SOFTPROOF, &error);
-	if (dbus->priv->rendering_intent_softproof == NULL) {
-		if (error != NULL) {
-			egg_warning ("failed to get intent: %s", error->message);
-			g_clear_error (&error);
-		}
-
-		/* set defaults as GConf isn't sure */
-		dbus->priv->rendering_intent_softproof = g_strdup ("unknown");
-	}
+	dbus->priv->rendering_intent_display = gconf_client_get_string (dbus->priv->gconf_client, GCM_SETTINGS_RENDERING_INTENT_DISPLAY, NULL);
+	dbus->priv->rendering_intent_softproof = gconf_client_get_string (dbus->priv->gconf_client, GCM_SETTINGS_RENDERING_INTENT_SOFTPROOF, NULL);
+	dbus->priv->colorspace_rgb = gconf_client_get_string (dbus->priv->gconf_client, GCM_SETTINGS_COLORSPACE_RGB, NULL);
+	dbus->priv->colorspace_cmyk = gconf_client_get_string (dbus->priv->gconf_client, GCM_SETTINGS_COLORSPACE_CMYK, NULL);
 
 	/* get all devices */
 	ret = gcm_client_add_connected (dbus->priv->client, &error);
@@ -492,6 +492,8 @@ gcm_dbus_finalize (GObject *object)
 	g_return_if_fail (dbus->priv != NULL);
 	g_free (dbus->priv->rendering_intent_display);
 	g_free (dbus->priv->rendering_intent_softproof);
+	g_free (dbus->priv->colorspace_rgb);
+	g_free (dbus->priv->colorspace_cmyk);
 	g_object_unref (dbus->priv->client);
 	g_object_unref (dbus->priv->gconf_client);
 	g_timer_destroy (dbus->priv->timer);
diff --git a/src/gcm-inspect.c b/src/gcm-inspect.c
index 25a56ae..ac2e257 100644
--- a/src/gcm-inspect.c
+++ b/src/gcm-inspect.c
@@ -321,9 +321,18 @@ out:
 static void
 gcm_inspect_get_properties_collect_cb (const char *key, const GValue *value, gpointer user_data)
 {
-	if (g_strcmp0 (key, "OutputIntent") == 0) {
+	if (g_strcmp0 (key, "RenderingIntentDisplay") == 0) {
 		/* TRANSLATORS: this is the rendering intent of the output */
-		g_print ("%s %s\n", _("Rendering intent (output):"), g_value_get_string (value));
+		g_print ("%s %s\n", _("Rendering intent (display):"), g_value_get_string (value));
+	} else if (g_strcmp0 (key, "RenderingIntentSoftproof") == 0) {
+		/* TRANSLATORS: this is the rendering intent of the printer */
+		g_print ("%s %s\n", _("Rendering intent (softproof):"), g_value_get_string (value));
+	} else if (g_strcmp0 (key, "ColorspaceRgb") == 0) {
+		/* TRANSLATORS: this is filename of the default colorspace */
+		g_print ("%s %s\n", _("RGB Colorspace:"), g_value_get_string (value));
+	} else if (g_strcmp0 (key, "ColorspaceCmyk") == 0) {
+		/* TRANSLATORS: this is filename of the default colorspace */
+		g_print ("%s %s\n", _("CMYK Colorspace:"), g_value_get_string (value));
 	} else {
 		egg_warning ("unhandled property '%s'", key);
 	}
diff --git a/src/org.gnome.ColorManager.xml b/src/org.gnome.ColorManager.xml
index 2ce686e..7e36f1f 100644
--- a/src/org.gnome.ColorManager.xml
+++ b/src/org.gnome.ColorManager.xml
@@ -51,6 +51,28 @@
     </property>
 
     <!--*****************************************************************************************-->
+    <property name="ColorspaceRgb" type="s" access="read">
+      <doc:doc>
+        <doc:description>
+          <doc:para>
+            The default colorspace filename for RGB files.
+          </doc:para>
+        </doc:description>
+      </doc:doc>
+    </property>
+
+    <!--*****************************************************************************************-->
+    <property name="ColorspaceCmyk" type="s" access="read">
+      <doc:doc>
+        <doc:description>
+          <doc:para>
+            The default colorspace filename for CMYK files.
+          </doc:para>
+        </doc:description>
+      </doc:doc>
+    </property>
+
+    <!--*****************************************************************************************-->
     <method name="GetProfilesForDevice">
       <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
       <doc:doc>



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