psppire_conf_finalize (GObject *object)
{
PsppireConf *conf = PSPPIRE_CONF (object);
+ g_mutex_free (conf->mutex);
g_key_file_free (conf->keyfile);
g_free (conf->filename);
}
object_class->finalize = psppire_conf_finalize;
object_class->dispose = psppire_conf_dispose;
object_class->constructor = psppire_conf_construct;
-
}
{
const gchar *dirname = g_get_user_config_dir ();
+ conf->mutex = g_mutex_new ();
+
conf->filename = g_strdup_printf ("%s/%s", dirname, "psppirerc");
conf->keyfile = g_key_file_new ();
{
gboolean ok;
GError *err = NULL;
+
+ g_mutex_lock (conf->mutex);
conf_read (conf);
*value = g_key_file_get_integer (conf->keyfile,
base,
if ( err != NULL )
g_error_free (err);
+
+ g_mutex_unlock (conf->mutex);
+
return ok;
}
gboolean ok;
gboolean b;
GError *err = NULL;
+ g_mutex_lock (conf->mutex);
+
conf_read (conf);
b = g_key_file_get_boolean (conf->keyfile,
base,
if (ok)
*value = b;
+ g_mutex_unlock (conf->mutex);
+
return ok;
}
const gchar *base, const gchar *name,
gint value)
{
+ g_mutex_lock (conf->mutex);
g_key_file_set_integer (conf->keyfile, base, name, value);
conf_write (conf);
+ g_mutex_unlock (conf->mutex);
}
void
const gchar *base, const gchar *name,
gboolean value)
{
+ g_mutex_lock (conf->mutex);
g_key_file_set_boolean (conf->keyfile, base, name, value);
conf_write (conf);
+ g_mutex_unlock (conf->mutex);
}
/*