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.
22 #include <setting-shortcut.h>
25 #define UG_MODULE_API __attribute__ ((visibility("default")))
29 static void setting_shortcut_ug_cb_resize(void *data, Evas *e, Evas_Object *obj, void *event_info)
31 SettingShortcutUG *ad = (SettingShortcutUG *) data;
32 setting_view_update(&setting_view_shortcut_main, ad);
35 static void *setting_shortcut_ug_on_create(ui_gadget_h ug,
36 enum ug_mode mode, service_h service,
40 setting_retvm_if((!priv), NULL, "!priv");
42 SettingShortcutUG *shortcutUG = (SettingShortcutUG *)priv;
44 shortcutUG->win_main_layout = (Evas_Object *) ug_get_parent_layout(ug);
45 shortcutUG->win_get = (Evas_Object *) ug_get_window();
46 evas_object_show(shortcutUG->win_main_layout);
47 shortcutUG->evas = evas_object_evas_get(shortcutUG->win_main_layout);
49 setting_retvm_if(shortcutUG->win_main_layout == NULL, NULL,
50 "cannot get main window ");
52 /* --------------------------------------------------------- */
54 appcore_set_i18n(SETTING_PACKAGE, SETTING_LOCALEDIR);
55 /* --------------------------------------------------------- */
57 /* creating a view. */
58 setting_view_create(&setting_view_shortcut_main,(void *)shortcutUG);
59 evas_object_event_callback_add(shortcutUG->win_main_layout,
61 setting_shortcut_ug_cb_resize,
63 return shortcutUG->ly_main;
66 static void setting_shortcut_ug_on_start(ui_gadget_h ug, service_h service, void *priv)
70 static void setting_shortcut_ug_on_pause(ui_gadget_h ug, service_h service, void *priv)
74 static void setting_shortcut_ug_on_resume(ui_gadget_h ug, service_h service, void *priv)
78 static void setting_shortcut_ug_on_destroy(ui_gadget_h ug, service_h service, void *priv)
80 SettingShortcutUG *shortcutUG = (SettingShortcutUG *)priv;
82 evas_object_event_callback_del(shortcutUG->win_main_layout, EVAS_CALLBACK_RESIZE, setting_shortcut_ug_cb_resize); /* fix flash issue for gallery */
85 /* delete the allocated objects. */
86 setting_view_destroy(&setting_view_shortcut_main, shortcutUG);
87 if (NULL != ug_get_layout(shortcutUG->ug)) {
88 evas_object_hide((Evas_Object *) ug_get_layout(shortcutUG->ug));
89 evas_object_del((Evas_Object *) ug_get_layout(shortcutUG->ug));
93 static void setting_shortcut_ug_on_message(ui_gadget_h ug, service_h msg, service_h service, void *priv)
98 static void setting_shortcut_ug_on_event(ui_gadget_h ug,
99 enum ug_event event, service_h service,
103 case UG_EVENT_LOW_MEMORY:
105 case UG_EVENT_LOW_BATTERY:
107 case UG_EVENT_LANG_CHANGE:
109 case UG_EVENT_ROTATE_PORTRAIT:
111 case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
113 case UG_EVENT_ROTATE_LANDSCAPE:
115 case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
117 case UG_EVENT_REGION_CHANGE:
124 static void setting_shortcut_ug_on_key_event(ui_gadget_h ug,
125 enum ug_key_event event,
126 service_h service, void *priv)
132 case UG_KEY_EVENT_END:
140 UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops)
142 SettingShortcutUG *shortcutUG = calloc(1, sizeof(SettingShortcutUG));
143 setting_retvm_if(!shortcutUG, -1, "Create SettingShortcutUG obj failed");
145 ops->create = setting_shortcut_ug_on_create;
146 ops->start = setting_shortcut_ug_on_start;
147 ops->pause = setting_shortcut_ug_on_pause;
148 ops->resume = setting_shortcut_ug_on_resume;
149 ops->destroy = setting_shortcut_ug_on_destroy;
150 ops->message = setting_shortcut_ug_on_message;
151 ops->event = setting_shortcut_ug_on_event;
152 ops->key_event = setting_shortcut_ug_on_key_event;
153 ops->priv = shortcutUG;
154 ops->opt = UG_OPT_INDICATOR_ENABLE;
159 UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops)
161 struct SettingShortcutUG *shortcutUG;
162 setting_retm_if(!ops, "ops == NULL");
164 shortcutUG = ops->priv;