[gnome-color-manager] Save the device colorspace in the config file so we can set profiles when not connected
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Save the device colorspace in the config file so we can set profiles when not connected
- Date: Wed, 24 Feb 2010 10:25:18 +0000 (UTC)
commit b3a249ee3de20d4c48ae98ec0efa718bb0111ae9
Author: Richard Hughes <richard hughsie com>
Date: Wed Feb 24 09:31:32 2010 +0000
Save the device colorspace in the config file so we can set profiles when not connected
src/gcm-client.c | 14 +++++++++++++-
src/gcm-device.c | 3 +++
2 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/src/gcm-client.c b/src/gcm-client.c
index 4ba4361..a23df36 100644
--- a/src/gcm-client.c
+++ b/src/gcm-client.c
@@ -635,6 +635,8 @@ gcm_client_add_unconnected_device (GcmClient *client, GKeyFile *keyfile, const g
{
gchar *title;
gchar *type_text = NULL;
+ gchar *colorspace_text = NULL;
+ GcmColorspaceEnum colorspace;
GcmDeviceTypeEnum type;
GcmDevice *device = NULL;
gboolean ret;
@@ -650,6 +652,15 @@ gcm_client_add_unconnected_device (GcmClient *client, GKeyFile *keyfile, const g
if (type == GCM_DEVICE_TYPE_ENUM_UNKNOWN)
goto out;
+ /* get colorspace */
+ colorspace_text = g_key_file_get_string (keyfile, id, "colorspace", NULL);
+ if (colorspace_text == NULL) {
+ egg_warning ("legacy device %i, falling back to RGB", id);
+ colorspace = GCM_COLORSPACE_ENUM_RGB;
+ } else {
+ colorspace = gcm_colorspace_enum_from_string (colorspace_text);
+ }
+
/* create device or specified type */
if (type == GCM_DEVICE_TYPE_ENUM_DISPLAY) {
device = gcm_device_xrandr_new ();
@@ -672,7 +683,7 @@ gcm_client_add_unconnected_device (GcmClient *client, GKeyFile *keyfile, const g
"connected", FALSE,
"title", title,
"saved", TRUE,
- "colorspace", GCM_COLORSPACE_ENUM_RGB, //FIXME: should get from config file
+ "colorspace", colorspace,
NULL);
/* load the device */
@@ -693,6 +704,7 @@ out:
if (device != NULL)
g_object_unref (device);
g_free (type_text);
+ g_free (colorspace_text);
g_free (title);
}
diff --git a/src/gcm-device.c b/src/gcm-device.c
index 2a1425a..41ebf85 100644
--- a/src/gcm-device.c
+++ b/src/gcm-device.c
@@ -357,6 +357,9 @@ gcm_device_save (GcmDevice *device, GError **error)
g_key_file_set_string (keyfile, device->priv->id, "title", device->priv->title);
g_key_file_set_string (keyfile, device->priv->id, "type", gcm_device_type_enum_to_string (device->priv->type));
+ /* add colorspace */
+ g_key_file_set_string (keyfile, device->priv->id, "colorspace", gcm_colorspace_enum_to_string (device->priv->colorspace));
+
/* convert to string */
data = g_key_file_to_data (keyfile, NULL, &error_local);
if (data == NULL) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]