[gnome-color-manager: 12/18] When saving an edited profile, re-parse the data when complete



commit f0a4cdb409a6bcc92d062de914888ca291dfb78d
Author: Richard Hughes <richard hughsie com>
Date:   Fri Oct 8 17:03:45 2010 +0100

    When saving an edited profile, re-parse the data when complete

 libcolor-glib/gcm-profile.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/libcolor-glib/gcm-profile.c b/libcolor-glib/gcm-profile.c
index 04135d9..43c3418 100644
--- a/libcolor-glib/gcm-profile.c
+++ b/libcolor-glib/gcm-profile.c
@@ -899,6 +899,7 @@ _cmsWriteTagTextAscii (cmsHPROFILE lcms_profile, cmsTagSignature sig, const gcha
 gboolean
 gcm_profile_save (GcmProfile *profile, const gchar *filename, GError **error)
 {
+	GFile *file = NULL;
 	gboolean ret = FALSE;
 	GcmProfilePrivate *priv = profile->priv;
 
@@ -949,7 +950,19 @@ gcm_profile_save (GcmProfile *profile, const gchar *filename, GError **error)
 	/* save, TODO: get error */
 	cmsSaveProfileToFile (priv->lcms_profile, filename);
 	ret = TRUE;
+
+	/* the profile now tracks the saved file */
+	if (priv->filename == NULL) {
+		egg_debug ("assuming %s, so re-parse", filename);
+		file = g_file_new_for_path (filename);
+		ret = gcm_profile_parse (profile, file, error);
+		if (!ret)
+			goto out;
+	}
+
 out:
+	if (file != NULL)
+		g_object_unref (file);
 	return ret;
 }
 



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