telepathy-mission-control: mcd_storage_set_string: implement in terms of mcd_storage_set_value
Simon McVittie
smcv at kemper.freedesktop.org
Thu Oct 4 08:19:46 PDT 2012
Module: telepathy-mission-control
Branch: master
Commit: 3e08626fafa696290162fb8baafa5bc4cece07fa
URL: http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=3e08626fafa696290162fb8baafa5bc4cece07fa
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date: Wed Sep 5 10:07:33 2012 +0100
mcd_storage_set_string: implement in terms of mcd_storage_set_value
---
src/mcd-storage.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/mcd-storage.c b/src/mcd-storage.c
index 8631273..ed272aa 100644
--- a/src/mcd-storage.c
+++ b/src/mcd-storage.c
@@ -805,25 +805,25 @@ mcd_storage_set_string (McdStorage *self,
const gchar *val,
gboolean secret)
{
- gboolean updated = FALSE;
- gchar *old = g_key_file_get_string (self->keyfile, account, key, NULL);
+ gboolean updated;
g_return_val_if_fail (MCD_IS_STORAGE (self), FALSE);
g_return_val_if_fail (account != NULL, FALSE);
g_return_val_if_fail (key != NULL, FALSE);
if (val == NULL)
- g_key_file_remove_key (self->keyfile, account, key, NULL);
- else
- g_key_file_set_string (self->keyfile, account, key, val);
-
- if (tp_strdiff (old, val))
{
- update_storage (self, account, key, secret);
- updated = TRUE;
+ updated = mcd_storage_set_value (self, account, key, NULL, secret);
}
+ else
+ {
+ GValue tmp = G_VALUE_INIT;
- g_free (old);
+ g_value_init (&tmp, G_TYPE_STRING);
+ g_value_set_string (&tmp, val);
+ updated = mcd_storage_set_value (self, account, key, &tmp, secret);
+ g_value_unset (&tmp);
+ }
return updated;
}
More information about the telepathy-commits
mailing list