[gnome-color-manager] Save the internal panel brightness in the ICC profile
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Save the internal panel brightness in the ICC profile
- Date: Sat, 28 Jan 2012 21:56:21 +0000 (UTC)
commit a0b5278b4f108101a9949d2073f214ae8ba725ba
Author: Richard Hughes <richard hughsie com>
Date: Sat Jan 28 21:55:15 2012 +0000
Save the internal panel brightness in the ICC profile
src/gcm-calibrate-main.c | 12 ++++++++++++
src/gcm-calibrate.c | 14 +++++++++++++-
src/gcm-calibrate.h | 1 +
src/gcm-utils.h | 3 +++
4 files changed, 29 insertions(+), 1 deletions(-)
---
diff --git a/src/gcm-calibrate-main.c b/src/gcm-calibrate-main.c
index 59f5493..5520ea0 100644
--- a/src/gcm-calibrate-main.c
+++ b/src/gcm-calibrate-main.c
@@ -280,7 +280,9 @@ gcm_calib_set_extra_metadata (GcmCalibratePriv *calib,
cmsHPROFILE lcms_profile;
gboolean ret = TRUE;
gchar *data = NULL;
+ gchar *screen_brightness_str = NULL;
gsize len;
+ guint percentage;
/* parse */
ret = g_file_get_contents (filename, &data, &len, error);
@@ -315,6 +317,15 @@ gcm_calib_set_extra_metadata (GcmCalibratePriv *calib,
CD_PROFILE_METADATA_MAPPING_DEVICE_ID,
cd_device_get_id (calib->device));
+ /* add the calibration brightness if an internal panel */
+ percentage = gcm_calibrate_get_screen_brightness (calib->calibrate);
+ if (percentage > 0) {
+ screen_brightness_str = g_strdup_printf ("%i", percentage);
+ _cmsDictAddEntryAscii (dict,
+ CD_PROFILE_METADATA_SCREEN_BRIGHTNESS,
+ screen_brightness_str);
+ }
+
/* just write dict */
ret = cmsWriteTag (lcms_profile, cmsSigMetaTag, dict);
if (!ret) {
@@ -335,6 +346,7 @@ gcm_calib_set_extra_metadata (GcmCalibratePriv *calib,
cmsSaveProfileToFile (lcms_profile, filename);
ret = TRUE;
out:
+ g_free (screen_brightness_str);
g_free (data);
if (dict != NULL)
cmsDictFree (dict);
diff --git a/src/gcm-calibrate.c b/src/gcm-calibrate.c
index e028485..b15730c 100644
--- a/src/gcm-calibrate.c
+++ b/src/gcm-calibrate.c
@@ -68,6 +68,7 @@ struct _GcmCalibratePrivate
gchar *device;
gchar *working_path;
guint old_brightness;
+ guint new_brightness;
guint target_whitepoint;
GtkWidget *content_widget;
GtkWindow *sample_window;
@@ -194,6 +195,15 @@ gcm_calibrate_get_basename (GcmCalibrate *calibrate)
}
/**
+ * gcm_calibrate_get_screen_brightness:
+ **/
+guint
+gcm_calibrate_get_screen_brightness (GcmCalibrate *calibrate)
+{
+ return calibrate->priv->new_brightness;
+}
+
+/**
* gcm_calibrate_set_basename:
**/
static void
@@ -1489,8 +1499,10 @@ gcm_calibrate_set_brightness (GcmCalibrate *calibrate, CdDevice *device)
error->message);
g_clear_error (&error);
}
+ /* FIXME: allow the user to set this */
+ calibrate->priv->new_brightness = 100;
ret = gcm_brightness_set_percentage (calibrate->priv->brightness,
- 100,
+ calibrate->priv->new_brightness,
&error);
if (!ret) {
g_warning ("failed to set brightness: %s",
diff --git a/src/gcm-calibrate.h b/src/gcm-calibrate.h
index fb3ab7a..699a51b 100644
--- a/src/gcm-calibrate.h
+++ b/src/gcm-calibrate.h
@@ -164,6 +164,7 @@ gboolean gcm_calibrate_set_from_exif (GcmCalibrate *calibrate,
const gchar *gcm_calibrate_get_filename_result (GcmCalibrate *calibrate);
const gchar *gcm_calibrate_get_working_path (GcmCalibrate *calibrate);
const gchar *gcm_calibrate_get_basename (GcmCalibrate *calibrate);
+guint gcm_calibrate_get_screen_brightness (GcmCalibrate *calibrate);
/* for gcm-calibrate-helper */
gboolean gcm_calibrate_display_characterize (GcmCalibrate *calibrate,
diff --git a/src/gcm-utils.h b/src/gcm-utils.h
index 2693470..d017342 100644
--- a/src/gcm-utils.h
+++ b/src/gcm-utils.h
@@ -53,6 +53,9 @@
#ifndef CD_PROFILE_METADATA_MAPPING_DEVICE_ID
#define CD_PROFILE_METADATA_MAPPING_DEVICE_ID "MAPPING_device_id"
#endif
+#ifndef CD_PROFILE_METADATA_SCREEN_BRIGHTNESS
+#define CD_PROFILE_METADATA_SCREEN_BRIGHTNESS "SCREEN_brightness"
+#endif
/* DISTROS: you will have to patch if you have changed the name of these packages */
#define GCM_PREFS_PACKAGE_NAME_SHARED_COLOR_TARGETS "shared-color-targets"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]