3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * Licensed under the Flora License, Version 1.0 (the License);
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://floralicense.org/license/
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an AS IS BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 #include <setting-task-switcher-viewtype.h>
19 static int setting_task_switcher_viewtype_create(void *cb);
20 static int setting_task_switcher_viewtype_destroy(void *cb);
21 static int setting_task_switcher_viewtype_update(void *cb);
22 static int setting_task_switcher_viewtype_cleanup(void *cb);
24 setting_view setting_view_task_switcher_viewtype = {
25 .create = setting_task_switcher_viewtype_create,
26 .destroy = setting_task_switcher_viewtype_destroy,
27 .update = setting_task_switcher_viewtype_update,
28 .cleanup = setting_task_switcher_viewtype_cleanup,
31 /* ***************************************************
35 ***************************************************/
37 static int setting_task_switcher_viewtype_create(void *cb)
41 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
43 SettingViewTypeUG *ad = (SettingViewTypeUG *) cb;
45 Evas_Object *navi_bar = NULL;
46 Evas_Object *scroller;
49 setting_create_layout_navi_bar_genlist(ad->win_main_layout,
52 ("IDS_ST_BODY_TASK_SWITCHER"),
53 dgettext("sys_string", "IDS_COM_SK_CANCEL"),
54 dgettext("sys_string", "IDS_COM_SK_SET"),
55 setting_task_switcher_viewtype_click_softkey_cancel_cb,
56 setting_task_switcher_viewtype_click_softkey_set_cb,
57 ad, &scroller, &navi_bar);
59 Elm_Object_Item *item = NULL;;
62 elm_genlist_item_append(scroller, &(ad->itc_seperator), NULL, NULL,
63 ELM_GENLIST_ITEM_NONE, NULL, NULL);
64 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
66 /* scroller is a genlist */
67 SETTING_TRACE("scroller:%p", scroller);
68 ad->chk_task = elm_radio_add(scroller);
69 elm_radio_state_value_set(ad->chk_task, -1);
71 setting_create_Gendial_field_1radio(scroller, &(ad->itc_1text_1icon_2),
72 setting_mouse_up_Gendial_list_radio_cb,
73 ad->chk_task, SWALLOW_Type_1RADIO,
75 VCONFKEY_TASKSWITCHER_VIEWTYPE_LIST,
76 "IDS_ST_BODY_LIST_VIEW", NULL);
78 setting_create_Gendial_field_1radio(scroller, &(ad->itc_1text_1icon_2),
79 setting_mouse_up_Gendial_list_radio_cb,
80 ad->chk_task, SWALLOW_Type_1RADIO,
82 VCONFKEY_TASKSWITCHER_VIEWTYPE_CARD,
84 #ifdef UNUSED_VCONFKEY
85 setting_update_chk_status(ad->chk_task,
86 INT_SLP_SETTING_TASKSWITCHER_VIEWTYPE);
88 setting_view_task_switcher_viewtype.is_create = 1;
89 return SETTING_RETURN_SUCCESS;
92 static int setting_task_switcher_viewtype_destroy(void *cb)
96 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
98 SettingViewTypeUG *ad = (SettingViewTypeUG *) cb;
100 if (ad->ly_task != NULL) {
101 evas_object_del(ad->ly_task);
102 setting_view_task_switcher_viewtype.is_create = 0;
105 return SETTING_RETURN_SUCCESS;
108 static int setting_task_switcher_viewtype_update(void *cb)
112 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
114 SettingViewTypeUG *ad = (SettingViewTypeUG *) cb;
116 if (ad->ly_task != NULL) {
117 evas_object_show(ad->ly_task);
118 #ifdef UNUSED_VCONFKEY
119 setting_update_chk_status(ad->chk_task,
120 INT_SLP_SETTING_TASKSWITCHER_VIEWTYPE);
123 return SETTING_RETURN_SUCCESS;
126 static int setting_task_switcher_viewtype_cleanup(void *cb)
130 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
132 SettingViewTypeUG *ad = (SettingViewTypeUG *) cb;
134 if (ad->ly_task != NULL) {
135 evas_object_hide(ad->ly_task);
138 return SETTING_RETURN_SUCCESS;
141 /* ***************************************************
145 ***************************************************/
147 /* ***************************************************
151 ***************************************************/
154 setting_task_switcher_viewtype_click_softkey_cancel_cb(void *data,
160 setting_retm_if(data == NULL, "Data parameter is NULL");
162 SettingViewTypeUG *ad = (SettingViewTypeUG *) data;
164 /* Send destroy request */
165 ug_destroy_me(ad->ug);
169 setting_task_switcher_viewtype_click_softkey_set_cb(void *data,
179 setting_retm_if(data == NULL, "Data parameter is NULL");
181 SettingViewTypeUG *ad = (SettingViewTypeUG *) data;
183 value = elm_radio_value_get(ad->chk_task);
184 SETTING_TRACE("value:%d", value);
185 #ifdef UNUSED_VCONFKEY
187 setting_set_int_slp_key(INT_SLP_SETTING_TASKSWITCHER_VIEWTYPE,
190 /* shared_gadget_send_command(SHARED_GADGET(ad), CLOSE_SETTING_DISPLAY_SG_CMD, NULL); */
191 /* Send message to ug */
192 /*bundle *b = bundle_create();
194 bundle_add(b, "updateType", "ON_OFF_TEXT");
195 bundle_add(b, "ON_OFF_TEXT", get_task_switcher_viewtype_str());
196 ug_send_result(ad->ug, b);
199 /* Send destroy request */
200 ug_destroy_me(ad->ug);