Appmanager(pkginfo view) 79/107879/1
authorRadek Kintop <r.kintop@samsung.com>
Fri, 30 Dec 2016 10:46:29 +0000 (11:46 +0100)
committerRadek Kintop <r.kintop@samsung.com>
Fri, 30 Dec 2016 10:46:29 +0000 (11:46 +0100)
- fixed glitch due to package size calculation
- fixed glitch due to force close/uninstall buttons redraw

Change-Id: I79c58093c40e4eb79dec6f5943999a4586174a36
Signed-off-by: Radek Kintop <r.kintop@samsung.com>
setting-appmgr/include/setting-appmgr.h
setting-appmgr/src/setting-appmgr-pkginfo.c

index fcb39005087ccda0414edfbfde2b2860769c8f05..20c454ae3ac4ccf06122e1dbe3381c35b210cd22 100755 (executable)
@@ -153,6 +153,10 @@ typedef struct {
        setting_view *pkginfo_view;
        Ecore_Timer *pkginfo_getsize_timer;
        /* Items of package_info_gl that need to be updated: */
+       Elm_Object_Item *icon_name_version_item;
+       /* this is complex item: */
+       Evas_Object *force_close_button;
+       Evas_Object *uninstall_button;
        Elm_Object_Item *total_size_item;
        Elm_Object_Item *app_size_item;
        Elm_Object_Item *data_size_item;
index f0a1fb877adccc6b0fbb5763b0101ff4e5761a24..5e2d54d0f3003eb7986723d6519d3c7cdf32125f 100644 (file)
@@ -70,6 +70,7 @@ static int _view_update(void *data);
 static int _view_cleanup(void *data);
 
 /* Genlist items classes functions: */
+static void _setup_force_close_uninstall_buttons(SettingAppMgr *ad);
 static char *_move_to_sd_item_text_get(void *data, Evas_Object *obj,
                                                const char *part);
 static char *_clear_cache_text_get(void *data, Evas_Object *obj,
@@ -257,7 +258,7 @@ static void _pkginfo_append_genlist(SettingAppMgr *ad)
        SETTING_TRACE_BEGIN;
        Elm_Object_Item *item = NULL;
        /* Title (pkg name, version S) */
-       item = elm_genlist_item_append(ad->package_info_gl,
+       ad->icon_name_version_item = elm_genlist_item_append(ad->package_info_gl,
                                &ad->itc_icon_name_version, &ad->selected_pkg,
                                NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
        elm_genlist_item_select_mode_set(item,
@@ -330,7 +331,7 @@ static int _view_create(void *data)
 
        _pkginfo_append_genlist(ad);
 
-       ad->pkginfo_getsize_timer = ecore_timer_add(8.0,
+       ad->pkginfo_getsize_timer = ecore_timer_add(2.0,
                                                _pkginfo_size_timer_cb, ad);
 
        setting_view_appmgr_pkginfo.is_create = 1;
@@ -346,6 +347,9 @@ static int _view_destroy(void *data)
 
        retv_if(!data, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
 
+       ad->icon_name_version_item = NULL;
+       ad->force_close_button = NULL;
+       ad->uninstall_button = NULL;
        ad->total_size_item = NULL;
        ad->app_size_item = NULL;
        ad->data_size_item = NULL;
@@ -408,7 +412,6 @@ static int _view_update(void *data)
                                                &ad->selected_pkg.package_info);
        }
 
-       elm_genlist_realized_items_update(ad->package_info_gl);
        /* free package data: */
        free(ad->selected_pkg.pkg_version);
        ad->selected_pkg.pkg_version = NULL;
@@ -443,6 +446,9 @@ static int _view_update(void *data)
                return -1;
        }
 
+       elm_genlist_item_update(ad->icon_name_version_item);
+       _setup_force_close_uninstall_buttons(ad);
+
        _pkginfo_append_privilege(ad);
 
        return SETTING_RETURN_SUCCESS;
@@ -594,8 +600,7 @@ static int _get_package_information(SettingAppMgr *ad)
        pkg->pkg_total_size = -1;
        pkg->pkg_cached_data_size = -1;
        pkg->pkg_user_data_size = -1;
-       package_manager_get_package_size_info(pkg->id,
-                                               _size_info_receive_cb, ad);
+
        pkg->is_preloaded = false;
        package_info_is_preload_package(pkg->package_info, &pkg->is_preloaded);
 
@@ -884,16 +889,10 @@ static int __package_move_finished2(uid_t target_uid, int req_id,
 Evas_Object *pkginfo_force_close_dis_uninst_content_get(
                void *data, Evas_Object *genlist, const char *part)
 {
-       bool running_flag = false;
-       int ret = 0;
        SettingAppMgr *ad = data;
        SettingAppMgr_PkgInfo *pkg = NULL;
-       Eina_List *cur = NULL;
-       const char *appid = NULL;
        int h = 0;
        Evas_Object *box = NULL;
-       Evas_Object *button1 = NULL;
-       Evas_Object *button2 = NULL;
 
        setting_retvm_if(ad == NULL, NULL, "Data parameter is NULL");
        pkg = &ad->selected_pkg;
@@ -904,52 +903,19 @@ Evas_Object *pkginfo_force_close_dis_uninst_content_get(
        elm_box_horizontal_set(box, EINA_TRUE);
        elm_box_align_set(box, 0.0, 0.5);
 
-       /* Check if have running app */
-       EINA_LIST_FOREACH(pkg->apps_in_package, cur, appid) {
-               if (!appid)
-                       continue;
-               ret = app_manager_is_running(appid, &running_flag);
-               if (APP_MANAGER_ERROR_NONE != ret)
-                       continue;
-               if (running_flag) {
-                       SETTING_TRACE_DEBUG(
-                               "Found running app :%s in package %s", appid,
-                               pkg->id);
-                       break;
-               }
-       }
        /* Force close button */
-       button1 = setting_create_button(box, _("Force close"),
-                                       NULL, _force_close_cb, pkg);
-
-       elm_object_disabled_set(button1, !running_flag);
+       ad->force_close_button = setting_create_button(box, _("Force close"),
+                                                                                               NULL, _force_close_cb, pkg);
 
        /* Disable/Enable button */
-       button2 = setting_create_button(box, _("IDS_ST_BUTTON_DISABLE_ABB"),
-                               NULL, NULL, pkg);
-       elm_object_disabled_set(button2, EINA_TRUE);
+       ad->uninstall_button = setting_create_button(box,
+                                                       _("IDS_ST_BUTTON_DISABLE_ABB"), NULL, NULL, pkg);
 
-       if (pkg->is_disable_supported) {
-               if (pkg->is_disabled) {
-                       evas_object_smart_callback_add(button2, "clicked",
-                                                       _enable_cb, pkg);
-                       elm_object_text_set(button2, _("IDS_ST_BUTTON_ENABLE_ABB3"));
-               } else {
-                       evas_object_smart_callback_add(button2, "clicked",
-                                                       _disable_cb, pkg);
-               }
-               elm_object_disabled_set(button2, EINA_FALSE);
+       _setup_force_close_uninstall_buttons(ad);
 
-       } else if (pkg->is_removable) {
-               elm_object_text_set(button2, _("IDS_ST_BUTTON_UNINSTALL"));
-               evas_object_smart_callback_add(button2, "clicked",
-                                               _uninstall_cb, ad);
-               elm_object_disabled_set(button2, EINA_FALSE);
-       }
-
-       elm_box_pack_end(box, button1);
-       elm_box_pack_end(box, button2);
-       evas_object_size_hint_min_get(button1, NULL, &h);
+       elm_box_pack_end(box, ad->force_close_button);
+       elm_box_pack_end(box, ad->uninstall_button);
+       evas_object_size_hint_min_get(ad->force_close_button, NULL, &h);
        evas_object_size_hint_min_set(box, 0, h);
 
        return box;
@@ -996,6 +962,58 @@ Evas_Object *pkginfo_icon_name_ver_content_get(void *data, Evas_Object *genlist,
        return icon;
 }
 
+static void _setup_force_close_uninstall_buttons(SettingAppMgr *ad)
+{
+       bool running_flag = false;
+       int ret = 0;
+       SettingAppMgr_PkgInfo *pkg = NULL;
+       Eina_List *cur = NULL;
+       const char *appid = NULL;
+
+
+       pkg = &ad->selected_pkg;
+
+
+       /* Check if have running app */
+       EINA_LIST_FOREACH(pkg->apps_in_package, cur, appid) {
+               if (!appid)
+                       continue;
+               ret = app_manager_is_running(appid, &running_flag);
+               if (APP_MANAGER_ERROR_NONE != ret)
+                       continue;
+               if (running_flag) {
+                       SETTING_TRACE_DEBUG(
+                               "Found running app :%s in package %s", appid,
+                               pkg->id);
+                       break;
+               }
+       }
+
+       elm_object_disabled_set(ad->force_close_button, !running_flag);
+
+       /* Disable/Enable button */
+       elm_object_disabled_set(ad->uninstall_button, EINA_TRUE);
+
+       if (pkg->is_disable_supported) {
+               if (pkg->is_disabled) {
+                       evas_object_smart_callback_add(ad->uninstall_button, "clicked",
+                                                                               _enable_cb, pkg);
+                       elm_object_text_set(ad->uninstall_button,
+                                                               _("IDS_ST_BUTTON_ENABLE_ABB3"));
+               } else {
+                       evas_object_smart_callback_add(ad->uninstall_button, "clicked",
+                                                                                       _disable_cb, pkg);
+               }
+               elm_object_disabled_set(ad->uninstall_button, EINA_FALSE);
+
+       } else if (pkg->is_removable) {
+               elm_object_text_set(ad->uninstall_button, _("IDS_ST_BUTTON_UNINSTALL"));
+               evas_object_smart_callback_add(ad->uninstall_button, "clicked",
+                                                                               _uninstall_cb, ad);
+               elm_object_disabled_set(ad->uninstall_button, EINA_FALSE);
+       }
+}
+
 static char *_move_to_sd_item_text_get(void *data, Evas_Object *obj,
                                                const char *part)
 {