diff options
author | Timo Sirainen <cras@irssi.org> | 2001-01-04 19:01:01 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-01-04 19:01:01 +0000 |
commit | 93c0086d411a4ddec854755584f838344a54dae5 (patch) | |
tree | 4c5e161cf4e5d67be199a71511a8383ebeecfe9a /src | |
parent | d431bea4395035632d280cfa9b7250bf29fe40bc (diff) | |
download | irssi-93c0086d411a4ddec854755584f838344a54dae5.zip |
Complain about errors in theme file
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1065 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r-- | src/fe-common/core/themes.c | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/src/fe-common/core/themes.c b/src/fe-common/core/themes.c index b3a79f14..79083574 100644 --- a/src/fe-common/core/themes.c +++ b/src/fe-common/core/themes.c @@ -37,6 +37,8 @@ GSList *themes; THEME_REC *current_theme; GHashTable *default_formats; +static char *init_errors; + static void theme_read(THEME_REC *theme, const char *path, const char *data); THEME_REC *theme_create(const char *path, const char *name) @@ -532,23 +534,24 @@ static void theme_init_module(THEME_REC *theme, const char *module, } } +static void sig_print_errors(void) +{ + signal_remove("irssi init finished", (SIGNAL_FUNC) sig_print_errors); + + if (init_errors != NULL) { + signal_emit("gui dialog", 2, "error", init_errors); + g_free(init_errors); + } +} + static void theme_read_module(THEME_REC *theme, const char *module) { CONFIG_REC *config; - char *msg; config = config_open(theme->path, -1); - if (config != NULL) { + if (config != NULL) config_parse(config); - if (config_last_error(mainconfig) != NULL) { - msg = g_strdup_printf(_("Ignored errors in theme:\n%s"), - config_last_error(mainconfig)); - signal_emit("gui dialog", 2, "error", msg); - g_free(msg); - } - } - theme_init_module(theme, module, config); if (config != NULL) config_close(config); @@ -671,6 +674,14 @@ static void theme_read(THEME_REC *theme, const char *path, const char *data) config = config_open(NULL, -1); config_parse_data(config, data, "internal"); } + + if (config_last_error(config) != NULL) { + signal_add("irssi init finished", (SIGNAL_FUNC) sig_print_errors); + init_errors = + g_strdup_printf(_("Ignored errors in theme:\n%s"), + config_last_error(config)); + } + theme->default_color = config_get_int(config, NULL, "default_color", 15); theme_read_replaces(config, theme); theme_read_abstracts(config, theme); @@ -1017,6 +1028,8 @@ void themes_init(void) default_formats = g_hash_table_new((GHashFunc) g_str_hash, (GCompareFunc) g_str_equal); + init_errors = NULL; + themes = NULL; themes_read(); @@ -1024,7 +1037,7 @@ void themes_init(void) command_bind("save", NULL, (SIGNAL_FUNC) cmd_save); signal_add("complete command format", (SIGNAL_FUNC) sig_complete_format); signal_add("setup changed", (SIGNAL_FUNC) read_settings); - signal_add("setup reread", (SIGNAL_FUNC) themes_read); + signal_add("setup reread", (SIGNAL_FUNC) themes_read); command_set_options("format", "delete reset"); } |