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.
18 #include <setting-about.h>
20 #define UG_MODULE_API __attribute__ ((visibility("default")))
24 * Event process when the sizeof UG view changes
26 static void setting_about_ug_cb_resize(void *data, Evas *e, Evas_Object *obj,
29 SettingAboutUG *ad = (SettingAboutUG *) data;
30 setting_view_update(&setting_view_about_main, ad);
34 * on_create function of the UG
36 static void *setting_about_ug_on_create(struct ui_gadget *ug, enum ug_mode mode,
37 bundle *data, void *priv)
40 setting_retvm_if((NULL == ug
41 || NULL == priv), NULL, "NULL == ug || NULL == priv");
42 SettingAboutUG *aboutUG = priv;
45 aboutUG->win_main_layout = (Evas_Object *) ug_get_parent_layout(ug);
46 aboutUG->win_get = (Evas_Object *) ug_get_window();
47 evas_object_show(aboutUG->win_main_layout);
48 aboutUG->evas = evas_object_evas_get(aboutUG->win_main_layout);
50 setting_retvm_if(aboutUG->win_main_layout == NULL, NULL,
51 "cannot get main window ");
53 /* register view node table */
54 setting_view_node_table_intialize();
55 setting_view_node_table_register(&setting_view_about_main, NULL);
57 setting_view_node_table_register(&setting_view_about_licences,
58 &setting_view_about_main);
59 /* setting_view_node_table_register(&setting_view_about_about_view, &setting_view_about_main); */
61 /* creating a view. */
62 setting_create_Gendial_itc("dialogue/1text", &(aboutUG->itc_1text));
63 setting_create_Gendial_itc("dialogue/2text.3", &(aboutUG->itc_2text_2));
64 setting_create_Gendial_itc("dialogue/title",
65 &(aboutUG->itc_group_item));
66 setting_create_Gendial_itc("dialogue/1icon", &(aboutUG->itc_1icon));
67 setting_create_Gendial_itc("dialogue/2text.3/expandable",
68 &(aboutUG->itc_2text_3_parent));
69 setting_create_Gendial_itc("dialogue/1text.1icon/expandable2",
70 &(aboutUG->itc_1icon_1text_sub));
71 setting_create_Gendial_itc("multiline/1text",
72 &(aboutUG->itc_help_style));
74 aboutUG->itc_seperator.item_style = "dialogue/separator/21/with_line";
75 aboutUG->itc_seperator.func.text_get = NULL;
76 aboutUG->itc_seperator.func.content_get = NULL;
77 aboutUG->itc_seperator.func.state_get = NULL;
78 aboutUG->itc_seperator.func.del = NULL;
79 setting_view_node_set_cur_view(&setting_view_about_main);
80 setting_view_create(&setting_view_about_main, (void *)aboutUG);
81 evas_object_event_callback_add(aboutUG->win_main_layout,
83 setting_about_ug_cb_resize, aboutUG);
85 aboutUG->popup_showed_flag = FALSE;
86 return aboutUG->ly_main;
89 static void setting_about_ug_on_start(struct ui_gadget *ug, bundle *data,
94 static void setting_about_ug_on_pause(struct ui_gadget *ug, bundle *data,
99 static void setting_about_ug_on_resume(struct ui_gadget *ug, bundle *data,
105 * on_destroy function of the UG
107 static void setting_about_ug_on_destroy(struct ui_gadget *ug, bundle *data,
111 setting_retm_if((!ug || !priv), "!ug || !priv");
112 SettingAboutUG *aboutUG = priv;
114 evas_object_event_callback_del(aboutUG->win_main_layout, EVAS_CALLBACK_RESIZE, setting_about_ug_cb_resize); /* fix flash issue for gallery */
116 /* delete the allocated objects. */
117 setting_view_destroy(&setting_view_about_licences,
119 setting_view_destroy(&setting_view_about_main, aboutUG);
120 if (NULL != ug_get_layout(aboutUG->ug)) {
121 evas_object_hide((Evas_Object *) ug_get_layout(aboutUG->ug));
122 evas_object_del((Evas_Object *) ug_get_layout(aboutUG->ug));
128 static void setting_about_ug_on_message(struct ui_gadget *ug, bundle *msg,
129 bundle *data, void *priv)
134 static void setting_about_ug_on_event(struct ui_gadget *ug, enum ug_event event,
135 bundle *data, void *priv)
139 case UG_EVENT_LOW_MEMORY:
141 case UG_EVENT_LOW_BATTERY:
143 case UG_EVENT_LANG_CHANGE:
145 case UG_EVENT_ROTATE_PORTRAIT:
147 case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
149 case UG_EVENT_ROTATE_LANDSCAPE:
151 case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
153 case UG_EVENT_REGION_CHANGE:
160 static void setting_about_ug_on_key_event(struct ui_gadget *ug,
161 enum ug_key_event event,
162 bundle *data, void *priv)
165 SettingAboutUG *ad = (SettingAboutUG *) priv;
170 case UG_KEY_EVENT_END:
172 if (elm_naviframe_top_item_get(ad->navi_bar) ==
173 elm_naviframe_bottom_item_get(ad->navi_bar)) {
176 /* elm_naviframe_item_pop(ad->navi_bar); */
177 setting_view_cb_at_endKey(ad);
186 UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops)
189 SettingAboutUG *aboutUG = calloc(1, sizeof(SettingAboutUG));
190 setting_retvm_if(!aboutUG, -1, "Create SettingAboutUG obj failed");
192 ops->create = setting_about_ug_on_create;
193 ops->start = setting_about_ug_on_start;
194 ops->pause = setting_about_ug_on_pause;
195 ops->resume = setting_about_ug_on_resume;
196 ops->destroy = setting_about_ug_on_destroy;
197 ops->message = setting_about_ug_on_message;
198 ops->event = setting_about_ug_on_event;
199 ops->key_event = setting_about_ug_on_key_event;
201 ops->opt = UG_OPT_INDICATOR_ENABLE;
206 UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops)
209 struct SettingAboutUG *aboutUG;
210 setting_retm_if(!ops, "ops == NULL");
218 /* ***************************************************
222 ****************************************************/
223 void setting_about_layout_ug_cb(struct ui_gadget *ug, enum ug_mode mode,
226 SettingAboutUG *ad = (SettingAboutUG *) priv;
233 base = (Evas_Object *) ug_get_layout(ug);
238 case UG_MODE_FULLVIEW:
239 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND,
241 elm_win_resize_object_add(ad->win_get, base);
242 evas_object_show(base);
252 * Reset function to 'reset' the settings of the UG, it will be invoked by 'Reset' UG
257 UG_MODULE_API int setting_plugin_reset(bundle *data, void *priv)
260 #if SUPPORT_RUN_SYSTEM_COMMAND
261 return excuteCmd(SETTING_POSTINST_FILE, 1, "about");
263 return vconf_set_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR, "Tizen");