tizen 2.3 release
[apps/home/settings.git] / setting-network / src / setting-network-con-list.c
1 /*
2  * setting
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
5  *
6  * Contact: MyoungJune Park <mj2004.park@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21 #include <setting-network-con-list.h>
22
23 static int setting_network_con_list_create(void *cb);
24 static int setting_network_con_list_destroy(void *cb);
25 static int setting_network_con_list_update(void *cb);
26 static int setting_network_con_list_cleanup(void *cb);
27 void setting_network_con_list_chk_changed(void *data, Evas_Object *obj, void *event_info);
28
29 setting_view setting_view_network_con_list = {
30         .create = setting_network_con_list_create,
31         .destroy = setting_network_con_list_destroy,
32         .update = setting_network_con_list_update,
33         .cleanup = setting_network_con_list_cleanup,
34 };
35
36
37 /**
38  *  3
39  */
40 #if SUPPORT_TETHERING
41 static int __get_naviframe_depth_con_list(void* data)
42 {
43         SettingNetworkUG *ad = (SettingNetworkUG *) data;
44
45         Eina_List * list = elm_naviframe_items_get(ad->navi_bar);
46         //Object_Drawer *list_item = NULL;
47
48         int index = 0;
49         while (list) {
50                 Elm_Object_Item *item = (Elm_Object_Item *) eina_list_data_get(list);
51                 if (NULL == item)
52                         continue;
53
54                 SETTING_TRACE("ad->navi_bar : %x ---  %d --- address of the item = %x",ad->navi_bar, index, item);
55                 index += 1;
56
57                 //if not matched,to check next node.
58                 list = eina_list_next(list);
59                 item = NULL;
60         }
61         return index;
62 }
63
64 static void __popup_cb(void *data, Evas_Object *obj, void *event_info)
65 {
66         SETTING_TRACE_BEGIN;
67         setting_retm_if(NULL == data, "NULL == data");
68         SettingNetworkUG *ad = (SettingNetworkUG *) data;
69         int response_type = POPUP_RESPONSE_CANCEL;
70         if (0 == safeStrCmp(elm_object_text_get(obj), "OK"))
71         {
72                 response_type = POPUP_RESPONSE_OK;
73         }
74         evas_object_del(ad->popup_conlist);
75         ad->popup_conlist = NULL;
76
77         if (POPUP_RESPONSE_OK == response_type)
78         {
79                 setting_view_destroy(&setting_view_network_con_list, ad);
80                 setting_view_destroy(&setting_view_network_con, ad);
81         }
82 }
83 /**
84  * HERE
85  */
86
87 static void __enabled_tethering(void *data)
88 {
89         SettingNetworkUG *ad = (SettingNetworkUG *) data;
90         SETTING_TRACE("Tethering is enabled -- callback\n");
91
92         int frames =  __get_naviframe_depth_con_list(ad);
93         if ( frames == 3 )
94         {
95                 // create a popup
96                 ad->popup_conlist = setting_create_popup_with_btn(ad, ad->win_get,
97                                           NULL, _(SETTING_NETWORK_NOT_ALLOWED_WITH_TETHERING),
98                                          __popup_cb, 0, 1, "OK");
99         }
100 }
101
102 static void __disabled_tethering(void *data)
103 {
104         SETTING_TRACE("Tethering is disabled -- callback\n");
105         //setting_enable_genlist_item(ad->data_connection->item);
106 }
107
108 static void __enabled_cb(tethering_error_e error, tethering_type_e type, bool is_requested, void *data)
109 {
110         SETTING_TRACE_BEGIN;
111         SettingNetworkUG *ad = (SettingNetworkUG *) data;
112         SETTING_TRACE("Tethering is enabled -- callback\n");
113         __enabled_tethering(ad);
114 }
115
116 static void __disabled_cb(tethering_error_e error, tethering_type_e type, tethering_disabled_cause_e code, void *data)
117 {
118         SETTING_TRACE_BEGIN;
119         SettingNetworkUG *ad = (SettingNetworkUG *) data;
120         SETTING_TRACE("Tethering is disabled -- callback\n");
121         __disabled_tethering(ad);
122 }
123
124 /**
125  * DOCOMO required
126  * if tethering is ON, 'connection' should be inactivated.
127  */
128 static bool is_tethering_enabled(void* data)
129 {
130         SettingNetworkUG *ad = (SettingNetworkUG *) data;
131
132         bool ret = false;
133         tethering_h th = NULL;
134         (void) tethering_create(&th);
135
136         ad->th_conlists = th;
137
138         tethering_set_enabled_cb(th, TETHERING_TYPE_ALL, __enabled_cb, data);
139         tethering_set_disabled_cb(th, TETHERING_TYPE_ALL, __disabled_cb, data);
140
141         if (tethering_is_enabled(th, TETHERING_TYPE_WIFI) == true ||
142                         tethering_is_enabled(th, TETHERING_TYPE_USB) == true ||
143                         tethering_is_enabled(th, TETHERING_TYPE_BT) == true) {
144
145                 SETTING_TRACE("Tethering is enabled\n");
146                 __enabled_tethering(ad);
147                 ret = true;
148         } else {
149                 SETTING_TRACE("Tethering is not enabled\n");
150                 __disabled_tethering(ad);
151                 ret = false;;
152         }
153
154         //tethering_destroy(th);
155         return ret;
156 }
157 #endif
158
159 /* ***************************************************
160  *
161  *basic func
162  *
163  ***************************************************/
164 static int __con_list_recreate(void *cb)
165 {
166         SETTING_TRACE_BEGIN;
167         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
168         SettingNetworkUG *ad = (SettingNetworkUG *) cb;
169         Evas_Object *scroller;
170         scroller = ad->con_list_gl;
171         elm_genlist_clear(scroller);    /* first to clear list */
172         Elm_Object_Item *first_item;
173         /* item = elm_genlist_item_append(scroller, &itc_seperator, NULL, NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL); */
174         first_item = elm_genlist_item_append(scroller, &itc_seperator, NULL, NULL,
175                                     ELM_GENLIST_ITEM_NONE, NULL, NULL);
176         elm_genlist_item_select_mode_set(first_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
177
178         Evas_Object *radio;
179         Setting_GenGroupItem_Data *item_data = NULL;
180
181         radio = elm_radio_add(scroller);
182         elm_radio_state_value_set(radio, -1);
183         ad->rdg = radio;
184         setting_disable_evas_object(radio);
185
186         int srvType = ad->profile_service_type;
187
188         char *def_apn = NULL;
189         char *def_name = NULL;
190         char *def_id = NULL;
191         connection_profile_h def_profile = NULL;
192         (void) connection_get_default_cellular_service_profile(ad->connection, srvType, &def_profile);
193         if (def_profile) connection_profile_get_cellular_apn(def_profile, &def_apn);
194         if (def_profile) connection_profile_get_name(def_profile, &def_name);
195         if (def_profile) connection_profile_get_id(def_profile, &def_id);
196         SETTING_TRACE("Default profile:%p, def_apn[%s], def_name[%s], def_id[%s]", def_profile, def_apn, def_name, def_id);
197
198         setting_network_reget_profile_list(ad);
199
200         Eina_List* elist = NULL;
201         connection_profile_h profile_h = NULL;
202         int idx = 0;
203         char *id = NULL;
204         ad->selected_profile = NULL;
205         char *apn;
206         char *name;
207         char *proxy_address;
208         EINA_LIST_FOREACH(ad->profile_list, elist, profile_h)
209         {
210                 apn = name = NULL;
211                 connection_profile_get_cellular_apn(profile_h, &apn);
212                 connection_profile_get_name(profile_h, &name);
213                 connection_profile_get_proxy_address(profile_h, CONNECTION_ADDRESS_FAMILY_IPV4, &proxy_address);
214                 connection_profile_get_id(profile_h, &id);
215
216
217                 item_data = (Setting_GenGroupItem_Data *) calloc(1,sizeof(Setting_GenGroupItem_Data));
218                 setting_retvm_if(!item_data, SETTING_RETURN_FAIL, "calloc failed");
219                 item_data->keyStr = (char *)g_strdup(name);
220                 item_data->swallow_type = SWALLOW_Type_1RADIO_1BTN;
221                 item_data->r_swallow_path = (char *)g_strdup("reveal/extended");
222                 item_data->chk_status = idx;
223                 item_data->chk_change_cb = setting_network_con_list_chk_changed;
224                 item_data->stop_change_cb = setting_network_con_list_go_button_cb;
225                 item_data->rgd = radio;
226                 item_data->userdata = ad;
227                 item_data->sub_desc = (char *)g_strdup(apn);
228                 item_data->keyStr2 = (char *)g_strdup(id);
229                 if (idx ==0 )
230                 {
231                         ad->selected_profile = item_data; //defaulty,it the first item
232                         item_data->group_style = SETTING_GROUP_STYLE_TOP;
233                 }
234                 else
235                         item_data->group_style = SETTING_GROUP_STYLE_CENTER;
236
237                 item_data->item =
238                         elm_genlist_item_append(scroller, &(itc_2text_2icon_3), item_data, NULL,
239                                             ELM_GENLIST_ITEM_NONE,
240                                             setting_network_con_list_item_Gendial_mouse_up_cb, ad);
241                 if (idx == 0 )
242                         setting_genlist_item_groupstyle_set(item_data, SETTING_GROUP_STYLE_TOP);
243                 else
244                         setting_genlist_item_groupstyle_set(item_data, SETTING_GROUP_STYLE_CENTER);
245
246                 SETTING_TRACE("profile_h:%p, apn:%s, id:%s", profile_h, apn, id);
247                 if (!safeStrCmp(def_apn, apn) && !safeStrCmp(def_name, name) && !safeStrCmp(def_id, id))
248                 {
249                         SETTING_TRACE("Matched [idx:%d, apn:%s, id:%s]!", idx, apn, id);
250                         if (srvType == CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET)
251                         {
252                                 ad->selected_profile = item_data; //the selected item
253                                 elm_radio_value_set(radio, idx);
254                                 if(ad->internet_conn) {
255                                         G_FREE(ad->internet_conn->sub_desc);
256                                         FREE(ad->apn_internet);
257                                         ad->apn_internet = strdup(name);
258                                         ad->internet_conn->sub_desc = strdup(name);
259                                         elm_object_item_data_set(ad->internet_conn->item, ad->internet_conn);
260                                         elm_genlist_item_update( ad->internet_conn->item);
261                                 }
262                         }
263                 }
264
265                 G_FREE(apn);
266                 G_FREE(name);
267                 G_FREE(proxy_address);
268                 G_FREE(id);
269                 idx++;
270         }
271         ADD_GL_SEPARATOR(scroller);
272
273         setting_genlist_item_groupstyle_set(item_data, SETTING_GROUP_STYLE_BOTTOM);
274         SETTING_TRACE("idx:%d", idx);
275         Evas_Object *toolbar = elm_object_item_part_content_get(ad->navi_it_con_list, "toolbar");
276         SETTING_TRACE("elm_object_text_get(del_btn):%s", elm_object_item_text_get(elm_toolbar_last_item_get(toolbar)));
277         if(idx == 1)
278         {
279                 setting_genlist_item_groupstyle_set(item_data, SETTING_GROUP_STYLE_NONE);
280                 elm_object_item_disabled_set(elm_toolbar_last_item_get(toolbar), EINA_FALSE);
281         }
282         else if (idx > 1)
283         {
284                 setting_genlist_item_groupstyle_set(item_data, SETTING_GROUP_STYLE_BOTTOM);
285                 elm_object_item_disabled_set(elm_toolbar_last_item_get(toolbar), EINA_FALSE);
286         }
287         else
288         {
289                 FREE(ad->apn_internet);
290                 SETTING_TRACE("To disable");
291                 elm_object_item_disabled_set(elm_toolbar_last_item_get(toolbar), EINA_TRUE);
292         }
293         if (srvType == CONNECTION_CELLULAR_SERVICE_TYPE_MMS)
294         {
295                 if (idx > 0) elm_radio_value_set(radio, 0);//the first one
296                 if (ad->selected_profile && !isEmptyStr(ad->selected_profile->keyStr) && ad->mms_conn)
297                 {
298                         SETTING_TRACE("ad->selected_profile->keyStr:%s", ad->selected_profile->keyStr);
299                         G_FREE(ad->mms_conn->sub_desc);
300                         FREE(ad->apn_MMS);
301                         ad->apn_MMS = strdup(ad->selected_profile->keyStr);
302                         ad->mms_conn->sub_desc = strdup(ad->selected_profile->keyStr);
303                         elm_genlist_item_fields_update(ad->mms_conn->item, "*", ELM_GENLIST_ITEM_FIELD_TEXT);
304                 }
305         }
306         ad->cur_profile_num = idx;
307         //if (0 == idx)
308         //      setting_create_simple_popup(ad, ad->navi_bar,NULL, "There is no avaiable profile,you can create one.");
309
310         SETTING_TRACE_END;
311         G_FREE(def_id);
312         G_FREE(def_apn);
313         G_FREE(def_name);
314         return SETTING_RETURN_SUCCESS;
315 }
316
317 static int setting_network_con_list_create(void *cb)
318 {
319         SETTING_TRACE_BEGIN;
320         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
321
322         SettingNetworkUG *ad = (SettingNetworkUG *) cb;
323
324         Evas_Object *scroller = elm_genlist_add(ad->win_main_layout);
325         retvm_if(scroller == NULL, SETTING_DRAW_ERR_FAIL_SCROLLER,
326                  "Cannot set scroller object  as contento of layout");
327         elm_genlist_realization_mode_set(scroller, EINA_TRUE);
328         elm_object_style_set(scroller, "dialogue");
329
330         const char *title = NULL;
331         switch (ad->profile_service_type)
332         {
333             case CONNECTION_CELLULAR_SERVICE_TYPE_MMS:
334                 title = "IDS_ST_BODY_MMS_CONNECTIONS";
335                 break;
336             case CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET:
337                 title = "IDS_ST_BODY_INTERNET_CONNECTION";
338                 break;
339             default:
340                 title = ad->con_name;
341                 break;
342         }
343
344         ad->navi_it_con_list =
345                 setting_push_layout_navi_bar(_(title),
346                                      _("IDS_COM_BODY_BACK"),
347                                      _("IDS_COM_SK_DELETE"),
348                                      _("IDS_COM_BODY_CREATE"),
349                                      NULL,
350                                      setting_network_con_list_click_softkey_delete_cb,
351                                      setting_network_con_list_click_softkey_create_cb,
352                                      ad, scroller, ad->navi_bar, NULL);
353
354         elm_naviframe_item_pop_cb_set(ad->navi_it_con_list,
355                         setting_network_con_list_click_softkey_cancel_cb, ad);
356         evas_object_smart_callback_add(scroller, "realized", __gl_realized_cb, NULL);
357         ad->con_list_gl = scroller;
358         __con_list_recreate(ad);
359
360 #if SUPPORT_TETHERING
361         is_tethering_enabled(ad);
362 #endif
363         setting_view_network_con_list.is_create = 1;
364         SETTING_TRACE_END;
365         return SETTING_RETURN_SUCCESS;
366 }
367
368 static int setting_network_con_list_destroy(void *cb)
369 {
370         SETTING_TRACE_BEGIN;
371         /* error check */
372         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
373
374         SettingNetworkUG *ad = (SettingNetworkUG *) cb;
375         if  (setting_view_network_con_list.is_create) {
376                 //ad->connections_gl = NULL;
377 #if SUPPORT_TETHERING
378                 if (ad->th_conlists) {
379                         SETTING_TRACE("tethering destruction ");
380                         tethering_destroy(ad->th_conlists);
381                         ad->th_conlists = NULL;
382                 }
383 #endif
384                 setting_view_network_con_list.is_create = 0;
385                 ad->selected_profile = NULL;
386                 ad->navi_it_con_list = NULL;
387                 ad->con_list_gl = NULL;
388                 elm_naviframe_item_pop(ad->navi_bar);
389         } else {
390                 SETTING_TRACE("why is this is_create == 0 ?? !!!");
391         }
392         return SETTING_RETURN_SUCCESS;
393 }
394
395 static int setting_network_con_list_update(void *cb)
396 {
397         SETTING_TRACE_BEGIN;
398         /* error check */
399         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
400         __con_list_recreate(cb);
401         return SETTING_RETURN_SUCCESS;
402 }
403
404 static int setting_network_con_list_cleanup(void *cb)
405 {
406         SETTING_TRACE_BEGIN;
407         return setting_network_con_list_destroy(cb);
408         //return SETTING_RETURN_SUCCESS;
409 }
410
411 /* ***************************************************
412  *
413  *general func
414  *
415  ***************************************************/
416
417 /* ***************************************************
418  *
419  *call back func
420  *
421  ***************************************************/
422 static void setting_network_con_list_go_button_cb(void *data, Evas_Object * obj, void *event_info)
423 {
424         SETTING_TRACE_BEGIN;
425         retm_if(data == NULL, "Data parameter is NULL");
426         Setting_GenGroupItem_Data *item_data = data;
427
428         SettingNetworkUG *ad = item_data->userdata;
429         FREE(ad->access_name);
430         ad->access_name = strdup(item_data->keyStr2);
431         setting_view_change(&setting_view_network_con_list, &setting_view_network_connection_create, ad);
432 }
433
434 #if 0
435 static void ___network_con_set_default_cb(connection_error_e result, void* data)
436 {
437         SETTING_TRACE_BEGIN;
438         setting_retm_if(data == NULL, "Data parameter is NULL");
439         Setting_GenGroupItem_Data *list_item = data;
440         SettingNetworkUG *ad = list_item->userdata;
441         setting_retm_if(ad == NULL, "ad parameter is NULL");
442         if(ad->network_ug_pop) {
443                 evas_object_del(ad->network_ug_pop);
444                 ad->network_ug_pop = NULL;
445         }
446
447         int srvType = CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION;
448         if (0 == safeStrCmp(ad->con_name,"IDS_ST_BODY_INTERNET_CONNECTION"))
449         {
450                 srvType = CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET;
451         }
452         else if (0 == safeStrCmp(ad->con_name,STR_SETTING_MMS_CONNECTIONS))
453         {
454                 srvType = CONNECTION_CELLULAR_SERVICE_TYPE_MMS;
455         }
456         SETTING_TRACE("The result is :%d,but it is meaningless for our Setting", result);
457         ad->selected_profile = list_item;
458         if(srvType == CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET && ad->internet_conn) {
459                 G_FREE(ad->internet_conn->sub_desc);
460                 FREE(ad->apn_internet);
461                 ad->apn_internet = strdup(list_item->keyStr);
462                 ad->internet_conn->sub_desc = strdup(list_item->keyStr);
463                 elm_object_item_data_set(ad->internet_conn->item, ad->internet_conn);
464                 elm_genlist_item_update( ad->internet_conn->item);
465         }
466         elm_genlist_realized_items_update(ad->con_list_gl);
467 }
468 #endif
469
470 static void __set_default_response_cb(void *data, Evas_Object *obj,
471                                      void *event_info)
472 {
473         setting_retm_if(data == NULL, "Data parameter is NULL");
474         Setting_GenGroupItem_Data *list_item = data;
475         SettingNetworkUG *ad = list_item->userdata;
476
477         int srvType = CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION;
478         if (0 == safeStrCmp(ad->con_name,"IDS_ST_BODY_INTERNET_CONNECTION"))
479         {
480                 srvType = CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET;
481         }
482         else if (0 == safeStrCmp(ad->con_name,STR_SETTING_MMS_CONNECTIONS))
483         {
484                 srvType = CONNECTION_CELLULAR_SERVICE_TYPE_MMS;
485         }
486         //SETTING_TRACE("The result is :%d,but it is meaningless for our Setting", result);
487         ad->selected_profile = list_item;
488         if(srvType == CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET && ad->internet_conn) {
489                 G_FREE(ad->internet_conn->sub_desc);
490                 FREE(ad->apn_internet);
491                 ad->apn_internet = strdup(list_item->keyStr);
492                 ad->internet_conn->sub_desc = strdup(list_item->keyStr);
493                 elm_object_item_data_set(ad->internet_conn->item, ad->internet_conn);
494                 elm_genlist_item_update( ad->internet_conn->item);
495         }
496         elm_genlist_realized_items_update(ad->con_list_gl);
497
498         if (obj) {
499                 evas_object_del(obj);
500                 obj = NULL;
501         }
502 }
503
504
505 void __set_default_profile(void *data)
506 {
507         setting_retm_if(data == NULL, "Data parameter is NULL");
508         Setting_GenGroupItem_Data *list_item = data;
509         SettingNetworkUG *ad = list_item->userdata;
510         setting_retm_if(ad == NULL, "ad parameter is NULL");
511
512         connection_profile_iterator_h profile_iter = NULL;
513         connection_profile_h profile_h = NULL;
514         int rv = connection_get_profile_iterator(ad->connection, CONNECTION_ITERATOR_TYPE_REGISTERED, &profile_iter);
515         if (rv != CONNECTION_ERROR_NONE) {
516                 SETTING_TRACE_ERROR("Fail to get profile iterator [%d]", rv);
517                 return;
518         }
519
520         int cnt = 0;
521         char *apn = NULL;
522         char *profile_id = NULL;
523         connection_cellular_service_type_e service_type = CONNECTION_CELLULAR_SERVICE_TYPE_UNKNOWN;
524
525         int srvType = CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION;
526         if (0 == safeStrCmp(ad->con_name,"IDS_ST_BODY_INTERNET_CONNECTION"))
527         {
528                 srvType = CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET;
529         }
530         else if (0 == safeStrCmp(ad->con_name,STR_SETTING_MMS_CONNECTIONS))
531         {
532                 srvType = CONNECTION_CELLULAR_SERVICE_TYPE_MMS;
533         }
534         while (connection_profile_iterator_has_next(profile_iter)) {
535                 if (cnt >= MAX_PROFILE_NUM)
536                 {
537                         break;
538                 }
539                 if (connection_profile_iterator_next(profile_iter, &profile_h) != CONNECTION_ERROR_NONE) {
540                         SETTING_TRACE_ERROR("Fail to get profile handle");
541                         break;
542                 }
543                 if (connection_profile_get_cellular_service_type(profile_h, &service_type) != CONNECTION_ERROR_NONE) {
544                         SETTING_TRACE_ERROR("Fail to get service type");
545                         continue;
546                 }
547
548                 connection_profile_get_cellular_apn(profile_h, &apn);
549                 connection_profile_get_id(profile_h, &profile_id);
550                 if(srvType != service_type)
551                 {
552                         G_FREE(apn);
553                         continue;
554                 }
555
556                 SETTING_TRACE("Record[%d] profile is %s(%s)", cnt, apn, profile_id);
557                 if (0 == safeStrCmp(profile_id, list_item->keyStr2))
558                 {
559
560                         if (CONNECTION_CELLULAR_SERVICE_TYPE_MMS == srvType)
561                         {
562                                 setting_create_simple_popup(ad, ad->win_get, NULL, _("IDS_MSGF_POP_UNSUPPORTED"));
563                                 //elm_radio_value_set(list_item->eo_check, old_type);
564                                 if (ad->selected_profile)
565                                         elm_radio_value_set(list_item->eo_check, ad->selected_profile->chk_status);
566                                 break;
567                         }
568                         else
569                         {
570                                 SETTING_TRACE("Set default[%d] as [%s], profile:%p, id:%s", srvType, apn, profile_h, profile_id);
571                                 int ret = connection_set_default_cellular_service_profile(ad->connection, srvType, profile_h);
572                                 SETTING_TRACE("The result is :%d", ret);
573
574                                 if(ad->network_ug_pop) {
575                                         evas_object_del(ad->network_ug_pop);
576                                         ad->network_ug_pop = NULL;
577                                 }
578                                 if(ret != CONNECTION_ERROR_NONE){
579                                         if (ad->selected_profile)
580                                                 elm_radio_value_set(list_item->eo_check, ad->selected_profile->chk_status);
581
582                                         setting_create_popup_without_btn(list_item, ad->win_get, NULL,
583                                                                  _("IDS_COM_POP_FAILED"), NULL,
584                                                                  2.0, FALSE, FALSE);
585                                         return;
586                                 }
587
588                                 setting_create_popup_without_btn(list_item, ad->win_get, NULL,
589                                                                  _("IDS_COM_POP_PROCESSING"), __set_default_response_cb,
590                                                                  2.0, TRUE, FALSE);
591                         }
592                         break;
593                 }
594                 cnt++;
595         }
596         G_FREE(apn);
597         G_FREE(profile_id);
598
599 }
600 static void setting_network_con_list_item_Gendial_mouse_up_cb(void *data, Evas_Object *obj, void *event_info)
601 {
602         SETTING_TRACE_BEGIN;
603         /* error check */
604         setting_retm_if(data == NULL, "Data parameter is NULL");
605
606         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
607         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
608         elm_genlist_item_selected_set(item, 0);
609         Setting_GenGroupItem_Data *list_item =
610             (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
611
612         SETTING_TRACE("clicking item[%s]", _(list_item->keyStr));
613         if(list_item->chk_status == elm_radio_value_get(list_item->eo_check))
614         {
615                 SettingNetworkUG *ad = data;
616                 elm_genlist_realized_items_update(ad->con_list_gl);
617                 return;
618         }
619
620         elm_radio_value_set(list_item->eo_check, list_item->chk_status);
621         __set_default_profile(list_item);
622 }
623 void setting_network_con_list_chk_changed(void *data, Evas_Object *obj, void *event_info)
624 {
625         SETTING_TRACE_BEGIN;
626         retm_if(data == NULL || obj == NULL, "Parameter is NULL");
627         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *)data;
628         list_item->chk_status = elm_radio_value_get(obj);
629         __set_default_profile(list_item);
630
631 }
632
633 static void setting_network_con_list_click_softkey_delete_cb(void *data, Evas_Object *obj,void *event_info)
634 {
635         SETTING_TRACE_BEGIN;
636         /* error check */
637         retm_if(data == NULL, "Data parameter is NULL");
638
639         SettingNetworkUG *ad = (SettingNetworkUG *) data;
640         setting_view_change(&setting_view_network_con_list, &setting_view_network_profile_delete, ad);
641 }
642
643 static void setting_network_con_list_click_softkey_create_cb(void *data, Evas_Object *obj,void *event_info)
644 {
645         SETTING_TRACE_BEGIN;
646         /* error check */
647         retm_if(data == NULL, "Data parameter is NULL");
648
649         SettingNetworkUG *ad = (SettingNetworkUG *) data;
650
651         //setting_create_simple_popup(ad, ad->win_get, NULL, _("UX Undefined"));
652         //return;
653
654         //to add a new connection
655         //ad->con_type = -1;
656         //FREE(ad->con_name);
657         //ad->need_check_srvtype = FALSE;
658         //ad->con_name = strdup(STR_SETTING_NEW_CONNECTIONS);
659         FREE(ad->access_name);
660         setting_view_change(&setting_view_network_con_list, &setting_view_network_connection_create, ad);
661 }
662
663 static Eina_Bool
664 setting_network_con_list_click_softkey_cancel_cb(void *data, Elm_Object_Item *it)
665 {
666         SETTING_TRACE_BEGIN;
667         SETTING_TRACE_ERROR("TTT");
668         /* error check */
669         retvm_if(data == NULL, EINA_FALSE, "Data parameter is NULL");
670
671         SettingNetworkUG *ad = (SettingNetworkUG *) data;
672
673         setting_view_change(&setting_view_network_con_list,
674                             &setting_view_network_con, ad);
675         return EINA_TRUE;
676 }