3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * Licensed under the Flora License, Version 1.1 (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-network-3gcon-option.h>
19 static int setting_network_3gcon_create(void *cb);
20 static int setting_network_3gcon_destroy(void *cb);
21 static int setting_network_3gcon_update(void *cb);
22 static int setting_network_3gcon_cleanup(void *cb);
24 setting_view setting_view_network_3gcon = {
25 .create = setting_network_3gcon_create,
26 .destroy = setting_network_3gcon_destroy,
27 .update = setting_network_3gcon_update,
28 .cleanup = setting_network_3gcon_cleanup,
31 static void setting_network_3gcon_click_softkey_set_cb(void *data,
34 static void setting_network_3gcon_click_softkey_cancel_cb(void *data,
38 /* ***************************************************
42 ***************************************************/
44 static int setting_network_3gcon_create(void *cb)
47 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
49 SettingNetworkUG *ad = (SettingNetworkUG *) cb;
51 Evas_Object *scroller;
52 setting_push_layout_navi_bar_genlist(ad->win_main_layout, ad->win_get,
53 _("2G/3G connection"),
54 dgettext("sys_string", "IDS_COM_SK_CANCEL"),
55 dgettext("sys_string", "IDS_COM_SK_SET"),
56 setting_network_3gcon_click_softkey_cancel_cb,
57 setting_network_3gcon_click_softkey_set_cb,
58 ad, &scroller, ad->navi_bar);
60 /* scroller is a genlist */
61 ad->chk_3gcon = elm_radio_add(scroller);
62 elm_radio_state_value_set(ad->chk_3gcon, -1);
64 setting_create_Gendial_field_1radio(scroller, &itc_1text_1icon_2,
65 setting_mouse_up_Gendial_list_radio_cb,
66 ad->chk_3gcon, SWALLOW_Type_1RADIO,
68 SETTING_NETWORK_3GCON_NOT_USE,
71 setting_create_Gendial_field_1radio(scroller, &itc_1text_1icon_2,
72 setting_mouse_up_Gendial_list_radio_cb,
73 ad->chk_3gcon, SWALLOW_Type_1RADIO,
75 SETTING_NETWORK_3GCON_ASK_ON_CON,
76 _("IDS_ST_BODY_USB_ASK_ON_CONNECTION"), NULL);
77 setting_create_Gendial_field_1radio(scroller, &itc_1text_1icon_2,
78 setting_mouse_up_Gendial_list_radio_cb,
79 ad->chk_3gcon, SWALLOW_Type_1RADIO,
81 SETTING_NETWORK_3GCON_USE_WO_ASK,
82 "Use without asking", NULL);
86 err = vconf_get_int(VCONFKEY_3G_ENABLE, &value);
88 elm_radio_value_set(ad->chk_3gcon,
89 SETTING_NETWORK_3GCON_NOT_USE);
91 elm_radio_value_set(ad->chk_3gcon, value);
94 setting_view_network_3gcon.is_create = 1;
96 return SETTING_RETURN_SUCCESS;
99 static int setting_network_3gcon_destroy(void *cb)
103 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
105 SettingNetworkUG *ad = (SettingNetworkUG *) cb;
107 elm_naviframe_item_pop(ad->navi_bar);
108 setting_view_network_3gcon.is_create = 0;
110 return SETTING_RETURN_SUCCESS;
113 static int setting_network_3gcon_update(void *cb)
115 return SETTING_RETURN_SUCCESS;
118 static int setting_network_3gcon_cleanup(void *cb)
120 return setting_network_3gcon_destroy(cb);
123 /* ***************************************************
127 ***************************************************/
129 /* ***************************************************
133 ***************************************************/
136 setting_network_3gcon_click_softkey_set_cb(void *data, Evas_Object *obj,
140 retm_if(data == NULL, "Data parameter is NULL");
142 SettingNetworkUG *ad = (SettingNetworkUG *) data;
146 value = elm_radio_value_get(ad->chk_3gcon);
148 err = vconf_set_int(VCONFKEY_3G_ENABLE, value);
152 ("%s*** [ERR] Failed to set 3G connection option ***%s",
153 SETTING_FONT_RED, SETTING_FONT_BLACK);
156 setting_view_change(&setting_view_network_3gcon,
157 &setting_view_network_main, ad);
161 setting_network_3gcon_click_softkey_cancel_cb(void *data, Evas_Object *obj,
165 retm_if(data == NULL, "Data parameter is NULL");
167 SettingNetworkUG *ad = (SettingNetworkUG *) data;
169 setting_view_change(&setting_view_network_3gcon,
170 &setting_view_network_main, ad);