summaryrefslogtreecommitdiff
path: root/saedit
diff options
context:
space:
mode:
authorVasily_Makarov <danilka.pro@gmail.com>2011-10-19 23:49:08 +0400
committerVasily_Makarov <danilka.pro@gmail.com>2011-10-19 23:49:08 +0400
commit95213c9cdb04d1791d55c231331467edce9ab722 (patch)
tree41e73ce4fe85d54bd35af01e88dc77334ef64181 /saedit
parent580c082d81b21c34886ab59905239eb64449378f (diff)
downloadevol-tools-95213c9cdb04d1791d55c231331467edce9ab722.tar.gz
evol-tools-95213c9cdb04d1791d55c231331467edce9ab722.tar.bz2
evol-tools-95213c9cdb04d1791d55c231331467edce9ab722.tar.xz
evol-tools-95213c9cdb04d1791d55c231331467edce9ab722.zip
Correct config loading/saving
Diffstat (limited to 'saedit')
-rw-r--r--saedit/config.c11
-rw-r--r--saedit/config.h7
2 files changed, 13 insertions, 5 deletions
diff --git a/saedit/config.c b/saedit/config.c
index 98a1325..f28ab54 100644
--- a/saedit/config.c
+++ b/saedit/config.c
@@ -56,10 +56,13 @@ void config_keys_save(Keys *keys) {
POSTFIX_FOLDER,
NULL));
g_key_file_set_boolean(key_file, "General", "ShowGrid", keys->show_grid);
- g_file_set_contents(KEYS_CONFIG_FILE,
- g_key_file_to_data(key_file, NULL, NULL),
- -1,
- NULL);
+
+ mkdir(KEYS_CONFIG_DIR, S_IRWXU);
+ int fd = g_creat(KEYS_CONFIG_FILE, S_IREAD | S_IWRITE);
+ gchar *buf = g_key_file_to_data(key_file, NULL, NULL);
+ write(fd, buf, strlen(buf), NULL);
+ close(fd);
+
g_key_file_free(key_file);
}
diff --git a/saedit/config.h b/saedit/config.h
index e7c5fb5..e8e064a 100644
--- a/saedit/config.h
+++ b/saedit/config.h
@@ -14,6 +14,10 @@
#include <glib.h>
#include <ibusxml.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
#include "common.h"
#include "xml.h"
@@ -21,7 +25,8 @@
#define KEY_SHOW_GRID_DEFAULT TRUE
#define KEY_CLIENTDATA_FOLDER_DEFAULT ""
-#define KEYS_CONFIG_FILE g_strjoin(SEPARATOR_SLASH, g_get_user_config_dir(), "saedit/config.ini", NULL)
+#define KEYS_CONFIG_DIR g_strjoin(SEPARATOR_SLASH, g_get_user_config_dir(), "saedit", NULL)
+#define KEYS_CONFIG_FILE g_strjoin(SEPARATOR_SLASH, KEYS_CONFIG_DIR, "config.ini", NULL)
typedef struct {
gchar *sprites;