summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/efreet/efreet_menu.c63
1 files changed, 2 insertions, 61 deletions
diff --git a/src/lib/efreet/efreet_menu.c b/src/lib/efreet/efreet_menu.c
index f48f13c07e..f3160b8b97 100644
--- a/src/lib/efreet/efreet_menu.c
+++ b/src/lib/efreet/efreet_menu.c
@@ -319,9 +319,6 @@ static void efreet_menu_path_set(Efreet_Menu_Internal *internal, const char *pat
319static int efreet_menu_save_menu(Efreet_Menu *menu, FILE *f, int indent); 319static int efreet_menu_save_menu(Efreet_Menu *menu, FILE *f, int indent);
320static int efreet_menu_save_indent(FILE *f, int indent); 320static int efreet_menu_save_indent(FILE *f, int indent);
321 321
322static void _efreet_menu_async_parse_cb(void *data, Ecore_Thread *thread);
323static void _efreet_menu_async_end_cb(void *data, Ecore_Thread *thread);
324
325int 322int
326efreet_menu_init(void) 323efreet_menu_init(void)
327{ 324{
@@ -530,43 +527,11 @@ efreet_menu_file_set(const char *file)
530 527
531/* deprecated */ 528/* deprecated */
532EFREET_DEPRECATED_API EAPI void 529EFREET_DEPRECATED_API EAPI void
533efreet_menu_async_get(Efreet_Menu_Cb func, const void *data) 530efreet_menu_async_get(Efreet_Menu_Cb func EINA_UNUSED, const void *data EINA_UNUSED)
534{ 531{
535 char menu[PATH_MAX];
536 const char *dir;
537 Eina_List *config_dirs, *l;
538
539 ERR("%s is deprecated and shouldn't be called", __FUNCTION__); 532 ERR("%s is deprecated and shouldn't be called", __FUNCTION__);
540 533
541 return; 534 return;
542
543
544 if (!func) return;
545
546#ifndef STRICT_SPEC
547 /* prefer user set menu */
548 if (efreet_menu_file)
549 {
550 if (ecore_file_exists(efreet_menu_file))
551 efreet_menu_async_parse(efreet_menu_file, func, data);
552 }
553#endif
554
555 /* check the users config directory first */
556 snprintf(menu, sizeof(menu), "%s/menus/%sapplications.menu",
557 efreet_config_home_get(), efreet_menu_prefix);
558 if (ecore_file_exists(menu))
559 efreet_menu_async_parse(menu, func, data);
560
561 /* fallback to the XDG_CONFIG_DIRS */
562 config_dirs = efreet_config_dirs_get();
563 EINA_LIST_FOREACH(config_dirs, l, dir)
564 {
565 snprintf(menu, sizeof(menu), "%s/menus/%sapplications.menu",
566 dir, efreet_menu_prefix);
567 if (ecore_file_exists(menu))
568 efreet_menu_async_parse(menu, func, data);
569 }
570} 535}
571 536
572EAPI Efreet_Menu * 537EAPI Efreet_Menu *
@@ -606,18 +571,11 @@ efreet_menu_get(void)
606 571
607/* deprecated */ 572/* deprecated */
608EFREET_DEPRECATED_API EAPI void 573EFREET_DEPRECATED_API EAPI void
609efreet_menu_async_parse(const char *path, Efreet_Menu_Cb func, const void *data) 574efreet_menu_async_parse(const char *path EINA_UNUSED, Efreet_Menu_Cb func EINA_UNUSED, const void *data EINA_UNUSED)
610{ 575{
611 Efreet_Menu_Async *async;
612
613 ERR("%s is deprecated and shouldn't be called", __FUNCTION__); 576 ERR("%s is deprecated and shouldn't be called", __FUNCTION__);
614 577
615 return; 578 return;
616 async = NEW(Efreet_Menu_Async, 1);
617 async->func = func;
618 async->data = (void*)data;
619 async->path = eina_stringshare_add(path);
620 ecore_thread_run(_efreet_menu_async_parse_cb, _efreet_menu_async_end_cb, NULL, async);
621} 579}
622 580
623EAPI Efreet_Menu * 581EAPI Efreet_Menu *
@@ -3925,20 +3883,3 @@ efreet_menu_save_indent(FILE *f, int indent)
3925 return 1; 3883 return 1;
3926} 3884}
3927 3885
3928static void
3929_efreet_menu_async_parse_cb(void *data, Ecore_Thread *thread EINA_UNUSED)
3930{
3931 Efreet_Menu_Async *async = data;
3932
3933 async->menu = efreet_menu_parse(async->path);
3934}
3935
3936static void
3937_efreet_menu_async_end_cb(void *data, Ecore_Thread *thread EINA_UNUSED)
3938{
3939 Efreet_Menu_Async *async = data;
3940
3941 async->func(async->data, async->menu);
3942 eina_stringshare_del(async->path);
3943 free(async);
3944}