/* * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an AS IS BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include #include #include "define.h" #include "utils.h" #include "view.h" SET_TAG(PACKAGE); struct _appdata { Evas_Object *win; const char *name; }; static bool _create(void *data) { struct _appdata *ad; Evas_Object *win; if (!data) { _ERR("Get data failed."); return false; } ad = data; elm_theme_overlay_add(NULL, THEMEFILE); win = utils_add_window(ad->name); if (!win) { _ERR("Add window failed."); return false; } if (!viewmgr_create(win)) { _ERR("Create viewmgr failed."); evas_object_del(win); return false; } if (!viewmgr_add_view(view_base_get_vclass(), NULL)) { _ERR("Add view failed."); viewmgr_destroy(); evas_object_del(win); return false; } if (!viewmgr_add_view(view_action_menu_get_vclass(), NULL)) { _ERR("Add view faild."); viewmgr_destroy(); evas_object_del(win); return false; } ad->win = win; return true; } static void _terminate(void *data) { struct _appdata *ad; if (!data) { _ERR("Get data failed."); return; } ad = data; if (ad->win) { evas_object_del(ad->win); ad->win = NULL; } viewmgr_remove_view(VIEW_BASE); viewmgr_remove_view(VIEW_ACTION_MENU); viewmgr_destroy(); } static void _app_control(app_control_h control, void *data) { struct _appdata *ad; if (!data) { _ERR("Get data failed."); return; } ad = data; if (ad->win) elm_win_activate(ad->win); if (!viewmgr_push_view(VIEW_BASE)) _ERR("Push view failed."); } int main(int argc, char *argv[]) { struct _appdata ad; ui_app_lifecycle_callback_s cbs = { .create = _create, .terminate = _terminate, .app_control = _app_control, }; memset(&ad, 0x00, sizeof(ad)); ad.name = PACKAGE; return ui_app_main(argc, argv, &cbs, &ad); }