Enlightenment CVS committal Author : englebass Project : e17 Module : libs/efreet
Dir : e17/libs/efreet/src/lib Modified Files: efreet_utils.c efreet_utils.h Log Message: search for mime =================================================================== RCS file: /cvs/e/e17/libs/efreet/src/lib/efreet_utils.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -3 -r1.13 -r1.14 --- efreet_utils.c 25 Mar 2007 16:44:47 -0000 1.13 +++ efreet_utils.c 25 Mar 2007 18:17:34 -0000 1.14 @@ -2,9 +2,10 @@ #include "Efreet.h" #include "efreet_private.h" -typedef struct _Efreet_Cache_Fill Efreet_Cache_Fill; -typedef struct _Efreet_Cache_Fill_Dir Efreet_Cache_Fill_Dir; -typedef struct _Efreet_Cache_Search Efreet_Cache_Search; +typedef struct _Efreet_Cache_Fill Efreet_Cache_Fill; +typedef struct _Efreet_Cache_Fill_Dir Efreet_Cache_Fill_Dir; +typedef struct _Efreet_Cache_Search Efreet_Cache_Search; +typedef struct _Efreet_Cache_Search_Mime Efreet_Cache_Search_Mime; struct _Efreet_Cache_Fill { @@ -21,12 +22,19 @@ struct _Efreet_Cache_Search { - const char *what1; - const char *what2; + const char *what1; + const char *what2; +}; + +struct _Efreet_Cache_Search_Mime +{ + Ecore_List *list; + const char *mime; }; static int _efreet_util_cache_fill(void *data); static void _efreet_util_cache_dir_free(void *data); +static void _efreet_util_cache_search_mime(void *value, void *data); static int _efreet_util_cache_search_wm_class(const void *value, const void *data); static int _efreet_util_cache_search_name(const void *value, const void *data); static int _efreet_util_cache_search_generic_name(const void *value, const void *data); @@ -160,6 +168,20 @@ return file_id; } +Ecore_List * +efreet_util_desktop_mime_list(const char *mime) +{ + Efreet_Cache_Search_Mime search; + + search.list = ecore_list_new(); + search.mime = mime; + + ecore_hash_for_each_node(desktop_by_exec, _efreet_util_cache_search_mime, &search); + + if (ecore_list_is_empty(search.list)) IF_FREE_LIST(search.list); + return search.list; +} + Efreet_Desktop * efreet_util_desktop_wm_class_find(const char *wmname, const char *wmclass) { @@ -372,6 +394,30 @@ IF_FREE(dir->path); IF_FREE(dir->file_id); free(dir); +} + +static void +_efreet_util_cache_search_mime(void *value, void *data) +{ + Ecore_Hash_Node *node; + Efreet_Cache_Search_Mime *search; + Efreet_Desktop *desktop; + const char *mime; + + node = value; + search = data; + desktop = node->value; + + if (!desktop->mime_types) return; + ecore_list_goto_first(desktop->mime_types); + while ((mime = ecore_list_next(desktop->mime_types))) + { + if (!strcmp(search->mime, mime)) + { + ecore_list_append(search->list, desktop); + break; + } + } } static int =================================================================== RCS file: /cvs/e/e17/libs/efreet/src/lib/efreet_utils.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- efreet_utils.h 25 Mar 2007 16:17:19 -0000 1.10 +++ efreet_utils.h 25 Mar 2007 18:17:34 -0000 1.11 @@ -5,6 +5,8 @@ char *efreet_util_path_in_default(const char *section, const char *path); const char *efreet_util_path_to_file_id(const char *path); +Ecore_List *efreet_util_desktop_mime_list(const char *mime); + Efreet_Desktop *efreet_util_desktop_wm_class_find(const char *wmname, const char *wmclass); Efreet_Desktop *efreet_util_desktop_file_id_find(const char *file_id); Efreet_Desktop *efreet_util_desktop_exec_find(const char *exec); ------------------------------------------------------------------------- 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