Use GList in manifest_x structures
[platform/core/appfw/app-installers.git] / src / common / step / step_recover_icons.cc
index aaf2dfd..37591bb 100644 (file)
@@ -9,8 +9,8 @@
 #include <pkgmgr-info.h>
 
 #include "common/backup_paths.h"
-#include "common/utils/clist_helpers.h"
 #include "common/utils/file_util.h"
+#include "common/utils/glist_range.h"
 
 namespace bf = boost::filesystem;
 namespace bs = boost::system;
@@ -54,19 +54,19 @@ Step::Status StepRecoverIcons::RecoveryUpdate() {
 bool StepRecoverIcons::TryGatherIcons() {
   if (!context_->manifest_data.get())
     return false;
-  application_x* app = nullptr;
-  PKGMGR_LIST_MOVE_NODE_TO_HEAD(context_->manifest_data.get()->application,
-                                app);
-  for (; app != nullptr; app = app->next) {
+  for (application_x* app :
+       GListRange<application_x*>(context_->manifest_data.get()->application)) {
     if (strcmp(app->component_type, "uiapp") != 0)
       continue;
 
     bf::path app_icon = bf::path(getIconPath(context_->uid.get()))
       / bf::path(app->appid);
-    if (app->icon && app->icon->text)
-      app_icon += bf::path(app->icon->text).extension();
-    else
+    if (app->icon) {
+      icon_x* icon = reinterpret_cast<icon_x*>(app->icon->data);
+      app_icon += bf::path(icon->text).extension();
+    } else {
       app_icon += ".png";
+    }
     bf::path icon_backup = GetBackupPathForIconFile(app_icon);
     if (bf::exists(icon_backup) || bf::exists(app_icon))
         icons_.emplace_back(app_icon, icon_backup);