From: Enlightenment S. <no-...@en...> - 2009-11-01 14:41:32
|
Log: Enable using theme variants. Author: kwo Date: 2009-11-01 06:41:21 -0800 (Sun, 01 Nov 2009) New Revision: 43392 Modified: trunk/E16/e/src/E.h trunk/E16/e/src/config.c trunk/E16/e/src/theme.c Modified: trunk/E16/e/src/E.h =================================================================== --- trunk/E16/e/src/E.h 2009-11-01 14:41:18 UTC (rev 43391) +++ trunk/E16/e/src/E.h 2009-11-01 14:41:21 UTC (rev 43392) @@ -388,6 +388,7 @@ struct { char *paths; char *path; + char *variant; } theme; struct { char *exec_name; /* argv[0] */ Modified: trunk/E16/e/src/config.c =================================================================== --- trunk/E16/e/src/config.c 2009-11-01 14:41:18 UTC (rev 43391) +++ trunk/E16/e/src/config.c 2009-11-01 14:41:21 UTC (rev 43392) @@ -231,6 +231,7 @@ char execline[FILEPATH_LEN_MAX]; const char *epp_path = ENLIGHTENMENT_BIN "/epp"; char *def_home, *def_user, *def_shell; + const char *variant; if (EDebug(EDBUG_TYPE_CONFIG)) Eprintf("ConfigFilePreparse %s -> %s\n", src, dst); @@ -243,20 +244,22 @@ * with old behavior */ if (!themepath) themepath = Mode.theme.path; + variant = (Mode.theme.variant) ? Mode.theme.variant : ""; Esnprintf(execline, sizeof(execline), "%s " "-P " "-nostdinc " "-undef " "-include %s/config/definitions " "-I%s " "-I%s/config " "-D ENLIGHTENMENT_VERSION=%s " "-D ENLIGHTENMENT_ROOT=%s " "-D ENLIGHTENMENT_BIN=%s " - "-D ENLIGHTENMENT_THEME=%s " "-D ECONFDIR=%s " - "-D ECACHEDIR=%s " "-D SCREEN_RESOLUTION_%ix%i=1 " + "-D ENLIGHTENMENT_THEME=%s " "-D VARIANT=%s " + "-D ECONFDIR=%s " "-D ECACHEDIR=%s " + "-D SCREEN_RESOLUTION_%ix%i=1 " "-D SCREEN_WIDTH_%i=1 " "-D SCREEN_HEIGHT_%i=1 " "-D SCREEN_DEPTH_%i=1 " "-D USER_NAME=%s " "-D HOME_DIR=%s " "-D USER_SHELL=%s " "%s %s", epp_path, EDirRoot(), themepath, EDirRoot(), - e_wm_version, EDirRoot(), EDirBin(), - themepath, EDirUser(), EDirUserCache(), + e_wm_version, EDirRoot(), EDirBin(), themepath, variant, + EDirUser(), EDirUserCache(), WinGetW(VROOT), WinGetH(VROOT), WinGetW(VROOT), WinGetH(VROOT), WinGetDepth(VROOT), def_user, def_home, def_shell, src, dst); Esystem(execline); @@ -499,7 +502,10 @@ if (file[i] == '/') file[i] = '.'; + if (Mode.theme.variant) + file = Estrdupcat2(file, "_", Mode.theme.variant); Esnprintf(s, sizeof(s), "%s/cached/cfg/%s.preparsed", EDirUserCache(), file); + ppfile = Estrdup(s); if (exists(s) && moddate(s) > moddate(fullname)) goto done; Modified: trunk/E16/e/src/theme.c =================================================================== --- trunk/E16/e/src/theme.c 2009-11-01 14:41:18 UTC (rev 43391) +++ trunk/E16/e/src/theme.c 2009-11-01 14:41:21 UTC (rev 43392) @@ -327,13 +327,19 @@ void ThemePathFind(void) { - char *name, *path; + char *name, *path, *s; /* * Conf.theme.name is read from the configuration. * Mode.theme.path may be assigned on the command line. */ name = (Mode.theme.path) ? Mode.theme.path : Conf.theme.name; + if ((s = strchr(name, '.'))) + { + *s = 0; + Efree(Mode.theme.variant); + Mode.theme.variant = Estrdup(s + 1); + } path = ThemeFind(name); if (!path && (!name || strcmp(name, "-"))) |