about summary refs log tree commit diff stats
path: root/src/config
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-11-30 21:25:13 +0000
committerJames Booth <boothj5@gmail.com>2014-11-30 21:25:13 +0000
commit5875dcfd53f8659a7e25fabd340b1cbfe4939c26 (patch)
tree7c93a787f9f71147ee6af8f53288e1e1eec5ba54 /src/config
parentaec7afd06af37767abdd7a6bedb7bafba41bb886 (diff)
downloadprofani-tty-5875dcfd53f8659a7e25fabd340b1cbfe4939c26.tar.gz
Only overwrite preferences with theme when them loaded, not on startup
Diffstat (limited to 'src/config')
-rw-r--r--src/config/theme.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/config/theme.c b/src/config/theme.c
index 72d5ef0b..6d3c5938 100644
--- a/src/config/theme.c
+++ b/src/config/theme.c
@@ -130,18 +130,33 @@ static void _load_preferences(void);
 static gchar * _get_themes_dir(void);
 void _theme_list_dir(const gchar * const dir, GSList **result);
 static GString * _theme_find(const char * const theme_name);
+static gboolean _theme_load_file(const char * const theme_name);
 
 void
 theme_init(const char * const theme_name)
 {
-    if (!theme_load(theme_name) && !theme_load("default")) {
+    if (!_theme_load_file(theme_name) && !_theme_load_file("default")) {
         log_error("Theme initialisation failed");
+    } else {
+        _load_colours();
     }
 }
 
 gboolean
 theme_load(const char * const theme_name)
 {
+    if (_theme_load_file(theme_name)) {
+        _load_colours();
+        _load_preferences();
+        return TRUE;
+    } else {
+        return FALSE;
+    }
+}
+
+static gboolean
+_theme_load_file(const char * const theme_name)
+{
     // use default theme
     if (theme_name == NULL || strcmp(theme_name, "default") == 0) {
         if (theme != NULL) {
@@ -170,8 +185,6 @@ theme_load(const char * const theme_name)
             NULL);
     }
 
-    _load_colours();
-    _load_preferences();
     return TRUE;
 }