2 * Copyright (c) 2009-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.
21 #include "_util_log.h"
22 #include "_util_efl.h"
26 static bool app_create(void *user_data)
28 elm_app_base_scale_set(1.8);
29 /* Initialize feedback */
30 feedback_initialize();
32 /* Initialize volume */
33 if(VOLUME_ERROR_OK != volume_control_initialize())
35 _E("Failed to initialize volume");
42 static void app_terminate(void *user_data)
44 /* Deinitialize feedback */
45 feedback_deinitialize();
47 /* Deinitialize volume */
48 volume_control_deinitialize();
51 static void app_pause(void *user_data)
53 if(VOLUME_ERROR_OK != volume_control_pause())
55 _E("Failed to pause volume");
59 static void app_resume(void *user_data)
63 static void app_control(app_control_h service, void *user_data)
66 app_control_to_bundle(service, &b);
68 if(VOLUME_ERROR_OK != volume_control_reset(b))
70 _E("Failed to reset volume");
74 Evas_Object *win = volume_view_win_get();
77 elm_win_activate(win);
81 static void lang_changed(app_event_info_h event_info, void *user_data)
83 _D("language changed");
84 char *locale = vconf_get_str(VCONFKEY_LANGSET);
85 if (locale) elm_language_set(locale);
88 int main(int argc, char *argv[])
92 ui_app_lifecycle_callback_s lifecycle_callback = {0,};
93 app_event_handler_h handlers[5] = {NULL, };
95 lifecycle_callback.create = app_create;
96 lifecycle_callback.terminate = app_terminate;
97 lifecycle_callback.pause = app_pause;
98 lifecycle_callback.resume = app_resume;
99 lifecycle_callback.app_control = app_control;
101 ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, NULL, NULL);
102 ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, NULL, NULL);
103 ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, NULL, NULL);
104 ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, lang_changed, NULL);
105 ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, NULL, NULL);
107 ret = ui_app_main(argc, argv, &lifecycle_callback, NULL);
108 if (ret != APP_ERROR_NONE) {
109 _E("app_main() is failed. err = %d", ret);