Change slider enabling/disabling logic 46/234646/2
authorLukasz Stanislawski <lukasz.stanislawski@gmail.com>
Tue, 26 May 2020 10:45:22 +0000 (12:45 +0200)
committerLukasz Stanislawski <lukasz.stanislawski@gmail.com>
Wed, 27 May 2020 15:30:51 +0000 (17:30 +0200)
In new guideline the sliders should enable/disable depending
on current sound me we are in.
This patch changes
* old logic of managing sliders enabled/disable state
and icons
* when system volume is set to 0, the sound mode goest to "mute"

Change-Id: I15c136603453565b779b54022865d511a100a6cd

19 files changed:
resource/icons/sound_slider_icon_default.png [new file with mode: 0644]
resource/icons/sound_slider_icon_default_mute.png [new file with mode: 0644]
resource/icons/sound_slider_icon_default_vibrate.png [new file with mode: 0644]
resource/icons/sound_slider_icon_incoming_call.png [deleted file]
resource/icons/sound_slider_icon_notification.png [deleted file]
resource/icons/sound_slider_icon_notification_mute.png [deleted file]
resource/icons/sound_slider_icon_notification_vibrate.png [deleted file]
resource/icons/sound_slider_icon_system.png [deleted file]
resource/icons/sound_slider_icon_system_mute.png [deleted file]
resource/icons/sound_slider_icon_system_vibrate.png [deleted file]
resource/icons/sound_slider_icon_volume.png [deleted file]
resource/icons/sound_slider_icon_volume_mute.png [deleted file]
resource/icons/sound_slider_icon_volume_vibrate.png [deleted file]
setting-common/include/setting-common-general-func.h
setting-common/src/setting-common-general-func.c
setting-profile/include/setting-profile.h
setting-profile/src/setting-profile-common.c
setting-profile/src/setting-profile-sound-main.c
setting-profile/src/setting-profile-sound-mode-view.c

diff --git a/resource/icons/sound_slider_icon_default.png b/resource/icons/sound_slider_icon_default.png
new file mode 100644 (file)
index 0000000..bd1fc15
Binary files /dev/null and b/resource/icons/sound_slider_icon_default.png differ
diff --git a/resource/icons/sound_slider_icon_default_mute.png b/resource/icons/sound_slider_icon_default_mute.png
new file mode 100644 (file)
index 0000000..25b05ab
Binary files /dev/null and b/resource/icons/sound_slider_icon_default_mute.png differ
diff --git a/resource/icons/sound_slider_icon_default_vibrate.png b/resource/icons/sound_slider_icon_default_vibrate.png
new file mode 100644 (file)
index 0000000..779895f
Binary files /dev/null and b/resource/icons/sound_slider_icon_default_vibrate.png differ
diff --git a/resource/icons/sound_slider_icon_incoming_call.png b/resource/icons/sound_slider_icon_incoming_call.png
deleted file mode 100644 (file)
index 24c01a1..0000000
Binary files a/resource/icons/sound_slider_icon_incoming_call.png and /dev/null differ
diff --git a/resource/icons/sound_slider_icon_notification.png b/resource/icons/sound_slider_icon_notification.png
deleted file mode 100644 (file)
index bd1fc15..0000000
Binary files a/resource/icons/sound_slider_icon_notification.png and /dev/null differ
diff --git a/resource/icons/sound_slider_icon_notification_mute.png b/resource/icons/sound_slider_icon_notification_mute.png
deleted file mode 100644 (file)
index 25b05ab..0000000
Binary files a/resource/icons/sound_slider_icon_notification_mute.png and /dev/null differ
diff --git a/resource/icons/sound_slider_icon_notification_vibrate.png b/resource/icons/sound_slider_icon_notification_vibrate.png
deleted file mode 100644 (file)
index 779895f..0000000
Binary files a/resource/icons/sound_slider_icon_notification_vibrate.png and /dev/null differ
diff --git a/resource/icons/sound_slider_icon_system.png b/resource/icons/sound_slider_icon_system.png
deleted file mode 100644 (file)
index bd1fc15..0000000
Binary files a/resource/icons/sound_slider_icon_system.png and /dev/null differ
diff --git a/resource/icons/sound_slider_icon_system_mute.png b/resource/icons/sound_slider_icon_system_mute.png
deleted file mode 100644 (file)
index 25b05ab..0000000
Binary files a/resource/icons/sound_slider_icon_system_mute.png and /dev/null differ
diff --git a/resource/icons/sound_slider_icon_system_vibrate.png b/resource/icons/sound_slider_icon_system_vibrate.png
deleted file mode 100644 (file)
index 779895f..0000000
Binary files a/resource/icons/sound_slider_icon_system_vibrate.png and /dev/null differ
diff --git a/resource/icons/sound_slider_icon_volume.png b/resource/icons/sound_slider_icon_volume.png
deleted file mode 100644 (file)
index bd1fc15..0000000
Binary files a/resource/icons/sound_slider_icon_volume.png and /dev/null differ
diff --git a/resource/icons/sound_slider_icon_volume_mute.png b/resource/icons/sound_slider_icon_volume_mute.png
deleted file mode 100644 (file)
index 25b05ab..0000000
Binary files a/resource/icons/sound_slider_icon_volume_mute.png and /dev/null differ
diff --git a/resource/icons/sound_slider_icon_volume_vibrate.png b/resource/icons/sound_slider_icon_volume_vibrate.png
deleted file mode 100644 (file)
index 779895f..0000000
Binary files a/resource/icons/sound_slider_icon_volume_vibrate.png and /dev/null differ
index 35a0c565d73efa70d8abc705d28b81f111ffbe47..63627b608c38189e5182efa50168236f21eb47c7 100755 (executable)
@@ -74,5 +74,6 @@ extern const char *get_font_size_str(int value);
 extern char *get_pa_backlight_time_value_str();
 
 extern const char *setting_get_resource_path(const char *filename);
+extern bool isZero(double val);
 
 #endif                         /* __SETTING_COMMON_GENERAL_FUNC_H__ */
index d74c9b0e32654ca7d9c654a2fee6c0d227d455c2..b43cfaca84d3ba0e31487fd0b884abc3202b3b91 100755 (executable)
@@ -27,6 +27,8 @@
 #include "setting-cfg.h"
 #include <pkgmgr-info.h>
 
+#define EPISLON 10e-5
+
 EXPORT_PUBLIC
 char *get_application_default_icon(const char *appid)
 {
@@ -922,3 +924,13 @@ const char *setting_get_resource_path(const char *filename)
        free(app_res_path);
        return path_str;
 }
+
+EXPORT_PUBLIC
+extern bool isZero(double val)
+{
+       if (fabs(val) < EPISLON)
+       {
+               return true;
+       }
+       return false;
+}
index 480cc06fcb31cf841905cd7f0828def6bd1b5521..27641a084960d9485b1c65e12a0351d72e5b84c2 100644 (file)
        _TZ_SYS_GLOBALUSER_DATA"/settings/Ringtones/ringtone_sdk.mp3"
 #define SUPPORT_PLAYER_ASYNC 1
 
-/*Call ringtone:3 icon status */
-#define ICON_CALL_VIB \
-       SETTING_PROFILE_ICON_PATH_CFG"sound_slider_icon_volume_vibrate.png"
-#define ICON_CALL_NORMAL \
-       SETTING_PROFILE_ICON_PATH_CFG"sound_slider_icon_incoming_call.png"
-#define ICON_CALL_MUTE \
-       SETTING_PROFILE_ICON_PATH_CFG"sound_slider_icon_volume_mute.png"
-
-/*Notification: 2 icon status */
-#define ICON_NOTI_VIB \
-       SETTING_PROFILE_ICON_PATH_CFG"sound_slider_icon_notification_vibrate.png"
-#define ICON_NOTI_MUTE \
-       SETTING_PROFILE_ICON_PATH_CFG"sound_slider_icon_notification_mute.png"
-#define ICON_NOTI_NORMAL \
-       SETTING_PROFILE_ICON_PATH_CFG"sound_slider_icon_notification.png"
-
-/*Media: 2 icon status */
-#define ICON_MEDIA_MUTE                SETTING_PROFILE_ICON_PATH_CFG"sound_slider_icon_volume_mute.png"
-#define ICON_MEDIA_NORMAL      SETTING_PROFILE_ICON_PATH_CFG"sound_slider_icon_volume.png"
-
-/*System:2 icon status */
-#define ICON_SYSTEM_MUTE \
-       SETTING_PROFILE_ICON_PATH_CFG"sound_slider_icon_system_mute.png"
-#define ICON_SYSTEM_NORMAL \
-       SETTING_PROFILE_ICON_PATH_CFG"sound_slider_icon_system.png"
+/* General sound icon */
+#define ICON_DEFAULT_MUTE \
+       SETTING_PROFILE_ICON_PATH_CFG"sound_slider_icon_default_mute.png"
+#define ICON_DEFAULT_NORMAL \
+       SETTING_PROFILE_ICON_PATH_CFG"sound_slider_icon_default.png"
+#define ICON_DEFAULT_VIBRATION \
+       SETTING_PROFILE_ICON_PATH_CFG"sound_slider_icon_default_vibrate.png"
 
 #define GLOBAL_RESOURCE_ALERTS_DIR _TZ_SYS_GLOBALUSER_DATA"/settings/Alerts/"
 #define GLOBAL_RESOURCE_RINGTONES_DIR _TZ_SYS_GLOBALUSER_DATA"/settings/Ringtones/"
@@ -157,12 +139,14 @@ void setting_sound_key_grab(SettingSoundData *ad);
 void setting_sound_key_ungrab(SettingSoundData *ad);
 char *setting_media_basename(const char *path);
 void setting_sound_create_warning_popup_during_call(void *data);
-char *setting_sound_get_slider_icon(int type, int volume);
+const char *setting_sound_get_slider_icon(int type, int volume);
 void setting_sound_update_slider_icon(Setting_GenGroupItem_Data *item_data,
                int type);
 Evas_Object *setting_sound_init(SettingSoundData *ad);
 void setting_sound_deinit(void *data);
 const char *setting_notifiaction_on_lock_screen(void *data);
 void setting_sound_update_notifiaction_on_lock_screen_item(void *data);
+void setting_sound_set_item_enabled(Setting_GenGroupItem_Data *item_data, bool state);
+void setting_sound_update_item(Setting_GenGroupItem_Data *item_data);
 
 #endif
index 84269cdf43e390ebd2e1c3b1d5517d5e187735d8..02077c0481837b5dbaecae0bca56dc26309876de 100755 (executable)
 #include <player.h>
 #include "setting-profile-other-sounds-view.h"
 #include "setting-profile-sound-mode-view.h"
+#include "setting-profile-sound-mode.h"
 
 #define SETTING_DEFAULT_FOLDER_PATH    _TZ_SYS_GLOBALUSER_DATA"/settings/"
 #define SDCARD_PATH    _TZ_SYS_MEDIA"/sdcard/"
 #define EXP 0.001
 
-typedef struct _SliderIcons {
-       int index;
-       char mute[256];
-       char volume[256];
-} SliderIcons;
-
-SliderIcons slider_icons[SND_SLIDER_MAX] = {
-       {SND_SLIDER_CALL,       ICON_CALL_MUTE,         ICON_CALL_NORMAL},
-       {SND_SLIDER_NOTI,       ICON_NOTI_MUTE,         ICON_NOTI_NORMAL},
-       {SND_SLIDER_MEDIA,      ICON_MEDIA_MUTE,        ICON_MEDIA_NORMAL},
-       {SND_SLIDER_SYSTEM,     ICON_SYSTEM_MUTE,       ICON_SYSTEM_NORMAL}
-};
-
 static void __mm_player_prepared_cb(void *user_data);
 static void __sound_stream_focus_state_changed_cb(
                sound_stream_info_h stream_info,
@@ -76,43 +64,58 @@ void setting_sound_update_notifiaction_on_lock_screen_item(void *data)
        elm_genlist_item_update(ad->data_notifiaction_on_lock_screen->item);
 }
 
-char *setting_sound_get_slider_icon(int type, int volume)
+static const char *setting_sound_get_default_slider_icon(sound_mode_e mode, int volume)
+{
+       bool muted = volume <= 0;
+
+       switch (mode)
+       {
+               case SOUND_MODE_SOUND:
+                       return muted ? ICON_DEFAULT_MUTE : ICON_DEFAULT_NORMAL;
+               case SOUND_MODE_VIBRATE:
+                       return ICON_DEFAULT_VIBRATION;
+               case SOUND_MODE_MUTE:
+                       return ICON_DEFAULT_MUTE;
+               default:
+                       return NULL;
+       }
+}
+
+static char *setting_sound_get_media_slider_icon(sound_mode_e mode, int volume)
+{
+       bool muted = volume <= 0;
+
+       switch (mode)
+       {
+               case SOUND_MODE_SOUND:
+                       return muted ? ICON_DEFAULT_MUTE : ICON_DEFAULT_NORMAL;
+               case SOUND_MODE_MUTE:
+               case SOUND_MODE_VIBRATE:
+                       return ICON_DEFAULT_MUTE;
+               default:
+                       return NULL;
+       }
+}
+
+const char *setting_sound_get_slider_icon(int type, int volume)
 {
        if (type < SND_SLIDER_CALL || type >= SND_SLIDER_MAX)
                return NULL;
 
        SETTING_TRACE("type : %d, volume : %d", type, volume);
-       /* 1.Call ringtone and notification have 3 icon status */
-       if (SND_SLIDER_CALL == type || SND_SLIDER_NOTI == type) {
-               /*special process */
-               int sound = 0;
-               int vibration = 0;
-               vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &sound);
-               vconf_get_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL,
-                               &vibration);
-
-               if (sound && !vibration) {
-                       return (SND_SLIDER_CALL == type ?
-                                       ICON_CALL_NORMAL : ICON_NOTI_NORMAL);
-               }
-
-               if (vibration && !sound) {
-                       return (SND_SLIDER_CALL == type ? ICON_CALL_VIB : ICON_NOTI_VIB);
-               }
-
-               if (!vibration && !sound) {
-                       return (SND_SLIDER_CALL == type ? ICON_CALL_MUTE : ICON_NOTI_MUTE);
-               }
-
-               return (SND_SLIDER_CALL == type ?
-                               ICON_CALL_NORMAL : ICON_NOTI_NORMAL);
+       sound_mode_e current_mode = setting_profile_get_sound_mode();
+
+       switch (type)
+       {
+               case SND_SLIDER_CALL:
+               case SND_SLIDER_NOTI:
+               case SND_SLIDER_SYSTEM:
+                       return setting_sound_get_default_slider_icon(current_mode, volume);
+               case SND_SLIDER_MEDIA:
+                       return setting_sound_get_media_slider_icon(current_mode, volume);
+               default:
+                       return NULL;
        }
-
-       /* 2.Other types, just have two icon status */
-       if (volume > 0)
-               return slider_icons[type].volume;
-       else
-               return slider_icons[type].mute;
 }
 
 void setting_sound_update_slider_icon(Setting_GenGroupItem_Data *item_data,
@@ -121,12 +124,16 @@ void setting_sound_update_slider_icon(Setting_GenGroupItem_Data *item_data,
        SETTING_TRACE_BEGIN;
        ret_if(!item_data || !item_data->eo_check);
 
+       const char *new_file = setting_sound_get_slider_icon(type,
+                       item_data->chk_status);
+
        Evas_Object *icon = elm_object_content_get(item_data->eo_check);
        if (icon) {
-               char *new_file = setting_sound_get_slider_icon(type,
-                               item_data->chk_status);
                elm_image_file_set(icon, new_file, NULL);
        }
+
+       G_FREE(item_data->l_swallow_path);
+       item_data->l_swallow_path = new_file ? (char *)g_strdup(new_file) : NULL;
 }
 
 char *setting_media_basename(const char *path)
@@ -669,172 +676,11 @@ static Evas_Object *__sound_slider_icon_get(void *data, Evas_Object *obj,
                elm_object_part_text_set(layout, "elm.text", _(item_data->keyStr));
 
        elm_object_part_content_set(layout, "elm.swallow.content", slider);
-       return layout;
-}
-
-static void __enable_sound_menu(void *data)
-{
-       SETTING_TRACE_BEGIN;
-       ret_if(!data);
-       SettingSoundData *ad = data;
-       ad->sound_on = TRUE;
-       Setting_GenGroupItem_Data *item_to_update = NULL;
-
-
-       /*1.Enable "Vibrate when ringing" */
-       if (ad->data_sound_when_ring) {
-               item_to_update = ad->data_sound_when_ring;
-               elm_object_item_disabled_set(item_to_update->item, EINA_FALSE);
-       }
-
-       if (ad->data_call_volume) {
-               elm_object_item_disabled_set(ad->data_call_volume->item,
-                               EINA_FALSE);
-               elm_object_disabled_set(ad->data_call_volume->eo_check,
-                               EINA_FALSE);
-       }
-
-       /*2.Enable "Notification", via Sound Manager */
-       item_to_update = ad->data_noti_volume;
-
-       /* @todo make sure data_msg_alert_tone is correct for 'Silent' set.
-       if (item_to_update && safeStrCmp(item_to_update->sub_desc, "Silent"))*/
-       if ((ad->data_msg_alert_tone &&
-               safeStrCmp(ad->data_msg_alert_tone->sub_desc, "Silent")) ||
-               (!safeStrCmp(ad->viewtype, VOLUME_APP_NAME))
-               ) {
-               /* Enable */
-               if (item_to_update
-                               && item_to_update->item
-                               && item_to_update->eo_check) {
-                       int mm_value = 0;
-                       int ret =  sound_manager_get_volume(
-                                       SOUND_TYPE_NOTIFICATION, &mm_value);
-                       SETTING_TRACE("ret:%d", ret);
-                       item_to_update->chk_status = mm_value;
-                       elm_slider_value_set(
-                                       item_to_update->eo_check,
-                                       item_to_update->chk_status);
-                       elm_object_item_disabled_set(item_to_update->item,
-                                       EINA_FALSE);
-                       elm_object_disabled_set(item_to_update->eo_check,
-                                       EINA_FALSE);
-
-                       setting_sound_update_slider_icon(
-                                       item_to_update, SND_SLIDER_NOTI);
-               }
-       }
-
-       /*3.Enable "System", via Sound Manager */
-       item_to_update = ad->data_touch_volume;
-       if (item_to_update && item_to_update->item
-                       && item_to_update->eo_check) {
-               int mm_value = 0;
-               int ret =  sound_manager_get_volume(
-                               SOUND_TYPE_SYSTEM, &mm_value);
-               SETTING_TRACE("ret:%d", ret);
-               item_to_update->chk_status = mm_value;
-               elm_slider_value_set(
-                               item_to_update->eo_check,
-                               item_to_update->chk_status);
-               elm_object_item_disabled_set(
-                               item_to_update->item, EINA_FALSE);
-               elm_object_disabled_set(item_to_update->eo_check, EINA_FALSE);
-
-               setting_sound_update_slider_icon(
-                               item_to_update, SND_SLIDER_SYSTEM);
-       }
-
-
-       /*4.Enable "Call ringtone", via "Backuped" value */
-       item_to_update = ad->data_call_volume;
-       if (item_to_update && item_to_update->eo_check) {
-               SETTING_TRACE("....ad->is_ringtone_slidering:%d, "
-                               "ad->data_call_volume->chk_status:%d",
-                               ad->is_ringtone_slidering,
-                               item_to_update->chk_status);
-               /* do need to restore from BACKUP VOLUME */
-               if (ad->is_ringtone_slidering) return;
-
-               int mm_value = 0;
-               sound_manager_get_volume(SOUND_TYPE_RINGTONE, &mm_value);
-               if (mm_value <= 0) mm_value = 1;
-               sound_manager_set_volume(SOUND_TYPE_RINGTONE, mm_value);
-               item_to_update->chk_status = mm_value;
-               elm_slider_value_set(
-                               item_to_update->eo_check,
-                               item_to_update->chk_status);
-               SETTING_TRACE("ad->data_call_volume->chk_status : %d",
-                               item_to_update->chk_status);
-       }
-}
-
-static void __disable_sound_menu(void *data)
-{
-       SETTING_TRACE_BEGIN;
-       ret_if(!data);
-       SettingSoundData *ad = data;
-       ad->sound_on = FALSE;
-       Setting_GenGroupItem_Data *item_to_update = NULL;
-
-       setting_sound_stop_sound(ad);
 
-       /*1.Disable      "Vibrate when ringing" */
-       item_to_update = ad->data_sound_when_ring;
-       if (item_to_update)
-               elm_object_item_disabled_set(item_to_update->item, EINA_TRUE);
-
-       /* Disable Call Volume slider if Silent ringtone is selected */
-       if (ad->data_call_alert_tone && !safeStrCmp(
-                       ad->data_call_alert_tone->sub_desc, "Silent")) {
-               elm_object_item_disabled_set(ad->data_call_volume->item,
-                               EINA_TRUE);
-               elm_object_disabled_set(ad->data_call_volume->eo_check,
-                               EINA_TRUE);
-       }
-
-       /*2.Disable "Notification" */
-       item_to_update = ad->data_noti_volume;
-       if (item_to_update && item_to_update->item
-                       && item_to_update->eo_check) {
-               item_to_update->chk_status = 0;
-               elm_slider_value_set(item_to_update->eo_check,
-                               item_to_update->chk_status);
-               elm_object_item_disabled_set(item_to_update->item, EINA_TRUE);
-               elm_object_disabled_set(item_to_update->eo_check, EINA_TRUE);
-
-               /* Change notification slider's icon as mute style */
-               setting_sound_update_slider_icon(item_to_update,
-                               SND_SLIDER_NOTI);
-       }
-
-       /*3.Disable "System" */
-       item_to_update = ad->data_touch_volume;
-       if (item_to_update && item_to_update->item
-                       && item_to_update->eo_check) {
-               item_to_update->chk_status = 0;
-               elm_slider_value_set(item_to_update->eo_check,
-                               item_to_update->chk_status);
-               elm_object_item_disabled_set(item_to_update->item, EINA_TRUE);
-               elm_object_disabled_set(item_to_update->eo_check, EINA_TRUE);
-
-               /* Change system slider's icon as mute style */
-               setting_sound_update_slider_icon(item_to_update,
-                               SND_SLIDER_SYSTEM);
-       }
-
-       /*4.Disable "Call ringtone" */
-       item_to_update = ad->data_call_volume;
-       if (item_to_update && item_to_update->eo_check) {
-               /*DO NOT CHANGE Backup Values(
-                * VCONFKEY_SETAPPL_RINGTONE_BACKUP_VOLUME) */
-               item_to_update->chk_status = 0;
-               elm_slider_value_set(item_to_update->eo_check,
-                               item_to_update->chk_status);
-               SETTING_TRACE("item_to_update->chk_status : %d",
-                               item_to_update->chk_status);
-       }
+       if (elm_object_item_disabled_get(item_data->item))
+               elm_object_disabled_set(slider, EINA_TRUE);
 
+       return layout;
 }
 
 static void __sound_vconf_change_cb(keynode_t *key, void *data)
@@ -881,24 +727,14 @@ static void __sound_vconf_change_cb(keynode_t *key, void *data)
                        VCONFKEY_SETAPPL_SOUND_STATUS_BOOL)) {
                status = vconf_keynode_get_bool(key);
                SETTING_TRACE_DEBUG("sound status is changed. %d", status);
-               if (status)
-                       __enable_sound_menu(ad);
-               else
-                       __disable_sound_menu(ad);
-
-               setting_sound_update_slider_icon(ad->data_call_volume,
-                               SND_SLIDER_CALL);
-
+               setting_view_update(&setting_view_sound_main, ad);
                if (ad->data_sound_when_ring)
                        elm_object_item_disabled_set(ad->data_sound_when_ring->item,
                                                                                !status);
        } else if (!safeStrCmp(vconf_name,
                        VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL)) {
-               status = vconf_keynode_get_bool(key);
                SETTING_TRACE_DEBUG("vibration status is changed. %d", status);
-
-               setting_sound_update_slider_icon(ad->data_call_volume,
-                               SND_SLIDER_CALL);
+               setting_view_update(&setting_view_sound_main, ad);
        } else if (!safeStrCmp(vconf_name,
                        VCONFKEY_SETAPPL_VIBRATE_WHEN_RINGING_BOOL)) {
                item_to_update = ad->data_sound_when_ring;
@@ -1310,4 +1146,16 @@ static void __sound_stream_focus_state_changed_cb(
        }
 }
 
+void setting_sound_set_item_enabled(Setting_GenGroupItem_Data *item_data, bool enabled)
+{
+       Eina_Bool val = enabled ? EINA_FALSE : EINA_TRUE;
 
+       elm_object_item_disabled_set(item_data->item, val);
+       if (item_data->eo_check)
+               elm_object_disabled_set(item_data->eo_check, val);
+}
+
+void setting_sound_update_item(Setting_GenGroupItem_Data *item_data)
+{
+       elm_genlist_item_update(item_data->item);
+}
index 9b8614253b1ad4cc7a06cd566c0347b4624758ba..9c6c72c2acd076b1a9dc6cecdc0c979fe3f7eca0 100755 (executable)
                                NULL,\
                                NULL, \
                                SWALLOW_Type_LAYOUT_SLIDER,\
-                               l_img, \
+                               (char*)l_img, \
                                r_img,\
                                value,\
                                keystr,\
 
 static int _view_create(void *cb);
 static int _view_destroy(void *cb);
+static int _view_update(void *cb);
 static Eina_Bool _view_pop_cb(void *data, Elm_Object_Item *it);
 static void _create_myfile_ug(SettingSoundData *ad, char *titleID);
 
 setting_view setting_view_sound_main = {
        .create = _view_create,
        .destroy = _view_destroy,
-       .update = NULL,
+       .update = _view_update,
        .cleanup = NULL
 };
 
@@ -422,6 +423,21 @@ void _stop_change_cb(void *data, Evas_Object *obj, void *event_info)
        SETTING_TRACE_END;
 }
 
+void _stop_system_change_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       SETTING_TRACE_BEGIN;
+
+       _stop_change_cb(data, obj, event_info);
+
+       double val = elm_slider_value_get(obj);
+       if (isZero(val))
+       {
+               setting_profile_set_sound_mode(SOUND_MODE_MUTE);
+       }
+
+       SETTING_TRACE_END;
+}
+
 static void __genlist_item_sound_mode_clicked_cb(void *data, Evas_Object *obj, void *event_info)
 {
        SettingSoundData *gd = data;
@@ -451,7 +467,7 @@ static void _get_lite_main_list(void *data)
        SettingSoundData *ad = (SettingSoundData *)data;
 
        char *app_id = NULL;
-       char *left_icon = NULL;
+       const char *left_icon = NULL;
        int mm_value = 0;
        int sound_value = 0;
        int ret = 0;
@@ -585,8 +601,6 @@ static void _get_lite_main_list(void *data)
                SETTING_TRACE_DEBUG("Fail to get volume");
                mm_value = SETTING_DEFAULT_SYSTEM_VOL_INT;
        }
-       if (sound_value == FALSE)
-               mm_value = 0;
 
        /* separator */
        setting_create_Gendial_field_titleItem(
@@ -659,29 +673,13 @@ static void _get_lite_main_list(void *data)
                        mm_value, "", ad,
                        _sys_slider_change_cb,
                        max_system_vol,
-                       _start_change_cb, _stop_change_cb);
+                       _start_change_cb, _stop_system_change_cb);
 
        __BACK_POINTER_SET(ad->data_touch_volume);
 
        free(app_id);
        app_id = NULL;
 
-       /* Disable Notification slider if Silent ringtone is selected */
-       if (ad->data_noti_volume
-                       && ad->data_msg_alert_tone
-                       && !safeStrCmp(ad->data_msg_alert_tone->sub_desc, SILENT_MODE)) {
-               elm_object_item_disabled_set(ad->data_noti_volume->item, EINA_TRUE);
-               elm_object_disabled_set(ad->data_noti_volume->eo_check, EINA_TRUE);
-       }
-
-       if (!sound_value) {
-               if (ad->data_noti_volume)
-                       elm_object_item_disabled_set(ad->data_noti_volume->item,
-                                                                               EINA_TRUE);
-               if (ad->data_touch_volume)
-                       elm_object_item_disabled_set(ad->data_touch_volume->item,
-                                                                               EINA_TRUE);
-       }
 }
 
 static void _click_softkey_back_cb(void *data,
@@ -723,6 +721,8 @@ static int _view_create(void *cb)
 
        setting_view_sound_main.is_create = TRUE;
 
+       setting_view_update(&setting_view_sound_main, ad);
+
        SETTING_TRACE_END;
        return SETTING_RETURN_SUCCESS;
 }
@@ -956,3 +956,42 @@ static void _create_myfile_ug(SettingSoundData *ad, char *titleID)
        app_control_destroy(svc);
        free(pa_cur_ringtone);
 }
+
+static int _view_update(void *data)
+{
+       SETTING_TRACE_BEGIN;
+
+       SettingSoundData *appdata = (SettingSoundData *) data;
+       sound_mode_e current_mode = setting_profile_get_sound_mode();
+
+       free(appdata->sound_mode->sub_desc);
+       appdata->sound_mode->sub_desc = strdup(setting_profile_sound_mode_to_string(current_mode));
+       setting_sound_update_item(appdata->sound_mode);
+
+       switch (current_mode)
+       {
+               case SOUND_MODE_SOUND:
+                       setting_sound_set_item_enabled(appdata->data_media_volume, TRUE);
+                       setting_sound_set_item_enabled(appdata->data_noti_volume, TRUE);
+                       setting_sound_set_item_enabled(appdata->data_touch_volume, TRUE);
+                       break;
+               case SOUND_MODE_VIBRATE:
+                       setting_sound_set_item_enabled(appdata->data_media_volume, FALSE);
+                       setting_sound_set_item_enabled(appdata->data_noti_volume, TRUE);
+                       setting_sound_set_item_enabled(appdata->data_touch_volume, FALSE);
+                       break;
+               case SOUND_MODE_MUTE:
+                       setting_sound_set_item_enabled(appdata->data_media_volume, FALSE);
+                       setting_sound_set_item_enabled(appdata->data_noti_volume, FALSE);
+                       setting_sound_set_item_enabled(appdata->data_touch_volume, FALSE);
+                       break;
+       }
+
+       setting_sound_update_slider_icon(appdata->data_media_volume, SND_SLIDER_MEDIA);
+       setting_sound_update_slider_icon(appdata->data_noti_volume, SND_SLIDER_NOTI);
+       setting_sound_update_slider_icon(appdata->data_touch_volume, SND_SLIDER_SYSTEM);
+
+       SETTING_TRACE_END;
+
+       return SETTING_RETURN_SUCCESS;
+}
index c81b53348ed8174f6fd7e3688395e0b1d7a1b906..ffa3a7bc305737ec7a60542934874afeaab479ff 100644 (file)
@@ -64,9 +64,6 @@ static void item_selected_cb(void *data, Evas_Object *obj, void *event_info)
 
        setting_profile_set_sound_mode(item->mode);
        elm_radio_value_set(item_data->eo_check, item_data->chk_status);
-       // update genlist item on previous page
-       g_ad->sound_mode->sub_desc = strdup(setting_profile_sound_mode_to_string(item->mode));
-       elm_genlist_item_update(g_ad->sound_mode->item);
 
        SETTING_TRACE_END;
 }