Put metadata of app-widget into application_x 28/88628/2 accepted/tizen/common/20160922.120318 accepted/tizen/ivi/20160922.233116 accepted/tizen/mobile/20160922.233052 accepted/tizen/tv/20160922.233110 accepted/tizen/wearable/20160922.233104 submit/tizen/20160922.003440
authorJunghyun Yeon <jungh.yeon@samsung.com>
Tue, 20 Sep 2016 05:05:29 +0000 (14:05 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Wed, 21 Sep 2016 05:12:14 +0000 (14:12 +0900)
Put metadata of app-widget at parsing time to
Insert it into app metadata db

Change-Id: I877fabfc4f324439344632a0a4909b9fe07a7b81
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
src/wgt/step/configuration/step_parse.cc

index 33bb0b2..914bbc3 100644 (file)
@@ -70,6 +70,21 @@ GList* GenerateMetadataListX(const wgt::parse::MetaDataInfo& meta_info) {
   return list;
 }
 
+void AppendWidgetMetadata(GList** metadatas,
+    const std::vector<std::pair<std::string, std::string>> metadata) {
+  GList* list = *metadatas;
+  for (auto& meta : metadata) {
+    metadata_x* new_meta = static_cast<metadata_x*>(calloc(1, sizeof(metadata_x)));
+    new_meta->key = strdup(meta.first.c_str());
+    if (!meta.second.empty())
+      new_meta->value = strdup(meta.second.c_str());
+
+    list = g_list_append(list, new_meta);
+  }
+
+  *metadatas = list;
+}
+
 void SetApplicationXDefaults(application_x* application) {
   application->effectimage_type = strdup("image");
   application->enabled = strdup("true");
@@ -433,6 +448,9 @@ bool StepParse::FillWidgetApplicationInfo(manifest_x* manifest) {
       application->icon = g_list_append(application->icon, icon);
     }
 
+    if (!app_widget.metadata.empty())
+      AppendWidgetMetadata(&application->metadata, app_widget.metadata);
+
     manifest->application = g_list_append(manifest->application, application);
   }
   return true;