Commit c9cbc31d authored by Matthias Clasen's avatar Matthias Clasen
Browse files

Handle GConf errors

Instead of checking writability in advance, handle errors returned
by GConfClient setters. Bug 594286.
parent a986583b
......@@ -152,41 +152,51 @@ vinagre_prefs_get_list (VinagrePrefs *prefs, const gchar* key)
static void
vinagre_prefs_set_bool (VinagrePrefs *prefs, const gchar* key, gboolean value)
{
g_return_if_fail (gconf_client_key_is_writable (
prefs->priv->gconf_client, key, NULL));
GError *error = NULL;
gconf_client_set_bool (prefs->priv->gconf_client, key, value, NULL);
if (!gconf_client_set_bool (prefs->priv->gconf_client, key, value, &error))
{
g_warning ("Setting key %s failed: %s", key, error->message);
g_error_free (error);
}
}
static void
vinagre_prefs_set_int (VinagrePrefs *prefs, const gchar* key, gint value)
{
g_return_if_fail (gconf_client_key_is_writable (
prefs->priv->gconf_client, key, NULL));
GError *error = NULL;
gconf_client_set_int (prefs->priv->gconf_client, key, value, NULL);
if (!gconf_client_set_int (prefs->priv->gconf_client, key, value, &error))
{
g_warning ("Setting key %s failed: %s", key, error->message);
g_error_free (error);
}
}
static void
vinagre_prefs_set_string (VinagrePrefs *prefs, const gchar *key, const gchar *value)
{
g_return_if_fail (gconf_client_key_is_writable (
prefs->priv->gconf_client, key, NULL));
GError *error = NULL;
gconf_client_set_string (prefs->priv->gconf_client, key, value, NULL);
if (!gconf_client_set_string (prefs->priv->gconf_client, key, value, &error))
{
g_warning ("Setting key %s failed: %s", key, error->message);
g_error_free (error);
}
}
static void
vinagre_prefs_set_list (VinagrePrefs *prefs, const gchar* key, GSList *list)
{
g_return_if_fail (gconf_client_key_is_writable (
prefs->priv->gconf_client, key, NULL));
gconf_client_set_list (prefs->priv->gconf_client,
key,
GCONF_VALUE_STRING,
list,
NULL);
GError *error = NULL;
if (!gconf_client_set_list (prefs->priv->gconf_client, key,
GCONF_VALUE_STRING, list,
&error))
{
g_warning ("Setting key %s failed: %s", key, error->message);
g_error_free (error);
}
}
static void
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment