2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.1 (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://floralicense.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.
18 #define UG_MODULE_API __attribute__ ((visibility("default")))
21 #include "homescreen-setting-efl.h"
22 #include "homescreen-setting-main.h"
24 static Evas_Object *_create_naviframe(Evas_Object *parent)
26 Evas_Object *naviframe = NULL;
30 HOMESET_ERR("Parent is null.");
34 naviframe = elm_naviframe_add(parent);
35 if (naviframe == NULL)
37 HOMESET_ERR("Cannot add naviframe.");
41 elm_object_part_content_set(parent, "elm.swallow.content", naviframe);
43 evas_object_show(naviframe);
48 static Evas_Object *_create_background(Evas_Object *parent)
50 Evas_Object *bg = elm_bg_add(parent);
52 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
53 elm_object_style_set(bg, "group_list");
55 elm_object_part_content_set(parent, "elm.swallow.bg", bg);
61 static Evas_Object *_create_layout(Evas_Object *parent)
63 Evas_Object *layout = NULL;
67 HOMESET_ERR("Parent is null.");
71 layout = elm_layout_add(parent);
74 HOMESET_ERR("Cannot add layout.");
78 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
80 evas_object_show(layout);
85 static Evas_Object *create_fullview(Evas_Object *parent, struct ug_data *ugd)
90 HOMESET_ERR("Invalid ug data");
94 /* Create Full view */
95 ugd->base = _create_layout(parent);
97 elm_layout_theme_set(ugd->base, "layout", "application", "default");
98 elm_win_indicator_mode_set(parent, ELM_WIN_INDICATOR_SHOW);
100 /* Create background */
101 _create_background(ugd->base);
103 /* Create navigation bar */
104 ugd->naviframe = _create_naviframe(ugd->base);
106 /* Create main view */
107 homescreen_setting_main_create_view(ugd);
112 static void *on_create(ui_gadget_h ug, enum ug_mode mode, app_control_h app_control, void *priv)
121 bindtextdomain(HOMESET_DOMAIN, "/usr/ug/res/locale");
126 parent = ug_get_parent_layout(ug);
130 /* always make full view */
131 ugd->base = create_fullview(parent, ugd);
136 static void on_start(ui_gadget_h ug, app_control_h app_control, void *priv)
140 static void on_pause(ui_gadget_h ug, app_control_h app_control, void *priv)
145 static void on_resume(ui_gadget_h ug, app_control_h app_control, void *priv)
150 static void on_destroy(ui_gadget_h ug, app_control_h app_control, void *priv)
159 evas_object_del(ugd->base);
163 static void on_message(ui_gadget_h ug, app_control_h msg, app_control_h app_control, void *priv)
167 static void on_event(ui_gadget_h ug, enum ug_event event, app_control_h app_control, void *priv)
171 case UG_EVENT_LOW_MEMORY:
173 case UG_EVENT_LOW_BATTERY:
175 case UG_EVENT_LANG_CHANGE:
177 case UG_EVENT_ROTATE_PORTRAIT:
179 case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
181 case UG_EVENT_ROTATE_LANDSCAPE:
183 case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
185 case UG_EVENT_REGION_CHANGE:
192 UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops)
194 HOMESET_DBG("ug init");
200 ugd = calloc(1, sizeof(struct ug_data));
204 ops->create = on_create;
205 ops->start = on_start;
206 ops->pause = on_pause;
207 ops->resume = on_resume;
208 ops->destroy = on_destroy;
209 ops->message = on_message;
210 ops->event = on_event;
212 ops->opt = UG_OPT_INDICATOR_ENABLE;
217 UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops)
219 HOMESET_DBG("ug exit");