[gnome-color-manager] trivial: save the virtual devices in the config file with a special flag
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] trivial: save the virtual devices in the config file with a special flag
- Date: Wed, 24 Feb 2010 10:25:43 +0000 (UTC)
commit cb2c42643577e8d5d0b795baf320043065189e74
Author: Richard Hughes <richard hughsie com>
Date: Wed Feb 24 09:51:20 2010 +0000
trivial: save the virtual devices in the config file with a special flag
src/gcm-client.c | 10 ++++++++--
src/gcm-device.c | 4 ++++
2 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/gcm-client.c b/src/gcm-client.c
index a23df36..b487f7b 100644
--- a/src/gcm-client.c
+++ b/src/gcm-client.c
@@ -40,6 +40,7 @@
#include "gcm-device-udev.h"
#include "gcm-device-cups.h"
#include "gcm-device-sane.h"
+#include "gcm-device-virtual.h"
#include "gcm-screen.h"
#include "gcm-utils.h"
@@ -640,6 +641,7 @@ gcm_client_add_unconnected_device (GcmClient *client, GKeyFile *keyfile, const g
GcmDeviceTypeEnum type;
GcmDevice *device = NULL;
gboolean ret;
+ gboolean virtual;
GError *error = NULL;
GcmClientPrivate *priv = client->priv;
@@ -647,6 +649,7 @@ gcm_client_add_unconnected_device (GcmClient *client, GKeyFile *keyfile, const g
title = g_key_file_get_string (keyfile, id, "title", NULL);
if (title == NULL)
goto out;
+ virtual = g_key_file_get_boolean (keyfile, id, "virtual", NULL);
type_text = g_key_file_get_string (keyfile, id, "type", NULL);
type = gcm_device_type_enum_from_string (type_text);
if (type == GCM_DEVICE_TYPE_ENUM_UNKNOWN)
@@ -655,14 +658,16 @@ gcm_client_add_unconnected_device (GcmClient *client, GKeyFile *keyfile, const g
/* 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);
+ egg_warning ("legacy device %s, 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) {
+ if (virtual) {
+ device = gcm_device_virtual_new ();
+ } else if (type == GCM_DEVICE_TYPE_ENUM_DISPLAY) {
device = gcm_device_xrandr_new ();
} else if (type == GCM_DEVICE_TYPE_ENUM_PRINTER) {
device = gcm_device_cups_new ();
@@ -683,6 +688,7 @@ gcm_client_add_unconnected_device (GcmClient *client, GKeyFile *keyfile, const g
"connected", FALSE,
"title", title,
"saved", TRUE,
+ "virtual", virtual,
"colorspace", colorspace,
NULL);
diff --git a/src/gcm-device.c b/src/gcm-device.c
index be886e9..efe14f9 100644
--- a/src/gcm-device.c
+++ b/src/gcm-device.c
@@ -362,6 +362,10 @@ gcm_device_save (GcmDevice *device, GError **error)
/* add colorspace */
g_key_file_set_string (keyfile, device->priv->id, "colorspace", gcm_colorspace_enum_to_string (device->priv->colorspace));
+ /* add virtual */
+ if (device->priv->virtual)
+ g_key_file_set_boolean (keyfile, device->priv->id, "virtual", TRUE);
+
/* 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]