From 01a9d810965a99a1924f06dde9d0e0760a5215f9 Mon Sep 17 00:00:00 2001 From: Sebastian Dransfeld Date: Wed, 9 Feb 2011 17:10:12 +0000 Subject: [PATCH] Wait for caches to update, then quit. SVN revision: 56857 --- legacy/efreet/src/tests/ef_cache.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/legacy/efreet/src/tests/ef_cache.c b/legacy/efreet/src/tests/ef_cache.c index 1fc5cc6ee3..2843bc1273 100644 --- a/legacy/efreet/src/tests/ef_cache.c +++ b/legacy/efreet/src/tests/ef_cache.c @@ -10,6 +10,27 @@ EAPI Eina_List *efreet_util_desktop_generic_name_glob_list(const char *glob); EAPI Eina_List *efreet_util_desktop_comment_glob_list(const char *glob); #endif +static Eina_Bool icon_cb = EINA_FALSE; +static Eina_Bool desktop_cb = EINA_FALSE; + +static Eina_Bool +icon_handler_cb(void *data __UNUSED__, int event_type __UNUSED__, void *event __UNUSED__) +{ + icon_cb = EINA_TRUE; + if (icon_cb && desktop_cb) + ecore_main_loop_quit(); + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +desktop_handler_cb(void *data __UNUSED__, int event_type __UNUSED__, void *event __UNUSED__) +{ + desktop_cb = EINA_TRUE; + if (icon_cb && desktop_cb) + ecore_main_loop_quit(); + return ECORE_CALLBACK_PASS_ON; +} + static void check(void) { @@ -135,9 +156,16 @@ check(void) int main(int argc __UNUSED__, char **argv __UNUSED__) { + Ecore_Event_Handler *icon_handler; + Ecore_Event_Handler *desktop_handler; + if (!efreet_init()) return 1; + icon_handler = ecore_event_handler_add(EFREET_EVENT_ICON_CACHE_UPDATE, icon_handler_cb, NULL); + desktop_handler = ecore_event_handler_add(EFREET_EVENT_DESKTOP_CACHE_UPDATE, desktop_handler_cb, NULL); check(); ecore_main_loop_begin(); + ecore_event_handler_del(icon_handler); + ecore_event_handler_del(desktop_handler); efreet_shutdown(); return 0; }