parent
70a6cc695c
commit
b15a1fe53a
6
src/E.h
6
src/E.h
|
@ -259,7 +259,6 @@ typedef struct {
|
|||
char animate;
|
||||
} startup;
|
||||
struct {
|
||||
char localise;
|
||||
char use_alt_font_cfg;
|
||||
char *name;
|
||||
char *extra_path;
|
||||
|
@ -441,9 +440,8 @@ char *GetLine(char *s, int size, FILE * f);
|
|||
int ConfigParseline1(char *str, char *s2, char **p2, char **p3);
|
||||
void ConfigParseError(const char *where, const char *line);
|
||||
void ConfigAlertLoad(const char *txt);
|
||||
char *FindFile(const char *file, const char *themepath,
|
||||
int localized);
|
||||
char *ThemeFileFind(const char *file, int localized);
|
||||
char *FindFile(const char *file, const char *themepath);
|
||||
char *ThemeFileFind(const char *file);
|
||||
char *ConfigFileFind(const char *name, const char *themepath,
|
||||
int pp);
|
||||
int ConfigFileLoad(const char *name, const char *themepath,
|
||||
|
|
|
@ -93,7 +93,7 @@ BackgroundGetUniqueString(const Background * bg)
|
|||
{
|
||||
char *f;
|
||||
|
||||
f = ThemeFileFind(bg->bg.file, 0);
|
||||
f = ThemeFileFind(bg->bg.file);
|
||||
if (f)
|
||||
{
|
||||
f1 = fileinode(f);
|
||||
|
@ -106,7 +106,7 @@ BackgroundGetUniqueString(const Background * bg)
|
|||
{
|
||||
char *f;
|
||||
|
||||
f = ThemeFileFind(bg->top.file, 0);
|
||||
f = ThemeFileFind(bg->top.file);
|
||||
if (f)
|
||||
{
|
||||
f4 = fileinode(f);
|
||||
|
@ -259,7 +259,7 @@ BackgroundDelete(Background * bg)
|
|||
/* And delete the actual image files */
|
||||
if (bg->bg.file)
|
||||
{
|
||||
f = ThemeFileFind(bg->bg.file, 0);
|
||||
f = ThemeFileFind(bg->bg.file);
|
||||
if (f)
|
||||
{
|
||||
E_rm(f);
|
||||
|
@ -268,7 +268,7 @@ BackgroundDelete(Background * bg)
|
|||
}
|
||||
if (bg->top.file)
|
||||
{
|
||||
f = ThemeFileFind(bg->top.file, 0);
|
||||
f = ThemeFileFind(bg->top.file);
|
||||
if (f)
|
||||
{
|
||||
E_rm(f);
|
||||
|
@ -548,7 +548,7 @@ BackgroundRealize(Background * bg, Win win, Drawable draw, unsigned int rw,
|
|||
if (bg->bg.file && !bg->bg.im)
|
||||
{
|
||||
if (!bg->bg.real_file)
|
||||
bg->bg.real_file = ThemeFileFind(bg->bg.file, 0);
|
||||
bg->bg.real_file = ThemeFileFind(bg->bg.file);
|
||||
if (bg->bg.real_file)
|
||||
bg->bg.im = EImageLoad(bg->bg.real_file);
|
||||
}
|
||||
|
@ -556,7 +556,7 @@ BackgroundRealize(Background * bg, Win win, Drawable draw, unsigned int rw,
|
|||
if (bg->top.file && !bg->top.im)
|
||||
{
|
||||
if (!bg->top.real_file)
|
||||
bg->top.real_file = ThemeFileFind(bg->top.file, 0);
|
||||
bg->top.real_file = ThemeFileFind(bg->top.file);
|
||||
if (bg->top.real_file)
|
||||
bg->top.im = EImageLoad(bg->top.real_file);
|
||||
}
|
||||
|
@ -1084,7 +1084,7 @@ BackgroundsConfigLoad(FILE * fs)
|
|||
/* check first if we can actually find the files */
|
||||
if (bg1)
|
||||
{
|
||||
tmp = ThemeFileFind(bg1, 0);
|
||||
tmp = ThemeFileFind(bg1);
|
||||
if (!tmp)
|
||||
ok = 0;
|
||||
else
|
||||
|
@ -1092,7 +1092,7 @@ BackgroundsConfigLoad(FILE * fs)
|
|||
}
|
||||
if (bg2)
|
||||
{
|
||||
tmp = ThemeFileFind(bg2, 0);
|
||||
tmp = ThemeFileFind(bg2);
|
||||
if (!tmp)
|
||||
ok = 0;
|
||||
else
|
||||
|
@ -1248,10 +1248,10 @@ BackgroundsConfigSave(void)
|
|||
fprintf(fs, "560 %d %d %d\n", r, g, b);
|
||||
|
||||
if ((bg->bg.file) && (!bg->bg.real_file))
|
||||
bg->bg.real_file = ThemeFileFind(bg->bg.file, 0);
|
||||
bg->bg.real_file = ThemeFileFind(bg->bg.file);
|
||||
|
||||
if ((bg->top.file) && (!bg->top.real_file))
|
||||
bg->top.real_file = ThemeFileFind(bg->top.file, 0);
|
||||
bg->top.real_file = ThemeFileFind(bg->top.file);
|
||||
|
||||
if ((bg->bg.file) && (bg->bg.real_file))
|
||||
{
|
||||
|
|
64
src/config.c
64
src/config.c
|
@ -400,55 +400,31 @@ ConfigFileRead(FILE * fs)
|
|||
}
|
||||
|
||||
static char *
|
||||
FindFileLocalized(const char *name, const char *path, int localized)
|
||||
FindFilePath(const char *name, const char *path)
|
||||
{
|
||||
char s[FILEPATH_LEN_MAX];
|
||||
const char *lang;
|
||||
char *p[4];
|
||||
int i, len;
|
||||
int len;
|
||||
|
||||
if (path)
|
||||
len = Esnprintf(s, sizeof(s), "%s/%s", path, name);
|
||||
{
|
||||
len = Esnprintf(s, sizeof(s), "%s/%s", path, name);
|
||||
name = s;
|
||||
}
|
||||
else
|
||||
len = Esnprintf(s, sizeof(s), "%s", name);
|
||||
{
|
||||
len = strlen(name);
|
||||
}
|
||||
if (len <= 0)
|
||||
return NULL;
|
||||
|
||||
lang = Mode.locale.lang;
|
||||
if (!localized || !lang)
|
||||
{
|
||||
if (canread(s))
|
||||
return Estrdup(s);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (len + 1 + strlen(lang) >= sizeof(s))
|
||||
if (canread(name))
|
||||
return Estrdup(name);
|
||||
else
|
||||
return NULL;
|
||||
|
||||
s[len] = '.';
|
||||
strcpy(s + len + 1, lang);
|
||||
|
||||
p[0] = s + len + 1 + strlen(lang); /* .da_DK.UTF-8 */
|
||||
p[1] = strchr(s + len + 1, '.'); /* .da_DK */
|
||||
p[2] = strchr(s + len + 1, '_'); /* .da */
|
||||
p[3] = s + len;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (p[i] == NULL)
|
||||
continue;
|
||||
|
||||
*p[i] = '\0';
|
||||
if (canread(s))
|
||||
return Estrdup(s);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
FindFile(const char *file, const char *themepath, int localized)
|
||||
FindFile(const char *file, const char *themepath)
|
||||
{
|
||||
char s[FILEPATH_LEN_MAX];
|
||||
char *p;
|
||||
|
@ -456,27 +432,27 @@ FindFile(const char *file, const char *themepath, int localized)
|
|||
/* if absolute path - and file exists - return it */
|
||||
if (isabspath(file))
|
||||
{
|
||||
p = FindFileLocalized(file, NULL, localized);
|
||||
p = FindFilePath(file, NULL);
|
||||
if (p)
|
||||
return p;
|
||||
}
|
||||
|
||||
/* look in ~/.e16 first */
|
||||
p = FindFileLocalized(file, EDirUser(), localized);
|
||||
p = FindFilePath(file, EDirUser());
|
||||
if (p)
|
||||
return p;
|
||||
|
||||
if (themepath)
|
||||
{
|
||||
/* look in theme dir */
|
||||
p = FindFileLocalized(file, themepath, localized);
|
||||
p = FindFilePath(file, themepath);
|
||||
if (p)
|
||||
return p;
|
||||
}
|
||||
|
||||
/* look in system config dir */
|
||||
Esnprintf(s, sizeof(s), "%s/config", EDirRoot());
|
||||
p = FindFileLocalized(file, s, localized);
|
||||
p = FindFilePath(file, s);
|
||||
if (p)
|
||||
return p;
|
||||
|
||||
|
@ -485,9 +461,9 @@ FindFile(const char *file, const char *themepath, int localized)
|
|||
}
|
||||
|
||||
char *
|
||||
ThemeFileFind(const char *file, int localized)
|
||||
ThemeFileFind(const char *file)
|
||||
{
|
||||
return FindFile(file, Mode.theme.path, localized);
|
||||
return FindFile(file, Mode.theme.path);
|
||||
}
|
||||
|
||||
char *
|
||||
|
@ -497,7 +473,7 @@ ConfigFileFind(const char *name, const char *themepath, int pp)
|
|||
char *fullname, *file, *ppfile;
|
||||
int i, err;
|
||||
|
||||
fullname = FindFile(name, themepath, Conf.theme.localise);
|
||||
fullname = FindFile(name, themepath);
|
||||
if (!fullname)
|
||||
return NULL;
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ ECursorCreate(const char *name, const char *image, int native_id,
|
|||
|
||||
if (image)
|
||||
{
|
||||
img = FindFile(image, Mode.theme.path, 0);
|
||||
img = FindFile(image, Mode.theme.path);
|
||||
if (!img)
|
||||
return NULL;
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ ThemeImageLoad(const char *file)
|
|||
return im;
|
||||
}
|
||||
|
||||
f = ThemeFileFind(file, 0);
|
||||
f = ThemeFileFind(file);
|
||||
if (f)
|
||||
{
|
||||
im = EImageLoad(f);
|
||||
|
@ -253,7 +253,7 @@ ImagestateRealize(ImageState * is)
|
|||
|
||||
/* not loaded, load and setup */
|
||||
if (!is->real_file)
|
||||
is->real_file = ThemeFileFind(is->im_file, 0);
|
||||
is->real_file = ThemeFileFind(is->im_file);
|
||||
if (is->real_file)
|
||||
is->im = EImageLoad(is->real_file);
|
||||
if (!is->im)
|
||||
|
|
|
@ -397,15 +397,15 @@ MenuCreateFromFlatFile(const char *name, Menu * parent, MenuStyle * ms,
|
|||
|
||||
if (isabspath(file))
|
||||
{
|
||||
ff = FindFile(file, NULL, 0);
|
||||
ff = FindFile(file, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Check menus subdir first */
|
||||
Esnprintf(buf, sizeof(buf), "menus/%s", file);
|
||||
ff = FindFile(buf, NULL, 0);
|
||||
ff = FindFile(buf, NULL);
|
||||
if (!ff)
|
||||
ff = FindFile(file, NULL, 0);
|
||||
ff = FindFile(file, NULL);
|
||||
}
|
||||
if (!ff)
|
||||
goto done;
|
||||
|
|
|
@ -113,7 +113,7 @@ SclassApply(SoundClass * sclass)
|
|||
{
|
||||
char *file;
|
||||
|
||||
file = FindFile(sclass->file, Mode.theme.path, 0);
|
||||
file = FindFile(sclass->file, Mode.theme.path);
|
||||
if (file)
|
||||
{
|
||||
sclass->sample = ops->SampleLoad(file);
|
||||
|
|
|
@ -534,7 +534,6 @@ static const IpcItem ThemeIpcArray[] = {
|
|||
#define N_IPC_FUNCS (sizeof(ThemeIpcArray)/sizeof(IpcItem))
|
||||
|
||||
static const CfgItem ThemeCfgItems[] = {
|
||||
CFG_ITEM_BOOL(Conf.theme, localise, 0),
|
||||
CFG_ITEM_STR(Conf.theme, name),
|
||||
CFG_ITEM_STR(Conf.theme, extra_path),
|
||||
CFG_ITEM_STR(Conf.theme, ttfont_path),
|
||||
|
|
Loading…
Reference in New Issue