Enlightenment CVS committal Author : onefang Project : e17 Module : apps/e_utils
Dir : e17/apps/e_utils/src/bin/e17genmenu/src/bin Modified Files: Makefile.am main.c global.c Added Files: fdo_paths.c fdo_paths.h Log Message: * FDO directory snarfing and searching. * fix a segv in global.c. =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e_utils/src/bin/e17genmenu/src/bin/Makefile.am,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- Makefile.am 31 Jan 2006 19:10:34 -0000 1.1 +++ Makefile.am 1 Feb 2006 19:03:22 -0000 1.2 @@ -16,10 +16,10 @@ bin_PROGRAMS = e17genmenu e17genmenu_SOURCES = main.c global.c menus.c parse.c eaps.c icons.c \ - category.c order.c sort.c + category.c order.c sort.c fdo_paths.c noinst_HEADERS = global.h menus.h parse.h eaps.h icons.h \ - category.h order.h sort.h + category.h order.h sort.h fdo_paths.h e17genmenu_LDADD = @EET_LIBS@ @ECORE_LIBS@ @ENGRAVE_LIBS@ =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e_utils/src/bin/e17genmenu/src/bin/main.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- main.c 1 Feb 2006 09:41:25 -0000 1.4 +++ main.c 1 Feb 2006 19:03:22 -0000 1.5 @@ -2,6 +2,7 @@ #include "config.h" #include "menus.h" #include "sort.h" +#include "fdo_paths.h" /* Function Prototypes */ void _e17genmenu_backup(void); @@ -21,6 +22,70 @@ } void +_e17genmenu_test_fdo_paths() +{ + int i; + char *path; + char *menu = "applications.menu"; + + printf("Testing FDO paths\n"); + + fdo_paths_init(); + + /* 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]); + for (i = 0; i < fdo_paths_directories->size; i++) + printf("FDO directory path = %s\n", fdo_paths_directories->list[i]); + for (i = 0; i < fdo_paths_desktops->size; i++) + printf("FDO desktop path = %s\n", fdo_paths_desktops->list[i]); + for (i = 0; i < fdo_paths_icons->size; i++) + printf("FDO icon path = %s\n", fdo_paths_icons->list[i]); + + /* First, find the main menu file. */ + path = fdo_paths_search_for_file(FDO_PATHS_TYPE_MENU, menu); + if (path) + { + char *directory = "Applications.directory"; + char *desktop = "xterm.desktop"; + char *icon = "tux.png"; + + printf("Path to %s is %s\n", menu, path); + free(path); + + /* During the processing of the menu file, you will need to search for + * .directory files, .desktop files, and icons. + */ + path = fdo_paths_search_for_file(FDO_PATHS_TYPE_DIRECTORY, directory); + if (path) + { + printf("Path to %s is %s\n", directory, path); + free(path); + } + + path = fdo_paths_search_for_file(FDO_PATHS_TYPE_DESKTOP, desktop); + if (path) + { + printf("Path to %s is %s\n", desktop, path); + free(path); + } + + path = fdo_paths_search_for_file(FDO_PATHS_TYPE_ICON, icon); + if (path) + { + printf("Path to %s is %s\n", icon, path); + free(path); + } + } + + fdo_paths_shutdown(); + + _e17genmenu_shutdown(); + + exit(0); +} + +void _e17genmenu_help() { printf("e17genmenu - Generate Enlightenment DR17 Menus\n"); @@ -55,6 +120,8 @@ _e17genmenu_help(); if ((strstr(argv[i], "--backup")) || (strstr(argv[i], "-b"))) _e17genmenu_backup(); + if ((strstr(argv[i], "--fdo")) || (strstr(argv[i], "-f"))) + _e17genmenu_test_fdo_paths(); } } } =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e_utils/src/bin/e17genmenu/src/bin/global.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- global.c 1 Feb 2006 09:41:25 -0000 1.4 +++ global.c 1 Feb 2006 19:03:22 -0000 1.5 @@ -20,8 +20,6 @@ home[length] = '\0'; } } - if (d) - free(d); return strdup(home); } ------------------------------------------------------- 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