[gnome-color-manager] trivial: add gcm_clut_reset()
- From: Richard Hughes <rhughes src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] trivial: add gcm_clut_reset()
- Date: Mon, 9 Nov 2009 16:08:04 +0000 (UTC)
commit a4793793470ce6f7c4359d5e89ef858788533fdb
Author: Richard Hughes <richard hughsie com>
Date: Mon Nov 9 16:05:56 2009 +0000
trivial: add gcm_clut_reset()
src/gcm-clut.c | 25 ++++++++++++++++++++-----
src/gcm-clut.h | 1 +
2 files changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/src/gcm-clut.c b/src/gcm-clut.c
index 8345aea..2051bf8 100644
--- a/src/gcm-clut.c
+++ b/src/gcm-clut.c
@@ -102,6 +102,25 @@ gcm_clut_set_from_data (GcmClut *clut, const GcmClutData *data, guint size)
}
/**
+ * gcm_clut_reset:
+ **/
+gboolean
+gcm_clut_reset (GcmClut *clut)
+{
+ g_return_val_if_fail (GCM_IS_CLUT (clut), FALSE);
+
+ /* remove old data */
+ g_free (clut->priv->copyright);
+ g_free (clut->priv->description);
+
+ /* setup nothing */
+ clut->priv->copyright = NULL;
+ clut->priv->description = NULL;
+ g_ptr_array_set_size (clut->priv->array, 0);
+ return TRUE;
+}
+
+/**
* gcm_clut_load_from_profile:
**/
gboolean
@@ -117,11 +136,7 @@ gcm_clut_load_from_profile (GcmClut *clut, GError **error)
/* no profile to load */
if (clut->priv->profile == NULL) {
egg_debug ("no profile to load");
- g_free (clut->priv->copyright);
- g_free (clut->priv->description);
- clut->priv->copyright = NULL;
- clut->priv->description = NULL;
- g_ptr_array_set_size (clut->priv->array, 0);
+ gcm_clut_reset (clut);
goto out;
}
diff --git a/src/gcm-clut.h b/src/gcm-clut.h
index e9bef1d..ac78581 100644
--- a/src/gcm-clut.h
+++ b/src/gcm-clut.h
@@ -69,6 +69,7 @@ gboolean gcm_clut_load_from_config (GcmClut *clut,
gboolean gcm_clut_save_to_config (GcmClut *clut,
GError **error);
GPtrArray *gcm_clut_get_array (GcmClut *clut);
+gboolean gcm_clut_reset (GcmClut *clut);
void gcm_clut_print (GcmClut *clut);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]