Enlightenment CVS committal Author : onefang Project : e17 Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore_desktop Modified Files: Ecore_Desktop.h ecore_desktop_icon.c Log Message: A few fixes for icon themes, including - Icon theme inherits can have a list of parents, I don't recall seeing that in the spec, but some of mine have that. =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_desktop/Ecore_Desktop.h,v retrieving revision 1.28 retrieving revision 1.29 diff -u -3 -r1.28 -r1.29 --- Ecore_Desktop.h 22 Sep 2006 06:07:01 -0000 1.28 +++ Ecore_Desktop.h 22 Sep 2006 07:51:32 -0000 1.29 @@ -71,6 +71,7 @@ struct _Ecore_Desktop_Icon_Theme { Ecore_Hash *data, *group; + Ecore_List *Inherits; Ecore_List *Directories; char *path; char *name; =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_desktop/ecore_desktop_icon.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -3 -r1.20 -r1.21 --- ecore_desktop_icon.c 22 Sep 2006 06:14:25 -0000 1.20 +++ ecore_desktop_icon.c 22 Sep 2006 07:51:32 -0000 1.21 @@ -249,19 +249,24 @@ /* Fall back strategy #1, look for closest size in this theme. */ found = closest; - /* Fall back strategy #2, Try again with the parent theme. */ - if ((!found) && (theme->inherits) - && (theme->inherits[0] != '\0') + /* Fall back strategy #2, Try again with the parent themes. */ + if ((!found) && (theme->Inherits) && (strcmp(icon_theme, "hicolor") != 0)) { - found = (char *) - _ecore_desktop_icon_find0(icon, icon_size, - theme->inherits); + char *inherits; + + ecore_list_goto_first(theme->Inherits); + while ((inherits = ecore_list_next(theme->Inherits)) != NULL) + { + found = (char *) _ecore_desktop_icon_find0(icon, icon_size, inherits); + if (found) + break; + } } /* Fall back strategy #3, Try the default hicolor theme. */ if ((!found) - && (!((theme->inherits) && (theme->inherits[0] != '\0'))) + && (!(theme->Inherits)) && (strcmp(icon_theme, "hicolor") != 0)) { found = (char *) @@ -385,28 +390,29 @@ ecore_desktop_icon_theme_get(const char *icon_theme, const char *lang) { Ecore_Desktop_Icon_Theme *result; + char *theme_path = NULL, *dir = NULL; + + if (icon_theme[0] == '/') + { + theme_path = strdup(icon_theme); + dir = ecore_file_get_dir(theme_path); + if (dir) + icon_theme = (char *)ecore_file_get_file(dir); +#ifdef DEBUG + printf("LOADING THEME %s - %s\n", icon_theme, theme_path); +#endif + } result = (Ecore_Desktop_Icon_Theme *) ecore_hash_get(icon_theme_cache, (char *)icon_theme); if (!result) { - char icn[PATH_MAX], *theme_path; - if (icon_theme[0] == '/') + if (!dir) { - char *dir; + char icn[PATH_MAX]; - theme_path = strdup(icon_theme); - dir = ecore_file_get_dir(theme_path); - if (dir) - icon_theme = (char *)ecore_file_get_file(dir); -#ifdef DEBUG - printf("LOADING THEME %s - %s\n", icon_theme, theme_path); -#endif - } - else - { snprintf(icn, PATH_MAX, "%s/index.theme", icon_theme); #ifdef DEBUG printf("SEARCHING FOR %s\n", icn); @@ -442,10 +448,13 @@ value = "No comment provided."; result->comment = strdup(value); value = - (char *)ecore_hash_get(result->group, - "Inherits"); + (char *)ecore_hash_get(result->group, "Inherits"); if (value) - result->inherits = strdup(value); + { + result->inherits = strdup(value); + if (result->inherits) + result->Inherits = ecore_desktop_paths_to_list(result->inherits); + } value = (char *)ecore_hash_get(result->group, "Example"); if (!value) @@ -557,7 +566,7 @@ } /* This passes the basic validation tests, mark it as real and cache it. */ - result->path = theme_path; + result->path = strdup(theme_path); ecore_hash_set(icon_theme_cache, strdup(icon_theme), result); } @@ -568,12 +577,13 @@ if (!result->path) { _ecore_desktop_icon_theme_destroy(result); - free(theme_path); result = NULL; } } } } + if (dir) free(dir); + if (theme_path) free(theme_path); return result; } ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs