4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
6 * Contact: MyoungJune Park <mj2004.park@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
21 #include <setting-livebox.h>
24 #define UG_MODULE_API __attribute__ ((visibility("default")))
28 static void setting_livebox_ug_cb_resize(void *data, Evas *e, Evas_Object *obj, void *event_info)
30 SettingLiveboxUG *ad = (SettingLiveboxUG *) data;
31 setting_view_update(&setting_view_livebox_main, ad);
34 static void *setting_livebox_ug_on_create(ui_gadget_h ug,
35 enum ug_mode mode, service_h service,
39 setting_retvm_if((!priv), NULL, "!priv");
41 SettingLiveboxUG *liveboxUG = (SettingLiveboxUG *)priv;
43 liveboxUG->win_main_layout = (Evas_Object *) ug_get_parent_layout(ug);
44 liveboxUG->win_get = (Evas_Object *) ug_get_window();
45 evas_object_show(liveboxUG->win_main_layout);
46 liveboxUG->evas = evas_object_evas_get(liveboxUG->win_main_layout);
48 setting_retvm_if(liveboxUG->win_main_layout == NULL, NULL,
49 "cannot get main window ");
51 /* --------------------------------------------------------- */
53 appcore_set_i18n(SETTING_PACKAGE, SETTING_LOCALEDIR);
54 /* --------------------------------------------------------- */
55 int ret = setting_cfg_init();
57 SETTING_TRACE_DEBUG("cfg_init failed. %d", ret);
59 /* creating a view. */
60 setting_view_create(&setting_view_livebox_main,(void *)liveboxUG);
61 evas_object_event_callback_add(liveboxUG->win_main_layout,
63 setting_livebox_ug_cb_resize,
65 return liveboxUG->ly_main;
68 static void setting_livebox_ug_on_start(ui_gadget_h ug, service_h service, void *priv)
72 static void setting_livebox_ug_on_pause(ui_gadget_h ug, service_h service, void *priv)
76 static void setting_livebox_ug_on_resume(ui_gadget_h ug, service_h service, void *priv)
80 static void setting_livebox_ug_on_destroy(ui_gadget_h ug, service_h service, void *priv)
82 SettingLiveboxUG *liveboxUG = (SettingLiveboxUG *)priv;
84 evas_object_event_callback_del(liveboxUG->win_main_layout, EVAS_CALLBACK_RESIZE, setting_livebox_ug_cb_resize); /* fix flash issue for gallery */
87 /* delete the allocated objects. */
88 setting_view_destroy(&setting_view_livebox_main, liveboxUG);
89 if (NULL != ug_get_layout(liveboxUG->ug)) {
90 evas_object_hide((Evas_Object *) ug_get_layout(liveboxUG->ug));
91 evas_object_del((Evas_Object *) ug_get_layout(liveboxUG->ug));
95 static void setting_livebox_ug_on_message(ui_gadget_h ug, service_h msg, service_h service, void *priv)
100 static void setting_livebox_ug_on_event(ui_gadget_h ug,
101 enum ug_event event, service_h service,
105 case UG_EVENT_LOW_MEMORY:
107 case UG_EVENT_LOW_BATTERY:
109 case UG_EVENT_LANG_CHANGE:
111 case UG_EVENT_ROTATE_PORTRAIT:
113 case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
115 case UG_EVENT_ROTATE_LANDSCAPE:
117 case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
119 case UG_EVENT_REGION_CHANGE:
126 static void setting_livebox_ug_on_key_event(ui_gadget_h ug,
127 enum ug_key_event event,
128 service_h service, void *priv)
134 case UG_KEY_EVENT_END:
142 UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops)
144 SettingLiveboxUG *liveboxUG = calloc(1, sizeof(SettingLiveboxUG));
145 setting_retvm_if(!liveboxUG, -1, "Create SettingPasswordUG obj failed");
147 ops->create = setting_livebox_ug_on_create;
148 ops->start = setting_livebox_ug_on_start;
149 ops->pause = setting_livebox_ug_on_pause;
150 ops->resume = setting_livebox_ug_on_resume;
151 ops->destroy = setting_livebox_ug_on_destroy;
152 ops->message = setting_livebox_ug_on_message;
153 ops->event = setting_livebox_ug_on_event;
154 ops->key_event = setting_livebox_ug_on_key_event;
155 ops->priv = liveboxUG;
156 ops->opt = UG_OPT_INDICATOR_ENABLE;
161 UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops)
163 struct SettingLiveboxUG *liveboxUG;
164 setting_retm_if(!ops, "ops == NULL");
166 liveboxUG = ops->priv;