From 7d25dfa68256fa89555364e8f62cb86d7e6d811f Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Tue, 20 Sep 2016 14:05:29 +0900 Subject: [PATCH] Put metadata of app-widget into application_x Put metadata of app-widget at parsing time to Insert it into app metadata db Change-Id: I877fabfc4f324439344632a0a4909b9fe07a7b81 Signed-off-by: Junghyun Yeon --- src/wgt/step/configuration/step_parse.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/wgt/step/configuration/step_parse.cc b/src/wgt/step/configuration/step_parse.cc index 33bb0b2..914bbc3 100644 --- a/src/wgt/step/configuration/step_parse.cc +++ b/src/wgt/step/configuration/step_parse.cc @@ -70,6 +70,21 @@ GList* GenerateMetadataListX(const wgt::parse::MetaDataInfo& meta_info) { return list; } +void AppendWidgetMetadata(GList** metadatas, + const std::vector> metadata) { + GList* list = *metadatas; + for (auto& meta : metadata) { + metadata_x* new_meta = static_cast(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; -- 2.7.4