Enlightenment CVS committal Author : onefang Project : e17 Module : apps/e_utils
Dir : e17/apps/e_utils/src/bin/e17genmenu Modified Files: eaps.c fdo_menus.c icons.c icons.h main.c menus.c parse.c Log Message: * Some icon finding fixes. * Debug-- =================================================================== RCS file: /cvs/e/e17/apps/e_utils/src/bin/e17genmenu/eaps.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- eaps.c 26 Apr 2006 01:44:06 -0000 1.4 +++ eaps.c 26 Apr 2006 08:24:48 -0000 1.5 @@ -4,7 +4,9 @@ #include "eaps.h" #include "parse.h" -#define DEBUG 1 +//#define DEBUG 1 + +extern int not_found_count; static void _write_eap(Eet_File *ef, char *section, char *value); @@ -80,12 +82,13 @@ char *idir, *ifile, *icomp, *exec; #ifdef DEBUG - fprintf(stderr, "\tWriting file %s\n", file); - fprintf(stderr, "\t\tIcon %s\n", eap->icon_path); + fprintf(stderr, "\tWriting file %s\t\twith icon (%s) %s\n", file, eap->icon, eap->icon_path); #endif - /* FIXME: This does not seem to be catching all the problems. Further head scratching is needed. */ - if ((!eap->icon_path) || (eap->icon_path[0] == '\0')) + if ((!eap->icon_path) || (eap->icon_path[0] == '\0') || (!ecore_file_exists(eap->icon_path))) + { eap->icon_path = DEFAULTICON; + not_found_count++; + } ifile = ecore_file_get_file(eap->icon_path); idir = ecore_file_get_dir(eap->icon_path); =================================================================== RCS file: /cvs/e/e17/apps/e_utils/src/bin/e17genmenu/fdo_menus.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- fdo_menus.c 9 Mar 2006 19:34:29 -0000 1.4 +++ fdo_menus.c 26 Apr 2006 08:24:48 -0000 1.5 @@ -22,7 +22,7 @@ #include "parse.h" #include "xmlame.h" -#define DEBUG 1 +//#define DEBUG 1 extern double convert_time; =================================================================== RCS file: /cvs/e/e17/apps/e_utils/src/bin/e17genmenu/icons.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- icons.c 21 Mar 2006 03:50:43 -0000 1.2 +++ icons.c 26 Apr 2006 08:24:48 -0000 1.3 @@ -7,8 +7,13 @@ #include "icons.h" #include "parse.h" +//#define DEBUG 1 + extern double icon_time; +static char * find_fdo_icon(char *icon, char *icon_size, char *icon_theme); + + /* FIXME: Ideally this should be - * {".png", ".svg", ".xpm", "", NULL} * Add them in when they are supported in .eaps. @@ -61,7 +66,11 @@ char *dir, *icon_size, *icon_theme, *home; if (icon == NULL) - return strdup(DEFAULTICON); + return NULL; + + /* Easy check first, was a full path supplied? */ + if ((icon[0] == '/') && (ecore_file_exists(icon))) + return strdup(icon); home = get_home(); @@ -73,7 +82,7 @@ /* Check For Unsupported Extension */ if ((!strcmp(icon + strlen(icon) - 4, ".svg")) || (!strcmp(icon + strlen(icon) - 4, ".ico")) || (!strcmp(icon + strlen(icon) - 4, ".xpm"))) - return strdup(DEFAULTICON); + return NULL; /* Check For An Extension, Append PNG If Missing */ if (strrchr(icon, '.') == NULL) @@ -97,7 +106,10 @@ } } - return strdup(find_fdo_icon(icon, icon_size, icon_theme)); + dir = find_fdo_icon(icon, icon_size, icon_theme); + if (dir) + dir = strdup(dir); + return dir; } /** Search for an icon the fdo way. @@ -109,7 +121,7 @@ * @param icon_theme The icon theme to search in. * @return The full path to the found icon. */ -char * +static char * find_fdo_icon(char *icon, char *icon_size, char *icon_theme) { /* NOTES ON OPTIMIZATIONS @@ -145,7 +157,7 @@ if ((icon == NULL) || (icon[0] == '\0')) { icon_time += ecore_time_get() - begin; - return DEFAULTICON; + return NULL; } #ifdef DEBUG @@ -202,7 +214,7 @@ Ecore_Hash *sub_group; #ifdef DEBUG - printf("FDO icon path = %s\n", directory_paths->elements[i].element); + printf("FDO icon path = %s\n", (char *) directory_paths->elements[i].element); #endif /* Get the details for this theme directory. */ sub_group = (Ecore_Hash *) ecore_hash_get(theme, directory_paths->elements[i].element); @@ -303,7 +315,7 @@ if ((inherits) && (inherits[0] != '\0') && (strcmp(icon_theme, "hicolor") != 0)) { found = find_fdo_icon(icon, icon_size, inherits); - if (found != DEFAULTICON) + if (found != NULL) { icon_time += ecore_time_get() - begin; return found; @@ -314,7 +326,7 @@ if ((!((inherits) && (inherits[0] != '\0'))) && (strcmp(icon_theme, "hicolor") != 0)) { found = find_fdo_icon(icon, icon_size, "hicolor"); - if (found != DEFAULTICON) + if (found != NULL) { icon_time += ecore_time_get() - begin; return found; @@ -344,5 +356,5 @@ } icon_time += ecore_time_get() - begin; - return DEFAULTICON; + return NULL; } =================================================================== RCS file: /cvs/e/e17/apps/e_utils/src/bin/e17genmenu/icons.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- icons.h 8 Mar 2006 01:06:16 -0000 1.2 +++ icons.h 26 Apr 2006 08:24:48 -0000 1.3 @@ -24,6 +24,5 @@ /* Function Prototypes */ char *set_icon(char *token); char *find_icon(char *icon); -char *find_fdo_icon(char *icon, char *icon_size, char *icon_theme); #endif =================================================================== RCS file: /cvs/e/e17/apps/e_utils/src/bin/e17genmenu/main.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- main.c 21 Mar 2006 02:27:29 -0000 1.5 +++ main.c 26 Apr 2006 08:24:48 -0000 1.6 @@ -8,7 +8,7 @@ #include "fdo_paths.h" #include "xmlame.h" -#define DEBUG 1 +//#define DEBUG 1 /* Function Prototypes */ void _e17genmenu_backup(void); @@ -117,7 +117,7 @@ } double convert_time = 0.0, icon_time = 0.0, cache_time = 0.0, generate_time = 0.0; -int menu_count, item_count, reject_count, not_over_count; +int menu_count, item_count, reject_count, not_over_count, not_found_count; int main(int argc, char **argv) @@ -202,8 +202,8 @@ printf("* aware of this problem, and has a fix on his TODO list. *\n"); printf("********************************************************************************\n"); - printf("\nTotal time %3.3f seconds, finding fdo paths %3.3f, converting fdo menus %3.3f, converting to %d (rejected %d) eaps in %d fdo menus %3.3f, generating menus %3.3f, finding icons %3.3f, not overwritten %d, generating eap caches %3.3f.\n", - ecore_time_get() - start, paths, convert_time, item_count, reject_count, menu_count, gen - (icon_time + generate_time), generate_time, icon_time, not_over_count, cache_time); + printf("\nTotal time %3.3f seconds, finding fdo paths %3.3f, converting fdo menus %3.3f, converting to %d (rejected %d) eaps in %d fdo menus %3.3f, generating menus %3.3f, finding icons %3.3f (%d not found), not overwritten %d, generating eap caches %3.3f.\n", + ecore_time_get() - start, paths, convert_time, item_count, reject_count, menu_count, gen - (icon_time + generate_time), generate_time, icon_time, not_found_count, not_over_count, cache_time); #if 0 /* This is just a test of parsing speed for the old weather data's huge xml file. It passed the parse test. B-) */ =================================================================== RCS file: /cvs/e/e17/apps/e_utils/src/bin/e17genmenu/menus.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- menus.c 10 Mar 2006 15:17:28 -0000 1.3 +++ menus.c 26 Apr 2006 08:24:48 -0000 1.4 @@ -5,7 +5,7 @@ #include "parse.h" #include "menus.h" -#define DEBUG 1 +//#define DEBUG 1 extern int menu_count, item_count; extern double generate_time; =================================================================== RCS file: /cvs/e/e17/apps/e_utils/src/bin/e17genmenu/parse.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- parse.c 26 Apr 2006 01:44:06 -0000 1.4 +++ parse.c 26 Apr 2006 08:24:48 -0000 1.5 @@ -234,9 +234,7 @@ eap->window_class = get_window_class(path); if (eap->icon != NULL) - eap->icon_path = find_icon(strdup(eap->icon)); - if (eap->icon == NULL) - eap->icon_path = strdup(DEFAULTICON); + eap->icon_path = find_icon(eap->icon); if ((ecore_file_exists(path)) && (!overwrite)) not_over_count++; ------------------------------------------------------- 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