diff options
author | jinwang.an <jinwang.an@samsung.com> | 2018-07-26 15:20:28 +0900 |
---|---|---|
committer | jinwang.an <jinwang.an@samsung.com> | 2018-07-26 18:02:36 +0900 |
commit | 8518aa77d8ee52829567efeb55e56b6355914d05 (patch) | |
tree | 016e275abf84c220ec21f05141c6cbef44e3ce4e | |
parent | f2ea4a0a36a1931e0da714ff527569bb05ca46e5 (diff) | |
download | watch-setting-8518aa77d8ee52829567efeb55e56b6355914d05.tar.gz watch-setting-8518aa77d8ee52829567efeb55e56b6355914d05.tar.bz2 watch-setting-8518aa77d8ee52829567efeb55e56b6355914d05.zip |
Delete unused source files.
Change-Id: Idd0a47cfa43bdaf77d7cf7f3f30f2c8b86d9c143
Signed-off-by: jinwang.an <jinwang.an@samsung.com>
-rwxr-xr-x | CMakeLists.txt | 9 | ||||
-rw-r--r-- | src/setting-battery.c | 747 | ||||
-rw-r--r-- | src/setting-bluetooth.c | 837 | ||||
-rw-r--r-- | src/setting-double.c | 922 | ||||
-rw-r--r-- | src/setting-homescreen.c | 1356 | ||||
-rw-r--r-- | src/setting-motion.c | 403 | ||||
-rw-r--r-- | src/setting-notification.c | 189 | ||||
-rw-r--r-- | src/setting-reset.c | 121 | ||||
-rw-r--r-- | src/setting-volume.c | 1476 | ||||
-rw-r--r-- | src/setting_control_bt.c | 60 |
10 files changed, 0 insertions, 6120 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3abd058..56a2928 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,27 +7,18 @@ SET(SRCS src/setting-vibration.c src/setting-connection.c src/setting-clock.c -# src/setting-homescreen.c -# src/setting-volume.c src/setting-volume-page.c src/setting-info.c -# src/setting-bluetooth.c -# src/setting-motion.c src/setting-device.c src/setting-display.c src/setting-privacy.c -# src/setting-double.c src/setting-language.c src/setting-safety.c -# src/setting-reset.c -# src/setting-battery.c src/setting-common-sound.c src/util.c src/setting_data_vconf.c src/setting_control_haptic.c -# src/setting_control_bt.c src/setting_view_toast.c -# src/setting-notification.c src/setting-profile.c src/setting_indicator_util.c ) diff --git a/src/setting-battery.c b/src/setting-battery.c deleted file mode 100644 index a4b4f8e..0000000 --- a/src/setting-battery.c +++ /dev/null @@ -1,747 +0,0 @@ -/* - * 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. - */ -/* - * setting-battery.c - * - * Created on: Oct 12, 2013 - * Author: min-hoyun - */ -#include <pkgmgr-info.h> -#include <aul.h> -#include <device/battery.h> -#include "setting_data_vconf.h" - -#include "setting-battery.h" -#include "util.h" - -int percent; -bool is_charging; -bool prev_charging_state; -int image_index; -int is_alive; - -Ecore_Timer *battery_timer; - - -Evas_Object *_create_battery_content2(void *data); -#if 0 /* _NOT_USED_ */ -static void _battery_percent_cb(void *data, Evas_Object *obj, void *event_info); -#endif -static void _power_saving_cb(void *data, Evas_Object *obj, void *event_info); -void _pws_popup_cb(void *data, Evas_Object *obj, void *event_info); - -static struct _battery_menu_item battery_menu_list[] = { - { "IDS_ST_BODY_BATTERY_STATUS", DISABLE, _battery_status_cb_gen_item }, - /*{ "IDS_ST_BODY_BATTERY_PERCENTAGE_ABB", DISABLE, _battery_percent_cb }, */ - { "IDS_ST_MBODY_POWER_SAVER_ABB", DISABLE, _power_saving_cb } -}; - -char *battery_icons[] = { - "b_setting_battery_01.png", - "b_setting_battery_02.png", - "b_setting_battery_03.png", - "b_setting_battery_04.png", - "b_setting_battery_05.png", - "b_setting_battery_06.png", - "b_setting_battery_07.png", - "b_setting_battery_08.png", - "b_setting_battery_09.png" -}; - -char *battery_charging_icons[] = { - "b_setting_battery_charge_01.png", - "b_setting_battery_charge_02.png", - "b_setting_battery_charge_03.png", - "b_setting_battery_charge_04.png", - "b_setting_battery_charge_05.png", - "b_setting_battery_charge_06.png", - "b_setting_battery_charge_07.png", - "b_setting_battery_charge_08.png", - "b_setting_battery_charge_09.png" -}; - -static char *power_saving_str[] = { - "IDS_ST_BODY_DISABLED_M_STATUS", - "IDS_EMAIL_BODY_ENABLED_M_STATUS" -}; - -static appdata *g_app_context = NULL; -static Ecore_Timer *pws_timer = NULL; -static Evas_Object *g_pws_check = NULL; -static Elm_Object_Item *pws_it = NULL; - -int _power_saving_terminate_app(void *data); - -static Eina_Bool _delete_timer(void *data) -{ - DBG("_delete_timer"); - pws_timer = NULL; - _power_saving_terminate_app(g_app_context); - - return ECORE_CALLBACK_CANCEL; -} - -static void change_pws_key(keynode_t *key, void *data) -{ - int mode_val = 0; - vconf_get_int(VCONFKEY_SETAPPL_PSMODE, &mode_val); - - if (mode_val) { - DBG("change_pws_key is power saving"); - if (pws_timer) { - ecore_timer_del(pws_timer); - pws_timer = NULL; - } - pws_timer = ecore_timer_add(1.0, (Ecore_Task_Cb) _delete_timer, NULL); - } - - else { - DBG("change_pws_key is normal"); - } -} - -void _initialize_battery() -{ - battery_timer = NULL; - - percent = 0; - is_charging = false; - prev_charging_state = false; - is_alive = 0; - - register_vconf_changing(VCONFKEY_SETAPPL_PSMODE, change_pws_key, NULL); -} - -Eina_Bool _clear_battery_list_cb(void *data, Elm_Object_Item *it) -{ - return EINA_TRUE; -} - -void _clear_battery_cb(void *data , Evas *e, Evas_Object *obj, void *event_info) -{ - if (battery_timer) { - ecore_timer_del(battery_timer); - battery_timer = NULL; - } - if (pws_timer) { - ecore_timer_del(pws_timer); - pws_timer = NULL; - } - percent = 0; - is_charging = false; - prev_charging_state = false; - is_alive = 0; - - g_pws_check = NULL; - pws_it = NULL; - - unregister_vconf_changing(VCONFKEY_SYSTEM_TIME_CHANGED, change_pws_key); - - return; -} - -static int get_battery_img_index(int percent) -{ - int index = 0; - - if (percent > 0 && percent < 5) { - index = 0; - } else if (percent >= 5 && percent <= 10) { - index = 1; - } else if (percent >= 11 && percent <= 20) { - index = 2; - } else if (percent >= 21 && percent <= 34) { - index = 3; - } else if (percent >= 35 && percent <= 49) { - index = 4; - } else if (percent >= 50 && percent <= 64) { - index = 5; - } else if (percent >= 65 && percent <= 79) { - index = 6; - } else if (percent >= 80 && percent <= 94) { - index = 7; - } else if (percent >= 95 && percent <= 100) { - index = 8; - } - return index; -} - -static int is_updated_battery_state() -{ - int current_percent = 0; - bool current_charging_state = false; - - if (device_battery_get_percent(¤t_percent) != DEVICE_ERROR_NONE) { - DBG("Setting - Battery percent get error"); - } - - if (device_battery_is_charging(¤t_charging_state) != DEVICE_ERROR_NONE) { - DBG("Setting - Battery charging do not get. error"); - } - - if ((current_percent != percent) || (current_charging_state != is_charging)) { - percent = current_percent; - is_charging = current_charging_state; - - DBG("Setting - Updated battery state !! percent: %d, charging: %d", percent, is_charging); - - return TRUE; - } - - return FALSE; -} - -static int is_type_of_charging() -{ - int status = 0; - - vconf_get_int(VCONFKEY_SYSMAN_CHARGER_STATUS, &status); - - if (status == VCONFKEY_SYSMAN_CHARGER_CONNECTED) { - vconf_get_int(VCONFKEY_SYSMAN_USB_STATUS, &status); - if (status == VCONFKEY_SYSMAN_USB_AVAILABLE) { - return CHARGING_USB; - } - } - return CHARGING_AC; -} - -static Evas_Object *create_icon(Evas_Object *parent, char *img_path) -{ - if (img_path == NULL) - return NULL; - - Evas_Object *icon = elm_image_add(parent); - elm_image_file_set(icon, img_path, NULL); - evas_object_size_hint_align_set(icon, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - - return icon; -} - -static Eina_Bool _battery_timeout(void *data) -{ - Evas_Object *layout = (Evas_Object *)data; - if (layout == NULL) { - return ECORE_CALLBACK_CANCEL; - } - - char buf[512]; - char *ret_str = NULL; - ret_str = _get_strnum_from_icu(percent); - if (is_updated_battery_state()) { - if (layout) { - snprintf(buf, sizeof(buf) - 1, "%s%c", ret_str, '\%'); - char *temp_percent = strdup(buf); - elm_object_part_text_set(layout, "text1", temp_percent); - FREE(temp_percent); - - if (is_charging) { - snprintf(buf, sizeof(buf) - 1, "%s%s", _("IDS_COM_BODY_CHARGING_GA"), (is_type_of_charging() == CHARGING_AC) ? "(AC)" : "(USB)"); - char *temp_charging_msg = strdup(buf); - elm_object_part_text_set(layout, "text2", temp_charging_msg); - FREE(temp_charging_msg); - } else { - elm_object_part_text_set(layout, "text2", _("IDS_ST_BODY_NOT_CHARGING_ABB")); - } - - int img_index = get_battery_img_index(percent); - if ((img_index != image_index) || (prev_charging_state != is_charging)) { - snprintf(buf, sizeof(buf) - 1, "%s%s", IMG_DIR, (is_charging) ? battery_charging_icons[img_index] : battery_icons[img_index]); - - Evas_Object *del_icon = elm_object_part_content_get(layout, "image"); - if (del_icon) { - evas_object_del(del_icon); - del_icon = NULL; - } - elm_object_part_content_set(layout, "image", create_icon(layout, buf)); - } - - prev_charging_state = is_charging; - - DBG("Setting - Update Battery Layout!!"); - } - } - - DBG("Setting - check battery state!!"); - FREE(ret_str); - - return ECORE_CALLBACK_RENEW; -} - -void _start_timer_for_update(Evas_Object *obj) -{ - is_alive = 1; - if (battery_timer) { - ecore_timer_del(battery_timer); - battery_timer = NULL; - } - battery_timer = ecore_timer_add(1.0, (Ecore_Task_Cb)_battery_timeout, obj); -} - -void _battery_lang_changed(void *data, Evas_Object *obj, void *event_info) -{ - DBG("Setting - _battery_lang_changed is called!"); - - char buf[512]; - char *ret_str = NULL; - ret_str = (char *)_get_strnum_from_icu(percent); - if (obj) { - snprintf(buf, sizeof(buf) - 1, "%s%c", ret_str, '\%'); - char *temp_percent = strdup(buf); - elm_object_part_text_set(obj, "text1", temp_percent); - FREE(temp_percent); - - if (is_charging) { - snprintf(buf, sizeof(buf) - 1, "%s%s", _("IDS_COM_BODY_CHARGING_GA"), (is_type_of_charging() == CHARGING_AC) ? "(AC)" : "(USB)"); - char *temp_charging_msg = strdup(buf); - elm_object_part_text_set(obj, "text2", temp_charging_msg); - FREE(temp_charging_msg); - } else { - elm_object_part_text_set(obj, "text2", _("IDS_ST_BODY_NOT_CHARGING_ABB")); - } - } - FREE(ret_str); -} - -Evas_Object *_create_battery_content2(void *data) -{ - Evas_Object *layout; - char buf[__SETTING_BUF_SIZE__] = {0,}; - appdata *ad = (appdata *)data; - if (ad == NULL) - return NULL; - - layout = elm_layout_add(ad->nf); - elm_layout_file_set(layout, EDJE_PATH, "setting-test/battery"); - evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_smart_callback_add(layout, "language,changed", _battery_lang_changed, NULL); - - if (device_battery_get_percent(&percent) != DEVICE_ERROR_NONE) { - DBG("Setting - Battery percent get error"); - } - char *ret_str = NULL; - ret_str = _get_strnum_from_icu(percent); - snprintf(buf, sizeof(buf) - 1, "%s%c", ret_str, '\%'); - - elm_object_part_text_set(layout, "text1", buf); - - if (device_battery_is_charging(&is_charging) != DEVICE_ERROR_NONE) { - DBG("Setting - Battery charging do not get. error"); - } - char *charging_text = NULL; - if (is_charging) { - snprintf(buf, sizeof(buf) - 1, "%s%s", _("IDS_COM_BODY_CHARGING_GA"), (is_type_of_charging() == CHARGING_AC) ? "(AC)" : "(USB)"); - charging_text = strdup(buf); - } - elm_object_part_text_set(layout, "text2", (is_charging) ? charging_text : _("IDS_ST_BODY_NOT_CHARGING_ABB")); - FREE(charging_text); - - prev_charging_state = is_charging; - - image_index = get_battery_img_index(percent); - - snprintf(buf, sizeof(buf) - 1, "%s%s", IMG_DIR, (is_charging) ? battery_charging_icons[image_index] : battery_icons[image_index]); - - elm_object_part_content_set(layout, "image", create_icon(layout, buf)); - - _start_timer_for_update(layout); /* updating timer start! */ - - FREE(ret_str); - return layout; -} - -void _battery_status_cb_gen_item(void *data, Evas_Object *obj, void *event_info) -{ - appdata *ad = data; - - if (ad == NULL) { - DBG("Setting - ad is null"); - return; - } - - _initialize_battery(); - - return; -} - -Evas_Object *_battery_status_cb(void *data) -{ - Evas_Object *layout = NULL; - /* Elm_Object_Item *nf_it = NULL; */ - appdata *ad = data; - - if (ad == NULL) { - DBG("Setting - ad is null"); - return NULL; - } - - _initialize_battery(); - layout = _create_battery_content2(data); - if (layout == NULL) { - DBG("%s", "battery cb - layout is null"); - return NULL;; - } - - return layout; - /*nf_it = elm_naviframe_item_push(ad->nf, NULL, NULL, NULL, layout, NULL); */ - /*elm_naviframe_item_pop_cb_set(nf_it, _clear_battery_cb, ad); */ - /*elm_naviframe_item_title_enabled_set(nf_it, EINA_FALSE, EINA_FALSE); */ -} - -int _get_battery_percent_value() -{ - int value = 0; - if (vconf_get_bool(VCONFKEY_SETAPPL_BATTERY_PERCENTAGE_BOOL, &value) != 0) { - ERR("error get vconf value!!"); - } - return value; -} - -int _set_battery_percent_value(int value) -{ - if (vconf_set_bool(VCONFKEY_SETAPPL_BATTERY_PERCENTAGE_BOOL, value) != 0) { - ERR("error set vconf value!!"); - return FALSE; - } - return TRUE; -} - -#if 0 /* _NOT_USED_ */ -void _battery_percent_cb(void *data, Evas_Object *obj, void *event_info) -{ - elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE); - - _set_battery_percent_value(!_get_battery_percent_value()); - - elm_genlist_item_update((Elm_Object_Item *)event_info); -} -#endif - -int _power_saving_runapp_info_get(const aul_app_info *ainfo, void *data) -{ - DBG("_power_saving_runapp_info_get"); - - int ret = 0; - bool taskmanage = false; - pkgmgrinfo_appinfo_h handle; - - ret = pkgmgrinfo_appinfo_get_appinfo(ainfo->appid, &handle); - if (ret != PMINFO_R_OK) { - ERR("pkgmgrinfo_appinfo_get_appinfo error"); - return -1; - } - - ret = pkgmgrinfo_appinfo_is_taskmanage(handle, &taskmanage); - if (ret != PMINFO_R_OK) { - ERR("pkgmgrinfo_appinfo_is_taskmanage error"); - pkgmgrinfo_appinfo_destroy_appinfo(handle); - return -1; - } - - if (taskmanage != 0) - aul_terminate_pid(ainfo->pid); - - pkgmgrinfo_appinfo_destroy_appinfo(handle); - return 0; -} -/* -static Eina_Bool _pws_timer(void *data) -{ - DBG("_pws_timer"); - appdata *ad = (appdata *) data; - if( ad == NULL ) - return ECORE_CALLBACK_CANCEL; - - if(ad->win_main) - { - evas_object_del(ad->win_main); - ad->win_main = NULL; - } - pws_timer = NULL; - return ECORE_CALLBACK_CANCEL; -} -*/ -int _power_saving_terminate_app(void *data) -{ - int ret = AUL_R_ERROR; - appdata *ad = (appdata *) data; - - if (ad->win_main) { - evas_object_del(ad->win_main); - ad->win_main = NULL; - } - - ret = aul_app_get_running_app_info(_power_saving_runapp_info_get, NULL); - if (ret != AUL_R_OK) { - DBG("aul_app_get_running_app_info() failed"); - } - - return 0; -} - -int _get_power_saving_status() -{ - int value = 0; - if (vconf_get_int(VCONFKEY_SETAPPL_PSMODE, &value) != 0) { - ERR("error get vconf value!!"); - } - if (value) - battery_menu_list[BATT_MENU_POWER_SAVING].is_enable = ENABLE; - else - battery_menu_list[BATT_MENU_POWER_SAVING].is_enable = DISABLE; - return value; -} - -int _set_power_saving_status(int value) -{ - if (vconf_set_int(VCONFKEY_SETAPPL_PSMODE, value) != 0) { - ERR("error set vconf value!!"); - return FALSE; - } - if (value) { - battery_menu_list[BATT_MENU_POWER_SAVING].is_enable = ENABLE; - } else - battery_menu_list[BATT_MENU_POWER_SAVING].is_enable = DISABLE; - return TRUE; -} - -static void _power_saving_cb(void *data, Evas_Object *obj, void *event_info) -{ - elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE); - - int pws_status; /*int , 0:normal, 3:pws on */ - pws_status = _get_power_saving_status(); - - if (pws_status) { - /*on -> off */ - DBG("psmode state [%d]", pws_status); - _set_power_saving_status(SETTING_PSMODE_NORMAL); - } else if (!pws_status) { - /*off -> on */ - _pws_popup_cb(data, obj, event_info); - } - - elm_genlist_item_update((Elm_Object_Item *)event_info); -} - -char *_gl_battery_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.1") || !strcmp(part, "elm.text")) { - snprintf(buf, sizeof(buf) - 1, "%s", _(battery_menu_list[index].name)); - } else if (!strcmp(part, "elm.text.2") && index == BATT_MENU_POWER_SAVING) { - snprintf(buf, sizeof(buf) - 1, "%s", _(power_saving_str[battery_menu_list[index].is_enable])); - } - return strdup(buf); -} - - -Evas_Object *_gl_battery_check_get(void *data, Evas_Object *obj, const char *part) -{ - Evas_Object *check = NULL; - - Item_Data *id = data; - int index = id->index; - - if (!strcmp(part, "elm.icon")) { - check = elm_check_add(obj); - if (index == BATT_MENU_POWER_SAVING) { - elm_check_state_set(check, (_get_power_saving_status()) ? EINA_TRUE : EINA_FALSE); - g_pws_check = check; - } else { - elm_check_state_set(check, (_get_battery_percent_value()) ? 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); - - } - - return check; -} - -void _gl_battery_del(void *data, Evas_Object *obj) -{ - Item_Data *id = data; - FREE(id); -} - -Evas_Object *_create_battery_list(void *data) -{ - appdata *ad = data; - - if (!ad) { - ERR("appdata is null!!"); - return NULL; - } - - Evas_Object *genlist = NULL; - Evas_Object *layout = NULL; - struct _battery_menu_item *menu_list = NULL; - int idx = 0; - - g_app_context = ad; - - Elm_Genlist_Item_Class *itc = NULL; - - Elm_Genlist_Item_Class *itc_1text = elm_genlist_item_class_new(); - itc_1text->item_style = "1text"; - itc_1text->func.text_get = _gl_battery_title_get; - itc_1text->func.del = _gl_battery_del; - - Elm_Genlist_Item_Class *itc_2text_1icon = elm_genlist_item_class_new(); - itc_2text_1icon->item_style = "2text.1icon.1"; - itc_2text_1icon->func.text_get = _gl_battery_title_get; - itc_2text_1icon->func.content_get = _gl_battery_check_get; - itc_2text_1icon->func.del = _gl_battery_del; - - 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_mode_set(genlist, ELM_LIST_COMPRESS); - connect_to_wheel_with_genlist(genlist, ad); - - menu_list = battery_menu_list; - - for (idx = 0; idx < sizeof(battery_menu_list) / sizeof(struct _battery_menu_item); idx++) { - if (idx == BATT_MENU_POWER_SAVING) { - itc = itc_2text_1icon; - } else if (idx == BATT_MENU_STATUS) { - itc = itc_1text; - } - - Item_Data *id = calloc(sizeof(Item_Data), 1); - if (id) { - id->index = idx; - id->item = elm_genlist_item_append( - genlist, /* genlist object */ - itc, /* item class */ - id, /* data */ - NULL, - ELM_GENLIST_ITEM_NONE, - menu_list[idx].func, /* call back */ - ad); - - if (idx == BATT_MENU_POWER_SAVING) { - pws_it = id->item; - } - } - } - - elm_genlist_item_class_free(itc_2text_1icon); - /*elm_genlist_item_class_free(itc_1text_1icon); */ - elm_genlist_item_class_free(itc_1text); - itc = NULL; - - elm_object_part_content_set(layout, "elm.genlist", genlist); - - return layout; -} - -static void _pws_cancel_cb(void *data, Evas_Object *obj, void *event_info) -{ - appdata *ad = (appdata *) data; - if (ad == NULL) - return; - - if (ad->popup) { - evas_object_del(data); - ad->popup = NULL; - } -} - -static void _pws_ok_cb(void *data, Evas_Object *obj, void *event_info) -{ - appdata *ad = data; - - if (ad == NULL) { - DBG("%s", "_disable_emergency_ok_cb : appdata is null"); - return; - } - - if (ad->popup) { - evas_object_del(data); - ad->popup = NULL; - } - - if (pws_it) { - battery_menu_list[BATT_MENU_POWER_SAVING].is_enable = ENABLE; - elm_genlist_item_fields_update(pws_it, "elm.text.2", ELM_GENLIST_ITEM_FIELD_TEXT); - elm_check_state_set(g_pws_check, EINA_TRUE); - } - _set_power_saving_status(SETTING_PSMODE_WEARABLE); -} - -void _pws_popup_cb(void *data, Evas_Object *obj, void *event_info) -{ - Evas_Object *popup = NULL; - Evas_Object *btn = NULL; - Evas_Object *scroller = NULL; - Evas_Object *label = NULL; - - appdata *ad = (appdata *) data; - if (ad == NULL) - return; - - popup = elm_popup_add(ad->nf); - evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_object_part_text_set(popup, "title,text", _("IDS_ST_MBODY_POWER_SAVER_ABB")); - - ad->popup = popup; - - scroller = elm_scroller_add(popup); - evas_object_size_hint_weight_set(scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_object_style_set(scroller, "effect"); - elm_object_content_set(popup, scroller); - evas_object_show(scroller); - - label = elm_label_add(scroller); - elm_object_style_set(label, "popup/default"); - elm_label_line_wrap_set(label, ELM_WRAP_MIXED); - - char buf[__SETTING_BUF_SIZE__] = {0,}; - - char *font_size_frame = "<font_size=34>%s</font_size>"; - snprintf(buf, sizeof(buf) - 1, font_size_frame, _("IDS_ST_POP_POWER_SAVER_WILL_BE_ENABLED_THIS_WILL_LIMIT_THE_MAXIMUM_PERFORMANCE_OF_THE_CPU_TURN_OFF_BLUETOOTH_AND_A_LOWER_SCREEN_POWER_LEVEL_WILL_BE_USED_MSG")); - - char *txt = strdup(buf); - elm_object_text_set(label, txt); - FREE(txt); - evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_object_content_set(scroller, label); - evas_object_show(label); - - /*ea_object_event_callback_add(popup, EA_CALLBACK_BACK, setting_popup_back_cb, ad); */ - - btn = elm_button_add(popup); - elm_object_style_set(btn, "default"); - 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, "button1", btn); - evas_object_smart_callback_add(btn, "clicked", _pws_cancel_cb, popup); - - btn = elm_button_add(popup); - elm_object_style_set(btn, "default"); - 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, "button2", btn); - evas_object_smart_callback_add(btn, "clicked", _pws_ok_cb, popup); - - evas_object_show(popup); -} - - diff --git a/src/setting-bluetooth.c b/src/setting-bluetooth.c deleted file mode 100644 index fa07b57..0000000 --- a/src/setting-bluetooth.c +++ /dev/null @@ -1,837 +0,0 @@ -/* - * 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. - */ -/* - * setting-bluetooth.c - * - * Created on: Oct 9, 2013 - * Author: min-hoyun - */ - -#include <feedback.h> - -#include "setting-bluetooth.h" -#include "setting_control_bt.h" -#include "setting_data_vconf.h" -#include "setting-common-sound.h" -#include "util.h" - -static void _blutooth_cb(void *data, Evas_Object *obj, void *event_info); -static void _visibility_cb(void *data, Evas_Object *obj, void *event_info); -static void _BT_headset_cb(void *data, Evas_Object *obj, void *event_info); - -static struct _bt_menu_item bt_menu_its[] = { - { "IDS_QP_BUTTON_BLUETOOTH", DISABLE, _blutooth_cb }, - { "IDS_VCALL_BODY_BT_HEADSET", DISABLE, _BT_headset_cb }, - { "IDS_ST_MBODY_MAKE_VISIBLE_ABB", DISABLE, _visibility_cb }, /* "IDS_OP_BODY_VISIBILITY" */ - { NULL, DISABLE, NULL } -}; - -static char *bluetooth_enable_str[] = { - "IDS_ST_BODY_OFF_M_STATUS", - "IDS_ST_BODY_ON_M_STATUS", - "IDS_COM_POP_PROCESSING" -}; - -static char *visible_str[] = { - "IDS_ST_BODY_DISABLED_M_STATUS", - "IDS_ST_BODY_YOUR_GEAR_IS_VISIBLE_FOR_PS_ABB" -}; - - -static Ecore_Timer *bt_timer = NULL; -static Ecore_Timer *vb_timer = NULL; - -static Elm_Object_Item *bt_it = NULL; -static Elm_Object_Item *vb_it = NULL; -static Elm_Object_Item *hf_it = NULL; - -static Evas_Object *bt_genlist = NULL; -static Evas_Object *g_bt_check = NULL; -static Evas_Object *g_vb_check = NULL; - -static int is_bt_operating = BT_NON_OPERATING; -static int timeout_seconds = VISIBILITY_TIMEOUT; -static bt_adapter_visibility_mode_e visibility_mode = BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE; -static int origin_bt_enable; -static double bt_time = 0.0; -static int is_connected_hf = FALSE; -static char *g_device_name = NULL; - - -static void _init_bt_value(); -static int is_handsfree_connected(); -static void _bt_genlist_update(); -static int is_disable_visibility_item_view(); -static void _update_visibility_view(); -static void _alternate_bt_mode(void *data); - -static char *_gl_bt_title_get(void *data, Evas_Object *obj, const char *part); -static Evas_Object *_gl_bt_check_get(void *data, Evas_Object *obj, const char *part); -static void hf_event_handler(int event, bt_hf_event_param_t *data, void *user_data); - - - -static void sap_state_vconf_change_cb(keynode_t *key, void *data) -{ - _update_visibility_item_view(is_handsfree_connected()); -} - -static void _bt_adapter_state_enabled_cb(int result, bt_adapter_state_e adapter_state, void *user_data) -{ - DBG("Setting - _bt_adapter_state_enabled_cb() is called!"); - - if (adapter_state == BT_ADAPTER_ENABLED) { - DBG("Setting - BT adapter state : BT_ADAPTER_ENABLED"); - - bt_menu_its[BT_MENU_TYPE_BT_ON_OFF].is_enable = 1; - - _bt_genlist_update(); - } else if (adapter_state == BT_ADAPTER_DISABLED) { - DBG("Setting - BT adapter state : BT_ADAPTER_DISABLED"); - - bt_menu_its[BT_MENU_TYPE_BT_ON_OFF].is_enable = 0; - is_connected_hf = FALSE; - - _bt_genlist_update(); - } - _init_bt_value(); -} - -void initialize_bt() -{ - DBG("Setting - initialize_bt()"); - - if (bt_initialize() != BT_ERROR_NONE) { - ERR("Setting - bt_initialize() is failed...."); - return; - } - DBG("Setting - bt_initialize() is success"); - - if (bt_adapter_set_state_changed_cb(_bt_adapter_state_enabled_cb, NULL) != BT_ERROR_NONE) { - ERR("[%s] bt_adapter_set_state_changed_cb() failed.", __FUNCTION__); - return; - } else { - DBG("bt_adapter_set_state_changed_cb() is success!"); - } - - bluetooth_hf_init(hf_event_handler, NULL); - - register_vconf_changing("memory/private/sap/conn_status", sap_state_vconf_change_cb, NULL); - - int ret; - ret = feedback_initialize(); - if (ret != FEEDBACK_ERROR_NONE) { - DBG("feedback_initialize failed"); - } -} - -Eina_Bool _clear_bluetooth_cb(void *data, Elm_Object_Item *it) -{ - clear_bt_resource(); - - return EINA_TRUE; -} - -static void _disable_visibility_item_view() -{ - bt_menu_its[BT_MENU_TYPE_VISIBLE_ON_OFF].is_enable = DISABLE; - timeout_seconds = VISIBILITY_TIMEOUT; - - _update_visibility_view(); -} - -static void hf_event_handler(int event, bt_hf_event_param_t *data, void *user_data) -{ - switch (event) { - case BLUETOOTH_EVENT_HF_CONNECTED: - DBG("Setting - BLUETOOTH_EVENT_HF_CONNECTED"); - _update_visibility_item_view(TRUE); - break; - - case BLUETOOTH_EVENT_HF_DISCONNECTED: - DBG("Setting - BLUETOOTH_EVENT_HF_DISCONNECTED"); - _update_visibility_item_view(is_handsfree_connected()); - break; - } -} - -void _update_visibility_item_view(int is_hf_connected) -{ - DBG("Setting - _update_view() is called!!"); - - if (is_hf_connected) { - is_connected_hf = TRUE; - - if (vb_timer) { - ecore_timer_del(vb_timer); - vb_timer = NULL; - } - - bt_menu_its[BT_MENU_TYPE_VISIBLE_ON_OFF].is_enable = DISABLE; - timeout_seconds = VISIBILITY_TIMEOUT; - - _update_visibility_view(); - } else { - is_connected_hf = FALSE; - - _update_visibility_view(); - } -} - -void clear_bt_resource() -{ - bt_menu_its[BT_MENU_TYPE_BT_ON_OFF].is_enable = DISABLE; - is_bt_operating = BT_NON_OPERATING; - - if (timeout_seconds == 0 && vb_timer) { - ecore_timer_del(vb_timer); - vb_timer = NULL; - - bt_menu_its[BT_MENU_TYPE_VISIBLE_ON_OFF].is_enable = DISABLE; - timeout_seconds = VISIBILITY_TIMEOUT; - } - - bluetooth_hf_deinit(); - - int ret = bt_adapter_unset_state_changed_cb(); - - if (ret != BT_ERROR_NONE) { - ERR("Setting - bt adapter unset state changed cb is fail"); - } - - if (bt_deinitialize() < 0) { - ERR("Setting - bt_deinitialize() failed."); - return; - } - DBG("Setting - bt_deinitialize() is success"); - - bt_genlist = NULL; - vb_it = NULL; - bt_it = NULL; - g_bt_check = NULL; - g_vb_check = NULL; - - /* Unregister SAP status vconf changeing callback */ - unregister_vconf_changing("memory/private/sap/conn_status", sap_state_vconf_change_cb); - - ret = feedback_deinitialize(); - if (ret != FEEDBACK_ERROR_NONE) { - DBG("feedback_deinitialize failed"); - } -} - -static void _init_bt_value() -{ - bt_timer = NULL; - bt_time = 0.0; - timeout_seconds = VISIBILITY_TIMEOUT; - bt_menu_its[BT_MENU_TYPE_VISIBLE_ON_OFF].is_enable = DISABLE; - is_bt_operating = BT_NON_OPERATING; -} - -static void _alternate_bt_mode(void *data) -{ - int ret = 0; - bt_adapter_state_e value; - - /*appdata * ad = data; */ - - int prev_bt_enable = bt_menu_its[BT_MENU_TYPE_BT_ON_OFF].is_enable; - bt_menu_its[BT_MENU_TYPE_BT_ON_OFF].is_enable = 2; - if (bt_it != NULL) { - elm_genlist_item_fields_update(bt_it, "elm.text.2", ELM_GENLIST_ITEM_FIELD_TEXT); - elm_check_state_set(g_bt_check, !prev_bt_enable); - edje_object_signal_emit(elm_layout_edje_get(g_bt_check), "elm,state,disabled", "elm"); - } - - if (bt_adapter_get_state(&value) != BT_ERROR_NONE) { - ERR("Setting - bt_adapter_get_state() is failed "); - _init_bt_value(); - return; - } - - if (value == EINA_TRUE) { - DBG("Setting - Current bt is on....disable..."); - - bt_menu_its[BT_MENU_TYPE_BT_ON_OFF].is_enable = 0; - is_connected_hf = TRUE; - _disable_visibility_item_view(); - - if (hf_it) { - elm_genlist_item_update(hf_it); - } - - ret = bt_adapter_disable(); - - timeout_seconds = 0; /* vb_timer stop!! */ - } else { - DBG("Setting - Current bt is off....enable..."); - ret = bt_adapter_enable(); - } - - if (ret != BT_ERROR_NONE) { - DBG("Setting - Enalbe or Disable failed.... : %d", ret); - - bt_menu_its[BT_MENU_TYPE_BT_ON_OFF].is_enable = origin_bt_enable; - - _bt_genlist_update(); - _init_bt_value(); - - return; - } -} - -static void _blutooth_cb(void *data, Evas_Object *obj, void *event_info) -{ - DBG("Setting - %s", "Setting - _blutooth_cb is called"); - - Elm_Object_Item *it = (Elm_Object_Item *)event_info; - elm_genlist_item_selected_set(it, EINA_FALSE); - - if (is_bt_operating == BT_OPERATING) { - DBG("Setting - _blutooth_cb() is same status "); - - return; - } - is_bt_operating = BT_OPERATING; - - appdata *ad = data; - if (ad == NULL) { - DBG("%s", "Setting - _blutooth_cb - ad or check is null"); - return; - } - - /* previous state backup */ - origin_bt_enable = bt_menu_its[BT_MENU_TYPE_BT_ON_OFF].is_enable; - - if (vb_timer != NULL && vb_it != NULL) { - DBG("Setting - vb_it is disabled"); - - bt_menu_its[BT_MENU_TYPE_VISIBLE_ON_OFF].is_enable = DISABLE; - timeout_seconds = 0; - - ecore_timer_del(vb_timer); - vb_timer = NULL; - - _update_visibility_view(); - - /*elm_genlist_item_update(vb_it); */ - } - - _alternate_bt_mode(data); -} - -static int is_valid_timeout(int seconds) -{ - return ((seconds > 0) && (seconds <= VISIBILITY_TIMEOUT)); -} - -static void _bt_genlist_update() -{ - if (bt_it) { - elm_genlist_item_fields_update(bt_it, "elm.text.2", ELM_GENLIST_ITEM_FIELD_TEXT); - - int bt_enable = bt_menu_its[BT_MENU_TYPE_BT_ON_OFF].is_enable; - edje_object_signal_emit(elm_layout_edje_get(g_bt_check), "elm,state,enabled", "elm"); - elm_check_state_set(g_bt_check, (bt_enable == 1) ? EINA_TRUE : EINA_FALSE); - } - if (hf_it) { - elm_genlist_item_update(hf_it); - } - if (vb_it) { - elm_genlist_item_fields_update(vb_it, "elm.text.1", ELM_GENLIST_ITEM_FIELD_TEXT); - elm_genlist_item_fields_update(vb_it, "elm.text.2", ELM_GENLIST_ITEM_FIELD_TEXT); - - elm_check_state_set(g_vb_check, (bt_menu_its[BT_MENU_TYPE_VISIBLE_ON_OFF].is_enable == 1) ? EINA_TRUE : EINA_FALSE); - - if (is_disable_visibility_item_view()) { - edje_object_signal_emit(elm_layout_edje_get(g_vb_check), "elm,state,disabled", "elm"); - } else { - edje_object_signal_emit(elm_layout_edje_get(g_vb_check), "elm,state,enabled", "elm"); - } - } -} - -static void _update_visibility_view() -{ - DBG("Setting - _update_visibility_view()"); - - if (vb_it) { - elm_genlist_item_fields_update(vb_it, "elm.text.1", ELM_GENLIST_ITEM_FIELD_TEXT); - elm_genlist_item_fields_update(vb_it, "elm.text.2", ELM_GENLIST_ITEM_FIELD_TEXT); - - elm_check_state_set(g_vb_check, (bt_menu_its[BT_MENU_TYPE_VISIBLE_ON_OFF].is_enable == TRUE) - ? EINA_TRUE : EINA_FALSE); - - if (is_disable_visibility_item_view()) { - edje_object_signal_emit(elm_layout_edje_get(g_vb_check), "elm,state,disabled", "elm"); - } else { - edje_object_signal_emit(elm_layout_edje_get(g_vb_check), "elm,state,enabled", "elm"); - } - } -} - -static void _update_visibility_item_update(void *data) -{ - appdata *ad = data; - if (ad == NULL) { - DBG("Setting - ad is null."); - return; - } - - if (ad->MENU_TYPE == SETTING_BLUETOOTH) { - DBG("Setting - update_visibility_item_update"); - - _update_visibility_view(); - /*_bt_genlist_update(); */ - } -} - -static void _init_vb_data(void *data) -{ - bt_menu_its[BT_MENU_TYPE_VISIBLE_ON_OFF].is_enable = DISABLE; - timeout_seconds = VISIBILITY_TIMEOUT; - _update_visibility_item_update(data); - vb_timer = NULL; -} - -static Eina_Bool __vb_timeout(void *data) -{ - if (is_valid_timeout(timeout_seconds)) { - DBG("Setting - %d seconds", timeout_seconds); - - --timeout_seconds; - - _update_visibility_item_update(data); - - return ECORE_CALLBACK_RENEW; - } - - bt_menu_its[BT_MENU_TYPE_VISIBLE_ON_OFF].is_enable = DISABLE; - _update_visibility_item_update(data); - - DBG("Setting - visibility time is out."); - - if (visibility_mode != BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE) { - if (bt_adapter_set_visibility(BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE, 0) != BT_ERROR_NONE) { - DBG("[%s] Setting - bt_adapter_set_visibility(NON) failed.", __FUNCTION__); - _init_vb_data(data); - return ECORE_CALLBACK_CANCEL; - } - visibility_mode = BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE; - DBG("[%s] Setting - bt_adapter_set_visibility(NON) success.", __FUNCTION__); - } - - _init_vb_data(data); - - return ECORE_CALLBACK_CANCEL; -} - -static void _start_visibility_timer(void *data) -{ - if (vb_timer) { /* Timer Start */ - ecore_timer_del(vb_timer); - vb_timer = NULL; - } - vb_timer = ecore_timer_add(1.0, (Ecore_Task_Cb) __vb_timeout, data); -} - -static void _bt_visibility_mode(void *data) -{ - bt_adapter_state_e bt_state; - - if (bt_adapter_get_state(&bt_state) != BT_ERROR_NONE) { - DBG("[%s] Setting - bt_adapter_get_state() failed.", __FUNCTION__); - return; - } - - int state = DISABLE; - vconf_get_int(VCONFKEY_BT_STATUS, &state); - - DBG("Setting - bt state : %d", state); - - if (bt_state == BT_ADAPTER_ENABLED) { - if (bt_adapter_get_visibility(&visibility_mode, NULL) != BT_ERROR_NONE) { - DBG("[%s] Setting - bt_adapter_get_visibility() failed.", __FUNCTION__); - return; - } - - DBG("Setting - visibility_mode : %d", visibility_mode); - - if (visibility_mode == BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE) { - if (bt_adapter_set_visibility(BT_ADAPTER_VISIBILITY_MODE_GENERAL_DISCOVERABLE, 0) != BT_ERROR_NONE) { - DBG("[%s] Setting - bt_adapter_set_visibility(VISIBLE) failed.", __FUNCTION__); - } else { - visibility_mode = BT_ADAPTER_VISIBILITY_MODE_GENERAL_DISCOVERABLE; - DBG("[%s] Setting - bt_adapter_set_visibility(VISIBLE) success.", __FUNCTION__); - - bt_menu_its[BT_MENU_TYPE_VISIBLE_ON_OFF].is_enable = ENABLE; - timeout_seconds = VISIBILITY_TIMEOUT; - - _update_visibility_view(); - - _start_visibility_timer(data); /* Timer start */ - } - } else if (visibility_mode == BT_ADAPTER_VISIBILITY_MODE_GENERAL_DISCOVERABLE) { - DBG("[%s] Setting - Visibility mode was already set as BT_ADAPTER_VISIBILITY_MODE_GENERAL_DISCOVERABLE.", __FUNCTION__); - - timeout_seconds = 0; /* Timer stop; */ - - if (bt_adapter_set_visibility(BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE, 0) != BT_ERROR_NONE) { - DBG("[%s] Setting - bt_adapter_set_visibility(NON) failed.", __FUNCTION__); - } else { - visibility_mode = BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE; - DBG("[%s] Setting - bt_adapter_set_visibility(NON) success.", __FUNCTION__); - } - } - } -} - -static int is_disable_visibility_item_view() -{ - return (!bt_menu_its[BT_MENU_TYPE_BT_ON_OFF].is_enable || is_connected_hf); -} - -static void _visibility_cb(void *data, Evas_Object *obj, void *event_info) -{ - DBG("%s", "Setting - _visibility_cb is called"); - - Elm_Object_Item *it = (Elm_Object_Item *)event_info; - elm_genlist_item_selected_set(it, EINA_FALSE); - - int touch_sound_enable = false; - if (get_sound_mode() == SOUND_MODE_SOUND) { - vconf_get_bool(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, &touch_sound_enable); - if (touch_sound_enable) { - feedback_play(FEEDBACK_PATTERN_TAP); - } - } - - if (is_disable_visibility_item_view()) { - DBG("Setting - disable visibility!!"); - return; - } - - appdata *ad = data; - if (ad == NULL) { - DBG("%s", "Setting - _visibility_cb - ad or check is null"); - return; - } - - _bt_visibility_mode(data); -} - -static int _is_enable_BT_headset() -{ - int enable = FALSE; - - vconf_get_int(VCONFKEY_BT_STATUS, &enable); - - return (enable != VCONFKEY_BT_STATUS_OFF) && bt_menu_its[BT_MENU_TYPE_BT_ON_OFF].is_enable; -} - -static void _BT_headset_cb(void *data, Evas_Object *obj, void *event_info) -{ - DBG("%s", "Setting - _BT_headset_cb is called"); - - Elm_Object_Item *it = (Elm_Object_Item *)event_info; - elm_genlist_item_selected_set(it, EINA_FALSE); - - if (!_is_enable_BT_headset()) - return; - - app_control_h service; - app_control_create(&service); - app_control_set_app_id(service, "org.tizen.bluetooth"); - app_control_add_extra_data(service, "launch-type", "setting"); - app_control_send_launch_request(service, NULL, NULL); - app_control_destroy(service); -} - -static char *_get_device_name() -{ - char *bt_adapter_name = NULL; - -#if 0 - bt_adapter_state_e bt_state; - if (bt_adapter_get_state(&bt_state) != BT_ERROR_NONE) { - DBG("[%s] Setting - bt_adapter_get_state() failed.", __FUNCTION__); - return NULL; - } - if (bt_adapter_get_name(&bt_adapter_name) != BT_ERROR_NONE) { - ERR("%s,%d: bt get name fail", __func__, __LINE__); - return NULL; - } -#endif - bt_adapter_name = vconf_get_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR); - - return strdup(bt_adapter_name); -} - -static char *_gl_bt_title_get(void *data, Evas_Object *obj, const char *part) -{ - char buf[__SETTING_BUF_SIZE__] = {0,}; - Bt_Item_Data *id = data; - int index = id->index; - char expression[32]; - - if (!strcmp(part, "elm.text.1") || !strcmp(part, "elm.text")) { - if (index == BT_MENU_TYPE_BT_ON_OFF) { - snprintf(buf, sizeof(buf) - 1, "%s", _(bt_menu_its[BT_MENU_TYPE_BT_ON_OFF].name)); - } else if (index == BT_MENU_TYPE_VISIBLE_ON_OFF) { - if (is_disable_visibility_item_view()) { - strcpy(expression, "<font color=#515151>%s</font>"); - } else { - strcpy(expression, "%s"); - } - snprintf(buf, sizeof(buf) - 1, expression, _(bt_menu_its[BT_MENU_TYPE_VISIBLE_ON_OFF].name)); - } else { - if (!_is_enable_BT_headset()) { - strcpy(expression, "<font color=#515151>%s</font>"); - } else { - strcpy(expression, "%s"); - } - snprintf(buf, sizeof(buf) - 1, expression, _(bt_menu_its[BT_MENU_TYPE_BT_HEADSET].name)); - } - } else if (!strcmp(part, "elm.text.2")) { - if (index == BT_MENU_TYPE_BT_ON_OFF) { - DBG("BT item subtitle updated!!"); - int sub_title_type = bt_menu_its[BT_MENU_TYPE_BT_ON_OFF].is_enable; - char *subtitle = _(bluetooth_enable_str[sub_title_type]); - snprintf(buf, sizeof(buf) - 1, "%s", subtitle); - } else if (index == BT_MENU_TYPE_VISIBLE_ON_OFF) { - if (is_disable_visibility_item_view()) { - strncpy(expression, "<font color=#515151>%s</font>", 32); - - if (g_device_name == NULL) { - g_device_name = _get_device_name(); - if (g_device_name == NULL) { - g_device_name = _(visible_str[bt_menu_its[BT_MENU_TYPE_VISIBLE_ON_OFF].is_enable]); - } - } - - snprintf(buf, sizeof(buf) - 1, expression, g_device_name); - } else { - if (bt_menu_its[BT_MENU_TYPE_VISIBLE_ON_OFF].is_enable) { - int hour = timeout_seconds / 60; - int minutes = timeout_seconds % 60; - - char time_buf[16] = {0,}; - snprintf(time_buf, sizeof(time_buf) - 1, "%02d:%02d", hour, minutes); - - snprintf(buf, sizeof(buf) - 1, _(visible_str[bt_menu_its[BT_MENU_TYPE_VISIBLE_ON_OFF].is_enable]), time_buf); - } else { - g_device_name = _get_device_name(); - if (g_device_name == NULL) { - g_device_name = _(visible_str[bt_menu_its[BT_MENU_TYPE_VISIBLE_ON_OFF].is_enable]); - } - - snprintf(buf, sizeof(buf) - 1, "%s", g_device_name); - } - } - } - } - return strdup(buf); -} -#if 0 -static Evas_Object *_get_emtpy_layout(Evas_Object *parent) -{ - if (parent == NULL) - return NULL; - - Evas_Object *layout = elm_layout_add(parent); - elm_layout_file_set(layout, EDJE_PATH, "setting-empty/swallow"); - - return layout; -} -#endif - -static Evas_Object *_gl_bt_check_get(void *data, Evas_Object *obj, const char *part) -{ - Evas_Object *check = NULL; - - Bt_Item_Data *id = data; - int index = id->index; - - if (!strcmp(part, "elm.icon")) { - check = elm_check_add(obj); - elm_object_style_set(check, "list"); - elm_check_state_set(check, (bt_menu_its[index].is_enable == TRUE) ? 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); - evas_object_repeat_events_set(check, EINA_TRUE); - - if (index == BT_MENU_TYPE_VISIBLE_ON_OFF) { - if (is_disable_visibility_item_view()) { - edje_object_signal_emit(elm_layout_edje_get(check), "elm,state,disabled", "elm"); - } - g_vb_check = check; - } else if (index == BT_MENU_TYPE_BT_ON_OFF) { - g_bt_check = check; - } - } - return check; -} - -static void _bt_gl_del(void *data, Evas_Object *obj) -{ - Bt_Item_Data *id = data; - FREE(id); -} - -static void init_values() -{ - if (!vb_timer) { - bt_menu_its[BT_MENU_TYPE_VISIBLE_ON_OFF].is_enable = DISABLE; - } -} - -static int is_handsfree_connected() -{ - int ret = FALSE; - int headset_connected = FALSE; - int sap_connected = FALSE; - - vconf_get_int(VCONFKEY_BT_DEVICE, &headset_connected); - DBG("Heaadset connected : %x", headset_connected); - - if (headset_connected & VCONFKEY_BT_DEVICE_AG_CONNECTED) { - DBG("Setting - Heaadset connected"); - return TRUE; - } - - vconf_get_int("memory/private/sap/conn_status", &sap_connected); - DBG("Sap connected : %d", sap_connected); - - if (sap_connected) { - DBG("Setting - Sap connected"); - return TRUE; - } - - return ret; -} - -static int is_add_BT_headset() -{ - /* temporary code!! */ - /* this code will be changed!! */ - return TRUE; -} - -static int is_BT_enable() -{ - bt_adapter_state_e enable = BT_ADAPTER_DISABLED; - - if (bt_adapter_get_state(&enable) != BT_ERROR_NONE) { - ERR("Setting - bt_adapter_get_state() is failed "); - _init_bt_value(); - enable = DISABLE; - } - - return enable; -} - -Evas_Object *_create_bt_list(void *data) -{ - appdata *ad = data; - if (ad == NULL) { - DBG("%s", "_create_bluetooth_list - appdata is null"); - return NULL; - } - - Evas_Object *genlist = NULL; - struct _bt_menu_item *menu_its = NULL; - int idx = 0; - - init_values(); - - bt_menu_its[BT_MENU_TYPE_BT_ON_OFF].is_enable = is_BT_enable(); - - DBG("Setting - BT status is %d", bt_menu_its[BT_MENU_TYPE_BT_ON_OFF].is_enable); - - if (bt_menu_its[BT_MENU_TYPE_BT_ON_OFF].is_enable > 1) { - bt_menu_its[BT_MENU_TYPE_BT_ON_OFF].is_enable = ENABLE; - } - - if (bt_menu_its[BT_MENU_TYPE_BT_ON_OFF].is_enable) { - is_connected_hf = is_handsfree_connected(); - } else { - is_connected_hf = FALSE; - } - - elm_theme_extension_add(NULL, EDJE_PATH); - Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new(); - itc->item_style = "2text.1icon.1"; - itc->func.text_get = _gl_bt_title_get; - itc->func.content_get = _gl_bt_check_get; - itc->func.del = _bt_gl_del; - - Elm_Genlist_Item_Class *itc2 = elm_genlist_item_class_new(); - itc2->item_style = "1text"; - itc2->func.text_get = _gl_bt_title_get; - itc2->func.del = _bt_gl_del; - - Elm_Genlist_Item_Class *itc3 = elm_genlist_item_class_new(); - itc3->item_style = "multiline.2text.1icon"; - itc3->func.text_get = _gl_bt_title_get; - itc3->func.content_get = _gl_bt_check_get; - itc3->func.del = _bt_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); - connect_to_wheel_with_genlist(genlist, ad); - - menu_its = bt_menu_its; - - Elm_Genlist_Item_Class *itc_arr[3] = { itc, itc2, itc3 }; - - for (idx = 0; idx < BT_LIST_ITEM_COUNT; idx++) { - /* if bt headset is disable, continue */ - if (idx == BT_MENU_TYPE_BT_HEADSET && !is_add_BT_headset()) - continue; - - Bt_Item_Data *id = calloc(sizeof(Bt_Item_Data), 1); - if (id) { - id->index = idx; - id->item = elm_genlist_item_append( - genlist, /* genlist object */ - itc_arr[idx], /* item class */ - id, /* data */ - NULL, - ELM_GENLIST_ITEM_NONE, - menu_its[idx].func, /* call back */ - ad); - - if (idx == BT_MENU_TYPE_BT_ON_OFF) { - bt_it = id->item; - } else if (idx == BT_MENU_TYPE_BT_HEADSET) { - hf_it = id->item; - } else { - vb_it = id->item; - } - } - } - elm_genlist_item_class_free(itc); - elm_genlist_item_class_free(itc2); - elm_genlist_item_class_free(itc3); - - bt_genlist = genlist; - - elm_object_part_content_set(layout, "elm.genlist", genlist); - - return layout; -} diff --git a/src/setting-double.c b/src/setting-double.c deleted file mode 100644 index 6b94c4e..0000000 --- a/src/setting-double.c +++ /dev/null @@ -1,922 +0,0 @@ -/* - * 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. - */ -/* - * setting-double.c - * - * Created on: Jan 8, 2014 - * Author: Sunyeop Hwang - */ -#include <utils_i18n.h> -#include <package-manager.h> -#include <pkgmgr-info.h> - -#include "setting-double.h" -#include "setting_data_vconf.h" -#include "util.h" - -#ifndef VCONFKEY_SETAPPL_DOUBLE_PRESS_HOME_KEY -#define VCONFKEY_SETAPPL_DOUBLE_PRESS_HOME_KEY "db/setting/double_press_home_key" -enum { - VCONFKEY_DOUBLE_PRESS_HOME_KEY_NONE = 0, - VCONFKEY_DOUBLE_PRESS_HOME_KEY_LAST_APP = 1, - VCONFKEY_DOUBLE_PRESS_HOME_KEY_RECENT_APPS = 2 -}; -#endif - -static Evas_Object *g_double_genlist = NULL; -static Evas_Object *g_double_app_genlist = NULL; -static Eina_List *app_list = NULL; -static int list_index = 1; -struct _double_menu_item *pitem_none = NULL; -struct _double_menu_item *pitem_recent = NULL; -struct _double_menu_item *pitem_last = NULL; -/*pkgmgr_client *pc = NULL; */ -/*pkgmgr_client *pc2 = NULL; */ -static i18n_ucollator_h *coll = NULL; - -static char * -_gl_menu_title_text_get(void *data, Evas_Object *obj, const char *part) -{ - char buf[__SETTING_BUF_SIZE__] = {0,}; - snprintf(buf, sizeof(buf)-1, "%s", "Double Press Home Key"); - return strdup(buf); -} - -char *_get_selected_app_name() -{ - int val = 0; - vconf_get_int(VCONFKEY_SETAPPL_DOUBLE_PRESS_HOME_KEY, &val); - - switch (val) { - case VCONFKEY_DOUBLE_PRESS_HOME_KEY_NONE: - return _("IDS_LCKSCN_BODY_NONE"); - case VCONFKEY_DOUBLE_PRESS_HOME_KEY_RECENT_APPS: - return _("IDS_ST_OPT_RECENT_APPS_ABB"); - case VCONFKEY_DOUBLE_PRESS_HOME_KEY_LAST_APP: - return "Last app"; - } - ERR("abnormal state!!!"); - return _("IDS_LCKSCN_BODY_NONE"); -} - - -static struct _double_menu_item *_get_selected_app() -{ - int val = 0; - vconf_get_int(VCONFKEY_SETAPPL_DOUBLE_PRESS_HOME_KEY, &val); - - switch (val) { - case VCONFKEY_DOUBLE_PRESS_HOME_KEY_NONE: - return pitem_none; - case VCONFKEY_DOUBLE_PRESS_HOME_KEY_RECENT_APPS: - return pitem_recent; - case VCONFKEY_DOUBLE_PRESS_HOME_KEY_LAST_APP: - return pitem_last; - } - - return NULL; -} - -static int _sort_app_list_cb(const void *d1, const void *d2) -{ - i18n_uchar app1[128] = { 0, }; - i18n_uchar app2[128] = { 0, }; - - struct _double_menu_item *r1 = (struct _double_menu_item *) d1; - struct _double_menu_item *r2 = (struct _double_menu_item *) d2; - i18n_ustring_copy_ua(app1, r1->name); - i18n_ustring_copy_ua(app2, r2->name); - - i18n_ucollator_result_e ret; - i18n_ucollator_str_collator(coll, app1, -1, app2, -1, &ret); - - switch (ret) { - case I18N_UCOLLATOR_EQUAL: - return 0; - case I18N_UCOLLATOR_GREATER: - return 1; - case I18N_UCOLLATOR_LESS: - return -1; - default: - return 0; - } -} - -static int _app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data) -{ - appdata *ad = user_data; - if (!ad) { - ERR("appdata is null"); - return -1; - } - - char *appid = NULL; - char *name = NULL; - char *pkgid = NULL; - int ret = 0; - pkgmgrinfo_appinfo_h tmp_handle; - - ret = pkgmgrinfo_appinfo_get_appid(handle, &appid); - - if (ret < 0 || !appid) { - ERR("pkgmgrinfo_appinfo_get_appid error"); - return -1; - } else { - - ret = pkgmgrinfo_appinfo_get_appinfo(appid, &tmp_handle); - if (ret != PMINFO_R_OK) { - ERR("pkgmgrinfo_appinfo_get_appinfo error"); - return -1; - } - ret = pkgmgrinfo_appinfo_get_pkgid(tmp_handle, &pkgid); - if (ret != PMINFO_R_OK) { - ERR("pkgmgrinfo_appinfo_get_pkgid error"); - pkgmgrinfo_appinfo_destroy_appinfo(tmp_handle); - return -1; - } - ret = pkgmgrinfo_appinfo_get_label(tmp_handle, &name); - if (ret != PMINFO_R_OK) { - ERR("pkgmgrinfo_appinfo_get_label error"); - pkgmgrinfo_appinfo_destroy_appinfo(tmp_handle); - return -1; - } - - if (strcmp(name, "Call")) { - struct _double_menu_item *pitem = NULL; - pitem = (struct _double_menu_item *)calloc(1, sizeof(struct _double_menu_item)); - if (pitem) { - memset(pitem, 0x0, sizeof(struct _double_menu_item)); - - pitem->index = ++list_index; - pitem->appid = strdup(appid); - pitem->pkgid = strdup(pkgid); - pitem->name = strdup(name); - - app_list = eina_list_sorted_insert(app_list, _sort_app_list_cb, pitem); - } - } - } - - pkgmgrinfo_appinfo_destroy_appinfo(tmp_handle); - return 0; -} - -static void _clear_app_list() -{ - struct _double_menu_item *pitem = NULL; - Eina_List *list = NULL; - - EINA_LIST_FOREACH(app_list, list, pitem) { - FREE(pitem->appid); - FREE(pitem->name); - } - app_list = eina_list_free(app_list); - list_index = 1; -} - -static void _make_app_list(void *data) -{ - appdata *ad = data; - if (!ad) { - ERR("appdata is null"); - return; - } - - if (app_list) { - _clear_app_list(); - } - - pkgmgrinfo_appinfo_filter_h handle = NULL; - - if (pkgmgrinfo_appinfo_filter_create(&handle) != PMINFO_R_OK) { - ERR("pkgmgrinfo_appinfo_filter_create error"); - return; - } - - if (pkgmgrinfo_appinfo_filter_add_bool(handle, PMINFO_APPINFO_PROP_APP_NODISPLAY, 0) - != PMINFO_R_OK) { - ERR("pkgmgrinfo_appinfo_filter_add_bool error"); - pkgmgrinfo_appinfo_filter_destroy(handle); - return; - } - - if (pkgmgrinfo_appinfo_filter_foreach_appinfo(handle, _app_list_cb, ad) - != PMINFO_R_OK) { - ERR("pkgmgrinfo_appinfo_filter_foreach_appinfo error"); - pkgmgrinfo_appinfo_filter_destroy(handle); - return; - } - - pkgmgrinfo_appinfo_filter_destroy(handle); - - /*app_list = eina_list_sort(app_list, eina_list_count(app_list), _sort_app_list_cb); */ -} - -static void _gl_double_del(void *data, Evas_Object *obj) -{ - Double_Item_Data *id = data; - FREE(id); -} - -static char *_gl_double_title_get(void *data, Evas_Object *obj, const char *part) -{ - char buf[__SETTING_BUF_SIZE__] = {0, }; - - if (!strcmp(part, "elm.text.1") || !strcmp(part, "elm.text")) { - snprintf(buf, sizeof(buf) - 1, "%s", _("IDS_ST_MBODY_DOUBLE_PRESS_ABB")); - DBG("elm.text.1 : %s", buf); - } else if (!strcmp(part, "elm.text.2")) { - struct _double_menu_item *selected_app = _get_selected_app(); - if (selected_app) { - snprintf(buf, sizeof(buf) - 1, "%s", _(selected_app->name)); - DBG("elm.text.2 : %s", buf); - } - } - - return strdup(buf); -} - -static char *_gl_double_app_title_get(void *data, Evas_Object *obj, const char *part) -{ - Double_Item_Data *id = data; - - if (id && id->pitem) { - if (id->pitem->index >= 0) { - DBG("--------------------------------"); - DBG("index : %d", id->pitem->index); - DBG("--------------------------------"); - if (id->pitem->index >= 0 && id->pitem->name && !strcmp(part, "elm.text")) { - switch (id->pitem->index) { - case VCONFKEY_DOUBLE_PRESS_HOME_KEY_NONE: - return strdup(_("IDS_LCKSCN_BODY_NONE")); - case VCONFKEY_DOUBLE_PRESS_HOME_KEY_RECENT_APPS: - return strdup(_("IDS_ST_OPT_RECENT_APPS_ABB")); - case VCONFKEY_DOUBLE_PRESS_HOME_KEY_LAST_APP: - return strdup("Last app"); - } - } - } else { - DBG("index : %d", id->pitem->index); - DBG("Do nothing"); - } - } - return NULL; -} - - -static Evas_Object *_gl_double_app_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"); - Double_Item_Data *id = data; - - if (!strcmp(part, "elm.icon")) { - radio = elm_radio_add(obj); - elm_object_style_set(radio, "list"); - elm_radio_state_value_set(radio, id->pitem->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); - evas_object_propagate_events_set(radio, EINA_FALSE); - evas_object_repeat_events_set(radio, EINA_TRUE); - elm_radio_group_add(radio, radio_main); - - 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 _response_ok_cb(void *data, Evas_Object *obj, void *event_info) -{ - appdata *ad = data; - - if (ad && ad->popup) { - evas_object_del(ad->popup); - ad->popup = NULL; - } - back_button_cb_pop(); - -} - -void _last_app_popup_cb(void *data, Evas_Object *obj, void *event_info) -{ - Evas_Object *popup = NULL; - Evas_Object *btn = NULL; - - appdata *ad = (appdata *) data; - if (ad == NULL) - return; - - popup = elm_popup_add(ad->nf); - elm_object_style_set(popup, "circle"); - evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0); - elm_win_resize_object_add(ad->nf, popup); - - ad->popup = popup; - - char buf[__SETTING_BUF_SIZE__] = {0,}; - - char *font_size_frame = "<text_class=tizen><align=center><font_size=28>%s</font_size></align></text_class>"; - snprintf(buf, sizeof(buf) - 1, font_size_frame, "Open the last app you used by pressing the Home key twice on watch face."); - - char *txt = strdup(buf); - elm_object_text_set(popup, txt); - FREE(txt); - - btn = elm_button_add(popup); - elm_object_style_set(btn, "bottom"); - evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_object_translatable_text_set(btn, "IDS_WNOTI_BUTTON_OK_ABB2"); - elm_object_part_content_set(popup, "button1", btn); - evas_object_smart_callback_add(btn, "clicked", _response_ok_cb, ad); - back_button_cb_push(&back_key_popup_cb, data, NULL, g_double_app_genlist, "g_double_app_genlist"); - eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, _hw_back_key_cb, NULL); - - evas_object_show(popup); -} - -static void _gl_double_app_sel_cb(void *data, Evas_Object *obj, void *event_info) -{ - Elm_Object_Item *item = (Elm_Object_Item *)event_info; - elm_genlist_item_selected_set(item, EINA_FALSE); - Double_Item_Data *id = (Double_Item_Data *)elm_object_item_data_get(item); - - appdata *ad = data; - - if (!ad || !id) { - ERR("appdata or id is null!!"); - return; - } - - if (id->pitem && id->pitem->index == 0) { - int val = VCONFKEY_DOUBLE_PRESS_HOME_KEY_NONE ; - vconf_set_int(VCONFKEY_SETAPPL_DOUBLE_PRESS_HOME_KEY, val); - } else if (id->pitem && id->pitem->index == 1) { - int val = VCONFKEY_DOUBLE_PRESS_HOME_KEY_LAST_APP ; - vconf_set_int(VCONFKEY_SETAPPL_DOUBLE_PRESS_HOME_KEY, val); - _last_app_popup_cb(data, obj, event_info); - } else if (id->pitem && id->pitem->index == 2) { - int val = VCONFKEY_DOUBLE_PRESS_HOME_KEY_RECENT_APPS ; - vconf_set_int(VCONFKEY_SETAPPL_DOUBLE_PRESS_HOME_KEY, val); - } - - if (ad && ad->double_press_item) { - elm_genlist_item_update(ad->double_press_item); - } - - back_key_generic_cb(data, obj, event_info); - - if (!ad->double_rdg) { - evas_object_del(ad->double_rdg); - ad->double_rdg = NULL; - } -} - -static void change_double_pressing_cb(keynode_t *key, void *data) -{ - appdata *ad = data; - - if (!ad) { - ERR("appdata is null!!"); - return; - } - if (g_double_app_genlist) { - struct _double_menu_item *selected_app = NULL; - selected_app = _get_selected_app(); - if (selected_app) { - elm_radio_value_set(ad->double_rdg, selected_app->index); - } else { - elm_radio_value_set(ad->double_rdg, -1); - } - - Elm_Object_Item *item = NULL; - item = elm_genlist_first_item_get(g_double_app_genlist); - - while (item) { - Double_Item_Data *id = (Double_Item_Data *)elm_object_item_data_get(item); - if (id && id->pitem == selected_app) { - elm_genlist_item_show(item, ELM_GENLIST_ITEM_SCROLLTO_TOP); - break; - } - item = elm_genlist_item_next_get(item); - } - } - - if (g_double_genlist) { - elm_genlist_realized_items_update(g_double_genlist); - } -} - -static void update_double_app_list(void *data) -{ - appdata *ad = data; - - if (!ad) { - ERR("appdata is null!!"); - return; - } - - _make_app_list(ad); - - if (g_double_genlist) { - elm_genlist_realized_items_update(g_double_genlist); - } - - if (g_double_app_genlist) { - struct _double_menu_item *selected_app = NULL; - /* Elm_Object_Item *sel_it = NULL; */ - - elm_genlist_clear(g_double_app_genlist); - - Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new(); - itc->item_style = "1text.1icon.1"; - itc->func.text_get = _gl_double_app_title_get; - itc->func.content_get = _gl_double_app_radio_get; - itc->func.del = _gl_double_del; - - selected_app = _get_selected_app(); - - Double_Item_Data *id_none = calloc(sizeof(Double_Item_Data), 1); - if (id_none) { - id_none->pitem = pitem_none; - id_none->item = elm_genlist_item_append(g_double_app_genlist, itc, id_none, NULL, - ELM_GENLIST_ITEM_NONE, - _gl_double_app_sel_cb, ad); - - /* if (id_none->pitem == selected_app) { - sel_it = id_none->item; - } */ - } - - Double_Item_Data *id_recent = calloc(sizeof(Double_Item_Data), 1); - if (id_recent) { - id_recent->pitem = pitem_recent; - id_recent->item = elm_genlist_item_append(g_double_app_genlist, itc, id_recent, NULL, - ELM_GENLIST_ITEM_NONE, - _gl_double_app_sel_cb, ad); - - /* if (id_recent->pitem == selected_app) { - sel_it = id_recent->item; - } */ - } - - Double_Item_Data *id_last = calloc(sizeof(Double_Item_Data), 1); - if (id_last) { - id_last->pitem = pitem_last; - id_last->item = elm_genlist_item_append(g_double_app_genlist, itc, id_last, NULL, - ELM_GENLIST_ITEM_NONE, - _gl_double_app_sel_cb, ad); - - /* if (id_last->pitem == selected_app) { - sel_it = id_last->item; - } */ - } - /* struct _double_menu_item *pitem = NULL; */ - /* EINA_LIST_FOREACH(app_list, list, pitem) { */ - /* Double_Item_Data *id = calloc(sizeof(Double_Item_Data), 1); */ - /* if (id) { */ - /* id->pitem = pitem; */ - /* id->item = elm_genlist_item_append(g_double_app_genlist, itc, id, NULL, */ - /* ELM_GENLIST_ITEM_NONE, */ - /* _gl_double_app_sel_cb, ad); */ - /* */ - /* if (id->pitem == selected_app) { */ - /* sel_it = id->item; */ - /* } */ - /* } */ - /* } */ - - if (selected_app) { - elm_radio_value_set(ad->double_rdg, selected_app->index); - } else { - elm_radio_value_set(ad->double_rdg, -1); - } - - /* elm_genlist_item_show(sel_it, ELM_GENLIST_ITEM_SCROLLTO_TOP); */ - - elm_genlist_item_class_free(itc); - } - -} - -static void change_language_cb(keynode_t *key, void *data) -{ - appdata *ad = data; - - if (!ad) { - ERR("appdata is null!!"); - return; - } - - UErrorCode status = U_ZERO_ERROR; - if (coll) { - i18n_ucollator_destroy(coll); - coll = NULL; - } - const char *lang = vconf_get_str(VCONFKEY_LANGSET); - i18n_ucollator_create(lang, &coll); - - update_double_app_list(ad); - FREE(lang); -} - -#if 0 /* _NOT_USED_ */ -static int _double_press_check_appinfo(void *data, char *appid) -{ - appdata *ad = data; - - if (!ad) { - ERR("appdata is null!!"); - return -1; - } - int r; - pkgmgrinfo_appinfo_h tmp_handle; - _Bool nodisplay = 0; - - DBG("appid:%s", appid); - r = pkgmgrinfo_appinfo_get_appinfo(appid, &tmp_handle); - if (r != PMINFO_R_OK) { - ERR("pkgmgrinfo_appinfo_get_appinfo error : %d", r); - return -1; - } - - r = pkgmgrinfo_appinfo_is_nodisplay(tmp_handle, &nodisplay); - if (r != PMINFO_R_OK) { - ERR("pkgmgrinfo_appinfo_is_nodisplay error"); - return -1; - } - - if (!nodisplay) { - update_double_app_list(ad); - } - - return 0; -} -#endif - -Eina_Bool clear_double_app_cb(void *data, Elm_Object_Item *it) -{ - if (coll) { - i18n_ucollator_destroy(coll); - coll = NULL; - } - -#if 0 - if (pc) { - pkgmgr_client_free(pc); - pc = NULL; - } - if (pc2) { - pkgmgr_client_free(pc2); - pc2 = NULL; - } -#endif - - FREE(pitem_none); - FREE(pitem_recent); - FREE(pitem_last); - - Elm_Object_Item *first = elm_genlist_first_item_get(g_double_app_genlist); - elm_object_item_signal_emit(first, "elm,action,title,slide,stop", "elm"); - - g_double_app_genlist = NULL; - unregister_vconf_changing(VCONFKEY_SETAPPL_DOUBLE_PRESS_HOME_KEY, change_double_pressing_cb); - unregister_vconf_changing(VCONFKEY_LANGSET, change_language_cb); - - return EINA_TRUE; -} - -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_double_app_genlist); - if (first == item) - elm_object_item_signal_emit(first, "elm,action,title,slide,start", "elm"); - -} - -Evas_Object *create_double_app_list(void *data) -{ - appdata *ad = data; - - if (!ad) { - ERR("appdata is null!!"); - return NULL; - } - - Evas_Object *layout = NULL; - Evas_Object *genlist = NULL; - - struct _double_menu_item *selected_app = NULL; - - Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new(); - itc->item_style = "1text.1icon.1"; - itc->func.text_get = _gl_double_app_title_get; - itc->func.content_get = _gl_double_app_radio_get; - itc->func.del = _gl_double_del; - - 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); - evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - - connect_to_wheel_with_genlist(genlist, ad); - selected_app = _get_selected_app(); - - 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, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); - - elm_genlist_item_class_free(title_item); - - Double_Item_Data *id_none = calloc(sizeof(Double_Item_Data), 1); - if (id_none) { - id_none->pitem = pitem_none; - id_none->item = elm_genlist_item_append(genlist, itc, id_none, NULL, - ELM_GENLIST_ITEM_NONE, - _gl_double_app_sel_cb, ad); - - } - - - Double_Item_Data *id_last = calloc(sizeof(Double_Item_Data), 1); - if (id_last) { - id_last->pitem = pitem_last; - id_last->item = elm_genlist_item_append(genlist, itc, id_last, NULL, - ELM_GENLIST_ITEM_NONE, - _gl_double_app_sel_cb, ad); - - } - - Double_Item_Data *id_recent = calloc(sizeof(Double_Item_Data), 1); - if (id_recent) { - id_recent->pitem = pitem_recent; - id_recent->item = elm_genlist_item_append(genlist, itc, id_recent, NULL, - ELM_GENLIST_ITEM_NONE, - _gl_double_app_sel_cb, ad); - } - - ad->double_rdg = elm_radio_add(genlist); - elm_radio_state_value_set(ad->double_rdg, -1); - - if (selected_app) { - elm_radio_value_set(ad->double_rdg, selected_app->index); - } else { - elm_radio_value_set(ad->double_rdg, -1); - } - evas_object_data_set(genlist, "radio_main", ad->double_rdg); - - Elm_Genlist_Item_Class *padding = elm_genlist_item_class_new(); - padding->item_style = "padding"; - padding->func.del = _gl_double_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_double_app_genlist = genlist; - - elm_object_part_content_set(layout, "elm.genlist", genlist); - - elm_genlist_item_class_free(itc); - - evas_object_smart_callback_add(genlist, "realized", gl_realized_cb, NULL); - - return layout; -} - -#if 0 /* _NOT_USED_ */ -static int _double_press_appinfo_cb(pkgmgrinfo_appinfo_h handle, void *data) -{ - appdata *ad = data; - - if (!ad) { - ERR("appdata is null!!"); - return -1; - } - char *appid = NULL; - int r; - pkgmgrinfo_appinfo_h tmp_handle; - _Bool nodisplay = 0; - - r = pkgmgrinfo_appinfo_get_appid(handle, &appid); - if (r < 0 || !appid) { - ERR("pkgmgrinfo_appinfo_get_appid error"); - return -1; - } else { - r = pkgmgrinfo_appinfo_get_appinfo(appid, &tmp_handle); - if (r != PMINFO_R_OK) { - ERR("pkgmgrinfo_appinfo_get_appinfo error"); - return -1; - } - - r = pkgmgrinfo_appinfo_is_nodisplay(tmp_handle, &nodisplay); - if (r != PMINFO_R_OK) { - ERR("pkgmgrinfo_appinfo_is_nodisplay error"); - return -1; - } - } - - if (!nodisplay) { - update_double_app_list(ad); - } - - return 0; -} - -static int _double_press_app_event_cb(uid_t target_uid, int req_id, const char *pkg_type, const char *pkgid, - const char *key, const char *val, const void *pmsg, void *data) -{ - appdata *ad = data; - - if (!ad) { - ERR("appdata is null!!"); - return -1; - } - - if (!pkgid || !key || !val) { - ERR("pkgid or key or val is null"); - return -1; - } - - int ret = 0; - if (!strncmp(key, "end", 3) && !strncmp(val, "ok", 2)) { - DBG("end install/update for some pkgid"); - - pkgmgrinfo_pkginfo_h handle; - - ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle); - if (ret != PMINFO_R_OK) - return -1; - ret = pkgmgrinfo_appinfo_get_list(handle, PMINFO_UI_APP, _double_press_appinfo_cb , data); - if (ret != PMINFO_R_OK) { - pkgmgrinfo_pkginfo_destroy_pkginfo(handle); - return -1; - } - pkgmgrinfo_pkginfo_destroy_pkginfo(handle); - - } - return 0; -} - -static int _double_press_app_uninstall_event_cb(int req_id, const char *pkg_type, const char *pkgid, - const char *key, const char *val, const void *pmsg, void *data) -{ - appdata *ad = data; - - if (!ad) { - ERR("appdata is null!!"); - return -1; - } - - if (!pkgid || !key || !val) { - ERR("pkgid or key or val is null"); - return -1; - } - - int ret = 0; - if (!strncmp(key, "end", 3) && !strncmp(val, "ok", 2)) { - DBG("end uninstall for some pkgid"); - update_double_app_list(ad); - } - return 0; -} -#endif - -void init_double_pressing(void *data) -{ - appdata *ad = data; - - if (!ad) { - ERR("appdata is null!!"); - return; - } - - FREE(pitem_none); - pitem_none = calloc(sizeof(struct _double_menu_item), 1); - - if (pitem_none) { - pitem_none->index = 0; - pitem_none->appid = strdup("none"); - pitem_none->pkgid = strdup("none"); - pitem_none->name = strdup(_("IDS_LCKSCN_BODY_NONE")); - } - - FREE(pitem_recent); - pitem_recent = calloc(sizeof(struct _double_menu_item), 1); - - if (pitem_recent) { - pitem_recent->index = 2; - pitem_recent->appid = strdup("recent"); - pitem_recent->pkgid = strdup("recent"); - pitem_recent->name = strdup(_("IDS_ST_OPT_RECENT_APPS_ABB")); - } - - FREE(pitem_last); - pitem_last = calloc(sizeof(struct _double_menu_item), 1); - if (pitem_last) { - pitem_last->index = 1; - pitem_last->appid = strdup("last"); - pitem_last->pkgid = strdup("last"); - pitem_last->name = strdup("Last app"); - } - UErrorCode status = U_ZERO_ERROR; - if (coll) { - i18n_ucollator_destroy(coll); - coll = NULL; - } - const char *lang = vconf_get_str(VCONFKEY_LANGSET); - i18n_ucollator_create(lang, &coll); - - -#if 0 - int event_type = PMINFO_CLIENT_STATUS_INSTALL | PMINFO_CLIENT_STATUS_UPGRADE; - if (pc) { - pkgmgr_client_free(pc); - pc = NULL; - } - - if (!ad->pc) { - ad->pc = pkgmgr_client_new(PC_LISTENING); - pkgmgr_client_set_status_type(ad->pc, event_type); - pkgmgr_client_listen_status(ad->pc, _double_press_app_event_cb, ad); - } - - int event_type2 = PMINFO_CLIENT_STATUS_UNINSTALL; - - if (pc2) { - pkgmgr_client_free(pc2); - pc2 = NULL; - - if (!ad->pc2) { - ad->pc2 = pkgmgr_client_new(PMINFO_LISTENING); - pkgmgr_client_set_status_type(ad->pc2, event_type2); - pkgmgr_client_listen_status(ad->pc2, _double_press_app_uninstall_event_cb, ad); - } - } -#endif - - _make_app_list(ad); - - register_vconf_changing(VCONFKEY_SETAPPL_DOUBLE_PRESS_HOME_KEY, change_double_pressing_cb, ad); - register_vconf_changing(VCONFKEY_LANGSET, change_language_cb, ad); - FREE(lang); -} - -Evas_Object *create_double_list(void *data) -{ - appdata *ad = data; - - if (!ad) { - ERR("appdata is null!!"); - return NULL; - } - - Evas_Object *genlist = NULL; - Evas_Object *layout = NULL; - - Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new(); - itc->item_style = "2text"; - itc->func.text_get = _gl_double_title_get; - - 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_append(genlist, itc, NULL, NULL, */ - /* ELM_GENLIST_ITEM_NONE, _double_app_list_cb, ad); */ - - elm_genlist_item_class_free(itc); - - g_double_genlist = genlist; - - elm_object_part_content_set(layout, "elm.genlist", genlist); - - return layout; -} - diff --git a/src/setting-homescreen.c b/src/setting-homescreen.c deleted file mode 100644 index e66570a..0000000 --- a/src/setting-homescreen.c +++ /dev/null @@ -1,1356 +0,0 @@ -/* - * 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 <app_manager.h> - -#include <vconf.h> -#include <vconf-keys.h> -#include <system_settings.h> -#include <pkgmgr-info.h> -#include <stdint.h> - -#include <media_content.h> -/*#include <media_info_comm_feature.h> */ - -#include <feedback.h> - -#include "setting_data_vconf.h" -#include "setting-homescreen.h" -#include "setting_view_toast.h" -#include "util.h" - -static struct _homescreen_menu_item homescreen_menu_its[] = { - { "IDS_HS_MBODY_HOME_ICON_SIZE_ABB", 0, 0, _homescreen_gl_viewtype_cb }, - { "IDS_ST_MBODY_HOME_BACKGROUND_ABB", 0, 0, _wallpaper_gl_cb }, - { "IDS_ST_OPT_EDIT_HOME_SCREEN_ABB", 0, 0, _homescreen_gl_edit_home_cb }, - { NULL, 0, 0, NULL } -}; - -static struct _homebg_menu_item homebg_menu_its[] = { - { "IDS_COM_MBODY_COLOUR_PALETTE", _show_bg_slide_cb }, - { "IDS_ST_BODY_WALLPAPERS", _wallpaper_gl_cb }, - { "IDS_ST_BODY_GALLERY", _gallery_gl_cb }, - { NULL, NULL } -}; - -static struct _color color[] = { - { 255, 111, 32, "FF6F20" }, - { 244, 102, 141, "F4668D" }, - { 249, 55, 66, "F93742" }, - { 167, 63, 149, "A73F95" }, - { 132, 0, 196, "8400C4" }, - { 3, 54, 224, "0336E0" }, - { 0, 175, 164, "00AFA4" }, - { 96, 192, 30, "60C01E" }, - { 31, 147, 0, "1F9300" }, - { 107, 58, 51 , "6B3A33" }, - { 48, 48, 48, "303030" }, - { 0, 0, 0, "000000" }, /*default black */ -}; - - -static char *home_icon_sub_str[] = { - "IDS_HS_OPT_LARGE_ICONS_ABB", - "IDS_HS_OPT_SMALL_ICONS_ABB", -}; - -static char *thumb_path[] = { - SETTING_DEFAULT_WALLPAPER_PATH"/btn_icons/setting_icon_color_platte.png", - SETTING_DEFAULT_WALLPAPER_PATH"/btn_icons/setting_icon_wallpaper.png", - CROPPED_GALLERY_DEFAULT_WALLPAPER_PATH, - SETTING_DEFAULT_WALLPAPER_PATH"/wallpaper_01.png", - SETTING_DEFAULT_WALLPAPER_PATH"/wallpaper_02.png", - SETTING_DEFAULT_WALLPAPER_PATH"/wallpaper_03.png", - SETTING_DEFAULT_WALLPAPER_PATH"/wallpaper_04.png", - SETTING_DEFAULT_WALLPAPER_PATH"/wallpaper_05.png", - SETTING_DEFAULT_WALLPAPER_PATH"/wallpaper_06.png" -}; - -static void _show_viewtype_list(void *data); -static void _show_homebg_list(void *data); -static void _show_edit_home(void *data); -static void _show_edit_apps(void *data); -static void _wallpaper_vconf_color_changed_cb(keynode_t *node, void *data); -static void _wallpaper_vconf_wallpaper_changed_cb(keynode_t *node, void *data); - -static appdata *g_app_context = NULL; -static Evas_Object *g_home_bg_genlist = NULL; -static int touch_mode = NONE; -static int gallery_img_cnt = 0; -static int is_prev_update = 0; -static char *last_img_path = NULL; -static bool running_gallery = false; -static Ecore_Timer *running_gallery_timer = NULL; - -static Evas_Object *g_wallpaper_layout = NULL; -static Evas_Object *g_wallpaper_scroller = NULL; -static Evas_Object *g_color_page = NULL; -static Evas_Object *g_gallery_prv = NULL; -static Evas_Object *g_wallpaper_box = NULL; -static bool wallpaper_touched = false; - - -#if 0 /* _NOT_USED_ */ -static int _chk_pkg_install(const char *pkgid) -{ - int ret = 0; - pkgmgrinfo_pkginfo_h pkginfo_h = NULL; - - /*get pkg appinfo handler */ - ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &pkginfo_h); - if (PMINFO_R_OK != ret || NULL == pkginfo_h) { - DBG("un-installed pkg [%s]", pkgid); - return FALSE; - } - - if (pkginfo_h) { - pkgmgrinfo_pkginfo_destroy_pkginfo(pkginfo_h); - } - return TRUE; -} - -static bool -_gallery_item_cb(media_info_h item, void *user_data) -{ - if (user_data == NULL) { - DBG("user_data == NULL"); - return false; - } - media_info_get_file_path(item, &last_img_path); - /*DBG("last gallery image path[%s]", last_img_path); */ - - return false; -} -#endif - -static void _get_last_img_path() -{ -#if 0 - Eina_List *item_list = NULL; -#endif - filter_h media_filter; - - int ret; - ret = media_filter_create(&media_filter); - if (ret != MEDIA_CONTENT_ERROR_NONE) { - DBG("Cannot create filter. err"); - } - - ret = media_filter_set_condition(media_filter, "((MEDIA_TYPE=0 OR MEDIA_TYPE=1) AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=101 OR MEDIA_STORAGE_TYPE=121))", MEDIA_CONTENT_COLLATE_DEFAULT); - if (ret != MEDIA_CONTENT_ERROR_NONE) { - DBG("Cannot set condition. err"); - } - - ret = media_filter_set_order(media_filter, MEDIA_CONTENT_ORDER_DESC, "MEDIA_TIMELINE, MEDIA_DISPLAY_NAME", MEDIA_CONTENT_COLLATE_NOCASE); - if (ret != MEDIA_CONTENT_ERROR_NONE) { - DBG("media_filter_set_order is failed, err"); - } - - media_content_connect(); - -#if 0 - ret = media_info_foreach_media_from_db_with_media_mode(media_filter, _gallery_item_cb, &item_list); - if (ret != MEDIA_CONTENT_ERROR_NONE) { - DBG("Cannot retrive data err[%d]", ret); - } -#endif - media_content_disconnect(); - media_filter_destroy(media_filter); -} - - -void _clear_homescreen_cb(void *data , Evas *e, Evas_Object *obj, void *event_info) -{ - unregister_vconf_changing("db/wms/home_bg_palette", _wallpaper_vconf_color_changed_cb); - unregister_vconf_changing("db/wms/home_bg_mode", _wallpaper_vconf_wallpaper_changed_cb); - if (is_prev_update) { - Evas_Object *layout = NULL; - Elm_Object_Item *nf_it = NULL; - layout = create_wallpaper_list(g_app_context); - elm_naviframe_item_pop(g_app_context->nf); - nf_it = elm_naviframe_item_push(g_app_context->nf, NULL, NULL, NULL, layout, NULL); - elm_naviframe_item_title_enabled_set(nf_it, EINA_FALSE, EINA_FALSE); - is_prev_update = 0; - } else { - g_app_context = NULL; - touch_mode = NONE; - } - int ret; - ret = feedback_deinitialize(); - if (ret != FEEDBACK_ERROR_NONE) { - DBG("feedback_deinitialize failed"); - } -} - -/* 1: view type */ -void _homescreen_gl_viewtype_cb(void *data, Evas_Object *obj, void *event_info) -{ - elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE); - - if (data != NULL) { - _show_viewtype_list(data); - } -} - -/* 2: home background */ -void _homescreen_gl_homebg_cb(void *data, Evas_Object *obj, void *event_info) -{ - elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE); - - if (data != NULL) { - _show_homebg_list(data); - } -} - -/* 3: Edit home screen */ -void _homescreen_gl_edit_home_cb(void *data, Evas_Object *obj, void *event_info) -{ - elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE); - - if (data != NULL) { - _show_edit_home(data); - } -} - -/* 4: Edit apps */ -void _homescreen_gl_edit_apps_cb(void *data, Evas_Object *obj, void *event_info) -{ - elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE); - - if (data != NULL) { - _show_edit_apps(data); - } -} - -/* homescreen main list */ -char *_gl_homescreen_title_get(void *data, Evas_Object *obj, const char *part) -{ - char buf[__SETTING_BUF_SIZE__] = {0,}; - Homescreen_Item_Data *id = data; - int index = id->index; - - if (!strcmp(part, "elm.text")) { - snprintf(buf, sizeof(buf) - 1, "%s", _(homescreen_menu_its[index].name)); - index++; - } - return strdup(buf); -} - -Evas_Object *_gl_homescreen_check_get(void *data, Evas_Object *obj, const char *part) -{ - Evas_Object *check = NULL; - - Homescreen_Item_Data *id = data; - int index = id->index; - - if (homescreen_menu_its[index % (HOME_MENU_COUNT)].is_check_type && !strcmp(part, "elm.icon")) { - check = elm_check_add(obj); - elm_check_state_set(check, (homescreen_menu_its[index % (HOME_MENU_COUNT)].state) ? 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); - - index++; - } - - return check; -} - -void _homescreen_gl_del(void *data, Evas_Object *obj) -{ - Homescreen_Item_Data *id = data; - FREE(id); -} - -Evas_Object *_create_homescreen_list(void *data) -{ - appdata *ad = data; - if (ad == NULL) { - DBG("%s", "_create_homescreen_list - appdata is null"); - return NULL; - } - Evas_Object *genlist = NULL; - struct _homescreen_menu_item *menu_its = NULL; - int idx = 0; - - g_app_context = ad; - - Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new(); - itc->item_style = "1text"; - itc->func.text_get = _gl_homescreen_title_get; - itc->func.del = _homescreen_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_mode_set(genlist, ELM_LIST_COMPRESS); - connect_to_wheel_with_genlist(genlist, ad); - - menu_its = homescreen_menu_its; - - for (idx = 0; idx < HOME_MENU_COUNT; idx++) { - Homescreen_Item_Data *id = calloc(sizeof(Homescreen_Item_Data), 1); - if (id) { - id->index = idx; - id->item = elm_genlist_item_append( - genlist, /* genlist object */ - itc, /* item class */ - id, /* data */ - NULL, - ELM_GENLIST_ITEM_NONE, - menu_its[idx].func, /* call back */ - ad); - } - } - elm_genlist_item_class_free(itc); - elm_object_part_content_set(layout, "elm.genlist", genlist); - return layout; -} - -/* home view type */ -char *_get_homeview_type_subtitle() -{ - int value = 0; - vconf_get_int(VCONFKEY_SETAPPL_HOMESCREEN_TYPE_INT, &value); - DBG("VCONFKEY_SETAPPL_HOMESCREEN_TYPE_INT : %d", value); - - char *substr = NULL; - substr = strdup(_(home_icon_sub_str[value])); - - return substr; -} - -static char *_gl_viewtype_title_get(void *data, Evas_Object *obj, const char *part) -{ - Item_Data *id = data; - char *title = NULL; - if (!strcmp(part, "elm.text")) { - if (!id->index) { - char buf[__SETTING_BUF_SIZE__] = {0,}; - snprintf(buf, sizeof(buf) - 1, "%s", _("IDS_HS_OPT_LARGE_ICONS_ABB")); - title = strdup(buf); - } else { - char buf[__SETTING_BUF_SIZE__] = {0,}; - snprintf(buf, sizeof(buf) - 1, "%s", _("IDS_HS_OPT_SMALL_ICONS_ABB")); - title = strdup(buf); - } - } - return title; -} - -static Evas_Object *_gl_viewtype_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; - - 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); - evas_object_propagate_events_set(radio, EINA_FALSE); - evas_object_repeat_events_set(radio, EINA_TRUE); - elm_radio_group_add(radio, radio_main); - } - - return radio; -} - -static void _viewtype_gl_del(void *data, Evas_Object *obj) -{ - Item_Data *id = data; - FREE(id); -} - -static void _viewtype_gl_cb(void *data, Evas_Object *obj, void *event_info) -{ - elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE); - - int idx = (uintptr_t)data; - vconf_set_int(VCONFKEY_SETAPPL_HOMESCREEN_TYPE_INT, idx); - - /*elm_genlist_realized_items_update(g_screen_time_genlist); */ - elm_naviframe_item_pop(g_app_context->nf); - if (!g_app_context->homescreen_rdg) { - evas_object_del(g_app_context->homescreen_rdg); - g_app_context->homescreen_rdg = NULL; - } -} - -void _show_viewtype_list(void *data) -{ - appdata *ad = data; - if (ad == NULL) { - DBG("%s", "_show_viewtype_list - appdata is null"); - return; - } - Evas_Object *layout = NULL; - Evas_Object *genlist = NULL; - Elm_Object_Item *nf_it = NULL; - int idx; - int value = 0; - - g_app_context = ad; - - Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new(); - itc->item_style = "1text.1icon.1"; - itc->func.text_get = _gl_viewtype_title_get; - itc->func.content_get = _gl_viewtype_radio_get; - itc->func.del = _viewtype_gl_del; - - 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); - - for (idx = 0; idx < VIEWTYPE_COUNT; idx++) { - Item_Data *id = calloc(sizeof(Item_Data), 1); - if (id) { - id->index = idx; - id->item = elm_genlist_item_append(genlist, itc, id, NULL, ELM_GENLIST_ITEM_NONE, _viewtype_gl_cb, (void *)(uintptr_t)idx); - } - } - - ad->homescreen_rdg = elm_radio_add(genlist); - elm_radio_state_value_set(ad->homescreen_rdg, -1); - - vconf_get_int(VCONFKEY_SETAPPL_HOMESCREEN_TYPE_INT, &value); - elm_radio_value_set(ad->homescreen_rdg, value); - evas_object_data_set(genlist, "radio_main", ad->homescreen_rdg); - - elm_object_part_content_set(layout, "elm.genlist", genlist); - - elm_genlist_item_class_free(itc); - - 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); -} - -/* home background */ -static char *_gl_homebg_title_get(void *data, Evas_Object *obj, const char *part) -{ - char buf[__SETTING_BUF_SIZE__] = {0,}; - Item_Data *id = data; - - if (!strcmp(part, "elm.text")) { - snprintf(buf, sizeof(buf) - 1, "%s", _(homebg_menu_its[id->index].name)); - } - return strdup(buf); -} - -static void _homebg_gl_del(void *data, Evas_Object *obj) -{ - Item_Data *id = data; - FREE(id); -} - -static void _show_homebg_list(void *data) -{ - appdata *ad = data; - if (ad == NULL) { - DBG("%s", "_show_homebg_list - appdata is null"); - return; - } - Evas_Object *genlist = NULL; - Elm_Object_Item *nf_it = NULL; - struct _homebg_menu_item *menu_its = NULL; - int idx; - - g_app_context = ad; - - Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new(); - itc->item_style = "1text"; - itc->func.text_get = _gl_homebg_title_get; - itc->func.del = _homebg_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); - connect_to_wheel_with_genlist(genlist, ad); - - menu_its = homebg_menu_its; - - for (idx = 0; idx < HOME_BG_LIST_COUNT; idx++) { - Item_Data *id = calloc(sizeof(Item_Data), 1); - if (id) { - id->index = idx; - id->item = elm_genlist_item_append(genlist, itc, id, NULL, ELM_GENLIST_ITEM_NONE, menu_its[idx].func, ad); - } - } - - g_home_bg_genlist = genlist; - - elm_object_part_content_set(layout, "elm.genlist", genlist); - - elm_genlist_item_class_free(itc); - - 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); -} - -static void _layout_del_cb(void *data , Evas *e, Evas_Object *obj, void *event_info) -{ - page_data *pd = data; - FREE(pd); -} - -#if 0 /* _NOT_USED_ */ -static Eina_Bool animator_cb(void *data) -{ - page_data *pd = (page_data *)data; - - /*Since mapbuf is not perfect, Enable them after the size calculation is finished */ - int idx; - for (idx = 0; idx < BG_COLOR_COUNT / WALLPAPER_CNT_PER_PAGE; idx++) { - elm_mapbuf_enabled_set(pd->mapbuf[idx], EINA_TRUE); - } - return ECORE_CALLBACK_CANCEL; -} -#endif - -static int _set_bg_color_type(int type_num) -{ - if (type_num < 0 || type_num > BG_COLOR_COUNT - 1) - return FALSE; - - /*set color -> set mode */ - vconf_set_str("db/wms/home_bg_palette", color[type_num].hex); /*ex. fcb800 */ - vconf_set_int("db/wms/home_bg_mode", 0); - - /*vconf_set_int(VCONFKEY_SETAPPL_HOME_BG_COLOR_TYPE_INT, type_num); */ - DBG("color [%s]", color[type_num].hex); - - return TRUE; -} - -static int _set_wallpaper_path(int thumbIdx) -{ - if (thumbIdx < NUM_DEFAULT_THUMB_BUTTON || thumbIdx > DEFAULT_WALLPAPER_COUNT + NUM_DEFAULT_THUMB_BUTTON) - return FALSE; - - if (system_settings_set_value_string(SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, thumb_path[thumbIdx]) != SYSTEM_SETTINGS_ERROR_NONE) { - DBG("Homescreen set Error : %s", thumb_path[thumbIdx]); - return FALSE; - } - - /*caution : set mode after change wallpaper */ - if (gallery_img_cnt && thumbIdx == NUM_DEFAULT_THUMB_BUTTON) { - /*2:gallery */ - vconf_set_str("db/wms/home_bg_wallpaper", ".bgwallpaper.jpg"); - vconf_set_int("db/wms/home_bg_mode", 2); - } else { - /*1:wallpaper */ - char *wallpaper_name = NULL; - wallpaper_name = strstr(thumb_path[thumbIdx], "wallpaper_"); - vconf_set_str("db/wms/home_bg_wallpaper", wallpaper_name); - /*DBG("wallpaper_name[%s]",wallpaper_name); */ - - vconf_set_int("db/wms/home_bg_mode", 1); - } - - return TRUE; -} - - -static int prev_x = 0; - -static void _mouse_down_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) -{ - if (running_gallery == true) { - touch_mode = NONE; - return; - } - - touch_mode = TOUCH_DOWN; - Evas_Event_Mouse_Down *ev = event_info; - prev_x = ev->canvas.x; -} - -static void _mouse_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) -{ - if (touch_mode == TOUCH_MOVE) - return; - - int type = (uintptr_t)data; - - DBG("Setting - BG type is %d", type); - - prev_x = 0; - touch_mode = NONE; - - feedback_play(FEEDBACK_PATTERN_TAP); - /* set gb vconf */ - if (_set_bg_color_type(type)) { - if (g_app_context != NULL) { - elm_naviframe_item_pop(g_app_context->nf); - } - - /* automatic freed!! */ - struct _toast_data *toast = _create_toast(g_app_context, REPL(_("IDS_GALLERY_TPOP_HOME_BACKGROUND_SET"), "\n", "<br>")); - if (toast) { - _show_toast(g_app_context, toast); - } - } else { - DBG("Setting - BG type is wrong!!"); - } -} - -static void _mouse_move_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) -{ - if (running_gallery == true) { - touch_mode = NONE; - return; - } - - Evas_Event_Mouse_Move *ev = event_info; - - int cur_x = ev->cur.canvas.x; - - if (abs(cur_x - prev_x) > 15) { - /* todo : confirm and remove */ - touch_mode = TOUCH_MOVE; - } -} - -static void _mouse_up_wallpaper_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) -{ - if (running_gallery == true) { - touch_mode = NONE; - return; - } - - if (touch_mode == TOUCH_MOVE) - return; - - int idx = (uintptr_t)data; - - DBG("Setting - wallpaper idx is %d", idx); - - prev_x = 0; - touch_mode = NONE; - - /* set gb vconf */ - if (idx == 0) { - feedback_play(FEEDBACK_PATTERN_TAP); - _show_bg_slide_cb(g_app_context, obj, event_info); - return; - } else if (idx == 1) { - feedback_play(FEEDBACK_PATTERN_TAP); - _gallery_gl_cb(g_app_context, obj, event_info); - running_gallery = true; - elm_object_scroll_freeze_push(obj); - return; - } - - if (_set_wallpaper_path(idx)) { - feedback_play(FEEDBACK_PATTERN_TAP); - wallpaper_touched = true; - if (g_app_context != NULL) { - elm_naviframe_item_pop(g_app_context->nf); - } - - /* automatic freed!! */ - struct _toast_data *toast = _create_toast(g_app_context, REPL(_("IDS_GALLERY_TPOP_HOME_BACKGROUND_SET"), "\n", "<br>")); - if (toast) { - _show_toast(g_app_context, toast); - } - - } else { - DBG("Setting - wallpaper path is wrong!!"); - } -} - -static void _page_show(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - int page; -#if 0 - int idx = 0; - vconf_get_int(VCONFKEY_SETAPPL_HOME_BG_COLOR_TYPE_INT, &idx); - page = (idx - 1) / WALLPAPER_CNT_PER_PAGE; -#endif - /*first page show */ - page = 0; - elm_scroller_page_show(obj, page, 0); -} - -static Evas_Object *_create_index(Evas_Object *parent) -{ - Evas_Object *layout, *scroller, *box, *page_layout, *page; - int index; - - if (parent == NULL) - return NULL; - - /* Create Layout */ - layout = elm_layout_add(parent); - if (layout == NULL) - return NULL; - - page_data *pd = calloc(1, sizeof(page_data)); - if (pd == NULL) - return NULL; - - elm_layout_file_set(layout, EDJE_PATH, "setting-test/index"); - evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_show(layout); - evas_object_event_callback_add(layout, EVAS_CALLBACK_DEL, _layout_del_cb, pd); - - /* Create Scroller */ - scroller = elm_scroller_add(layout); - elm_scroller_loop_set(scroller, EINA_FALSE, EINA_FALSE); - evas_object_size_hint_weight_set(scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(scroller, EVAS_HINT_FILL, EVAS_HINT_FILL); - /*elm_scroller_page_relative_set(scroller, 1.0, 0.0); */ - elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF); - elm_scroller_page_scroll_limit_set(scroller, 1, 0); - elm_object_scroll_lock_y_set(scroller, EINA_TRUE); - elm_scroller_page_size_set(scroller, WIN_SIZE, WIN_SIZE); - elm_object_part_content_set(layout, "scroller", scroller); - elm_object_style_set(scroller, "effect"); - elm_scroller_bounce_set(scroller, EINA_TRUE, EINA_TRUE); - evas_object_show(scroller); - - /* Create Box */ - box = elm_box_add(scroller); - evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_box_horizontal_set(box, EINA_TRUE); - elm_object_content_set(scroller, box); - evas_object_show(box); - - - int totalPageCnt = 0; - totalPageCnt = (BG_COLOR_COUNT + 1) / NUM_MAX_THUMB_IN_PAGES; - for (index = 0; index < totalPageCnt; index++) { - page_layout = elm_layout_add(box); - evas_object_size_hint_weight_set(page_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(page_layout, EVAS_HINT_FILL, EVAS_HINT_FILL); - - elm_layout_file_set(page_layout, EDJE_PATH, "thumbnail_page"); - evas_object_show(page_layout); - - int thumbIdx = 0; - for (thumbIdx = index * NUM_MAX_THUMB_IN_PAGES; thumbIdx < ((index * NUM_MAX_THUMB_IN_PAGES) + NUM_MAX_THUMB_IN_PAGES); thumbIdx++) { - Evas_Object *thumbnail_layout = elm_layout_add(page_layout); - evas_object_size_hint_weight_set(thumbnail_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(thumbnail_layout, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_layout_file_set(thumbnail_layout, EDJE_PATH, "thumbnail"); - evas_object_show(thumbnail_layout); - - /* page content */ - page = evas_object_rectangle_add(evas_object_evas_get(page_layout)); - evas_object_color_set(page, color[thumbIdx].r, color[thumbIdx].g, color[thumbIdx].b, 255); - evas_object_size_hint_weight_set(page, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(page, EVAS_HINT_FILL, EVAS_HINT_FILL); - - elm_object_part_content_set(thumbnail_layout, "thumb", page); - evas_object_show(page); - - switch (thumbIdx % NUM_MAX_THUMB_IN_PAGES) { - case 0: - elm_object_part_content_set(page_layout, "thumb1", thumbnail_layout); - break; - case 1: - elm_object_part_content_set(page_layout, "thumb2", thumbnail_layout); - break; - } - - /* touch event */ - evas_object_event_callback_add(page, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down_cb, NULL); - evas_object_event_callback_add(page, EVAS_CALLBACK_MOUSE_UP, _mouse_up_cb, (void *)(uintptr_t)(thumbIdx)); - evas_object_event_callback_add(page, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move_cb, NULL); - } - elm_box_pack_end(box, page_layout); - } - - evas_object_event_callback_add(scroller, EVAS_CALLBACK_RESIZE, _page_show, NULL); - - /*ecore_animator_add(animator_cb, pd); */ - - return layout; -} - -#if 0 /* _NOT_USED_ */ -static void -_wallpaper_layout_del_cb(void *data , Evas *e, Evas_Object *obj, void *event_info) -{ - wallpaper_page_data *pd = data; - free(pd); -} - -static Eina_Bool -wallpaper_animator_cb(void *data) -{ - wallpaper_page_data *pd = (wallpaper_page_data *)data; - - /*Since mapbuf is not perfect, Enable them after the size calculation is finished */ - int idx; - for (idx = 0; idx < DEFAULT_WALLPAPER_COUNT / WALLPAPER_CNT_PER_PAGE; idx++) { - elm_mapbuf_enabled_set(pd->mapbuf[idx], EINA_TRUE); - } - return ECORE_CALLBACK_CANCEL; -} -#endif - -static void _wallpaper_page_show(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - DBG("_wallpaper_page_show"); -#if 0 - char *ret_wallpaper = NULL; - int idx = 0; - int page_idx = 0; - if (system_settings_get_value_string(SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, &ret_wallpaper) != SYSTEM_SETTINGS_ERROR_NONE) { - page_idx = idx; - } else { - for (idx; idx < DEFAULT_WALLPAPER_COUNT; idx++) { - if (ret_wallpaper && !strcmp(ret_wallpaper, thumb_path[idx])) { - DBG("wallpaper[%s] idx [%d]", ret_wallpaper, idx); - page_idx = idx / WALLPAPER_CNT_PER_PAGE; - break; - } - } - } -#endif - /*set just first page to show */ - int page_idx = 0; - elm_scroller_page_show(obj, page_idx, 0); -} - -static void _update_wallpaper() -{ - Evas_Object *page_layout, *thumbnail, *color_page, *gallery_page, *touch_eo; - Evas_Object *box = g_wallpaper_box; - - if (box && !wallpaper_touched) { - elm_box_clear(box); - int totalPageCnt = 0; - totalPageCnt = (DEFAULT_WALLPAPER_COUNT + NUM_DEFAULT_THUMB_BUTTON + gallery_img_cnt + 1) / NUM_MAX_THUMB_IN_PAGES; - int index; - for (index = 0; index < totalPageCnt; index++) { - page_layout = elm_layout_add(box); - evas_object_size_hint_weight_set(page_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(page_layout, EVAS_HINT_FILL, EVAS_HINT_FILL); - - elm_layout_file_set(page_layout, EDJE_PATH, "thumbnail_page"); - evas_object_show(page_layout); - - int thumbIdx = 0; - for (thumbIdx = index * NUM_MAX_THUMB_IN_PAGES; thumbIdx < ((index * NUM_MAX_THUMB_IN_PAGES) + NUM_MAX_THUMB_IN_PAGES); thumbIdx++) { - DBG("total : %d, thumbIdx : %d", DEFAULT_WALLPAPER_COUNT + NUM_DEFAULT_THUMB_BUTTON + gallery_img_cnt + 1, thumbIdx); - if (DEFAULT_WALLPAPER_COUNT + NUM_DEFAULT_THUMB_BUTTON + gallery_img_cnt == thumbIdx) { - DBG("check break"); - break; - } - Evas_Object *thumbnail_layout = elm_layout_add(page_layout); - evas_object_size_hint_weight_set(thumbnail_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(thumbnail_layout, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_layout_file_set(thumbnail_layout, EDJE_PATH, "thumbnail"); - evas_object_show(thumbnail_layout); - /*elm_object_signal_emit(thumbnail_layout, "thumb_bg,white", "thumb_bg"); */ - - /* color palette - set color box */ - if (thumbIdx == 0) { - char *bg_color = NULL; - int R = 0x00, G = 0x00, B = 0x00; - bg_color = vconf_get_str("db/wms/home_bg_palette"); - colorstr_to_decimal(bg_color, &R, &G, &B); - DBG("R : [%d] G : [%d] B : [%d]", R, G, B); - color_page = evas_object_rectangle_add(evas_object_evas_get(page_layout)); - evas_object_color_set(color_page, R, G, B, 255); - evas_object_size_hint_weight_set(color_page, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(color_page, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_object_part_content_set(thumbnail_layout, "thumb", color_page); - evas_object_show(color_page); - g_color_page = color_page; - FREE(bg_color); - } - - if (thumbIdx == 1) { - _get_last_img_path(); - gallery_page = elm_image_add(page_layout); - elm_image_file_set(gallery_page, last_img_path, NULL); - elm_object_part_content_set(thumbnail_layout, "thumb", gallery_page); - evas_object_show(gallery_page); - } - - /* page content */ - char buf[256]; - thumbnail = elm_image_add(page_layout);/*thumb_path */ - - int idx_arr; - /*default 1,2page thumbnail button : pallette btn, gallery btn */ - if (gallery_img_cnt || thumbIdx == 0 || thumbIdx == 1) { - idx_arr = thumbIdx; - } else { - idx_arr = thumbIdx + 1; - } - - snprintf(buf, sizeof(buf), "%s", thumb_path[idx_arr]); - - if (ecore_file_exists(buf)) { - elm_image_file_set(thumbnail, buf, NULL); - } else { - elm_image_file_set(thumbnail, NULL, NULL); - } - elm_image_aspect_fixed_set(thumbnail, EINA_FALSE); - elm_image_resizable_set(thumbnail, EINA_TRUE, EINA_TRUE); - - if (thumbIdx == 0 || thumbIdx == 1) - elm_object_part_content_set(thumbnail_layout, "thumb_btn", thumbnail); - else - elm_object_part_content_set(thumbnail_layout, "thumb", thumbnail); - - if (thumbIdx == 2 && gallery_img_cnt) { - g_gallery_prv = thumbnail; - } - evas_object_show(thumbnail); - - /* select page */ - int bg_mode; - vconf_get_int("db/wms/home_bg_mode", &bg_mode); - - if (bg_mode) { - Evas_Object *selected_rect = elm_image_add(page_layout); - elm_image_file_set(selected_rect, SETTING_DEFAULT_WALLPAPER_PATH"/btn_icons/settings_wallpaper_selected.png", NULL); - elm_image_aspect_fixed_set(selected_rect, EINA_FALSE); - elm_image_resizable_set(selected_rect, EINA_TRUE, EINA_TRUE); - elm_object_part_content_set(thumbnail_layout, "thumb_select", selected_rect); - evas_object_show(selected_rect); - } - - switch (thumbIdx % NUM_MAX_THUMB_IN_PAGES) { - case 0: - elm_object_part_content_set(page_layout, "thumb1", thumbnail_layout); - break; - case 1: - elm_object_part_content_set(page_layout, "thumb2", thumbnail_layout); - break; - } - - /* touch event */ - if (thumbIdx == 0) { - touch_eo = color_page; - elm_object_signal_emit(thumbnail_layout, "thumbnail,opacity", "thumb_op"); - } else if (thumbIdx == 1) { - touch_eo = gallery_page; - elm_object_signal_emit(thumbnail_layout, "thumbnail,opacity", "thumb_op"); - } else { - touch_eo = thumbnail; - elm_object_signal_emit(thumbnail_layout, "thumbnail,default", "thumb_op"); - } - - evas_object_event_callback_add(touch_eo, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down_cb, NULL); - evas_object_event_callback_add(touch_eo, EVAS_CALLBACK_MOUSE_UP, _mouse_up_wallpaper_cb, (void *)(uintptr_t)idx_arr); - evas_object_event_callback_add(touch_eo, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move_cb, NULL); - } - elm_box_pack_end(box, page_layout); - } - /*_wallpaper_page_show(NULL, NULL, g_wallpaper_scroller, NULL); */ - } -} - - -#if 0 /* _NOT_USED_ */ -static void _wallpaper_page_refresh(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - DBG("is_prev_update , %d", is_prev_update); -} -#endif - -bool _is_file_exist(const char *filepath) -{ - if (ecore_file_exists(filepath) == EINA_TRUE) { - DBG("exist"); - return true; - } - DBG("not exist %s", filepath); - return false; -} - -static void _wallpaper_vconf_color_changed_cb(keynode_t *node, void *data) -{ - char *bg_color = NULL; - int R = 0x00, G = 0x00, B = 0x00; - bg_color = vconf_get_str("db/wms/home_bg_palette"); - colorstr_to_decimal(bg_color, &R, &G, &B); - evas_object_color_set(g_color_page, R, G, B, 255); - evas_object_show(g_color_page); - FREE(bg_color); -} - -static void _wallpaper_vconf_wallpaper_changed_cb(keynode_t *node, void *data) -{ - DBG("_wallpaper_vconf_wallpaper_changed_cb"); - int bg_mode; - vconf_get_int("db/wms/home_bg_mode", &bg_mode); - if (bg_mode == 2 && !gallery_img_cnt) { - DBG("gallery_img_cnt : %d", gallery_img_cnt); - is_prev_update = 1; - if (g_wallpaper_layout) { - evas_object_del(g_wallpaper_layout); - g_wallpaper_layout = NULL; - } - } - if (bg_mode == 2 && gallery_img_cnt) { - /*gallery type */ - /*char *bg_gallery = NULL; */ - /*bg_gallery = vconf_get_str(VCONFKEY_BGSET); */ - /*DBG(" bg mode 2 , gallery true , [%s]", bg_gallery); */ - /*elm_image_file_set(g_gallery_prv, bg_gallery, NULL); */ - /*evas_object_show(g_gallery_prv); */ - _update_wallpaper(); - } - - if (bg_mode == 0 || bg_mode == 1) { - _update_wallpaper(); - } - wallpaper_touched = false; -} - -static Evas_Object *_create_wallpaper_thumbnail(Evas_Object *parent) -{ - Evas_Object *layout, *scroller, *box, *page_layout, *thumbnail, *color_page, *gallery_page; - int index; - - Evas_Object *touch_eo = NULL; - - if (parent == NULL) - return NULL; - - if (_is_file_exist(CROPPED_GALLERY_DEFAULT_WALLPAPER_PATH) == true) { - /*cropped gallery image exist or not */ - gallery_img_cnt = 1; /*fixed on 1page */ - } - - - /* Create Layout */ - layout = elm_layout_add(parent); - if (layout == NULL) - return NULL; - - elm_layout_file_set(layout, EDJE_PATH, "setting-test/index"); - evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_show(layout); - g_wallpaper_layout = layout; - - /* Create Scroller */ - scroller = elm_scroller_add(layout); - elm_scroller_loop_set(scroller, EINA_FALSE, EINA_FALSE); - evas_object_size_hint_weight_set(scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(scroller, EVAS_HINT_FILL, EVAS_HINT_FILL); - /*elm_scroller_page_relative_set(scroller, 1.0, 0.0); */ - elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF); - elm_scroller_page_scroll_limit_set(scroller, 1, 0); - elm_object_scroll_lock_y_set(scroller, EINA_TRUE); - elm_scroller_page_size_set(scroller, WIN_SIZE, WIN_SIZE); - elm_object_part_content_set(layout, "scroller", scroller); - elm_object_style_set(scroller, "effect"); - elm_scroller_bounce_set(scroller, EINA_TRUE, EINA_TRUE); - evas_object_show(scroller); - g_wallpaper_scroller = scroller; - - /* Create Box */ - box = elm_box_add(scroller); - evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_box_horizontal_set(box, EINA_TRUE); - elm_object_content_set(scroller, box); - evas_object_show(box); - g_wallpaper_box = box; - - int totalPageCnt = 0; - totalPageCnt = (DEFAULT_WALLPAPER_COUNT + NUM_DEFAULT_THUMB_BUTTON + gallery_img_cnt + 1) / NUM_MAX_THUMB_IN_PAGES; - for (index = 0; index < totalPageCnt; index++) { - page_layout = elm_layout_add(box); - evas_object_size_hint_weight_set(page_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(page_layout, EVAS_HINT_FILL, EVAS_HINT_FILL); - - elm_layout_file_set(page_layout, EDJE_PATH, "thumbnail_page"); - evas_object_show(page_layout); - - int thumbIdx = 0; - for (thumbIdx = index * NUM_MAX_THUMB_IN_PAGES; thumbIdx < ((index * NUM_MAX_THUMB_IN_PAGES) + NUM_MAX_THUMB_IN_PAGES); thumbIdx++) { - DBG("total : %d, thumbIdx : %d", DEFAULT_WALLPAPER_COUNT + NUM_DEFAULT_THUMB_BUTTON + gallery_img_cnt + 1, thumbIdx); - if (DEFAULT_WALLPAPER_COUNT + NUM_DEFAULT_THUMB_BUTTON + gallery_img_cnt == thumbIdx) { - DBG("check break"); - break; - } - Evas_Object *thumbnail_layout = elm_layout_add(page_layout); - evas_object_size_hint_weight_set(thumbnail_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(thumbnail_layout, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_layout_file_set(thumbnail_layout, EDJE_PATH, "thumbnail"); - evas_object_show(thumbnail_layout); - /*elm_object_signal_emit(thumbnail_layout, "thumb_bg,white", "thumb_bg"); */ - - /* color palette - set color box */ - if (thumbIdx == 0) { - char *bg_color = NULL; - int R = 0x00, G = 0x00, B = 0x00; - bg_color = vconf_get_str("db/wms/home_bg_palette"); - colorstr_to_decimal(bg_color, &R, &G, &B); - DBG("R : [%d] G : [%d] B : [%d]", R, G, B); - color_page = evas_object_rectangle_add(evas_object_evas_get(page_layout)); - evas_object_color_set(color_page, R, G, B, 255); - evas_object_size_hint_weight_set(color_page, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(color_page, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_object_part_content_set(thumbnail_layout, "thumb", color_page); - evas_object_show(color_page); - g_color_page = color_page; - FREE(bg_color); - } - - if (thumbIdx == 1) { - _get_last_img_path(); - gallery_page = elm_image_add(page_layout); - elm_image_file_set(gallery_page, last_img_path, NULL); - elm_object_part_content_set(thumbnail_layout, "thumb", gallery_page); - evas_object_show(gallery_page); - } - - /* page content */ - char buf[256]; - thumbnail = elm_image_add(page_layout);/*thumb_path */ - - int idx_arr; - /*default 1,2page thumbnail button : pallette btn, gallery btn */ - if (gallery_img_cnt || thumbIdx == 0 || thumbIdx == 1) { - idx_arr = thumbIdx; - } else { - idx_arr = thumbIdx + 1; - } - - snprintf(buf, sizeof(buf), "%s", thumb_path[idx_arr]); - - if (ecore_file_exists(buf)) { - elm_image_file_set(thumbnail, buf, NULL); - } else { - elm_image_file_set(thumbnail, NULL, NULL); - } - elm_image_aspect_fixed_set(thumbnail, EINA_FALSE); - elm_image_resizable_set(thumbnail, EINA_TRUE, EINA_TRUE); - - if (thumbIdx == 0 || thumbIdx == 1) - elm_object_part_content_set(thumbnail_layout, "thumb_btn", thumbnail); - else - elm_object_part_content_set(thumbnail_layout, "thumb", thumbnail); - - if (thumbIdx == 2 && gallery_img_cnt) { - g_gallery_prv = thumbnail; - } - evas_object_show(thumbnail); - - /* select page */ - int bg_mode; - vconf_get_int("db/wms/home_bg_mode", &bg_mode); - - if (bg_mode) { - Evas_Object *selected_rect = elm_image_add(page_layout); - elm_image_file_set(selected_rect, SETTING_DEFAULT_WALLPAPER_PATH"/btn_icons/settings_wallpaper_selected.png", NULL); - elm_image_aspect_fixed_set(selected_rect, EINA_FALSE); - elm_image_resizable_set(selected_rect, EINA_TRUE, EINA_TRUE); - elm_object_part_content_set(thumbnail_layout, "thumb_select", selected_rect); - evas_object_show(selected_rect); - } - - switch (thumbIdx % NUM_MAX_THUMB_IN_PAGES) { - case 0: - elm_object_part_content_set(page_layout, "thumb1", thumbnail_layout); - break; - case 1: - elm_object_part_content_set(page_layout, "thumb2", thumbnail_layout); - break; - } - - /* touch event */ - if (thumbIdx == 0) { - touch_eo = color_page; - elm_object_signal_emit(thumbnail_layout, "thumbnail,opacity", "thumb_op"); - } else if (thumbIdx == 1) { - touch_eo = gallery_page; - elm_object_signal_emit(thumbnail_layout, "thumbnail,opacity", "thumb_op"); - } else { - touch_eo = thumbnail; - elm_object_signal_emit(thumbnail_layout, "thumbnail,default", "thumb_op"); - } - - evas_object_event_callback_add(touch_eo, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down_cb, NULL); - evas_object_event_callback_add(touch_eo, EVAS_CALLBACK_MOUSE_UP, _mouse_up_wallpaper_cb, (void *)(uintptr_t)idx_arr); - evas_object_event_callback_add(touch_eo, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move_cb, NULL); - } - elm_box_pack_end(box, page_layout); - } - - evas_object_event_callback_add(scroller, EVAS_CALLBACK_RESIZE, _wallpaper_page_show, NULL); - register_vconf_changing("db/wms/home_bg_palette", _wallpaper_vconf_color_changed_cb, NULL); - register_vconf_changing("db/wms/home_bg_mode", _wallpaper_vconf_wallpaper_changed_cb, NULL); - - return layout; -} - -static Eina_Bool _wallpaper_pop_cb(void *data, Elm_Object_Item *it) -{ - DBG("_wallpaper_pop_cb"); - unregister_vconf_changing("db/wms/home_bg_palette", _wallpaper_vconf_color_changed_cb); - unregister_vconf_changing("db/wms/home_bg_mode", _wallpaper_vconf_wallpaper_changed_cb); - return EINA_TRUE; -} - -void _wallpaper_gl_cb(void *data, Evas_Object *obj, void *event_info) -{ - elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE); - - appdata *ad; - Evas_Object *layout_inner; - Elm_Object_Item *it; - - ad = (appdata *)data; - if (ad == NULL) - return; - - g_app_context = ad; - - layout_inner = _create_wallpaper_thumbnail(ad->nf); - it = elm_naviframe_item_push(ad->nf, NULL, NULL, NULL, layout_inner, NULL); - elm_naviframe_item_pop_cb_set(it, _wallpaper_pop_cb, ad); - elm_naviframe_item_title_enabled_set(it, EINA_FALSE, EINA_FALSE); -} - -Evas_Object *create_wallpaper_list(void *data) -{ - appdata *ad; - Evas_Object *layout_inner; - - ad = (appdata *)data; - if (ad == NULL) - return NULL; - - g_app_context = ad; - - int ret; - ret = feedback_initialize(); - if (ret != FEEDBACK_ERROR_NONE) { - DBG("feedback_initialize failed"); - } - - layout_inner = _create_wallpaper_thumbnail(ad->nf); - return layout_inner; -} - -void _gallery_result_cb(app_control_h service, app_control_h reply, app_control_result_e result, void *data) -{ - DBG("_gallery_result_cb"); - if (running_gallery) { - running_gallery = false; - elm_object_scroll_freeze_pop(data); - } -} - -static Eina_Bool _timer_cb(void *data) -{ - DBG("reset gallery running flag"); - if (running_gallery) { - running_gallery = false; - running_gallery_timer = NULL; - elm_object_scroll_freeze_pop(data); - } - return ECORE_CALLBACK_CANCEL; -} - -void _gallery_gl_cb(void *data, Evas_Object *obj, void *event_info) -{ - /*elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE); */ - DBG("_gallery_gl_cb"); - - appdata *ad; - - ad = (appdata *)data; - if (ad == NULL) - return; - - /*app_manager_is_running("org.tizen.w-gallery.appcontrol.setting_wallpaper", &running); */ - if (!running_gallery) { - app_control_h service; - app_control_create(&service); - app_control_set_app_id(service, "org.tizen.w-gallery.appcontrol.setting_wallpaper"); - app_control_send_launch_request(service, _gallery_result_cb, obj); - app_control_destroy(service); - - if (running_gallery_timer) { - ecore_timer_del(running_gallery_timer); - running_gallery_timer = NULL; - } - running_gallery_timer = ecore_timer_add(1.0, (Ecore_Task_Cb)_timer_cb, obj); - } -} - -void _show_bg_slide_cb(void *data, Evas_Object *obj, void *event_info) -{ - /*elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE); */ - - appdata *ad; - Evas_Object *layout_inner; - Elm_Object_Item *it; - - ad = (appdata *)data; - if (ad == NULL) - return; - - g_app_context = ad; - - layout_inner = _create_index(ad->nf); - it = elm_naviframe_item_push(ad->nf, NULL, NULL, NULL, layout_inner, NULL); - elm_naviframe_item_title_enabled_set(it, EINA_FALSE, EINA_FALSE); -} - -/* edit home screen */ -static void _show_edit_home(void *data) -{ - appdata *ad = data; - if (ad == NULL) { - DBG("%s", "_show_edit_home - appdata is null"); - return; - } - - app_control_h service; - app_control_create(&service); - app_control_set_app_id(service, "org.tizen.w-launcher-app"); - app_control_add_extra_data(service, "home_op", "edit"); - app_control_send_launch_request(service, NULL, NULL); - app_control_destroy(service); -} - -/* edit home screen */ -static void _show_edit_apps(void *data) -{ - appdata *ad = data; - if (ad == NULL) { - DBG("%s", "_show_edit_home - appdata is null"); - return; - } - - app_control_h service; - app_control_create(&service); - app_control_set_app_id(service, "org.tizen.w-launcher-app"); - app_control_add_extra_data(service, "home_op", "apps_edit"); - app_control_send_launch_request(service, NULL, NULL); - app_control_destroy(service); -} - diff --git a/src/setting-motion.c b/src/setting-motion.c deleted file mode 100644 index 1193060..0000000 --- a/src/setting-motion.c +++ /dev/null @@ -1,403 +0,0 @@ -/* - * 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. - */ -/* - * setting-motion.c - * - * Created on: Oct 9, 2013 - * Author: min-hoyun - */ - -/*#include <capability_manager.h> */ -#include "setting-motion.h" - -static appdata *g_app_context = NULL; - -static struct _motion_menu_item motion_menu_its[] = { - { "IDS_WMGR_MBODY_SMART_RELAY", 0, _motion_gl_smart_relay_cb }, - { "IDS_WMGR_MBODY_WAKE_UP_GESTURE", 0, _motion_gl_wake_up_cb }, - { NULL, 0, NULL } -}; - -static char *wake_up_gesture_str[] = { - "IDS_ST_BODY_OFF_M_STATUS", - "IDS_ST_BUTTON_CLOCK", - "IDS_WMGR_OPT_LAST_VIEWED_SCREEN" -}; - -static struct _motion_data motion_data; -static int is_called_myself; - - -static void init_motion_value() -{ - motion_data.is_enable_smart_relay = 0; - motion_data.is_enable_wake_up_gesture = 0; - motion_data.wake_up_gesture_type = SETTING_WAKE_UP_GESTURE_LAST_VIEWED_SCREEN; - - g_app_context = NULL; - motion_data.g_motion_genlist = NULL; - is_called_myself = 0; -} - -void _initialize_motion() -{ - init_motion_value(); - - /* motion vconf changed callback */ - register_vconf_changing(VCONFKEY_WMS_WAKEUP_BY_GESTURE_SETTING, motion_vconf_changed_cb, NULL); - register_vconf_changing(VCONFKEY_WMS_SMART_RELAY, motion_vconf_changed_cb, NULL); -} - -void motion_vconf_changed_cb(keynode_t *key, void *data) -{ - DBG("Setting - motion_vconf_changed_cb() is called!"); - - char *vconf_name = vconf_keynode_get_name(key); - if (!vconf_name || is_called_myself) { - is_called_myself = 0; - return; - } - - if (!strcmp(vconf_name, VCONFKEY_WMS_WAKEUP_BY_GESTURE_SETTING)) { - vconf_get_int(VCONFKEY_WMS_WAKEUP_BY_GESTURE_SETTING, &motion_data.wake_up_gesture_type); - - DBG("Setting - wake_up_gesture_type : %d", motion_data.wake_up_gesture_type); - } else if (!strcmp(vconf_name, VCONFKEY_WMS_SMART_RELAY)) { - vconf_get_bool(VCONFKEY_WMS_SMART_RELAY, &motion_data.is_enable_smart_relay); - - DBG("Setting - is_enable_smart_relay : %d", motion_data.is_enable_smart_relay); - } - - if (motion_data.g_motion_genlist) { - /*elm_genlist_realized_items_update(motion_data.g_motion_genlist); */ - elm_radio_value_set(g_app_context->wake_up_guesture_rdg, motion_data.wake_up_gesture_type); - } -} - -Eina_Bool _clear_motion_cb(void *data, Elm_Object_Item *it) -{ - init_motion_value(); - - /* unregister motion vconf changed callback */ - unregister_vconf_changing(VCONFKEY_WMS_WAKEUP_BY_GESTURE_SETTING, motion_vconf_changed_cb); - unregister_vconf_changing(VCONFKEY_WMS_SMART_RELAY, motion_vconf_changed_cb); - - return EINA_TRUE; -} - -void _motion_gl_smart_relay_cb(void *data, Evas_Object *obj, void *event_info) -{ - Elm_Object_Item *it = (Elm_Object_Item *)event_info; - appdata *ad = data; - - if (ad == NULL) { - DBG("%s", "_motion_gl_smart_relay_cb - ad or check is null"); - return; - } - - is_called_myself = 1; - - motion_data.is_enable_smart_relay = (motion_data.is_enable_smart_relay) ? 0 : 1; - - vconf_set_bool(VCONFKEY_WMS_SMART_RELAY, motion_data.is_enable_smart_relay); - - elm_genlist_item_selected_set(it, EINA_FALSE); - elm_genlist_item_update(it); -} - -void _motion_gl_wake_up_guesture_radio_cb(void *data, Evas_Object *obj, void *event_info) -{ - Elm_Object_Item *it = (Elm_Object_Item *)event_info; - elm_genlist_item_selected_set(it, EINA_FALSE); - - int wake_up_mode = (int)data; - - is_called_myself = 1; - - vconf_set_int(VCONFKEY_WMS_WAKEUP_BY_GESTURE_SETTING, wake_up_mode); - - elm_genlist_item_update(it); - - elm_naviframe_item_pop(g_app_context->nf); - if (g_app_context && g_app_context->wake_up_guesture_rdg) { - evas_object_del(g_app_context->wake_up_guesture_rdg); - g_app_context->wake_up_guesture_rdg = NULL; - } - - if (motion_data.g_motion_genlist) { - elm_genlist_realized_items_update(motion_data.g_motion_genlist); - } -} - -char *_get_wake_up_gesture_sub_title() -{ - int gusture_mode = 0; - vconf_get_int(VCONFKEY_WMS_WAKEUP_BY_GESTURE_SETTING, &gusture_mode); - - DBG("VCONFKEY_WMS_WAKEUP_BY_GESTURE_SETTING : %d", gusture_mode); - - return _(wake_up_gesture_str[gusture_mode % 3]); -} - -char *_gl_wake_up_guesture_mode_title_get(void *data, Evas_Object *obj, const char *part) -{ - char buf[__SETTING_BUF_SIZE__] = {0,}; - Motion_Item_Data *id = data; - int index = id->index; - - if (!strcmp(part, "elm.text") || !strcmp(part, "elm.text.1")) { - snprintf(buf, sizeof(buf) - 1, "%s", _(wake_up_gesture_str[index % 3])); - } - return strdup(buf); -} - -Evas_Object *_gl_wake_up_guesture_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 wake_up_mode = 0; - - if (!strcmp(part, "elm.icon")) { - DBG("radio get"); - 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_propagate_events_set(radio, EINA_FALSE); - evas_object_repeat_events_set(radio, EINA_TRUE); - evas_object_smart_callback_add(radio, "changed", NULL, (void *)id->index); - - vconf_get_int(VCONFKEY_WMS_WAKEUP_BY_GESTURE_SETTING, &wake_up_mode); - if (wake_up_mode == id->index) { - elm_radio_value_set(radio_main, wake_up_mode); - } - } - return radio; -} - -static void _wake_up_guesture_gl_del(void *data, Evas_Object *obj) -{ - /* FIXME: Unrealized callback can be called after this. */ - /* Accessing Item_Data can be dangerous on unrealized callback. */ - struct _motion_wake_up_guesture_item *id = data; - FREE(id); -} - -void _show_wake_up_guesture_list(void *data) -{ - appdata *ad = data; - if (ad == NULL) { - DBG("%s", "_show_wake_up_guesture_list - appdata is null"); - return; - } - - Evas_Object *genlist = 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_wake_up_guesture_mode_title_get; - itc->func.content_get = _gl_wake_up_guesture_ridio_get; - itc->func.del = _wake_up_guesture_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_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); - - int idx; - for (idx = 0; idx < MOTION_WAKE_UP_ITEM_COUNT; idx++) { - Item_Data *id = calloc(sizeof(Item_Data), 1); - if (id) { - id->index = idx; - id->item = elm_genlist_item_append(genlist, itc, id, NULL, ELM_GENLIST_ITEM_NONE, - _motion_gl_wake_up_guesture_radio_cb, - (void *)idx); - } - } - motion_data.g_motion_genlist = genlist; - ad->wake_up_guesture_rdg = elm_radio_add(genlist); - elm_radio_state_value_set(ad->wake_up_guesture_rdg, MOTION_WAKE_UP_ITEM_COUNT); - elm_radio_value_set(ad->wake_up_guesture_rdg, 0); - - evas_object_data_set(genlist, "radio_main", ad->wake_up_guesture_rdg); - - elm_genlist_item_class_free(itc); - - g_app_context = ad; - - elm_object_part_content_set(layout, "elm.genlist", genlist); - - nf_it = elm_naviframe_item_push(ad->nf, NULL, NULL, NULL, layout, NULL); - elm_naviframe_item_pop_cb_set(nf_it, _clear_motion_cb, ad); - elm_naviframe_item_title_enabled_set(nf_it, EINA_FALSE, EINA_FALSE); -} - -void _motion_gl_wake_up_cb(void *data, Evas_Object *obj, void *event_info) -{ - Elm_Object_Item *it = (Elm_Object_Item *)event_info; - elm_genlist_item_selected_set(it, EINA_FALSE); - - _initialize_motion(); - - appdata *ad = data; - - if (ad == NULL) { - DBG("%s", "_motion_gl_smart_relay_cb - ad or check is null"); - return; - } - - _show_wake_up_guesture_list(ad); -} - -void _motion_chk_changed_cb(void *data, Evas_Object *obj, void *event_info) -{ - Evas_Object *check = obj; - - if (check == NULL) - return; - - /* check state callback */ - DBG("%s : %d", "_motion_chk_changed_cb - current state", elm_check_state_get(check)); -} - -char *_gl_motion_title_get(void *data, Evas_Object *obj, const char *part) -{ - char buf[__SETTING_BUF_SIZE__] = {0,}; - Motion_Item_Data *id = data; - int index = id->index; - - if (!strcmp(part, "elm.text.1")) { - bool is_operator_dcm = 0; - char *salescode = vconf_get_str(VCONFKEY_CSC_SALESCODE); - if (salescode && (!strcmp(salescode, "DCM") || !strcmp(salescode, "KDI") || !strcmp(salescode, "XJP"))) - is_operator_dcm = 1; - FREE(salescode); - - if (is_operator_dcm && !strcmp(motion_menu_its[index % 3].name, "IDS_WMGR_MBODY_SMART_RELAY")) { - strncpy(buf, _("IDS_WMGR_MBODY_SMART_TOSS_JPN"), sizeof(buf) - 1); - } else { - snprintf(buf, sizeof(buf) - 1, "%s", _(motion_menu_its[index % 3].name)); - } - } else if (!strcmp(part, "elm.text.2")) { - if (index == 0) { - vconf_get_bool(VCONFKEY_WMS_SMART_RELAY, &motion_data.is_enable_smart_relay); - snprintf(buf, sizeof(buf) - 1, "%s", (motion_data.is_enable_smart_relay) ? _("IDS_ST_BODY_ON_M_STATUS") : _("IDS_ST_BODY_OFF_M_STATUS")); - } else { - snprintf(buf, sizeof(buf) - 1, "%s", _get_wake_up_gesture_sub_title()); - } - index++; - } - return strdup(buf); -} - -Evas_Object *_gl_motion_check_get(void *data, Evas_Object *obj, const char *part) -{ - Evas_Object *check = NULL; - Motion_Item_Data *id = data; - int index = id->index; - - if (!strcmp(part, "elm.icon")) { - check = elm_check_add(obj); - vconf_get_bool(VCONFKEY_WMS_SMART_RELAY, &motion_data.is_enable_smart_relay); - elm_check_state_set(check, (motion_data.is_enable_smart_relay) ? EINA_TRUE : EINA_FALSE); - evas_object_smart_callback_add(check, "changed", _motion_chk_changed_cb, (void *)1); - 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); - - index++; - } - - return check; -} - -static void _motion_gl_del(void *data, Evas_Object *obj) -{ - /* FIXME: Unrealized callback can be called after this. */ - /* Accessing Item_Data can be dangerous on unrealized callback. */ - Motion_Item_Data *id = data; - FREE(id); -} - -Evas_Object *_create_motion_list(void *data) -{ - appdata *ad = data; - if (ad == NULL) { - DBG("%s", "_create_motion_list - appdata is null"); - return NULL; - } - Evas_Object *genlist = NULL; - Elm_Genlist_Item_Class *temp_itc = NULL; - struct _motion_menu_item *menu_its = NULL; - int idx; - - Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new(); - itc->item_style = "2text.1icon.1"; - itc->func.text_get = _gl_motion_title_get; - itc->func.content_get = _gl_motion_check_get; - itc->func.del = _motion_gl_del; - - Elm_Genlist_Item_Class *itc_wake_up = elm_genlist_item_class_new(); - itc_wake_up->item_style = "2text"; - itc_wake_up->func.text_get = _gl_motion_title_get; - itc_wake_up->func.del = _motion_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); - - connect_to_wheel_with_genlist(genlist, ad); - menu_its = motion_menu_its; - - char *val = NULL; - - for (idx = 0; idx < MOTION_ITEM_COUNT; idx++) { - if (idx == 0) { - temp_itc = itc; - } else { - temp_itc = itc_wake_up; - } - - Motion_Item_Data *id = calloc(sizeof(Motion_Item_Data), 1); - if (id) { - id->index = idx; - id->item = elm_genlist_item_append( - genlist, /* genlist object */ - temp_itc, /* item class */ - id, /* data */ - NULL, - ELM_GENLIST_ITEM_NONE, - menu_its[idx].func, /* call back */ - ad); - } - } - elm_genlist_item_class_free(itc); - elm_genlist_item_class_free(itc_wake_up); - - motion_data.g_motion_genlist = genlist; - - elm_object_part_content_set(layout, "elm.genlist", genlist); - - return layout; -} diff --git a/src/setting-notification.c b/src/setting-notification.c deleted file mode 100644 index e9bd15c..0000000 --- a/src/setting-notification.c +++ /dev/null @@ -1,189 +0,0 @@ -/* - * setting-notification.c - * - * Created on: Feb 14, 2014 - * Author: min-hoyun - */ - -#include "setting-notification.h" - - -static struct _noti_menu_item noti_menu_its[] = { - { "IDS_ST_BUTTON_NOTIFICATIONS", 1, _noti_gl_enabling_noti_cb }, - { NULL, 0, NULL } -}; - -static struct _noti_data g_noti_data; -static bool is_called_myself; - - -void _initialize_noti() -{ - is_called_myself = false; - - g_noti_data.g_noti_genlist = NULL; - g_noti_data.is_enable_noti = 0; - g_noti_data.app_context = NULL; - - register_vconf_changing(VCONF_WMS_NOTIFICATION_KEY, noti_enabling_vconf_changed_cb, NULL); -} - -void _noti_gl_enabling_noti_cb(void *data, Evas_Object *obj, void *event_info) -{ - DBG("Setting - _noti_gl_enabling_noti_cb() is called!"); - - Elm_Object_Item *it = (Elm_Object_Item *)event_info; - appdata *ad = data; - - if (ad == NULL) { - DBG("%s", "_noti_gl_enabling_noti_cb - ad or check is null"); - return; - } - - is_called_myself = true; - - g_noti_data.is_enable_noti = (g_noti_data.is_enable_noti) ? 0 : 1; - - vconf_set_int(VCONF_WMS_NOTIFICATION_KEY, g_noti_data.is_enable_noti); - - elm_genlist_item_selected_set(it, EINA_FALSE); - - if (g_noti_data.g_noti_genlist) { - elm_genlist_realized_items_update(g_noti_data.g_noti_genlist); - } -} - -Eina_Bool _clear_noti_cb(void *data, Elm_Object_Item *it) -{ - DBG("Setting - _clear_noti_cb() is called!"); - - is_called_myself = false; - - g_noti_data.g_noti_genlist = NULL; - g_noti_data.is_enable_noti = 0; - g_noti_data.app_context = NULL; - - unregister_vconf_changing(VCONF_WMS_NOTIFICATION_KEY, noti_enabling_vconf_changed_cb); - - return EINA_TRUE; -} - -char *_gl_noti_title_get(void *data, Evas_Object *obj, const char *part) -{ - char buf[__SETTING_BUF_SIZE__] = {0,}; - Noti_Item_Data *id = data; - int index = id->index; - - if (!strcmp(part, "elm.text")) { - snprintf(buf, sizeof(buf) - 1, "%s", _(noti_menu_its[index % 1].name)); - } else if (!strcmp(part, "elm.text.1")) { - vconf_get_int(VCONF_WMS_NOTIFICATION_KEY, &g_noti_data.is_enable_noti); - snprintf(buf, sizeof(buf) - 1, "%s", (g_noti_data.is_enable_noti) ? _("IDS_EMAIL_BODY_ENABLED_M_STATUS") - : _("IDS_ST_MBODY_DISABLED_ABB")); - } - return strdup(buf); -} - -Evas_Object *_gl_noti_check_get(void *data, Evas_Object *obj, const char *part) -{ - Evas_Object *check = NULL; - - if (!strcmp(part, "elm.icon")) { - check = elm_check_add(obj); - elm_object_style_set(check, "list"); - vconf_get_int(VCONF_WMS_NOTIFICATION_KEY, &g_noti_data.is_enable_noti); - elm_check_state_set(check, (g_noti_data.is_enable_noti) ? EINA_TRUE : EINA_FALSE); - evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_propagate_events_set(check, EINA_FALSE); - evas_object_repeat_events_set(check, EINA_TRUE); - } - - return check; -} - -static void _noti_gl_del(void *data, Evas_Object *obj) -{ - Noti_Item_Data *id = data; - FREE(id); -} - -Evas_Object *_create_noti_list(void *data) -{ - DBG("Setting - _create_noti_list() is called!"); - - appdata *ad = data; - if (ad == NULL) { - DBG("%s", "_create_noti_list - appdata is null"); - return NULL; - } - Evas_Object *genlist = NULL; - struct _noti_menu_item *menu_its = NULL; - int idx = 0; - - Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new(); - itc->item_style = "2text.1icon.1"; - itc->func.text_get = _gl_noti_title_get; - itc->func.content_get = _gl_noti_check_get; - itc->func.del = _noti_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_mode_set(genlist, ELM_LIST_COMPRESS); - - menu_its = noti_menu_its; - - connect_to_wheel_with_genlist(genlist, ad); -#if 0 - device_info_h *device_info = NULL; - bundle *b = NULL; - char *val = NULL; - capability_manager_create_device_info(&device_info); - capability_manager_get_device_features(device_info, &b); - val = bundle_get_val(b, "smartrelay"); - capability_manager_destroy_device_info(device_info); -#endif - - for (idx = 0; idx < NOTIFICATION_ITEM_COUNT; idx++) { - Noti_Item_Data *id = calloc(sizeof(Noti_Item_Data), 1); - if (id) { - id->index = idx; - id->item = elm_genlist_item_append( - genlist, /* genlist object */ - itc, /* item class */ - id, /* data */ - NULL, - ELM_GENLIST_ITEM_NONE, - menu_its[idx].func, /* call back */ - ad); - } - } - elm_genlist_item_class_free(itc); - - g_noti_data.g_noti_genlist = genlist; - - elm_object_part_content_set(layout, "elm.genlist", genlist); - - return layout; -} - -void noti_enabling_vconf_changed_cb(keynode_t *key, void *data) -{ - DBG("Setting - noti_enabling_vconf_changed_cb() is called!"); - - if (is_called_myself) { - DBG("Setting - is_called_myself!! Return!!"); - is_called_myself = false; - return; - } - - g_noti_data.is_enable_noti = vconf_keynode_get_int(key); - - DBG("Setting - Noti value: %d", g_noti_data.is_enable_noti); - - if (g_noti_data.g_noti_genlist) { - elm_genlist_realized_items_update(g_noti_data.g_noti_genlist); - } -} diff --git a/src/setting-reset.c b/src/setting-reset.c deleted file mode 100644 index 2bafd15..0000000 --- a/src/setting-reset.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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. - */ -/* - * setting-reset.c - * - * Created on: Oct 10, 2013 - * Author: min-hoyun - */ - -#include "setting.h" -#include "setting-reset.h" -#include "util.h" - - -static void _remove_reset_popup(appdata *ad) -{ - if (ad == NULL) - return; - if (ad->popup) { - evas_object_del(ad->popup); - ad->popup = NULL; - } -} - -static void _response_cancel_cb(void *data, Evas_Object *obj, void *event_info) -{ - appdata *ad = (appdata *)data; - - _remove_reset_popup(ad); -} - -static void _response_ok_cb(void *data, Evas_Object *obj, void *event_info) -{ - appdata *ad = data; - - _remove_reset_popup(ad); - - /* call Factory-reset -- deprecated!! deviced_call_predef_action */ - /* deviced_call_predef_action(PREDEF_FACTORY_RESET, 0, NULL); */ -} - -void _reset_lange_changed(void *data, Evas_Object *obj, void *event_info) -{ - DBG("Setting - _reset_lange_changed() is called!"); - - char buf[__SETTING_BUF_SIZE__] = {0,}; - snprintf(buf, sizeof(buf), "<font_size=34>%s</font_size>", - elm_entry_utf8_to_markup(_("IDS_ST_POP_ALL_DATA_WILL_BE_ERASED_FROM_GEAR_MEMORY_YOU_CAN_THEN_CONNECT_YOUR_GEAR_TO_ANOTHER_DEVICE"))); - elm_object_text_set(obj, strdup(buf)); -} - -void _reset_popup_cb(void *data, Evas_Object *obj, void *event_info) -{ - Evas_Object *popup = NULL; - Evas_Object *btn = NULL; - Evas_Object *scroller = NULL; - Evas_Object *label = NULL; - - appdata *ad = (appdata *) data; - if (ad == NULL) - return; - - popup = elm_popup_add(ad->nf); - evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_object_translatable_part_text_set(popup, "title,text", "IDS_ST_BODY_RESET_GEAR_ABB"); - - ad->popup = popup; - - scroller = elm_scroller_add(popup); - evas_object_size_hint_weight_set(scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_object_content_set(popup, scroller); - elm_scroller_bounce_set(scroller, EINA_TRUE, EINA_TRUE); - elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); - elm_object_style_set(scroller, "effect"); - evas_object_show(scroller); - - label = elm_label_add(scroller); - elm_object_style_set(label, "popup/default"); - elm_label_line_wrap_set(label, ELM_WRAP_MIXED); - - char buf[__SETTING_BUF_SIZE__]; - - char *font_size_frame = "<font_size=34>%s</font_size>"; - snprintf(buf, sizeof(buf) - 1, font_size_frame, _("IDS_ST_POP_ALL_DATA_WILL_BE_ERASED_FROM_GEAR_MEMORY_YOU_CAN_THEN_CONNECT_YOUR_GEAR_TO_ANOTHER_DEVICE")); - - char *txt = strdup(buf); - elm_object_text_set(label, txt); - FREE(txt); - evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_smart_callback_add(label, "language,changed", _reset_lange_changed, NULL); - elm_object_content_set(scroller, label); - evas_object_show(label); - - - /*ea_object_event_callback_add(popup, EA_CALLBACK_BACK, setting_popup_back_cb, ad); */ - - btn = elm_button_add(popup); - elm_object_style_set(btn, "default"); - evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_object_translatable_text_set(btn, "IDS_COM_SK_CANCEL_A"); - elm_object_part_content_set(popup, "button1", btn); - evas_object_smart_callback_add(btn, "clicked", _response_cancel_cb, ad); - - btn = elm_button_add(popup); - elm_object_style_set(btn, "default"); - evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_object_translatable_text_set(btn, "IDS_WNOTI_BUTTON_OK_ABB2"); - elm_object_part_content_set(popup, "button2", btn); - evas_object_smart_callback_add(btn, "clicked", _response_ok_cb, ad); - - evas_object_show(popup); -} diff --git a/src/setting-volume.c b/src/setting-volume.c deleted file mode 100644 index ad62861..0000000 --- a/src/setting-volume.c +++ /dev/null @@ -1,1476 +0,0 @@ -/* - * 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 <vconf.h> -#include <vconf-keys.h> - -#include "setting-volume.h" -#include "setting_control_haptic.h" -#include "setting-common-sound.h" -#include "util.h" -#include "setting_data_vconf.h" - -static int sound_manager_id = 0; -static void _gl_multimedia_cb(void *data, Evas_Object *obj, void *event_info); -static void _gl_ringtone_cb(void *data, Evas_Object *obj, void *event_info); -static void _gl_notification_cb(void *data, Evas_Object *obj, void *event_info); -static void _gl_system_cb(void *data, Evas_Object *obj, void *event_info); - -static struct _volume_menu_item volume_menu_its[] = { - { "IDS_ST_BUTTON_MULTIMEDIA", _gl_multimedia_cb }, - { "IDS_ST_HEADER_RINGTONES_ABB", _gl_ringtone_cb }, - { "IDS_ST_BUTTON_NOTIFICATIONS", _gl_notification_cb }, - { "IDS_ST_BODY_SYSTEM_M_VOLUME_ABB", _gl_system_cb }, - { NULL, NULL } -}; - -static void _set_volumn(sound_stream_type_e type, int volume_index, char *vconf_key); -/*static void _change_to_vibrate_mode(); */ -static void vibrate_vconf_changed_cb(keynode_t *key, void *data); -static void sound_vconf_changed_cb(keynode_t *key, void *data); -static void _play_sound_all_type(int sound_type, float volume); -static void _update_volume_circle(Evas_Object *spiner); - - -static appdata *g_ad; -static Evas_Object *g_volume_spinner = NULL; -static Evas_Object *g_volume_genlist = NULL; - -static int is_changing_level_by_vconf = 0; -static int is_changed = 0; -static int is_myself_changing = 0; -static int is_myself_ringtone_changing = 0; -static int is_play_ringtone_sound = 0; - -static int is_sound_changed = 0; -static int is_vibrate_changed = 0; -static int is_play_media_sound = 0; - -typedef void -(*system_part_volume_cb)(void *data, Evas_Object *obj, void *event_info); - -static void -multimedia_value_changed(void *data, Evas_Object *obj, void *event_info) -{ - DBG("Setting - multimedia_value_changed() is called!"); - char buf[PATH_MAX]; - Evas_Object *label = data; - - snprintf(buf, sizeof(buf), "%.0lf", eext_circle_object_value_get(obj)); - DBG(">>>>>>>>>>>>>>>>>>>>>>>>>>> Slider value = %s", buf); - elm_object_text_set(label, buf); - - if (curr_sound_type != SOUND_STREAM_TYPE_MEDIA) { - if (is_changing_level_by_vconf) { - DBG("Setting - is_changing_level_by_vconf!!!!"); - - is_changing_level_by_vconf = 0; - return; - } - } - - /*Evas_Coord w;*/ - /*double min, max; */ - int idx = (int) eext_circle_object_value_get(obj); - - is_changed = 1; /* changed flag!! */ - - volume_index = idx; - - DBG("Setting - volume_index : %d", volume_index); - - if (curr_sound_type == SOUND_STREAM_TYPE_MEDIA) { - if (!is_play_media_sound) { - _play_sound_all_type(curr_sound_type, 0.0); - is_play_media_sound = 0; - } else { - is_play_media_sound = 0; - } - } else { - _play_sound_all_type(curr_sound_type, 0.0); - } - - - /*double posx = 0.0; */ - /*posx = (double)(w / max) * idx; */ -} - -static void -ringtone_value_changed(void *data, Evas_Object *obj, void *event_info) -{ - DBG("Setting - ringtone_value_changed() is called!"); - char buf[PATH_MAX]; - Evas_Object *label = data; - - snprintf(buf, sizeof(buf), "%.0lf", eext_circle_object_value_get(obj)); - DBG(">>>>>>>>>>>>>>>>>>>>>>>>>>> Slider value = %s", buf); - if (get_sound_mode() == SOUND_MODE_SOUND) { - elm_object_text_set(label, buf); - - if (curr_sound_type != SOUND_STREAM_TYPE_MEDIA) { - if (is_changing_level_by_vconf) { - DBG("Setting - is_changing_level_by_vconf!!!!"); - - is_changing_level_by_vconf = 0; - return; - } - } - - /*Evas_Coord w; */ - /*double min, max; */ - int idx = (int) eext_circle_object_value_get(obj); - - is_changed = 1; /* changed flag!! */ - - volume_index = idx; - - DBG("Setting - volume_index : %d", volume_index); - - if (curr_sound_type == SOUND_STREAM_TYPE_MEDIA) { - if (!is_play_media_sound) { - _play_sound_all_type(curr_sound_type, 0.0); - is_play_media_sound = 0; - } else { - is_play_media_sound = 0; - } - } else { - _play_sound_all_type(curr_sound_type, 0.0); - } - - /*edje_object_part_geometry_get(elm_layout_edje_get(obj), "center.image2", NULL, NULL, &w, NULL); */ - /*elm_spinner_min_max_get(obj, &min, &max); */ - /*DBG("Setting - min: %i, max: %i, idx: %d", (int)min, (int)max, idx); */ - /*double posx = 0.0; */ - /* posx = (double)(w / max) * idx; */ - /*edje_object_part_drag_value_set(elm_layout_edje_get(obj), "elm.dragable.slider", posx, 0); */ - } -} - -static void volume_circle_system_part(appdata *ad, Evas_Object *ly, system_part_volume_cb changed_callback, int is_multimedia) -{ - Evas_Object *label = elm_label_add(ly); - evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL); - - char tempbuf[128]; - snprintf(tempbuf, sizeof(tempbuf) - 1, "%d", volume_index); - elm_object_text_set(label, tempbuf); - elm_object_part_content_set(ly, "elm.icon.2", label); - if (!is_multimedia) { - evas_object_resize(label, 200, 200); - if (get_sound_mode() != SOUND_MODE_SOUND) - evas_object_color_set(label, 83, 94, 102, 255); - } - evas_object_show(label); - - Evas_Object *slider = eext_circle_object_slider_add(ly, ad->circle_surface); - - eext_circle_object_value_min_max_set(slider, 0.0, 15.0); - eext_circle_object_value_set(slider, volume_index); - - eext_rotary_object_event_activated_set(slider, EINA_TRUE); - eext_circle_object_slider_step_set(slider, 1); - evas_object_smart_callback_add(slider, "value,changed", changed_callback, label); -} - - -void _initialize_volume() -{ - volume_index = 0; - original_volume = 0; - is_wav_playing_vol = SOUND_STATE_STOP; - sound_id_vol = -1; - is_changed = 0; - is_changing_level_by_vconf = 0; - is_myself_changing = 0; - is_myself_ringtone_changing = 0; - - is_sound_changed = 0; - is_vibrate_changed = 0; - is_play_media_sound = 0; - - curr_sound_type = SOUND_STREAM_TYPE_RINGTONE_CALL; - - if (is_created_player()) { - _close_player(NULL); - } -} - -void _clear_volume_cb(void *data , Evas *e, Evas_Object *obj, void *event_info) -{ - _clear_volume_resources(); - - return; -} - -static void stop_wav() -{ - if (is_wav_playing_vol == SOUND_STATE_PLAY) { - DBG("Setting - sound id : %d", sound_id_vol); - - wav_player_stop(sound_id_vol); - is_wav_playing_vol = SOUND_STATE_STOP; - sound_id_vol = -1; - } -} - -void _stop_all_volume_sound() -{ - DBG("Setting - stop all volume sound."); - - if (is_created_player()) { - _close_player(NULL); - } - - stop_wav(); -} - -void _clear_volume_resources() -{ - DBG("Setting - _clear_volume_resources()"); - - if (is_created_player()) { - _close_player(NULL); - } - - stop_wav(); - - g_ad = NULL; - g_volume_genlist = NULL; - g_volume_spinner = NULL; - is_myself_changing = 0; - is_myself_ringtone_changing = 0; - is_sound_changed = is_vibrate_changed = 0; -} - -static void _update_volume_popup_for_changing_sound_mode() -{ - DBG("_update_volume_popup_for_changing_sound_mode is called!!"); - - is_sound_changed = is_vibrate_changed = 0; - - if (g_volume_spinner) { - is_changing_level_by_vconf = 1; - - int sound_mode = get_sound_mode(); - - if (sound_mode == SOUND_MODE_VIBRATE) { - DBG("Setting - vibrate!!!"); - - if (curr_sound_type == SOUND_STREAM_TYPE_RINGTONE_CALL) { - volume_index = 0; - } - elm_spinner_value_set(g_volume_spinner, 0); - _update_volume_circle(g_volume_spinner); - - _stop_all_volume_sound(); - - edje_object_signal_emit(elm_layout_edje_get(g_volume_spinner), "elm,spinner,min", "elm"); - edje_object_part_drag_value_set(elm_layout_edje_get(g_volume_spinner), "elm.dragable.slider", 0, 0); - edje_object_signal_emit(elm_layout_edje_get(g_volume_spinner), "elm,spinner,vibrate", "elm"); - - if (curr_sound_type == SOUND_STREAM_TYPE_NOTIFICATION || - curr_sound_type == SOUND_STREAM_TYPE_SYSTEM) { - DBG("current_sound_type!!"); - - elm_object_disabled_set(g_volume_spinner, EINA_TRUE); - } - } else if (sound_mode == SOUND_MODE_SOUND) { - DBG("Setting - Sound!!!"); - - sound_manager_get_volume(curr_sound_type, &volume_index); - - DBG("volume_index !!!!!! -------------- %d", volume_index); - - if (volume_index != 0) { - elm_spinner_value_set(g_volume_spinner, volume_index); - - _update_volume_circle(g_volume_spinner); - - elm_object_disabled_set(g_volume_spinner, EINA_FALSE); - } - } else { - DBG("Setting - Mute!!!"); - - if (curr_sound_type == SOUND_STREAM_TYPE_NOTIFICATION || - curr_sound_type == SOUND_STREAM_TYPE_SYSTEM) { - elm_object_disabled_set(g_volume_spinner, EINA_FALSE); - - edje_object_signal_emit(elm_layout_edje_get(g_volume_spinner), "elm,spinner,min", "elm"); - edje_object_part_drag_value_set(elm_layout_edje_get(g_volume_spinner), "elm.dragable.slider", 0, 0); - - elm_object_disabled_set(g_volume_spinner, EINA_TRUE); - } else if (curr_sound_type == SOUND_STREAM_TYPE_RINGTONE_CALL) { - _stop_all_volume_sound(); - - if (curr_sound_type == SOUND_STREAM_TYPE_RINGTONE_CALL) { - volume_index = 0; - } - elm_spinner_value_set(g_volume_spinner, 0); - _update_volume_circle(g_volume_spinner); - - edje_object_signal_emit(elm_layout_edje_get(g_volume_spinner), "elm,spinner,min", "elm"); - edje_object_part_drag_value_set(elm_layout_edje_get(g_volume_spinner), "elm.dragable.slider", 0, 0); - } - } - } -} - -static void sound_vconf_changed_cb(keynode_t *key, void *data) -{ - DBG("Setting - sound_vconf_changed_cb() is called!!"); - - if (curr_sound_type == SOUND_STREAM_TYPE_MEDIA) { - return; - } - - if (is_myself_changing) { - DBG("Setting - is_myself_changing is called!!"); - is_myself_changing = 0; - return; - } - - is_sound_changed = 1; - - if (is_sound_changed && is_vibrate_changed) { - _update_volume_popup_for_changing_sound_mode(); - } -} - -static void vibrate_vconf_changed_cb(keynode_t *key, void *data) -{ - DBG("Setting - vibrate_vconf_changed_cb() is called!!"); - - if (curr_sound_type == SOUND_STREAM_TYPE_MEDIA) { - return; - } - - if (is_myself_changing) { - DBG("Setting - is_myself_changing is called!!"); - is_myself_changing = 0; - return; - } - - is_vibrate_changed = 1; - - if (is_sound_changed && is_vibrate_changed) { - _update_volume_popup_for_changing_sound_mode(); - } -} - -static void pm_state_vconf_changed_cb_for_volume(keynode_t *key, void *data) -{ - DBG("Setting - pm_state_vconf_changed_cb_for_volume() 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_volume_sound(); - } -} - -static void _rigngtone_volume_changed_cb(sound_stream_type_e type, unsigned int volume, void *user_data) -{ - DBG("Setting - _rigngtone_volume_changed_cb() is called!"); - - if (type != SOUND_STREAM_TYPE_RINGTONE_CALL) { - DBG("Setting - sound_type is not media!!"); - return; - } - - if (is_myself_ringtone_changing) { - is_myself_ringtone_changing = 0; - return; - } - - if (g_volume_spinner) { - volume_index = volume; - - DBG("Setting - Ringtone volume: %d", volume_index); - - is_play_ringtone_sound = 1; - - elm_spinner_value_set(g_volume_spinner, volume_index); - } -} - -static void _media_volume_changed_cb(sound_stream_type_e type, unsigned int volume, void *user_data) -{ - DBG("Setting - _media_volume_changed_cb() is called!"); - - if (type == SOUND_STREAM_TYPE_RINGTONE_CALL) { - DBG("Setting - sound_type is ringtone!!"); - return; - } - - if (is_myself_ringtone_changing) { - is_myself_ringtone_changing = 0; - return; - } - - if (volume_index == volume) { - DBG("Setting - Volume is same!! %d ---- %d ", volume_index, volume); - return; - } - - if (g_volume_spinner) { - volume_index = volume; - - DBG("Setting - Media volume: %d", volume_index); - - is_play_media_sound = 1; - - elm_spinner_value_set(g_volume_spinner, volume_index); - } -} - -static void _gl_multimedia_cb(void *data, Evas_Object *obj, void *event_info) -{ - elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE); - - _show_multimedia_popup(data, obj, event_info); -} - -static void _gl_ringtone_cb(void *data, Evas_Object *obj, void *event_info) -{ - elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE); - - _show_ringtone_popup(data, obj, event_info); -} - -static void _gl_notification_cb(void *data, Evas_Object *obj, void *event_info) -{ - elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE); - - _show_notification_popup(data, obj, event_info); -} - -static void _gl_system_cb(void *data, Evas_Object *obj, void *event_info) -{ - elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE); - - _show_system_popup(data, obj, event_info); -} - -char *_gl_volume_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", _(volume_menu_its[index % VOLUMN_ITEM_COUNT].name)); - index++; - } - return strdup(buf); -} - -static void _volumn_gl_del(void *data, Evas_Object *obj) -{ - Item_Data *id = data; - FREE(id); -} - -Evas_Object *_create_volume_list(void *data) -{ - appdata *ad = data; - if (ad == NULL) { - DBG("%s", "_create_volume_list - appdata is null"); - return NULL; - } - Evas_Object *genlist = NULL; - Elm_Object_Item *item = NULL; - struct _volume_menu_item *menu_its = NULL; - int idx = 0; - - g_ad = ad; - - Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new(); - itc->item_style = "1text"; - itc->func.text_get = _gl_volume_title_get; - itc->func.del = _volumn_gl_del; - - genlist = elm_genlist_add(ad->nf); - elm_genlist_block_count_set(genlist, 14); - elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS); - connect_to_wheel_with_genlist(genlist, ad); - - menu_its = volume_menu_its; - - for (idx = 0; idx < VOLUMN_ITEM_COUNT; idx++) { - Item_Data *id = calloc(sizeof(Item_Data), 1); - if (id) { - id->index = idx; - item = elm_genlist_item_append( - genlist, /* genlist object */ - itc, /* item class */ - id, /* data */ - NULL, - ELM_GENLIST_ITEM_NONE, - menu_its[idx].func, /* call back */ - ad); - id->item = item; - } - } - elm_genlist_item_class_free(itc); - - g_volume_genlist = genlist; - - return genlist; -} - -static void change_sound_mode(int mode) -{ - switch (mode) { - case SOUND_MODE_SOUND: - DBG("Setting - Change sound mode to Sound!"); - - vconf_set_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, TRUE); - vconf_set_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, FALSE); - break; - case SOUND_MODE_VIBRATE: - DBG("Setting - Change sound mode to Sound!"); - - vconf_set_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, FALSE); - vconf_set_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, TRUE); - break; - case SOUND_MODE_MUTE: - DBG("Setting - Change sound mode to Sound!"); - - vconf_set_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, FALSE); - vconf_set_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, FALSE); - break; - } -} - -static void _set_cancel_cb(void *data, Evas_Object *obj, void *event_info) -{ - appdata *ad = data; - if (ad == NULL) - return; - - if (!is_changed) { - DBG("not changed"); - elm_naviframe_item_pop(ad->nf); - return; - } - - DBG("Setting - original volume : %d", original_volume); - - char vconf_key[512] = {0,}; - - switch (curr_sound_type) { - case SOUND_STREAM_TYPE_MEDIA: - strncpy(vconf_key, VCONFKEY_SETAPPL_MEDIA_SOUND_VOLUME_INT, 512); - break; - case SOUND_STREAM_TYPE_RINGTONE_CALL: - strncpy(vconf_key, VCONFKEY_SETAPPL_CALL_RINGTONE_SOUND_VOLUME_INT, 512); - break; - case SOUND_STREAM_TYPE_SYSTEM: - strncpy(vconf_key, VCONFKEY_SETAPPL_TOUCH_FEEDBACK_SOUND_VOLUME_INT, 512); - break; - case SOUND_STREAM_TYPE_NOTIFICATION: - strncpy(vconf_key, VCONFKEY_SETAPPL_NOTI_SOUND_VOLUME_INT, 512); - break; - } - - /* restore original vulume value */ - _set_volumn(curr_sound_type, original_volume, vconf_key); - - if (original_sound_mode != get_sound_mode()) { - /* restore sound mode */ - change_sound_mode(original_sound_mode); - } - - /*original_volume = 0; */ - - if (is_created_player()) { - _close_player(ad); - } - - stop_wav(); - - elm_naviframe_item_pop(ad->nf); -} - -static void _back_volume_naviframe_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - DBG("Setting - _back_volume_naviframe_cb is called"); - DBG("Setting - original volume : %d", original_volume); - DBG("Setting - volume index : %d", volume_index); - - if (original_sound_mode != get_sound_mode()) { - /* restore sound mode */ - change_sound_mode(original_sound_mode); - } - - if (is_created_player()) { - _close_player(data); - } - - g_volume_spinner = NULL; - - is_changed = 0; /* initialize flag! */ - - stop_wav(); - - unregister_vconf_changing(VCONFKEY_PM_STATE, pm_state_vconf_changed_cb_for_volume); - - sound_manager_remove_volume_changed_cb(sound_manager_id); - - /* Unregister sound mode vconf callback */ - unregister_vconf_changing(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, vibrate_vconf_changed_cb); - unregister_vconf_changing(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL , sound_vconf_changed_cb); - - return; -} - -static void _set_volumn(sound_stream_type_e type, int volume_index, char *vconf_key) -{ - DBG("Setting - set_volume() is called!"); - - int err = -1; - err = sound_manager_set_volume(type, volume_index); - - /* save system vulume value */ - if (err == SOUND_MANAGER_ERROR_NONE) { - int vret = vconf_set_int(vconf_key, volume_index); - DBG(" ret = %d , %s :: %d ", vret, vconf_key, volume_index); - - if (curr_sound_type == SOUND_STREAM_TYPE_RINGTONE_CALL) { - DBG("Ringtone volume is changed....!"); - - if (volume_index == 0 && get_sound_mode() == SOUND_MODE_SOUND) { - vconf_set_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, FALSE); - vconf_set_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, FALSE); - } else if (volume_index > 0 && get_sound_mode() != SOUND_MODE_SOUND) { - vconf_set_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, TRUE); - vconf_set_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, FALSE); - } - } else { - DBG("current sound mode is %d, not type_ringtone", curr_sound_type); - } - } else { - DBG("Setting - ringtone value is not saved... %d", volume_index); - } -} - -static void _set_multimedia_clicked_cb(void *data, Evas_Object *obj, void *event_info) -{ - appdata *ad = data; - if (ad == NULL) - return; - - if (!is_changed) { - DBG("not changed"); - elm_naviframe_item_pop(ad->nf); - return; - } - - /* save multimedia vulume value */ - _set_volumn(SOUND_STREAM_TYPE_MEDIA, volume_index, VCONFKEY_SETAPPL_MEDIA_SOUND_VOLUME_INT); - - - if (is_created_player()) { - _close_player(ad); - } - - stop_wav(); - - elm_naviframe_item_pop(ad->nf); -} - -static void _play_sound_all_type(int sound_type, float volume) -{ - if (is_myself_ringtone_changing) { - DBG(" is_myself_ringtone_changing !!!!!!!!!!!"); - - return; - } - - char buf[__SETTING_BUF_SIZE__] = {0,}; - const char *sound_path = NULL; - int temp_volume_index = 0; - switch (sound_type) { - case SOUND_STREAM_TYPE_RINGTONE_CALL: - temp_volume_index = volume_index; - - vconf_set_int(VCONFKEY_SETAPPL_CALL_RINGTONE_SOUND_VOLUME_INT, temp_volume_index); - vconf_set_int("db/setting/sound/call/rmd_ringtone_volume", temp_volume_index); /* backup ringtone volume */ - - sound_path = vconf_get_str(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR); - if (sound_path) { - snprintf(buf, sizeof(buf)-1, "%s", sound_path); - } else { - snprintf(buf, sizeof(buf)-1, "%s", VCONFKEY_SETAPPL_CALL_RINGTONE_DEFAULT_PATH_STR); - } - - break; - case SOUND_STREAM_TYPE_MEDIA: - _set_volumn(sound_type, volume_index, VCONFKEY_SETAPPL_MEDIA_SOUND_VOLUME_INT); - - snprintf(buf, sizeof(buf)-1, "%s", SETTING_DEFAULT_MEDIA_TONE); - break; - case SOUND_STREAM_TYPE_NOTIFICATION: - vconf_set_int(VCONFKEY_SETAPPL_NOTI_SOUND_VOLUME_INT, volume_index); - temp_volume_index = volume_index; - - sound_path = vconf_get_str(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR); - if (sound_path) { - snprintf(buf, sizeof(buf)-1, "%s", sound_path); - } else { - snprintf(buf, sizeof(buf)-1, "%s", SETTING_DEFAULT_MSG_TONE); - } - break; - case SOUND_STREAM_TYPE_SYSTEM: - vconf_set_int(VCONFKEY_SETAPPL_TOUCH_FEEDBACK_SOUND_VOLUME_INT, volume_index); - - snprintf(buf, sizeof(buf)-1, "%s", SETTING_DEFAULT_SYS_TONE); - break; - } - - FREE(sound_path); - - ERR(">>>>> Play Sound path : %s", buf); - - int err = -1; - - if (sound_type == SOUND_STREAM_TYPE_RINGTONE_CALL) { - DBG("Setting - ringtone safety volume!!"); - DBG("Setting - real volume : %d", temp_volume_index); - - sound_manager_set_volume(sound_type, temp_volume_index); - } else if (sound_type == SOUND_STREAM_TYPE_NOTIFICATION) { - DBG("Setting - notification safety volume!!"); - sound_manager_set_volume(sound_type, temp_volume_index); - } else { - DBG("Setting - normal volume!! ----- volume_index : %d ", volume_index); - err = sound_manager_set_volume(sound_type, volume_index); - if (err != SOUND_MANAGER_ERROR_NONE) { - ERR("Setting - sound_manager_set_volume() is failed! : %d", err); - } - } - - if (sound_type == SOUND_STREAM_TYPE_RINGTONE_CALL) { - if (!is_created_player() || is_player_paused()) { - play_sound(buf, volume, SOUND_STREAM_TYPE_RINGTONE_CALL); - set_looping(TRUE); - } - is_myself_ringtone_changing = 1; - } else if (sound_type == SOUND_STREAM_TYPE_SYSTEM || sound_type == SOUND_STREAM_TYPE_MEDIA) { - - play_sound(buf, volume, SOUND_STREAM_TYPE_SYSTEM); - set_looping(FALSE); - return; - } else if (sound_type == SOUND_STREAM_TYPE_NOTIFICATION) { - play_sound(buf, volume, SOUND_STREAM_TYPE_NOTIFICATION); - set_looping(FALSE); - - return; - } -} - -#if 0 /* NOT USED */ -static void _change_to_vibrate_mode() -{ - DBG("Setting - _change_to_vibrate_mode() is called!"); - - if (curr_sound_type == SOUND_STREAM_TYPE_MEDIA) { - return; - } - - if (get_sound_mode() != SOUND_MODE_VIBRATE) { - DBG("Setting - Change sound mode to vibrate!"); - - is_myself_changing = 1; - - _stop_all_volume_sound(); - - _start_vibration(3, SETTING_VIB_STRONG_RATE, SETTING_DEFAULT_SYSTEM_HAPTIC_PREVIEW_VIB); - - vconf_set_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, FALSE); - vconf_set_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, TRUE); - } -} - -static void _change_to_sound_mode() -{ - DBG("Setting - _change_to_sound_mode() is called!"); - - if (curr_sound_type == SOUND_STREAM_TYPE_MEDIA) { - return; - } - - if (get_sound_mode() != SOUND_MODE_SOUND) { - DBG("Setting - Change sound mode to sound!"); - - is_myself_changing = 1; - - vconf_set_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, TRUE); - vconf_set_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, FALSE); - } -} -#endif - -static int sync_volume(int vconf_vol, int real_vol) -{ - if (vconf_vol != real_vol) - return real_vol; - return vconf_vol; -} - -static void _update_volume_circle(Evas_Object *spiner) -{ - if (spiner == NULL) - return; - - Evas_Coord w; - double min, max, posx; - int idx = (int) elm_spinner_value_get(spiner); - - edje_object_part_geometry_get(elm_layout_edje_get(spiner), "center.image2", NULL, NULL, &w, NULL); - elm_spinner_min_max_get(spiner, &min, &max); - - if (idx == max) - edje_object_signal_emit(elm_layout_edje_get(spiner), "elm,spinner,full", "elm"); - if (idx < max) - edje_object_signal_emit(elm_layout_edje_get(spiner), "elm,spinner,default", "elm"); - if (idx == min) { - edje_object_signal_emit(elm_layout_edje_get(spiner), "elm,spinner,min", "elm"); - if (curr_sound_type != SOUND_STREAM_TYPE_MEDIA && get_sound_mode() == SOUND_MODE_VIBRATE) { - edje_object_signal_emit(elm_layout_edje_get(spiner), "elm,spinner,vibrate", "elm"); - } - } - if (idx > min) - edje_object_signal_emit(elm_layout_edje_get(spiner), "elm,spinner,normal", "elm"); - - posx = (double)(w / max) * idx; - - edje_object_part_drag_value_set(elm_layout_edje_get(spiner), "elm.dragable.slider", posx, 0); -} - - -#if 0 /* NOT USED */ -static void _on_volume_spinner_change_cb(void *data, Evas_Object *obj, void *event_info) -{ - DBG("Setting - _on_volume_spinner_change_cb() is called!"); - - if (is_changing_level_by_vconf) { - DBG("Setting - is_changing_level_by_vconf!!!!"); - - is_changing_level_by_vconf = 0; - return; - } - - is_changed = 1; /* changed flag!! */ - - Evas_Coord w; - - double min, max; - int idx = (int) elm_spinner_value_get(obj); - - volume_index = idx; - - DBG("Setting - volume_index : %d", volume_index); - - if (get_sound_mode() != SOUND_MODE_MUTE) { - if (!is_play_ringtone_sound) { - _play_sound_all_type(curr_sound_type, 0.0); - } else { - is_play_ringtone_sound = 0; - } - } - - edje_object_part_geometry_get(elm_layout_edje_get(obj), "center.image2", NULL, NULL, &w, NULL); - elm_spinner_min_max_get(obj, &min, &max); - - DBG("Setting - min: %i, max: %i, idx: %d", (int)min, (int)max, idx); - - if (idx == max) { - edje_object_signal_emit(elm_layout_edje_get(obj), "elm,spinner,full", "elm"); - } - if (idx < max) { - edje_object_signal_emit(elm_layout_edje_get(obj), "elm,spinner,default", "elm"); - } - if (idx == min) { - if (get_sound_mode() != SOUND_MODE_VIBRATE) { - _change_to_vibrate_mode(); - } - edje_object_signal_emit(elm_layout_edje_get(obj), "elm,spinner,min", "elm"); - edje_object_signal_emit(elm_layout_edje_get(obj), "elm,spinner,vibrate", "elm"); - } - if (idx > min) { - if (get_sound_mode() == SOUND_MODE_MUTE) { - _change_to_vibrate_mode(); - edje_object_signal_emit(elm_layout_edje_get(obj), "elm,spinner,min", "elm"); - edje_object_signal_emit(elm_layout_edje_get(obj), "elm,spinner,vibrate", "elm"); - - elm_spinner_value_set(obj, 0); - } else { - _change_to_sound_mode(); - edje_object_signal_emit(elm_layout_edje_get(obj), "elm,spinner,normal", "elm"); - } - } - - double posx = 0.0; - if (get_sound_mode() == SOUND_MODE_MUTE) { - posx = 0; - } else { - posx = (double)(w / max) * idx; - } - - edje_object_part_drag_value_set(elm_layout_edje_get(obj), "elm.dragable.slider", posx, 0); -} -#endif - -#if 0 /* NOT USED */ -static void _on_media_volume_spinner_change_cb(void *data, Evas_Object *obj, void *event_info) -{ - DBG("Setting - _on_media_volume_spinner_change_cb() is called!"); - - if (curr_sound_type != SOUND_STREAM_TYPE_MEDIA) { - if (is_changing_level_by_vconf) { - DBG("Setting - is_changing_level_by_vconf!!!!"); - - is_changing_level_by_vconf = 0; - return; - } - } - - Evas_Coord w; - - double min, max; - int idx = (int) elm_spinner_value_get(obj); - - is_changed = 1; /* changed flag!! */ - - volume_index = idx; - - DBG("Setting - volume_index : %d", volume_index); - - if (curr_sound_type == SOUND_STREAM_TYPE_MEDIA) { - if (!is_play_media_sound) { - _play_sound_all_type(curr_sound_type, 0.0); - is_play_media_sound = 0; - } else { - is_play_media_sound = 0; - } - } else { - _play_sound_all_type(curr_sound_type, 0.0); - } - - edje_object_part_geometry_get(elm_layout_edje_get(obj), "center.image2", NULL, NULL, &w, NULL); - elm_spinner_min_max_get(obj, &min, &max); - - DBG("Setting - min: %i, max: %i, idx: %d", (int)min, (int)max, idx); - - if (idx == max) { - edje_object_signal_emit(elm_layout_edje_get(obj), "elm,spinner,full", "elm"); - } - if (idx < max) { - edje_object_signal_emit(elm_layout_edje_get(obj), "elm,spinner,default", "elm"); - } - if (idx == min) { - edje_object_signal_emit(elm_layout_edje_get(obj), "elm,spinner,min", "elm"); - } - if (idx > min) { - edje_object_signal_emit(elm_layout_edje_get(obj), "elm,spinner,normal", "elm"); - } - - double posx = 0.0; - posx = (double)(w / max) * idx; - - edje_object_part_drag_value_set(elm_layout_edje_get(obj), "elm.dragable.slider", posx, 0); -} -#endif - -void _show_multimedia_popup(void *data, Evas_Object *obj, void *event_info) -{ - Evas_Object *ly; - appdata *ad = data; - - if (ad == NULL) - return; - - is_play_media_sound = 0; - - original_sound_mode = get_sound_mode(); - - curr_sound_type = SOUND_STREAM_TYPE_MEDIA; - - vconf_get_int(VCONFKEY_SETAPPL_MEDIA_SOUND_VOLUME_INT, &volume_index); - - int real_volume_index = 0; - sound_manager_get_volume(SOUND_STREAM_TYPE_MEDIA, &real_volume_index); - - DBG("Setting - vconf vol: %d, real vol: %d", volume_index, real_volume_index); - - /* sync volume */ - volume_index = sync_volume(volume_index, real_volume_index); - original_volume = volume_index; - - ad->MENU_TYPE = SETTING_VOLUME_2_DEPTH; - - - ly = elm_layout_add(ad->nf); - elm_layout_file_set(ly, EDJE_PATH, "setting/2finger_popup/default2"); - /*elm_layout_file_set(ly, EDJE_PATH, "setting/2finger_popup/default3");*/ - evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL); - - volume_circle_system_part(ad, ly, multimedia_value_changed, 1 /*is_multimedia == 1*/); -#if 0 - Evas_Object *spinner = elm_spinner_add(ly); - - g_volume_spinner = spinner; - - elm_spinner_editable_set(spinner, EINA_FALSE); - elm_spinner_min_max_set(spinner, 0, 15); - elm_spinner_value_set(spinner, volume_index); - _update_volume_circle(spinner); - evas_object_smart_callback_add(spinner, "changed", _on_media_volume_spinner_change_cb, ly); - elm_object_part_content_set(ly, "elm.icon.1", spinner); - -#endif - Evas_Object *btn_cancel; - btn_cancel = elm_button_add(ly); - elm_object_style_set(btn_cancel, "default"); - evas_object_size_hint_weight_set(btn_cancel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_object_translatable_text_set(btn_cancel, "IDS_ST_BUTTON_CANCEL_ABB2"); - elm_object_part_content_set(ly, "btn1", btn_cancel); - evas_object_smart_callback_add(btn_cancel, "clicked", _set_cancel_cb, ad); - - Evas_Object *btn_ok; - btn_ok = elm_button_add(ly); - elm_object_style_set(btn_ok, "default"); - evas_object_size_hint_weight_set(btn_ok, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_object_translatable_text_set(btn_ok, "IDS_WNOTI_BUTTON_OK_ABB2"); - elm_object_part_content_set(ly, "btn2", btn_ok); - evas_object_smart_callback_add(btn_ok, "clicked", _set_multimedia_clicked_cb, ad); - - Elm_Object_Item *nf_it = elm_naviframe_item_push(ad->nf, - "IDS_ST_BUTTON_MULTIMEDIA", - NULL, NULL, - ly, NULL); - back_button_cb_push(&_set_cancel_cb, data, btn_cancel, g_volume_genlist, "g_volume_genlist"); - elm_object_item_domain_text_translatable_set(nf_it, SETTING_PACKAGE, EINA_TRUE); - evas_object_event_callback_add(nf_it, EVAS_CALLBACK_DEL, _back_volume_naviframe_cb, ad); - - register_vconf_changing(VCONFKEY_PM_STATE, pm_state_vconf_changed_cb_for_volume, NULL); - /*register_vconf_changing(VCONFKEY_SETAPPL_MEDIA_SOUND_VOLUME_INT ,_media_vconf_changing_cb, NULL); */ - - sound_manager_add_volume_changed_cb(_media_volume_changed_cb, NULL, &sound_manager_id); - - /* Unregister sound mode vconf callback */ - register_vconf_changing(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, vibrate_vconf_changed_cb, NULL); - register_vconf_changing(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL , sound_vconf_changed_cb, NULL); -} - -static void _set_ringtone_clicked_cb(void *data, Evas_Object *obj, void *event_info) -{ - appdata *ad = data; - if (ad == NULL) - return; - - if (!is_changed) { - DBG("not changed"); - elm_naviframe_item_pop(ad->nf); - return; - } - - /* save ringtone vulume value */ - _set_volumn(SOUND_STREAM_TYPE_RINGTONE_CALL, volume_index, VCONFKEY_SETAPPL_CALL_RINGTONE_SOUND_VOLUME_INT); - - if (is_created_player()) { - _close_player(ad); - } - - stop_wav(); - - elm_naviframe_item_pop(ad->nf); -} - -void _show_ringtone_popup(void *data, Evas_Object *obj, void *event_info) -{ - Evas_Object *ly; - Evas_Object *btn; - appdata *ad = data; - int sound_mode; - - if (ad == NULL) - return; - - original_sound_mode = get_sound_mode(); - - curr_sound_type = SOUND_STREAM_TYPE_RINGTONE_CALL; - - vconf_get_int(VCONFKEY_SETAPPL_CALL_RINGTONE_SOUND_VOLUME_INT, &volume_index); - - DBG("Setting - Ringtone volume is %d", volume_index); - - sound_mode = get_sound_mode(); - - int real_volume_index = 0; - sound_manager_get_volume(SOUND_STREAM_TYPE_RINGTONE_CALL, &real_volume_index); - - int virtual_index = real_volume_index; - - DBG("Setting - vconf vol: %d, real vol: %d", volume_index, virtual_index); - - if (sound_mode != SOUND_MODE_SOUND) { - DBG("sound_mode != SOUND_MODE_SOUND ---> set to zero -> mode:%d ", sound_mode); - virtual_index = 0; - } - - /* sync volume */ - volume_index = sync_volume(volume_index, virtual_index); - original_volume = real_volume_index; - - ad->MENU_TYPE = SETTING_VOLUME_2_DEPTH; - - ly = elm_layout_add(ad->nf); - elm_layout_file_set(ly, EDJE_PATH, "setting/2finger_popup/default2"); - /*elm_layout_file_set(ly, EDJE_PATH, "setting/2finger_popup/default3");*/ - evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL); - - if (ad->root_w == 360 && ad->root_h == 480) { - DBG("make long height !!!!!!!!!!!!!!!!!"); - elm_object_signal_emit(ly, "set,popup,long", "*"); - } - - volume_circle_system_part(ad, ly, ringtone_value_changed, 0 /*is_multimedia == 0*/); -#if 0 - Evas_Object *spinner = elm_spinner_add(ly); - - g_volume_spinner = spinner; - - DBG("Setting- Volume: %d", volume_index); - - elm_spinner_editable_set(spinner, EINA_FALSE); - elm_spinner_min_max_set(spinner, 0, 15); - - if (sound_mode != SOUND_MODE_SOUND) { - elm_spinner_value_set(spinner, volume_index); - edje_object_signal_emit(elm_layout_edje_get(spinner), "elm,spinner,min", "elm"); - edje_object_part_drag_value_set(elm_layout_edje_get(spinner), "elm.dragable.slider", 0, 0); - - if (get_sound_mode() == SOUND_MODE_VIBRATE) { - edje_object_signal_emit(elm_layout_edje_get(spinner), "elm,spinner,vibrate", "elm"); - } - - elm_object_disabled_set(spinner, EINA_TRUE); - } else { - elm_spinner_value_set(spinner, volume_index); - _update_volume_circle(spinner); - } - evas_object_smart_callback_add(spinner, "changed", _on_volume_spinner_change_cb, ly); - elm_object_part_content_set(ly, "elm.icon.1", spinner); -#endif - - btn = elm_button_add(ly); - elm_object_style_set(btn, "default"); - evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_object_translatable_text_set(btn, "IDS_ST_BUTTON_CANCEL_ABB2"); - elm_object_part_content_set(ly, "btn1", btn); - evas_object_smart_callback_add(btn, "clicked", _set_cancel_cb, ad); - - btn = elm_button_add(ly); - elm_object_style_set(btn, "default"); - evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_object_translatable_text_set(btn, "IDS_WNOTI_BUTTON_OK_ABB2"); - elm_object_part_content_set(ly, "btn2", btn); - evas_object_smart_callback_add(btn, "clicked", _set_ringtone_clicked_cb, ad); - - Elm_Object_Item *nf_it = elm_naviframe_item_push(ad->nf, - "IDS_ST_HEADER_RINGTONES_ABB", - NULL, NULL, - ly, NULL); - back_button_cb_push(&_set_cancel_cb, data, btn, g_volume_genlist, "g_volume_genlist"); - elm_object_item_domain_text_translatable_set(nf_it, SETTING_PACKAGE, EINA_TRUE); - evas_object_event_callback_add(nf_it, EVAS_CALLBACK_DEL, _back_volume_naviframe_cb, ad); - - register_vconf_changing(VCONFKEY_PM_STATE, pm_state_vconf_changed_cb_for_volume, NULL); - - sound_manager_add_volume_changed_cb(_rigngtone_volume_changed_cb, NULL, &sound_manager_id); - - /* Unregister sound mode vconf callback */ - register_vconf_changing(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, vibrate_vconf_changed_cb, NULL); - register_vconf_changing(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL , sound_vconf_changed_cb, NULL); -} - -static void _set_notification_clicked_cb(void *data, Evas_Object *obj, void *event_info) -{ - appdata *ad = data; - if (ad == NULL) - return; - - if (!is_changed) { - DBG("not changed"); - elm_naviframe_item_pop(ad->nf); - return; - } - - _set_volumn(SOUND_STREAM_TYPE_NOTIFICATION, volume_index, VCONFKEY_SETAPPL_NOTI_SOUND_VOLUME_INT); - - if (is_created_player()) { - _close_player(ad); - } - - stop_wav(); - - elm_naviframe_item_pop(ad->nf); -} - -void _show_notification_popup(void *data, Evas_Object *obj, void *event_info) -{ - Evas_Object *ly; - Evas_Object *btn; - appdata *ad = data; - int sound_mode; - - if (ad == NULL) - return; - - original_sound_mode = get_sound_mode(); - - curr_sound_type = SOUND_STREAM_TYPE_NOTIFICATION; - - vconf_get_int(VCONFKEY_SETAPPL_NOTI_SOUND_VOLUME_INT, &volume_index); - - DBG("Setting - Notification volume is %d", volume_index); - sound_mode = get_sound_mode(); - - int real_volume_index = 0; - sound_manager_get_volume(SOUND_STREAM_TYPE_NOTIFICATION, &real_volume_index); - - int virtual_index = real_volume_index; - - DBG("Setting - vconf vol: %d, real vol: %d", volume_index, real_volume_index); - DBG("current sound mode is : %d <--------", sound_mode); - - if (sound_mode != SOUND_MODE_SOUND) - virtual_index = 0; - else { - DBG("Sound Mode is - %d ", sound_mode); - } - - /* sync volume */ - volume_index = sync_volume(volume_index, virtual_index); - original_volume = real_volume_index; - - ad->MENU_TYPE = SETTING_VOLUME_2_DEPTH; - - ly = elm_layout_add(ad->nf); - elm_layout_file_set(ly, EDJE_PATH, "setting/2finger_popup/default2"); - /*elm_layout_file_set(ly, EDJE_PATH, "setting/2finger_popup/default3");*/ - evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL); - - if (ad->root_w == 360 && ad->root_h == 480) { - DBG("make long height !!!!!!!!!!!!!!!!!"); - elm_object_signal_emit(ly, "set,popup,long", "*"); - } - - volume_circle_system_part(ad, ly, ringtone_value_changed, 0 /*is_multimedia == 0*/); -#if 0 - Evas_Object *spinner = elm_spinner_add(ly); - - g_volume_spinner = spinner; - - DBG("Setting- Volume: %d", volume_index); - - /*elm_object_style_set(spinner, "volumestyle"); */ - elm_spinner_editable_set(spinner, EINA_FALSE); - elm_spinner_min_max_set(spinner, 0, 15); - - if (get_sound_mode() != SOUND_MODE_SOUND) { - elm_spinner_value_set(spinner, volume_index); - edje_object_signal_emit(elm_layout_edje_get(spinner), "elm,spinner,min", "elm"); - edje_object_part_drag_value_set(elm_layout_edje_get(spinner), "elm.dragable.slider", 0, 0); - - if (get_sound_mode() == SOUND_MODE_VIBRATE) { - edje_object_signal_emit(elm_layout_edje_get(spinner), "elm,spinner,vibrate", "elm"); - } - - elm_object_disabled_set(spinner, EINA_TRUE); - } else { - elm_spinner_value_set(spinner, volume_index); - _update_volume_circle(spinner); - } - evas_object_smart_callback_add(spinner, "changed", _on_media_volume_spinner_change_cb, ly); - elm_object_part_content_set(ly, "elm.icon.1", spinner); -#endif - - btn = elm_button_add(ly); - elm_object_style_set(btn, "default"); - evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_object_translatable_text_set(btn, "IDS_ST_BUTTON_CANCEL_ABB2"); - elm_object_part_content_set(ly, "btn1", btn); - evas_object_smart_callback_add(btn, "clicked", _set_cancel_cb, ad); - - btn = elm_button_add(ly); - elm_object_style_set(btn, "default"); - evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_object_translatable_text_set(btn, "IDS_WNOTI_BUTTON_OK_ABB2"); - elm_object_part_content_set(ly, "btn2", btn); - evas_object_smart_callback_add(btn, "clicked", _set_notification_clicked_cb, ad); - - Elm_Object_Item *nf_it = elm_naviframe_item_push(ad->nf, - "IDS_ST_BUTTON_NOTIFICATIONS", - NULL, NULL, - ly, NULL); - back_button_cb_push(&back_key_generic_cb, data, NULL, g_volume_genlist, "g_volume_genlist"); - elm_object_item_domain_text_translatable_set(nf_it, SETTING_PACKAGE, EINA_TRUE); - evas_object_event_callback_add(nf_it, EVAS_CALLBACK_DEL, _back_volume_naviframe_cb, ad); - register_vconf_changing(VCONFKEY_PM_STATE, pm_state_vconf_changed_cb_for_volume, NULL); - - sound_manager_add_volume_changed_cb(_media_volume_changed_cb, NULL, &sound_manager_id); - - /* Unregister sound mode vconf callback */ - register_vconf_changing(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, vibrate_vconf_changed_cb, NULL); - register_vconf_changing(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL , sound_vconf_changed_cb, NULL); -} - -static void _set_system_clicked_cb(void *data, Evas_Object *obj, void *event_info) -{ - appdata *ad = data; - if (ad == NULL) - return; - - if (!is_changed) { - DBG("not changed"); - elm_naviframe_item_pop(ad->nf); - return; - } - - /* save system vulume value */ - _set_volumn(SOUND_STREAM_TYPE_SYSTEM, volume_index, VCONFKEY_SETAPPL_TOUCH_FEEDBACK_SOUND_VOLUME_INT); - - if (is_created_player()) { - _close_player(ad); - } - - stop_wav(); - - elm_naviframe_item_pop(ad->nf); -} - - -void _show_system_popup(void *data, Evas_Object *obj, void *event_info) -{ - Evas_Object *ly; - Evas_Object *btn; - appdata *ad = data; - int sound_mode; - - if (ad == NULL) - return; - - original_sound_mode = get_sound_mode(); - - curr_sound_type = SOUND_STREAM_TYPE_SYSTEM; - - vconf_get_int(VCONFKEY_SETAPPL_TOUCH_FEEDBACK_SOUND_VOLUME_INT, &volume_index); - - DBG("Setting - Notification volume is %d", volume_index); - sound_mode = get_sound_mode(); - - int real_volume_index = 0; - sound_manager_get_volume(SOUND_STREAM_TYPE_SYSTEM, &real_volume_index); - - int virtual_index = real_volume_index; - - DBG("Setting - vconf vol: %d, real vol: %d", volume_index, real_volume_index); - if (sound_mode != SOUND_MODE_SOUND) - virtual_index = 0; - else { - DBG("Sound Mode is - %d ", sound_mode); - } - - /* sync volume */ - volume_index = sync_volume(volume_index, virtual_index); - original_volume = real_volume_index; - - ad->MENU_TYPE = SETTING_VOLUME_2_DEPTH; - - ly = elm_layout_add(ad->nf); - elm_layout_file_set(ly, EDJE_PATH, "setting/2finger_popup/default2"); - /*elm_layout_file_set(ly, EDJE_PATH, "setting/2finger_popup/default3");*/ - evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL); - - if (ad->root_w == 360 && ad->root_h == 480) { - DBG("make long height !!!!!!!!!!!!!!!!!"); - elm_object_signal_emit(ly, "set,popup,long", "*"); - } - - volume_circle_system_part(ad, ly, ringtone_value_changed, 0 /*is_multimedia == 0*/); - -#if 0 - Evas_Object *spinner = elm_spinner_add(ly); - - g_volume_spinner = spinner; - - DBG("Setting- Volume: %d", volume_index); - - /*elm_object_style_set(spinner, "volumestyle"); */ - elm_spinner_editable_set(spinner, EINA_FALSE); - elm_spinner_min_max_set(spinner, 0, 15); - - if (get_sound_mode() != SOUND_MODE_SOUND) { - elm_spinner_value_set(spinner, volume_index); - edje_object_signal_emit(elm_layout_edje_get(spinner), "elm,spinner,min", "elm"); - edje_object_part_drag_value_set(elm_layout_edje_get(spinner), "elm.dragable.slider", 0, 0); - - if (get_sound_mode() == SOUND_MODE_VIBRATE) { - edje_object_signal_emit(elm_layout_edje_get(spinner), "elm,spinner,vibrate", "elm"); - } - - elm_object_disabled_set(spinner, EINA_TRUE); - } else { - elm_spinner_value_set(spinner, volume_index); - _update_volume_circle(spinner); - } - evas_object_smart_callback_add(spinner, "changed", _on_media_volume_spinner_change_cb, ly); - elm_object_part_content_set(ly, "elm.icon.1", spinner); -#endif - - btn = elm_button_add(ly); - elm_object_style_set(btn, "default"); - evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_object_translatable_text_set(btn, "IDS_ST_BUTTON_CANCEL_ABB2"); - elm_object_part_content_set(ly, "btn1", btn); - evas_object_smart_callback_add(btn, "clicked", _set_cancel_cb, ad); - - btn = elm_button_add(ly); - elm_object_style_set(btn, "default"); - evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_object_translatable_text_set(btn, "IDS_WNOTI_BUTTON_OK_ABB2"); - elm_object_part_content_set(ly, "btn2", btn); - evas_object_smart_callback_add(btn, "clicked", _set_system_clicked_cb, ad); - - Elm_Object_Item *nf_it = elm_naviframe_item_push(ad->nf, - "IDS_ST_BODY_SYSTEM_M_VOLUME_ABB", - NULL, NULL, - ly, NULL); - back_button_cb_push(&_set_cancel_cb, data, btn, g_volume_genlist, "g_volume_genlist"); - elm_object_item_domain_text_translatable_set(nf_it, SETTING_PACKAGE, EINA_TRUE); - evas_object_event_callback_add(nf_it, EVAS_CALLBACK_DEL, _back_volume_naviframe_cb, ad); - - register_vconf_changing(VCONFKEY_PM_STATE, pm_state_vconf_changed_cb_for_volume, NULL); - - sound_manager_add_volume_changed_cb(_media_volume_changed_cb, NULL, &sound_manager_id); - - /* Unregister sound mode vconf callback */ - register_vconf_changing(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, vibrate_vconf_changed_cb, NULL); - register_vconf_changing(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL , sound_vconf_changed_cb, NULL); -} diff --git a/src/setting_control_bt.c b/src/setting_control_bt.c deleted file mode 100644 index dd3c628..0000000 --- a/src/setting_control_bt.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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 "setting_control_bt.h" -#include "setting_debug.h" -#include <stdio.h> - -int hf_is_connected() -{ - int ret; - int i; - GPtrArray *dev_list = NULL; - bluetooth_device_info_t *dev; - gboolean is_connected = FALSE; - - dev_list = g_ptr_array_new(); - if (dev_list == NULL) { - printf("Setting - g_ptr_array_new is failed\n"); - return FALSE; - } - - ret = bluetooth_get_bonded_device_list(&dev_list); - if (ret != BLUETOOTH_ERROR_NONE) { - printf("Setting - bluetooth_get_bonded_device_list is failed 0x%X\n", ret); - g_ptr_array_free(dev_list, TRUE); - dev_list = NULL; - return FALSE; - } - - for (i = 0; i < dev_list->len; i++) { - is_connected = FALSE; - - dev = g_ptr_array_index(dev_list, i); - if (dev == NULL) { - printf("Setting - Invalid bluetooth device\n"); - break; - } - - ret = bluetooth_is_device_connected(&dev->device_address, - BLUETOOTH_HFG_SERVICE, &is_connected); - if (ret == BLUETOOTH_ERROR_NONE && is_connected) { - break; - } - } - - g_ptr_array_foreach(dev_list, (GFunc)g_free, NULL); - g_ptr_array_free(dev_list, TRUE); - dev_list = NULL; - - DBG("Setting - connected? %d", is_connected); - - return is_connected; -} |