From db828ca153a24fd110971b4da286306828c33b8d Mon Sep 17 00:00:00 2001 From: Kairong Yin Date: Sat, 27 Oct 2012 17:30:35 +0800 Subject: [PATCH] Add idler task controlling to improve the response speed issue of P121026-4952 Change-Id: I9f2fab7b30960d8799114f6740bcaefd3af9a54b --- src/setting-main.c | 47 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/src/setting-main.c b/src/setting-main.c index 5c448af..bda6a39 100755 --- a/src/setting-main.c +++ b/src/setting-main.c @@ -1402,40 +1402,61 @@ static void __btnback_clicked_cb(void *data, Evas_Object *obj, void *event_info) elm_win_lower(ad->win_main); } +static Eina_Bool __refresh_on_idle(void *data) +{ + SETTING_TRACE_BEGIN; + retv_if(!data, FALSE); + setting_main_appdata *ad = data; + if (MAIN_PROFILE_ALL == ad->profile_type) + { + ad->load_fns[Func_Type_Connectivity] = __load_connectivity_level_all_list; + ad->load_fns[Func_Type_System] = __load_system_level_all_list; + ad->load_fns[Func_Type_Apps] = __load_applications_level_all_list; + ad->load_fns[Func_Type_DownApp] = __load_downloaded_apps_level_all_list; + setting_main_refresh(ad); + } + else if (MAIN_PROFILE_PREFERRED == ad->profile_type) + { + ad->load_fns[Func_Type_Connectivity] = __load_connectivity_level0_list; + ad->load_fns[Func_Type_System] = __load_system_level0_list; + ad->load_fns[Func_Type_Apps] = __load_applications_level0_list; + ad->load_fns[Func_Type_DownApp] = __load_downloaded_apps_level0_list; + setting_main_refresh(ad); + } + ad->refresh_idler = NULL; + return FALSE; +} + static void __allFrequent_btn_cb(void *data, Evas_Object *obj, void *event_info) { SETTING_TRACE_BEGIN; ret_if(!data || !obj); setting_main_appdata *ad = (setting_main_appdata *) data; + //if already has the task,cancel the old task with ecore_idler_del,then add new idler task. + if (ad->refresh_idler) { + ecore_idler_del(ad->refresh_idler); + ad->refresh_idler = NULL; + } + Elm_Object_Item *item = elm_toolbar_first_item_get(obj); ret_if(!item); - if (MAIN_PROFILE_ALL == ad->profile_type) { SETTING_TRACE("Change to Preferred view"); elm_object_item_text_set(item, _(ALL_STR)); ad->profile_type = MAIN_PROFILE_PREFERRED; - ad->load_fns[Func_Type_Connectivity] = __load_connectivity_level0_list; - ad->load_fns[Func_Type_System] = __load_system_level0_list; - ad->load_fns[Func_Type_Apps] = __load_applications_level0_list; - ad->load_fns[Func_Type_DownApp] = __load_downloaded_apps_level0_list; - setting_main_refresh(ad); } else if (MAIN_PROFILE_PREFERRED == ad->profile_type) { SETTING_TRACE("Change to ALL view"); elm_object_item_text_set(item, _(PREFERRED_STR)); ad->profile_type = MAIN_PROFILE_ALL; - ad->load_fns[Func_Type_Connectivity] = __load_connectivity_level_all_list; - ad->load_fns[Func_Type_System] = __load_system_level_all_list; - ad->load_fns[Func_Type_Apps] = __load_applications_level_all_list; - ad->load_fns[Func_Type_DownApp] = __load_downloaded_apps_level_all_list; - setting_main_refresh(ad); } else { return; } + ad->refresh_idler = ecore_idler_add((Ecore_Task_Cb) __refresh_on_idle, ad); } /** @@ -1825,6 +1846,10 @@ static int setting_main_destroy(void *cb) //already not exsit return SETTING_RETURN_SUCCESS; } + if (ad->refresh_idler) { + ecore_idler_del(ad->refresh_idler); + ad->refresh_idler = NULL; + } if (ad->handle) { int tapi_ret = tel_deinit(ad->handle); -- 2.7.4