2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
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.
20 #define UG_MODULE_API __attribute__ ((visibility("default")))
23 #include <Elementary.h>
24 #include <ui-gadget-module.h>
26 #include "openlock-setting.h"
27 #include "openlock-setting-util.h"
28 #include "openlock-setting-main.h"
30 static Evas_Object *create_bg(Evas_Object * parent)
32 Evas_Object *bg = elm_bg_add(parent);
34 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND,
36 elm_object_style_set(bg, "group_list");
38 elm_object_part_content_set(parent, "elm.swallow.bg", bg);
44 static Evas_Object *create_fullview(Evas_Object * parent,
45 openlock_ug_data * openlock_data)
47 Evas_Object *base = NULL;
48 Evas_Object *navi_bar = NULL;
49 Evas_Object *bg = NULL;
51 base = openlock_setting_util_create_layout(parent);
53 elm_layout_theme_set(base, "layout", "application", "default");
54 elm_win_resize_object_add(parent, base);
55 elm_win_indicator_mode_set(parent, ELM_WIN_INDICATOR_SHOW);
59 navi_bar = openlock_setting_util_create_navigation(base);
60 openlock_data->navi_bar = navi_bar;
62 openlock_setting_main_create_view(openlock_data);
67 static Evas_Object *create_frameview(Evas_Object * parent,
68 openlock_ug_data * openlock_data)
70 Evas_Object *base = NULL;
72 /* Create Frame view */
77 static void *on_create(ui_gadget_h ug, enum ug_mode mode, service_h service,
80 Evas_Object *parent = NULL;
81 Evas_Object *win_main = NULL;
82 openlock_ug_data *openlock_data = NULL;
87 bindtextdomain("openlock-setting", "/opt/ug/res/locale");
90 openlock_data->ug = ug;
92 parent = ug_get_parent_layout(ug);
96 win_main = ug_get_window();
101 openlock_data->win_main = win_main;
103 if (mode == UG_MODE_FULLVIEW)
104 openlock_data->base = create_fullview(parent, openlock_data);
106 openlock_data->base = create_frameview(parent, openlock_data);
108 /* Add del callback for base layout */
110 return openlock_data->base;
113 static void on_start(ui_gadget_h ug, service_h service, void *priv)
117 static void on_pause(ui_gadget_h ug, service_h service, void *priv)
122 static void on_resume(ui_gadget_h ug, service_h service, void *priv)
127 static void on_destroy(ui_gadget_h ug, service_h service, void *priv)
129 openlock_ug_data *openlock_data;
134 openlock_data = priv;
135 evas_object_del(openlock_data->base);
136 openlock_data->base = NULL;
139 static void on_message(ui_gadget_h ug, service_h msg, service_h service,
144 static void on_event(ui_gadget_h ug, enum ug_event event, service_h service,
148 case UG_EVENT_LOW_MEMORY:
150 case UG_EVENT_LOW_BATTERY:
152 case UG_EVENT_LANG_CHANGE:
154 case UG_EVENT_ROTATE_PORTRAIT:
156 case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
158 case UG_EVENT_ROTATE_LANDSCAPE:
160 case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
167 static void on_key_event(ui_gadget_h ug, enum ug_key_event event,
168 service_h service, void *priv)
174 case UG_KEY_EVENT_END:
182 UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops)
184 openlock_ug_data *openlock_data;
189 openlock_data = calloc(1, sizeof(openlock_ug_data));
193 ops->create = on_create;
194 ops->start = on_start;
195 ops->pause = on_pause;
196 ops->resume = on_resume;
197 ops->destroy = on_destroy;
198 ops->message = on_message;
199 ops->event = on_event;
200 ops->key_event = on_key_event;
201 ops->priv = openlock_data;
202 ops->opt = UG_OPT_INDICATOR_ENABLE;
207 UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops)
209 openlock_ug_data *openlock_data;
214 openlock_data = ops->priv;