2 * Copyright (c) 2000-2012 Samsung Electronics Co., Ltd All Rights Reserved
4 * This file is part of the ug-memo-efl
5 * Written by Zhibin Zhou <zhibin.zhou@samsung.com>, Canjiang Lu <canjiang.lu@samsung.com>,
6 * Feng Li <feng.li@samsung.com>
8 * PROPRIETARY/CONFIDENTIAL
10 * This software is the confidential and proprietary information of
11 * SAMSUNG ELECTRONICS ("Confidential Information").
12 * You shall not disclose such Confidential Information and shall
13 * use it only in accordance with the terms of the license agreement
14 * you entered into with SAMSUNG ELECTRONICS. SAMSUNG make no
15 * representations or warranties about the suitability
16 * of the software, either express or implied, including but not
17 * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
18 * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
19 * a result of using, modifying or distributing this software or its derivatives.
23 #define UG_MODULE_API __attribute__ ((visibility("default")))
26 #include <Elementary.h>
27 #include <ui-gadget-module.h>
28 #include <supplement.h>
32 static Evas_Object *create_fullview(Evas_Object *parent, struct ug_data *ugd)
36 base = elm_layout_add(parent);
39 elm_layout_theme_set(base, "layout", "application", "default");
42 Evas_Object *bg = elm_bg_add(base);
43 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
44 elm_object_part_content_set(base, "elm.swallow.bg", bg);
49 static Evas_Object *create_frameview(Evas_Object *parent, struct ug_data *ugd)
53 base = elm_layout_add(parent);
56 elm_layout_theme_set(base, "layout", "application", "default");
61 static Evas_Object *create_error_popup_layout(Evas_Object *parent, bool is_fullview)
65 base = elm_layout_add(parent);
70 elm_layout_theme_set(base, "layout", "application", "default");
72 elm_layout_theme_set(base, "layout", "application", "noindicator");
74 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
79 void memo_ug_hide_cb(void *data, Evas_Object *obj, void *event_info)
84 static void *on_create(struct ui_gadget *ug, enum ug_mode mode, bundle *data, void *priv)
88 const char *index = NULL;
99 ugd->th = elm_theme_new();
100 elm_theme_ref_set(ugd->th, NULL);
101 elm_theme_extension_add(ugd->th, EDJ_FILE);
107 bindtextdomain("memo", "/opt/ug/res/locale");
109 parent = ug_get_parent_layout(ug);
113 index = bundle_get_val(data, "index");
114 if (index != NULL) {/* legitimacy check of memo record */
115 memo_data_t *md = memo_get_data(atoi(index));
117 if (mode == UG_MODE_FULLVIEW)
118 ugd->base = create_error_popup_layout(parent, TRUE);
120 ugd->base = create_error_popup_layout(parent, FALSE);
123 popup = elm_popup_add(ugd->base);
124 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
125 elm_object_text_set(popup, dgettext("sys_string", "IDS_COM_POP_FILE_NOT_FOUND"));
126 elm_popup_timeout_set(popup, 1.5);
127 evas_object_show(popup);
129 evas_object_smart_callback_add(popup, "timeout", memo_ug_hide_cb, ugd->ug);
137 if (mode == UG_MODE_FULLVIEW)
138 ugd->base = create_fullview(parent, ugd);
140 ugd->base = create_frameview(parent, ugd);
143 if (bundle_key_check(data, "type", "select")) {
144 memo_load_select_view(ugd, data);
145 } else if (index != NULL) {
146 memo_load_detail_view(ugd, data);
148 memo_load_select_view(ugd, data);
155 static void on_start(struct ui_gadget *ug, bundle *data, void *priv)
159 static void on_pause(struct ui_gadget *ug, bundle *data, void *priv)
164 static void on_resume(struct ui_gadget *ug, bundle *data, void *priv)
169 static void on_destroy(struct ui_gadget *ug, bundle *data, void *priv)
182 elm_theme_extension_del(ugd->th, EDJ_FILE);
183 elm_theme_free(ugd->th);
186 evas_object_del(ugd->base);
190 static void on_message(struct ui_gadget *ug, bundle *msg, bundle *data, void *priv)
194 static void on_event(struct ui_gadget *ug, enum ug_event event, bundle *data, void *priv)
197 case UG_EVENT_LOW_MEMORY:
199 case UG_EVENT_LOW_BATTERY:
201 case UG_EVENT_LANG_CHANGE:
203 case UG_EVENT_ROTATE_PORTRAIT:
205 case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
207 case UG_EVENT_ROTATE_LANDSCAPE:
209 case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
216 static void on_key_event(struct ui_gadget *ug, enum ug_key_event event, bundle *data, void *priv)
222 case UG_KEY_EVENT_END:
230 UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops)
237 ugd = calloc(1, sizeof(struct ug_data));
241 ops->create = on_create;
242 ops->start = on_start;
243 ops->pause = on_pause;
244 ops->resume = on_resume;
245 ops->destroy = on_destroy;
246 ops->message = on_message;
247 ops->event = on_event;
248 ops->key_event = on_key_event;
250 ops->opt = UG_OPT_INDICATOR_ENABLE;
255 UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops)