2 * Copyright (c) 2009-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.
19 #include <app_control_internal.h>
21 #include <app_common.h>
24 #include "_util_log.h"
25 #include "_util_efl.h"
29 static bool _create_app(void *user_data);
30 static void _terminate_app(void *user_data);
31 static void _pause_app(void *user_data);
32 static void _resume_app(void *user_data);
33 static void _control_app(app_control_h service, void *user_data);
34 static void _changed_language(app_event_info_h event_info, void *user_data);
36 int main(int argc, char *argv[])
40 ui_app_lifecycle_callback_s lifecycle_callback = {0,};
41 app_event_handler_h handlers[5] = {NULL, };
43 lifecycle_callback.create = _create_app;
44 lifecycle_callback.terminate = _terminate_app;
45 lifecycle_callback.pause = _pause_app;
46 lifecycle_callback.resume = _resume_app;
47 lifecycle_callback.app_control = _control_app;
49 ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, NULL, NULL);
50 ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, NULL, NULL);
51 ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, NULL, NULL);
52 ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, _changed_language, NULL);
53 ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, NULL, NULL);
55 ret = ui_app_main(argc, argv, &lifecycle_callback, NULL);
56 if (ret != APP_ERROR_NONE)
57 _E("app_main() is failed. err = %d", ret);
62 static bool _create_app(void *user_data)
64 elm_app_base_scale_set(1.8);
65 /* Initialize feedback */
66 feedback_initialize();
68 /* Initialize volume */
69 if (VOLUME_ERROR_OK != volume_control_initialize()) {
70 _E("Failed to initialize volume");
77 static void _terminate_app(void *user_data)
79 /* Deinitialize feedback */
80 feedback_deinitialize();
82 /* Deinitialize volume */
83 volume_control_deinitialize();
86 static void _pause_app(void *user_data)
88 if (VOLUME_ERROR_OK != volume_control_pause())
89 _E("Failed to pause volume");
92 static void _resume_app(void *user_data)
96 static void _control_app(app_control_h service, void *user_data)
99 app_control_to_bundle(service, &b);
101 if (VOLUME_ERROR_OK != volume_control_reset(b)) {
102 _E("Failed to reset volume");
106 Evas_Object *win = volume_view_win_get();
108 elm_win_activate(win);
111 static void _changed_language(app_event_info_h event_info, void *user_data)
113 _D("language changed");
114 char *locale = vconf_get_str(VCONFKEY_LANGSET);
116 elm_language_set(locale);