Enlightenment CVS committal Author : onefang Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: e_fdo_menu_to_order.c Log Message: Part two of the quick'n'dirty "save our menu customizations" hack. This commit brought to you by devilhorns, the trendy head wear for very naughty boys. =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_fdo_menu_to_order.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -3 -r1.25 -r1.26 --- e_fdo_menu_to_order.c 14 Nov 2006 21:44:34 -0000 1.25 +++ e_fdo_menu_to_order.c 15 Nov 2006 00:15:05 -0000 1.26 @@ -3,7 +3,6 @@ //#define DEBUG 1 -// FIXME: Scan through ~/.e/e/applications/all, nuke any dangling links. Start simple, add smarts later. // FIXME: If there is only one top level menu, likely called "Applications", then throw it away. The top level is already called "Applications". @@ -35,18 +34,51 @@ EAPI void e_fdo_menu_to_order(int do_nuke) { + Ecore_List *files; + const char *home; char dir[PATH_MAX]; menu_count = 0; item_count = 0; _do_nuke = do_nuke; ecore_desktop_instrumentation_reset(); + home = e_user_homedir_get(); if (do_nuke) { /* Nuke the old menus. */ - snprintf(dir, sizeof(dir), "%s/.e/e/applications/menu/all/", e_user_homedir_get()); + snprintf(dir, sizeof(dir), "%s/.e/e/applications/menu/all/", home); ecore_file_recursive_rm(dir); } + /* Scan through ~/.e/e/applications/all, nuke any dangling links. + * Start simple, add smarts later. + */ + snprintf(dir, sizeof(dir), "%s/.e/e/applications/all", home); + files = ecore_file_ls(dir); + if (files) + { + const char *file; + + while ((file = ecore_list_next(files))) + { + char *real_file; + + snprintf(dir, sizeof(dir), "%s/.e/e/applications/all/%s", home, file); + /* If it's not a link, readlink returns NULL. + * There are other failures that can result in NULL, we don't care about those. + */ + real_file = ecore_file_readlink(dir); + if (real_file) + { + if ((do_nuke) || (!ecore_file_exists(real_file)) ) + { + /* FIXME: Should also remove that item from any menus it is in. */ + ecore_file_unlink(dir); + } + free(real_file); + } + } + } + ecore_desktop_menu_for_each(_e_fdo_menu_to_order_make_apps); ecore_desktop_instrumentation_print(); /* This is a hueristic to guess if there are not enough apps. Feel free to tweak it. */ ------------------------------------------------------------------------- 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