1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

internal default.theme is used if it isn't found anywhere

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@910 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-12-02 02:01:51 +00:00 committed by cras
parent f2a8cab907
commit 6ef409c4d0
3 changed files with 22 additions and 13 deletions

View File

@ -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

View File

@ -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 ";"

View File

@ -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);
}