[gnome-color-manager] Add a profile property to GcmProfile



commit 3a5eb9471826b5aa5af3a736349b7c472572a75d
Author: Richard Hughes <richard hughsie com>
Date:   Tue Nov 10 12:28:59 2009 +0000

    Add a profile property to GcmProfile

 src/gcm-profile.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/src/gcm-profile.c b/src/gcm-profile.c
index 515b961..a0b462a 100644
--- a/src/gcm-profile.c
+++ b/src/gcm-profile.c
@@ -120,6 +120,7 @@ struct _GcmProfilePrivate
 	gboolean			 loaded;
 	guint				 profile_type;
 	gchar				*description;
+	gchar				*filename;
 	gchar				*copyright;
 	gchar				*vendor;
 	gboolean			 has_mlut;
@@ -141,6 +142,7 @@ enum {
 	PROP_COPYRIGHT,
 	PROP_VENDOR,
 	PROP_DESCRIPTION,
+	PROP_FILENAME,
 	PROP_TYPE,
 	PROP_LAST
 };
@@ -654,6 +656,7 @@ gcm_profile_parse (GcmProfile *profile, const gchar *filename, GError **error)
 	gboolean ret;
 	gsize length;
 	GError *error_local = NULL;
+	GcmProfilePrivate *priv = profile->priv;
 
 	g_return_val_if_fail (GCM_IS_PROFILE (profile), FALSE);
 	g_return_val_if_fail (filename != NULL, FALSE);
@@ -661,6 +664,10 @@ gcm_profile_parse (GcmProfile *profile, const gchar *filename, GError **error)
 
 	egg_debug ("loading '%s'", filename);
 
+	/* save */
+	g_free (priv->filename);
+	priv->filename = g_strdup (filename);
+
 	/* load files */
 	ret = g_file_get_contents (filename, &data, &length, &error_local);
 	if (!ret) {
@@ -865,6 +872,9 @@ gcm_profile_get_property (GObject *object, guint prop_id, GValue *value, GParamS
 	case PROP_DESCRIPTION:
 		g_value_set_string (value, priv->description);
 		break;
+	case PROP_FILENAME:
+		g_value_set_string (value, priv->filename);
+		break;
 	case PROP_TYPE:
 		g_value_set_uint (value, priv->profile_type);
 		break;
@@ -924,6 +934,14 @@ gcm_profile_class_init (GcmProfileClass *klass)
 	g_object_class_install_property (object_class, PROP_DESCRIPTION, pspec);
 
 	/**
+	 * GcmProfile:filename:
+	 */
+	pspec = g_param_spec_string ("filename", NULL, NULL,
+				     NULL,
+				     G_PARAM_READABLE);
+	g_object_class_install_property (object_class, PROP_FILENAME, pspec);
+
+	/**
 	 * GcmProfile:type:
 	 */
 	pspec = g_param_spec_uint ("type", NULL, NULL,
@@ -958,6 +976,8 @@ gcm_profile_finalize (GObject *object)
 	GcmProfilePrivate *priv = profile->priv;
 
 	g_free (priv->copyright);
+	g_free (priv->description);
+	g_free (priv->filename);
 	g_free (priv->vendor);
 	g_free (priv->vcgt_data);
 	g_free (priv->mlut_data);



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