[ekiga] Conf: Fixed keys upgrade.
- From: Damien Sandras <dsandras src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga] Conf: Fixed keys upgrade.
- Date: Sat, 2 Jun 2012 16:23:30 +0000 (UTC)
commit 8d5b4fa0c42f499184c29d0ab97bda20d64bf36a
Author: Damien Sandras <dsandras beip be>
Date: Sat Jun 2 18:22:34 2012 +0200
Conf: Fixed keys upgrade.
There was a leak.
There was no check for the case where there was no value.
Also, we can get rid of the version test if we reset to old key to a
NULL value when done.
src/gui/conf.cpp | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/src/gui/conf.cpp b/src/gui/conf.cpp
index ac1ec47..6161243 100644
--- a/src/gui/conf.cpp
+++ b/src/gui/conf.cpp
@@ -188,11 +188,23 @@ gnomemeeting_conf_upgrade ()
// this allows to read the old option only when it exists
// and also not to be used during the very first execution of ekiga
+ // Dams: This is wrong, look below
+
// migrate custom statuses from online to available, and from dnd to busy
- if (version >= 3000 && version <= 3032) {
- gm_conf_set_string_list (PERSONAL_DATA_KEY "available_custom_status",
- gm_conf_get_string_list (PERSONAL_DATA_KEY "online_custom_status"));
- gm_conf_set_string_list (PERSONAL_DATA_KEY "busy_custom_status",
- gm_conf_get_string_list (PERSONAL_DATA_KEY "dnd_custom_status"));
+ GSList *old_values = NULL;
+ old_values = gm_conf_get_string_list (PERSONAL_DATA_KEY "online_custom_status");
+ if (old_values) {
+ gm_conf_set_string_list (PERSONAL_DATA_KEY "available_custom_status", old_values);
+ g_slist_foreach (old_values, (GFunc) g_free, NULL);
+ g_slist_free (old_values);
+ gm_conf_set_string_list (PERSONAL_DATA_KEY "online_custom_status", NULL);
+ }
+
+ old_values = gm_conf_get_string_list (PERSONAL_DATA_KEY "dnd_custom_status");
+ if (old_values) {
+ gm_conf_set_string_list (PERSONAL_DATA_KEY "busy_custom_status", old_values);
+ g_slist_foreach (old_values, (GFunc) g_free, NULL);
+ g_slist_free (old_values);
+ gm_conf_set_string_list (PERSONAL_DATA_KEY "dnd_custom_status", NULL);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]