Enlightenment CVS committal
Author : kwo
Project : e16
Module : e
Dir : e16/e/src
Modified Files:
E.h Makefile.am config.c misc.c theme.c
Log Message:
No longer use the DEFAULT theme link.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.262
retrieving revision 1.263
diff -u -3 -r1.262 -r1.263
--- E.h 7 May 2004 15:18:04 -0000 1.262
+++ E.h 7 May 2004 22:29:30 -0000 1.263
@@ -2623,8 +2623,8 @@
void ThemeSetDefault(const char *theme);
void ThemeCleanup(void);
void ThemeBadDialog(void);
+char *ThemeFind(const char *theme);
char **ListThemes(int *number);
-char *FindTheme(const char *theme);
/* timers.c */
double GetTime(void);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/Makefile.am,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -3 -r1.38 -r1.39
--- Makefile.am 4 May 2004 19:04:20 -0000 1.38
+++ Makefile.am 7 May 2004 22:29:30 -0000 1.39
@@ -107,11 +107,7 @@
DEFS=-DENLIGHTENMENT_ROOT=\"@[EMAIL PROTECTED]" -DENLIGHTENMENT_BIN=\"@[EMAIL
PROTECTED]" -DLOCALEDIR=\"@[EMAIL PROTECTED]"
install-data-local:
- $(top_srcdir)/mkinstalldirs $(DESTDIR)$(ENLIGHTENMENT_ROOT)/themes; \
- rm -f $(DESTDIR)$(ENLIGHTENMENT_ROOT)/themes/DEFAULT; \
- $(LN_S) \
- BrushedMetal-Tigert \
- $(DESTDIR)$(ENLIGHTENMENT_ROOT)/themes/DEFAULT;
+ $(top_srcdir)/mkinstalldirs $(DESTDIR)$(ENLIGHTENMENT_ROOT)/themes
uninstall-local:
for i in $(bin_PROGRAMS); do \
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/config.c,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -3 -r1.102 -r1.103
--- config.c 4 May 2004 19:04:24 -0000 1.102
+++ config.c 7 May 2004 22:29:30 -0000 1.103
@@ -3702,32 +3702,15 @@
"filesystem permissions.\n"), ss);
}
- theme = FindTheme(themelocation);
+ theme = ThemeFind(themelocation);
if (!theme)
{
- Alert(_("Enlightenment has just experienced some major problems in\n"
- "attempting to load the theme you specified or the default\n"
- "configuration directory:\n" "%s/config/\n"
- "This will prevent Enlightenment from loading any "
- "configuration\n" "files at all.\n"
- "Since this couldn't be found Enlightenment is probably not\n"
- "going to find any configuration files anywhere on your\n"
- "system, and so it will have almost no configuration loaded\n"
- "when it starts up. This is most likely the sign of a bad\n"
- "installation of Enlightenment if this directory is missing.\n"
- "The likely causes are that the package was improperly built,\n"
- "if a binary package, or 'make install' hasn't been typed\n"
- "or during the installation the directory above was not\n"
- "able to be copied over for installation perhaps due to\n"
- "permissions or lack of disk space. It also could be that the\n"
- "config directory has been inadvertently deleted since\n"
- "installation.\n"
- "This is a serious problem and should be rectified immediately\n"
- "Please contact your system administrator or package "
- "maintainer.\n"
- "If you are the administrator of your own system please\n"
- "consult the documentation that came with Enlightenment for\n"
- "additional information.\n"), EDirRoot());
+ Alert(_("No themes were found in the default theme directory:\n"
+ " %s/themes/\n"
+ "or in the user theme directory:\n"
+ " %s/themes/\n"
+ "Proceeding from here is mostly pointless.\n"),
+ EDirRoot(), EDirUser());
EDBUG_RETURN(0);
}
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/misc.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -3 -r1.55 -r1.56
--- misc.c 4 May 2004 19:04:33 -0000 1.55
+++ misc.c 7 May 2004 22:29:30 -0000 1.56
@@ -27,10 +27,8 @@
static char *cacheDir = NULL;
static const char *const bins[] = { "eesh", "epp" };
-static const char *const thms[] = { "themes/DEFAULT/epplets/epplets.cfg" };
#define N_BINS (sizeof(bins)/sizeof(char*))
-#define N_THMS (sizeof(thms)/sizeof(char*))
void
BlumFlimFrub(void)
@@ -65,23 +63,6 @@
EExit(NULL);
}
}
-
- for (i = 0; i < N_THMS; i++)
- {
- Esnprintf(s, sizeof(s), "%s/%s", EDirRoot(), thms[i]);
- if (!exists(s))
- {
- Alert(_("!!!!!!!! ERROR ERROR ERROR ERROR !!!!!!!!\n" "\n"
- "Enlightenment's DEFAULT installed theme is missing or
inadequately\n"
- "configured to be a useful DEFAULT theme.\n" "\n"
- "This is a fatal error and Enlightenment will cease to run.\n"
- "Please rectify this situation and ensure it is installed\n"
- "correctly. The DEFAULT theme Enlightenment comes with normally\n"
- "is BrushedMetal-Tigert and this theme is adequate for a
DEFAULT\n"
- "theme.\n"));
- EExit(NULL);
- }
- }
}
const char *
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/theme.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -3 -r1.34 -r1.35
--- theme.c 20 Mar 2004 15:49:05 -0000 1.34
+++ theme.c 7 May 2004 22:29:30 -0000 1.35
@@ -206,70 +206,89 @@
char **
ListThemes(int *number)
{
- char s[FILEPATH_LEN_MAX], **list = NULL, *def = NULL, *def2 =
- NULL;
+ char s[FILEPATH_LEN_MAX], **list = NULL;
+ char *def = NULL, *def2 = NULL;
int count = 0;
Esnprintf(s, sizeof(s), "%s/themes", EDirUser());
def = append_merge_dir(s, &list, &count);
- Esnprintf(s, sizeof(s), "%s/themes", EDirRoot());
- def2 = append_merge_dir(s, &list, &count);
-
- if ((def) && (def2))
- {
- Efree(def2);
- def2 = NULL;
- }
- else if ((!def) && (def2))
- def = def2;
- else if ((!def) && (!def2))
- fprintf(stderr, "errrrrrrrr no default theme?\n");
-
if (def)
Efree(def);
+ Esnprintf(s, sizeof(s), "%s/themes", EDirRoot());
+ def2 = append_merge_dir(s, &list, &count);
+ if (def2)
+ Efree(def2);
+
*number = count;
return list;
}
+static char *
+ThemeGetPath(const char *path)
+{
+ char s1[FILEPATH_LEN_MAX], s2[FILEPATH_LEN_MAX];
+ int len;
+
+ Esnprintf(s1, sizeof(s1), "%s/epplets/epplets.cfg", path);
+ if (!exists(s1))
+ return NULL;
+
+ /* If link, dereference */
+ len = readlink(path, s2, sizeof(s2) - 1);
+ if (len < 0)
+ return Estrdup(path);
+
+ s2[len] = '\0';
+ if (isabspath(s2))
+ return Estrdup(s2);
+
+ Esnprintf(s1, sizeof(s1), "%s/themes/%s", path, s2);
+ if (isdir(s1))
+ return Estrdup(s1);
+
+ /* We should never get here */
+ return NULL;
+}
+
char *
ThemeGetDefault(void)
{
- char s[FILEPATH_LEN_MAX], ss[FILEPATH_LEN_MAX];
- char *def = NULL;
- int count;
+ static const char *const dts[] = {
+ "DEFAULT", "BrushedMetal-Tigert", "ShinyMetal", "winter"
+ };
+ char s[FILEPATH_LEN_MAX];
+ char *path, **lst;
+ int i, num;
- Esnprintf(ss, sizeof(ss), "%s/themes/DEFAULT", EDirUser());
- count = readlink(ss, s, sizeof(s));
- if ((exists(ss)) && (count > 0))
+ /* First, try out some defaults */
+ num = sizeof(dts) / sizeof(char *);
+ for (i = 0; i < num; i++)
{
- s[count] = 0;
- if (isabspath(s))
- def = Estrdup(s);
- else
- {
- Esnprintf(ss, sizeof(ss), "%s/themes/%s", EDirUser(), s);
- def = Estrdup(ss);
- }
- return def;
+ Esnprintf(s, sizeof(s), "%s/themes/%s", EDirUser(), dts[i]);
+ path = ThemeGetPath(s);
+ if (path)
+ return path;
+
+ Esnprintf(s, sizeof(s), "%s/themes/%s", EDirRoot(), dts[i]);
+ path = ThemeGetPath(s);
+ if (path)
+ return path;
}
- Esnprintf(ss, sizeof(ss), "%s/themes/DEFAULT", EDirRoot());
- count = readlink(ss, s, sizeof(s));
- if ((exists(ss)) && (count > 0))
+ /* Then, try out all installed themes */
+ path = NULL;
+ lst = ListThemes(&num);
+ for (i = 0; i < num; i++)
{
- s[count] = 0;
- if (isabspath(s))
- def = Estrdup(s);
- else
- {
- Esnprintf(ss, sizeof(ss), "%s/themes/%s", EDirRoot(), s);
- def = Estrdup(ss);
- }
- return def;
+ path = ThemeGetPath(lst[i]);
+ if (path)
+ break;
}
+ if (lst)
+ freestrlist(lst, num);
- return NULL;
+ return path;
}
void
@@ -367,12 +386,12 @@
}
char *
-FindTheme(const char *theme)
+ThemeFind(const char *theme)
{
char s[FILEPATH_LEN_MAX];
char *ret = NULL;
- EDBUG(6, "FindTheme");
+ EDBUG(6, "ThemeFind");
if (Conf.theme.name)
Efree(Conf.theme.name);
@@ -380,10 +399,7 @@
badreason = _("Unknown\n");
if (!theme[0])
- {
- Esnprintf(s, sizeof(s), "%s/themes/DEFAULT", EDirRoot());
- EDBUG_RETURN(Estrdup(s));
- }
+ EDBUG_RETURN(ThemeGetDefault());
if (isabspath(theme))
ret = ThemeExtract(theme);
-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to
deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs