2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include <ui-gadget.h>
19 #include <ui-gadget-module.h>
21 #include <Elementary.h>
25 #include <dpl/wrt-dao-ro/WrtDatabase.h>
26 #include <dpl/wrt-dao-ro/common_dao_types.h>
27 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
31 #define EXPORT_SYMBOL extern "C" __attribute__((visibility("default")))
34 WebAppDetailSetting::MainView *mainView;
37 static void *onCreate(ui_gadget_h ug,
38 enum ug_mode /*mode*/,
43 WrtDB::TizenAppId appID;
46 Assert(ug && user_data);
47 priv = static_cast<struct priv *>(user_data);
49 service_get_extra_data(service, "pkg_name", &pkgname);
53 appID = WrtDB::WidgetDAOReadOnly::getTzAppId((DPL::FromASCIIString
54 (std::string(pkgname))));
58 priv->mainView = new WebAppDetailSetting::MainView(ug, appID);
59 return priv->mainView->loadView();
60 } catch (const std::bad_alloc &) {
65 static void onDestroy(ui_gadget_h /*ug*/,
66 service_h /*service*/,
72 priv = static_cast<struct priv *>(user_data);
73 delete priv->mainView;
74 priv->mainView = NULL;
77 EXPORT_SYMBOL int UG_MODULE_INIT(struct ug_module_ops *ops)
82 priv = static_cast<struct priv *>(calloc(1, sizeof(*priv)));
86 WrtDB::WrtDatabase::attachToThreadRW();
87 //AceDB::AceDAOReadOnly::attachToThreadRW();
89 memset(ops, 0x00, sizeof(*ops));
91 ops->create = onCreate;
92 ops->destroy = onDestroy;
93 ops->opt = UG_OPT_INDICATOR_ENABLE;
98 EXPORT_SYMBOL void UG_MODULE_EXIT(struct ug_module_ops *ops)
103 priv = static_cast<struct priv *>(ops->priv);
105 delete priv->mainView;
108 //AceDB::AceDAOReadOnly::detachFromThread();
109 WrtDB::WrtDatabase::detachFromThread();