2 * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
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.
19 #include <KeyDefine.h>
26 #include "view_maincatalog.h"
27 #include "data_wrapper.h"
28 #include "settings_provider.h"
30 #define DATA_ID "main_setting_data"
31 #define SUBITEM_DATA_ID "subitem_data_id"
32 #define SYSTEM_CLOCK_DATA "system_clock_data"
33 #define ICON_PART "iconpart"
34 #define PROGRESS_BAR_DATA "progressbar"
36 #define SETTING_ID "setting_id"
37 #define E_CREATE_ITEMS 0
39 #define MAX_PROGRESS_VALUE 100.0
40 #define MIN_PROGRESS_VALUE 0.0
41 #define ICON_BUTTON_NO_DISP_NAME "No Display Name"
42 #define CHANGE_PASSCODE_NAME "change-passcode"
43 #define PASSCODE_MASK "****"
44 #define DISABLED "disabled"
45 #define ENABLED "enabled"
46 #define SIG_CLICKED "clicked"
48 #define KEY_PASSCODE "settings/system/change_passcode"
49 #define ITEM_CHANNEL_LOCK_ID "channel-lock"
59 Eina_Array *sub_item_btn;
60 Eina_Array *main_item_btn;
61 Eina_Array *main_icon_base;
62 Eina_Array *item_path;
63 Evas_Object *focused_sub_item_btn;
64 Evas_Object *focused_main_item_btn;
65 Evas_Object *subitem_box;
66 Evas_Object *mainitem_box;
72 struct setting_mgr *mgr;
73 struct settingview_data *main_setting_view;
74 struct settingview_data *subsetting_view;
78 * This function will be invoked when focus moves from subitem to main item.
80 * @param[in]: data : the user data.
81 * @param[in]: btn : subitem which focus is on.
85 static void _move_from_subitem_to_main_item(struct _view_data *data,
91 data->focus_status = FOCUS_MAIN_ITEM;
92 data->focused_sub_item_btn = btn;
94 elm_object_focus_set(data->focused_main_item_btn, EINA_TRUE);
98 * Evas_Object_Event_Cb type callback for handling key press event.
100 * @param[in]: data : the user data.
101 * @param[in]: e : the evas canvas.
102 * @param[in]: obj : the corresponding object which the key press event occurred.
103 * @param[in]: ei : event info.
107 static void _subitem_key_pressed_cb(void *data, Evas *e,
108 Evas_Object *obj, void *ei)
110 Evas_Event_Key_Down *ev;
111 struct _view_data *priv;
115 if (!data || !ei || !obj)
124 if (!strcmp(ev->keyname, KEY_LEFT)
125 || !strcmp(ev->keyname, KEY_BACK)
126 || !strcmp(ev->keyname, KEY_BACK_REMOTE)) {
127 pb = evas_object_data_get(obj, PROGRESS_BAR_DATA);
129 elm_object_signal_emit(pb,
130 SIG_UNCTRL_PB_UNFOCUSED, SRC_PB_PROG);
132 _move_from_subitem_to_main_item(priv, obj);
133 } else if (!strncmp(ev->keyname, KEY_DOWN, strlen(ev->keyname))) {
134 pb = evas_object_data_get(obj, PROGRESS_BAR_DATA);
136 elm_object_signal_emit(pb,
137 SIG_UNCTRL_PB_UNFOCUSED, SRC_PB_PROG);
139 next = elm_object_focus_next_object_get(obj,
142 _ERR("focus next object get failed.");
146 pb = evas_object_data_get(next, PROGRESS_BAR_DATA);
148 elm_object_signal_emit(pb,
149 SIG_UNCTRL_PB_FOCUSED, SRC_PB_PROG);
150 } else if (!strncmp(ev->keyname, KEY_UP, strlen(ev->keyname))) {
151 pb = evas_object_data_get(obj, PROGRESS_BAR_DATA);
153 elm_object_signal_emit(pb,
154 SIG_UNCTRL_PB_UNFOCUSED, SRC_PB_PROG);
156 next = elm_object_focus_next_object_get(obj, ELM_FOCUS_UP);
158 _ERR("focus next object get failed.");
162 pb = evas_object_data_get(next, PROGRESS_BAR_DATA);
164 elm_object_signal_emit(pb,
165 SIG_UNCTRL_PB_FOCUSED, SRC_PB_PROG);
166 } else if (!strncmp(ev->keyname, KEY_EXIT, strlen(ev->keyname))) {
172 * Get geometry data of object such as width, height.
174 * @param[in]: obj : the object which you want to get geometry data from.
175 * @param[out]: param : the geometry data.
179 static void _get_geometry_data(Evas_Object *obj,
180 struct obj_geometry_data *param)
184 if (!param || !obj) {
185 _ERR("Invalid argument");
191 evas_object_geometry_get(obj, &x, &y, &w, &h);
200 * Entry of showing UI gadget views.
202 * param[in]: data : the user data.
203 * param[in]: item : item data.
204 * param[in]: obj : object whose next view is UI gadget.
206 * @return: 0 - success, -1 - fail.
208 static int _push_ug_view(struct _view_data *data,
209 struct settingitem *item, Evas_Object *obj)
212 struct evas_obj_data param;
215 if (!data || !item || !obj) {
216 _ERR("Invalid argument");
220 id = settingitem_get_id(item);
222 _ERR("Fail to get item id");
226 param.subitem_box = data->subitem_box;
227 param.display_name = settingitem_get_display_name(item);
230 r = settingmgr_view_push(data->mgr, id, (void *)¶m);
232 _ERR("Fail to push view");
240 * Entry of showing sublist views.
242 * param[in]: data : the user data.
243 * param[in]: item : item data.
244 * param[in]: obj : object whose next view is sublist.
246 * @return: 0 - success, -1 - fail.
248 static int _push_sublist_view(struct _view_data *data,
249 struct settingitem *item, Evas_Object *obj)
253 struct obj_geometry_data ogd;
255 if (!data || !item || !obj) {
256 _ERR("Invalid argument");
260 id = settingitem_get_id(item);
262 _ERR("Fail to get item id");
266 _get_geometry_data(obj, &ogd);
268 r = settingmgr_view_push(data->mgr, id, (void *)&ogd);
270 _ERR("Fail to push view");
274 elm_object_signal_emit(obj, SUBITEMBTN_BUTTON_CLICKED,
275 SUBITEMBTN_BUTTON_SOURCE);
281 * Entry of showing bottom sublist views.
283 * param[in]: data : the user data.
284 * param[in]: item : item data.
286 * @return: 0 - success, -1 - fail.
288 static int _push_bottom_sublist_view(struct _view_data *data,
289 struct settingitem *item)
294 if (!data || !item) {
295 _ERR("Invalid argument");
299 id = settingitem_get_id(item);
301 _ERR("Fail to get item id");
305 r = settingmgr_view_push(data->mgr, id, NULL);
307 _ERR("Fail to push view");
315 * Entry of showing bottom slider views.
317 * param[in]: data : the user data.
318 * param[in]: item : item data.
319 * param[in]: obj : object whose next view bottom slider.
321 * @return: 0 - success, -1 - fail.
323 static int _push_bottom_slider_view(struct _view_data *data,
324 struct settingitem *item, Evas_Object *obj)
331 if (!data || !item || !obj) {
332 _ERR("Invalid argument");
336 id = settingitem_get_id(item);
338 _ERR("Fail to get item id");
342 pb = evas_object_data_get(obj, PROGRESS_BAR_DATA);
344 elm_object_signal_emit(pb,
345 SIG_UNCTRL_PB_UNFOCUSED, SRC_PB_PROG);
347 list = settingitem_get_slider_group_list(
348 viewdata_get_parentitem(data->subsetting_view),
349 settingmgr_get_data(data->mgr), id);
351 r = settingmgr_view_push(data->mgr, id, list);
353 _ERR("Fail to push view");
361 * Entry of showing passcode popup views.
363 * param[in]: data : the user data.
364 * param[in]: item : item data.
366 * @return: 0 - success, -1 - fail.
368 static int _push_passcode_popup_view(struct _view_data *data,
369 struct settingitem *item)
374 if (!data || !item) {
375 _ERR("Invalid argument");
379 id = settingitem_get_id(item);
381 _ERR("Fail to get item id");
385 r = settingmgr_view_push(data->mgr, id, NULL);
387 _ERR("Fail to push view");
395 * Entry of showing device manager view.
397 * param[in]: data : the user data.
398 * param[in]: item : item data read from json file.
400 * @return: 0 - success, -1 - fail.
402 static int _push_device_manager_view(struct _view_data *data,
403 struct settingitem *item)
406 struct evas_obj_data param;
409 if (!data || !item) {
410 _ERR("Invalid argument");
414 id = settingitem_get_id(item);
416 _ERR("Fail to get item id");
420 param.display_name = settingitem_get_display_name(item);
421 param.subitem_box = data->subitem_box;
423 r = settingmgr_view_push(data->mgr, id, ¶m);
425 _ERR("Fail to push view");
433 * Entry of showing reset popup view.
435 * param[in]: data : the user data.
436 * param[in]: item : item data read from json file.
438 * @return: 0 - success, -1 - fail.
440 static int _push_reset_popup_view(struct _view_data *data,
441 struct settingitem *item)
446 if (!data || !item) {
447 _ERR("Invalid argument");
451 id = settingitem_get_id(item);
453 _ERR("Fail to get item id");
457 r = settingmgr_view_push(data->mgr, id, NULL);
459 _ERR("Fail to push view");
467 * Entry of showing software upgrade popup view.
469 * param[in]: data : the user data.
470 * param[in]: item : item data read from json file.
472 * @return: 0 - success, -1 - fail.
474 static int _push_upgrade_popup_view(struct _view_data *data,
475 struct settingitem *item)
480 if (!data || !item) {
481 _ERR("Invalid argument");
485 id = settingitem_get_id(item);
487 _ERR("Fail to get item id");
491 r = settingmgr_view_push(data->mgr, id, NULL);
493 _ERR("Fail to push view");
501 * Entry of showing clock sublist view.
503 * param[in]: data : the user data.
504 * param[in]: item : item data read from json file.
505 * param[in]: obj : object whose next view is clock sublist view.
507 * @return: 0 - success, -1 - fail.
509 static int _push_clock_sublist_view(struct _view_data *data,
510 struct settingitem *item, Evas_Object *obj)
513 struct evas_obj_data param;
514 struct obj_geometry_data ogd;
517 if (!data || !item || !obj) {
518 _ERR("Invalid argument");
522 id = settingitem_get_id(item);
524 _ERR("Fail to get item id");
528 _get_geometry_data(obj, &ogd);
530 param.display_name = settingitem_get_display_name(item);
531 param.subitem_box = data->subitem_box;
534 evas_object_data_set(obj, SYSTEM_CLOCK_DATA, (void *)&ogd);
536 r = settingmgr_view_push(data->mgr, id, ¶m);
538 _ERR("Fail to push view");
542 elm_object_signal_emit(obj,
543 SUBITEMBTN_BUTTON_CLICKED, SUBITEMBTN_BUTTON_SOURCE);
548 * Entry of showing channel lock view.
550 * param[in]: data : the user data.
551 * param[in]: item : item data read from json file.
552 * param[in]: obj : the channel lock object.
554 * @return: 0 - success, -1 - fail.
556 static int _push_need_passcode_view(struct _view_data *data,
557 struct settingitem *item, Evas_Object *obj)
561 struct obj_geometry_data ogd;
563 if (!data || !item || !obj) {
564 _ERR("Invalid argument");
568 id = settingitem_get_id(item);
570 _ERR("Fail to get item id");
574 _get_geometry_data(obj, &ogd);
576 r = settingmgr_view_push(data->mgr, id, &ogd);
578 _ERR("Fail to push view");
582 elm_object_signal_emit(obj, SUBITEMBTN_BUTTON_CLICKED,
583 SUBITEMBTN_BUTTON_SOURCE);
589 * This function will be invoked when subitem is clicked.
591 * @param[in]: data : the user data.
592 * @param[in]: obj : the subitem object.
596 static void _submenu_item_clicked(void *data, Evas_Object *obj)
598 struct _view_data *priv;
600 struct settingitem *item;
603 _ERR("Invalid argument");
609 if (priv->focus_status != FOCUS_SUB_ITEM)
612 item = evas_object_data_get(obj, SUBITEM_DATA_ID);
614 _ERR("Get sub item failed");
618 style = settingitem_get_settingui_style(item);
620 _ERR("setting-ui style is null.");
624 if (!strncmp(style, STYLE_UIGADGET, strlen(style))) {
625 if (_push_ug_view(priv, item, obj) != 0)
626 _ERR("Fail to push ug");
627 } else if (!strncmp(style, STYLE_CTXPOPUP,
629 if (_push_sublist_view(priv, item, obj) != 0)
630 _ERR("Fail to push sublist");
631 } else if (!strncmp(style, STYLE_BOTTOM_CTXPOPUP,
633 if (_push_bottom_sublist_view(priv, item) != 0)
634 _ERR("Fail to push bottom sublist");
635 } else if (!strncmp(style, STYLE_BOTTOMSLIDER,
636 strlen(style)) || !strncmp(style,
637 STYLE_BOTTOM2WAYSLIDER,
639 if (_push_bottom_slider_view(priv,
641 _ERR("Fail to push bottom slider");
642 } else if (!strncmp(style, STYLE_PASSCODE_POPUP,
644 if (_push_passcode_popup_view(priv, item) != 0)
645 _ERR("Fail to push passcode popup");
646 } else if (!strncmp(style, STYLE_DEVICE_MANAGER,
648 if (_push_device_manager_view(priv, item) != 0)
649 _ERR("Fail to push device mgr view");
650 } else if (!strncmp(style, STYLE_RESET_POPUP,
652 if (_push_reset_popup_view(priv, item) != 0)
653 _ERR("Fail to push reset popup");
654 } else if (!strncmp(style, STYLE_UPGRADE_POPUP,
656 if (_push_upgrade_popup_view(priv, item) != 0)
657 _ERR("Fail to push upgrade popup");
658 } else if (!strncmp(style, STYLE_CLOCK_CTXPOPUP,
660 if (_push_clock_sublist_view(
661 priv, item, obj) != 0)
662 _ERR("Fail to push clock sublist");
663 } else if (!strncmp(style, STYLE_NEED_PASSCODE,
665 if (_push_need_passcode_view(
666 priv, item, obj) != 0)
667 _ERR("Fail to push need passcode view");
670 priv->focused_sub_item_btn = obj;
674 * Evas_Smart_Cb type callback for handling click event.
676 * @param[in]: data : the user data.
677 * @param[in]: obj : the corresponding object which the click event occurred.
678 * @param[in]: ev : event info.
682 static void _subitem_btn_clicked_cb(void *data,
683 Evas_Object *obj, void *ev)
685 struct _view_data *priv;
689 _ERR("Invalid argument");
695 _submenu_item_clicked(priv, obj);
697 elm_object_signal_emit(priv->focused_main_item_btn,
698 MAINICONBTN_FOCUSED_ON_SUBITEM,
699 MAINICONBTN_MAIN_ITEM_SOURCE);
701 icon = elm_object_part_content_get(priv->focused_main_item_btn,
702 MAINICONBTN_ICON_SWALLOW);
704 elm_object_signal_emit(icon, MAIN_BTN_HIGHLIGHT, MAIN_BTN);
708 * Get item value from item.
710 * @param[in]: item : the item data read from json file.
712 * @return: the value of item or null if error occurred.
714 static char *_settingitems_get_value(struct settingitem *item)
717 const char *name, *style;
720 _ERR("Invalid argument");
726 name = settingitem_get_id(item);
727 if (name && !strncmp(name, CHANGE_PASSCODE_NAME, strlen(name))) {
728 result = strdup(PASSCODE_MASK);
732 style = settingitem_get_settingui_style(item);
734 _ERR("Fail to get setting ui style");
738 if (!strncmp(style, STYLE_UIGADGET, strlen(style)))
739 return provider_get_list_value(item);
741 return provider_get_selected_display_name(item);
745 * Get percentage value of progress from item data.
747 * @param[in]: item : item data read from json file.
749 * @return: the percentage value or -1.0 if error occurred.
751 static double _get_progress_percentage(struct settingitem *item)
753 struct slideritem *sitem;
757 _ERR("Invalid argument");
761 sitem = settingitem_get_data_slideritem(item);
763 _ERR("Get slider item failed");
767 val = provider_get_slider_value(item);
768 persent = slideritem_find_slider_value(val, sitem);
774 * Get displaying value of item.
776 * @param[in]: item : item data read from json file.
777 * @param[in]: value : the percentage value.
779 * @return: the display value.
781 static double _get_display_value(struct settingitem *item, double value)
783 struct slideritem *sitem;
787 _ERR("Invalid argument");
791 sitem = settingitem_get_data_slideritem(item);
793 _ERR("Get slider item failed");
797 disp = slideritem_find_slider_display_value(value, sitem);
803 * Create slider of subitem.
805 * @param[in]: item : the item data read from json file.
806 * @param[in]: base : the base layout of subitems.
807 * @param[in]: btn : the subitem the slider will be created on.
811 static void _set_subitem_btn_slider(struct settingitem *item,
812 Evas_Object *base, Evas_Object *btn)
818 if (!item || !base || !btn) {
819 _ERR("Invalid argument");
823 elm_object_style_set(btn, SUBITEMBTN_TITLE_SLIDER_VALUE);
825 pb = elm_progressbar_add(base);
827 _ERR("Add progress bar failed.");
831 elm_object_style_set(pb, SUBITEMBTN_TITILE_SLIDER);
833 percent = _get_progress_percentage(item);
834 val = _get_display_value(item, percent);
835 elm_progressbar_value_set(pb, percent);
837 snprintf(buf, sizeof(buf), "%d", (int)val);
838 elm_object_part_text_set(btn, SUBITEMBTN_VALUE, buf);
839 elm_object_part_content_set(btn, SUBITEMBTN_SLIDER_SWALLOW, pb);
841 evas_object_data_set(btn, PROGRESS_BAR_DATA, pb);
847 * @param[in]: item : the item data read from json file.
848 * @param[in]: tint_r : the tint r-value.
850 * @return: the tint g-value.
852 static double _get_disp_tint_g_val(struct settingitem *item, double tint_r)
855 struct slideritem *sitem;
859 _ERR("Invalid argument");
863 sitem = settingitem_get_data_slideritem(item);
865 _ERR("Get slider item failed");
869 strval = slideritem_get_max_display_value(sitem);
879 * Create two way slider.
881 * @param[in]: item : the item data read from json file.
882 * @param[in]: base : the base layout of subitems.
883 * @param[in]: btn : the subitem which the two way slider will be created on.
887 static void _set_subitem_btn_value_slider(struct settingitem *item,
888 Evas_Object *base, Evas_Object *btn)
891 double tint_r, tint_g, percent;
894 if (!item || !base || !btn) {
895 _ERR("Invalid argument");
899 elm_object_style_set(btn, SUBITEMBTN_TITLE_SLIDER_VALUE);
901 pb = elm_progressbar_add(base);
903 _ERR("Add progress bar failed.");
907 elm_object_style_set(pb, SUBITEMBTN_TITILE_SLIDER);
908 percent = _get_progress_percentage(item);
909 elm_progressbar_value_set(pb, percent);
911 tint_r = _get_display_value(item, percent);
912 tint_g = _get_disp_tint_g_val(item, tint_r);
914 snprintf(buf, sizeof(buf), "R%d", (int)tint_r);
915 elm_object_part_text_set(btn, SUBITEMBTN_VALUE,
916 utils_get_translation_str(buf));
917 snprintf(buf, sizeof(buf), "G%d", (int)tint_g);
918 elm_object_part_text_set(btn, SUBITEMBTN_G_VALUE,
919 utils_get_translation_str(buf));
921 elm_object_part_content_set(btn, SUBITEMBTN_SLIDER_SWALLOW, pb);
923 evas_object_data_set(btn, PROGRESS_BAR_DATA, pb);
927 * Create style for subitem.
929 * @param[in]: base : the base layout of subitems.
930 * @param[in]: obj : the subitem which the style will be created on.
931 * @param[in]: style : the style read from json file.
932 * @param[in]: item : the item data read from json file.
936 static void _draw_subitem_with_style(Evas_Object *base, Evas_Object *obj,
937 const char *style, struct settingitem *item)
941 if (!style || !base || !obj || !item)
944 if (!strncmp(style, STYLE_SUBBUTTON_TITLE_VALUE, strlen(style))) {
945 val = _settingitems_get_value(item);
946 elm_object_part_text_set(obj, SUBITEMBTN_VALUE,
947 utils_get_translation_str(val));
949 } else if (!strncmp(style, STYLE_SUBBUTTON_TITLE_ICON, strlen(style))) {
950 elm_object_style_set(obj, SUBITEMBTN_TITLE_ICON);
951 } else if (!strncmp(style, STYLE_SUBBUTTON_TITLE_SLIDER_VALUE,
953 _set_subitem_btn_slider(item, base, obj);
954 } else if (!strncmp(style, STYLE_SUBBUTTON_TITLE_2WAYSLIDER_VALUE,
956 _set_subitem_btn_value_slider(item, base, obj);
961 * Release resources of subitems.
963 * @param[in]: data : the user data.
967 static void _release_subitems(struct _view_data *data)
970 Eina_Array_Iterator a;
974 _ERR("Invalid argument");
978 if (data->sub_item_btn) {
979 EINA_ARRAY_ITER_NEXT(data->sub_item_btn, i, btn, a)
980 evas_object_del(btn);
981 eina_array_free(data->sub_item_btn);
984 if (data->subsetting_view)
985 viewdata_release(data->subsetting_view);
987 if (data->subitem_box)
988 evas_object_del(data->subitem_box);
992 * Refresh subitems when subitems are changed.
994 * @param[in]: data : the user data.
996 * @return: 0 - success, -1 - fail.
998 static int _refresh_subitems(struct _view_data *data)
1001 Eina_Array_Iterator a;
1003 struct settingitem *item;
1007 _ERR("Invalid argument");
1011 EINA_ARRAY_ITER_NEXT(data->sub_item_btn, i, btn, a) {
1012 item = evas_object_data_get(btn, SUBITEM_DATA_ID);
1013 style = settingitem_get_style(item);
1015 _draw_subitem_with_style(data->base, btn, style, item);
1022 * Evas_Object_Event_Cb type callback for handling mouse out event.
1024 * @param[in]: data : the user data.
1025 * @param[in]: e : the evas.
1026 * @param[in]: obj : the corresponding object which the mouse out event occurred.
1027 * @param[in]: ei : event info.
1031 static void _subitem_btn_mouse_out_cb(void *data, Evas *e,
1032 Evas_Object *obj, void *ei)
1034 /* TODO: Add necessary operations if needed. */
1038 * Evas_Object_Event_Cb type callback for handling mouse in event.
1040 * @param[in]: data : the user data.
1041 * @param[in]: e : the evas.
1042 * @param[in]: obj : the corresponding object which the mouse in event occurred.
1043 * @param[in]: ei : event info.
1047 static void _subitem_btn_mouse_in_cb(void *data, Evas *e,
1048 Evas_Object *obj, void *ei)
1050 struct _view_data *priv;
1051 Evas_Object *icon, *pb;
1058 elm_object_focus_set(obj, EINA_TRUE);
1060 if (priv->focus_status == FOCUS_MAIN_ITEM) {
1061 priv->focus_status = FOCUS_SUB_ITEM;
1062 elm_object_signal_emit(priv->focused_main_item_btn,
1063 MAINICONBTN_FOCUSED_ON_SUBITEM,
1064 MAINICONBTN_MAIN_ITEM_SOURCE);
1066 icon = elm_object_part_content_get(priv->focused_main_item_btn,
1067 MAINICONBTN_ICON_SWALLOW);
1069 elm_object_signal_emit(icon,
1070 MAIN_BTN_HIGHLIGHT, MAIN_BTN);
1073 pb = evas_object_data_get(priv->focused_sub_item_btn,
1076 elm_object_signal_emit(pb, SIG_UNCTRL_PB_UNFOCUSED,
1079 pb = evas_object_data_get(obj, PROGRESS_BAR_DATA);
1081 elm_object_signal_emit(pb, SIG_UNCTRL_PB_FOCUSED, SRC_PB_PROG);
1083 priv->focused_sub_item_btn = obj;
1087 * Create subitems of settings.
1089 * @param[in]: data : the user data.
1090 * @param[in]: name : the name of subitem.
1092 * @return: 0 - success, -1 - fail.
1094 static int _draw_subitems(struct _view_data *data, const char *name)
1096 Evas_Object *box, *btn, *tmp;
1097 struct settingview_data *view;
1098 struct settingitem *item;
1099 Eina_List *list, *l;
1101 Eina_Array_Iterator a;
1103 const char *id, *style, *status;
1105 Eina_Array *enabled;
1107 if (!data || !name || !data->base) {
1108 _ERR("Invalid argument");
1112 view = settingmgr_get_view(data->mgr, name);
1114 _ERR("get subview failed\n");
1118 list = viewdata_get_childitems_list(view);
1120 _ERR("childitem list is empty!");
1122 viewdata_release(view);
1126 cnt = eina_list_count(list);
1128 data->sub_item_btn = eina_array_new(1);
1129 enabled = eina_array_new(1);
1130 if (!data->sub_item_btn || !enabled) {
1131 _ERR("Create Eina Array failed\n");
1132 EINA_LIST_FREE(list, item);
1134 viewdata_release(view);
1138 box = utils_add_box(data->base);
1140 _ERR("Add box failed\n");
1141 EINA_LIST_FREE(list, item);
1142 eina_array_free(data->sub_item_btn);
1144 viewdata_release(view);
1148 EINA_LIST_FOREACH(list, l, item) {
1149 btn = utils_add_btn(data->base, SUBITEMBTN_STYLE,
1150 settingitem_get_display_name(item), EINA_FALSE);
1152 _ERR("Add btn failed");
1153 evas_object_del(box);
1154 EINA_LIST_FREE(list, item);
1155 EINA_ARRAY_ITER_NEXT(data->sub_item_btn, i, tmp, a)
1156 evas_object_del(tmp);
1157 eina_array_free(data->sub_item_btn);
1159 viewdata_release(view);
1163 style = settingitem_get_style(item);
1165 _draw_subitem_with_style(data->base, btn, style, item);
1167 evas_object_smart_callback_add(btn, "clicked",
1168 _subitem_btn_clicked_cb, data);
1169 evas_object_event_callback_add(btn, EVAS_CALLBACK_KEY_DOWN,
1170 _subitem_key_pressed_cb, data);
1171 evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_IN,
1172 _subitem_btn_mouse_in_cb, data);
1173 evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_OUT,
1174 _subitem_btn_mouse_out_cb, data);
1176 elm_box_pack_end(box, btn);
1177 eina_array_push(data->sub_item_btn, btn);
1179 evas_object_data_set(btn, SUBITEM_DATA_ID, item);
1181 id = settingitem_get_id(item);
1182 if (id && !strncmp(id, ITEM_CHANNEL_LOCK_ID, strlen(id))
1183 && (provider_get_passcode(KEY_PASSCODE, &passcode) == -1)) {
1184 /*Disable channel lock menu if passcode has not been setup yet*/
1187 status = settingitem_get_status(item);
1190 if (status && !strncmp(status, DISABLED, strlen(status))) {
1191 elm_object_disabled_set(btn, EINA_TRUE);
1192 evas_object_freeze_events_set(btn, EINA_TRUE);
1194 eina_array_push(enabled, btn);
1198 data->subsetting_view = view;
1199 data->sub_item_count = cnt;
1200 data->subitem_box = box;
1202 elm_object_part_content_set(data->base, MAIN_VIEW_SUBITEM_SWALLOW, box);
1204 utils_set_focus_directions(enabled, eina_array_count(enabled));
1206 EINA_LIST_FREE(list, item);
1207 eina_array_free(enabled);
1213 * This function will be invoked when the main item is clicked.
1215 * @param[in]: data : the user data.
1216 * @param[in]: mainbtn : the main item which the clicked event is occurred.
1220 static void _move_from_main_item_to_subitem(struct _view_data *data,
1221 Evas_Object *mainbtn)
1223 Evas_Object *btn, *pb, *icon;
1226 if (!data || !mainbtn)
1229 data->focus_status = FOCUS_SUB_ITEM;
1231 for (i = 0; i < data->sub_item_count; i++) {
1232 btn = eina_array_data_get(data->sub_item_btn, i);
1234 _ERR("Get subitem btn failed\n");
1235 data->focus_status = FOCUS_MAIN_ITEM;
1239 if (elm_object_disabled_get(btn) != EINA_TRUE)
1243 if (i >= data->sub_item_count) {
1244 data->focus_status = FOCUS_MAIN_ITEM;
1248 pb = evas_object_data_get(btn, PROGRESS_BAR_DATA);
1250 elm_object_signal_emit(pb, SIG_UNCTRL_PB_FOCUSED, SRC_PB_PROG);
1252 elm_object_focus_set(btn, EINA_TRUE);
1254 data->focused_main_item_btn = mainbtn;
1255 elm_object_signal_emit(mainbtn, MAINICONBTN_FOCUSED_ON_SUBITEM,
1256 MAINICONBTN_MAIN_ITEM_SOURCE);
1258 icon = elm_object_part_content_get(mainbtn, MAINICONBTN_ICON_SWALLOW);
1260 elm_object_signal_emit(icon, MAIN_BTN_HIGHLIGHT, MAIN_BTN);
1264 * Evas_Object_Event_Cb type callback for handling key press event.
1266 * @param[in]: data : the user data.
1267 * @param[in]: e : the evas.
1268 * @param[in]: obj : the corresponding object which the key press event occurred.
1269 * @param[in]: ei : event info.
1273 static void _main_setting_key_pressed_cb(void *data, Evas *e,
1274 Evas_Object *obj, void *ei)
1276 Evas_Event_Key_Down *ev;
1277 struct _view_data *priv;
1278 Evas_Object *next, *icon;
1281 if (!data || !ei || !obj)
1290 if (!strcmp(ev->keyname, KEY_DOWN)) {
1291 icon = elm_object_part_content_get(obj,
1292 MAINICONBTN_ICON_SWALLOW);
1294 _ERR("part %s content get failed.",
1295 MAINICONBTN_ICON_SWALLOW);
1299 elm_object_signal_emit(icon, MAIN_BTN_UNFOCUSED, MAIN_BTN);
1301 next = elm_object_focus_next_object_get(obj, ELM_FOCUS_DOWN);
1303 _ERR("next object get failed.");
1307 priv->focused_main_item_btn = next;
1309 icon = elm_object_part_content_get(next,
1310 MAINICONBTN_ICON_SWALLOW);
1312 _ERR("part %s content get failed.",
1313 MAINICONBTN_ICON_SWALLOW);
1317 elm_object_signal_emit(icon, MAIN_BTN_FOCUSED, MAIN_BTN);
1319 _release_subitems(priv);
1321 name = evas_object_data_get(next, SETTING_ID);
1323 _draw_subitems(priv, name);
1324 } else if (!strcmp(ev->keyname, KEY_UP)) {
1325 icon = elm_object_part_content_get(obj,
1326 MAINICONBTN_ICON_SWALLOW);
1328 _ERR("part %s content get failed.",
1329 MAINICONBTN_ICON_SWALLOW);
1333 elm_object_signal_emit(icon, MAIN_BTN_UNFOCUSED, MAIN_BTN);
1335 next = elm_object_focus_next_object_get(obj, ELM_FOCUS_UP);
1337 _ERR("next object get failed.");
1341 priv->focused_main_item_btn = next;
1343 icon = elm_object_part_content_get(next,
1344 MAINICONBTN_ICON_SWALLOW);
1346 _ERR("part %s content get failed.",
1347 MAINICONBTN_ICON_SWALLOW);
1351 elm_object_signal_emit(icon, MAIN_BTN_FOCUSED, MAIN_BTN);
1353 _release_subitems(priv);
1355 name = evas_object_data_get(next, SETTING_ID);
1357 _draw_subitems(priv, name);
1358 } else if (!strcmp(ev->keyname, KEY_RIGHT)) {
1359 _move_from_main_item_to_subitem(priv, obj);
1360 } else if (!strcmp(ev->keyname, KEY_EXIT)
1361 || !strcmp(ev->keyname, KEY_BACK)
1362 || !strcmp(ev->keyname, KEY_BACK_REMOTE)) {
1368 * Evas_Object_Event_Cb type callback for handling mouse in event.
1370 * @param[in]: data : the user data.
1371 * @param[in]: e : the evas.
1372 * @param[in]: obj : the corresponding object which the mouse in event occurred.
1373 * @param[in]: ei : event info.
1377 static void _mainitem_btn_mouse_in_cb(void *data, Evas *e,
1378 Evas_Object *obj, void *ei)
1380 struct _view_data *priv;
1384 if (!data || !obj) {
1385 _ERR("Invalid argument");
1391 if (priv->focus_status == FOCUS_SUB_ITEM)
1392 _move_from_subitem_to_main_item(priv,
1393 priv->focused_sub_item_btn);
1395 icon = elm_object_part_content_get(priv->focused_main_item_btn,
1396 MAINICONBTN_ICON_SWALLOW);
1398 elm_object_signal_emit(icon, MAIN_BTN_UNFOCUSED, MAIN_BTN);
1400 icon = elm_object_part_content_get(obj, MAINICONBTN_ICON_SWALLOW);
1402 elm_object_signal_emit(icon, MAIN_BTN_FOCUSED, MAIN_BTN);
1404 _release_subitems(priv);
1406 name = evas_object_data_get(obj, SETTING_ID);
1408 _draw_subitems(priv, name);
1410 elm_object_focus_set(obj, EINA_TRUE);
1411 priv->focused_main_item_btn = obj;
1415 * Evas_Object_Event_Cb type callback for handling mouse out event.
1417 * @param[in]: data : the user data.
1418 * @param[in]: e : the evas.
1419 * @param[in]: obj : the corresponding object which the mouse out event occurred.
1420 * @param[in]: ei : event info.
1424 static void _mainitem_btn_mouse_out_cb(void *data, Evas *e,
1425 Evas_Object *obj, void *ei)
1427 /* TODO: Add necessary operations if needed. */
1431 * Evas_Smart_Cb type callback for handling click event.
1433 * @param[in]: data : the user data.
1434 * @param[in]: obj : the corresponding object which the click event occurred.
1435 * @param[in]: ev : event info.
1439 static void _mainitem_btn_clicked_cb(void *data,
1440 Evas_Object *obj, void *ev)
1442 struct _view_data *priv;
1444 if (!data || !obj) {
1445 _ERR("Invalid argument");
1450 _move_from_main_item_to_subitem(priv, obj);
1454 * Create main items of settings.
1456 * @param[in]: data : the user data.
1457 * @param[in]: list : the eina list containing data of main items.
1459 * @return: 0 - success, -1 - fail.
1461 static int _add_icon_btns(struct _view_data *data, Eina_List *list)
1463 Evas_Object *btn, *icon;
1464 const char *id, *name;
1465 struct settingitem *item;
1469 if (!data || !list || !data->base) {
1470 _ERR("Invalid argument");
1474 for (i = 0; i < data->main_item_count; i++) {
1475 btn = utils_add_btn(data->base, MAINICONBTN_STYLE,
1478 _ERR("Add btn failed\n");
1482 item = eina_list_nth(list, i);
1484 name = settingitem_get_display_name(item);
1485 elm_object_text_set(btn,
1486 utils_get_translation_str(name));
1488 elm_object_text_set(btn, ICON_BUTTON_NO_DISP_NAME);
1491 evas_object_event_callback_add(btn, EVAS_CALLBACK_KEY_DOWN,
1492 _main_setting_key_pressed_cb, data);
1493 evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_IN,
1494 _mainitem_btn_mouse_in_cb, data);
1495 evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_OUT,
1496 _mainitem_btn_mouse_out_cb, data);
1497 evas_object_smart_callback_add(btn, SIG_CLICKED,
1498 _mainitem_btn_clicked_cb, data);
1500 icon = elm_layout_add(btn);
1502 id = settingitem_get_id(item);
1504 _ERR("get item name failed.");
1505 evas_object_del(btn);
1509 snprintf(buf, sizeof(buf), "%s/%s.edj",
1511 elm_layout_file_set(icon, buf, id);
1512 elm_object_part_content_set(btn,
1513 MAINICONBTN_ICON_SWALLOW, icon);
1514 elm_object_signal_emit(icon, MAIN_BTN_NORMAL, MAIN_BTN);
1515 eina_array_push(data->main_icon_base, icon);
1518 elm_box_pack_end(data->mainitem_box, btn);
1519 evas_object_data_set(btn, SETTING_ID, settingitem_get_id(item));
1520 eina_array_push(data->main_item_btn, btn);
1527 * Create all the UI components of settings.
1529 * @param[in]: data : the user data.
1531 * @return: 0 - success, -1 - fail.
1533 static int _draw_main_items(struct _view_data *data)
1535 Evas_Object *box, *btn, *tmp, *icon;
1536 Eina_Array *btns, *icons;
1539 Eina_Array_Iterator a;
1541 if (!data || !data->base)
1544 box = utils_add_box(data->base);
1548 data->mainitem_box = box;
1551 list = viewdata_get_childitems_list(data->main_setting_view);
1553 cnt = eina_list_count(list);
1556 _ERR("There is no child item");
1557 evas_object_del(box);
1558 viewdata_free_childitems_list(list);
1562 data->main_item_count = cnt;
1564 btns = eina_array_new(1);
1566 _ERR("Create Eina Array failed\n");
1567 evas_object_del(box);
1568 viewdata_free_childitems_list(list);
1572 data->main_item_btn = btns;
1574 icons = eina_array_new(1);
1576 _ERR("new array for icon base failed.");
1577 evas_object_del(box);
1578 viewdata_free_childitems_list(list);
1579 eina_array_free(btns);
1583 data->main_icon_base = icons;
1585 if (_add_icon_btns(data, list) == -1) {
1586 _ERR("Fail to add icon buttons");
1590 elm_object_part_content_set(data->base, MAIN_VIEW_ICON_SWALLOW, box);
1592 if (!data->item_path) {
1593 btn = eina_array_data_get(btns, 0);
1597 if (_draw_subitems(data,
1598 evas_object_data_get(btn, SETTING_ID)) == -1)
1601 icon = eina_array_data_get(icons, 0);
1603 if (data->subsetting_view)
1604 viewdata_release(data->subsetting_view);
1608 elm_object_signal_emit(icon, MAIN_BTN_FOCUSED, MAIN_BTN);
1610 data->focus_status = FOCUS_MAIN_ITEM;
1612 elm_object_focus_set(btn, EINA_TRUE);
1613 data->focused_main_item_btn = btn;
1616 utils_set_focus_directions(data->main_item_btn, cnt);
1618 viewdata_free_childitems_list(list);
1623 evas_object_del(box);
1624 viewdata_free_childitems_list(list);
1625 EINA_ARRAY_ITER_NEXT(btns, i, tmp, a)
1626 evas_object_del(tmp);
1627 eina_array_free(btns);
1629 EINA_ARRAY_ITER_NEXT(icons, i, tmp, a)
1630 evas_object_del(tmp);
1631 eina_array_free(icons);
1637 * Edje_Signal_Cb type callback for handling signal.
1639 * @param[in]: data : the user data.
1640 * @param[in]: obj : the object signal occurred on.
1641 * @param[in]: emission : the signal name.
1642 * @param[in]: source : the source name.
1646 static void _view_anim_finish(void *data, Evas_Object *obj,
1647 const char *emission, const char *source)
1649 struct _view_data *priv;
1656 _draw_main_items(priv);
1660 * This function moves focus from main item to subitem and
1661 * does corresponding operations.
1663 * @param[in]: data : the user data.
1667 void _move_focus_on_subitem(struct _view_data *data)
1669 const char *path, *id;
1671 Evas_Object *icon, *subbtn, *pb;
1672 Eina_Array *subbtns;
1673 Eina_Array_Iterator a;
1674 struct settingitem *item;
1679 subbtns = data->sub_item_btn;
1681 path = eina_array_data_get(data->item_path, 0);
1683 EINA_ARRAY_ITER_NEXT(subbtns, i, subbtn, a) {
1684 item = evas_object_data_get(subbtn, SUBITEM_DATA_ID);
1685 id = settingitem_get_id(item);
1689 if (!strncmp(id, path, ARRAY_SIZE)) {
1690 icon = elm_object_part_content_get(
1691 data->focused_main_item_btn,
1692 MAINICONBTN_ICON_SWALLOW);
1694 elm_object_signal_emit(icon,
1695 MAIN_BTN_HIGHLIGHT, MAIN_BTN);
1697 data->focus_status = FOCUS_SUB_ITEM;
1698 data->focused_sub_item_btn = subbtn;
1700 elm_object_focus_set(subbtn, EINA_TRUE);
1701 elm_object_signal_emit(data->focused_main_item_btn,
1702 MAINICONBTN_FOCUSED_ON_SUBITEM,
1703 MAINICONBTN_MAIN_ITEM_SOURCE);
1705 pb = evas_object_data_get(subbtn, PROGRESS_BAR_DATA);
1707 elm_object_signal_emit(pb,
1708 SIG_UNCTRL_PB_FOCUSED,
1715 * Change the language of names of buttons.
1717 * @param[in]: list : eina list of item data.
1718 * @param[in]: btns : eina array containing buttons.
1719 * @param[in]: cnt : number of buttons.
1723 static void _change_buttons_name(Eina_List *list,
1724 Eina_Array *btns, int cnt)
1726 struct settingitem *item;
1731 if (!list || !btns || !cnt) {
1732 _ERR("Invalid argument");
1736 for (i = 0; i < cnt; i++) {
1737 item = eina_list_nth(list, i);
1738 btn = eina_array_data_get(btns, i);
1742 name = settingitem_get_display_name(item);
1744 elm_object_text_set(btn,
1745 utils_get_translation_str(name));
1750 * Create all UI components of settings view.
1752 * @param[in]: mgr : the view manager of settings.
1753 * @param[in]: view : the view data.
1754 * @param[in]: prev : the user data.
1756 * @return: the base layout of settings or null if error occurred.
1758 static Evas_Object *_create(struct setting_mgr *mgr,
1759 struct settingview_data *view, void *prev)
1761 Evas_Object *base, *win;
1762 struct _view_data *data;
1764 if (!mgr || !view) {
1765 _ERR("Invalid argument");
1769 win = settingmgr_get_win(mgr);
1771 _ERR("Fail to get win");
1775 data = calloc(1, sizeof(*data));
1779 base = elm_layout_add(win);
1785 if (!elm_layout_file_set(base, EDJ_FILE, MAIN_VIEW_PAGE))
1791 data->main_setting_view = view;
1792 data->subsetting_view = NULL;
1793 data->item_path = settingmgr_get_item_path(mgr);
1795 evas_object_data_set(base, DATA_ID, data);
1797 elm_object_signal_callback_add(base, MAIN_VIEW_ANIM_FINISH,
1798 MAIN_VIEW_SOURCE, _view_anim_finish, data);
1800 if (!data->item_path)
1801 elm_object_signal_emit(data->base, MAIN_VIEW_LOAD, "");
1803 _view_anim_finish(data, NULL, NULL, NULL);
1808 evas_object_del(base);
1815 * Show the view of settings.
1817 * @param[in]: base : the base layout of settings.
1821 static void _show(Evas_Object *base)
1823 struct _view_data *data;
1824 unsigned int cnt, i;
1825 const char *name, *path;
1826 Evas_Object *btn, *icon;
1828 Eina_Array_Iterator a;
1831 _ERR("Invalid argument");
1835 data = evas_object_data_get(base, DATA_ID);
1837 _ERR("evas object data get failed. id: %s", DATA_ID);
1843 if (data->item_path) {
1844 btns = data->main_item_btn;
1846 cnt = eina_array_count(data->item_path);
1848 path = eina_array_data_get(data->item_path, cnt - 2);
1853 EINA_ARRAY_ITER_NEXT(btns, i, btn, a) {
1854 name = evas_object_data_get(btn, SETTING_ID);
1858 if (!strncmp(name, path, ARRAY_SIZE)) {
1859 _draw_subitems(data, name);
1861 icon = eina_array_data_get(
1862 data->main_icon_base, i);
1864 elm_object_signal_emit(icon,
1868 elm_object_focus_set(btn, EINA_TRUE);
1870 data->focus_status = FOCUS_MAIN_ITEM;
1871 data->focused_main_item_btn = btn;
1873 _move_focus_on_subitem(data);
1878 evas_object_show(base);
1882 * Hide the view of settings.
1884 * @param[in]: base : the base layout of settings.
1888 static void _hide(Evas_Object *base)
1891 _ERR("Invalid argument");
1895 evas_object_hide(base);
1899 * Refresh the view of settings.
1901 * @param[in]: base : the base layout of settings.
1905 static void _refresh(Evas_Object *base)
1907 struct _view_data *data;
1911 struct settingitem *item;
1912 Eina_Array_Iterator a;
1913 Evas_Object *btn, *pb, *icon;
1918 data = evas_object_data_get(base, DATA_ID);
1922 sld = evas_object_data_del(base, SELECTED_ITEM_ID);
1924 EINA_ARRAY_ITER_NEXT(data->sub_item_btn, i, btn, a) {
1925 item = evas_object_data_get(btn, SUBITEM_DATA_ID);
1926 id = settingitem_get_id(item);
1930 if (item && !strncmp(sld, id, strlen(sld))) {
1931 data->focused_sub_item_btn = btn;
1937 if (data->focus_status == FOCUS_SUB_ITEM) {
1938 elm_object_focus_set(data->focused_sub_item_btn, EINA_TRUE);
1940 elm_object_signal_emit(data->focused_main_item_btn,
1941 MAINICONBTN_FOCUSED_ON_SUBITEM,
1942 MAINICONBTN_MAIN_ITEM_SOURCE);
1944 icon = elm_object_part_content_get(data->focused_main_item_btn,
1945 MAINICONBTN_ICON_SWALLOW);
1947 elm_object_signal_emit(icon,
1948 MAIN_BTN_HIGHLIGHT, MAIN_BTN);
1950 if (_refresh_subitems(data) == -1)
1951 _ERR("Refresh subitems failed");
1953 pb = evas_object_data_get(data->focused_sub_item_btn,
1956 elm_object_signal_emit(pb,
1957 SIG_UNCTRL_PB_FOCUSED, SRC_PB_PROG);
1960 if (settingmgr_get_timeout_freeze_state(data->mgr) == EINA_TRUE)
1961 settingmgr_thaw_timeout(data->mgr);
1965 * Destroy the view of settings.
1967 * @param[in]: base : the base layout of settings.
1971 static void _destroy(Evas_Object *base)
1973 struct _view_data *data;
1974 Eina_Array_Iterator a;
1979 _ERR("Parameter error!");
1983 data = evas_object_data_get(base, DATA_ID);
1985 if (data->sub_item_btn) {
1986 EINA_ARRAY_ITER_NEXT(data->sub_item_btn, i, tmp, a)
1987 evas_object_del(tmp);
1988 eina_array_free(data->sub_item_btn);
1991 if (data->main_item_btn) {
1992 EINA_ARRAY_ITER_NEXT(data->main_item_btn, i, tmp, a)
1993 evas_object_del(tmp);
1994 eina_array_free(data->main_item_btn);
1997 if (data->main_icon_base) {
1998 EINA_ARRAY_ITER_NEXT(data->main_icon_base, i, tmp, a)
1999 evas_object_del(tmp);
2000 eina_array_free(data->main_icon_base);
2003 if (data->main_setting_view)
2004 viewdata_release(data->main_setting_view);
2006 if (data->subsetting_view)
2007 viewdata_release(data->subsetting_view);
2010 evas_object_del(base);
2014 * Change the language of view of settings.
2016 * @param[in]: base : the base layout of settings.
2020 static void _lang_changed(Evas_Object *base)
2022 struct _view_data *data;
2027 _ERR("Invalid argument");
2031 data = evas_object_data_get(base, DATA_ID);
2036 l = viewdata_get_childitems_list(data->main_setting_view);
2038 cnt = eina_list_count(l);
2040 _change_buttons_name(l, data->main_item_btn, cnt);
2043 l = viewdata_get_childitems_list(data->subsetting_view);
2045 cnt = eina_list_count(l);
2047 _change_buttons_name(l, data->sub_item_btn, cnt);
2051 * Froze the view of settings.
2053 * @param[in]: base : the base layout of settings.
2057 static void _frozen(Evas_Object *base)
2059 struct _view_data *data;
2062 _ERR("Invalid argument");
2066 data = evas_object_data_get(base, DATA_ID);
2068 _ERR("Fail to get mainview data");
2072 evas_object_freeze_events_set(data->mainitem_box, EINA_TRUE);
2073 evas_object_freeze_events_set(data->subitem_box, EINA_TRUE);
2077 * Activate the view of settings.
2079 * @param[in]: base : the base layout of settings.
2083 static void _active(Evas_Object *base)
2085 struct _view_data *data;
2088 _ERR("Invalid argument");
2092 data = evas_object_data_get(base, DATA_ID);
2094 _ERR("Fail to get mainview data");
2098 evas_object_freeze_events_set(data->mainitem_box, EINA_FALSE);
2099 evas_object_freeze_events_set(data->subitem_box, EINA_FALSE);
2102 static struct setting_class _vclass = {
2103 .title = VCLASS_TITLE_MAIN_VIEW,
2106 .destroy = _destroy,
2108 .refresh = _refresh,
2111 .lang_changed = _lang_changed,
2116 * Return view class of settings view.
2120 * @return: the view class of settings view.
2122 struct setting_class *view_maincatalog_get_vclass(void)