[gvfs] Add metafile_key_list_set to clear and set a key as a list
- From: Alexander Larsson <alexl src gnome org>
- To: svn-commits-list gnome org
- Subject: [gvfs] Add metafile_key_list_set to clear and set a key as a list
- Date: Tue, 23 Jun 2009 11:11:09 -0400 (EDT)
commit 1ca409e4431e7bbc323af4fd5daf68d22133b351
Author: Alexander Larsson <alexl redhat com>
Date: Mon Jun 22 14:47:09 2009 +0200
Add metafile_key_list_set to clear and set a key as a list
metadata/metabuilder.c | 17 +++++++++++++++++
metadata/metabuilder.h | 2 ++
2 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/metadata/metabuilder.c b/metadata/metabuilder.c
index e37cf70..9f8af33 100644
--- a/metadata/metabuilder.c
+++ b/metadata/metabuilder.c
@@ -229,6 +229,23 @@ metafile_key_set_value (MetaFile *metafile,
}
void
+metafile_key_list_set (MetaFile *metafile,
+ const char *key)
+{
+ MetaData *data;
+
+ data = metafile_key_lookup (metafile, key, TRUE);
+ if (!data->is_list)
+ {
+ metadata_clear (data);
+ data->is_list = TRUE;
+ }
+ g_list_foreach (data->values, (GFunc)g_free, NULL);
+ g_list_free (data->values);
+ data->values = NULL;
+}
+
+void
metafile_key_list_add (MetaFile *metafile,
const char *key,
const char *value)
diff --git a/metadata/metabuilder.h b/metadata/metabuilder.h
index 3af05bb..51340f2 100644
--- a/metadata/metabuilder.h
+++ b/metadata/metabuilder.h
@@ -50,6 +50,8 @@ void metafile_key_unset (MetaFile *metafile,
void metafile_key_set_value (MetaFile *metafile,
const char *key,
const char *value);
+void metafile_key_list_set (MetaFile *metafile,
+ const char *key);
void metafile_key_list_add (MetaFile *metafile,
const char *key,
const char *value);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]