4 * Copyright 2012 Samsung Electronics Co., Ltd
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
10 * http://www.tizenopensource.org/license
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.
22 #include <ui-gadget-module.h>
23 #include <bundle_internal.h>
24 #include <efl_extension.h>
25 #include <libxml/xmlmemory.h>
26 #include <libxml/parser.h>
27 #include <libxml/tree.h>
28 #include <system_info.h>
32 #include "common_utils.h"
33 #include "i18nmanager.h"
35 #define SUPPLICANT_SERVICE "fi.w1.wpa_supplicant1"
36 #define SUPPLICANT_SERVICE_INTERFACE SUPPLICANT_SERVICE ".Interface"
37 #define COLOR_TABLE "/usr/apps/wifi-efl-ug/shared/res/tables/ug-wifi-efl_ChangeableColorTable.xml"
38 #define FONT_TABLE "/usr/apps/wifi-efl-ug/shared/res/tables/ug-wifi-efl_FontInfoTable.xml"
40 #define MODEL_CONFIG_FILE "/etc/config/model-config.xml"
41 #define TYPE_FIELD "string"
42 #define FEATURE_TAG "platform"
43 #define MODEL_CONFIG_TAG "model-config"
46 #define BUTTON_CIRCLE_SIZE 40
47 #define COMMON_BUTTON_CIRCLE_SIZE 30
48 #define OOBE_BUTTON_CIRCLE_SIZE_H 33
49 #define OOBE_BUTTON_CIRCLE_SIZE_W 45
52 #define SMALL_FONT_SIZE 28
53 #define MID_FONT_SIZE 30
54 #define BIG_FONT_SIZE 32
55 #define COMMON_SMALL_FONT_SIZE 18
56 #define COMMON_BIG_FONT_SIZE 22
57 #define OOBE_SMALL_FONT_SIZE 16
58 #define OOBE_MID_FONT_SIZE 18
59 #define OOBE_BIG_FONT_SIZE 20
62 #define PROGRESS_SMALL "process_small"
63 #define PROGRESS_MID "process_medium"
66 TIZEN_MODEL_UNKNOWN = 0,
67 TIZEN_MODEL_EMULATOR = 0x1,
68 TIZEN_MODEL_NOT_EMULATOR = 0x2,
71 static tizen_model_t emulator = TIZEN_MODEL_UNKNOWN;
72 static UG_TYPE g_ug_type = UG_VIEW_DEFAULT;
77 } two_line_disp_data_t;
79 struct managed_idle_data {
85 struct gdbus_connection_data {
86 GDBusConnection *connection;
87 guint subscribe_id_supplicant;
90 static GSList *managed_idler_list = NULL;
91 static int (*rotate_cb)(enum appcore_rm, void*, Eina_Bool, Eina_Bool) = NULL;
92 static void *rotate_cb_data = NULL;
93 static Eina_Bool is_wps = EINA_FALSE;
94 static Eina_Bool is_setting = EINA_FALSE;
95 static Eina_Bool is_portrait_mode = EINA_TRUE;
96 static Ecore_Timer *scan_update_timer = NULL;
98 genlist_info_t g_genlist_info[WIFI_GENLIST_STYLE_MAX];
99 content_size_info_t g_content_size_info;
101 static char *__common_utils_2line_text_get(void *data, Evas_Object *obj, const char *part)
103 two_line_disp_data_t *item_data = (two_line_disp_data_t *)data;
104 if (!strcmp(g_genlist_info[WIFI_GENLIST_1LINE_STYLE].text_part, part))
105 return g_strdup(item_data->title_str);
106 else if (!strcmp(g_genlist_info[WIFI_GENLIST_1LINE_STYLE].sub_text_part, part))
107 return g_strdup(item_data->info_str);
112 static void __common_utils_2line_text_del(void *data, Evas_Object *obj)
114 two_line_disp_data_t *item_data = (two_line_disp_data_t *)data;
116 g_free(item_data->info_str);
117 g_free(item_data->title_str);
122 static void __common_utils_separator_del(void *data, Evas_Object *obj)
124 elm_genlist_item_class_free(data);
128 Eina_Bool common_utils_is_portrait_mode(void)
130 return is_portrait_mode;
133 static void __common_utils_set_portrait_mode(Eina_Bool on)
135 is_portrait_mode = on;
138 void common_utils_set_rotate_cb(int (*func)(enum appcore_rm, void*, Eina_Bool, Eina_Bool),
139 void *data, Eina_Bool wps_value, Eina_Bool setting_value)
142 rotate_cb_data = data;
144 is_setting = setting_value;
147 static void __common_utils_rotate_popup(enum appcore_rm rotmode)
150 rotate_cb(rotmode, rotate_cb_data, is_wps, is_setting);
153 void common_utils_contents_rotation_adjust(int event)
155 if (event == UG_EVENT_ROTATE_PORTRAIT ||
156 event == UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN) {
157 __common_utils_rotate_popup(APPCORE_RM_PORTRAIT_NORMAL);
158 __common_utils_set_portrait_mode(EINA_TRUE);
160 __common_utils_rotate_popup(APPCORE_RM_LANDSCAPE_NORMAL);
161 __common_utils_set_portrait_mode(EINA_FALSE);
165 Elm_Object_Item* common_utils_add_dialogue_separator(Evas_Object* genlist, const char *separator_style)
167 assertm_if(NULL == genlist, "NULL!!");
169 static Elm_Genlist_Item_Class *separator_itc;
170 separator_itc = elm_genlist_item_class_new();
171 separator_itc->item_style = separator_style;
172 separator_itc->func.text_get = NULL;
173 separator_itc->func.content_get = NULL;
174 separator_itc->func.state_get = NULL;
175 separator_itc->func.del = __common_utils_separator_del;
177 Elm_Object_Item* sep = elm_genlist_item_append(
182 ELM_GENLIST_ITEM_GROUP,
186 assertm_if(NULL == sep, "NULL!!");
188 elm_genlist_item_select_mode_set(sep, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
193 char *common_utils_get_ap_security_type_info_txt(const char *pkg_name,
194 wifi_device_info_t *device_info, bool check_fav)
196 bool favorite = false;
198 char *status_txt = NULL;
200 switch (device_info->security_mode) {
201 case WIFI_MANAGER_SECURITY_TYPE_NONE: /** Security disabled */
202 status_txt = g_strdup(sc(pkg_name, I18N_TYPE_Open));
204 case WIFI_MANAGER_SECURITY_TYPE_WEP: /** WEP */
205 case WIFI_MANAGER_SECURITY_TYPE_WPA_PSK: /** WPA-PSK */
206 case WIFI_MANAGER_SECURITY_TYPE_WPA2_PSK: /** WPA2-PSK */
207 if (TRUE == device_info->wps_mode) {
208 status_txt = g_strdup_printf("%s (%s)", sc(pkg_name,
209 I18N_TYPE_Secured), sc(pkg_name, I18N_TYPE_WPS_Available));
211 status_txt = g_strdup(sc(pkg_name, I18N_TYPE_Secured));
214 case WIFI_MANAGER_SECURITY_TYPE_EAP: /** EAP */
215 status_txt = g_strdup_printf("%s (%s)", sc(pkg_name, I18N_TYPE_Secured),
216 sc(pkg_name, I18N_TYPE_EAP));
218 default: /** Unknown */
219 status_txt = g_strdup(sc(pkg_name, I18N_TYPE_Unknown));
223 if (true == check_fav) {
224 wifi_manager_ap_is_favorite(device_info->ap, &favorite);
225 if (true == favorite) {
227 status_txt = g_strdup_printf("%s, %s",
228 sc(pkg_name, I18N_TYPE_Saved), temp);
236 void common_utils_get_device_icon(wifi_device_info_t *device_info, char **icon_path)
238 char buf[MAX_DEVICE_ICON_PATH_STR_LEN] = {'\0', };
240 g_strlcat(buf, "A01-3_icon", sizeof(buf));
242 if (device_info->security_mode != WIFI_MANAGER_SECURITY_TYPE_NONE)
243 g_strlcat(buf, "_lock", sizeof(buf));
245 switch (wlan_manager_get_signal_strength(device_info->rssi)) {
246 case SIGNAL_STRENGTH_TYPE_EXCELLENT:
247 g_strlcat(buf, "_03", sizeof(buf));
249 case SIGNAL_STRENGTH_TYPE_GOOD:
250 g_strlcat(buf, "_02", sizeof(buf));
252 case SIGNAL_STRENGTH_TYPE_WEAK:
253 g_strlcat(buf, "_01", sizeof(buf));
255 case SIGNAL_STRENGTH_TYPE_VERY_WEAK:
257 g_strlcat(buf, "_00", sizeof(buf));
262 *icon_path = g_strdup_printf("%s", buf);
265 char *common_utils_get_rssi_text(const char *str_pkg_name, int rssi)
267 switch (wlan_manager_get_signal_strength(rssi)) {
268 case SIGNAL_STRENGTH_TYPE_EXCELLENT:
269 return g_strdup(sc(str_pkg_name, I18N_TYPE_Excellent));
270 case SIGNAL_STRENGTH_TYPE_GOOD:
271 return g_strdup(sc(str_pkg_name, I18N_TYPE_Good));
273 return g_strdup(sc(str_pkg_name, I18N_TYPE_Weak));
277 void common_utils_set_edit_box_imf_panel_evnt_cb(Elm_Object_Item *item,
278 imf_ctxt_panel_cb_t input_panel_cb, void *user_data)
280 __COMMON_FUNC_ENTER__;
281 common_utils_entry_info_t *entry_info;
282 entry_info = elm_object_item_data_get(item);
286 entry_info->input_panel_cb = input_panel_cb;
287 entry_info->input_panel_cb_data = user_data;
289 Evas_Object *entry = elm_object_item_part_content_get(item, "elm.icon.entry");
290 Ecore_IMF_Context *imf_ctxt = elm_entry_imf_context_get(entry);
291 if (imf_ctxt && entry_info->input_panel_cb) {
292 /* Deleting the previously attached callback */
293 ecore_imf_context_input_panel_event_callback_del(imf_ctxt,
294 ECORE_IMF_INPUT_PANEL_STATE_EVENT,
295 entry_info->input_panel_cb);
296 ecore_imf_context_input_panel_event_callback_add(imf_ctxt,
297 ECORE_IMF_INPUT_PANEL_STATE_EVENT,
298 entry_info->input_panel_cb,
299 entry_info->input_panel_cb_data);
300 DEBUG_LOG(UG_NAME_NORMAL, "set the imf ctxt cbs");
303 __COMMON_FUNC_EXIT__;
307 void common_utils_edit_box_focus_set(Elm_Object_Item *item, Eina_Bool focus_set)
309 __COMMON_FUNC_ENTER__;
313 Evas_Object *entry = elm_object_item_part_content_get(item, "elm.icon.entry");
316 elm_object_focus_set(entry, focus_set);
317 elm_object_focus_allow_set(entry, focus_set);
320 __COMMON_FUNC_EXIT__;
324 void common_utils_edit_box_allow_focus_set(Elm_Object_Item *item,
327 __COMMON_FUNC_ENTER__;
331 Evas_Object *entry = elm_object_item_part_content_get(item, "elm.icon.entry");
332 elm_object_focus_allow_set(entry, focus_set);
334 __COMMON_FUNC_EXIT__;
338 Elm_Object_Item *common_utils_add_2_line_txt_disabled_item(
339 Evas_Object* view_list, const char *style_name,
340 const char *line1_txt, const char *line2_txt)
342 static Elm_Genlist_Item_Class two_line_display_itc;
343 two_line_disp_data_t *two_line_data = NULL;
344 Elm_Object_Item *item = NULL;
346 two_line_display_itc.item_style = style_name;
347 two_line_display_itc.func.text_get = __common_utils_2line_text_get;
348 two_line_display_itc.func.content_get = NULL;
349 two_line_display_itc.func.state_get = NULL;
350 two_line_display_itc.func.del = __common_utils_2line_text_del;
352 two_line_data = g_new0(two_line_disp_data_t, 1);
353 two_line_data->title_str = g_strdup(line1_txt);
354 two_line_data->info_str = g_strdup(line2_txt);
355 SECURE_INFO_LOG(UG_NAME_NORMAL, "title_str = %s info_str = %s",
356 two_line_data->title_str, two_line_data->info_str);
358 item = elm_genlist_item_append(view_list, &two_line_display_itc,
359 two_line_data, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
360 elm_object_item_disabled_set(item, TRUE);
365 char *common_utils_get_list_item_entry_txt(Elm_Object_Item *entry_item)
367 common_utils_entry_info_t *entry_info =
368 (common_utils_entry_info_t *)elm_object_item_data_get(entry_item);
369 if (entry_info == NULL)
372 DEBUG_LOG(UG_NAME_NORMAL, "entry_info: %p", entry_info);
374 return g_strdup(entry_info->entry_txt);
377 Evas_Object *common_utils_create_layout(Evas_Object *navi_frame)
380 layout = elm_layout_add(navi_frame);
382 if (g_ug_type == UG_VIEW_IOT_COMMON) {
383 elm_layout_file_set(layout, MAIN_LAYOUT_EDJ_PATH, "main_layout");
385 elm_layout_theme_set(layout, "layout", "application", "noindicator");
386 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
387 evas_object_show(layout);
393 static void __common_utils_del_popup(void *data, Evas_Object *obj, void *event_info)
395 Evas_Object *popup = (Evas_Object *)data;
396 evas_object_del(popup);
399 Evas_Object *common_utils_show_info_popup(Evas_Object *parent,
400 popup_btn_info_t *popup_data)
402 __COMMON_FUNC_ENTER__;
404 Evas_Object *popup = elm_popup_add(parent);
406 double vertical = g_ug_type == UG_VIEW_OOBE ? 0.5 : 1.0;
409 ERROR_LOG(UG_NAME_ERR, "Could not add popup");
413 elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, vertical);
414 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
416 if (popup_data->title_txt) {
417 char *full_txt = NULL;
418 txt = evas_textblock_text_utf8_to_markup(NULL, popup_data->title_txt);
419 if (g_ug_type == UG_VIEW_OOBE)
420 full_txt = g_strdup_printf("<align=left>%s: <b>%s</b></align>",
421 sc(PACKAGE, I18N_TYPE_Ssid), txt);
422 elm_object_domain_translatable_part_text_set(popup,
423 "title,text", PACKAGE, g_ug_type == UG_VIEW_OOBE ? full_txt : txt);
429 if (g_ug_type == UG_VIEW_OOBE && popup_data->sub_title_txt) {
430 txt = g_strdup_printf("<align=left>%s: <b>%s</b></align>",
431 sc(PACKAGE, I18N_TYPE_Security),
432 popup_data->sub_title_txt);
433 elm_object_part_text_set(popup, "subtitle,text", txt);
438 if (popup_data->info_txt) {
439 elm_object_domain_translatable_text_set(popup, PACKAGE,
440 popup_data->info_txt);
443 if (popup_data->btn1_txt) {
444 Evas_Object *btn_1 = elm_button_add(popup);
446 if (g_ug_type== UG_VIEW_OOBE)
447 elm_object_style_set(btn_1, "cancel");
449 elm_object_style_set(btn_1, "popup");
451 elm_object_domain_translatable_text_set(btn_1, PACKAGE,
452 popup_data->btn1_txt);
453 elm_object_part_content_set(popup, "button1", btn_1);
454 if (popup_data->btn1_cb) {
455 evas_object_smart_callback_add(btn_1, "clicked",
456 popup_data->btn1_cb, popup_data->btn1_data);
457 eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK,
458 popup_data->btn1_cb, popup_data->btn1_data);
460 evas_object_smart_callback_add(btn_1, "clicked",
461 __common_utils_del_popup, popup);
462 eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK,
463 __common_utils_del_popup, popup);
467 if (popup_data->btn2_txt) {
468 Evas_Object *btn_2 = elm_button_add(popup);
470 if (g_ug_type == UG_VIEW_OOBE)
471 elm_object_style_set(btn_2, "connect");
473 elm_object_style_set(btn_2, "popup");
475 /* This button reference used in case of hidden AP case */
476 popup_data->btn = btn_2;
477 elm_object_domain_translatable_text_set(btn_2, PACKAGE,
478 popup_data->btn2_txt);
479 elm_object_part_content_set(popup, "button2", btn_2);
480 //evas_object_smart_callback_add(btn_2, "clicked", popup_data->btn2_cb, NULL);
481 evas_object_show(popup);
482 if (popup_data->btn2_cb) {
483 evas_object_smart_callback_add(btn_2, "clicked",
484 popup_data->btn2_cb, popup_data->btn2_data);
486 evas_object_smart_callback_add(btn_2, "clicked",
487 __common_utils_del_popup, popup);
491 evas_object_show(popup);
492 elm_object_focus_set(popup, EINA_TRUE);
497 Evas_Object *common_utils_show_info_ok_popup(Evas_Object *win,
498 const char *str_pkg_name, const char *info_txt,
499 Evas_Smart_Cb ok_cb, void *cb_data)
501 popup_btn_info_t popup_data;
503 memset(&popup_data, 0, sizeof(popup_data));
504 popup_data.info_txt = (char *)info_txt;
505 popup_data.btn1_txt = sc(str_pkg_name, I18N_TYPE_Ok);
506 popup_data.btn1_cb = ok_cb;
507 popup_data.btn1_data = cb_data;
509 return common_utils_show_info_popup(win, &popup_data);
512 Evas_Object *common_utils_show_info_timeout_popup(Evas_Object *win,
513 const char* info_text, const double timeout)
515 Evas_Object *popup = elm_popup_add(win);
517 elm_object_text_set(popup, info_text);
518 elm_popup_timeout_set(popup, timeout);
519 evas_object_smart_callback_add(popup, "timeout",
520 __common_utils_del_popup, popup);
521 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
522 elm_popup_orient_set(popup, ELM_POPUP_ORIENT_CENTER);
523 evas_object_show(popup);
528 int common_utils_get_rotate_angle(enum appcore_rm rotate_mode)
531 if (APPCORE_RM_UNKNOWN == rotate_mode)
532 appcore_get_rotation_state(&rotate_mode);
534 DEBUG_LOG(SP_NAME_NORMAL, "rotate_mode = %d", rotate_mode);
536 switch (rotate_mode) {
537 case APPCORE_RM_PORTRAIT_NORMAL: /**< Portrait mode */
538 DEBUG_LOG(SP_NAME_NORMAL, "rotate mode is APPCORE_RM_PORTRAIT_NORMAL");
542 case APPCORE_RM_PORTRAIT_REVERSE: /**< Portrait upside down mode */
543 DEBUG_LOG(SP_NAME_NORMAL, "rotate mode is APPCORE_RM_PORTRAIT_REVERSE");
547 case APPCORE_RM_LANDSCAPE_NORMAL: /**< Left handed landscape mode */
548 DEBUG_LOG(SP_NAME_NORMAL, "rotate mode is APPCORE_RM_LANDSCAPE_NORMAL");
552 case APPCORE_RM_LANDSCAPE_REVERSE: /**< Right handed landscape mode */
553 DEBUG_LOG(SP_NAME_NORMAL, "rotate mode is APPCORE_RM_LANDSCAPE_REVERSE");
558 ERROR_LOG(SP_NAME_ERR, "Invalid rotate mode. The default value (0) is set to 'rotate_angle'.");
566 int common_utils_send_message_to_net_popup(const char *title,
567 const char *content, const char *type, const char *ssid)
570 bundle *b = bundle_create();
572 bundle_add_str(b, "_SYSPOPUP_TITLE_", title);
573 bundle_add_str(b, "_SYSPOPUP_CONTENT_", content);
574 bundle_add_str(b, "_SYSPOPUP_TYPE_", type);
575 bundle_add_str(b, "_AP_NAME_", ssid);
577 ret = aul_launch_app("net.netpopup", b);
584 int common_utils_send_restriction_to_net_popup(const char *title,
585 const char *type, const char *restriction)
588 bundle *b = bundle_create();
590 bundle_add_str(b, "_SYSPOPUP_TITLE_", title);
591 bundle_add_str(b, "_SYSPOPUP_CONTENT_", "security restriction");
592 bundle_add_str(b, "_SYSPOPUP_TYPE_", type);
593 bundle_add_str(b, "_RESTRICTED_TYPE_", restriction);
595 ret = aul_launch_app("net.netpopup", b);
602 int common_util_set_system_registry(const char *key, int value)
604 __COMMON_FUNC_ENTER__;
606 if (vconf_set_int(key, value) < 0) {
607 ERROR_LOG(UG_NAME_NORMAL, "Failed to set vconf");
609 __COMMON_FUNC_EXIT__;
613 __COMMON_FUNC_EXIT__;
617 int common_util_get_system_registry(const char *key)
619 __COMMON_FUNC_ENTER__;
623 if (vconf_get_int(key, &value) < 0) {
624 ERROR_LOG(UG_NAME_NORMAL, "Failed to get vconf");
626 __COMMON_FUNC_EXIT__;
630 __COMMON_FUNC_EXIT__;
634 static void __common_util_managed_idle_destroy_cb(gpointer data)
639 managed_idler_list = g_slist_remove(managed_idler_list, data);
643 static gboolean __common_util_managed_idle_cb(gpointer user_data)
645 struct managed_idle_data *data = (struct managed_idle_data *)user_data;
650 return data->func(data->user_data);
653 guint common_util_managed_idle_add(GSourceFunc func, gpointer user_data)
656 struct managed_idle_data *data;
661 data = g_try_new0(struct managed_idle_data, 1);
666 data->user_data = user_data;
668 id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, __common_util_managed_idle_cb,
669 data, __common_util_managed_idle_destroy_cb);
677 managed_idler_list = g_slist_append(managed_idler_list, data);
682 void common_util_managed_idle_cleanup(void)
684 if (managed_idler_list == NULL)
687 GSList *cur = managed_idler_list;
689 struct managed_idle_data *data;
692 GSList *next = cur->next;
693 data = (struct managed_idle_data *)cur->data;
695 src = g_main_context_find_source_by_id(g_main_context_default(), data->id);
697 g_source_destroy(src);
698 cur = managed_idler_list;
704 g_slist_free(managed_idler_list);
705 managed_idler_list = NULL;
708 void common_util_managed_ecore_scan_update_timer_add(double interval,
709 common_util_scan_update_cb callback, void *data)
711 if (callback == NULL)
714 common_util_managed_ecore_scan_update_timer_del();
716 scan_update_timer = ecore_timer_add(interval, callback, data);
719 void common_util_managed_ecore_scan_update_timer_del(void)
721 if (scan_update_timer != NULL) {
722 ecore_timer_del(scan_update_timer);
723 scan_update_timer = NULL;
727 void common_util_manager_ecore_scan_update_timer_reset(void)
729 scan_update_timer = NULL;
733 // not used at this moment 06/15/2018
734 static GDBusConnection *common_util_get_gdbus_conn(void)
736 GError *error = NULL;
738 if (gdbus_conn.connection != NULL)
739 return gdbus_conn.connection;
741 #if !GLIB_CHECK_VERSION(2, 36, 0)
745 gdbus_conn.connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
746 if (gdbus_conn.connection == NULL) {
747 ERROR_LOG(UG_NAME_NORMAL,
748 "Failed to connect to the D-BUS daemon: [%s]\n", error->message);
753 return gdbus_conn.connection;
757 int common_utils_get_sim_state(void)
759 int value = VCONFKEY_TELEPHONY_SIM_UNKNOWN;
762 value = common_util_get_system_registry(VCONFKEY_TELEPHONY_SIM_SLOT);
763 INFO_LOG(UG_NAME_NORMAL, "SIM slot 1 state : %d", value);
764 if (value == VCONFKEY_TELEPHONY_SIM_INSERTED)
767 sim_count = common_util_get_system_registry(
768 VCONFKEY_TELEPHONY_SIM_SLOT_COUNT);
772 value = common_util_get_system_registry(VCONFKEY_TELEPHONY_SIM_SLOT2);
773 INFO_LOG(UG_NAME_NORMAL, "SIM slot 2 state : %d", value);
778 Eina_Bool _is_emulator(void)
780 char *model_name = NULL;
782 if (emulator == TIZEN_MODEL_EMULATOR)
784 else if (emulator == TIZEN_MODEL_NOT_EMULATOR)
787 if (system_info_get_platform_string("http://tizen.org/system/model_name", &model_name) < 0)
790 if (model_name == NULL)
793 if (strncmp(model_name, "Emulator", strlen("Emulator")) == 0) {
795 emulator = TIZEN_MODEL_EMULATOR;
799 emulator = TIZEN_MODEL_NOT_EMULATOR;
804 bool is_common_profile(void)
806 char *profile = NULL;
808 if (system_info_get_platform_string("http://tizen.org/feature/profile", &profile) < 0)
814 if (strncmp(profile, "common", strlen("common")) == 0) {
823 static void _init_genlist_1line_style(void)
825 g_genlist_info[WIFI_GENLIST_1LINE_STYLE].style_name = GENLIST_STYLE_1LINE;
826 g_genlist_info[WIFI_GENLIST_1LINE_STYLE].text_part = GENLIST_PART_ELM_TEXT;
827 g_genlist_info[WIFI_GENLIST_1LINE_STYLE].sub_text_part = GENLIST_PART_ELM_TEXT_END;
828 g_genlist_info[WIFI_GENLIST_1LINE_STYLE].content_part = GENLIST_PART_ELM_ICON;
829 g_genlist_info[WIFI_GENLIST_1LINE_STYLE].sub_content_part = GENLIST_PART_ELM_END;
832 static void _init_genlist_2line_style(void)
834 g_genlist_info[WIFI_GENLIST_2LINE_STYLE].style_name = GENLIST_STYLE_2LINE;
835 g_genlist_info[WIFI_GENLIST_2LINE_STYLE].text_part = GENLIST_PART_ELM_TEXT;
836 g_genlist_info[WIFI_GENLIST_2LINE_STYLE].sub_text_part = GENLIST_PART_ELM_TEXT_SUB;
837 g_genlist_info[WIFI_GENLIST_2LINE_STYLE].content_part = GENLIST_PART_ELM_ICON;
838 g_genlist_info[WIFI_GENLIST_2LINE_STYLE].sub_content_part = GENLIST_PART_ELM_END;
841 static void _init_genlist_type1_style(void)
843 g_genlist_info[WIFI_GENLIST_1LINE_STYLE].style_name = GENLIST_STYLE_TYPE1;
844 g_genlist_info[WIFI_GENLIST_1LINE_STYLE].text_part = GENLIST_PART_ELM_TEXT;
845 g_genlist_info[WIFI_GENLIST_1LINE_STYLE].sub_text_part = GENLIST_PART_ELM_TEXT_SUB;
846 g_genlist_info[WIFI_GENLIST_1LINE_STYLE].content_part = GENLIST_PART_ELM_SWALLOW_ICON;
847 g_genlist_info[WIFI_GENLIST_1LINE_STYLE].sub_content_part = GENLIST_PART_ELM_SWALLOW_END;
851 // -------------------------------------------------------------------------------------------
852 // | | elm.text.sub | elm.text.sub.end | |
853 // | elm.swallow.icon |----------------------------------------------------| elm.swallow.end |
854 // | | elm.swallow.icon.0 | elm.text | elm.swallow.icon.1 | |
855 // -------------------------------------------------------------------------------------------
856 static void _init_genlist_type2_style(void)
858 g_genlist_info[WIFI_GENLIST_2LINE_STYLE].style_name = GENLIST_STYLE_TYPE2;
859 g_genlist_info[WIFI_GENLIST_2LINE_STYLE].text_part = GENLIST_PART_ELM_TEXT_SUB;
860 g_genlist_info[WIFI_GENLIST_2LINE_STYLE].sub_text_part = GENLIST_PART_ELM_TEXT;
861 g_genlist_info[WIFI_GENLIST_2LINE_STYLE].content_part = GENLIST_PART_ELM_SWALLOW_ICON;
862 g_genlist_info[WIFI_GENLIST_2LINE_STYLE].sub_content_part = GENLIST_PART_ELM_SWALLOW_END;
865 static void _init_genlist_multiline_style(void)
867 g_genlist_info[WIFI_GENLIST_MULTILINE_STYLE].style_name = GENLIST_STYLE_MULTILINE;
868 g_genlist_info[WIFI_GENLIST_MULTILINE_STYLE].text_part = GENLIST_PART_ELM_TEXT;
869 g_genlist_info[WIFI_GENLIST_MULTILINE_STYLE].sub_text_part = GENLIST_PART_ELM_TEXT_MULTILINE;
870 g_genlist_info[WIFI_GENLIST_MULTILINE_STYLE].content_part = NULL;
871 g_genlist_info[WIFI_GENLIST_MULTILINE_STYLE].sub_content_part = GENLIST_PART_ELM_SWALLOW_END;
874 static void _init_genlist_common_multiline_style(void)
876 g_genlist_info[WIFI_GENLIST_MULTILINE_STYLE].style_name = GENLIST_STYLE_MULTILINE;
877 g_genlist_info[WIFI_GENLIST_MULTILINE_STYLE].text_part = GENLIST_PART_ELM_TEXT;
878 g_genlist_info[WIFI_GENLIST_MULTILINE_STYLE].sub_text_part = GENLIST_PART_ELM_TEXT_MULTILINE;
879 g_genlist_info[WIFI_GENLIST_MULTILINE_STYLE].content_part = GENLIST_PART_ELM_ICON;
880 g_genlist_info[WIFI_GENLIST_MULTILINE_STYLE].sub_content_part = GENLIST_PART_ELM_END;
883 static void _init_genlist_group_index_style(void)
885 g_genlist_info[WIFI_GENLIST_GROUP_INDEX_STYLE].style_name = GENLIST_STYLE_GROUP_INDEX;
886 g_genlist_info[WIFI_GENLIST_GROUP_INDEX_STYLE].text_part = GENLIST_PART_ELM_TEXT;
887 g_genlist_info[WIFI_GENLIST_GROUP_INDEX_STYLE].sub_text_part = NULL;
888 g_genlist_info[WIFI_GENLIST_GROUP_INDEX_STYLE].content_part = NULL;
889 g_genlist_info[WIFI_GENLIST_GROUP_INDEX_STYLE].sub_content_part = NULL;
892 static void _init_genlist_common_group_index_style(void)
894 g_genlist_info[WIFI_GENLIST_GROUP_INDEX_STYLE].style_name = GENLIST_STYLE_GROUP_INDEX;
895 g_genlist_info[WIFI_GENLIST_GROUP_INDEX_STYLE].text_part = GENLIST_PART_ELM_TEXT;
896 g_genlist_info[WIFI_GENLIST_GROUP_INDEX_STYLE].sub_text_part = NULL;
897 g_genlist_info[WIFI_GENLIST_GROUP_INDEX_STYLE].content_part = GENLIST_PART_ELM_END;
898 g_genlist_info[WIFI_GENLIST_GROUP_INDEX_STYLE].sub_content_part = NULL;
901 static void _init_genlist_full_style(void)
903 g_genlist_info[WIFI_GENLIST_FULL_STYLE].style_name = GENLIST_STYLE_FULL;
904 g_genlist_info[WIFI_GENLIST_FULL_STYLE].text_part = NULL;
905 g_genlist_info[WIFI_GENLIST_FULL_STYLE].sub_text_part = GENLIST_PART_ELM_TEXT_SUB;
906 g_genlist_info[WIFI_GENLIST_FULL_STYLE].content_part = GENLIST_PART_ELM_SWALLOW_CONTENT;
907 g_genlist_info[WIFI_GENLIST_FULL_STYLE].sub_content_part = NULL;
910 void common_util_update_genlist_style(void)
912 if (g_ug_type == UG_VIEW_IOT_COMMON) {
913 _init_genlist_1line_style();
914 _init_genlist_2line_style();
915 _init_genlist_common_multiline_style();
916 _init_genlist_common_group_index_style();
918 _init_genlist_type1_style();
919 _init_genlist_type2_style();
920 _init_genlist_multiline_style();
921 _init_genlist_group_index_style();
923 _init_genlist_full_style();
926 void common_util_update_content_size(void)
928 if (g_ug_type == UG_VIEW_OOBE) {
929 g_content_size_info.small_font = OOBE_SMALL_FONT_SIZE;
930 g_content_size_info.mid_font = OOBE_MID_FONT_SIZE;
931 g_content_size_info.big_font = OOBE_BIG_FONT_SIZE;
932 g_content_size_info.icon_w = OOBE_BUTTON_CIRCLE_SIZE_H;
933 g_content_size_info.icon_h = OOBE_BUTTON_CIRCLE_SIZE_W;
934 g_content_size_info.progress = PROGRESS_MID;
935 } else if (g_ug_type == UG_VIEW_IOT_COMMON) {
936 g_content_size_info.small_font = COMMON_SMALL_FONT_SIZE;
937 g_content_size_info.mid_font = COMMON_SMALL_FONT_SIZE;
938 g_content_size_info.big_font = COMMON_BIG_FONT_SIZE;
939 g_content_size_info.icon_w = COMMON_BUTTON_CIRCLE_SIZE;
940 g_content_size_info.icon_h = COMMON_BUTTON_CIRCLE_SIZE;
941 g_content_size_info.progress = PROGRESS_SMALL;
943 g_content_size_info.small_font = SMALL_FONT_SIZE;
944 g_content_size_info.mid_font = MID_FONT_SIZE;
945 g_content_size_info.big_font = BIG_FONT_SIZE;
946 g_content_size_info.icon_w = BUTTON_CIRCLE_SIZE;
947 g_content_size_info.icon_h = BUTTON_CIRCLE_SIZE;
948 g_content_size_info.progress = PROGRESS_MID;
952 void common_util_set_ug_type(UG_TYPE type)
957 UG_TYPE common_util_get_ug_type(void)