summaryrefslogtreecommitdiff
path: root/libcaja-private
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2014-07-08 11:36:24 +0200
committerStefano Karapetsas <[email protected]>2014-07-08 11:36:24 +0200
commit5c00ec63c8e6c73706e67876cb4b88837112f5d9 (patch)
tree98ea7036783365093e7ac492e4642c599897e32d /libcaja-private
parent055af122062667206828a6e971d7c8cc8b29d519 (diff)
parente2c56fc2f8182c361684b9ae29beb998749912dc (diff)
downloadcaja-5c00ec63c8e6c73706e67876cb4b88837112f5d9.tar.bz2
caja-5c00ec63c8e6c73706e67876cb4b88837112f5d9.tar.xz
Merge pull request #298 from bl0ckeduser/master
Handle metadata key deletions (fixes #296)
Diffstat (limited to 'libcaja-private')
-rw-r--r--libcaja-private/caja-desktop-metadata.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/libcaja-private/caja-desktop-metadata.c b/libcaja-private/caja-desktop-metadata.c
index 8434ec08..c9e136bc 100644
--- a/libcaja-private/caja-desktop-metadata.c
+++ b/libcaja-private/caja-desktop-metadata.c
@@ -146,13 +146,31 @@ caja_desktop_set_metadata_string (CajaFile *file,
const gchar *string)
{
GKeyFile *keyfile;
+ GError *error = NULL;
keyfile = get_keyfile ();
- g_key_file_set_string (keyfile,
- name,
- key,
- string);
+ if (string != NULL) {
+ g_key_file_set_string (keyfile,
+ name,
+ key,
+ string);
+ } else {
+ /* NULL as value is taken to mean that we want to remove the key */
+
+ g_key_file_remove_key (keyfile,
+ name,
+ key,
+ &error);
+
+ if (error != NULL) {
+ g_warning ("Couldn't remove the key '%s' from '%s' in the keyfile: %s",
+ key,
+ name,
+ error->message);
+ g_error_free (error);
+ }
+ }
save_in_idle (keyfile);