diff --git a/Makefile.am b/Makefile.am index bb7ef7bf..622dd1e1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,8 +1,10 @@ # create default-config.h -config.h: default-config.h +config.h: default-config.h default-theme.h default-config.h: $(srcdir)/config - $(srcdir)/file2header.sh $(srcdir)/config > default-config.h + $(srcdir)/file2header.sh $(srcdir)/config default_config > default-config.h +default-theme.h: $(srcdir)/default.theme + $(srcdir)/file2header.sh $(srcdir)/default.theme default_theme > default-theme.h if BUILD_PLUGINS PLUGINS=plugins diff --git a/file2header.sh b/file2header.sh index 8b37b8eb..f25ae13b 100755 --- a/file2header.sh +++ b/file2header.sh @@ -1,5 +1,5 @@ #!/bin/sh -echo "const char *default_config =" +echo "const char *$2 =" cat $1|sed 's/\\/\\\\/g'|sed 's/"/\\"/g'|sed 's/^/\"/'|sed 's/$/\\n\"/' echo ";" diff --git a/src/fe-common/core/themes.c b/src/fe-common/core/themes.c index e7e17cc9..73e5e094 100644 --- a/src/fe-common/core/themes.c +++ b/src/fe-common/core/themes.c @@ -31,11 +31,13 @@ #include "themes.h" #include "printtext.h" +#include "default-theme.h" + GSList *themes; THEME_REC *current_theme; GHashTable *default_formats; -static void theme_read(THEME_REC *theme, const char *path); +static void theme_read(THEME_REC *theme, const char *path, const char *data); THEME_REC *theme_create(const char *path, const char *name) { @@ -635,7 +637,7 @@ THEME_REC *theme_load(const char *name) } theme = theme_create(fname, name); - theme_read(theme, theme->path); + theme_read(theme, theme->path, NULL); g_free(fname); return theme; @@ -652,19 +654,23 @@ static void theme_read_modules(const char *module, void *value, theme_init_module(rec->theme, module, rec->config); } -static void theme_read(THEME_REC *theme, const char *path) +static void theme_read(THEME_REC *theme, const char *path, const char *data) { CONFIG_REC *config; THEME_READ_REC rec; - config = config_open(path, -1); - if (config == NULL) { - /* didn't exist or no access? */ - theme->default_color = 15; - return; + if (data == NULL) { + config = config_open(path, -1); + if (config == NULL) { + /* didn't exist or no access? */ + theme->default_color = 15; + return; + } + config_parse(config); + } else { + config = config_open(NULL, -1); + config_parse_data(config, data, "internal"); } - - config_parse(config); theme->default_color = config_get_int(config, NULL, "default_color", 15); theme_read_replaces(config, theme); theme_read_abstracts(config, theme); @@ -968,6 +974,7 @@ static void themes_read(void) g_get_home_dir()); current_theme = theme_create(fname, "default"); current_theme->default_color = 15; + theme_read(current_theme, NULL, default_theme); g_free(fname); }