/* * Copyright (c) 2010 Samsung Electronics, Inc. * All rights reserved. * * This software is a confidential and proprietary information * of Samsung Electronics, Inc. ("Confidential Information"). You * shall not disclose such Confidential Information and shall use * it only in accordance with the terms of the license agreement * you entered into with Samsung Electronics. */ #include #include #include #include #include #include #include "util.h" #include "setting-sound.h" #include "setting-vibration.h" #include "setting-common-sound.h" #include "setting_view_toast.h" #include "setting_data_vconf.h" #include "setting-volume.h" #define AUDIO_RESOURCE_EXTENSION ".ogg" static struct _sound_menu_item sound_menu_its[] = { { "IDS_ST_OPT_SOUND_MODE_ABB", SETTING_SOUND_MENU_MODE, _sound_mode_cb }, { "IDS_ST_OPT_VOLUME", SETTING_SOUND_MENU_VOLUME, _volume_cb }, { "IDS_ST_HEADER_VIBRATION_ABB", SETTING_SOUND_MENU_VIBRATION, _vibrate_cb }, { "IDS_ST_HEADER_RINGTONES_ABB", SETTING_SOUND_MENU_RINGTONE, _show_ringtone_layer_cb }, { "IDS_ST_BODY_TOUCH_SOUNDS_ABB", SETTING_SOUND_MENU_TOUCH_SOUND, _touch_sound_cb }, }; char *sound_mode_str[] = { "IDS_ST_OPT_SOUND_ABB2", "IDS_ST_BODY_VIBRATE_ABB2", "IDS_ST_OPT_MUTE" }; char *vibration_str[] = { "IDS_ST_OPT_STRONG_M_INTENSITY", "IDS_ST_OPT_WEAK_M_INTENSITY" }; char *pref_arm_str[] = { "IDS_ST_OPT_LEFT_ARM_ABB", "IDS_ST_OPT_RIGHT_ARM_ABB" }; char *pref_arm_toast_msg[] = { "IDS_ST_TPOP_MAIN_MIC_ADJUSTED_FOR_LEFT_ARM", "IDS_ST_TPOP_MAIN_MIC_ADJUSTED_FOR_RIGHT_ARM" }; static char ringtone_arr[RINGTONE_MAX_COUNT][1025]; static char ringtone_name_arr[RINGTONE_MAX_COUNT][1025]; static char notification_arr[RINGTONE_MAX_COUNT][1025]; static char notification_name_arr[RINGTONE_MAX_COUNT][1025]; static appdata *g_app_context = NULL; static Evas_Object *g_sound_genlist = NULL; static Evas_Object *g_sound_mode_genlist = NULL; static Evas_Object *g_ringtone_type_genlist = NULL; static Evas_Object *g_notification_type_genlist = NULL; static Evas_Object *g_vibration_type_genlist = NULL; static Evas_Object *g_pref_arm_type_genlist = NULL; static int sound_mode = 1; /* Vibrate */ static int ringtone_type = 0; /* Rigntone type */ static int confirmed_ringtone_type = 0; /* setted Rigntone type */ static int notification_type = 0; /* Notification type */ static int confirmed_Notification_type = 0; /* setted Notification type */ static int vibrate_type = 0; /* Vibration type */ static int pref_arm_type = 0; /* Pref_arm_type */ static int changing_sound_mode_myself = 0; static int ringtone_count = 0; static int notification_count = 0; char curr_ringtone_file_path[1023]; char curr_noti_file_path[1023]; static int cur_sound_type; static int is_loaded_ringtone_data = 0; static int is_loaded_noti_data = 0; static int origin_vibration_level; static Ecore_Timer *vibration_timer = NULL; static int is_wav_playing = SOUND_STATE_STOP; static int sound_id = -1; static Evas_Object *g_touch_check = NULL; static void sound_vconf_changed_cb(system_settings_key_e key, void *data); static void vibrate_vconf_changed_cb(system_settings_key_e key, void *data); static void pm_state_vconf_changed_cb(keynode_t *key, void *data); static void _ringtone_type_gl_cb(void *data, Evas_Object *obj, void *event_info); static void stop_wav(); enum { SOUND_TITLE_SOUND, SOUND_TITLE_SOUND_MODE, SOUND_TITLE_RINGTONE, SOUND_TITLE_NOTIFICATION, SOUND_TITLE_VIBRATION, SOUND_TITLE_PREF_ARM_MODE }; static char * _gl_menu_title_text_get(void *data, Evas_Object *obj, const char *part) { char buf[__SETTING_BUF_SIZE__] = {0,}; int title_idx = (uintptr_t)data; switch (title_idx) { case SOUND_TITLE_SOUND: snprintf(buf, sizeof(buf)-1, "%s", _("IDS_ST_OPT_SOUND_ABB2")); break; case SOUND_TITLE_SOUND_MODE: snprintf(buf, sizeof(buf)-1, "%s", _("IDS_ST_OPT_SOUND_MODE_ABB")); break; case SOUND_TITLE_RINGTONE: snprintf(buf, sizeof(buf)-1, "%s", _("IDS_ST_HEADER_RINGTONES_ABB")); break; case SOUND_TITLE_NOTIFICATION: snprintf(buf, sizeof(buf)-1, "%s", _("IDS_ST_BUTTON_NOTIFICATIONS")); break; case SOUND_TITLE_VIBRATION: snprintf(buf, sizeof(buf)-1, "%s", _("IDS_ST_HEADER_VIBRATION_ABB")); break; case SOUND_TITLE_PREF_ARM_MODE: snprintf(buf, sizeof(buf)-1, "%s", _("IDS_ST_BODY_PREFERRED_ARM_ABB")); break; } return strdup(buf); } void _initialize() { /* touch sound */ /*effect_playsound_init(); */ } void _clear_sound_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) { _clear_sound_resource(); return; } void _clear_sound_resource() { if (vibration_timer) { ecore_timer_del(vibration_timer); vibration_timer = NULL; } g_app_context = NULL; g_sound_genlist = NULL; g_sound_mode_genlist = NULL; g_ringtone_type_genlist = NULL; g_notification_type_genlist = NULL; g_vibration_type_genlist = NULL; g_pref_arm_type_genlist = NULL; sound_mode = 0; ringtone_type = 0; notification_type = 0; vibrate_type = 0; pref_arm_type = 0; cur_sound_type = 0; is_loaded_ringtone_data = 0; is_loaded_noti_data = 0; origin_vibration_level = 0; is_wav_playing = 0; sound_id = -1; /* _stop_player(); */ /* Unregister sound mode vconf callback */ system_settings_remove_changed_cb(SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE, sound_vconf_changed_cb); system_settings_remove_changed_cb(SYSTEM_SETTINGS_KEY_VIBRATION, vibrate_vconf_changed_cb); } void _stop_all_sound_play() { DBG("Setting - stop all sound"); stop_wav(); _stop_player(); } static void stop_wav() { if (is_wav_playing == SOUND_STATE_PLAY) { DBG("Setting - sound id : %d", sound_id); wav_player_stop(sound_id); is_wav_playing = SOUND_STATE_STOP; sound_id = -1; } } void _stop_wav_player() { stop_wav(); } void _stop_player() { DBG("Setting - _stop_player() is called!"); if (is_created_player()) { _close_player(NULL); } } static void get_sound_file_list(char *dir, int type) { DIR *dp; struct dirent *result = NULL; char *cur_ring_path = NULL; int ret = 0; if ((dp = opendir(dir)) == NULL) { DBG("Setting - dir open error!"); return; } if (type) { ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, &cur_ring_path); if (ret != SYSTEM_SETTINGS_ERROR_NONE) DBG("failed! get SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE"); ringtone_count = 0; } else { ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE, &cur_ring_path); if (ret != SYSTEM_SETTINGS_ERROR_NONE) DBG("failed! get SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE"); notification_count = 0; } while (((result = readdir(dp)) != NULL) && ringtone_count < RINGTONE_MAX_COUNT && notification_count < RINGTONE_MAX_COUNT && cur_ring_path != NULL ) { if (strncmp(result->d_name, ".", 1) && strlen(dir) < 1024 && strlen(replace(result->d_name, ".ogg", "")) < 1024) { if (type) { strncpy(ringtone_arr[ringtone_count], dir, sizeof(ringtone_arr[0])-1); strncat(ringtone_arr[ringtone_count], result->d_name, (sizeof(ringtone_arr[0])-1) - strlen(ringtone_arr[ringtone_count])); strncpy(ringtone_name_arr[ringtone_count], replace(result->d_name, ".ogg", ""), sizeof(ringtone_name_arr[0])-1); DBG("Setting - %s", ringtone_arr[ringtone_count]); if (!strcmp(cur_ring_path, ringtone_arr[ringtone_count])) { ringtone_type = ringtone_count; /*DBG("Settng - %s is same with %s", cur_ring_path, ringtone_arr[ringtone_count]); */ } /*DBG("Settng - %s is same with %s", cur_ring_path, ringtone_arr[ringtone_count]); */ DBG("Setting - ringtone cnt : %d", ringtone_count); ringtone_count++; DBG("Setting - ringtone++ cnt : %d", ringtone_count); } else { strncpy(notification_arr[notification_count], dir, sizeof(notification_arr[0])-1); strncat(notification_arr[notification_count], result->d_name, (sizeof(notification_arr[0])-1) - strlen(notification_arr[notification_count])); strncpy(notification_name_arr[notification_count], replace(result->d_name, ".ogg", ""), sizeof(notification_name_arr[0])-1); strncpy(notification_name_arr[notification_count], replace(notification_name_arr[notification_count], "_", " "), sizeof(notification_name_arr[0])-1); /*DBG("Setting - %s", notification_arr[notification_count]); */ if (!strcmp(cur_ring_path, notification_arr[notification_count])) { notification_type = notification_count; /*DBG("Settng - %s is same with %s", cur_ring_path, notification_arr[notification_count]); */ } /*DBG("Settng - %s is same with %s", cur_ring_path, notification_arr[notification_count]); */ notification_count++; } } } FREE(cur_ring_path); closedir(dp); } void _show_volume_list(void *data) { appdata *ad = data; if (ad == NULL) { DBG("Setting - ad is null"); return; } _initialize_volume(); Evas_Object *layout = _create_volume_page(data); Elm_Object_Item *nf_it = elm_naviframe_item_push(ad->nf, NULL, NULL, NULL, layout, NULL); elm_naviframe_item_title_enabled_set(nf_it, EINA_FALSE, EINA_FALSE); back_button_cb_push(&_clear_volume_setting_cb, data, NULL, g_sound_genlist, "g_sound_genlist"); } void _volume_cb(void *data, Evas_Object *obj, void *event_info) { elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE); _show_volume_list(data); } void _sound_mode_cb(void *data, Evas_Object *obj, void *event_info) { elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE); _show_sound_mode_list(data); } void _touch_sound_cb(void *data, Evas_Object *obj, void *event_info) { Elm_Object_Item *it = (Elm_Object_Item *)event_info; appdata *ad = data; DBG("_touch_sound_cb is called!!!!!!!"); if (ad == NULL) { DBG("%s", "_touch_sound_cb - appdata or check is null"); return; } ad->is_enable_touch_sound = ad->is_enable_touch_sound ? 0 : 1; vconf_set_bool(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, ad->is_enable_touch_sound); vconf_set_bool(VCONFKEY_SETAPPL_BUTTON_SOUNDS_BOOL, ad->is_enable_touch_sound); elm_genlist_item_selected_set(it, EINA_FALSE); if (g_touch_check != NULL) elm_check_state_set(g_touch_check, (ad->is_enable_touch_sound) ? EINA_TRUE : EINA_FALSE); } void _vibrate_cb(void *data, Evas_Object *obj, void *event_info) { Evas_Object *genlist = NULL; Elm_Object_Item *nf_it = NULL; appdata *ad = data; if (ad == NULL) { DBG("Setting - ad is null"); return; } _initialize(); genlist = _create_vibration_list(data); if (genlist == NULL) { DBG("%s", "sound cb - genlist is null"); return; } nf_it = elm_naviframe_item_push(ad->nf, NULL, NULL, NULL, genlist, NULL); elm_naviframe_item_title_enabled_set(nf_it, EINA_FALSE, EINA_FALSE); back_button_cb_push(&_clear_vibration_resource, data, NULL, g_sound_genlist, "g_sound_genlist"); elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE); ad->MENU_TYPE = SETTING_SOUND; } static char *_get_sound_file_name(char *full_name) { char *token = NULL; char *temp_token = NULL; char sep[] = "*/*"; char *saveptr = NULL; DBG("Setting - %s", full_name); strtok_r(full_name, sep, &saveptr); do { token = strtok_r(NULL, sep, &saveptr); if (token != NULL) { temp_token = token; } } while (token != NULL); char *result_token = NULL; if (temp_token) { temp_token = replace(temp_token, ".ogg", ""); result_token = replace(temp_token, "_", " "); } return result_token; } char *_gl_Sound_title_get(void *data, Evas_Object *obj, const char *part) { char buf[__SETTING_BUF_SIZE__] = {0,}; Sound_Item_Data *id = data; int index = id->index; char *pa_cur_ringtone = NULL; if (!strcmp(part, "elm.text")) { snprintf(buf, sizeof(buf) - 1, "%s", _(sound_menu_its[id->menu_array_idx].name)); } else if (!strcmp(part, "elm.text.1")) { char *text_color = "%s"; switch (index) { case SETTING_SOUND_MENU_MODE: sound_mode = get_sound_mode(); snprintf(buf, sizeof(buf) - 1, text_color, _(sound_mode_str[sound_mode % 3])); break; case SETTING_SOUND_MENU_RINGTONE: system_settings_get_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, &pa_cur_ringtone); if (pa_cur_ringtone && (strlen(pa_cur_ringtone) < 1024)) { strncpy(curr_ringtone_file_path, pa_cur_ringtone, sizeof(curr_ringtone_file_path)-1); DBG("Setting - ringtone path : %s", pa_cur_ringtone); snprintf(buf, sizeof(buf) - 1, text_color, _get_sound_file_name(pa_cur_ringtone)); } break; } } FREE(pa_cur_ringtone); return strdup(buf); } static void _sound_gl_del(void *data, Evas_Object *obj) { Sound_Item_Data *id = data; FREE(id); } Evas_Object *_gl_sound_check_get(void *data, Evas_Object *obj, const char *part) { Evas_Object *check = NULL; Sound_Item_Data *id = data; int index = id->index; appdata *ad = g_app_context; if (ad == NULL) { DBG("%s", "_create_sound_list - appdata is null"); return NULL; } if (!strcmp(part, "elm.icon")) { check = elm_check_add(obj); if (system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_SOUND_TOUCH, &ad->is_enable_touch_sound) < 0) { ad->is_enable_touch_sound = TOUCH_SOUND_ENABLE; /* default value of touch sounds : on */ } elm_object_style_set(check, "on&off"); elm_check_state_set(check, (ad->is_enable_touch_sound) ? EINA_TRUE : EINA_FALSE); evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_propagate_events_set(check, EINA_FALSE); g_touch_check = check; index++; elm_atspi_accessible_relationship_append(id->item, ELM_ATSPI_RELATION_DESCRIBED_BY, check); elm_atspi_accessible_relationship_append(id->item, ELM_ATSPI_RELATION_CONTROLLER_FOR, check); elm_atspi_accessible_relationship_append(check, ELM_ATSPI_RELATION_CONTROLLED_BY, id->item); } return check; } static void gl_realized_cb(void *data, Evas_Object *obj, void *event_info) { Elm_Object_Item *item = (Elm_Object_Item *)event_info; Elm_Object_Item *first = elm_genlist_first_item_get(g_sound_genlist); if (first == item) elm_object_item_signal_emit(first, "elm,action,title,slide,start", "elm"); else elm_object_item_signal_emit(item, "elm,event,pass,disabled", "elm"); } Evas_Object *_create_sound_list(void *data) { appdata *ad = data; if (ad == NULL) { DBG("%s", "_create_sound_list - appdata is null"); return NULL; } g_app_context = ad; Evas_Object *genlist = NULL; struct _sound_menu_item *menu_its = NULL; int idx = 0; Elm_Genlist_Item_Class *itc_tmp; Elm_Genlist_Item_Class *itc_1text = elm_genlist_item_class_new(); itc_1text->item_style = "1text"; itc_1text->func.text_get = _gl_Sound_title_get; itc_1text->func.del = _sound_gl_del; Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new(); itc->item_style = "2text"; itc->func.text_get = _gl_Sound_title_get; itc->func.del = _sound_gl_del; Elm_Genlist_Item_Class *itc_touch_snd = elm_genlist_item_class_new(); itc_touch_snd->item_style = "1text.1icon.1"; itc_touch_snd->func.text_get = _gl_Sound_title_get; itc_touch_snd->func.content_get = _gl_sound_check_get; itc_touch_snd->func.del = _sound_gl_del; genlist = elm_genlist_add(ad->nf); elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS); evas_object_smart_callback_add(genlist, "realized", gl_realized_cb, NULL); int menu_its_size = sizeof(sound_menu_its) / sizeof(struct _sound_menu_item); menu_its = sound_menu_its; connect_to_wheel_with_genlist(genlist, ad); Elm_Genlist_Item_Class *title_item = elm_genlist_item_class_new(); title_item->func.text_get = _gl_menu_title_text_get; title_item->item_style = "title"; title_item->func.del = NULL; elm_genlist_item_append(genlist, title_item, (void *)SOUND_TITLE_SOUND, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); elm_genlist_item_class_free(title_item); for (idx = 0; idx < menu_its_size; idx++) { if (idx == SETTING_SOUND_MENU_VOLUME || idx == SETTING_SOUND_MENU_VIBRATION) { itc_tmp = itc_1text; } else if (idx == SETTING_SOUND_MENU_TOUCH_SOUND) { itc_tmp = itc_touch_snd; } else { itc_tmp = itc; } if (idx == SETTING_SOUND_MENU_RINGTONE && !is_telephony_enable()) { continue; } Sound_Item_Data *id = calloc(sizeof(Sound_Item_Data), 1); if (id) { id->index = sound_menu_its[idx].sound_menu_enum; id->menu_array_idx = idx; id->item = elm_genlist_item_append( genlist, /* genlist object */ itc_tmp, /* item class */ id, /* data */ NULL, ELM_GENLIST_ITEM_NONE, menu_its[idx].func, /* call back */ ad); } } Elm_Genlist_Item_Class *padding = elm_genlist_item_class_new(); padding->item_style = "padding"; padding->func.del = _sound_gl_del; Elm_Object_Item *padding_item; padding_item = elm_genlist_item_append(genlist, padding, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); elm_atspi_accessible_role_set(padding_item, ELM_ATSPI_ROLE_REDUNDANT_OBJECT); elm_genlist_item_class_free(padding); elm_genlist_item_class_free(itc_1text); elm_genlist_item_class_free(itc); elm_genlist_item_class_free(itc_touch_snd); g_sound_genlist = genlist; /* Register sound mode vconf callback */ system_settings_add_changed_cb(SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE, sound_vconf_changed_cb, NULL); system_settings_add_changed_cb(SYSTEM_SETTINGS_KEY_VIBRATION, vibrate_vconf_changed_cb, NULL); return genlist; } static char *_gl_sound_mode_title_get(void *data, Evas_Object *obj, const char *part) { char buf[__SETTING_BUF_SIZE__] = {0,}; Item_Data *id = data; int index = id->index; if (!strcmp(part, "elm.text")) { snprintf(buf, sizeof(buf) - 1, "%s", _(sound_mode_str[index % 3])); index++; } return strdup(buf); } static Evas_Object *_gl_sound_mode_ridio_get(void *data, Evas_Object *obj, const char *part) { Evas_Object *radio = NULL; Evas_Object *radio_main = evas_object_data_get(obj, "radio_main"); Item_Data *id = data; int index = id->index; if (!strcmp(part, "elm.icon")) { radio = elm_radio_add(obj); elm_object_style_set(radio, "list"); elm_radio_state_value_set(radio, id->index); evas_object_size_hint_align_set(radio, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_radio_group_add(radio, radio_main); evas_object_smart_callback_add(radio, "changed", NULL, (void *)(uintptr_t)id->index); if (sound_mode == id->index) elm_radio_value_set(radio_main, sound_mode); index++; elm_atspi_accessible_relationship_append(id->item, ELM_ATSPI_RELATION_DESCRIBED_BY, radio); elm_atspi_accessible_relationship_append(id->item, ELM_ATSPI_RELATION_CONTROLLER_FOR, radio); elm_atspi_accessible_relationship_append(radio, ELM_ATSPI_RELATION_CONTROLLED_BY, id->item); } return radio; } static void _sound_mode_gl_del(void *data, Evas_Object *obj) { Item_Data *id = data; FREE(id); } static bool curr_touch_sound = false; static void _sound_mode_gl_cb(void *data, Evas_Object *obj, void *event_info) { elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE); sound_mode = (uintptr_t)data; changing_sound_mode_myself = 1; if (g_sound_mode_genlist) { elm_genlist_realized_items_update(g_sound_mode_genlist); } int ringtone_level = 0; int prev_sound_mode = get_sound_mode(); switch (sound_mode) { case SOUND_MODE_SOUND: if (get_sound_mode() != SOUND_MODE_SOUND) { DBG("Setting - current sound mode is not sound!! Change sound mode to sound!!"); system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_SOUND_TOUCH, &curr_touch_sound); if (curr_touch_sound) { system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_SOUND_TOUCH, FALSE); } vconf_get_int(SETTING_RINGTONE_VOLUME_BACKUP, &ringtone_level); DBG("Setting - ringtone backup level: %d", ringtone_level); vconf_set_int(VCONFKEY_SETAPPL_CALL_RINGTONE_SOUND_VOLUME_INT, ringtone_level); if (is_created_player()) { _close_player(NULL); } play_sound_for_sound_mode_setting(SETTING_DEFAULT_SILENT_OFF_TONE, 0.0, SOUND_STREAM_TYPE_RINGTONE_CALL); set_looping(FALSE); sound_manager_get_volume(SOUND_STREAM_TYPE_RINGTONE_CALL, &ringtone_level); if (ringtone_level == 0) { DBG("Setting - Ringtone volume is 0!! Restore to 1!!"); sound_manager_set_volume(SOUND_STREAM_TYPE_RINGTONE_CALL, 1); } system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE, FALSE); system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_VIBRATION, FALSE); system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_SOUND_TOUCH, curr_touch_sound); curr_touch_sound = false; sound_stream_info_h stream_info = NULL; sound_type_e type; int ret = sound_manager_create_stream_information_internal(SOUND_STREAM_TYPE_RINGTONE_CALL, NULL, NULL, &stream_info); if (ret != SOUND_MANAGER_ERROR_NONE) { ERR("sound_manager_create_stream_information_internal() get failed with err[%d, 0x%x]", ret, ret); return; } sound_manager_get_sound_type(stream_info, &type); sound_manager_destroy_stream_information(stream_info); ret = sound_manager_set_volume(type, ringtone_level); if (ret != SOUND_MANAGER_ERROR_NONE) { ERR("Setting - sound_manager_set_volume() is failed! : %d", ret); } } break; case SOUND_MODE_VIBRATE: if (prev_sound_mode != SOUND_MODE_VIBRATE) { DBG("Setting - current sound mode is not vibration. Change sound mode to vibration!!"); system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE, TRUE); system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_VIBRATION, TRUE); vconf_get_int(VCONFKEY_SETAPPL_CALL_RINGTONE_SOUND_VOLUME_INT, &ringtone_level); DBG("Setting - ringtone original level: %d", ringtone_level); vconf_set_int(SETTING_RINGTONE_VOLUME_BACKUP, ringtone_level); /*sound_manager_set_muteall(TRUE); // mute!! */ } break; case SOUND_MODE_MUTE: if (prev_sound_mode != SOUND_MODE_MUTE) { DBG("Setting - current sound mode is not mute. Change sound mode to mute!!"); system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE, TRUE); system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_VIBRATION, FALSE); vconf_get_int(VCONFKEY_SETAPPL_CALL_RINGTONE_SOUND_VOLUME_INT, &ringtone_level); DBG("Setting - ringtone original level: %d", ringtone_level); vconf_set_int(SETTING_RINGTONE_VOLUME_BACKUP, ringtone_level); /*sound_manager_set_muteall(TRUE); // mute!! */ } break; default: ERR("Setting - wrong sound mode value!!"); break; } back_key_generic_cb(g_app_context, obj, event_info); if (!g_app_context->sound_mode_rdg) { evas_object_del(g_app_context->sound_mode_rdg); g_app_context->sound_mode_rdg = NULL; } if (g_sound_genlist) { elm_genlist_realized_items_update(g_sound_genlist); } } static void sound_vconf_changed_cb(system_settings_key_e key, void *data) { DBG("Setting - sound_vconf_changed_cb() is called!!"); if (changing_sound_mode_myself) { DBG("Setting - changing_sound_mode_myself!!"); changing_sound_mode_myself = 0; return; } sound_mode = get_sound_mode(); if (g_sound_mode_genlist) { elm_genlist_realized_items_update(g_sound_mode_genlist); } if (g_sound_genlist) { elm_genlist_realized_items_update(g_sound_genlist); } } static void vibrate_vconf_changed_cb(system_settings_key_e key, void *data) { DBG("Setting - vibrate_vconf_changed_cb() is called!!"); sound_mode = get_sound_mode(); if (g_sound_mode_genlist) { elm_genlist_realized_items_update(g_sound_mode_genlist); } if (g_sound_genlist) { elm_genlist_realized_items_update(g_sound_genlist); } } void _sound_mode_back_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) { g_sound_mode_genlist = NULL; return; } void _show_sound_mode_list(void *data) { appdata *ad = data; if (ad == NULL) { DBG("%s", "_show_sound_mode_list - appdata is null"); return; } Evas_Object *genlist = NULL; Elm_Object_Item *item = NULL; Elm_Object_Item *nf_it = NULL; Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new(); itc->item_style = "1text.1icon.1"; itc->func.text_get = _gl_sound_mode_title_get; itc->func.content_get = _gl_sound_mode_ridio_get; itc->func.del = _sound_mode_gl_del; sound_mode = get_sound_mode(); Evas_Object *layout = elm_layout_add(ad->nf); elm_layout_file_set(layout, EDJE_PATH, "setting/genlist/layout"); evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); genlist = elm_genlist_add(layout); elm_genlist_block_count_set(genlist, 14); elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS); evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); connect_to_wheel_with_genlist(genlist, ad); Elm_Genlist_Item_Class *title_item = elm_genlist_item_class_new(); title_item->func.text_get = _gl_menu_title_text_get; title_item->item_style = "title"; title_item->func.del = NULL; elm_genlist_item_append(genlist, title_item, (void *)SOUND_TITLE_SOUND_MODE, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); elm_genlist_item_class_free(title_item); Item_Data *id = calloc(sizeof(Item_Data), 1); if (id) { id->index = 0; item = elm_genlist_item_append(genlist, itc, id, NULL, ELM_GENLIST_ITEM_NONE, _sound_mode_gl_cb, (void *)0); id->item = item; } Item_Data *id2 = calloc(sizeof(Item_Data), 1); if (id2) { id2->index = 1; item = elm_genlist_item_append(genlist, itc, id2, NULL, ELM_GENLIST_ITEM_NONE, _sound_mode_gl_cb, (void *)1); id2->item = item; } Item_Data *id3 = calloc(sizeof(Item_Data), 1); if (id3) { id3->index = 2; item = elm_genlist_item_append(genlist, itc, id3, NULL, ELM_GENLIST_ITEM_NONE, _sound_mode_gl_cb, (void *)2); id3->item = item; } ad->sound_mode_rdg = elm_radio_add(genlist); elm_object_style_set(ad->sound_mode_rdg, "elm/radio/base/list"); elm_radio_state_value_set(ad->sound_mode_rdg, 3); elm_radio_value_set(ad->sound_mode_rdg, sound_mode); evas_object_data_set(genlist, "radio_main", ad->sound_mode_rdg); elm_genlist_item_class_free(itc); Elm_Genlist_Item_Class *padding = elm_genlist_item_class_new(); padding->item_style = "padding"; padding->func.del = _sound_mode_gl_del; Elm_Object_Item *padding_item; padding_item = elm_genlist_item_append(genlist, padding, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); elm_atspi_accessible_role_set(padding_item, ELM_ATSPI_ROLE_REDUNDANT_OBJECT); elm_genlist_item_class_free(padding); g_sound_mode_genlist = genlist; elm_object_part_content_set(layout, "elm.genlist", genlist); nf_it = elm_naviframe_item_push(ad->nf, NULL, NULL, NULL, layout, "empty"); back_button_cb_push(&back_key_generic_cb, data, NULL, g_sound_genlist, "g_sound_genlist"); elm_naviframe_item_title_enabled_set(nf_it, EINA_FALSE, EINA_FALSE); evas_object_event_callback_add(nf_it, EVAS_CALLBACK_DEL, _sound_mode_back_cb, ad); } static void _response_ringtone_ok_cb(void *data, Evas_Object *obj, void *event_info) { _stop_player(); /* save a ringtone type. */ system_settings_set_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, ringtone_arr[ringtone_type]); if (g_ringtone_type_genlist != NULL) { evas_object_del(g_ringtone_type_genlist); g_ringtone_type_genlist = NULL; } if (g_app_context->ringtone_type_rdg != NULL) { evas_object_del(g_app_context->ringtone_type_rdg); g_app_context->ringtone_type_rdg = NULL; } back_key_generic_cb(g_app_context, obj, event_info); if (g_sound_genlist != NULL) { elm_genlist_realized_items_update(g_sound_genlist); } confirmed_ringtone_type = ringtone_type; unregister_vconf_changing(VCONFKEY_PM_STATE, pm_state_vconf_changed_cb); } static char *_gl_ringtone_text_get(void *data, Evas_Object *obj, const char *part) { Item_Data *item = data; if (item == NULL) return NULL; char buf[__SETTING_BUF_SIZE__] = {0,}; /*DBG("---> %d ---> %s ", (item->index%ringtone_count), ringtone_name_arr[item->index % ringtone_count]); */ snprintf(buf, sizeof(buf) -1, "%s", ringtone_name_arr[item->index % ringtone_count]); return strdup(buf); } static Evas_Object *_gl_ringtone_radio_get(void *data, Evas_Object *obj, const char *part) { Evas_Object *radio = NULL; Evas_Object *radio_main = evas_object_data_get(obj, "radio_main"); Item_Data *id = data; int index = id->index; if (!strcmp(part, "elm.icon")) { radio = elm_radio_add(obj); elm_object_style_set(radio, "list"); elm_radio_state_value_set(radio, id->index); evas_object_size_hint_align_set(radio, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_radio_group_add(radio, radio_main); evas_object_smart_callback_add(radio, "changed", _ringtone_type_gl_cb, (void *)(uintptr_t)id->index); evas_object_propagate_events_set(radio, EINA_FALSE); if (id->index == ringtone_type) { elm_radio_value_set(radio_main, id->index); } index++; elm_atspi_accessible_relationship_append(id->item, ELM_ATSPI_RELATION_DESCRIBED_BY, radio); elm_atspi_accessible_relationship_append(id->item, ELM_ATSPI_RELATION_CONTROLLER_FOR, radio); elm_atspi_accessible_relationship_append(radio, ELM_ATSPI_RELATION_CONTROLLED_BY, id->item); } return radio; } static void _ringtone_type_gl_cb(void *data, Evas_Object *obj, void *event_info) { elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE); ringtone_type = (uintptr_t)data; DBG("ringtone type = %d ", ringtone_type); play_sound(ringtone_arr[ringtone_type], 0.0, SOUND_STREAM_TYPE_RINGTONE_CALL); if (g_ringtone_type_genlist) elm_genlist_realized_items_update(g_ringtone_type_genlist); } static void pm_state_vconf_changed_cb(keynode_t *key, void *data) { DBG("Setting - pm_state_vconf_changed_cb() is called!"); int pm_state = 0; vconf_get_int(VCONFKEY_PM_STATE, &pm_state); if (pm_state == VCONFKEY_PM_STATE_LCDOFF) { DBG("Setting - LCD Off!! stop sound!"); _stop_all_sound_play(); } } int cstring_cmp(const void *a, const void *b) { const char *ia = (const char *)a; const char *ib = (const char *)b; return strcmp(ia, ib); } void _show_ringtone_layer_cb(void *data, Evas_Object *obj, void *event_info) { DBG("ENTER _show_ringtone_layer_cb"); Evas_Object *layer; unsigned int index; appdata *ad = data; if (ad == NULL) return; ad->MENU_TYPE = SETTING_SOUND_RINGTONE; if (is_loaded_ringtone_data == 0) { get_sound_file_list(SETTING_DEFAULT_RINGTONE_PATH"/", 1); is_loaded_ringtone_data = 1; /* @todo apply eina_sort */ /*qsort (ringtone_name_arr, ringtone_count-1, sizeof(char*), cstring_cmp); */ } cur_sound_type = SOUND_STREAM_TYPE_RINGTONE_CALL; layer = elm_layout_add(ad->nf); evas_object_size_hint_weight_set(layer, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(layer, EVAS_HINT_FILL, EVAS_HINT_FILL); Elm_Genlist_Item_Class *itc = NULL; itc = elm_genlist_item_class_new(); itc->item_style = "1text.1icon.1"; itc->func.text_get = _gl_ringtone_text_get; itc->func.content_get = _gl_ringtone_radio_get; Evas_Object *genlist; genlist = elm_genlist_add(ad->nf); elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS); connect_to_wheel_with_genlist(genlist, ad); Elm_Genlist_Item_Class *title_item = elm_genlist_item_class_new(); title_item->func.text_get = _gl_menu_title_text_get; title_item->item_style = "title"; title_item->func.del = NULL; elm_genlist_item_append(genlist, title_item, (void *)SOUND_TITLE_RINGTONE, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); elm_genlist_item_class_free(title_item); DBG("---> ringtone_count %d to GENLIST", ringtone_count); for (index = 0; index < ringtone_count; index++) { /*DBG("---> add item to list %d to GENLIST", index); */ Item_Data *item = (Item_Data *)calloc(sizeof(Item_Data), 1); if (item) { item->index = index; item->item = elm_genlist_item_append(genlist, itc, item, NULL, ELM_GENLIST_ITEM_NONE, _ringtone_type_gl_cb, (void *)(uintptr_t)index); } } ad->ringtone_type_rdg = elm_radio_add(genlist); elm_radio_state_value_set(ad->ringtone_type_rdg, ringtone_count); elm_radio_value_set(ad->ringtone_type_rdg, ringtone_type); confirmed_ringtone_type = ringtone_type; evas_object_data_set(genlist, "radio_main", ad->ringtone_type_rdg); g_ringtone_type_genlist = genlist; Elm_Genlist_Item_Class *padding = elm_genlist_item_class_new(); padding->item_style = "padding"; padding->func.del = _sound_gl_del; Elm_Object_Item *padding_item; padding_item = elm_genlist_item_append(genlist, padding, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); elm_atspi_accessible_role_set(padding_item, ELM_ATSPI_ROLE_REDUNDANT_OBJECT); elm_genlist_item_class_free(padding); evas_object_show(genlist); elm_genlist_item_class_free(itc); Elm_Object_Item *nf_it = elm_naviframe_item_push(ad->nf, NULL, NULL, NULL, genlist, "empty"); back_button_cb_push(&_response_ringtone_ok_cb, data, obj, g_sound_genlist, "g_sound_genlist"); elm_naviframe_item_title_enabled_set(nf_it, EINA_FALSE, EINA_FALSE); /*VCONFKEY_PM_STATE */ register_vconf_changing(VCONFKEY_PM_STATE, pm_state_vconf_changed_cb, NULL); DBG("LEAVE _show_ringtone_layer_cb"); elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE); } static void _response_notification_ok_cb(void *data, Evas_Object *obj, void *event_info) { if (is_created_player()) { _close_player(NULL); } /* save a notification type. */ vconf_set_str(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR , notification_arr[notification_type]); if (g_notification_type_genlist != NULL) { evas_object_del(g_notification_type_genlist); g_notification_type_genlist = NULL; } if (g_app_context->notification_rdg != NULL) { evas_object_del(g_app_context->notification_rdg); g_app_context->notification_rdg = NULL; } confirmed_Notification_type = notification_type; appdata *ad = (appdata *)data; if (ad != NULL) { elm_naviframe_item_pop(ad->nf); } if (g_sound_genlist != NULL) { elm_genlist_realized_items_update(g_sound_genlist); } } static void _response_notification_cancel_cb(void *data, Evas_Object *obj, void *event_info) { if (g_notification_type_genlist != NULL) { evas_object_del(g_notification_type_genlist); g_notification_type_genlist = NULL; } appdata *ad = (appdata *)data; if (ad != NULL) { elm_naviframe_item_pop(ad->nf); } notification_type = confirmed_Notification_type; if (is_created_player()) { _close_player(NULL); } } static char *_gl_notification_text_get(void *data, Evas_Object *obj, const char *part) { Item_Data *item = data; if (item == NULL) return NULL; char buf[__SETTING_BUF_SIZE__] = {0,}; snprintf(buf, sizeof(buf) - 1, "%s", notification_name_arr[item->index % notification_count]); return strdup(buf); } static Evas_Object *_gl_notification_radio_get(void *data, Evas_Object *obj, const char *part) { Evas_Object *radio = NULL; Evas_Object *radio_main = evas_object_data_get(obj, "radio_main"); Item_Data *id = data; int index = id->index; if (!strcmp(part, "elm.icon")) { radio = elm_radio_add(obj); elm_object_style_set(radio, "list"); elm_radio_state_value_set(radio, id->index); evas_object_size_hint_align_set(radio, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_radio_group_add(radio, radio_main); if (id->index == notification_type) { elm_radio_value_set(radio_main, id->index); } index++; elm_atspi_accessible_relationship_append(id->item, ELM_ATSPI_RELATION_DESCRIBED_BY, radio); elm_atspi_accessible_relationship_append(id->item, ELM_ATSPI_RELATION_CONTROLLER_FOR, radio); elm_atspi_accessible_relationship_append(radio, ELM_ATSPI_RELATION_CONTROLLED_BY, id->item); } return radio; } static void _notification_gl_cb(void *data, Evas_Object *obj, void *event_info) { elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE); notification_type = (uintptr_t)data; int volume = 0; sound_manager_get_volume(SOUND_STREAM_TYPE_NOTIFICATION, &volume); if (volume == 0 || get_sound_mode() != SOUND_MODE_SOUND) { if (g_app_context) { struct _toast_data *toast = _create_toast(g_app_context, _("IDS_ST_TPOP_VOLUME_CURRENTLY_SET_TO_0")); if (toast) { _show_toast(g_app_context, toast); } } } else { play_sound(notification_arr[notification_type], 0.0, SOUND_STREAM_TYPE_NOTIFICATION); set_looping(FALSE); } if (g_notification_type_genlist) { elm_genlist_realized_items_update(g_notification_type_genlist); } } void _show_notification_popup_cb(void *data, Evas_Object *obj, void *event_info) { Evas_Object *popup, *btn; unsigned int index; appdata *ad = data; if (ad == NULL) return; ad->MENU_TYPE = SETTING_SOUND_NOTIFICATION; if (is_loaded_noti_data == 0) { get_sound_file_list(TZ_SYS_RO_APP_D"/org.tizen.watch-setting/shared/res/settings/Alerts/", 0); is_loaded_noti_data = 1; } cur_sound_type = SOUND_STREAM_TYPE_NOTIFICATION; popup = elm_layout_add(ad->win_main); elm_layout_file_set(popup, EDJE_PATH, "setting/genlist/2button-layout"); evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(popup, EVAS_HINT_FILL, EVAS_HINT_FILL); Elm_Genlist_Item_Class *itc = NULL; itc = elm_genlist_item_class_new(); itc->item_style = "1text.1icon.1"; itc->func.text_get = _gl_notification_text_get; itc->func.content_get = _gl_notification_radio_get; Evas_Object *genlist; genlist = elm_genlist_add(popup); elm_object_style_set(genlist, "popup"); elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS); connect_to_wheel_with_genlist(genlist, ad); Elm_Genlist_Item_Class *title_item = elm_genlist_item_class_new(); title_item->func.text_get = _gl_menu_title_text_get; title_item->item_style = "title"; title_item->func.del = NULL; elm_genlist_item_append(genlist, title_item, (void *)SOUND_TITLE_NOTIFICATION, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); elm_genlist_item_class_free(title_item); for (index = 0; index < notification_count; index++) { Item_Data *item = (Item_Data *)calloc(sizeof(Item_Data), 1); if (item) { item->index = index; item->item = elm_genlist_item_append(genlist, itc, item, NULL, ELM_GENLIST_ITEM_NONE, _notification_gl_cb, (void *)(uintptr_t)index); } } ad->notification_rdg = elm_radio_add(genlist); elm_radio_state_value_set(ad->notification_rdg, notification_count); elm_radio_value_set(ad->notification_rdg, notification_type); confirmed_Notification_type = notification_type; evas_object_data_set(genlist, "radio_main", ad->notification_rdg); g_notification_type_genlist = genlist; Elm_Genlist_Item_Class *padding = elm_genlist_item_class_new(); padding->item_style = "padding"; padding->func.del = _sound_gl_del; Elm_Object_Item *padding_item; padding_item = elm_genlist_item_append(genlist, padding, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); elm_atspi_accessible_role_set(padding_item, ELM_ATSPI_ROLE_REDUNDANT_OBJECT); elm_genlist_item_class_free(padding); elm_object_part_content_set(popup, "elm.genlist", genlist); evas_object_show(genlist); elm_genlist_item_class_free(itc); btn = elm_button_add(popup); evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_object_text_set(btn, _("IDS_ST_BUTTON_CANCEL_ABB2")); elm_object_part_content_set(popup, "btn.left", btn); evas_object_smart_callback_add(btn, "clicked", _response_notification_cancel_cb, ad); btn = elm_button_add(popup); evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_object_text_set(btn, _("IDS_WNOTI_BUTTON_OK_ABB2")); elm_object_part_content_set(popup, "btn.right", btn); evas_object_smart_callback_add(btn, "clicked", _response_notification_ok_cb, ad); elm_naviframe_item_push(ad->nf, NULL, NULL, NULL, popup, "empty"); back_button_cb_push(&_response_notification_cancel_cb, data, btn, g_sound_genlist, "g_sound_genlist"); eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, _hw_back_key_cb, NULL); /*VCONFKEY_PM_STATE */ register_vconf_changing(VCONFKEY_PM_STATE, pm_state_vconf_changed_cb, NULL); } static char *_gl_pref_arm_title_get(void *data, Evas_Object *obj, const char *part) { char buf[__SETTING_BUF_SIZE__] = {0,}; Item_Data *id = data; int index = id->index; if (!strcmp(part, "elm.text")) { snprintf(buf, sizeof(buf) - 1, "%s", _(pref_arm_str[index % 2])); index++; } return strdup(buf); } static Evas_Object *_gl_pref_arm_ridio_get(void *data, Evas_Object *obj, const char *part) { Evas_Object *radio = NULL; Evas_Object *radio_main = evas_object_data_get(obj, "radio_main"); Item_Data *id = data; int index = id->index; int prefered_arm_type = 0; if (!strcmp(part, "elm.icon")) { radio = elm_radio_add(obj); elm_radio_state_value_set(radio, id->index); evas_object_size_hint_align_set(radio, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_radio_group_add(radio, radio_main); evas_object_smart_callback_add(radio, "changed", NULL, (void *)(uintptr_t)id->index); vconf_get_bool(VCONFKEY_SETAPPL_PERFERED_ARM_LEFT_BOOL, &prefered_arm_type); prefered_arm_type = (prefered_arm_type) ? 0 : 1; if (pref_arm_type == id->index) { elm_radio_value_set(radio_main, pref_arm_type); } index++; elm_atspi_accessible_relationship_append(id->item, ELM_ATSPI_RELATION_DESCRIBED_BY, radio); elm_atspi_accessible_relationship_append(id->item, ELM_ATSPI_RELATION_CONTROLLER_FOR, radio); elm_atspi_accessible_relationship_append(radio, ELM_ATSPI_RELATION_CONTROLLED_BY, id->item); } return radio; } static void _pref_arm_gl_del(void *data, Evas_Object *obj) { Item_Data *id = data; FREE(id); } static void _pref_arm_gl_cb(void *data, Evas_Object *obj, void *event_info) { elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE); pref_arm_type = (uintptr_t)data; elm_genlist_realized_items_update(g_pref_arm_type_genlist); if (g_app_context) { elm_naviframe_item_pop(g_app_context->nf); if (!g_app_context->pref_arm_rdg) { evas_object_del(g_app_context->pref_arm_rdg); g_app_context->pref_arm_rdg = NULL; } } /* save a perfered arm type */ vconf_set_bool(VCONFKEY_SETAPPL_PERFERED_ARM_LEFT_BOOL, (pref_arm_type == 0) ? TRUE : FALSE); if (g_sound_genlist) { elm_genlist_realized_items_update(g_sound_genlist); } /* show toast message */ if (g_app_context) { struct _toast_data *toast = _create_toast(g_app_context, _(pref_arm_toast_msg[pref_arm_type % 2])); if (toast) { _show_toast(g_app_context, toast); } } } void _show_pref_arm_mode_list(void *data) { appdata *ad = data; if (ad == NULL) { DBG("%s", "_show_pref_arm_mode_list - appdata is null"); return; } Evas_Object *genlist = NULL; Elm_Object_Item *item = NULL; Elm_Object_Item *nf_it = NULL; Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new(); itc->item_style = "1text.1icon.1"; itc->func.text_get = _gl_pref_arm_title_get; itc->func.content_get = _gl_pref_arm_ridio_get; itc->func.del = _pref_arm_gl_del; Evas_Object *layout = elm_layout_add(ad->nf); elm_layout_file_set(layout, EDJE_PATH, "setting/genlist/layout"); evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); genlist = elm_genlist_add(layout); elm_genlist_block_count_set(genlist, 14); elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS); evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); connect_to_wheel_with_genlist(genlist, ad); Elm_Genlist_Item_Class *title_item = elm_genlist_item_class_new(); title_item->func.text_get = _gl_menu_title_text_get; title_item->item_style = "title"; title_item->func.del = NULL; elm_genlist_item_append(genlist, title_item, (void *)SOUND_TITLE_PREF_ARM_MODE, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); elm_genlist_item_class_free(title_item); Item_Data *id = calloc(sizeof(Item_Data), 1); if (id) { id->index = 0; item = elm_genlist_item_append(genlist, itc, id, NULL, ELM_GENLIST_ITEM_NONE, _pref_arm_gl_cb, (void *)0); id->item = item; } Item_Data *id2 = calloc(sizeof(Item_Data), 1); if (id2) { id2->index = 1; item = elm_genlist_item_append(genlist, itc, id2, NULL, ELM_GENLIST_ITEM_NONE, _pref_arm_gl_cb, (void *)1); id2->item = item; } ad->pref_arm_rdg = elm_radio_add(genlist); elm_radio_state_value_set(ad->pref_arm_rdg, 2); elm_radio_value_set(ad->pref_arm_rdg, pref_arm_type); evas_object_data_set(genlist, "radio_main", ad->pref_arm_rdg); elm_genlist_item_class_free(itc); Elm_Genlist_Item_Class *padding = elm_genlist_item_class_new(); padding->item_style = "padding"; padding->func.del = _pref_arm_gl_del; Elm_Object_Item *padding_item; padding_item = elm_genlist_item_append(genlist, padding, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); elm_atspi_accessible_role_set(padding_item, ELM_ATSPI_ROLE_REDUNDANT_OBJECT); elm_genlist_item_class_free(padding); g_pref_arm_type_genlist = genlist; elm_object_part_content_set(layout, "elm.genlist", genlist); nf_it = elm_naviframe_item_push(ad->nf, NULL, NULL, NULL, layout, "empty"); elm_naviframe_item_title_enabled_set(nf_it, EINA_FALSE, EINA_FALSE); }