2 * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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 <Elementary.h>
21 #include <ui-gadget.h>
22 #include <app_define.h>
23 #include <app_debug.h>
36 static bool _create(void *data)
42 _ERR("Get data failed.");
47 elm_app_base_scale_set(APP_BASE_SCALE);
49 elm_theme_overlay_add(NULL, THEMEFILE);
51 win = utils_add_window(ad->name);
53 _ERR("Add window failed.");
57 if (ug_init_efl(win, UG_OPT_INDICATOR_ENABLE) < 0) {
58 _ERR("Fail to init ug");
63 if (!viewmgr_create(win)) {
64 _ERR("Create viewmgr failed.");
69 if (!viewmgr_add_view(view_base_get_vclass(), NULL)) {
70 _ERR("Add view failed.");
76 if (!viewmgr_add_view(view_action_menu_get_vclass(), NULL)) {
77 _ERR("Add view faild.");
83 if (!viewmgr_add_view(view_pin_get_vclass(), NULL)) {
84 _ERR("Add view faild.");
95 static void _terminate(void *data)
100 _ERR("Get data failed.");
106 evas_object_del(ad->win);
110 viewmgr_remove_view(VIEW_BASE);
111 viewmgr_remove_view(VIEW_ACTION_MENU);
112 viewmgr_remove_view(VIEW_PIN);
116 static void _app_control(app_control_h control, void *data)
123 _ERR("Get data failed.");
129 elm_win_activate(ad->win);
131 r = app_control_get_extra_data(control, PARAM_CATEGORY, &category);
132 if (r != APP_CONTROL_ERROR_NONE)
136 viewmgr_update_view(VIEW_BASE, UPDATE_MENU, category);
138 if (!viewmgr_push_view(VIEW_BASE))
139 _ERR("Push view failed.");
142 static void _pause(void *data)
146 state = viewmgr_get_view_state(VIEW_ACTION_MENU);
147 if (state == VIEW_STATE_VISIBLE)
148 viewmgr_hide_view(VIEW_ACTION_MENU);
150 state = viewmgr_get_view_state(VIEW_PIN);
151 if (state == VIEW_STATE_VISIBLE)
152 viewmgr_hide_view(VIEW_PIN);
154 inputmgr_enable(EINA_FALSE);
157 static void _resume(void *data)
159 inputmgr_enable(EINA_TRUE);
162 int main(int argc, char *argv[])
165 ui_app_lifecycle_callback_s cbs = {
167 .terminate = _terminate,
168 .app_control = _app_control,
173 memset(&ad, 0x00, sizeof(ad));
176 return ui_app_main(argc, argv, &cbs, &ad);