Enlightenment CVS committal
Author : rbdpngn
Project : e17
Module : libs/ewl
Dir : e17/libs/ewl/src
Modified Files:
ewl_theme.c
Log Message:
One more attempt to get the themes to fail over correctly.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_theme.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -3 -r1.53 -r1.54
--- ewl_theme.c 27 Jan 2004 16:37:54 -0000 1.53
+++ ewl_theme.c 28 Jan 2004 04:13:38 -0000 1.54
@@ -39,7 +39,7 @@
DRETURN_INT(FALSE, DLEVEL_STABLE);
/*
- * Setup a string with the path to the users theme dir
+ * Retrieve the current theme from the users config.
*/
theme_name = ewl_config_get_str("system", "/theme/name");
if (!theme_name)
@@ -48,6 +48,10 @@
if (!theme_name)
DRETURN_INT(FALSE, DLEVEL_STABLE);
+ /*
+ * Get the users home directory. This environment variable should
+ * always be set.
+ */
home = getenv("HOME");
if (!home) {
DERROR("Environment variable HOME not defined\n"
@@ -56,6 +60,11 @@
DRETURN_INT(FALSE, DLEVEL_STABLE);
}
+ /*
+ * Build a path to the theme if it is the users home dir and use it if
+ * available. First attempts to use the theme.db method, but fails
+ * over to an eet.
+ */
snprintf(theme_db_path, PATH_MAX, "%s/.e/ewl/themes/%s", home,
theme_name);
@@ -64,10 +73,15 @@
"%s/.e/ewl/themes/%s/theme.db", home,
theme_name);
theme_db = e_db_open_read(theme_db_path);
- if (theme_db)
+ if (theme_db) {
+ snprintf(theme_db_path, PATH_MAX,
+ "%s/.e/ewl/themes/%s/", home,
+ theme_name);
theme_path = strdup(theme_db_path);
+ }
}
- else {
+
+ if (!theme_path) {
snprintf(theme_db_path, PATH_MAX, "%s/.e/ewl/themes/%s.eet",
home, theme_name);
if (((stat(theme_db_path, &st)) == 0) && S_ISREG(st.st_mode)) {
@@ -75,6 +89,10 @@
}
}
+ /*
+ * No user theme, so we try the system-wide theme. Same failover
+ * scheme, theme.db first fails over to the eet.
+ */
if (!theme_path) {
/*
@@ -95,18 +113,22 @@
theme_path = strdup(theme_db_path);
}
}
- else {
- snprintf(theme_db_path, PATH_MAX, PACKAGE_DATA_DIR
- "/themes/%s.eet", theme_name);
- if (((stat(theme_db_path, &st)) == 0) &&
- S_ISREG(st.st_mode)) {
- theme_path = strdup(theme_db_path);
- }
- }
}
if (!theme_path) {
+ snprintf(theme_db_path, PATH_MAX, PACKAGE_DATA_DIR
+ "/themes/%s.eet", theme_name);
+ if (((stat(theme_db_path, &st)) == 0) &&
+ S_ISREG(st.st_mode)) {
+ theme_path = strdup(theme_db_path);
+ }
+ }
+
+ /*
+ * If we can't find a theme, no point in continuing further.
+ */
+ if (!theme_path) {
DERROR("No usable theme found, exiting EWL");
DRETURN_INT(FALSE, DLEVEL_STABLE);
}
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs