[gnome-settings-daemon] color: Remove the hacky heuristic to ensure that the correct profiles are checked for age



commit fa477a84ffb8aab88f79fb9a26e807ef4e093866
Author: Richard Hughes <richard hughsie com>
Date:   Mon Jun 13 13:56:46 2011 +0100

    color: Remove the hacky heuristic to ensure that the correct profiles are checked for age
    
    This removes the heuristic that assumed the name of any profiles prefixed with
    'GCM' were created by GNOME Color Manager in response to a user calibration.
    
    Note: This doesn't actually change any behaviour; the user only gets
    notifications that the profile is out of calibration if the gsettings keys is
    enabled manually.

 plugins/color/gsd-color-manager.c |   36 +++++++++++++++++++++++++++++-------
 1 files changed, 29 insertions(+), 7 deletions(-)
---
diff --git a/plugins/color/gsd-color-manager.c b/plugins/color/gsd-color-manager.c
index 61baf6c..dd58d19 100644
--- a/plugins/color/gsd-color-manager.c
+++ b/plugins/color/gsd-color-manager.c
@@ -626,6 +626,12 @@ gcm_apply_create_icc_profile_for_edid (GsdColorManager *manager,
         /* just create a new dict */
         dict = cmsDictAlloc (NULL);
 
+        /* set the data source so we don't ever prompt the user to
+         * recalibrate (as the EDID data won't have changed) */
+        _cmsDictAddEntryAscii (dict,
+                               CD_PROFILE_METADATA_DATA_SOURCE,
+                               CD_PROFILE_METADATA_DATA_SOURCE_EDID);
+
         /* set 'ICC meta Tag for Monitor Profiles' data */
         _cmsDictAddEntryAscii (dict, "EDID_md5", gcm_edid_get_checksum (edid));
         data = gcm_edid_get_monitor_name (edid);
@@ -1551,6 +1557,7 @@ gcm_session_profile_connect_cb (GObject *object,
         gboolean allow_notifications;
         gboolean ret;
         gchar *basename = NULL;
+        const gchar *data_source;
         GError *error = NULL;
         CdProfile *profile = CD_PROFILE (object);
         GcmSessionAsyncHelper *helper = (GcmSessionAsyncHelper *) user_data;
@@ -1567,13 +1574,28 @@ gcm_session_profile_connect_cb (GObject *object,
         }
 
         /* ensure it's a profile generated by us */
-        filename = cd_profile_get_filename (profile);
-        if (filename == NULL)
-                goto out;
-        basename = g_path_get_basename (filename);
-        if (!g_str_has_prefix (basename, "GCM")) {
-                g_debug ("not a GCM profile for %s: %s",
-                         cd_device_get_id (helper->device), filename);
+        data_source = cd_profile_get_metadata_item (profile,
+                                                    CD_PROFILE_METADATA_DATA_SOURCE);
+        if (data_source == NULL) {
+
+                /* existing profiles from gnome-color-manager < 3.1
+                 * won't have the extra metadata values added */
+                filename = cd_profile_get_filename (profile);
+                if (filename == NULL)
+                        goto out;
+                basename = g_path_get_basename (filename);
+                if (!g_str_has_prefix (basename, "GCM")) {
+                        g_debug ("not a GCM profile for %s: %s",
+                                 cd_device_get_id (helper->device), filename);
+                        goto out;
+                }
+
+        /* ensure it's been created from a calibration, rather than from
+         * auto-EDID */
+        } else if (g_strcmp0 (data_source,
+                   CD_PROFILE_METADATA_DATA_SOURCE_CALIB) != 0) {
+                g_debug ("not a calib profile for %s",
+                         cd_device_get_id (helper->device));
                 goto out;
         }
 



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