From 5875dcfd53f8659a7e25fabd340b1cbfe4939c26 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 30 Nov 2014 21:25:13 +0000 Subject: [PATCH] Only overwrite preferences with theme when them loaded, not on startup --- src/config/theme.c | 19 ++++++++++++++++--- 1 file 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,17 +130,32 @@ 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) { @@ -170,8 +185,6 @@ theme_load(const char * const theme_name) NULL); } - _load_colours(); - _load_preferences(); return TRUE; }