Improve the response speed of 'Reset'
authorKairong Yin <kairong78.yin@samsung.com>
Mon, 10 Sep 2012 09:16:38 +0000 (02:16 -0700)
committerKairong Yin <kairong78.yin@samsung.com>
Tue, 11 Sep 2012 05:29:13 +0000 (22:29 -0700)
Change-Id: I79731c30a45891a8121223dd64c8c29175841183

setting-font/src/setting-font.c
setting-reset/include/setting-reset.h
setting-reset/src/setting-reset-settings.c
setting-reset/src/setting-reset.c

index f13ddc5..41c9637 100755 (executable)
@@ -313,19 +313,17 @@ int setting_font_update_vconf_key(void *data, setting_vconf_type type,
 UG_MODULE_API int setting_plugin_reset(service_h service, void *priv)
 {
        SETTING_TRACE_BEGIN;
-       //int ret = vconf_set_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR, "Fraser");
        int ret = 0;
-#if SUPPORT_RUN_SYSTEM_COMMAND
-       ret += excuteCmd(SETTING_POSTINST_FILE, 1, "font");
-#else
-       /* reset font type, default is HelveticaNeue */
-       font_config_set("HelveticaNeue");
-
-       /* reset font size */
-       ret += vconf_set_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, SYSTEM_SETTINGS_FONT_SIZE_NORMAL);
-       setting_retvm_if(ret == -1, -1, "Failed to set vconf");
-       font_size_set();
-#endif
+       int value = SYSTEM_SETTINGS_FONT_SIZE_NORMAL;
+       vconf_get_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, &value);
+       if (value != SYSTEM_SETTINGS_FONT_SIZE_NORMAL)
+       {
+               /* reset font type, default is HelveticaNeue */
+               font_config_set("HelveticaNeue");
+               ret += vconf_set_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, SYSTEM_SETTINGS_FONT_SIZE_NORMAL);
+               setting_retvm_if(ret == -1, ret, "Failed to set vconf");
+               font_size_set();
+       }
        return ret;
 }
 
index cf25201..520fd9b 100755 (executable)
@@ -81,6 +81,7 @@ struct _SettingResetUG {
        Evas_Object *view_layout;
        Evas_Object *navi_bar;
        Evas_Object *controllbar;
+       Evas_Object *reset_list;
        Evas_Object *main_scroller;
 
        Evas_Object *pop_factory_reset;
index b285591..b83c6fc 100755 (executable)
@@ -66,7 +66,7 @@ static char *__result_gl_text_get(void *data, Evas_Object *obj,
            (Setting_GenGroupItem_Data *) data;
        //SETTING_TRACE("part:%s", part);
 
-       if (!safeStrCmp(part, "elm.text.1")) {  /* title */
+       if (!safeStrCmp(part, "elm.text") || !safeStrCmp(part, "elm.text.1")) { /* title */
                char label[HELP_MSG_BUFF_SIZE + 1] = { 0, };
                if (item_data->keyStr)
                {
@@ -106,8 +106,6 @@ static void __processing_popup_response_cb(void *data, Evas_Object *obj,
                SETTING_TRACE_ERROR("KEY_HOME ungrab error ret[%d]", ret);
        }
 }
-#endif
-#if SIMPLY_SUPPORT_ALL_RESET
 bool __reset_all_idler(void *data)
 {
        SETTING_TRACE_BEGIN;
@@ -198,8 +196,7 @@ bool __reset_all_idler(void *data)
        }
        return FALSE;
 }
-#endif
-#if SIMPLY_SUPPORT_ALL_RESET
+
 static void __reset_all_button_cb(void *data, Evas_Object *obj, void *event_info)
 {
        SETTING_TRACE_BEGIN;
@@ -340,6 +337,7 @@ static int setting_reset_settings_create(void *cb)
 
        ad->view_layout = view_layout;
        ad->controllbar = controllbar;
+       ad->reset_list = elm_object_part_content_get(scroller, "search_list");
        /* *******************************************update info */
 
        setting_view_reset_settings.is_create = 1;
@@ -425,6 +423,33 @@ static int setting_reset_settings_cleanup(void *cb)
  *general func
  *
  ***************************************************/
+bool __delay_reset_location(void *data)
+{
+       SETTING_TRACE_BEGIN;
+       retv_if(!data, FALSE);
+       Setting_GenGroupItem_Data *item_data = data;
+       int plugin_ret = setting_invoke_reset_function("setting-location-efl", NULL, NULL);
+       SETTING_TRACE("load libug-%s.so[plugin_ret:%d]", "setting-location-efl", plugin_ret);
+       const char *result_str = NULL;
+       if (LOAD_LIB_FAILED == plugin_ret) // -1
+       {
+               result_str = LOAD_LIB_FAILED_STR;
+       
+       } else if (UNDEFINED_LIB_SYMBOL == plugin_ret) // -2
+       {
+               result_str = UNDEFINE_STR;
+       } else if (OPERATE_LIB_SUCESS > plugin_ret){ // 0
+               result_str = RESET_FAILED_STR;
+       
+       } else {
+               return FALSE;
+       }
+       
+       item_data->sub_desc = (char *) g_strdup(_(result_str));
+       elm_object_item_data_set(item_data->item, item_data);
+       elm_genlist_item_update(item_data->item);
+       return FALSE;
+}
 
 static void __reset_an_item(Setting_Done_List_Data *list_data,
                                const char *item_name,
@@ -458,16 +483,27 @@ static void __reset_an_item(Setting_Done_List_Data *list_data,
                                                 NULL, NULL, 0,
                                                 (char *)item_name,
                                                 (char *)result_str, NULL);
-               elm_genlist_item_select_mode_set(elm_genlist_item_append(genlist, &(itc_seperator), NULL, NULL,ELM_GENLIST_ITEM_NONE, NULL, NULL),
-                                                ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
-
        } else
        {
                char *path = get_ug_path_from_ug_args((void *)ug_args);
                service_h svc = get_bundle_from_ug_args((void *)ug_args);
-
-               int plugin_ret = setting_invoke_reset_function(path, svc, NULL);
-               SETTING_TRACE("load libug-%s.so[plugin_ret:%d]", path, plugin_ret);
+               int plugin_ret = OPERATE_LIB_SUCESS;
+               if (!isEmulBin() || 0 != safeStrCmp(KeyStr_Location, item_name)) //KeyStr_Location is too slow to display in emulator
+               {
+                       plugin_ret = setting_invoke_reset_function(path, svc, NULL);
+                       SETTING_TRACE("load libug-%s.so[plugin_ret:%d]", path, plugin_ret);
+               }
+               else
+               {
+                       item_data = setting_create_Gendial_field_def(genlist, &(ad->itc_1text),
+                                                        NULL, ad,
+                                                        SWALLOW_Type_LAYOUT_SPECIALIZTION_X,
+                                                        NULL, NULL, 0,
+                                                        (char *)item_name,
+                                                        (char *)result_str, NULL);
+                       ecore_idler_add((Ecore_Task_Cb) __delay_reset_location, item_data);
+                       return;
+               }
 
                if (LOAD_LIB_FAILED == plugin_ret) // -1
                {
@@ -495,8 +531,6 @@ static void __reset_an_item(Setting_Done_List_Data *list_data,
                                                 NULL, NULL, 0,
                                                 (char *)item_name,
                                                 (char *)result_str, NULL);
-               elm_genlist_item_select_mode_set(elm_genlist_item_append(genlist, &(itc_seperator), NULL, NULL,ELM_GENLIST_ITEM_NONE, NULL, NULL),
-                                                ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
        }
 
        if (item_data)
@@ -518,14 +552,25 @@ static Eina_Bool __reset_animator_cb(void *data)
                        evas_object_del(ad->pop_progress);
                        ad->pop_progress = NULL;
                }
-
+               Evas_Object *btn = elm_object_part_content_get(ad->notify, "button1");
+               if (btn)
+               {
+                       setting_enable_evas_object(btn);
+                       setting_dim_evas_object(btn, FALSE);
+               }
+               
+               Evas_Object *genlist = elm_object_content_get(ad->notify);
+               if(genlist)
+                       elm_genlist_item_show(elm_genlist_first_item_get(genlist), ELM_GENLIST_ITEM_SCROLLTO_TOP);
+               if(ad->reset_list)
+                       elm_genlist_item_show(elm_genlist_first_item_get(ad->reset_list), ELM_GENLIST_ITEM_SCROLLTO_TOP);
                return ECORE_CALLBACK_CANCEL;
        }
        if (ad->list_data.chk_items[ad->gl_index].data_GenItem->chk_status) {
+               elm_genlist_item_show(ad->list_data.chk_items[ad->gl_index].data_GenItem->item, ELM_GENLIST_ITEM_SCROLLTO_IN);//show the last item
                __reset_an_item(&(ad->list_data),
                                ad->list_data.chk_items[ad->gl_index].item_name,
                                ad->list_data.chk_items[ad->gl_index].ug_args);
-
                /*unselect item*/
                elm_check_state_set(ad->list_data.chk_items[ad->gl_index].data_GenItem->eo_check, 0);
                ad->list_data.chk_items[ad->gl_index].data_GenItem->chk_status = 0;
@@ -551,8 +596,6 @@ static void setting_reset_settings_check_state(Setting_Done_List_Data *list_data
        SETTING_TRACE_DEBUG("********resetting*******");
 
        SettingResetUG *ad = (SettingResetUG *) list_data->UG_data;
-
-       //some item must have been selected, or else cannot go into setting_reset_check_state()
        ad->notify = elm_popup_add(ad->win_get);
        elm_object_style_set(ad->notify,"menustyle");
        elm_object_part_text_set(ad->notify, "title,text", _(RESET_RESULT_STR));
@@ -561,6 +604,8 @@ static void setting_reset_settings_check_state(Setting_Done_List_Data *list_data
                                EVAS_HINT_EXPAND);
        Evas_Object *btn = setting_create_button(ad->notify, _("IDS_COM_SK_OK"), NULL, setting_reset_result_popup_resp_cb, ad);
        elm_object_part_content_set(ad->notify, "button1", btn);
+       setting_disable_evas_object(btn);
+       setting_dim_evas_object(btn, TRUE);
 
        Evas_Object *genlist = elm_genlist_add(ad->notify);
        elm_object_style_set(genlist, "dialogue");
@@ -570,18 +615,18 @@ static void setting_reset_settings_check_state(Setting_Done_List_Data *list_data
        evas_object_size_hint_align_set(genlist,
                                EVAS_HINT_FILL,
                                EVAS_HINT_FILL);
-
-       elm_object_content_set(ad->notify, genlist);
-       evas_object_show(ad->notify);
-
-       ad->pop_progress = setting_create_popup_with_progressbar(ad, ad->win_get,
-                                "list_process",
-                                NULL, NULL, NULL, 0, 1, 1);
-
+       /*  add separator */
+       setting_create_Gendial_field_titleItem(genlist,
+                                            &itc_group_item,
+                                            RESET_RESULT_STR,
+                                            NULL);
        //ad->gl_index = 0;
        //ad->animator = ecore_animator_add(__reset_animator_cb, ad);
        //Don't append any item until the popup is fully showed up
        ecore_idler_add((Ecore_Task_Cb) __reset_delay_idler, ad);
+       elm_object_content_set(ad->notify, genlist);
+       elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
+       evas_object_show(ad->notify);
 
        /* reset sel_all item */
        elm_check_state_set(list_data->select_all_checkbox, 0);
@@ -737,7 +782,7 @@ setting_reset_settings_click_softkey_reset_cb(void *data, Evas_Object *obj,
        //int screen_lock_type = 0;
 
        //every time clicking 'Reset' button, restore following VCONFs
-       vconf_set_bool(VCONFKEY_SETAPPL_FONT_CHANGED, FALSE);
+       //vconf_set_bool(VCONFKEY_SETAPPL_FONT_CHANGED, FALSE);
 
        if (ad->list_data.selInfoPop) {
                evas_object_del(ad->list_data.selInfoPop);
index 47dbe2f..7894ac1 100755 (executable)
@@ -163,7 +163,6 @@ static void setting_reset_ug_on_event(ui_gadget_h ug, enum ug_event event,
 #endif
                        }
                }
-
                Evas_Object *sub_layout = elm_object_part_content_get(ad->view_layout, "elm.swallow.contents");
                if (sub_layout)
                {
@@ -171,13 +170,11 @@ static void setting_reset_ug_on_event(ui_gadget_h ug, enum ug_event event,
                        if (select_all_layout) {
                                elm_object_part_text_set(select_all_layout, "elm.text", _(KeyStr_Select_All));
                        }
-
-                       Evas_Object *scroller = elm_object_part_content_get(sub_layout, "search_list");
-                       if (scroller) elm_genlist_realized_items_update(scroller);
-                       SETTING_TRACE("scroller:%p", scroller);
-
                }
 
+               if (ad->reset_list)
+                       elm_genlist_realized_items_update(ad->reset_list);
+
                setting_reset_result_popup_update(ad);
 
                break;
@@ -263,44 +260,12 @@ static void __ask_popup_response_cb(void *data, Evas_Object *obj, void *event_in
        }
 }
 
-void setting_reset_special_process(void *data)
-{
-       SETTING_TRACE_BEGIN;
-       ret_if(!data);
-       SettingResetUG *ad = data;
-
-       char speciliztion[MAX_SPECIALIZITION_LEN] = { 0, };
-
-       int is_font_changed = FALSE;
-       //if failed, is_font_changed keep FALSE
-       vconf_get_bool(VCONFKEY_SETAPPL_FONT_CHANGED, &is_font_changed);
-       if (is_font_changed)
-       {
-               if ('\0' != speciliztion[0]) g_strlcat(speciliztion, _(ADN_STR), MAX_SPECIALIZITION_LEN);
-               g_strlcat(speciliztion, _(KeyStr_Font), MAX_SPECIALIZITION_LEN);
-       }
-       SETTING_TRACE("speciliztion:%s", speciliztion);
-       if ('\0' != speciliztion[0])
-       {
-               g_strlcat(speciliztion, _(CLOSEING_STR), MAX_SPECIALIZITION_LEN);
-
-               ad->ask_popup =
-                   setting_create_popup_with_btn(ad, ad->win_main_layout, NULL, speciliztion,
-                                        __ask_popup_response_cb,
-                                        0, 1,
-                                        _("IDS_COM_SK_OK"));
-       }
-
-}
-
 void setting_reset_result_popup_resp_cb(void *data, Evas_Object *obj, void *event_info)
 {
        SETTING_TRACE_BEGIN;
        ret_if(!data);
        SettingResetUG *ad = data;
        if (btn_type(obj) == POPUP_RESPONSE_OK) {
-
-               setting_reset_special_process(ad);
        }
        if (ad->notify) {
                evas_object_del(ad->notify);
@@ -319,40 +284,19 @@ void setting_reset_result_popup_update(void *data)
        ret_if(!data);
        SettingResetUG *ad = data;
        if (ad->notify) {
-               if (0 != safeStrCmp("menustyle", elm_object_style_get(ad->notify)))
+               elm_object_part_text_set(ad->notify, "title,text", _(RESET_RESULT_STR));
+               Evas_Object *btn = elm_object_part_content_get(ad->notify, "button1");
+               if (btn)
                {
-                       return;
+                       elm_object_text_set(btn, _("IDS_COM_SK_OK"));
                }
                Evas_Object *genlist = elm_object_content_get(ad->notify);
-               evas_object_hide(ad->notify);
-               ad->old_notify = ad->notify;
-
-               ad->notify = elm_popup_add(ad->win_get);
-               elm_object_style_set(ad->notify,"menustyle");
-               //elm_popup_title_label_set(ad->notify, RESET_RESULT_STR);
-               elm_object_part_text_set(ad->notify, "title,text", RESET_RESULT_STR);
-               evas_object_size_hint_weight_set(ad->notify,
-                                       EVAS_HINT_EXPAND,
-                                       EVAS_HINT_EXPAND);
-               //elm_popup_buttons_add(ad->notify,1,
-               //              _("IDS_COM_SK_OK"),
-               //              POPUP_RESPONSE_OK,NULL);
-               Evas_Object *btn = setting_create_button(ad->notify, _("IDS_COM_SK_OK"), NULL, setting_reset_result_popup_resp_cb, ad);
-               elm_object_part_content_set(ad->notify, "button1", btn);
-
-               SETTING_TRACE("genlist:%p", genlist);
-               if (genlist)
+               if(genlist)
                {
                        elm_genlist_realized_items_update(genlist);
                        elm_object_content_set(ad->notify, genlist);
                }
-
-               //evas_object_smart_callback_add(ad->notify,
-               //                      "response",
-               //                      setting_reset_result_popup_resp_cb,
-               //                      ad);
-
-               evas_object_show(ad->notify);
+               //evas_object_show(ad->notify);
        }
 }