1999-10-04 15:06:00 -07:00
|
|
|
/*
|
2007-01-13 11:14:29 -08:00
|
|
|
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
2009-01-18 03:17:25 -08:00
|
|
|
* Copyright (C) 2004-2009 Kim Woelders
|
2000-04-05 16:22:56 -07:00
|
|
|
*
|
1999-10-04 15:06:00 -07:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to
|
|
|
|
* deal in the Software without restriction, including without limitation the
|
|
|
|
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
|
|
* sell copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
2000-04-05 16:22:56 -07:00
|
|
|
*
|
1999-10-04 15:06:00 -07:00
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies of the Software, its documentation and marketing & publicity
|
|
|
|
* materials, and acknowledgment shall be given in the documentation, materials
|
|
|
|
* and software packages that this Software was used.
|
2000-04-05 16:22:56 -07:00
|
|
|
*
|
1999-10-04 15:06:00 -07:00
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
|
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
1999-08-17 15:56:46 -07:00
|
|
|
#include "E.h"
|
2005-07-16 09:57:45 -07:00
|
|
|
#include "emodule.h"
|
2006-07-24 14:10:59 -07:00
|
|
|
#include "file.h"
|
2008-10-15 08:23:24 -07:00
|
|
|
#include "util.h"
|
2006-04-19 12:13:46 -07:00
|
|
|
#include "session.h"
|
2004-02-11 07:27:54 -08:00
|
|
|
|
2008-10-15 08:23:24 -07:00
|
|
|
/* Update Mode.theme.paths (theme path list) */
|
|
|
|
static void
|
|
|
|
ThemePathsUpdate(void)
|
|
|
|
{
|
|
|
|
char paths[4096];
|
2004-02-11 07:27:54 -08:00
|
|
|
|
2008-10-15 08:23:24 -07:00
|
|
|
Esnprintf(paths, sizeof(paths), "%s/themes:%s/themes:%s", EDirUser(),
|
|
|
|
EDirRoot(), (Conf.theme.extra_path) ? Conf.theme.extra_path : "");
|
|
|
|
_EFDUP(Mode.theme.paths, paths);
|
|
|
|
}
|
2004-02-11 07:27:54 -08:00
|
|
|
|
2008-10-15 08:23:24 -07:00
|
|
|
/* Check if this is a theme dir */
|
|
|
|
static const char *
|
|
|
|
ThemeCheckPath(const char *path)
|
2004-02-11 07:27:54 -08:00
|
|
|
{
|
2008-10-15 08:23:24 -07:00
|
|
|
static const char *const theme_files[] = {
|
|
|
|
"init.cfg",
|
|
|
|
#if 0
|
|
|
|
"epplets/epplets.cfg",
|
|
|
|
#endif
|
|
|
|
NULL
|
|
|
|
};
|
2004-07-12 16:33:15 -07:00
|
|
|
const char *tf;
|
|
|
|
int i;
|
2004-02-11 07:27:54 -08:00
|
|
|
char s[4096];
|
|
|
|
|
2005-10-30 11:40:49 -08:00
|
|
|
for (i = 0; (tf = theme_files[i]) != NULL; i++)
|
2004-02-11 07:27:54 -08:00
|
|
|
{
|
2008-10-15 08:23:24 -07:00
|
|
|
Esnprintf(s, sizeof(s), "%s/%s", path, tf);
|
|
|
|
if (!isfile(s))
|
|
|
|
return NULL;
|
2004-02-11 07:27:54 -08:00
|
|
|
}
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2008-10-15 08:23:24 -07:00
|
|
|
return path;
|
2004-07-12 16:33:15 -07:00
|
|
|
}
|
2004-02-11 07:27:54 -08:00
|
|
|
|
2008-10-10 13:55:26 -07:00
|
|
|
char *
|
|
|
|
ThemePathName(const char *path)
|
|
|
|
{
|
|
|
|
const char *p;
|
|
|
|
char *s;
|
|
|
|
|
|
|
|
if (!path)
|
|
|
|
return NULL;
|
|
|
|
p = strrchr(path, '/');
|
|
|
|
if (!p)
|
|
|
|
return Estrdup(path); /* Name only */
|
|
|
|
if (strcmp(p + 1, "e16"))
|
|
|
|
return Estrdup(p + 1); /* Regular path */
|
|
|
|
|
|
|
|
/* <path>/<themename>/e16 */
|
|
|
|
s = strdup(path);
|
|
|
|
s[p - path] = '\0';
|
|
|
|
p = strrchr(s, '/');
|
|
|
|
if (!p)
|
|
|
|
return Estrdup(path); /* Should not happen */
|
|
|
|
p++;
|
|
|
|
memmove(s, p, strlen(p) + 1);
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2008-10-15 08:23:24 -07:00
|
|
|
static void
|
1999-08-17 15:56:46 -07:00
|
|
|
append_merge_dir(char *dir, char ***list, int *count)
|
|
|
|
{
|
2008-10-15 08:23:24 -07:00
|
|
|
char ss[FILEPATH_LEN_MAX], s1[FILEPATH_LEN_MAX];
|
|
|
|
char **str = NULL, *s;
|
|
|
|
int i, num;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2004-03-20 07:49:05 -08:00
|
|
|
str = E_ls(dir, &num);
|
2004-07-12 16:33:15 -07:00
|
|
|
if (!str)
|
2008-10-15 08:23:24 -07:00
|
|
|
return;
|
2004-07-12 16:33:15 -07:00
|
|
|
|
|
|
|
for (i = 0; i < num; i++)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2008-10-15 08:23:24 -07:00
|
|
|
if (!strcmp(str[i], "DEFAULT"))
|
2004-07-12 16:33:15 -07:00
|
|
|
continue;
|
|
|
|
|
|
|
|
Esnprintf(ss, sizeof(ss), "%s/%s", dir, str[i]);
|
|
|
|
|
2008-10-15 08:23:24 -07:00
|
|
|
if (isdir(ss))
|
2004-07-12 16:33:15 -07:00
|
|
|
{
|
2008-10-15 08:23:24 -07:00
|
|
|
if (ThemeCheckPath(ss))
|
|
|
|
goto got_one;
|
|
|
|
Esnprintf(ss, sizeof(ss), "%s/%s/e16", dir, str[i]);
|
|
|
|
if (ThemeCheckPath(ss))
|
|
|
|
goto got_one;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else if (isfile(ss))
|
|
|
|
{
|
|
|
|
s = strstr(str[i], ".etheme");
|
|
|
|
if (!s)
|
|
|
|
continue;
|
|
|
|
Esnprintf(s1, sizeof(s1), "%s/themes/%s", EDirUser(), str[i]);
|
|
|
|
s = strstr(s1, ".etheme");
|
|
|
|
if (!s)
|
|
|
|
continue;
|
|
|
|
*s = '\0';
|
|
|
|
if (isdir(s1))
|
|
|
|
continue;
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2004-07-12 16:33:15 -07:00
|
|
|
else
|
|
|
|
{
|
2008-10-15 08:23:24 -07:00
|
|
|
continue;
|
2004-07-12 16:33:15 -07:00
|
|
|
}
|
2008-10-15 08:23:24 -07:00
|
|
|
|
|
|
|
got_one:
|
|
|
|
(*count)++;
|
|
|
|
*list = EREALLOC(char *, *list, *count);
|
|
|
|
|
|
|
|
(*list)[(*count) - 1] = Estrdup(ss);
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2005-07-16 08:53:53 -07:00
|
|
|
StrlistFree(str, num);
|
1999-08-17 15:56:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
char **
|
2004-12-28 15:46:49 -08:00
|
|
|
ThemesList(int *number)
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
2008-10-15 08:23:24 -07:00
|
|
|
char **lst, **list;
|
|
|
|
int i, num, count;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2008-10-15 08:23:24 -07:00
|
|
|
ThemePathsUpdate();
|
|
|
|
lst = StrlistFromString(Mode.theme.paths, ':', &num);
|
2003-07-07 19:32:40 -07:00
|
|
|
|
2005-02-24 14:07:39 -08:00
|
|
|
count = 0;
|
2005-02-27 10:57:49 -08:00
|
|
|
list = NULL;
|
2008-10-15 08:23:24 -07:00
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
append_merge_dir(lst[i], &list, &count);
|
2005-02-24 14:07:39 -08:00
|
|
|
|
2008-10-15 08:23:24 -07:00
|
|
|
StrlistFree(lst, num);
|
2004-05-07 15:29:30 -07:00
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
*number = count;
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
2008-10-15 08:23:24 -07:00
|
|
|
static const char *
|
|
|
|
ThemeGetPath(const char *path, char *buf, unsigned int len)
|
2004-05-07 15:29:30 -07:00
|
|
|
{
|
2004-05-11 17:06:26 -07:00
|
|
|
const char *s;
|
2008-10-15 08:23:24 -07:00
|
|
|
char s1[FILEPATH_LEN_MAX];
|
|
|
|
int l;
|
2004-05-07 15:29:30 -07:00
|
|
|
|
2004-05-11 17:06:26 -07:00
|
|
|
/* We only attempt to dereference a DEFAULT link */
|
|
|
|
s = strstr(path, "/DEFAULT");
|
|
|
|
if (s == NULL)
|
2008-10-15 08:23:24 -07:00
|
|
|
return path;
|
2004-05-07 15:29:30 -07:00
|
|
|
|
2008-10-15 08:23:24 -07:00
|
|
|
l = readlink(path, s1, sizeof(s1) - 1);
|
|
|
|
if (l < 0)
|
|
|
|
return path;
|
|
|
|
s1[l] = '\0';
|
2004-05-07 15:29:30 -07:00
|
|
|
|
2004-05-11 17:06:26 -07:00
|
|
|
if (isabspath(s1))
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2008-10-15 08:23:24 -07:00
|
|
|
Esnprintf(buf, len, "%s", s1);
|
|
|
|
return buf;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2004-02-18 14:18:41 -08:00
|
|
|
|
2008-10-15 08:23:24 -07:00
|
|
|
Esnprintf(buf, len, "%s", path); /* Copy path */
|
|
|
|
l = s + 1 - path;
|
|
|
|
Esnprintf(buf + l, len - l, "%s", s1); /* Substitute link */
|
2004-02-18 14:18:41 -08:00
|
|
|
|
2008-10-15 08:23:24 -07:00
|
|
|
return buf;
|
1999-08-17 15:56:46 -07:00
|
|
|
}
|
|
|
|
|
2004-02-11 07:27:54 -08:00
|
|
|
static char *
|
2008-10-15 08:23:24 -07:00
|
|
|
ThemeExtract(const char *path)
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
|
|
|
char s[FILEPATH_LEN_MAX];
|
|
|
|
char th[FILEPATH_LEN_MAX];
|
|
|
|
FILE *f;
|
|
|
|
unsigned char buf[320];
|
2004-02-11 07:27:54 -08:00
|
|
|
char *name;
|
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
/* its a directory - just use it "as is" */
|
2008-10-15 08:23:24 -07:00
|
|
|
if (isdir(path))
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2008-10-15 08:23:24 -07:00
|
|
|
path = ThemeGetPath(path, s, sizeof(s));
|
2004-03-20 07:49:05 -08:00
|
|
|
goto done;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2004-02-11 07:27:54 -08:00
|
|
|
|
2008-10-15 08:23:24 -07:00
|
|
|
if (!isfile(path))
|
|
|
|
return NULL;
|
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
/* its a file - check its type */
|
2008-10-15 08:23:24 -07:00
|
|
|
f = fopen(path, "r");
|
|
|
|
if (!f)
|
|
|
|
return NULL;
|
|
|
|
fread(buf, 1, 320, f);
|
|
|
|
fclose(f);
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2008-10-15 08:23:24 -07:00
|
|
|
name = fileof(path);
|
|
|
|
Esnprintf(th, sizeof(th), "%s/themes/%s", EDirUser(), name);
|
|
|
|
Efree(name);
|
2004-02-11 07:27:54 -08:00
|
|
|
|
2008-10-15 08:23:24 -07:00
|
|
|
/* check magic numbers */
|
|
|
|
if ((buf[0] == 31) && (buf[1] == 139))
|
|
|
|
{
|
|
|
|
/* gzipped tarball */
|
|
|
|
Esnprintf(s, sizeof(s),
|
|
|
|
"gzip -d -c < %s | (cd %s ; tar -xf -)", path, th);
|
|
|
|
}
|
|
|
|
else if ((buf[257] == 'u') && (buf[258] == 's') &&
|
|
|
|
(buf[259] == 't') && (buf[260] == 'a') && (buf[261] == 'r'))
|
|
|
|
{
|
|
|
|
/* vanilla tarball */
|
|
|
|
Esnprintf(s, sizeof(s), "(cd %s ; tar -xf %s)", th, path);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return NULL;
|
2004-02-11 07:27:54 -08:00
|
|
|
|
2008-10-15 08:23:24 -07:00
|
|
|
E_md(th);
|
|
|
|
path = th;
|
2004-02-11 07:27:54 -08:00
|
|
|
|
2008-10-15 08:23:24 -07:00
|
|
|
/* exec the untar if tarred */
|
|
|
|
system(s);
|
2004-02-11 07:27:54 -08:00
|
|
|
|
2004-03-20 07:49:05 -08:00
|
|
|
done:
|
2008-10-15 08:23:24 -07:00
|
|
|
if (ThemeCheckPath(path))
|
|
|
|
return Estrdup(path);
|
2004-02-11 07:27:54 -08:00
|
|
|
|
|
|
|
/* failed */
|
2005-01-25 13:58:28 -08:00
|
|
|
return NULL;
|
1999-08-17 15:56:46 -07:00
|
|
|
}
|
|
|
|
|
2008-10-15 08:34:58 -07:00
|
|
|
char *
|
2004-05-07 15:29:30 -07:00
|
|
|
ThemeFind(const char *theme)
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
2008-10-15 08:23:24 -07:00
|
|
|
static const char *const default_themes[] = {
|
|
|
|
"DEFAULT", "winter", "BrushedMetal-Tigert", "ShinyMetal", NULL
|
|
|
|
};
|
|
|
|
char tdir[4096], *path;
|
|
|
|
char **lst;
|
|
|
|
int i, j, num;
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2008-10-15 08:23:24 -07:00
|
|
|
ThemePathsUpdate();
|
|
|
|
|
|
|
|
path = NULL;
|
2004-02-11 07:27:54 -08:00
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
if (!theme || !theme[0])
|
2008-10-15 08:23:24 -07:00
|
|
|
{
|
|
|
|
theme = NULL;
|
|
|
|
}
|
2009-01-18 03:17:25 -08:00
|
|
|
else if (!strcmp(theme, "-")) /* Use fallbacks */
|
2008-10-15 08:23:24 -07:00
|
|
|
{
|
2009-01-18 03:17:25 -08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
else if (isabspath(theme))
|
|
|
|
{
|
|
|
|
path = ThemeExtract(theme);
|
|
|
|
if (path)
|
|
|
|
return path;
|
|
|
|
theme = NULL;
|
2008-10-15 08:23:24 -07:00
|
|
|
}
|
2005-02-27 10:57:49 -08:00
|
|
|
|
2008-10-15 08:23:24 -07:00
|
|
|
lst = StrlistFromString(Mode.theme.paths, ':', &num);
|
2005-02-27 10:57:49 -08:00
|
|
|
|
2008-10-15 08:23:24 -07:00
|
|
|
i = 0;
|
|
|
|
do
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2008-10-15 08:23:24 -07:00
|
|
|
if (!theme)
|
|
|
|
goto next;
|
|
|
|
for (j = 0; j < num; j++)
|
|
|
|
{
|
|
|
|
Esnprintf(tdir, sizeof(tdir), "%s/%s", lst[j], theme);
|
|
|
|
path = ThemeExtract(tdir);
|
|
|
|
if (path)
|
|
|
|
goto done;
|
2005-02-27 10:57:49 -08:00
|
|
|
|
2008-10-15 08:23:24 -07:00
|
|
|
Esnprintf(tdir, sizeof(tdir), "%s/%s/e16", lst[j], theme);
|
|
|
|
path = ThemeExtract(tdir);
|
|
|
|
if (path)
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
next:
|
|
|
|
theme = default_themes[i++];
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2008-10-15 08:23:24 -07:00
|
|
|
while (theme);
|
2005-02-27 10:57:49 -08:00
|
|
|
|
2008-10-15 08:23:24 -07:00
|
|
|
done:
|
|
|
|
StrlistFree(lst, num);
|
2005-02-27 10:57:49 -08:00
|
|
|
|
2008-10-15 08:23:24 -07:00
|
|
|
if (path)
|
|
|
|
return path;
|
1999-10-03 09:24:00 -07:00
|
|
|
|
2008-10-15 08:23:24 -07:00
|
|
|
/* No theme found yet, just find any theme */
|
|
|
|
lst = ThemesList(&num);
|
|
|
|
if (!lst)
|
|
|
|
return NULL;
|
|
|
|
path = Estrdup(lst[0]);
|
|
|
|
StrlistFree(lst, num);
|
1999-10-03 09:24:00 -07:00
|
|
|
|
2008-10-15 08:23:24 -07:00
|
|
|
return path;
|
1999-10-03 09:24:00 -07:00
|
|
|
}
|
2004-12-28 15:46:49 -08:00
|
|
|
|
|
|
|
void
|
|
|
|
ThemePathFind(void)
|
|
|
|
{
|
2009-01-18 03:17:25 -08:00
|
|
|
char *name, *path;
|
2004-12-28 15:46:49 -08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Conf.theme.name is read from the configuration.
|
|
|
|
* Mode.theme.path may be assigned on the command line.
|
|
|
|
*/
|
2009-01-18 03:17:25 -08:00
|
|
|
name = (Mode.theme.path) ? Mode.theme.path : Conf.theme.name;
|
|
|
|
path = ThemeFind(name);
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2009-01-18 03:17:25 -08:00
|
|
|
if (!path && (!name || strcmp(name, "-")))
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
2008-10-15 08:23:24 -07:00
|
|
|
Alert(_("No themes were found in the default directories:\n"
|
|
|
|
" %s\n"
|
2004-12-28 15:46:49 -08:00
|
|
|
"Proceeding from here is mostly pointless.\n"),
|
2008-10-15 08:23:24 -07:00
|
|
|
Mode.theme.paths);
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
|
2008-02-23 04:09:38 -08:00
|
|
|
Efree(Conf.theme.name);
|
2009-01-18 03:17:25 -08:00
|
|
|
Conf.theme.name = ThemePathName(path);
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2008-02-23 04:09:38 -08:00
|
|
|
Efree(Mode.theme.path);
|
2009-01-18 03:17:25 -08:00
|
|
|
Mode.theme.path = (path) ? path : Estrdup("-");
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
|
2009-01-18 03:17:25 -08:00
|
|
|
/*
|
|
|
|
* Theme module
|
|
|
|
*/
|
2004-12-28 15:46:49 -08:00
|
|
|
|
|
|
|
static void
|
2007-05-18 01:25:06 -07:00
|
|
|
ThemesIpc(const char *params)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
|
|
|
const char *p;
|
|
|
|
char cmd[128], prm[128];
|
|
|
|
int len;
|
|
|
|
|
|
|
|
cmd[0] = prm[0] = '\0';
|
|
|
|
p = params;
|
|
|
|
if (p)
|
|
|
|
{
|
|
|
|
len = 0;
|
|
|
|
sscanf(p, "%100s %100s %n", cmd, prm, &len);
|
|
|
|
p += len;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!p || cmd[0] == '?')
|
|
|
|
{
|
2008-10-15 08:23:24 -07:00
|
|
|
char *path;
|
|
|
|
|
2009-01-18 03:17:25 -08:00
|
|
|
IpcPrintf("Name: %s\n", (Conf.theme.name) ? Conf.theme.name : "-");
|
2005-02-24 14:07:39 -08:00
|
|
|
IpcPrintf("Full: %s\n", Mode.theme.path);
|
2008-10-15 08:23:24 -07:00
|
|
|
path = ThemeFind(NULL);
|
|
|
|
IpcPrintf("Default: %s\n", path);
|
|
|
|
Efree(path);
|
|
|
|
IpcPrintf("Path: %s\n", Mode.theme.paths);
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
else if (!strncmp(cmd, "list", 2))
|
|
|
|
{
|
|
|
|
char **lst;
|
|
|
|
int i, num;
|
|
|
|
|
|
|
|
lst = ThemesList(&num);
|
2005-10-30 11:40:49 -08:00
|
|
|
if (!lst)
|
|
|
|
return;
|
2004-12-28 15:46:49 -08:00
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
IpcPrintf("%s\n", lst[i]);
|
2005-10-30 11:40:49 -08:00
|
|
|
StrlistFree(lst, num);
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
else if (!strcmp(cmd, "use"))
|
|
|
|
{
|
|
|
|
/* FIXME - ThemeCheckIfValid(s) */
|
2005-01-28 23:11:59 -08:00
|
|
|
SessionExit(EEXIT_THEME, prm);
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-10-30 11:40:49 -08:00
|
|
|
static const IpcItem ThemeIpcArray[] = {
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
|
|
|
ThemesIpc,
|
2005-09-24 17:50:53 -07:00
|
|
|
"theme", "th",
|
2004-12-28 15:46:49 -08:00
|
|
|
"Theme commands",
|
|
|
|
" theme Show current theme\n"
|
|
|
|
" theme list Show all themes\n"
|
|
|
|
" theme use <name> Switch to theme <name>\n"}
|
|
|
|
,
|
|
|
|
};
|
|
|
|
#define N_IPC_FUNCS (sizeof(ThemeIpcArray)/sizeof(IpcItem))
|
|
|
|
|
|
|
|
static const CfgItem ThemeCfgItems[] = {
|
|
|
|
CFG_ITEM_STR(Conf.theme, name),
|
2005-02-24 14:07:39 -08:00
|
|
|
CFG_ITEM_STR(Conf.theme, extra_path),
|
2009-03-29 07:56:45 -07:00
|
|
|
CFG_ITEM_BOOL(Conf.theme, use_theme_font_cfg, 0),
|
|
|
|
CFG_ITEM_BOOL(Conf.theme, use_alt_font_cfg, 0),
|
2007-08-07 08:05:08 -07:00
|
|
|
CFG_ITEM_STR(Conf.theme, font_cfg),
|
2004-12-28 15:46:49 -08:00
|
|
|
};
|
|
|
|
#define N_CFG_ITEMS (sizeof(ThemeCfgItems)/sizeof(CfgItem))
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Module descriptor
|
|
|
|
*/
|
2007-01-16 17:10:44 -08:00
|
|
|
extern const EModule ModTheme;
|
2006-04-21 15:52:59 -07:00
|
|
|
const EModule ModTheme = {
|
2004-12-28 15:46:49 -08:00
|
|
|
"theme", "th",
|
2009-01-18 03:17:25 -08:00
|
|
|
NULL,
|
2004-12-28 15:46:49 -08:00
|
|
|
{N_IPC_FUNCS, ThemeIpcArray},
|
|
|
|
{N_CFG_ITEMS, ThemeCfgItems}
|
|
|
|
};
|