Disable localization of theme files.

SVN revision: 36682
This commit is contained in:
Kim Woelders 2008-10-15 15:20:20 +00:00
parent 70a6cc695c
commit b15a1fe53a
8 changed files with 39 additions and 66 deletions

View File

@ -259,7 +259,6 @@ typedef struct {
char animate; char animate;
} startup; } startup;
struct { struct {
char localise;
char use_alt_font_cfg; char use_alt_font_cfg;
char *name; char *name;
char *extra_path; 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); int ConfigParseline1(char *str, char *s2, char **p2, char **p3);
void ConfigParseError(const char *where, const char *line); void ConfigParseError(const char *where, const char *line);
void ConfigAlertLoad(const char *txt); void ConfigAlertLoad(const char *txt);
char *FindFile(const char *file, const char *themepath, char *FindFile(const char *file, const char *themepath);
int localized); char *ThemeFileFind(const char *file);
char *ThemeFileFind(const char *file, int localized);
char *ConfigFileFind(const char *name, const char *themepath, char *ConfigFileFind(const char *name, const char *themepath,
int pp); int pp);
int ConfigFileLoad(const char *name, const char *themepath, int ConfigFileLoad(const char *name, const char *themepath,

View File

@ -93,7 +93,7 @@ BackgroundGetUniqueString(const Background * bg)
{ {
char *f; char *f;
f = ThemeFileFind(bg->bg.file, 0); f = ThemeFileFind(bg->bg.file);
if (f) if (f)
{ {
f1 = fileinode(f); f1 = fileinode(f);
@ -106,7 +106,7 @@ BackgroundGetUniqueString(const Background * bg)
{ {
char *f; char *f;
f = ThemeFileFind(bg->top.file, 0); f = ThemeFileFind(bg->top.file);
if (f) if (f)
{ {
f4 = fileinode(f); f4 = fileinode(f);
@ -259,7 +259,7 @@ BackgroundDelete(Background * bg)
/* And delete the actual image files */ /* And delete the actual image files */
if (bg->bg.file) if (bg->bg.file)
{ {
f = ThemeFileFind(bg->bg.file, 0); f = ThemeFileFind(bg->bg.file);
if (f) if (f)
{ {
E_rm(f); E_rm(f);
@ -268,7 +268,7 @@ BackgroundDelete(Background * bg)
} }
if (bg->top.file) if (bg->top.file)
{ {
f = ThemeFileFind(bg->top.file, 0); f = ThemeFileFind(bg->top.file);
if (f) if (f)
{ {
E_rm(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.file && !bg->bg.im)
{ {
if (!bg->bg.real_file) 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) if (bg->bg.real_file)
bg->bg.im = EImageLoad(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.file && !bg->top.im)
{ {
if (!bg->top.real_file) 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) if (bg->top.real_file)
bg->top.im = EImageLoad(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 */ /* check first if we can actually find the files */
if (bg1) if (bg1)
{ {
tmp = ThemeFileFind(bg1, 0); tmp = ThemeFileFind(bg1);
if (!tmp) if (!tmp)
ok = 0; ok = 0;
else else
@ -1092,7 +1092,7 @@ BackgroundsConfigLoad(FILE * fs)
} }
if (bg2) if (bg2)
{ {
tmp = ThemeFileFind(bg2, 0); tmp = ThemeFileFind(bg2);
if (!tmp) if (!tmp)
ok = 0; ok = 0;
else else
@ -1248,10 +1248,10 @@ BackgroundsConfigSave(void)
fprintf(fs, "560 %d %d %d\n", r, g, b); fprintf(fs, "560 %d %d %d\n", r, g, b);
if ((bg->bg.file) && (!bg->bg.real_file)) 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)) 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)) if ((bg->bg.file) && (bg->bg.real_file))
{ {

View File

@ -400,55 +400,31 @@ ConfigFileRead(FILE * fs)
} }
static char * static char *
FindFileLocalized(const char *name, const char *path, int localized) FindFilePath(const char *name, const char *path)
{ {
char s[FILEPATH_LEN_MAX]; char s[FILEPATH_LEN_MAX];
const char *lang; int len;
char *p[4];
int i, len;
if (path) if (path)
len = Esnprintf(s, sizeof(s), "%s/%s", path, name); {
len = Esnprintf(s, sizeof(s), "%s/%s", path, name);
name = s;
}
else else
len = Esnprintf(s, sizeof(s), "%s", name); {
len = strlen(name);
}
if (len <= 0) if (len <= 0)
return NULL; return NULL;
lang = Mode.locale.lang; if (canread(name))
if (!localized || !lang) return Estrdup(name);
{ else
if (canread(s))
return Estrdup(s);
else
return NULL;
}
if (len + 1 + strlen(lang) >= sizeof(s))
return NULL; 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 * char *
FindFile(const char *file, const char *themepath, int localized) FindFile(const char *file, const char *themepath)
{ {
char s[FILEPATH_LEN_MAX]; char s[FILEPATH_LEN_MAX];
char *p; char *p;
@ -456,27 +432,27 @@ FindFile(const char *file, const char *themepath, int localized)
/* if absolute path - and file exists - return it */ /* if absolute path - and file exists - return it */
if (isabspath(file)) if (isabspath(file))
{ {
p = FindFileLocalized(file, NULL, localized); p = FindFilePath(file, NULL);
if (p) if (p)
return p; return p;
} }
/* look in ~/.e16 first */ /* look in ~/.e16 first */
p = FindFileLocalized(file, EDirUser(), localized); p = FindFilePath(file, EDirUser());
if (p) if (p)
return p; return p;
if (themepath) if (themepath)
{ {
/* look in theme dir */ /* look in theme dir */
p = FindFileLocalized(file, themepath, localized); p = FindFilePath(file, themepath);
if (p) if (p)
return p; return p;
} }
/* look in system config dir */ /* look in system config dir */
Esnprintf(s, sizeof(s), "%s/config", EDirRoot()); Esnprintf(s, sizeof(s), "%s/config", EDirRoot());
p = FindFileLocalized(file, s, localized); p = FindFilePath(file, s);
if (p) if (p)
return p; return p;
@ -485,9 +461,9 @@ FindFile(const char *file, const char *themepath, int localized)
} }
char * 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 * char *
@ -497,7 +473,7 @@ ConfigFileFind(const char *name, const char *themepath, int pp)
char *fullname, *file, *ppfile; char *fullname, *file, *ppfile;
int i, err; int i, err;
fullname = FindFile(name, themepath, Conf.theme.localise); fullname = FindFile(name, themepath);
if (!fullname) if (!fullname)
return NULL; return NULL;

View File

@ -108,7 +108,7 @@ ECursorCreate(const char *name, const char *image, int native_id,
if (image) if (image)
{ {
img = FindFile(image, Mode.theme.path, 0); img = FindFile(image, Mode.theme.path);
if (!img) if (!img)
return NULL; return NULL;

View File

@ -158,7 +158,7 @@ ThemeImageLoad(const char *file)
return im; return im;
} }
f = ThemeFileFind(file, 0); f = ThemeFileFind(file);
if (f) if (f)
{ {
im = EImageLoad(f); im = EImageLoad(f);
@ -253,7 +253,7 @@ ImagestateRealize(ImageState * is)
/* not loaded, load and setup */ /* not loaded, load and setup */
if (!is->real_file) if (!is->real_file)
is->real_file = ThemeFileFind(is->im_file, 0); is->real_file = ThemeFileFind(is->im_file);
if (is->real_file) if (is->real_file)
is->im = EImageLoad(is->real_file); is->im = EImageLoad(is->real_file);
if (!is->im) if (!is->im)

View File

@ -397,15 +397,15 @@ MenuCreateFromFlatFile(const char *name, Menu * parent, MenuStyle * ms,
if (isabspath(file)) if (isabspath(file))
{ {
ff = FindFile(file, NULL, 0); ff = FindFile(file, NULL);
} }
else else
{ {
/* Check menus subdir first */ /* Check menus subdir first */
Esnprintf(buf, sizeof(buf), "menus/%s", file); Esnprintf(buf, sizeof(buf), "menus/%s", file);
ff = FindFile(buf, NULL, 0); ff = FindFile(buf, NULL);
if (!ff) if (!ff)
ff = FindFile(file, NULL, 0); ff = FindFile(file, NULL);
} }
if (!ff) if (!ff)
goto done; goto done;

View File

@ -113,7 +113,7 @@ SclassApply(SoundClass * sclass)
{ {
char *file; char *file;
file = FindFile(sclass->file, Mode.theme.path, 0); file = FindFile(sclass->file, Mode.theme.path);
if (file) if (file)
{ {
sclass->sample = ops->SampleLoad(file); sclass->sample = ops->SampleLoad(file);

View File

@ -534,7 +534,6 @@ static const IpcItem ThemeIpcArray[] = {
#define N_IPC_FUNCS (sizeof(ThemeIpcArray)/sizeof(IpcItem)) #define N_IPC_FUNCS (sizeof(ThemeIpcArray)/sizeof(IpcItem))
static const CfgItem ThemeCfgItems[] = { static const CfgItem ThemeCfgItems[] = {
CFG_ITEM_BOOL(Conf.theme, localise, 0),
CFG_ITEM_STR(Conf.theme, name), CFG_ITEM_STR(Conf.theme, name),
CFG_ITEM_STR(Conf.theme, extra_path), CFG_ITEM_STR(Conf.theme, extra_path),
CFG_ITEM_STR(Conf.theme, ttfont_path), CFG_ITEM_STR(Conf.theme, ttfont_path),