Remove obsolete codes
[platform/core/uifw/inputmethod-setting.git] / im_setting_selector / input_method_setting_selector.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17 #include <app.h>
18 #include <unistd.h>
19 #include <vconf-keys.h>
20 #include <vconf.h>
21 #include "input_method_setting_selector.h"
22 #include "input_method_setting_selector_ui.h"
23
24 static bool
25 app_create(void *data)
26 {
27     LOGD("");
28     /* Hook to take necessary actions before main event loop starts
29        Initialize UI resources and application's data
30        If this function returns true, the main loop of application starts
31        If this function returns false, the application is terminated */
32
33     return true;
34 }
35
36 static void
37 app_control(app_control_h app_control, void *data)
38 {
39     /* Handle the launch request. */
40     appdata *ad = (appdata *)data;
41     int res;
42
43     LOGD("");
44
45     if (!ad)
46         return;
47
48     ad->app_type = APP_TYPE_NORMAL;
49     ad->app_state = APP_STATE_SERVICE;
50     im_setting_selector_app_create(ad);
51 }
52
53 static void
54 app_pause(void *data)
55 {
56     appdata *ad = (appdata *)data;
57     LOGD("");
58     /* Take necessary actions when application becomes invisible. */
59
60     if (!ad)
61         return;
62     ad->app_state = APP_STATE_PAUSE;
63     im_setting_selector_app_pause(ad);
64 }
65
66 static void
67 app_resume(void *data)
68 {
69     appdata *ad = (appdata *)data;
70     LOGD("");
71     /* Take necessary actions when application becomes visible. */
72
73     if (!ad)
74         return;
75     ad->app_state = APP_STATE_RESUME;
76 }
77
78 static void
79 app_terminate(void *data)
80 {
81     appdata *ad = (appdata *)data;
82     LOGD("");
83     /* Release all resources. */
84
85     if (!ad)
86         return;
87     ad->app_state = APP_STATE_TERMINATE;
88     im_setting_selector_app_terminate(ad);
89 }
90
91 static void
92 ui_app_lang_changed(app_event_info_h event_info, void *user_data)
93 {
94     LOGD("");
95     /*APP_EVENT_LANGUAGE_CHANGED*/
96 }
97
98 static void
99 ui_app_orient_changed(app_event_info_h event_info, void *user_data)
100 {
101     LOGD("");
102     /*APP_EVENT_DEVICE_ORIENTATION_CHANGED*/
103 }
104
105 static void
106 ui_app_region_changed(app_event_info_h event_info, void *user_data)
107 {
108     LOGD("");
109     /*APP_EVENT_REGION_FORMAT_CHANGED*/
110 }
111
112 static void
113 ui_app_low_battery(app_event_info_h event_info, void *user_data)
114 {
115     LOGD("");
116     /*APP_EVENT_LOW_BATTERY*/
117 }
118
119 static void
120 ui_app_low_memory(app_event_info_h event_info, void *user_data)
121 {
122     LOGD("");
123     /*APP_EVENT_LOW_MEMORY*/
124 }
125
126 int
127 main(int argc, char *argv[])
128 {
129     appdata ad = {0,};
130     int ret = 0;
131
132     ui_app_lifecycle_callback_s event_callback = {0,};
133     app_event_handler_h handlers[5] = {NULL, };
134
135     event_callback.create = app_create;
136     event_callback.terminate = app_terminate;
137     event_callback.pause = app_pause;
138     event_callback.resume = app_resume;
139     event_callback.app_control = app_control;
140
141     ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, &ad);
142     ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &ad);
143     ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, &ad);
144     ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &ad);
145     ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, &ad);
146
147     ret = ui_app_main(argc, argv, &event_callback, &ad);
148     if (ret != APP_ERROR_NONE) {
149        LOGW("ui_app_main failed, Err=%d\n", ret);
150     }
151
152     return ret;
153 }
154