[gnome-color-manager] Load the systemwide default if it has been installed
- From: Richard Hughes <rhughes src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Load the systemwide default if it has been installed
- Date: Fri, 1 Jan 2010 16:43:49 +0000 (UTC)
commit 3db44e9d4ff557af619f43359e719249b0040ebd
Author: Richard Hughes <richard hughsie com>
Date: Fri Jan 1 16:43:12 2010 +0000
Load the systemwide default if it has been installed
src/gcm-utils.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/gcm-utils.c b/src/gcm-utils.c
index ac589e9..e2029ce 100644
--- a/src/gcm-utils.c
+++ b/src/gcm-utils.c
@@ -434,12 +434,14 @@ gcm_utils_set_gamma_for_device (GcmDevice *device, GError **error)
GnomeRROutput *output;
gint x, y;
gchar *filename = NULL;
+ gchar *filename_systemwide = NULL;
gfloat gamma;
gfloat brightness;
gfloat contrast;
gchar *output_name;
gchar *id = NULL;
guint size;
+ gboolean saved;
gboolean use_global;
gboolean use_atom;
gboolean leftmost_screen = FALSE;
@@ -456,6 +458,7 @@ gcm_utils_set_gamma_for_device (GcmDevice *device, GError **error)
g_object_get (device,
"id", &id,
"type", &type,
+ "saved", &saved,
"profile-filename", &filename,
"gamma", &gamma,
"brightness", &brightness,
@@ -477,6 +480,16 @@ gcm_utils_set_gamma_for_device (GcmDevice *device, GError **error)
goto out;
}
+ /* if not saved, try to find default filename */
+ if (!saved && filename == NULL) {
+ filename_systemwide = g_strdup_printf ("%s/%s.icc", GCM_SYSTEM_PROFILES_DIR, id);
+ ret = g_file_test (filename_systemwide, G_FILE_TEST_EXISTS);
+ if (ret) {
+ egg_error ("using systemwide %s as profile", filename_systemwide);
+ filename = g_strdup (filename_systemwide);
+ }
+ }
+
/* check we have an output */
rr_screen = gnome_rr_screen_new (gdk_screen_get_default (), NULL, NULL, error);
if (rr_screen == NULL)
@@ -572,6 +585,7 @@ gcm_utils_set_gamma_for_device (GcmDevice *device, GError **error)
out:
g_free (id);
g_free (filename);
+ g_free (filename_systemwide);
g_free (output_name);
if (gconf_client != NULL)
g_object_unref (gconf_client);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]