2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.1 (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.
17 #include <ui-gadget.h>
18 #include <ui-gadget-module.h>
23 #include <dpl/wrt-dao-ro/WrtDatabase.h>
24 #include <dpl/assert.h>
28 #define EXPORT_SYMBOL extern "C" __attribute__((visibility("default")))
31 WebAppCommonSetting::MainView *mainView;
34 static void *onCreate(ui_gadget_h ug,
35 enum ug_mode /*mode*/,
36 service_h /*service*/,
41 Assert(ug && user_data);
42 priv = static_cast<struct priv *>(user_data);
45 priv->mainView = new WebAppCommonSetting::MainView(ug);
46 if (priv->mainView->loadView())
47 return priv->mainView->getBase();
49 } catch (const std::bad_alloc &) {
54 static void onDestroy(ui_gadget_h /*ug*/,
55 service_h /*service*/,
61 priv = static_cast<struct priv *>(user_data);
62 delete priv->mainView;
63 priv->mainView = NULL;
66 EXPORT_SYMBOL int UG_MODULE_INIT(struct ug_module_ops *ops)
71 priv = static_cast<struct priv *>(calloc(1, sizeof(*priv)));
75 WrtDB::WrtDatabase::attachToThreadRW();
77 memset(ops, 0x00, sizeof(*ops));
79 ops->create = onCreate;
80 ops->destroy = onDestroy;
81 ops->opt = UG_OPT_INDICATOR_ENABLE;
86 EXPORT_SYMBOL void UG_MODULE_EXIT(struct ug_module_ops *ops)
91 priv = static_cast<struct priv *>(ops->priv);
93 delete priv->mainView;
96 WrtDB::WrtDatabase::detachFromThread();