2 * Copyright (c) 2014 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.
17 #include <AppCommon.h>
19 #include "source_mgr.h"
20 #include "allsource_view.h"
21 #include "menu_view.h"
24 SET_TAG("source-list");
26 static Evas_Object *_add_win(const char *name)
30 win = elm_win_util_standard_add(name, NULL);
32 _ERR("failed to create window!");
36 elm_win_title_set(win, name);
37 elm_win_focus_highlight_style_set(win, "invisible");
38 elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
40 evas_object_show(win);
46 static Evas_Object *_add_bg(Evas_Object *win)
53 bg = elm_layout_add(win);
57 elm_layout_file_set(bg, EDJ_FILE, GRP_BG);
59 evas_object_size_hint_weight_set(bg,
60 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
62 elm_win_resize_object_add(win, bg);
70 class CApp : public CBaseApp {
75 CAllSourceView *pAllSourceView;
82 virtual bool OnCreate(void)
87 elm_theme_overlay_add(NULL, EDJ_THEME);
89 m_win = _add_win(PACKAGE);
93 if (!CViewMgr::Initialize(m_win, NULL)) {
94 evas_object_del(m_win);
99 pAllSourceView = new CAllSourceView(ALLSOURCE_VIEW);
100 pMenuView = new CMenuView(MENU_VIEW);
102 CViewMgr::GetInstance()->AddView(pAllSourceView);
103 CViewMgr::GetInstance()->AddView(pMenuView);
105 m_bg = _add_bg(m_win);
110 virtual void OnTerminate(void)
115 CViewMgr::Finalize();
117 delete pAllSourceView;
120 evas_object_del(m_bg);
121 evas_object_del(m_win);
125 virtual void OnAppControl(app_control_h app_control)
130 enum launch_mode lmode;
137 ret = app_control_get_extra_data(app_control, "mode", &mode);
138 if (ret == APP_CONTROL_ERROR_NONE) {
139 if (!strcmp(mode, "plugged"))
141 else if (!strcmp(mode, "nearby"))
147 if (!CViewMgr::GetInstance()->PushView(ALLSOURCE_VIEW, (void *)lmode)) {
148 _ERR("push view error.");
153 virtual int Run(int argc, char **argv)
156 return CBaseApp::Run(argc, argv);
160 int main(int argc, char **argv)