[vinagre] Rewrite of vinagre_prefs_get_string()
- From: Jonh Wendell <jwendell src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [vinagre] Rewrite of vinagre_prefs_get_string()
- Date: Thu, 30 Jul 2009 20:13:05 +0000 (UTC)
commit d9a66245570868335cea0fc6c40bcba342e98eeb
Author: Jonh Wendell <jwendell gnome org>
Date: Thu Jul 30 17:12:37 2009 -0300
Rewrite of vinagre_prefs_get_string()
vinagre/vinagre-prefs.c | 30 ++++++++++--------------------
1 files changed, 10 insertions(+), 20 deletions(-)
---
diff --git a/vinagre/vinagre-prefs.c b/vinagre/vinagre-prefs.c
index cd9b8b7..703c6c8 100644
--- a/vinagre/vinagre-prefs.c
+++ b/vinagre/vinagre-prefs.c
@@ -128,29 +128,16 @@ vinagre_prefs_get_int (VinagrePrefs *prefs, const gchar* key, gint def)
return def;
}
-static const gchar *
+static gchar *
vinagre_prefs_get_string (VinagrePrefs *prefs, const gchar *key, const gchar *def)
{
- GError* error = NULL;
- GConfValue* val;
-
- val = gconf_client_get (prefs->priv->gconf_client, key, &error);
+ gchar *result;
- if (val != NULL)
- {
- const gchar *retval = def;
-
- g_return_val_if_fail (error == NULL, retval);
+ result = gconf_client_get_string (prefs->priv->gconf_client, key, NULL);
+ if (!result)
+ result = g_strdup (def);
- if (val->type == GCONF_VALUE_STRING)
- retval = gconf_value_get_string (val);
-
- gconf_value_free (val);
-
- return retval;
- }
- else
- return def;
+ return result;
}
static GSList *
@@ -301,6 +288,7 @@ static void
vinagre_prefs_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
{
VinagrePrefs *prefs = VINAGRE_PREFS (object);
+ gchar *str;
switch (prop_id)
{
@@ -341,7 +329,9 @@ vinagre_prefs_get_property (GObject *object, guint prop_id, GValue *value, GPara
g_value_set_pointer (value, vinagre_prefs_get_list (prefs, VM_ACTIVE_PLUGINS));
break;
case PROP_LAST_PROTOCOL:
- g_value_set_string (value, vinagre_prefs_get_string (prefs, VM_LAST_PROTOCOL, NULL));
+ str = vinagre_prefs_get_string (prefs, VM_LAST_PROTOCOL, NULL);
+ g_value_set_string (value, str);
+ g_free (str);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]