Add <category> tag parsing in tpk manifest 47/59047/2
authorTomasz Iwanek <t.iwanek@samsung.com>
Tue, 9 Feb 2016 09:00:56 +0000 (10:00 +0100)
committerTomasz Iwanek <t.iwanek@samsung.com>
Thu, 11 Feb 2016 16:31:17 +0000 (08:31 -0800)
Requires:
 - https://review.tizen.org/gerrit/59040

Change-Id: If3ebcd9f126d2f165a3820249b321054eb63c12f

src/common/step/step_parse_manifest.cc
src/common/step/step_parse_manifest.h

index 2bbdae9..0285a3e 100644 (file)
@@ -305,6 +305,8 @@ bool StepParseManifest::FillWidgetApplication(manifest_x* manifest) {
       return false;
     if (!FillImage(widget_app, application.app_images))
       return false;
+    if (!FillCategories(widget_app, application.categories))
+      return false;
     if (!FillMetadata(widget_app, application.meta_data))
       return false;
   }
@@ -365,6 +367,8 @@ bool StepParseManifest::FillServiceApplication(manifest_x* manifest) {
       return false;
     if (!FillMetadata(service_app, application.meta_data))
       return false;
+    if (!FillCategories(service_app, application.categories))
+      return false;
     if (!FillBackgroundCategoryInfo(service_app,
         application.background_category))
       return false;
@@ -441,6 +445,8 @@ bool StepParseManifest::FillUIApplication(manifest_x* manifest) {
       return false;
     if (!FillMetadata(ui_app, application.meta_data))
       return false;
+    if (!FillCategories(ui_app, application.categories))
+      return false;
     if (!FillBackgroundCategoryInfo(ui_app, application.background_category))
       return false;
   }
@@ -548,6 +554,16 @@ bool StepParseManifest::FillMetadata(application_x* app,
   return true;
 }
 
+template <typename T>
+bool StepParseManifest::FillCategories(application_x* manifest,
+                                     const T& categories) {
+  for (auto& category : categories) {
+    manifest->category = g_list_append(manifest->category,
+                                       strdup(category.c_str()));
+  }
+  return true;
+}
+
 bool StepParseManifest::FillImage(application_x* app,
                           const tpk::parse::ApplicationImagesInfo& image_list) {
   for (auto& app_image : image_list.images) {
index 4a8dfb7..c6284ec 100644 (file)
@@ -80,6 +80,8 @@ class StepParseManifest : public common_installer::Step {
       bool FillLabel(application_x* manifest, const T& label_list);
   template <typename T>
       bool FillMetadata(application_x* manifest, const T& meta_data_list);
+  template <typename T>
+      bool FillCategories(application_x* manifest, const T& meta_data_list);
   bool FillImage(application_x* app,
                  const tpk::parse::ApplicationImagesInfo& label_list);
   bool FillAccounts();