Storage 74/109274/2
authorRadek Kintop <r.kintop@samsung.com>
Mon, 9 Jan 2017 15:20:45 +0000 (16:20 +0100)
committerRadek Kintop <r.kintop@samsung.com>
Mon, 9 Jan 2017 16:48:02 +0000 (17:48 +0100)
- More menu will be unavailable when there is no app on the list
- 'Computing...' text added while waiting for app size calculation
- Select all mechanism fixed
- Miscellaneous delete mode is restored on app resume

Change-Id: I566351fd3e4835658de0bb40e7a0dbee006550d3
Signed-off-by: Radek Kintop <r.kintop@samsung.com>
setting-storage/src/setting-storage-applications-utils.c
setting-storage/src/setting-storage-applications.c
setting-storage/src/setting-storage-miscellaneous.c
setting-storage/src/setting-storage-utils.c

index 6b0632ddbe13145f9648ba1b8a3ad3c444aafeb0..68d81c5f92d49a6c9f50cf66e94d4a4269365f9f 100644 (file)
@@ -187,7 +187,6 @@ void storage_apps_get_node_info(package_info_h handle, Node_Info *info)
 {
        int ret = 0;
        char *value = NULL;
-       char desc[64] = { 0 };
        ret_if(NULL == handle);
        ret_if(NULL == info);
 
@@ -210,9 +209,7 @@ void storage_apps_get_node_info(package_info_h handle, Node_Info *info)
        info->added_time = ecore_file_mod_time(info->l_icon);
 
        info->total_size = 0;
-       size_to_str(info->total_size, desc, sizeof(desc));
-       info->size_str = strdup(desc);
-
+       info->size_str = strdup(_(IDS_ST_BODY_COMPUTING_ING));
 }
 
 void node_get_size_cb(const char *package_id, const package_size_info_h size_info,
index d1e70de3a3f2c10e5649038f79f5fda37e907a2b..eca2188d43994e2e6be23cd9d6519fa378b8c54e 100755 (executable)
@@ -210,7 +210,7 @@ static void _show_more_menu_cb(void *data, Evas_Object *obj,
        SETTING_TRACE_BEGIN;
        SettingStorage *ad = (SettingStorage *)data;
 
-       ret_if(!ad || ad->select_mode);
+       ret_if(!ad || ad->select_mode || ad->count_sz_all <= 0);
        evas_object_show(ad->main_menu_popup);
 }
 
@@ -323,8 +323,7 @@ static void storage_misces_handle_selecting(SettingStorage *ad)
        else
                ad->misces_is_select_all = EINA_FALSE;
 
-       if (was_select_all != ad->misces_is_select_all
-                       && ad->misces_ctx_popup_selected) {
+       if (was_select_all != ad->misces_is_select_all) {
                gl = ad->misces_genlist;
                it = elm_genlist_first_item_get(gl);
                if (it) {
@@ -451,7 +450,7 @@ static void storage_apps_gl_append_items(SettingStorage *ad)
                                ecore_timer_del(node->size_idler);
                                node->size_idler = NULL;
                        }
-                       node->size_idler = ecore_timer_add(0.6,
+                       node->size_idler = ecore_timer_add(2.0,
                                        (Ecore_Task_Cb)__get_size_on_time,
                                        node);
                } else {
index e3b609acfb4afd75ad12ac343821b7e9e7f8067d..091373a067e892dfa15fc8a73d4cb65adc45a914 100755 (executable)
@@ -27,7 +27,6 @@
 #define STR_DELETE_ITEMS       "IDS_ST_HEADER_DELETE_ITEMS_ABB2"
 
 static int __view_create(void *data);
-static int __view_update(void *data);
 static int __view_cleanup(void *data);
 static int __view_destroy(void *data);
 static void __gl_remove_select_all_item(SettingStorage *ad);
@@ -56,7 +55,7 @@ void storage_misc_init(SettingStorage *ad)
 
        setting_view_storage_misc.create = __view_create;
        setting_view_storage_misc.destroy = __view_destroy;
-       setting_view_storage_misc.update = __view_update;
+       setting_view_storage_misc.update = NULL;
        setting_view_storage_misc.cleanup = __view_cleanup;
        ad->sort_type = BY_SIZE;
        ad->misces_view = &setting_view_storage_misc;
@@ -841,16 +840,6 @@ static int __view_destroy(void *data)
        return SETTING_RETURN_SUCCESS;
 }
 
-static int __view_update(void *data)
-{
-       SettingStorage *ad = data;
-
-       retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
-
-       __update_ui_list(ad);
-       return SETTING_RETURN_SUCCESS;
-}
-
 static int __view_cleanup(void *data)
 {
        return __view_destroy(data);
index 41b39d70f6286b0a700072eef445ba738ff945ff..f56f79635a32b77a2e037510fcecfbe1a6b80937 100755 (executable)
@@ -20,6 +20,7 @@
 #include <storage.h>
 #include <media_content.h>
 #include <tzplatform_config.h>
+#include <package_manager.h>
 
 #include "setting-storage-async-worker.h"
 #include "setting-storage-utils.h"
@@ -301,21 +302,26 @@ int storage_get_internal_detail(SettingStorage *ad)
        return SETTING_RETURN_SUCCESS;
 }
 
-static void storage_get_app_cache_size_cb(pkgmgr_client *pc,
-               const pkg_size_info_t *size_info, void *user_data)
+static void storage_get_app_cache_size_cb(const package_size_info_h size_info,
+                                                                                       void *user_data)
 {
        SETTING_TRACE_BEGIN;
+       long long cache_size = 0;
+       long long app_size = 0;
+       long long ext_cache_size = 0;
+       long long ext_app_size = 0;
        setting_retm_if(NULL == user_data, "user_data is NULL");
        setting_retm_if(NULL == size_info, "size_info is NULL");
 
-
-       /*char * path = app_get_cache_path(); */
-       /*SETTING_TRACE_DEBUG("cache path:%s",path); */
-
        SettingStorage *ad = user_data;
 
-       ad->sz_apps = (double)(size_info->app_size + size_info->ext_app_size);
-       ad->sz_caches = (double)(size_info->cache_size + size_info->ext_cache_size);
+       package_size_info_get_app_size(size_info, &app_size);
+       package_size_info_get_external_app_size(size_info, &ext_app_size);
+       package_size_info_get_cache_size(size_info, &cache_size);
+       package_size_info_get_external_cache_size(size_info, &ext_cache_size);
+
+       ad->sz_apps = (double)(app_size + ext_app_size);
+       ad->sz_caches = (double)(cache_size + ext_cache_size);
 
        SETTING_TRACE_DEBUG("size_info->app_size : %ld", ad->sz_apps);
        SETTING_TRACE_DEBUG("ad->sz_caches:%lf", ad->sz_caches);
@@ -326,7 +332,6 @@ static void storage_get_app_cache_size_cb(pkgmgr_client *pc,
        ret_if(!ad->graph_genlist_it);
        elm_genlist_item_update(ad->graph_genlist_it);
 
-       pkgmgr_client_free(ad->pc_total_size);
        ad->pc_total_size = NULL;
        SETTING_TRACE_END;
 }
@@ -346,12 +351,12 @@ void storage_update_apps_cache_info(SettingStorage *ad)
                SETTING_TRACE_ERROR("pkgmgr_client_new() Fail");
                return;
        }
+       ret = package_manager_get_total_package_size_info(
+                                                                                       storage_get_app_cache_size_cb, ad);
 
-       ret = pkgmgr_client_get_total_package_size_info(ad->pc_total_size,
-                       storage_get_app_cache_size_cb, ad);
-
-       setting_retm_if(ret, "pkgmgr_client_get_total_package_size_info() Fail(%d)", ret);
-
+       setting_retm_if(PACKAGE_MANAGER_ERROR_NONE != ret,
+                               "package_manager_get_total_package_size_info() Fail(%s)",
+                               get_error_message(ret));
 }