Enlightenment CVS committal Author : onefang Project : e17 Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore_desktop Modified Files: ecore_desktop.c ecore_desktop_icon.c ecore_desktop_paths.c Log Message: More icon tweaking. I have started to simplify and rationalise this as it was starting to get silly. Searching the icon class in the wm theme first, then searching fdo icon themes sometimes ends up with a less specific icon. Menus make life tricky, as things are deferred there, but not enough to avoid delays. Lots more tweaking to come, but this commit should result in more icons on menus. =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_desktop/ecore_desktop.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -3 -r1.20 -r1.21 --- ecore_desktop.c 1 Sep 2006 15:03:19 -0000 1.20 +++ ecore_desktop.c 2 Sep 2006 04:19:25 -0000 1.21 @@ -297,22 +297,44 @@ * Use (from .desktop) eap name,exe name,categories. It's case sensitive, the reccomendation is to lowercase it. * It should be most specific to most generic. firefox,browser,internet for instance */ - if (eap_name) size += strlen(eap_name); - if (exe) size += strlen(exe); - if (categories) size += strlen(categories); - result->icon_class = malloc(size + 3); + + /* If the icon in the file is not a full path, just put it first in the class, greatly simplifies things. + * Otherwise, put that full path into the icon_path member. + */ + if ((result->icon) && (result->icon[0] != '/')) + size += strlen(result->icon) + 1; + else + { + result->icon_path = result->icon; + result->icon = NULL; + } + if (eap_name) size += strlen(eap_name) + 1; + if (exe) size += strlen(exe) + 1; + if (categories) size += strlen(categories) + 1; + result->icon_class = malloc(size + 1); if (result->icon_class) { char *p; int done = 0; result->icon_class[0] = '\0'; - if (eap_name) + if ((result->icon) && (result->icon[0] != '/') && (result->icon[0] != '\0')) + { + strcat(result->icon_class, result->icon); + done = 1; + result->icon = NULL; + } + /* We do this here coz we don't want to lower case the result->icon part later. */ + p = result->icon_class; + p += strlen(result->icon_class); + if ((eap_name) && (eap_name[0] != '\0')) { + if (done) + strcat(result->icon_class, ","); strcat(result->icon_class, eap_name); done = 1; } - if (exe) + if ((exe) && (exe[0] != '\0')) { char *tmp; @@ -336,14 +358,13 @@ free(tmp); } } - if (categories) + if ((categories) && (categories[0] != '\0')) { if (done) strcat(result->icon_class, ","); strcat(result->icon_class, categories); done = 1; } - p = result->icon_class; while (*p != '\0') { if (*p == ';') =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_desktop/ecore_desktop_icon.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -3 -r1.13 -r1.14 --- ecore_desktop_icon.c 21 Aug 2006 17:55:39 -0000 1.13 +++ ecore_desktop_icon.c 2 Sep 2006 04:19:25 -0000 1.14 @@ -45,8 +45,8 @@ const char * ecore_desktop_icon_find(const char *icon, const char *icon_size, const char *icon_theme) { - char icn[PATH_MAX], path[PATH_MAX]; - const char *dir; + const char *dir = NULL, *icn; + Ecore_List *icons; if (icon == NULL) return NULL; @@ -60,31 +60,25 @@ if (icon_theme == NULL) icon_theme="hicolor"; - snprintf(icn, sizeof(icn), "%s", icon); + icons = ecore_desktop_paths_to_list(icon); + ecore_list_goto_first(icons); + while ((icn = (char *) ecore_list_next(icons))) + { #ifdef DEBUG - fprintf(stderr, "\tTrying To Find Icon %s\n", icn); + fprintf(stderr, "\tTrying To Find Icon %s\n", icn); #endif + /* Check for unsupported extension */ + if (!strcmp(icn + strlen(icn) - 4, ".ico")) + continue; + + dir = _ecore_desktop_icon_find0(icn, icon_size, icon_theme); + if (dir) + { + dir = strdup(dir); + break; + } + } - /* Check For Unsupported Extension */ - if (!strcmp(icon + strlen(icon) - 4, ".ico")) - return NULL; - - if (!icon_theme) - { - /* Check If Dir Supplied In Desktop File */ - dir = ecore_file_get_dir(icn); - if (!strcmp(dir, icn) == 0) - { - snprintf(path, PATH_MAX, "%s", icn); - /* Check Supplied Dir For Icon */ - if (ecore_file_exists(path)) - return strdup(icn); - } - } - - dir = _ecore_desktop_icon_find0(icon, icon_size, icon_theme); - if (dir) - dir = strdup(dir); return dir; } =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_desktop/ecore_desktop_paths.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -3 -r1.16 -r1.17 --- ecore_desktop_paths.c 1 Sep 2006 06:59:21 -0000 1.16 +++ ecore_desktop_paths.c 2 Sep 2006 04:19:25 -0000 1.17 @@ -188,7 +188,7 @@ char *gnome; ecore_desktop_paths_icons = - _ecore_desktop_paths_get("~/.icons", "XDG_DATA_HOME", + _ecore_desktop_paths_get("~/.e/e/icons:~/.icons", "XDG_DATA_HOME", "XDG_DATA_DIRS", "~/.local/share:~/.kde/share", "/usr/local/share:/usr/share:/usr/X11R6/share", "icons:pixmaps", "dist/icons", "icon:pixmap"); ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs