static int theme_read(THEME_REC *theme, const char *path, const char *data) { CONFIG_REC *config; THEME_READ_REC rec; char *str; config = config_open(data == NULL ? path : NULL, -1) ; if (config == NULL) { /* didn't exist or no access? */ str = g_strdup_printf("Error reading theme file %s: %s", path, g_strerror(errno)); read_error(str); g_free(str); return FALSE; } if (data != NULL) config_parse_data(config, data, "internal"); else config_parse(config); if (config_last_error(config) != NULL) { str = g_strdup_printf("Ignored errors in theme %s:\n%s", theme->name, config_last_error(config)); read_error(str); g_free(str); } theme->default_color = config_get_int(config, NULL, "default_color", -1); theme->info_eol = config_get_bool(config, NULL, "info_eol", FALSE); /* FIXME: remove after 0.7.99 */ if (theme->default_color == 0 && config_get_int(config, NULL, "default_real_color", -1) != -1) theme->default_color = -1; theme_read_replaces(config, theme); if (data == NULL) { /* get the default abstracts from default theme. */ CONFIG_REC *default_config; default_config = config_open(NULL, -1); config_parse_data(default_config, default_theme, "internal"); theme_read_abstracts(default_config, theme); config_close(default_config); } theme_read_abstracts(config, theme); rec.theme = theme; rec.config = config; g_hash_table_foreach(default_formats, (GHFunc) theme_read_modules, &rec); config_close(config); return TRUE; }
static THEME_REC *read_internal_theme(void) { CONFIG_REC *config; THEME_REC *theme; theme = theme_create("internal", "_internal"); theme->refcount++; theme_destroy(theme); config = config_open(NULL, -1); config_parse_data(config, default_theme, "internal"); theme_read_abstracts(config, theme); config_close(config); return theme; }