Remove the sim feature and deprecated vconf key
[apps/native/ug-mobile-ap.git] / src / mh_common_utility.c
1 /*
2 * ug-mobile-ap
3 *
4 * Copyright 2012-2013  Samsung Electronics Co., Ltd
5
6 * Licensed under the Flora License, Version 1.1 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9
10 * http://floralicense.org/license
11
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 */
19
20 #include "mh_common_utility.h"
21 #include "mobile_hotspot.h"
22
23 static mh_popup_type_e popup_type = MH_POPUP_NONE;
24 static Evas_Object *popup_content = NULL;
25 static char *popup_string = NULL;
26
27 static void __one_btn_popup_resp(void *data, Evas_Object *obj, void *event_info)
28 {
29         __MOBILE_AP_FUNC_ENTER__;
30
31         if (data == NULL || obj == NULL) {
32                 ERR("The param is NULL\n");
33                 return;
34         }
35
36         mh_appdata_t *ad = (mh_appdata_t *)data;
37
38         evas_object_del(ad->popup);
39         ad->popup = NULL;
40
41         DBG("popup_type : %d\n", popup_type);
42         switch (popup_type) {
43         case MH_POP_USB_CONNECT:
44                 _update_usb_item(ad, MH_STATE_NONE);
45                 vconf_ignore_key_changed(VCONFKEY_SETAPPL_USB_MODE_INT,
46                                 _handle_usb_mode_change);
47                 break;
48
49         case MH_POP_INFORMATION:
50                 break;
51
52         default:
53                 DBG("Unknown popup_type : %d\n", popup_type);
54                 break;
55         }
56
57         __MOBILE_AP_FUNC_EXIT__;
58 }
59
60 static void __alert_popup_resp(void *data, Evas_Object *obj, void *event_info)
61 {
62         __MOBILE_AP_FUNC_ENTER__;
63
64         if (data == NULL || obj == NULL) {
65                 ERR("The param is NULL\n");
66                 return;
67         }
68
69         mh_appdata_t *ad = (mh_appdata_t *)data;
70
71         evas_object_del(ad->popup);
72         ad->popup = NULL;
73
74         DBG("popup_type : %d\n", popup_type);
75         switch (popup_type) {
76         case MH_POP_INFORMATION_WO_BUTTON:
77                 break;
78
79         default:
80                 DBG("Unknown popup_type : %d\n", popup_type);
81                 break;
82         }
83
84         __MOBILE_AP_FUNC_EXIT__;
85 }
86
87 static void __popup_resp_yes(void *data, Evas_Object *obj, void *event_info)
88 {
89         __MOBILE_AP_FUNC_ENTER__;
90
91         if (data == NULL || obj == NULL) {
92                 ERR("The param is NULL\n");
93                 return;
94         }
95
96         mh_appdata_t *ad = (mh_appdata_t *)data;
97         bool wifi_state;
98         int ret = 0;
99
100         evas_object_del(ad->popup);
101         ad->popup = NULL;
102
103         DBG("popup_type : %d\n", popup_type);
104         switch (popup_type) {
105         case MH_POP_WIFI_ON_CONF:
106                 wifi_is_activated(&wifi_state);
107                 DBG("wifi_state : %d\n", wifi_state);
108                 if (wifi_state == false) {
109                         ret = vconf_set_int(VCONFKEY_MOBILE_HOTSPOT_WIFI_STATE,
110                                         VCONFKEY_MOBILE_HOTSPOT_WIFI_PENDING_ON);
111                         if (ret < 0)
112                                 ERR("vconf_set_int() is failed : %d\n", ret);
113
114                         if (_turn_on_wifi(ad) != 0) {
115                                 ERR("_turn_on_wifi is failed\n");
116                                 _update_wifi_item(ad, MH_STATE_NONE);
117                         }
118                 } else if (_is_wifi_direct_on() == true) {
119                         if (_turn_off_wifi_direct(ad) != 0) {
120                                 ERR("_turn_off_wifi_direct is failed\n");
121                                 _update_wifi_item(ad, MH_STATE_NONE);
122                         }
123                 } else {
124                         ret = tethering_enable(ad->handle, TETHERING_TYPE_WIFI);
125                         if (ret != TETHERING_ERROR_NONE) {
126                                 ERR("wifi tethering on is failed : %d\n", ret);
127                                 _update_wifi_item(ad, MH_STATE_NONE);
128                         }
129                 }
130                 break;
131
132         case MH_POP_WIFI_OFF_CONF:
133                 ret = tethering_disable(ad->handle, TETHERING_TYPE_WIFI);
134                 if (ret != TETHERING_ERROR_NONE) {
135                         ERR("wifi tethering off is failed : %d\n", ret);
136                         _update_wifi_item(ad, MH_STATE_NONE);
137                 }
138                 break;
139
140         case MH_POP_BT_ON_CONF:
141                 ret = tethering_enable(ad->handle, TETHERING_TYPE_BT);
142                 if (ret != TETHERING_ERROR_NONE) {
143                         ERR("Error enable bt tethering : %d\n", ret);
144                         _update_bt_item(ad, MH_STATE_NONE);
145                 }
146                 break;
147
148         case MH_POP_USB_ON_CONF:
149                 if (_get_vconf_usb_state() != VCONFKEY_SYSMAN_USB_AVAILABLE) {
150                         _prepare_popup(MH_POP_USB_CONNECT,
151                                         _("IDS_MOBILEAP_POP_CONNECT_USB_CABLE"));
152                         _create_popup(ad);
153                         vconf_notify_key_changed(VCONFKEY_SETAPPL_USB_MODE_INT,
154                                         _handle_usb_mode_change, (void *)ad);
155                         break;
156                 }
157
158                 _prepare_popup(MH_POP_USB_ON_PREVCONN_CONF,
159                                 _("IDS_MOBILEAP_POP_ENABLING_USB_TETHERING_WILL_DISCONNECT_PREVIOUS_USB_CONNECTION"));
160                 _create_popup(ad);
161                 break;
162
163         case MH_POP_USB_ON_PREVCONN_CONF:
164                 ret = tethering_enable(ad->handle, TETHERING_TYPE_USB);
165                 if (ret != TETHERING_ERROR_NONE) {
166                         ERR("Error enable usb tethering : %d\n", ret);
167                         _update_usb_item(ad, MH_STATE_NONE);
168                 }
169                 break;
170
171         case MH_POP_ENTER_TO_WIFI_SETUP_CONF:
172                 _update_wifi_item(ad, MH_STATE_PROCESS);
173                 ret = tethering_disable(ad->handle, TETHERING_TYPE_WIFI);
174                 if (ret != TETHERING_ERROR_NONE) {
175                         ERR("Wi-Fi tethering off is failed : %d\n", ret);
176                         _update_wifi_item(ad, MH_STATE_NONE);
177                 } else
178                         ad->main.need_recover_wifi_tethering = true;
179
180                 mh_draw_wifi_setup_view(ad);
181                 break;
182
183         default:
184                 DBG("Unknown popup_type : %d\n", popup_type);
185                 break;
186         }
187
188         __MOBILE_AP_FUNC_EXIT__;
189 }
190
191 static void __popup_resp_no(void *data, Evas_Object *obj, void *event_info)
192 {
193         __MOBILE_AP_FUNC_ENTER__;
194
195         if (data == NULL || obj == NULL) {
196                 ERR("The param is NULL\n");
197                 return;
198         }
199
200         mh_appdata_t *ad = (mh_appdata_t *)data;
201
202         evas_object_del(ad->popup);
203         ad->popup = NULL;
204
205         DBG("popup_type : %d\n", popup_type);
206         switch (popup_type) {
207         case MH_POP_WIFI_ON_CONF:
208                 _update_wifi_item(ad, MH_STATE_NONE);
209                 break;
210
211         case MH_POP_WIFI_OFF_CONF:
212                 _update_wifi_item(ad, MH_STATE_NONE);
213                 break;
214
215         case MH_POP_BT_ON_CONF:
216                 _update_bt_item(ad, MH_STATE_NONE);
217                 break;
218
219         case MH_POP_USB_ON_CONF:
220                 _update_usb_item(ad, MH_STATE_NONE);
221                 break;
222
223         case MH_POP_USB_ON_PREVCONN_CONF:
224                 _update_usb_item(ad, MH_STATE_NONE);
225                 break;
226
227         case MH_POP_ENTER_TO_WIFI_SETUP_CONF:
228                 break;
229
230         default:
231                 DBG("Unknown popup_type : %d\n", popup_type);
232                 break;
233         }
234
235         __MOBILE_AP_FUNC_EXIT__;
236 }
237
238 static bool _count_connected_clients_cb(tethering_client_h client, void *user_data)
239 {
240         if (user_data == NULL) {
241                 ERR("user_data is NULL\n");
242                 return true;
243         }
244
245         int *count = (int *)user_data;
246
247         *count += 1;
248
249         return true;
250 }
251
252 void _prepare_popup_with_content(int type, Evas_Object *obj)
253 {
254         __MOBILE_AP_FUNC_ENTER__;
255
256         if (obj == NULL) {
257                 ERR("param is NULL\n");
258                 return;
259         }
260
261         popup_type = type;
262
263         if (popup_content)
264                 evas_object_del(popup_content);
265         popup_content = obj;
266
267         if (popup_string) {
268                 free(popup_string);
269                 popup_string = NULL;
270         }
271
272         __MOBILE_AP_FUNC_EXIT__;
273 }
274
275 void _prepare_popup(int type, const char *str)
276 {
277         __MOBILE_AP_FUNC_ENTER__;
278
279         if (str == NULL) {
280                 ERR("param is NULL\n");
281                 return;
282         }
283
284         popup_type = type;
285         popup_content = NULL;
286
287         if (popup_string)
288                 free(popup_string);
289
290         popup_string = strndup(str, MH_LABEL_LENGTH_MAX);
291         if (popup_string == NULL)
292                 ERR("strndup is failed\n");
293
294         __MOBILE_AP_FUNC_EXIT__;
295 }
296
297 Eina_Bool _create_popup(mh_appdata_t *ad)
298 {
299         __MOBILE_AP_FUNC_ENTER__;
300
301         Evas_Object *btn = NULL;
302
303         if (ad == NULL) {
304                 ERR("The param is NULL\n");
305                 if (popup_string) {
306                         free(popup_string);
307                         popup_string = NULL;
308                 }
309                 popup_content = NULL;
310
311                 return EINA_FALSE;
312         }
313
314         if (ad->popup != NULL) {
315                 DBG("Pop-up already exists. Delete it.\n");
316                 evas_object_del(ad->popup);
317                 ad->popup = NULL;
318         }
319
320         DBG("Create_popup %d\n", popup_type);
321         switch (popup_type) {
322         case MH_POP_WIFI_ON_CONF:
323                 ad->popup = elm_popup_add(ad->win);
324                 evas_object_size_hint_weight_set(ad->popup,
325                                 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
326
327                 if (popup_content == NULL)
328                         elm_object_text_set(ad->popup, popup_string);
329                 else
330                         elm_object_content_set(ad->popup, popup_content);
331
332                 btn = elm_button_add(ad->popup);
333                 elm_object_style_set(btn, "popup_button/default");
334                 elm_object_text_set(btn, S_("IDS_COM_SK_OK"));
335                 elm_object_part_content_set(ad->popup, "button1", btn);
336                 evas_object_smart_callback_add(btn, "clicked",
337                                 __popup_resp_yes, (void *)ad);
338
339                 btn = elm_button_add(ad->popup);
340                 elm_object_style_set(btn, "popup_button/default");
341                 elm_object_text_set(btn, S_("IDS_COM_SK_CANCEL"));
342                 elm_object_part_content_set(ad->popup, "button2", btn);
343                 evas_object_smart_callback_add(btn, "clicked",
344                                 __popup_resp_no, (void *)ad);
345
346                 evas_object_show(ad->popup);
347                 break;
348
349         case MH_POP_WIFI_OFF_CONF:
350                 ad->popup = elm_popup_add(ad->win);
351                 evas_object_size_hint_weight_set(ad->popup,
352                                 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
353
354                 if (popup_content == NULL)
355                         elm_object_text_set(ad->popup, popup_string);
356                 else
357                         elm_object_content_set(ad->popup, popup_content);
358
359                 btn = elm_button_add(ad->popup);
360                 elm_object_style_set(btn, "popup_button/default");
361                 elm_object_text_set(btn, S_("IDS_COM_SK_YES"));
362                 elm_object_part_content_set(ad->popup, "button1", btn);
363                 evas_object_smart_callback_add(btn, "clicked",
364                                 __popup_resp_yes, (void *)ad);
365
366                 btn = elm_button_add(ad->popup);
367                 elm_object_style_set(btn, "popup_button/default");
368                 elm_object_text_set(btn, S_("IDS_COM_SK_NO"));
369                 elm_object_part_content_set(ad->popup, "button2", btn);
370                 evas_object_smart_callback_add(btn, "clicked",
371                                 __popup_resp_no, (void *)ad);
372
373                 evas_object_show(ad->popup);
374                 break;
375
376         case MH_POP_USB_CONNECT:
377                 ad->popup = elm_popup_add(ad->win);
378                 evas_object_size_hint_weight_set(ad->popup, EVAS_HINT_EXPAND,
379                                 EVAS_HINT_EXPAND);
380
381                 if (popup_content == NULL)
382                         elm_object_text_set(ad->popup, popup_string);
383                 else
384                         elm_object_content_set(ad->popup, popup_content);
385
386                 btn = elm_button_add(ad->popup);
387                 elm_object_style_set(btn, "popup_button/default");
388                 elm_object_text_set(btn, S_("IDS_COM_SK_CANCEL"));
389                 elm_object_part_content_set(ad->popup, "button1", btn);
390                 evas_object_smart_callback_add(btn, "clicked",
391                                 __one_btn_popup_resp, (void *)ad);
392
393                 evas_object_show(ad->popup);
394                 break;
395
396         case MH_POP_BT_ON_CONF:
397                 ad->popup = elm_popup_add(ad->win);
398                 evas_object_size_hint_weight_set(ad->popup,
399                                 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
400
401                 if (popup_content == NULL)
402                         elm_object_text_set(ad->popup, popup_string);
403                 else
404                         elm_object_content_set(ad->popup, popup_content);
405
406                 btn = elm_button_add(ad->popup);
407                 elm_object_style_set(btn, "popup_button/default");
408                 elm_object_text_set(btn, S_("IDS_COM_SK_OK"));
409                 elm_object_part_content_set(ad->popup, "button1", btn);
410                 evas_object_smart_callback_add(btn, "clicked",
411                                 __popup_resp_yes, (void *)ad);
412
413                 btn = elm_button_add(ad->popup);
414                 elm_object_style_set(btn, "popup_button/default");
415                 elm_object_text_set(btn, S_("IDS_COM_SK_CANCEL"));
416                 elm_object_part_content_set(ad->popup, "button2", btn);
417                 evas_object_smart_callback_add(btn, "clicked",
418                                 __popup_resp_no, (void *)ad);
419
420                 evas_object_show(ad->popup);
421                 break;
422
423         case MH_POP_USB_ON_CONF:
424         case MH_POP_USB_ON_PREVCONN_CONF:
425                 ad->popup = elm_popup_add(ad->win);
426                 evas_object_size_hint_weight_set(ad->popup,
427                                 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
428
429                 if (popup_content == NULL)
430                         elm_object_text_set(ad->popup, popup_string);
431                 else
432                         elm_object_content_set(ad->popup, popup_content);
433
434                 btn = elm_button_add(ad->popup);
435                 elm_object_style_set(btn, "popup_button/default");
436                 elm_object_text_set(btn, S_("IDS_COM_SK_OK"));
437                 elm_object_part_content_set(ad->popup, "button1", btn);
438                 evas_object_smart_callback_add(btn, "clicked",
439                                 __popup_resp_yes, (void *)ad);
440
441                 btn = elm_button_add(ad->popup);
442                 elm_object_style_set(btn, "popup_button/default");
443                 elm_object_text_set(btn, S_("IDS_COM_SK_CANCEL"));
444                 elm_object_part_content_set(ad->popup, "button2", btn);
445                 evas_object_smart_callback_add(btn, "clicked",
446                                 __popup_resp_no, (void *)ad);
447
448                 evas_object_show(ad->popup);
449                 break;
450
451         case MH_POP_INFORMATION:
452                 ad->popup = elm_popup_add(ad->win);
453                 evas_object_size_hint_weight_set(ad->popup, EVAS_HINT_EXPAND,
454                                 EVAS_HINT_EXPAND);
455
456                 if (popup_content == NULL)
457                         elm_object_text_set(ad->popup, popup_string);
458                 else
459                         elm_object_content_set(ad->popup, popup_content);
460
461                 btn = elm_button_add(ad->popup);
462                 elm_object_style_set(btn, "popup_button/default");
463                 elm_object_text_set(btn, S_("IDS_COM_POP_CLOSE"));
464                 elm_object_part_content_set(ad->popup, "button1", btn);
465                 evas_object_smart_callback_add(btn, "clicked",
466                                 __one_btn_popup_resp, (void *)ad);
467
468                 evas_object_show(ad->popup);
469                 break;
470
471         case MH_POP_INFORMATION_WO_BUTTON:
472                 ad->popup = elm_popup_add(ad->win);
473                 evas_object_size_hint_weight_set(ad->popup, EVAS_HINT_EXPAND,
474                                 EVAS_HINT_EXPAND);
475
476                 if (popup_content == NULL)
477                         elm_object_text_set(ad->popup, popup_string);
478                 else
479                         elm_object_content_set(ad->popup, popup_content);
480
481                 elm_popup_timeout_set(ad->popup, MH_POPUP_TIMEOUT);
482                 evas_object_smart_callback_add(ad->popup, "timeout",
483                                 __alert_popup_resp, (void *)ad);
484                 evas_object_smart_callback_add(ad->popup, "block,clicked",
485                                 __alert_popup_resp, (void *)ad);
486
487                 evas_object_show(ad->popup);
488                 break;
489
490         case MH_POP_ENTER_TO_WIFI_SETUP_CONF:
491                 ad->popup = elm_popup_add(ad->win);
492                 evas_object_size_hint_weight_set(ad->popup,
493                                 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
494
495                 if (popup_content == NULL)
496                         elm_object_text_set(ad->popup, popup_string);
497                 else
498                         elm_object_content_set(ad->popup, popup_content);
499
500                 btn = elm_button_add(ad->popup);
501                 elm_object_style_set(btn, "popup_button/default");
502                 elm_object_text_set(btn, S_("IDS_COM_SK_OK"));
503                 elm_object_part_content_set(ad->popup, "button1", btn);
504                 evas_object_smart_callback_add(btn, "clicked",
505                                 __popup_resp_yes, (void *)ad);
506
507                 btn = elm_button_add(ad->popup);
508                 elm_object_style_set(btn, "popup_button/default");
509                 elm_object_text_set(btn, S_("IDS_COM_SK_CANCEL"));
510                 elm_object_part_content_set(ad->popup, "button2", btn);
511                 evas_object_smart_callback_add(btn, "clicked",
512                                 __popup_resp_no, (void *)ad);
513
514                 evas_object_show(ad->popup);
515                 break;
516         default:
517                 ERR("Unknown popup_type : %d\n", popup_type);
518                 break;
519         }
520
521         if (popup_string) {
522                 free(popup_string);
523                 popup_string = NULL;
524         }
525         popup_content = NULL;
526
527         __MOBILE_AP_FUNC_EXIT__;
528
529         return EINA_TRUE;
530 }
531
532 void _destroy_popup(mh_appdata_t *ad)
533 {
534         __MOBILE_AP_FUNC_ENTER__;
535
536         if (ad && ad->popup) {
537                 evas_object_del(ad->popup);
538                 ad->popup = NULL;
539         }
540
541         if (popup_string) {
542                 free(popup_string);
543                 popup_string = NULL;
544         }
545         popup_content = NULL;
546         popup_type = MH_POPUP_NONE;
547
548         __MOBILE_AP_FUNC_EXIT__;
549
550         return;
551 }
552
553 Evas_Object *_create_bg(Evas_Object *parent, const char *style)
554 {
555         __MOBILE_AP_FUNC_ENTER__;
556
557         if (parent == NULL || style == NULL) {
558                 ERR("The param is NULL\n");
559                 return NULL;
560         }
561
562         Evas_Object *bg = NULL;
563
564         bg = elm_bg_add(parent);
565         if (bg == NULL) {
566                 ERR("bg is NULL\n");
567                 return NULL;
568         }
569
570         evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
571         elm_object_style_set(bg, style);
572         evas_object_show(bg);
573
574         return bg;
575 }
576
577 Evas_Object *_create_win_layout(mh_appdata_t *ad)
578 {
579         __MOBILE_AP_FUNC_ENTER__;
580
581         if (ad->win == NULL) {
582                 ERR("There is no main window\n");
583                 return NULL;
584         }
585
586         Evas_Object *layout;
587         Evas_Object *bg;
588
589         layout = elm_layout_add(ad->win);
590         if (layout == NULL) {
591                 ERR("layout is NULL\n");
592                 return NULL;
593         }
594
595         elm_layout_theme_set(layout, "layout", "application", "default");
596         evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND,
597                         EVAS_HINT_EXPAND);
598
599         bg = _create_bg(layout, "group_list");
600         if (bg == NULL) {
601                 ERR("bg is NULL\n");
602                 evas_object_del(layout);
603                 return NULL;
604         }
605         elm_object_part_content_set(layout, "elm.swallow.bg", bg);
606
607         evas_object_show(layout);
608
609         ad->layout = layout;
610         ad->bg = bg;
611
612         __MOBILE_AP_FUNC_EXIT__;
613
614         return layout;
615 }
616
617 Evas_Object *_create_naviframe(Evas_Object *parent)
618 {
619         __MOBILE_AP_FUNC_ENTER__;
620
621         if (parent == NULL) {
622                 ERR("parent is NULL\n");
623                 return NULL;
624         }
625
626         Evas_Object *naviframe;
627
628         naviframe = elm_naviframe_add(parent);
629         if (naviframe == NULL) {
630                 ERR("naviframe is NULL\n");
631                 return NULL;
632         }
633         evas_object_show(naviframe);
634
635         __MOBILE_AP_FUNC_EXIT__;
636
637         return naviframe;
638 }
639
640 void _handle_usb_mode_change(keynode_t *key, void *data)
641 {
642         mh_appdata_t *ad = (mh_appdata_t *)data;
643         int vconf_key = 0;
644
645         if (!data) {
646                 ERR("The param is NULL\n");
647                 return;
648         }
649
650         if (vconf_keynode_get_type(key) != VCONF_TYPE_INT) {
651                 ERR("Invalid vconf key\n");
652                 return;
653         }
654
655         vconf_key = vconf_keynode_get_int(key);
656         DBG("vconf_key : %d\n", vconf_key);
657         if (vconf_key == SETTING_USB_NONE_MODE) {
658                 DBG("usb-utilties is processing mode change\n");
659                 return;
660         }
661
662         vconf_ignore_key_changed(VCONFKEY_SETAPPL_USB_MODE_INT,
663                                 _handle_usb_mode_change);
664
665         evas_object_del(ad->popup);
666         ad->popup = NULL;
667
668         if (tethering_enable(ad->handle, TETHERING_TYPE_USB) != TETHERING_ERROR_NONE) {
669                 DBG("Error enable usb tethering\n");
670                 _update_usb_item(ad, MH_STATE_NONE);
671         }
672 }
673
674 int _get_vconf_hotspot_mode(void)
675 {
676         int value = VCONFKEY_MOBILE_HOTSPOT_MODE_NONE;
677
678         if (vconf_get_int(VCONFKEY_MOBILE_HOTSPOT_MODE, &value) < 0) {
679                 ERR("vconf_get_int is failed\n");
680                 return 0;
681         }
682
683         DBG("%s : %d\n", VCONFKEY_MOBILE_HOTSPOT_MODE, value);
684
685         return value;
686 }
687
688 Eina_Bool _get_no_of_connected_device(tethering_h handle, int *no, tethering_type_e type)
689 {
690         if (handle == NULL || no == NULL)
691                 return FALSE;
692
693         tethering_foreach_connected_clients(handle, type,
694                         _count_connected_clients_cb, (void *)no);
695
696         return TRUE;
697 }
698
699 Evas_Object *_create_label(Evas_Object *parent, const char *text)
700 {
701         Evas_Object *label;
702
703         label = elm_entry_add(parent);
704         if (label == NULL) {
705                 ERR("elm_entry_add is failed\n");
706                 return NULL;
707         }
708
709         elm_entry_editable_set(label, EINA_FALSE);
710         elm_entry_context_menu_disabled_set(label, EINA_TRUE);
711         elm_object_text_set(label, text);
712
713         evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0);
714         evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
715         evas_object_show(label);
716
717         return label;
718 }
719
720 Evas_Object *_create_slide_title(Evas_Object *parent, const char *text)
721 {
722         if (parent == NULL || text == NULL)
723                 return NULL;
724
725         Evas_Object *label;
726
727         label = elm_label_add(parent);
728         elm_object_style_set(label, "naviframe_title");
729         elm_label_slide_mode_set(label, ELM_LABEL_SLIDE_MODE_AUTO);
730         elm_label_wrap_width_set(label, 1);
731         elm_label_ellipsis_set(label, EINA_TRUE);
732         elm_object_text_set(label, text);
733         evas_object_show(label);
734
735         elm_access_object_unregister(label);
736         return label;
737 }