--- a/gnt.h Wed Apr 23 01:55:42 2014 +0200
+++ b/gnt.h Wed Apr 23 12:35:57 2014 +0200
@@ -57,6 +57,17 @@
+ * @config_dir: the path to a configuration directory, may be %NULL. + * Change directory to store gnt configuration files (default is ~). + * You have to call this before #gnt_init. You might want to call this + * with %NULL, to free the resources, but not before a call to #gnt_quit. +void gnt_set_config_dir(const gchar *config_dir); * Start running the mainloop for gnt.
--- a/gntinternal.h Wed Apr 23 01:55:42 2014 +0200
+++ b/gntinternal.h Wed Apr 23 12:35:57 2014 +0200
@@ -44,4 +44,4 @@
extern int gnt_need_conversation_to_locale;
extern const char *C_(const char *x);
+const gchar *gnt_get_config_dir(void); --- a/gntmain.c Wed Apr 23 01:55:42 2014 +0200
+++ b/gntmain.c Wed Apr 23 12:35:57 2014 +0200
@@ -93,6 +93,8 @@
int gnt_need_conversation_to_locale;
+static gchar *custom_config_dir = NULL; #define HOLDING_ESCAPE (escape_stuff.timer != 0)
@@ -107,6 +109,25 @@
+gnt_set_config_dir(const gchar *config_dir) + gnt_warning("gnt_set_config_dir failed: %s", + "gnt already initialized"); + free(custom_config_dir); + custom_config_dir = g_strdup(config_dir); +gnt_get_config_dir(void) + return custom_config_dir; + return g_get_home_dir(); @@ -613,7 +634,7 @@
- filename = g_build_filename(g_get_home_dir(), ".gntrc", NULL);
+ filename = g_build_filename(gnt_get_config_dir(), ".gntrc", NULL); gnt_style_read_configure_file(filename);
--- a/gntwm.c Wed Apr 23 01:55:42 2014 +0200
+++ b/gntwm.c Wed Apr 23 12:35:57 2014 +0200
@@ -331,7 +331,7 @@
read_window_positions(GntWM *wm)
GKeyFile *gfile = g_key_file_new();
- char *filename = g_build_filename(g_get_home_dir(), ".gntpositions", NULL);
+ char *filename = g_build_filename(gnt_get_config_dir(), ".gntpositions", NULL); @@ -2120,7 +2120,7 @@
- filename = g_build_filename(g_get_home_dir(), ".gntpositions", NULL);
+ filename = g_build_filename(gnt_get_config_dir(), ".gntpositions", NULL); file = fopen(filename, "wb");