Enlightenment CVS committal Author : onefang Project : e17 Module : apps/e_utils
Dir : e17/apps/e_utils/src/bin/e17genmenu/src/bin Modified Files: icons.c icons.h main.c Log Message: Merged old and new icon searching code. =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e_utils/src/bin/e17genmenu/src/bin/icons.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -3 -r1.13 -r1.14 --- icons.c 3 Feb 2006 19:59:21 -0000 1.13 +++ icons.c 3 Feb 2006 20:52:04 -0000 1.14 @@ -7,7 +7,12 @@ #include "icons.h" #include "parse.h" -static const char *ext[] = {".png", ".svg", ".xpm", "", NULL}; + +/* FIXME: Ideally this should be - + * {".png", ".svg", ".xpm", "", NULL} + * Add them in when they are supported in .eaps. + */ +static const char *ext[] = {".png", "", NULL}; char * @@ -70,7 +75,8 @@ /* Check For Unsupported Extension */ if ((!strcmp(icon + strlen(icon) - 4, ".svg")) - || (!strcmp(icon + strlen(icon) - 4, ".ico"))) + || (!strcmp(icon + strlen(icon) - 4, ".ico")) + || (!strcmp(icon + strlen(icon) - 4, ".xpm"))) return DEFAULTICON; /* Check For An Extension, Append PNG If Missing */ @@ -87,55 +93,11 @@ return strdup(icn); } - snprintf(path, MAX_PATH, PIXMAPDIR "/%s", icn); - if (ecore_file_exists(path)) - return strdup(path); - /* Get Icon Options */ icon_size = get_icon_size(); icon_theme = get_icon_theme(); - /* Check User Supplied Icon Theme */ - if (icon_theme != NULL) - { - fprintf(stderr, "\tUsing Icon Theme: %s\n", icon_theme); - snprintf(path, MAX_PATH, "%s/%s/apps/%s", icon_theme, icon_size, icn); - if (ecore_file_exists(path)) - return strdup(path); - snprintf(path, MAX_PATH, "%s/%s/devices/%s", icon_theme, icon_size, - icn); - if (ecore_file_exists(path)) - return strdup(path); - snprintf(path, MAX_PATH, "%s/%s/filesystems/%s", icon_theme, icon_size, - icn); - if (ecore_file_exists(path)) - return strdup(path); - } - - snprintf(path, MAX_PATH, CRYSTALSVGDIR "/%s/apps/%s", icon_size, icn); - if (ecore_file_exists(path)) - return strdup(path); - snprintf(path, MAX_PATH, CRYSTALSVGDIR "/%s/devices/%s", icon_size, icn); - if (ecore_file_exists(path)) - return strdup(path); - snprintf(path, MAX_PATH, CRYSTALSVGDIR "/%s/filesystems/%s", icon_size, icn); - if (ecore_file_exists(path)) - return strdup(path); - - /* We Did Not Find the icon in theme dir, - * check default theme before setting a default icon */ - snprintf(path, MAX_PATH, ICONDIR "/hicolor/%s/apps/%s", icon_size, icn); - if (ecore_file_exists(path)) - return strdup(path); - snprintf(path, MAX_PATH, ICONDIR "/hicolor/%s/devices/%s", icon_size, icn); - if (ecore_file_exists(path)) - return strdup(path); - snprintf(path, MAX_PATH, ICONDIR "/hicolor/%s/filesystems/%s", icon_size, - icn); - if (ecore_file_exists(path)) - return strdup(path); - - return DEFAULTICON; + return strdup(find_fdo_icon(icon, icon_size, icon_theme)); } /** Search for an icon the fdo way. @@ -176,8 +138,7 @@ */ char icn[MAX_PATH], path[MAX_PATH]; - char *dir, *theme_path; - char *found; + char *theme_path, *found; if (icon == NULL) return DEFAULTICON; @@ -186,22 +147,6 @@ fprintf(stderr, "\tTrying To Find Icon %s (%s) in theme %s\n", icon, icon_size, icon_theme); #endif - /* Check For Unsupported Extension */ - if ((!strcmp(icon + strlen(icon) - 4, ".svg")) - || (!strcmp(icon + strlen(icon) - 4, ".ico")) - || (!strcmp(icon + strlen(icon) - 4, ".xpm"))) - return DEFAULTICON; - - /* Check If Dir Supplied In Desktop File */ - dir = ecore_file_get_dir(icon); - if (!strcmp(dir, icon) == 0) - { - snprintf(path, MAX_PATH, "%s", icon); - /* Check Supplied Dir For Icon */ - if (ecore_file_exists(path)) - return strdup(icon); - } - /* Get the theme description file. */ snprintf(icn, MAX_PATH, "%s/index.theme", icon_theme); #ifdef DEBUG =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e_utils/src/bin/e17genmenu/src/bin/icons.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- icons.h 3 Feb 2006 19:18:33 -0000 1.4 +++ icons.h 3 Feb 2006 20:52:04 -0000 1.5 @@ -6,10 +6,6 @@ #include <unistd.h> #include "config.h" -#define PIXMAPDIR "/usr/share/pixmaps" -#define ICONDIR "/usr/share/icons" -#define CRYSTALSVGDIR "/usr/share/icons/crystalsvg" - #define APPLICATIONICON PACKAGE_DATA_DIR"/icons/package_applications.png" #define COREICON PACKAGE_DATA_DIR"/icons/package_applications.png" #define EDITORICON PACKAGE_DATA_DIR"/icons/package_editors.png" =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e_utils/src/bin/e17genmenu/src/bin/main.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- main.c 3 Feb 2006 19:18:33 -0000 1.10 +++ main.c 3 Feb 2006 20:52:04 -0000 1.11 @@ -28,17 +28,12 @@ { int i; char *path; - char *icon_size, *icon_theme; char *menu = "applications.menu"; printf("Testing FDO paths\n"); fdo_paths_init(); - /* Get Icon Options */ - icon_size = get_icon_size(); - icon_theme = get_icon_theme(); - /* You can iterate through the various path lists as needed. */ for (i = 0; i < fdo_paths_menus->size; i++) printf("FDO menu path = %s\n", fdo_paths_menus->list[i]); @@ -90,13 +85,13 @@ free(path); } } - path = find_fdo_icon("tux", icon_size, icon_theme); + path = find_icon("tux"); if (path) { printf("Path to tux is %s\n", path); free(path); } - path = find_fdo_icon("blah", icon_size, icon_theme); + path = find_icon("blah"); if (path) { printf("Path to blah is %s\n", path); ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs