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-network-3gcon-option.h>
20 static int setting_network_3gcon_create(void *cb);
21 static int setting_network_3gcon_destroy(void *cb);
22 static int setting_network_3gcon_update(void *cb);
23 static int setting_network_3gcon_cleanup(void *cb);
25 setting_view setting_view_network_3gcon = {
26 .create = setting_network_3gcon_create,
27 .destroy = setting_network_3gcon_destroy,
28 .update = setting_network_3gcon_update,
29 .cleanup = setting_network_3gcon_cleanup,
32 static void setting_network_3gcon_click_softkey_set_cb(void *data,
35 static void setting_network_3gcon_click_softkey_cancel_cb(void *data,
39 /* ***************************************************
43 ***************************************************/
45 static int setting_network_3gcon_create(void *cb)
48 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
50 SettingNetworkUG *ad = (SettingNetworkUG *) cb;
52 Evas_Object *scroller;
53 setting_push_layout_navi_bar_genlist(ad->win_main_layout, ad->win_get,
54 _("2G/3G connection"),
55 dgettext("sys_string", "IDS_COM_SK_CANCEL"),
56 dgettext("sys_string", "IDS_COM_SK_SET"),
57 setting_network_3gcon_click_softkey_cancel_cb,
58 setting_network_3gcon_click_softkey_set_cb,
59 ad, &scroller, ad->navi_bar);
61 /* scroller is a genlist */
62 ad->chk_3gcon = elm_radio_add(scroller);
63 elm_radio_state_value_set(ad->chk_3gcon, -1);
65 setting_create_Gendial_field_1radio(scroller, &(ad->itc_1text_1icon_2),
66 setting_mouse_up_Gendial_list_radio_cb,
67 ad->chk_3gcon, SWALLOW_Type_1RADIO,
69 SETTING_NETWORK_3GCON_NOT_USE,
72 setting_create_Gendial_field_1radio(scroller, &(ad->itc_1text_1icon_2),
73 setting_mouse_up_Gendial_list_radio_cb,
74 ad->chk_3gcon, SWALLOW_Type_1RADIO,
76 SETTING_NETWORK_3GCON_ASK_ON_CON,
77 _("IDS_ST_BODY_USB_ASK_ON_CONNECTION"), NULL);
78 setting_create_Gendial_field_1radio(scroller, &(ad->itc_1text_1icon_2),
79 setting_mouse_up_Gendial_list_radio_cb,
80 ad->chk_3gcon, SWALLOW_Type_1RADIO,
82 SETTING_NETWORK_3GCON_USE_WO_ASK,
83 "Use without asking", NULL);
87 err = vconf_get_int(VCONFKEY_3G_ENABLE, &value);
89 elm_radio_value_set(ad->chk_3gcon,
90 SETTING_NETWORK_3GCON_NOT_USE);
92 elm_radio_value_set(ad->chk_3gcon, value);
95 setting_view_network_3gcon.is_create = 1;
97 return SETTING_RETURN_SUCCESS;
100 static int setting_network_3gcon_destroy(void *cb)
104 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
106 SettingNetworkUG *ad = (SettingNetworkUG *) cb;
108 elm_naviframe_item_pop(ad->navi_bar);
109 setting_view_network_3gcon.is_create = 0;
111 return SETTING_RETURN_SUCCESS;
114 static int setting_network_3gcon_update(void *cb)
116 return SETTING_RETURN_SUCCESS;
119 static int setting_network_3gcon_cleanup(void *cb)
121 return setting_network_3gcon_destroy(cb);
124 /* ***************************************************
128 ***************************************************/
130 /* ***************************************************
134 ***************************************************/
137 setting_network_3gcon_click_softkey_set_cb(void *data, Evas_Object *obj,
141 retm_if(data == NULL, "Data parameter is NULL");
143 SettingNetworkUG *ad = (SettingNetworkUG *) data;
147 value = elm_radio_value_get(ad->chk_3gcon);
149 err = vconf_set_int(VCONFKEY_3G_ENABLE, value);
153 ("%s*** [ERR] Failed to set 3G connection option ***%s",
154 SETTING_FONT_RED, SETTING_FONT_BLACK);
157 setting_view_change(&setting_view_network_3gcon,
158 &setting_view_network_main, ad);
162 setting_network_3gcon_click_softkey_cancel_cb(void *data, Evas_Object *obj,
166 retm_if(data == NULL, "Data parameter is NULL");
168 SettingNetworkUG *ad = (SettingNetworkUG *) data;
170 setting_view_change(&setting_view_network_3gcon,
171 &setting_view_network_main, ad);