[Task-mgr] When icon route is NULL, set the default icon
authormoon87.park <moon87.park@samsung.com>
Wed, 23 Sep 2015 02:21:38 +0000 (11:21 +0900)
committermoon87.park <moon87.park@samsung.com>
Wed, 23 Sep 2015 03:04:13 +0000 (12:04 +0900)
Change-Id: Iaf22aa9966d3d7d5ffb1eca5ebdc9d0dbcf23731

CMakeLists.txt
src/list.c

index 0fe5231..512f3fa 100644 (file)
@@ -30,6 +30,7 @@ pkg_check_modules(pkgs REQUIRED
 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 SET(RESDIR "${PREFIX}/res")
 SET(EDJEDIR "${RESDIR}/edje")
+SET(IMAGEDIR "${RESDIR}/images")
 SET(LOCALEDIR "${RESDIR}/locale")
 
 FOREACH(flag ${pkgs_CFLAGS})
@@ -54,6 +55,7 @@ MESSAGE(${CMAKE_C_FLAGS})
 
 ADD_DEFINITIONS("-DEDJEDIR=\"${EDJEDIR}\"")
 ADD_DEFINITIONS("-DLOCALEDIR=\"${LOCALEDIR}\"")
+ADD_DEFINITIONS("-DIMAGEDIR=\"${IMAGEDIR}\"")
 
 ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
 
index bf0f7d2..dad2c76 100644 (file)
@@ -151,6 +151,7 @@ ERROR:
 
 
 
+#define DEFAULT_ICON IMAGEDIR"/default.png"
 int _get_pkginfo_cb(pkgmgrinfo_appinfo_h app_handle, void *user_data)
 {
        char *appid = NULL;
@@ -183,10 +184,13 @@ int _get_pkginfo_cb(pkgmgrinfo_appinfo_h app_handle, void *user_data)
        if (PMINFO_R_OK != pkgmgrinfo_appinfo_get_icon(app_handle, &icon)) {
                goto ERROR;
        }
-       if (icon) {
+       if (icon && 0 == access(icon, F_OK)) {
                pkg_info->icon= strdup(icon);
-               goto_if(!pkg_info->icon, ERROR);
+       } else {
+               _D("Fail to access icon path");
+               pkg_info->icon = strdup(DEFAULT_ICON);
        }
+       goto_if(!pkg_info->icon, ERROR);
 
        if (PMINFO_R_OK != pkgmgrinfo_appinfo_get_label(app_handle, &name)) {
                goto ERROR;