Enlightenment CVS committal Author : raster Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: e_fm_mime.c Log Message: make mime type loads more correct and efficient =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_fm_mime.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- e_fm_mime.c 4 Nov 2006 02:31:53 -0000 1.10 +++ e_fm_mime.c 12 Nov 2006 03:08:48 -0000 1.11 @@ -189,6 +189,8 @@ char buf[4096]; const char *homedir; int reload = 0; + time_t ch_times[6] = {0, 0, 0, 0, 0, 0}; + time_t ch; /* load /etc/mime.types * load /usr/share/mime/ @@ -198,90 +200,50 @@ */ t = ecore_time_get(); if ((t - last_t) < 1.0) return; - + last_t = t; + homedir = e_user_homedir_get(); - - { - static time_t last_changed = 0; - time_t ch; - - snprintf(buf, sizeof(buf), "/etc/mime.types"); - ch = ecore_file_mod_time(buf); - if ((ch != last_changed) || (reload)) - { - _e_fm_mime_all_free(); - last_changed = ch; - _e_fm_mime_mime_types_load(buf); - reload = 1; - } - } - - { - static time_t last_changed = 0; - time_t ch; - - snprintf(buf, sizeof(buf), "/usr/local/etc/mime.types"); - ch = ecore_file_mod_time(buf); - if ((ch != last_changed) || (reload)) - { - _e_fm_mime_all_free(); - last_changed = ch; - _e_fm_mime_mime_types_load(buf); - reload = 1; - } - } - - { - static time_t last_changed = 0; - time_t ch; - - snprintf(buf, sizeof(buf), "/usr/local/share/mime/globs"); - ch = ecore_file_mod_time(buf); - if ((ch != last_changed) || (reload)) - { - last_changed = ch; - _e_fm_mime_shared_mimeinfo_globs_load(buf); - } - } - - { - static time_t last_changed = 0; - time_t ch; - - snprintf(buf, sizeof(buf), "/usr/share/mime/globs"); - ch = ecore_file_mod_time(buf); - if ((ch != last_changed) || (reload)) - { - last_changed = ch; - _e_fm_mime_shared_mimeinfo_globs_load(buf); - } - } - - { - static time_t last_changed = 0; - time_t ch; - - snprintf(buf, sizeof(buf), "%s/.mime.types", homedir); - ch = ecore_file_mod_time(buf); - if ((ch != last_changed) || (reload)) - { - last_changed = ch; - _e_fm_mime_mime_types_load(buf); - } - } + + snprintf(buf, sizeof(buf), "usr/local/etc/mime.types"); + ch = ecore_file_mod_time(buf); + if (ch != ch_times[0]) reload = 1; + ch_times[0] = ch; + snprintf(buf, sizeof(buf), "/etc/mime.types"); + ch = ecore_file_mod_time(buf); + if (ch != ch_times[1]) reload = 1; + ch_times[1] = ch; + snprintf(buf, sizeof(buf), "/usr/local/share/mime/globs"); + ch = ecore_file_mod_time(buf); + if (ch != ch_times[2]) reload = 1; + ch_times[2] = ch; + snprintf(buf, sizeof(buf), "/usr/share/mime/globs"); + ch = ecore_file_mod_time(buf); + if (ch != ch_times[3]) reload = 1; + ch_times[3] = ch; + snprintf(buf, sizeof(buf), "%s/.mime.types", homedir); + ch = ecore_file_mod_time(buf); + if (ch != ch_times[4]) reload = 1; + ch_times[4] = ch; + snprintf(buf, sizeof(buf), "%s/.local/share/mime/globs", homedir); + ch = ecore_file_mod_time(buf); + if (ch != ch_times[5]) reload = 1; + ch_times[5] = ch; - { - static time_t last_changed = 0; - time_t ch; - - snprintf(buf, sizeof(buf), "%s/.local/share/mime/globs", homedir); - ch = ecore_file_mod_time(buf); - if ((ch != last_changed) || (reload)) - { - last_changed = ch; - _e_fm_mime_shared_mimeinfo_globs_load(buf); - } - } + if (!reload) return; + + _e_fm_mime_all_free(); + snprintf(buf, sizeof(buf), "/usr/local/etc/mime.types"); + _e_fm_mime_mime_types_load(buf); + snprintf(buf, sizeof(buf), "/etc/mime.types"); + _e_fm_mime_mime_types_load(buf); + snprintf(buf, sizeof(buf), "/usr/local/share/mime/globs"); + _e_fm_mime_shared_mimeinfo_globs_load(buf); + snprintf(buf, sizeof(buf), "/usr/share/mime/globs"); + _e_fm_mime_shared_mimeinfo_globs_load(buf); + snprintf(buf, sizeof(buf), "%s/.mime.types", homedir); + _e_fm_mime_mime_types_load(buf); + snprintf(buf, sizeof(buf), "%s/.local/share/mime/globs", homedir); + _e_fm_mime_shared_mimeinfo_globs_load(buf); } static int ------------------------------------------------------------------------- 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