* Fixes NB#85740, save separator position as float in order to enhace placement...
[modest] / src / modest-conf.c
index 90946b9..4696520 100644 (file)
@@ -207,6 +207,18 @@ modest_conf_get_int (ModestConf* self, const gchar* key, GError **err)
        return gconf_client_get_int (priv->gconf_client, key, err);
 }
 
+gdouble
+modest_conf_get_float (ModestConf* self, const gchar* key, GError **err)
+{
+       ModestConfPrivate *priv;
+
+       g_return_val_if_fail (self, -1);
+       g_return_val_if_fail (key, -1);
+
+       priv = MODEST_CONF_GET_PRIVATE(self);
+       
+       return gconf_client_get_float (priv->gconf_client, key, err);
+}
 
 gboolean
 modest_conf_get_bool (ModestConf* self, const gchar* key, GError **err)
@@ -281,6 +293,27 @@ modest_conf_set_int  (ModestConf* self, const gchar* key, gint val,
        return gconf_client_set_int (priv->gconf_client, key, val, err);
 }
 
+gboolean
+modest_conf_set_float (ModestConf* self, 
+                      const gchar* key, 
+                      gdouble val,
+                      GError **err)
+{
+       ModestConfPrivate *priv;
+               
+       g_return_val_if_fail (self,FALSE);
+       g_return_val_if_fail (key, FALSE);
+       
+       priv = MODEST_CONF_GET_PRIVATE(self);
+
+       if (!gconf_client_key_is_writable(priv->gconf_client,key,err)) {
+               g_printerr ("modest: '%s' is not writable\n", key);
+               return FALSE;
+       }
+                       
+       return gconf_client_set_float (priv->gconf_client, key, val, err);
+}
+
 
 gboolean
 modest_conf_set_bool (ModestConf* self, const gchar* key, gboolean val,
@@ -309,7 +342,6 @@ modest_conf_set_list (ModestConf* self, const gchar* key,
 {
        ModestConfPrivate *priv;
        GConfValueType gconf_type;
-       gboolean result;
        
        g_return_val_if_fail (self, FALSE);
        g_return_val_if_fail (key, FALSE);
@@ -317,31 +349,8 @@ modest_conf_set_list (ModestConf* self, const gchar* key,
        priv = MODEST_CONF_GET_PRIVATE(self);
 
        gconf_type = modest_conf_type_to_gconf_type (list_type, err);
-       if (*err)
-               return FALSE;
 
-       result = gconf_client_set_list (priv->gconf_client, key, gconf_type, val, err);
-       if(*err) {
-               g_warning("gconf_client_set_list() failed with key=%s. error=%s", key,
-                         (*err)->message);
-               result = FALSE;
-       }
-       
-       /* TODO: Remove this, when we fix the problem: */
-       /* This shows that sometimes set_list fails, while saying that it succeeded: */
-       if (result) {
-               const gint debug_list_length_start = g_slist_length(val);
-               GSList* debug_list = gconf_client_get_list(priv->gconf_client, key, gconf_type, err);
-               const gint debug_list_length_after = g_slist_length(debug_list);
-              
-               if(debug_list_length_start != debug_list_length_after)
-                       g_warning("modest_conf_set_list(): The list length after setting is "
-                                 "not the same as the specified list. key=%s. "
-                                 "We think that we fixed this, so tell us if you see this.", key);
-               g_slist_free(debug_list);
-       }
-       
-       return result;
+       return gconf_client_set_list (priv->gconf_client, key, gconf_type, val, err);
 }