Enable selecting sound from other theme.

SVN revision: 36685
This commit is contained in:
Kim Woelders 2008-10-15 15:34:58 +00:00
parent 7f03196ff8
commit 34d36d4d31
4 changed files with 24 additions and 10 deletions

View File

@ -516,6 +516,7 @@ void StartupWindowsCreate(void);
void StartupWindowsOpen(void); void StartupWindowsOpen(void);
/* theme.c */ /* theme.c */
char *ThemeFind(const char *theme);
char *ThemePathName(const char *path); char *ThemePathName(const char *path);
void ThemePathFind(void); void ThemePathFind(void);
char **ThemesList(int *num); char **ThemesList(int *num);

View File

@ -223,14 +223,14 @@ ConfigAlertLoad(const char *txt)
} }
static int static int
ConfigFilePreparse(const char *path, const char *dest) ConfigFilePreparse(const char *src, const char *dst, const char *themepath)
{ {
char execline[FILEPATH_LEN_MAX]; char execline[FILEPATH_LEN_MAX];
const char *epp_path = ENLIGHTENMENT_BIN "/epp"; const char *epp_path = ENLIGHTENMENT_BIN "/epp";
char *def_home, *def_user, *def_shell; char *def_home, *def_user, *def_shell;
if (EDebug(EDBUG_TYPE_CONFIG)) if (EDebug(EDBUG_TYPE_CONFIG))
Eprintf("ConfigFilePreparse %s -> %s\n", path, dest); Eprintf("ConfigFilePreparse %s -> %s\n", src, dst);
def_home = homedir(getuid()); def_home = homedir(getuid());
def_user = username(getuid()); def_user = username(getuid());
@ -246,18 +246,18 @@ ConfigFilePreparse(const char *path, const char *dest)
"-D SCREEN_DEPTH_%i=1 " "-D USER_NAME=%s " "-D HOME_DIR=%s " "-D SCREEN_DEPTH_%i=1 " "-D USER_NAME=%s " "-D HOME_DIR=%s "
"-D USER_SHELL=%s " "-D ENLIGHTENMENT_VERSION_015=1 " "-D USER_SHELL=%s " "-D ENLIGHTENMENT_VERSION_015=1 "
"%s %s", "%s %s",
epp_path, EDirRoot(), Mode.theme.path, EDirRoot(), epp_path, EDirRoot(), themepath, EDirRoot(),
E_PKG_VERSION, EDirRoot(), EDirBin(), E_PKG_VERSION, EDirRoot(), EDirBin(),
Mode.theme.path, EDirUser(), EDirUserCache(), themepath, EDirUser(), EDirUserCache(),
WinGetW(VROOT), WinGetH(VROOT), WinGetW(VROOT), WinGetH(VROOT), WinGetW(VROOT), WinGetH(VROOT), WinGetW(VROOT), WinGetH(VROOT),
WinGetDepth(VROOT), def_user, def_home, def_shell, path, dest); WinGetDepth(VROOT), def_user, def_home, def_shell, src, dst);
system(execline); system(execline);
Efree(def_user); Efree(def_user);
Efree(def_shell); Efree(def_shell);
Efree(def_home); Efree(def_home);
return exists(dest) ? 0 : 1; return exists(dst) ? 0 : 1;
} }
/* Split the process of finding the file from the process of loading it */ /* Split the process of finding the file from the process of loading it */
@ -493,7 +493,7 @@ ConfigFileFind(const char *name, const char *themepath, int pp)
goto done; goto done;
/* No preparesd file or source is newer. Do preparsing. */ /* No preparesd file or source is newer. Do preparsing. */
err = ConfigFilePreparse(fullname, ppfile); err = ConfigFilePreparse(fullname, ppfile, themepath);
if (err) if (err)
{ {
Efree(ppfile); Efree(ppfile);

View File

@ -42,6 +42,12 @@ static struct {
char *theme; char *theme;
} Conf_sound; } Conf_sound;
static struct {
char *theme_path;
} Mode_sound;
#define SOUND_THEME_PATH ((Mode_sound.theme_path) ? Mode_sound.theme_path : Mode.theme.path)
static Ecore_List *sound_list = NULL; static Ecore_List *sound_list = NULL;
#if USE_MODULES #if USE_MODULES
@ -113,7 +119,7 @@ SclassApply(SoundClass * sclass)
{ {
char *file; char *file;
file = FindFile(sclass->file, Mode.theme.path); file = FindFile(sclass->file, SOUND_THEME_PATH);
if (file) if (file)
{ {
sclass->sample = ops->SampleLoad(file); sclass->sample = ops->SampleLoad(file);
@ -205,6 +211,12 @@ SoundInit(void)
"communicating with the audio server (Esound). Audio will\n" "communicating with the audio server (Esound). Audio will\n"
"now be disabled.\n")); "now be disabled.\n"));
} }
Efree(Mode_sound.theme_path);
if (Conf_sound.theme)
Mode_sound.theme_path = ThemeFind(Conf_sound.theme);
else
Mode_sound.theme_path = NULL;
} }
static void static void
@ -264,10 +276,11 @@ SoundSighan(int sig, void *prm __UNUSED__)
switch (sig) switch (sig)
{ {
case ESIGNAL_INIT: case ESIGNAL_INIT:
memset(&Mode_sound, 0, sizeof(Mode_sound));
SoundInit(); SoundInit();
break; break;
case ESIGNAL_CONFIGURE: case ESIGNAL_CONFIGURE:
ConfigFileLoad("sound.cfg", Mode.theme.path, SoundConfigLoad, 1); ConfigFileLoad("sound.cfg", SOUND_THEME_PATH, SoundConfigLoad, 1);
break; break;
case ESIGNAL_START: case ESIGNAL_START:
if (!Conf_sound.enable) if (!Conf_sound.enable)

View File

@ -260,7 +260,7 @@ ThemeExtract(const char *path)
return NULL; return NULL;
} }
static char * char *
ThemeFind(const char *theme) ThemeFind(const char *theme)
{ {
static const char *const default_themes[] = { static const char *const default_themes[] = {