[gnome-color-manager] Only save parameters in the config file if they are not the default values
- From: Richard Hughes <rhughes src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Only save parameters in the config file if they are not the default values
- Date: Wed, 18 Nov 2009 13:15:13 +0000 (UTC)
commit 28c3934142d190396c89842b41026053d467be9c
Author: Richard Hughes <richard hughsie com>
Date: Wed Nov 18 12:00:46 2009 +0000
Only save parameters in the config file if they are not the default values
src/gcm-device.c | 21 ++++++++++++++++++---
1 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/src/gcm-device.c b/src/gcm-device.c
index d211778..61e5973 100644
--- a/src/gcm-device.c
+++ b/src/gcm-device.c
@@ -312,9 +312,24 @@ gcm_device_save (GcmDevice *device, GError **error)
g_key_file_remove_key (keyfile, device->priv->id, "profile", NULL);
else
g_key_file_set_string (keyfile, device->priv->id, "profile", device->priv->profile_filename);
- g_key_file_set_double (keyfile, device->priv->id, "gamma", device->priv->gamma);
- g_key_file_set_double (keyfile, device->priv->id, "brightness", device->priv->brightness);
- g_key_file_set_double (keyfile, device->priv->id, "contrast", device->priv->contrast);
+
+ /* only save gamma if not the default */
+ if (device->priv->gamma > 0.99 && device->priv->gamma < 1.01)
+ g_key_file_remove_key (keyfile, device->priv->id, "gamma", NULL);
+ else
+ g_key_file_set_double (keyfile, device->priv->id, "gamma", device->priv->gamma);
+
+ /* only save brightness if not the default */
+ if (device->priv->brightness > -0.01 && device->priv->brightness < 0.01)
+ g_key_file_remove_key (keyfile, device->priv->id, "brightness", NULL);
+ else
+ g_key_file_set_double (keyfile, device->priv->id, "brightness", device->priv->brightness);
+
+ /* only save contrast if not the default */
+ if (device->priv->contrast > 99.9 && device->priv->contrast < 100.1)
+ g_key_file_remove_key (keyfile, device->priv->id, "contrast", NULL);
+ else
+ g_key_file_set_double (keyfile, device->priv->id, "contrast", device->priv->contrast);
/* convert to string */
data = g_key_file_to_data (keyfile, NULL, &error_local);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]