mirror of
https://github.com/irssi/irssi.git
synced 2026-08-17 15:42:26 +02:00
Fixes for printing errors in themes
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1084 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
f8f6d7670a
commit
9745db6925
1 changed files with 21 additions and 5 deletions
|
|
@ -37,6 +37,7 @@ GSList *themes;
|
||||||
THEME_REC *current_theme;
|
THEME_REC *current_theme;
|
||||||
GHashTable *default_formats;
|
GHashTable *default_formats;
|
||||||
|
|
||||||
|
static int init_finished;
|
||||||
static char *init_errors;
|
static char *init_errors;
|
||||||
|
|
||||||
static void theme_read(THEME_REC *theme, const char *path, const char *data);
|
static void theme_read(THEME_REC *theme, const char *path, const char *data);
|
||||||
|
|
@ -535,7 +536,7 @@ static void theme_init_module(THEME_REC *theme, const char *module,
|
||||||
|
|
||||||
static void sig_print_errors(void)
|
static void sig_print_errors(void)
|
||||||
{
|
{
|
||||||
signal_remove("irssi init finished", (SIGNAL_FUNC) sig_print_errors);
|
init_finished = TRUE;
|
||||||
|
|
||||||
if (init_errors != NULL) {
|
if (init_errors != NULL) {
|
||||||
signal_emit("gui dialog", 2, "error", init_errors);
|
signal_emit("gui dialog", 2, "error", init_errors);
|
||||||
|
|
@ -675,10 +676,22 @@ static void theme_read(THEME_REC *theme, const char *path, const char *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config_last_error(config) != NULL) {
|
if (config_last_error(config) != NULL) {
|
||||||
signal_add("irssi init finished", (SIGNAL_FUNC) sig_print_errors);
|
char *str;
|
||||||
init_errors =
|
|
||||||
g_strdup_printf(_("Ignored errors in theme:\n%s"),
|
str = g_strdup_printf(_("Ignored errors in theme %s:\n%s"),
|
||||||
config_last_error(config));
|
theme->name, config_last_error(config));
|
||||||
|
if (!init_finished) {
|
||||||
|
if (init_errors == NULL)
|
||||||
|
init_errors = str;
|
||||||
|
else {
|
||||||
|
init_errors = g_strconcat(init_errors, "\n",
|
||||||
|
str, NULL);
|
||||||
|
g_free(str);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
signal_emit("gui dialog", 2, "error", str);
|
||||||
|
g_free(str);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
theme->default_color = config_get_int(config, NULL, "default_color", 15);
|
theme->default_color = config_get_int(config, NULL, "default_color", 15);
|
||||||
|
|
@ -1027,6 +1040,7 @@ void themes_init(void)
|
||||||
default_formats = g_hash_table_new((GHashFunc) g_str_hash,
|
default_formats = g_hash_table_new((GHashFunc) g_str_hash,
|
||||||
(GCompareFunc) g_str_equal);
|
(GCompareFunc) g_str_equal);
|
||||||
|
|
||||||
|
init_finished = FALSE;
|
||||||
init_errors = NULL;
|
init_errors = NULL;
|
||||||
|
|
||||||
themes = NULL;
|
themes = NULL;
|
||||||
|
|
@ -1035,6 +1049,7 @@ void themes_init(void)
|
||||||
command_bind("format", NULL, (SIGNAL_FUNC) cmd_format);
|
command_bind("format", NULL, (SIGNAL_FUNC) cmd_format);
|
||||||
command_bind("save", NULL, (SIGNAL_FUNC) cmd_save);
|
command_bind("save", NULL, (SIGNAL_FUNC) cmd_save);
|
||||||
signal_add("complete command format", (SIGNAL_FUNC) sig_complete_format);
|
signal_add("complete command format", (SIGNAL_FUNC) sig_complete_format);
|
||||||
|
signal_add("irssi init finished", (SIGNAL_FUNC) sig_print_errors);
|
||||||
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
|
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
|
||||||
signal_add("setup reread", (SIGNAL_FUNC) themes_read);
|
signal_add("setup reread", (SIGNAL_FUNC) themes_read);
|
||||||
|
|
||||||
|
|
@ -1052,6 +1067,7 @@ void themes_deinit(void)
|
||||||
command_unbind("format", (SIGNAL_FUNC) cmd_format);
|
command_unbind("format", (SIGNAL_FUNC) cmd_format);
|
||||||
command_unbind("save", (SIGNAL_FUNC) cmd_save);
|
command_unbind("save", (SIGNAL_FUNC) cmd_save);
|
||||||
signal_remove("complete command format", (SIGNAL_FUNC) sig_complete_format);
|
signal_remove("complete command format", (SIGNAL_FUNC) sig_complete_format);
|
||||||
|
signal_remove("irssi init finished", (SIGNAL_FUNC) sig_print_errors);
|
||||||
signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
|
signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
|
||||||
signal_remove("setup reread", (SIGNAL_FUNC) themes_read);
|
signal_remove("setup reread", (SIGNAL_FUNC) themes_read);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue