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