From fa77756bd1db1c0b657fc784508890330bd5bfb3 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Tue, 4 Aug 2009 18:21:47 +0200 Subject: Remove the parameters from the unset pool when we set them again --- libempathy/empathy-account-settings.c | 36 ++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'libempathy') diff --git a/libempathy/empathy-account-settings.c b/libempathy/empathy-account-settings.c index 5c4644d5a..ad7874d6c 100644 --- a/libempathy/empathy-account-settings.c +++ b/libempathy/empathy-account-settings.c @@ -515,6 +515,29 @@ empathy_account_settings_get_tp_param (EmpathyAccountSettings *settings, return NULL; } +static void +account_settings_remove_from_unset (EmpathyAccountSettings *settings, + const gchar *param) +{ + EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); + int idx; + gchar *val; + + for (idx = 0; idx < priv->unset_parameters->len; idx++) + { + val = g_array_index (priv->unset_parameters, gchar *, idx); + + if (!tp_strdiff (val, param)) + { + priv->unset_parameters = + g_array_remove_index (priv->unset_parameters, idx); + g_free (val); + + break; + } + } +} + const GValue * empathy_account_settings_get_default (EmpathyAccountSettings *settings, const gchar *param) @@ -572,7 +595,6 @@ empathy_account_settings_get (EmpathyAccountSettings *settings, return empathy_account_settings_get_default (settings, param); } - void empathy_account_settings_unset (EmpathyAccountSettings *settings, const gchar *param) @@ -768,6 +790,8 @@ empathy_account_settings_set_string (EmpathyAccountSettings *settings, EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); tp_asv_set_string (priv->parameters, g_strdup (param), value); + + account_settings_remove_from_unset (settings, param); } void @@ -778,6 +802,8 @@ empathy_account_settings_set_int32 (EmpathyAccountSettings *settings, EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); tp_asv_set_int32 (priv->parameters, g_strdup (param), value); + + account_settings_remove_from_unset (settings, param); } void @@ -788,6 +814,8 @@ empathy_account_settings_set_int64 (EmpathyAccountSettings *settings, EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); tp_asv_set_int64 (priv->parameters, g_strdup (param), value); + + account_settings_remove_from_unset (settings, param); } void @@ -798,6 +826,8 @@ empathy_account_settings_set_uint32 (EmpathyAccountSettings *settings, EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); tp_asv_set_uint32 (priv->parameters, g_strdup (param), value); + + account_settings_remove_from_unset (settings, param); } void @@ -808,6 +838,8 @@ empathy_account_settings_set_uint64 (EmpathyAccountSettings *settings, EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); tp_asv_set_uint64 (priv->parameters, g_strdup (param), value); + + account_settings_remove_from_unset (settings, param); } void @@ -818,6 +850,8 @@ empathy_account_settings_set_boolean (EmpathyAccountSettings *settings, EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); tp_asv_set_boolean (priv->parameters, g_strdup (param), value); + + account_settings_remove_from_unset (settings, param); } static void -- cgit v1.2.3