From: Rahul Dadhich Date: Mon, 12 Dec 2016 07:44:04 +0000 (+0530) Subject: Corrected coding guidlines X-Git-Tag: submit/tizen_3.0/20161215.031643~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=be68726139c1b9e85bed6c96ae3d925a6da06065;p=profile%2Fmobile%2Fapps%2Fnative%2Fmusic-player.git Corrected coding guidlines Change-Id: Ib1b124e4cbb08f3f6d615067eca2a2d464a29b93 Signed-off-by: Rahul Dadhich --- diff --git a/inc/mp-common-defs.h b/inc/mp-common-defs.h index 60e7d11..6aa48b4 100644 --- a/inc/mp-common-defs.h +++ b/inc/mp-common-defs.h @@ -41,11 +41,11 @@ #define MP_MY_MUSIC "my_music" //ug-music-player request type -#define MC_REQ_TYPE_KEY MP_REQ_TYPE +#define MC_REQ_TYPE_KEY MP_REQ_TYPE -#define MC_REQ_SHORT_ALBUM_VAL "SC_Album" +#define MC_REQ_SHORT_ALBUM_VAL "SC_Album" #define MC_REQ_SHORT_ARTIST_VAL "SC_Artist" -#define MC_REQ_SHORT_PLAYLIST_VAL "SC_Playlist" +#define MC_REQ_SHORT_PLAYLIST_VAL "SC_Playlist" #define MC_REQ_SELECT_SINGLE "Select" #define MC_REQ_SELECT_SINGLE_RINGTONE "SelectRingtone" #define MC_REQ_SELECT_MULTI "MultipleSelect" @@ -60,13 +60,13 @@ //ug-music-player host app type #define MC_REQ_SHOW_RECOMMENDED_KEY MP_HOST_TYPE -#define MC_SHOW_VAL "show" -#define MC_HIDE_VAL "hide" +#define MC_SHOW_VAL "show" +#define MC_HIDE_VAL "hide" typedef enum { DEVICE, MMC -}storage_mode_e; +} storage_mode_e; //1 Do not change default thumbnail path. it's shared by other apps #define DEFAULT_THUMBNAIL "default_album_art_120.png" @@ -83,9 +83,9 @@ typedef enum { MP_ADD_TO_HOME_SHORTCUT_TYPE_USER_PLAYLIST, MP_ADD_TO_HOME_SHORTCUT_TYPE_ALBUM, MP_ADD_TO_HOME_SHORTCUT_TYPE_NUM, -}MpShortcutType_e; +} MpShortcutType_e; -#define MP_ADD_TO_HOME_SHORTCUT_PREFIX "_Shortcut:MusicPlayer://" +#define MP_ADD_TO_HOME_SHORTCUT_PREFIX "_Shortcut:MusicPlayer://" #define MP_ADD_TO_HOME_SHORTCUT_FIELD_DELIMETER "|" #define MP_ADD_TO_HOME_SHORTCUT_FIELD_NUM 4 @@ -121,24 +121,29 @@ typedef enum { #define MP_NOWPLAYING_INI_FILE_NAME "now_playing.ini" -#define MP_AUTO_PLAYLIST_ITEM_MAX 50 +#define MP_AUTO_PLAYLIST_ITEM_MAX 50 #define FACTORY_MUSIC "/opt/usr/media/Sounds/Over the horizon.mp3" static int device_id = -1; static int mmc_id = -1; -static void mp_lower_string(char *str) { +static void mp_lower_string(char *str) +{ int i = 0; - while(str[i] != '\0') { + while (str[i] != '\0') { if (str[i] >= 'A' && str[i] <= 'Z') { str[i] = str[i] + 32; } - i++; + i++; } } -static bool __mp_get_all_supported_storage_cb(int storageId, storage_type_e type, storage_state_e state, const char *path, void *userData) +static bool __mp_get_all_supported_storage_cb(int storageId, + storage_type_e type, + storage_state_e state, + const char *path, + void *userData) { char *temp_path = g_strdup(path); @@ -161,7 +166,9 @@ static bool __mp_get_all_supported_storage_cb(int storageId, storage_type_e type static inline char *Get_Root_Path(int storage_type, storage_mode_e smode) { char *path = NULL; - int error_code = storage_foreach_device_supported(__mp_get_all_supported_storage_cb, NULL); + int error_code = + storage_foreach_device_supported(__mp_get_all_supported_storage_cb, + NULL); if (error_code != STORAGE_ERROR_NONE) { ERROR_TRACE("failed to get storage Id"); return NULL; @@ -179,18 +186,18 @@ static inline char *Get_Root_Path(int storage_type, storage_mode_e smode) #define MP_PHONE_ROOT_PATH Get_Root_Path(STORAGE_TYPE_INTERNAL, DEVICE); #define MP_MMC_ROOT_PATH Get_Root_Path(STORAGE_TYPE_EXTERNAL, MMC) -#define CONTROLLER_REW_SOURCE "control_previous" -#define CONTROLLER_FF_SOURCE "control_next" +#define CONTROLLER_REW_SOURCE "control_previous" +#define CONTROLLER_FF_SOURCE "control_next" #define PLAY_TIME_ARGS(t) \ - (((int)(t)) / 60) % 60, \ - ((int)(t)) % 60 + (((int)(t)) / 60) % 60, \ + ((int)(t)) % 60 #define PLAY_TIME_FORMAT "02u:%02u" #define MUSIC_TIME_ARGS(t) \ - ((int)(t)) / (3600), \ - (((int)(t)) / 60) % 60, \ - ((int)(t)) % 60 + ((int)(t)) / (3600), \ + (((int)(t)) / 60) % 60, \ + ((int)(t)) % 60 #define MUSIC_TIME_FORMAT "02u:%02u:%02u" #endif diff --git a/inc/mp-images.h b/inc/mp-images.h index 10d38a4..632cf45 100644 --- a/inc/mp-images.h +++ b/inc/mp-images.h @@ -16,31 +16,31 @@ //2 icons directly installed to res/image #define ICON_DIRECTORY SHAREDDIR"/res/shared_images" -#define MORE_BTN_DIR "more icon" +#define MORE_BTN_DIR "more icon" #define STORAGE_TYPE_DIR "storage_type" -#define MP_LITE_PAUSE_ICON "lite/play_list_control_pause.png" -#define MP_LITE_PLAY_ICON "lite/play_list_control_play.png" -#define MP_LITE_SHUFFLE_ICON "lite/Icon/play_icon_shuffle.png" -#define MP_LITE_REORDER_ICON "lite/core_button_reorder.png" +#define MP_LITE_PAUSE_ICON "lite/play_list_control_pause.png" +#define MP_LITE_PLAY_ICON "lite/play_list_control_play.png" +#define MP_LITE_SHUFFLE_ICON "lite/Icon/play_icon_shuffle.png" +#define MP_LITE_REORDER_ICON "lite/core_button_reorder.png" #define NOCONTENT_MULTIMEDIA "T02_Nocontents_multimedia.png" -#define THUMBNAIL_MOST_PLAYED ICON_DIRECTORY"/T02_playlist_most_played.png" +#define THUMBNAIL_MOST_PLAYED ICON_DIRECTORY"/T02_playlist_most_played.png" #define THUMBNAIL_RECENTLY_PLAYED ICON_DIRECTORY"/T02_playlist_recently_played.png" -#define THUMBNAIL_RECENTLY_ADDED ICON_DIRECTORY"/T02_playlist_recently_added.png" -#define THUMBNAIL_QUICK_LIST ICON_DIRECTORY"/T02_playlist_starred.png" +#define THUMBNAIL_RECENTLY_ADDED ICON_DIRECTORY"/T02_playlist_recently_added.png" +#define THUMBNAIL_QUICK_LIST ICON_DIRECTORY"/T02_playlist_starred.png" -#define LIVE_THUMBNAIL_MOST_PLAYED "2x2_music_yellow.png" +#define LIVE_THUMBNAIL_MOST_PLAYED "2x2_music_yellow.png" #define LIVE_THUMBNAIL_RECENTLY_PLAYED "2x2_music_green.png" #define LIVE_THUMBNAIL_RECENTLY_ADDED "2x2_music_blue.png" -#define LIVE_THUMBNAIL_QUICK_LIST "2x2_music_red.png" +#define LIVE_THUMBNAIL_QUICK_LIST "2x2_music_red.png" -#define LIVE_ICON_MOST_PLAYED "music_icon_most.png" +#define LIVE_ICON_MOST_PLAYED "music_icon_most.png" #define LIVE_ICON_RECENTLY_PLAYED "music_icon_recently_play.png" -#define LIVE_ICON_RECENTLY_ADDED "music_icon_recently_add.png" -#define LIVE_ICON_QUICK_LIST "music_icon_favourites.png" +#define LIVE_ICON_RECENTLY_ADDED "music_icon_recently_add.png" +#define LIVE_ICON_QUICK_LIST "music_icon_favourites.png" #define MP_ICON_ALLSHARE_FOLDER "myfile_icon_folder.png" @@ -49,10 +49,10 @@ #define MP_ICON_STORAGE_PHONE STORAGE_TYPE_DIR"/T02_phone_02.png" #define MP_ICON_STORAGE_MEMORY STORAGE_TYPE_DIR"/play_list_ic_folder.png" #define MP_ICON_STORAGE_EXTERNAL STORAGE_TYPE_DIR"/T02_external_storage_02.png" -#define MP_ICON_SQUARE_CELL_NORMAL "square/T02_square_cell_nor.png" -#define MP_ICON_SQUARE_CELL_SELECTED "square/T02_square_cell_press_bg.png" -#define MP_ICON_SQUARE_CELL_NORMAL_LD "square/T02_square_cell_nor_h.png" -#define MP_ICON_SQUARE_CELL_SELECTED_LD "square/T02_square_cell_press_effect_h.png" +#define MP_ICON_SQUARE_CELL_NORMAL "square/T02_square_cell_nor.png" +#define MP_ICON_SQUARE_CELL_SELECTED "square/T02_square_cell_press_bg.png" +#define MP_ICON_SQUARE_CELL_NORMAL_LD "square/T02_square_cell_nor_h.png" +#define MP_ICON_SQUARE_CELL_SELECTED_LD "square/T02_square_cell_press_effect_h.png" #define MP_ICON_VOLUME_MIN "T02_volume_icon_01.png" #define MP_ICON_VOLUME_MAX "T02_volume_icon_02.png" @@ -67,10 +67,10 @@ #define MP_ICON_NEARBY_DMR "player-view/T01_2_icon_Near_by_device.png" #define MP_ICON_NEARBY_DMR_PRESS "player-view/T01_2_icon_Near_by_device_press.png" #define MP_ICON_MINI_PLAYER "mini_app/T02_control_icon_apps.png" -//#define MP_ICON_VIDEO_PLAY "T02_Video_play.png" -//#define MP_ICON_TURNOVER_01 "turn_over/B15_turn_over_01.png" -//#define MP_ICON_TURNOVER_02 "turn_over/B15_turn_over_02.png" -//#define MP_ICON_TURNOVER_03 "turn_over/B15_turn_over_03.png" +//#define MP_ICON_VIDEO_PLAY "T02_Video_play.png" +//#define MP_ICON_TURNOVER_01 "turn_over/B15_turn_over_01.png" +//#define MP_ICON_TURNOVER_02 "turn_over/B15_turn_over_02.png" +//#define MP_ICON_TURNOVER_03 "turn_over/B15_turn_over_03.png" #define MP_ICON_PLAY_LIST_PATH "lite/player_icon_play_list_normal.png" #define MP_ICON_SELECT_ALL "00_icon_edit.png" #define MP_ICON_SEARCH "T02_icon_search.png" @@ -113,15 +113,15 @@ #define MP_PLAYER_MORE_BTN_GROUP_PLAY_IMAGE MORE_BTN_DIR"/T02_popup_icon_play_via_group_play.png" #define MP_PLAYER_MORE_BTN_MORE_THUMBNAIL_VIEW_IMAGE MORE_BTN_DIR"/T02_popup_icon_thumbnail_view.png" #define MP_PLAYER_MORE_BTN_MORE_LIST_VIEW_IMAGE MORE_BTN_DIR"/T02_popup_icon_list_view.png" -//#define MP_PLAYER_MORE_BTN_EDIT_IMAGE MORE_BTN_DIR"/T02_popup_icon_edit_image.png" +//#define MP_PLAYER_MORE_BTN_EDIT_IMAGE MORE_BTN_DIR"/T02_popup_icon_edit_image.png" #define MP_PLAYER_MORE_BTN_RENAME_IMAGE MORE_BTN_DIR"/T02_popup_icon_rename.png" #define MP_PLAYER_MORE_BTN_EDIT MORE_BTN_DIR"/T02_popup_icon_edit.png" #define MP_PLAYER_MORE_BTN_FOLDER_VIEW MORE_BTN_DIR"/T02_popup_icon_folder_view.png" #define MP_PLAYER_MORE_BTN_GO_TO_LIB MORE_BTN_DIR"/T02_popup_icon_go_to_library.png" #define MP_PLAYER_MORE_BTN_HELP MORE_BTN_DIR"/T02_popup_icon_help.png" -//#define MP_PLAYER_MORE_BTN_HIDE_MUSIC_VIEW MORE_BTN_DIR"/T02_popup_icon_hide_music_view.png" +//#define MP_PLAYER_MORE_BTN_HIDE_MUSIC_VIEW MORE_BTN_DIR"/T02_popup_icon_hide_music_view.png" #define MP_PLAYER_MORE_BTN_LIB_UPDATE MORE_BTN_DIR"/T02_popup_icon_library_update.png" -//#define MP_PLAYER_MORE_BTN_MAKE_AVAILABLE_OFFICE MORE_BTN_DIR"/T02_popup_icon_make_available_office.png" +//#define MP_PLAYER_MORE_BTN_MAKE_AVAILABLE_OFFICE MORE_BTN_DIR"/T02_popup_icon_make_available_office.png" #define MP_PLAYER_MORE_BTN_SQUARE MORE_BTN_DIR"/T02_popup_icon_music_square.png" #define MP_PLAYER_MORE_BTN_OPEN_PLAYLIST MORE_BTN_DIR"/T02_popup_icon_open_playlist.png" #define MP_PLAYER_MORE_BTN_PLAYLIST MORE_BTN_DIR"/T02_popup_icon_playlist.png" @@ -129,18 +129,18 @@ #define MP_PLAYER_MORE_BTN_SEARCH MORE_BTN_DIR"/T02_popup_icon_search.png" #define MP_PLAYER_MORE_BTN_SET_AS MORE_BTN_DIR"/T02_popup_icon_set_as.png" #define MP_PLAYER_MORE_BTN_SAVE_PLAYLIST MORE_BTN_DIR"/T02_popup_icon_save_playlist.png" -#define MP_PLAYER_MORE_BTN_SET_REORDER MORE_BTN_DIR"/T02_popup_icon_reorder.png" +#define MP_PLAYER_MORE_BTN_SET_REORDER MORE_BTN_DIR"/T02_popup_icon_reorder.png" #define MP_PLAYER_MORE_BTN_INFOMATION MORE_BTN_DIR"/T02_popup_icon_infomation.png" #define MP_PLAYER_MORE_BTN_SETTING MORE_BTN_DIR"/T02_popup_icon_settings.png" #define MP_PLAYER_MORE_BTN_SHARE MORE_BTN_DIR"/T02_popup_icon_share.png" #define MP_PLAYER_MORE_BTN_SHARE_VIA MORE_BTN_DIR"/T02_popup_icon_share_via.png" -//#define MP_PLAYER_MORE_BTN_SHOW_MUSIC_VIEW MORE_BTN_DIR"/T02_popup_icon_show_music_view.png" +//#define MP_PLAYER_MORE_BTN_SHOW_MUSIC_VIEW MORE_BTN_DIR"/T02_popup_icon_show_music_view.png" #define MP_PLAYER_MORE_BTN_SIGN MORE_BTN_DIR"/T02_popup_icon_sign.png" #define MP_PLAYER_MORE_BTN_SUPPORT MORE_BTN_DIR"/T02_popup_icon_support.png" #define MP_PLAYER_MORE_BTN_UPDATE MORE_BTN_DIR"/T02_popup_icon_update.png" #define MP_PLAYER_MORE_BTN_UPLOAD_FROM_DEVICE MORE_BTN_DIR"/T02_popup_icon_upload_from_device.png" #define MP_PLAYER_MORE_BTN_VIEW_AS MORE_BTN_DIR"/T02_popup_icon_view_as.png" -//#define MP_PLAYER_MORE_BTN_VIEW MORE_BTN_DIR"/T02_popup_icon_view.png" +//#define MP_PLAYER_MORE_BTN_VIEW MORE_BTN_DIR"/T02_popup_icon_view.png" #define MP_PLAYER_MORE_BTN_VIEW_END MORE_BTN_DIR"/T02_popup_icon_end.png" #define MP_PLAYER_MORE_BTN_ADD_TO_PERSONAL_PAGE MORE_BTN_DIR"/more_icon_add_to_personal_page.png" #define MP_PLAYER_MORE_BTN_REMOVE_FROM_PERSONAL_PAGE MORE_BTN_DIR"/more_icon_remove_from_personal_page.png" diff --git a/inc/mp-resource.h b/inc/mp-resource.h index f837481..52d7f42 100644 --- a/inc/mp-resource.h +++ b/inc/mp-resource.h @@ -17,7 +17,7 @@ #ifndef __MP_RESOURCE_H_ #define __MP_RESOURCE_H_ -#define STR_MP_TRACKS ("IDS_MUSIC_OPT_TRACKS") +#define STR_MP_TRACKS ("IDS_MUSIC_OPT_TRACKS") #define STR_MP_PLAYLISTS ("IDS_MUSIC_TAB4_PLAYLISTS") #define STR_MP_ALBUMS ("IDS_MUSIC_TAB4_ALBUMS") #define STR_MP_ARTISTS ("IDS_MUSIC_TAB4_ARTISTS") @@ -33,29 +33,29 @@ #define STR_MP_RECENTLY_PLAYED ("IDS_MUSIC_BODY_RECENTLY_PLAYED") #define STR_MP_FAVOURITES ("IDS_IV_BODY_FAVOURITE") -#define STR_MP_ADD_TO_FAVOURITES ("IDS_MUSIC_OPT_ADD_TO_FAVOURITES") +#define STR_MP_ADD_TO_FAVOURITES ("IDS_MUSIC_OPT_ADD_TO_FAVOURITES") #define STR_MP_UNFAVOURITES ("Unfavourites") #define STR_MP_ADD_TO_PLAYLIST ("IDS_MUSIC_BODY_ADD_TO_PLAYLIST") -#define STR_MP_SETTINGS ("IDS_COM_BODY_SETTINGS") -#define STR_MP_DETAILS "IDS_MUSIC_HEADER_DETAILS" -#define STR_MP_END ("IDS_COM_BODY_END") -#define STR_MP_EDIT ("IDS_COM_BODY_EDIT") -#define STR_MP_SET_AS ("IDS_MUSIC_BODY_SET_AS_M_RINGTONE") +#define STR_MP_SETTINGS ("IDS_COM_BODY_SETTINGS") +#define STR_MP_DETAILS "IDS_MUSIC_HEADER_DETAILS" +#define STR_MP_END ("IDS_COM_BODY_END") +#define STR_MP_EDIT ("IDS_COM_BODY_EDIT") +#define STR_MP_SET_AS ("IDS_MUSIC_BODY_SET_AS_M_RINGTONE") #define STR_MP_POP_SET "IDS_MUSIC_POP_SET" #define STR_MP_POP_CALLER_RINGTONE_SAVED "IDS_PB_POP_CALLER_RINGTONE_SAVED" -#define STR_MP_SHARE "IDS_MUSIC_SK_SHARE" -#define STR_MP_ADD_TO_PERSONAL_PAGE "IDS_ST_POP_MOVE_TO_PERSONAL_STORAGE" -#define STR_MP_REMOVE_FROM_PERSONAL_PAGE "IDS_ST_POP_MOVE_TO_NORMAL_STORAGE" +#define STR_MP_SHARE "IDS_MUSIC_SK_SHARE" +#define STR_MP_ADD_TO_PERSONAL_PAGE "IDS_ST_POP_MOVE_TO_PERSONAL_STORAGE" +#define STR_MP_REMOVE_FROM_PERSONAL_PAGE "IDS_ST_POP_MOVE_TO_NORMAL_STORAGE" #define MP_PERSONAL_ITEM_MOVE_TO "IDS_ST_POP_THE_SELECTED_ITEM_WILL_BE_MOVED_TO_PS" #define MP_PERSONAL_ITEMS_MOVE_TO "IDS_ST_POP_THE_SELECTED_ITEMS_WILL_BE_MOVED_TO_PS" #define MP_PERSONAL_DONT_ASK_AGAIN "IDS_MUSIC_BUTTON_DONT_ASK_AGAIN" -#define STR_MP_CREATE_PLAYLIST "IDS_MUSIC_OPT_CREATE_PLAYLIST" -#define STR_MP_TURN_PHONE_OVER "IDS_MUSIC_BODY_TURN_PHONE_OVER_TO_MUTE_INCOMING_CALLS_MESSAGE_ALERTS_AND_ALARMS" -#define STR_MP_DONT_ASK_AGAIN "IDS_MUSIC_BUTTON_DONT_ASK_AGAIN" +#define STR_MP_CREATE_PLAYLIST "IDS_MUSIC_OPT_CREATE_PLAYLIST" +#define STR_MP_TURN_PHONE_OVER "IDS_MUSIC_BODY_TURN_PHONE_OVER_TO_MUTE_INCOMING_CALLS_MESSAGE_ALERTS_AND_ALARMS" +#define STR_MP_DONT_ASK_AGAIN "IDS_MUSIC_BUTTON_DONT_ASK_AGAIN" #define STR_MP_ENABLE_MOTION "IDS_MUSIC_BUTTON_ENABLE_MOTION" -#define STR_MP_DELETE ("IDS_MUSIC_OPT_DELETE") +#define STR_MP_DELETE ("IDS_MUSIC_OPT_DELETE") #define STR_MP_CANCEL "IDS_MUSIC_SK_CANCEL" #define STR_MP_OK "IDS_COM_SK_OK" #define STR_MP_CLOSE "IDS_COM_BODY_CLOSE" @@ -89,7 +89,7 @@ #define STR_MP_SEARCH "IDS_MUSIC_OPT_SEARCH_ABB" #define STR_MP_TAKE_PICTURE "IDS_MUSIC_OPT_TAKE_PICTURE" #define STR_MP_CHANGE_IMAGE "IDS_MUSIC_OPT_CHANGE_IMAGE" -#define STR_MP_VIEW "IDS_MUSIC_SK_VIEW" +#define STR_MP_VIEW "IDS_MUSIC_SK_VIEW" #define STR_MP_MAKE_AVAILABLE_OFFLINE "IDS_MUSIC_BODY_MAKE_AVAILABLE_OFFLINE" #define STR_MP_NEAR_BY_DEVICE "IDS_MUSIC_BODY_NEARBY_DEVICES" #define STR_MP_EDIT_IMAGE "IDS_MUSIC_SK2_EDIT_IMAGE" @@ -109,25 +109,25 @@ #define STR_MP_UPDATING_ING "IDS_MUSIC_POP_UPDATING_ING" #define STR_MP_TABS "IDS_BR_SK_TABS" -#define STR_MP_INTERNET "IDS_COM_BODY_INTERNET" -#define STR_MP_RELATED_VIDEOS "IDS_MUSIC_BODY_RELATED_VIDEOS" -#define STR_MP_CREDITS "IDS_MUSIC_BODY_CREDITS" +#define STR_MP_INTERNET "IDS_COM_BODY_INTERNET" +#define STR_MP_RELATED_VIDEOS "IDS_MUSIC_BODY_RELATED_VIDEOS" +#define STR_MP_CREDITS "IDS_MUSIC_BODY_CREDITS" #define STR_MP_MEDIA_INFO "IDS_MUSIC_BODY_DETAILS_MEADIA_INFO" -#define STR_MP_TRACK_LIST "IDS_MUSIC_HEADER_TRACK_LIST" -#define STR_MP_SIMILAR_ALBUMS "IDS_MUSIC_HEADER_SIMILAR_ALBUMS" -#define STR_MP_REVIEW "IDS_MUSIC_BODY_REVIEW" +#define STR_MP_TRACK_LIST "IDS_MUSIC_HEADER_TRACK_LIST" +#define STR_MP_SIMILAR_ALBUMS "IDS_MUSIC_HEADER_SIMILAR_ALBUMS" +#define STR_MP_REVIEW "IDS_MUSIC_BODY_REVIEW" #define STR_MP_POP_EXISTS "IDS_MUSIC_POP_ALREADY_EXISTS" #define STR_NH_COM_POPUP_CHARACTERS_MAXNUM_REACHED ("IDS_COM_POP_MAXIMUM_NUMBER_OF_CHARACTERS_REACHED") #define STR_MP_POP_PLAYLIST_EXISTS "IDS_MH_BODY_THE_PLAYLIST_NAME_PS_IS_ALREADY_IN_USE" #define STR_MP_POP_ADDED_TO_PLAYLIST "IDS_MH_TPOP_PD_TRACKS_ADDED_TO_PLAYLIST" #define STR_MP_POP_ADDED_1_TO_PLAYLIST "IDS_MH_TPOP_1_TRACK_ADDED_TO_PLAYLIST" -#define STR_MOOD "IDS_MUSIC_BODY_MOODS" -#define STR_YEAR "IDS_MUSIC_BUTTON_YEARS" -#define STR_ADDED "IDS_COM_OPT_ADDED" -#define STR_TIME "IDS_COM_BODY_TIME" -#define STR_OLD "IDS_MUSIC_BODY_OLD" -#define STR_NEW "IDS_COM_SK_NEW" +#define STR_MOOD "IDS_MUSIC_BODY_MOODS" +#define STR_YEAR "IDS_MUSIC_BUTTON_YEARS" +#define STR_ADDED "IDS_COM_OPT_ADDED" +#define STR_TIME "IDS_COM_BODY_TIME" +#define STR_OLD "IDS_MUSIC_BODY_OLD" +#define STR_NEW "IDS_COM_SK_NEW" #define STR_NEW_FOR_SQUARE "IDS_MUSIC_BODY_NEW_M_LATEST" #define STR_EXCITING "IDS_MUSIC_BODY_EXCITING_M_ADJECTIVE" #define STR_CALM "IDS_MUSIC_BODY_CALM_M_ADJECTIVE" @@ -141,11 +141,11 @@ #define STR_MP_SQUARE_LIBRARY_UPDATED_NEED "IDS_MUSIC_POP_YOU_WILL_NEED_TO_UPDATE_THE_LIBRARY_IF_NEW_SONGS_HAVE_BEEN_ADDED" #define STR_MP_SQUARE_HELP_TEXT "Music square analyses the characteristics of music files stored on your device and automatically creates playlists based on these characteristics. You can create a playlist of similar tracks by tapping cells in the music square." -#define STR_RECENTLY_ADDED "IDS_MUSIC_OPT_LISTBY_RECENTLY_ADDED" +#define STR_RECENTLY_ADDED "IDS_MUSIC_OPT_LISTBY_RECENTLY_ADDED" #define STR_MP_SMART_VOLUME "IDS_MUSIC_BODY_SMART_VOLUME_ABB" #define STR_MP_SMART_VOLUME_IS_ENABLED "IDS_MUSIC_HEADER_SMART_VOLUME_IS_ENABLED" #define STR_MP_VOLUME_WILL_BE_ADJUSTED_TO_PD "IDS_MUSIC_BODY_THE_VOLUME_OF_ALL_TRACKS_WILL_BE_ADJUSTED_TO_LEVEL_PD" -#define STR_MP_SEARCH_BY "IDS_MUSIC_OPT_SEARCH_BY" +#define STR_MP_SEARCH_BY "IDS_MUSIC_OPT_SEARCH_BY" #define STR_MP_THIS_SOUND_EFFECT_WORKS_IN "IDS_MUSIC_POP_THIS_SOUND_EFFECT_WORKS_IN_EARPHONE_MODE_ONLY" #define STR_MP_COM_REFRESH "IDS_COM_SK_REFRESH" #define STR_MP_SELECT_DEVICE "IDS_MUSIC_HEADER_SELECT_DEVICE" @@ -200,7 +200,7 @@ #define STR_MP_AFTER_YOU_DOWNLOAD_TRACKS_FOLDER_WILL_BE_SHOWN "IDS_MUSIC_BODY_AFTER_YOU_DOWNLOAD_TRACKS_FOLDERS_WILL_BE_SHOWN" #define STR_MP_YOU_CAN_ADD_TRACKS_THE_PLAYLIST_PD "IDS_MUSIC_BODY_AFTER_YOU_ADD_TRACKS_TO_PS_THEY_WILL_BE_SHOWN_HERE" -#define STR_MP_ADD_TRACKS "IDS_MUSIC_OPT_ADD" +#define STR_MP_ADD_TRACKS "IDS_MUSIC_OPT_ADD" #define STR_MP_AFTER_YOU_ADD_TRACK_TO_FAVOURITE "IDS_MUSIC_BODY_AFTER_YOU_ADD_TRACKS_TO_YOUR_FAVOURITES_THEY_WILL_BE_SHOWN_HERE" #define STR_MP_AFTER_YOU_PLAY_TRACKS_THEY_WILL_BE_SHOWN "IDS_MUSIC_BODY_AFTER_YOU_PLAY_TRACKS_THEY_WILL_BE_SHOWN_HERE" @@ -279,10 +279,10 @@ #define STR_MS_AUTO_TYPE "IDS_MUSIC_BODY_AUTO" #define STR_MS_BASIC_TAB "IDS_MUSIC_TAB4_BASIC_M_EQUALIZING" #define STR_MS_BASS_TYPE "IDS_MUSIC_BODY_BASS_M_EQUALISER" -#define STR_MS_TREBLE_TYPE "IDS_MUSIC_BODY_TREBLE_M_EQUALISER" -#define STR_MS_INSTRUMENT_TYPE "IDS_MUSIC_BODY_INSTRUMENT" -#define STR_MS_VOCAL_TYPE "IDS_MUSIC_BODY_VOCAL_M_SOUNDEFFECT" -#define STR_MS_EFFECT_TITLE "IDS_MUSIC_BODY_EFFECT" +#define STR_MS_TREBLE_TYPE "IDS_MUSIC_BODY_TREBLE_M_EQUALISER" +#define STR_MS_INSTRUMENT_TYPE "IDS_MUSIC_BODY_INSTRUMENT" +#define STR_MS_VOCAL_TYPE "IDS_MUSIC_BODY_VOCAL_M_SOUNDEFFECT" +#define STR_MS_EFFECT_TITLE "IDS_MUSIC_BODY_EFFECT" #define STR_MS_RESET_BUTTON "IDS_MUSIC_BUTTON_RESET" #define STR_MS_CLARITY_TYPE "IDS_MUSIC_BODY_CLARITY_M_SOUNDEFFECT" #define STR_MS_3D_TYPE "IDS_MUSIC_BUTTON_3D_CHN" @@ -327,17 +327,17 @@ #define STR_MP_HDMI "IDS_VPL_OPT_HDMI" -#define STR_MP_DROPBOX "IDS_MF_BODY_DROPBOX_ABB" +#define STR_MP_DROPBOX "IDS_MF_BODY_DROPBOX_ABB" ///can not find #define STR_MP_MIRRORING "Mirroring" -#define STR_MP_USB_AUDIO "USB Audio" -#define STR_PREVIOUSLY_ADDED "Previously added" //not used.. +#define STR_MP_USB_AUDIO "USB Audio" +#define STR_PREVIOUSLY_ADDED "Previously added" //not used.. #define STR_MP_THE_APP_CONTROL_IS_DISABLED "Bluetooth is disabled. To enable it, go to Privacy setting and allow the service to be used in application" #define STR_MP_THE_ACCOUNT_SVC_IS_DISABLED "Account is disabled. To enable it, go to Privacy setting and allow the service to be used in application" #define MP_MENU_FID "mp_menu_fid" -#define MP_MENU_GROUP_ITEM_HANDLER "mp_menu_group_item_handler" +#define MP_MENU_GROUP_ITEM_HANDLER "mp_menu_group_item_handler" #define STR_MP_SET_AS_FROM_BEGIN "IDS_MUSIC_BUTTON_FROM_THE_BEGINNING" #define STR_MP_SET_AS_AUTO_RECOMMEND "IDS_MUSIC_BUTTON_AUTO_RECOMMENDATIONS" diff --git a/inc/mp-vconf-private-keys.h b/inc/mp-vconf-private-keys.h index 6086fa9..2472b88 100644 --- a/inc/mp-vconf-private-keys.h +++ b/inc/mp-vconf-private-keys.h @@ -48,8 +48,7 @@ * 2 : repeat only a songs */ #define MP_KEY_MUSIC_REPEAT MP_DB_PREFIX"repeat" -enum -{ +enum { MP_SETTING_REP_ALL, MP_SETTING_REP_NON, MP_SETTING_REP_1 @@ -58,7 +57,7 @@ enum /* for live-box */ #define MP_LIVE_VCONF_PREFIX MP_MEMORY_PREFIX /* this state is only for livebox Sound player should not affect this app*/ -//#define MP_LIVE_PLAY_STATE MP_LIVE_VCONF_PREFIX"player_state" +//#define MP_LIVE_PLAY_STATE MP_LIVE_VCONF_PREFIX"player_state" /****************************/ @@ -147,9 +146,8 @@ enum * type: int */ #define KEY_MUSIC_AUTO_OFF_TYPE_VAL "auto_off_type_val" -enum -{ - KEY_MUSIC_AUTO_OFF_TIME_OFF = 0, +enum { + KEY_MUSIC_AUTO_OFF_TIME_OFF = 0, KEY_MUSIC_AUTO_OFF_TIME_15, KEY_MUSIC_AUTO_OFF_TIME_30, KEY_MUSIC_AUTO_OFF_TIME_60, @@ -177,8 +175,7 @@ enum * 2 : repeat only a songs */ #define MP_KEY_MUSIC_SQUARE_AXIS_VAL "square_axis_val" -enum -{ +enum { MP_KEY_MUSIC_SQUARE_AXIS_MOOD, MP_KEY_MUSIC_SQUARE_AXIS_YEAR, MP_KEY_MUSIC_SQUARE_AXIS_ADDED, @@ -324,8 +321,7 @@ enum { */ #define MP_LIVE_PROGRESS_RATIO_CHANGED MP_LIVE_VCONF_PREFIX"position_changed" //double -#define KEY_PERSONAL_NO_ASK_AGAIN "personal_no_ask_again" //"db/private/org.tizen.music-player/personal_no_ask_again" - +#define KEY_PERSONAL_NO_ASK_AGAIN "personal_no_ask_again" //"db/private/org.tizen.music-player/personal_no_ask_again" -#endif /* __MP_VCONF_PRIVATE_KEYS_H__ */ +#endif /* __MP_VCONF_PRIVATE_KEYS_H__ */ diff --git a/music-chooser/src/include/mc-common.h b/music-chooser/src/include/mc-common.h index 3131f31..570959a 100644 --- a/music-chooser/src/include/mc-common.h +++ b/music-chooser/src/include/mc-common.h @@ -20,34 +20,54 @@ #include #include -void mc_common_push_track_view_by_group_name(void *ad, int track_type, const char *name, int playlist_id, const char *folder_name); -bool mc_check_image_valid(Evas *evas, const char *path); -Elm_Object_Item *mc_common_toolbar_item_append(Evas_Object *obj, const char *icon, - const char *label, Evas_Smart_Cb func, - const void *data); +void mc_common_push_track_view_by_group_name(void *ad, int track_type, + const char *name, + int playlist_id, + const char *folder_name); +bool mc_check_image_valid(Evas * evas, const char *path); +Elm_Object_Item *mc_common_toolbar_item_append(Evas_Object * obj, + const char *icon, + const char *label, + Evas_Smart_Cb func, + const void *data); void mc_post_status_message(const char *text); bool mc_is_call_connected(void); -void mc_common_obj_domain_text_translate(Evas_Object *obj, const char *label); -void mc_common_obj_domain_translatable_part_text_set(Evas_Object *obj, const char* part, const char* label); +void mc_common_obj_domain_text_translate(Evas_Object * obj, + const char *label); +void mc_common_obj_domain_translatable_part_text_set(Evas_Object * obj, + const char *part, + const char *label); bool mc_check_file_exist(const char *path); Evas_Object *mc_widget_genlist_create(Evas_Object * parent); bool mc_is_mmc_removed(void); -char *mc_artist_text_get(void *data, Evas_Object *obj, const char *part); -char *mc_album_text_get(void *data, Evas_Object *obj, const char *part); -char * mc_playlist_text_get(void *data, Evas_Object *obj, const char *part); -char *mc_folder_list_label_get(void *data, Evas_Object * obj, const char *part); -Evas_Object * mc_group_content_get(void *data, Evas_Object *obj, const char *part); -void mc_eext_quit_cb(void *data, Evas_Object *obj, void *event_info); -Eina_Bool mc_quit_cb(void *data, Elm_Object_Item *it); -void mc_auto_recommended_check_cb(void *data, Evas_Object *obj, void *event_info); -void mc_quit_select_cb(void *data, Evas_Object *obj, void *event_info); -Evas_Object *mc_common_load_edj(Evas_Object * parent, const char *file, const char *group); +char *mc_artist_text_get(void *data, Evas_Object * obj, const char *part); +char *mc_album_text_get(void *data, Evas_Object * obj, const char *part); +char *mc_playlist_text_get(void *data, Evas_Object * obj, + const char *part); +char *mc_folder_list_label_get(void *data, Evas_Object * obj, + const char *part); +Evas_Object *mc_group_content_get(void *data, Evas_Object * obj, + const char *part); +void mc_eext_quit_cb(void *data, Evas_Object * obj, void *event_info); +Eina_Bool mc_quit_cb(void *data, Elm_Object_Item * it); +void mc_auto_recommended_check_cb(void *data, Evas_Object * obj, + void *event_info); +void mc_quit_select_cb(void *data, Evas_Object * obj, void *event_info); +Evas_Object *mc_common_load_edj(Evas_Object * parent, const char *file, + const char *group); Evas_Object *mc_widget_navigation_new(Evas_Object * parent); -void mc_common_create_fastscroller(Evas_Object *parent, Eina_Bool multiple, Evas_Object *genlist); +void mc_common_create_fastscroller(Evas_Object * parent, + Eina_Bool multiple, + Evas_Object * genlist); Evas_Object *mc_common_create_processing_popup(void *data); -const char *mc_commonl_search_markup_keyword(const char *string, char *searchword, bool *result); -Evas_Object *mc_common_create_thumb_icon(Evas_Object * obj, const char *path, int w, int h); +const char *mc_commonl_search_markup_keyword(const char *string, + char *searchword, + bool * result); +Evas_Object *mc_common_create_thumb_icon(Evas_Object * obj, + const char *path, int w, int h); -const char *mc_common_search_markup_keyword(const char *string, char *searchword, bool *result); +const char *mc_common_search_markup_keyword(const char *string, + char *searchword, + bool * result); #endif diff --git a/music-chooser/src/include/mc-data.h b/music-chooser/src/include/mc-data.h index 010300a..667c83d 100644 --- a/music-chooser/src/include/mc-data.h +++ b/music-chooser/src/include/mc-data.h @@ -19,18 +19,16 @@ typedef struct _mc_list_data *app_data; -typedef enum -{ +typedef enum { MP_DATA_ARTIST, MP_DATA_ALBUM, MP_DATA_PLAYLIST, -}mp_data_e; +} mp_data_e; int app_data_count(mp_data_e type, char *filter_text); -int app_data_create(mp_data_e type, char *filter_text, app_data *data); +int app_data_create(mp_data_e type, char *filter_text, app_data * data); int app_data_destory(app_data data); int app_data_get_main_text(); #endif - diff --git a/music-chooser/src/include/mc-debug.h b/music-chooser/src/include/mc-debug.h index a76fa8d..e8fc922 100644 --- a/music-chooser/src/include/mc-debug.h +++ b/music-chooser/src/include/mc-debug.h @@ -37,7 +37,7 @@ #ifdef LOG_TAG #undef LOG_TAG -#endif //LOG_TAG +#endif //LOG_TAG #define LOG_TAG "MUSIC_CHOOSER" @@ -46,46 +46,46 @@ #endif #define DEBUG_TRACE(fmt, arg...) dlog_print(DLOG_DEBUG, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg) -#define INFO_TRACE(fmt, arg...) dlog_print(DLOG_INFO, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg) -#define WARN_TRACE(fmt, arg...) dlog_print(DLOG_WARN, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg) +#define INFO_TRACE(fmt, arg...) dlog_print(DLOG_INFO, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg) +#define WARN_TRACE(fmt, arg...) dlog_print(DLOG_WARN, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg) #define ERROR_TRACE(fmt, arg...) dlog_print(DLOG_ERROR, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg) -#define PARAM_CHECK(fmt, arg...) dlog_print(DLOG_WARN, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg) -#define EVENT_TRACE(fmt, arg...) dlog_print(DLOG_INFO, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg) +#define PARAM_CHECK(fmt, arg...) dlog_print(DLOG_WARN, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg) +#define EVENT_TRACE(fmt, arg...) dlog_print(DLOG_INFO, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg) #define SECURE_DEBUG(fmt, args...) dlog_print(DLOG_DEBUG, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##args) #define SECURE_INFO(fmt, args...) dlog_print(DLOG_INFO, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##args) #define SECURE_ERROR(fmt, args...) dlog_print(DLOG_ERROR, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##args) -#else // use USE_DLOG_SYSTEM +#else // use USE_DLOG_SYSTEM -#define DEBUG_TRACE(fmt, arg...) do{fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ - fprintf (stderr, __VA_ARGS__);}while(0) -#define INFO_TRACE(fmt, arg...) do{fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ - fprintf (stderr, __VA_ARGS__);}while(0) -#define WARN_TRACE(fmt, arg...) do{fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ - fprintf (stderr, __VA_ARGS__);}while(0) -#define ERROR_TRACE(fmt, arg...) do{fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ - fprintf (stderr, __VA_ARGS__);}while(0) -#define EVENT_TRACE(fmt, arg...) do{fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ - fprintf (stderr, __VA_ARGS__);}while(0) -#endif //USE_DLOG_SYSTEM +#define DEBUG_TRACE(fmt, arg...) do {fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ + fprintf(stderr, __VA_ARGS__); } while (0) +#define INFO_TRACE(fmt, arg...) do {fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ + fprintf(stderr, __VA_ARGS__); } while (0) +#define WARN_TRACE(fmt, arg...) do {fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ + fprintf(stderr, __VA_ARGS__); } while (0) +#define ERROR_TRACE(fmt, arg...) do {fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ + fprintf(stderr, __VA_ARGS__); } while (0) +#define EVENT_TRACE(fmt, arg...) do {fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ + fprintf(stderr, __VA_ARGS__); } while (0) +#endif //USE_DLOG_SYSTEM #define DEBUG_TRACE_FUNC() DEBUG_TRACE("") -#else //ENABLE_LOG_SYSTEM +#else //ENABLE_LOG_SYSTEM #define DEBUG_TRACE(fmt, arg...) ; #define INFO_TRACE(fmt, arg...) ; #define WARN_TRACE(fmt, arg...) ; #define ERROR_TRACE(fmt, arg...) ; #define EVENT_TRACE(fmt, arg...) ; -#endif //ENABLE_LOG_SYSTEM +#endif //ENABLE_LOG_SYSTEM #ifdef ENABLE_CHECK_START_END_FUNCTION #ifndef startfunc -#define startfunc DEBUG_TRACE("+- START -------------------------"); +#define startfunc DEBUG_TRACE("+- START -------------------------"); #endif #ifndef endfunc -#define endfunc DEBUG_TRACE("+- END --------------------------"); +#define endfunc DEBUG_TRACE("+- END --------------------------"); #endif #define exceptionfunc ERROR_TRACE("### CRITICAL ERROR ###"); @@ -98,60 +98,60 @@ #define eventfunc EVENT_TRACE(""); #define mp_ret_if(expr) do { \ - if(expr) { \ + if (expr) { \ PARAM_CHECK("");\ return; \ } \ } while (0) #define mp_retv_if(expr, val) do { \ - if(expr) { \ + if (expr) { \ PARAM_CHECK("");\ return (val); \ } \ } while (0) #define mp_retm_if(expr, fmt, arg...) do { \ - if(expr) { \ + if (expr) { \ PARAM_CHECK(fmt, ##arg); \ return; \ } \ } while (0) #define mp_retvm_if(expr, val, fmt, arg...) do { \ - if(expr) { \ + if (expr) { \ PARAM_CHECK(fmt, ##arg); \ return (val); \ } \ } while (0) #define CHECK_EXCEP(expr) do { \ - if(!(expr)) { \ + if (!(expr)) { \ ERROR_TRACE("CRITICAL ERROR ## CHECK BELOW ITEM");\ goto mp_exception;\ } \ } while (0) #define mp_ecore_timer_del(timer) do { \ - if(timer) { \ + if (timer) { \ ecore_timer_del(timer);\ timer = NULL; \ } \ } while (0) -#define MP_CHECK_VAL(expr, val) mp_retvm_if(!(expr),val,"INVALID PARM RETURN VAL: 0x%x", val) -#define MP_CHECK_NULL(expr) mp_retvm_if(!(expr),NULL,"INVALID PARM RETURN NULL") -#define MP_CHECK_FALSE(expr) mp_retvm_if(!(expr),FALSE,"INVALID PARM RETURN FALSE") -#define CHECK_CANCEL(expr) mp_retvm_if(!(expr), ECORE_CALLBACK_CANCEL, "INVALID PARAM RETURN") -#define MP_CHECK(expr) mp_retm_if(!(expr),"INVALID PARAM RETURN") +#define MP_CHECK_VAL(expr, val) mp_retvm_if(!(expr), val, "INVALID PARM RETURN VAL: 0x%x", val) +#define MP_CHECK_NULL(expr) mp_retvm_if(!(expr), NULL, "INVALID PARM RETURN NULL") +#define MP_CHECK_FALSE(expr) mp_retvm_if(!(expr), FALSE, "INVALID PARM RETURN FALSE") +#define CHECK_CANCEL(expr) mp_retvm_if(!(expr), ECORE_CALLBACK_CANCEL, "INVALID PARAM RETURN") +#define MP_CHECK(expr) mp_retm_if(!(expr), "INVALID PARAM RETURN") #define MC_LIST_ICON_SIZE 70 * elm_config_scale_get() -#define SAFE_FREE(x) if(x) {free(x); x = NULL;} +#define SAFE_FREE(x) if (x) {free(x); x = NULL; } #undef IF_G_FREE -#define IF_G_FREE(p) ({g_free(p);p=NULL;}) +#define IF_G_FREE(p) ({g_free(p); p = NULL; }) #define mp_assert(expr) do { \ - if(!(expr)) { \ + if (!(expr)) { \ ERROR_TRACE("CRITICAL ERROR ## CHECK BELOW ITEM");\ assert(FALSE); \ } \ @@ -159,10 +159,10 @@ #define mc_evas_object_del(object) do { \ - if(object) { \ + if (object) { \ evas_object_del(object); \ object = NULL; \ } \ } while (0) -#endif // __MC_DEBUG_H_ +#endif // __MC_DEBUG_H_ diff --git a/music-chooser/src/include/mc-group-list.h b/music-chooser/src/include/mc-group-list.h index 37f68fd..223fa82 100644 --- a/music-chooser/src/include/mc-group-list.h +++ b/music-chooser/src/include/mc-group-list.h @@ -20,8 +20,11 @@ #include "music-chooser.h" #include "mp-media-info.h" -Evas_Object *mc_group_list_create(Evas_Object *parent, struct app_data *ad, Elm_Object_Item *navi_it); -int mc_group_list_set_data(Evas_Object *list, int group_type, const char *type_str); -int mc_group_list_update(Evas_Object *list); +Evas_Object *mc_group_list_create(Evas_Object * parent, + struct app_data *ad, + Elm_Object_Item * navi_it); +int mc_group_list_set_data(Evas_Object * list, int group_type, + const char *type_str); +int mc_group_list_update(Evas_Object * list); #endif diff --git a/music-chooser/src/include/mc-group-play-list.h b/music-chooser/src/include/mc-group-play-list.h index c967182..d58b71e 100644 --- a/music-chooser/src/include/mc-group-play-list.h +++ b/music-chooser/src/include/mc-group-play-list.h @@ -20,8 +20,9 @@ #include "music-chooser.h" #include "mp-media-info.h" -Evas_Object *mc_group_play_list_create(Evas_Object *parent, struct app_data *ad); -int mc_group_play_list_update(Evas_Object *list, Elm_Object_Item *navi_it); +Evas_Object *mc_group_play_list_create(Evas_Object * parent, + struct app_data *ad); +int mc_group_play_list_update(Evas_Object * list, + Elm_Object_Item * navi_it); #endif - diff --git a/music-chooser/src/include/mc-index.h b/music-chooser/src/include/mc-index.h index 8ed82f1..c829d04 100644 --- a/music-chooser/src/include/mc-index.h +++ b/music-chooser/src/include/mc-index.h @@ -19,10 +19,10 @@ #include -typedef void (*UgMpIndexCb)(void *data); +typedef void (*UgMpIndexCb) (void *data); -Evas_Object *mc_index_create(Evas_Object *parent, int group_type, void *data); -void mc_index_append_item(Evas_Object *index, Evas_Object *list); +Evas_Object *mc_index_create(Evas_Object * parent, int group_type, + void *data); +void mc_index_append_item(Evas_Object * index, Evas_Object * list); #endif - diff --git a/music-chooser/src/include/mc-library-view.h b/music-chooser/src/include/mc-library-view.h index b55a736..fb510c0 100644 --- a/music-chooser/src/include/mc-library-view.h +++ b/music-chooser/src/include/mc-library-view.h @@ -19,7 +19,6 @@ #include "music-chooser.h" void mc_library_view_create(struct app_data *ad); -Evas_Object *_create_tabbar(Evas_Object *parent, struct app_data *ad); +Evas_Object *_create_tabbar(Evas_Object * parent, struct app_data *ad); #endif - diff --git a/music-chooser/src/include/mc-list-play.h b/music-chooser/src/include/mc-list-play.h index 41491db..36a8667 100644 --- a/music-chooser/src/include/mc-list-play.h +++ b/music-chooser/src/include/mc-list-play.h @@ -42,7 +42,7 @@ typedef enum { MC_VOLUME_NUM, } mc_player_volume_type; -typedef struct __mc_player_cbs{ +typedef struct __mc_player_cbs { /* player callbacks */ /* player_started_cb started_cb; player_paused_cb paused_cb;*/ @@ -54,7 +54,7 @@ typedef struct __mc_player_cbs{ /* callback user data */ void *user_data[MC_PLAYER_CB_TYPE_MAX]; -}mc_player_cbs; +} mc_player_cbs; typedef struct { mc_player_cb_type cb_type; @@ -76,13 +76,13 @@ void mc_pre_play_mgr_destroy_play(void); bool mc_player_mgr_is_active(void); void mc_player_pause(void); void mc_player_play(void); -void mc_pre_play_control_play_no_pause_music_item(list_item_data_t *item_data); -void mc_pre_play_control_play_music_item(list_item_data_t *item_data); -void mc_vol_reset_default_value(void* data); +void mc_pre_play_control_play_no_pause_music_item(list_item_data_t * + item_data); +void mc_pre_play_control_play_music_item(list_item_data_t * item_data); +void mc_vol_reset_default_value(void *data); void mc_vol_type_set(sound_type_e type); int mc_get_volume(sound_type_e type); -#endif /* __DEF_MC_LIST_PLAY_H_ */ - +#endif /* __DEF_MC_LIST_PLAY_H_ */ diff --git a/music-chooser/src/include/mc-search-list.h b/music-chooser/src/include/mc-search-list.h index 9abc2e9..334bf1a 100644 --- a/music-chooser/src/include/mc-search-list.h +++ b/music-chooser/src/include/mc-search-list.h @@ -22,12 +22,11 @@ #include "mp-media-info.h" -enum -{ +enum { MC_SEARCH_LIST_FILTER_STR, }; -typedef struct __UgMpSearchList{ +typedef struct __UgMpSearchList { struct app_data *ad; Elm_Genlist_Item_Class *itc_track; @@ -47,22 +46,21 @@ typedef struct __UgMpSearchList{ mp_media_list_h track_handle; //for search mp_media_list_h artist_handle; //for search mp_media_list_h album_handle; //for search -}UgMpSearchList_t; +} UgMpSearchList_t; -typedef enum -{ - MP_LIST_ITEM_TYPE_NORMAL = 0, - MP_LIST_ITEM_TYPE_SHUFFLE, +typedef enum { + MP_LIST_ITEM_TYPE_NORMAL = 0, + MP_LIST_ITEM_TYPE_SHUFFLE, MP_LIST_ITEM_TYPE_GROUP_TITLE, MP_LIST_ITEM_TYPE_SELECTABLE_GROUP_TITLE, MP_LIST_ITEM_TYPE_ALBUMART_INDEX, MP_LIST_ITEM_TYPE_BOTTOM_COUNTER, } MpListItemType_e; -UgMpSearchList_t * mc_search_list_create(Evas_Object *parent, struct app_data *ad); -void mc_search_list_set_data(UgMpSearchList_t *list, ...); +UgMpSearchList_t *mc_search_list_create(Evas_Object * parent, + struct app_data *ad); +void mc_search_list_set_data(UgMpSearchList_t * list, ...); void mc_search_list_update(void *thiz); -void mc_search_list_set_reorder(UgMpSearchList_t *list, bool reorder); +void mc_search_list_set_reorder(UgMpSearchList_t * list, bool reorder); #endif - diff --git a/music-chooser/src/include/mc-search-view.h b/music-chooser/src/include/mc-search-view.h index 90b4bb2..fe3087b 100644 --- a/music-chooser/src/include/mc-search-view.h +++ b/music-chooser/src/include/mc-search-view.h @@ -21,7 +21,7 @@ #define MC_SEARCH_VIEW_STYLE_EMPTY "empty/music" -typedef struct{ +typedef struct { struct app_data *ad; Elm_Object_Item *navi_it; @@ -41,18 +41,20 @@ typedef struct{ mp_group_type_e type; - char *filter_text; //free - char *title; //not free + char *filter_text; //free + char *title; //not free int count; mp_media_list_h media_list; mp_media_list_h defualt_playlist; -}search_view_data_t; +} search_view_data_t; -search_view_data_t *mc_search_view_create(Evas_Object *parent, struct app_data *ad); +search_view_data_t *mc_search_view_create(Evas_Object * parent, + struct app_data *ad); int mc_search_view_update_options(void *thiz); -void mc_search_view_set_keyword(search_view_data_t *search, const char *keyword); -int mc_search_view_destory(search_view_data_t *search); +void mc_search_view_set_keyword(search_view_data_t * search, + const char *keyword); +int mc_search_view_destory(search_view_data_t * search); #endif diff --git a/music-chooser/src/include/mc-search.h b/music-chooser/src/include/mc-search.h index ec573b6..2479eff 100644 --- a/music-chooser/src/include/mc-search.h +++ b/music-chooser/src/include/mc-search.h @@ -19,11 +19,19 @@ #define __MC_SEARCH_H_ #include -Evas_Object *mc_search_create_new(Evas_Object * parent, Evas_Smart_Cb change_cb, void *change_cb_data, Evas_Smart_Cb cancel_cb, void *cancel_cb_data, Evas_Smart_Cb focus_cb, void *focus_cb_data, Evas_Smart_Cb unfocus_cb, void *unfocus_cb_data); +Evas_Object *mc_search_create_new(Evas_Object * parent, + Evas_Smart_Cb change_cb, + void *change_cb_data, + Evas_Smart_Cb cancel_cb, + void *cancel_cb_data, + Evas_Smart_Cb focus_cb, + void *focus_cb_data, + Evas_Smart_Cb unfocus_cb, + void *unfocus_cb_data); void mc_search_hide_imf_pannel(Evas_Object * search); void mc_search_show_imf_pannel(Evas_Object * search); -Evas_Object *mc_search_entry_get(Evas_Object *search); -char *mc_search_text_get(Evas_Object *search); -void mc_search_text_set(Evas_Object *search, const char *text); +Evas_Object *mc_search_entry_get(Evas_Object * search); +char *mc_search_text_get(Evas_Object * search); +void mc_search_text_set(Evas_Object * search, const char *text); -#endif //__MP_SEARCH_H_ +#endif //__MP_SEARCH_H_ diff --git a/music-chooser/src/include/mc-text.h b/music-chooser/src/include/mc-text.h index 0305222..0d54545 100644 --- a/music-chooser/src/include/mc-text.h +++ b/music-chooser/src/include/mc-text.h @@ -16,7 +16,7 @@ #define MC_TEXT_SEARCH "IDS_MUSIC_OPT_SEARCH_ABB" #define MC_TEXT_CANCEL "IDS_COM_POP_CANCEL" -#define MC_TEXT_DONE "IDS_COM_POP_DONE" +#define MC_TEXT_DONE "IDS_COM_POP_DONE" #define MC_TEXT_SELECT_ARTIST "IDS_MUSIC_TAB4_ARTISTS" #define MC_TEXT_SELECT_ALBUM "IDS_MUSIC_TAB4_ALBUMS" @@ -28,8 +28,8 @@ #define MC_TEXT_NO_ARTIST "IDS_MUSIC_BODY_NO_ARTISTS" #define MC_TEXT_ALL "IDS_MUSIC_OPT_TRACKS" -#define MC_TEXT_PLAYLISTS "IDS_MUSIC_TAB4_PLAYLISTS" -#define MC_TEXT_ALBUMS "IDS_MUSIC_TAB4_ALBUMS" +#define MC_TEXT_PLAYLISTS "IDS_MUSIC_TAB4_PLAYLISTS" +#define MC_TEXT_ALBUMS "IDS_MUSIC_TAB4_ALBUMS" #define MC_TEXT_ARTISTS "IDS_MUSIC_TAB4_ARTISTS" #define MC_TEXT_FOLDERS "IDS_COM_BODY_FOLDERS" @@ -40,4 +40,3 @@ #define MC_TEXT_SET_AS_AUTO_RECOMMEND "IDS_MUSIC_BUTTON_AUTO_RECOMMENDATIONS" #define MC_TEXT_SET_AS_RECOMMENDED_TXT "IDS_PB_BODY_AUTO_RECOMMENDATIONS_CAN_EXTRACT_THE_HIGHLIGHTS_FROM_SOUND_FILES" - diff --git a/music-chooser/src/include/mc-track-list.h b/music-chooser/src/include/mc-track-list.h index afa4141..acaa9a6 100644 --- a/music-chooser/src/include/mc-track-list.h +++ b/music-chooser/src/include/mc-track-list.h @@ -24,10 +24,9 @@ #define DEF_STR_LEN 512 -typedef struct -{ - Elm_Object_Item *it; // Genlist Item pointer - Eina_Bool checked; // Check status +typedef struct { + Elm_Object_Item *it; // Genlist Item pointer + Eina_Bool checked; // Check status player_state_e state; mp_media_info_h media; struct app_data *ad; @@ -38,18 +37,29 @@ typedef struct } list_item_data_t; -Evas_Object *mc_track_list_create(Evas_Object *parent, struct app_data *ad); -void mc_post_notification_indicator(list_item_data_t *it_data, player_state_e state); -int mc_track_list_set_data(Evas_Object *list, int track_type, const char *type_str, int playlist_id); +Evas_Object *mc_track_list_create(Evas_Object * parent, + struct app_data *ad); +void mc_post_notification_indicator(list_item_data_t * it_data, + player_state_e state); +int mc_track_list_set_data(Evas_Object * list, int track_type, + const char *type_str, int playlist_id); void mc_track_list_set_uri_selected(void *thiz, const char *uri); -int mc_track_list_update(Evas_Object *list, Elm_Object_Item *navi_it, Evas_Object *sub_view); +int mc_track_list_update(Evas_Object * list, Elm_Object_Item * navi_it, + Evas_Object * sub_view); int mc_track_list_get_radio(); -bool mc_widget_create_select_all_layout(Evas_Object *pParent, Evas_Smart_Cb pChangeFunc,Evas_Object_Event_Cb pMouseDownFunc, void *pUserData, Evas_Object **pCheckBox, Evas_Object **pSelectLayout); +bool mc_widget_create_select_all_layout(Evas_Object * pParent, + Evas_Smart_Cb pChangeFunc, + Evas_Object_Event_Cb + pMouseDownFunc, void *pUserData, + Evas_Object ** pCheckBox, + Evas_Object ** pSelectLayout); void _mc_popup_view(void *data); -void _mc_track_list_select_cb(void *data, Evas_Object *obj, void *event_info); -void _mc_track_list_select_all_selected_item_data_get(void *data, Evas_Object *obj, void *event_info); +void _mc_track_list_select_cb(void *data, Evas_Object * obj, + void *event_info); +void _mc_track_list_select_all_selected_item_data_get(void *data, + Evas_Object * obj, + void *event_info); char *mc_create_selectioninfo_text_with_count(int count); unsigned int _get_select_count(void *data); #endif - diff --git a/music-chooser/src/include/mc-voice-clip-list.h b/music-chooser/src/include/mc-voice-clip-list.h index 533960d..a43226b 100644 --- a/music-chooser/src/include/mc-voice-clip-list.h +++ b/music-chooser/src/include/mc-voice-clip-list.h @@ -20,8 +20,8 @@ #include "music-chooser.h" #include "mp-media-info.h" -Evas_Object *mc_voice_clip_list_create(Evas_Object *parent, struct app_data *ad); -int mc_voice_clip_list_update(Evas_Object *list); +Evas_Object *mc_voice_clip_list_create(Evas_Object * parent, + struct app_data *ad); +int mc_voice_clip_list_update(Evas_Object * list); #endif - diff --git a/music-chooser/src/include/mc-widget.h b/music-chooser/src/include/mc-widget.h index 8fc8327..930d69e 100644 --- a/music-chooser/src/include/mc-widget.h +++ b/music-chooser/src/include/mc-widget.h @@ -27,25 +27,31 @@ typedef enum { NO_CONTENT_ARTIST, } NoContentType_e; -Evas_Object * -mc_widget_create_title_icon_btn(Evas_Object *parent, const char *file, const char *group, Evas_Smart_Cb func, void *data); - -Evas_Object * -mc_create_win(const char *name); - -Evas_Object * -mc_widget_no_content_add(Evas_Object *parent, NoContentType_e type); - -Evas_Object * -mc_widget_create_naviframe_toolbar(Elm_Object_Item *navi_it); - -Elm_Object_Item * -mc_widget_create_toolbar_item_btn(Evas_Object *parent, - const char *style, const char *text, Evas_Smart_Cb func, void *data); - -Evas_Object* mc_widget_create_navi_left_btn(Evas_Object *pParent, - Elm_Object_Item *pNaviItem,Evas_Smart_Cb pFunc, void *pUserData); -Evas_Object* mc_widget_create_navi_right_btn(Evas_Object *pParent, - Elm_Object_Item *pNaviItem,Evas_Smart_Cb pFunc, void *pUserData); -#endif /* __MC_WIDGET_H__ */ - +Evas_Object *mc_widget_create_title_icon_btn(Evas_Object * parent, + const char *file, + const char *group, + Evas_Smart_Cb func, + void *data); + +Evas_Object *mc_create_win(const char *name); + +Evas_Object *mc_widget_no_content_add(Evas_Object * parent, + NoContentType_e type); + +Evas_Object *mc_widget_create_naviframe_toolbar(Elm_Object_Item * navi_it); + +Elm_Object_Item *mc_widget_create_toolbar_item_btn(Evas_Object * parent, + const char *style, + const char *text, + Evas_Smart_Cb func, + void *data); + +Evas_Object *mc_widget_create_navi_left_btn(Evas_Object * pParent, + Elm_Object_Item * pNaviItem, + Evas_Smart_Cb pFunc, + void *pUserData); +Evas_Object *mc_widget_create_navi_right_btn(Evas_Object * pParent, + Elm_Object_Item * pNaviItem, + Evas_Smart_Cb pFunc, + void *pUserData); +#endif /* __MC_WIDGET_H__ */ diff --git a/music-chooser/src/include/music-chooser.h b/music-chooser/src/include/music-chooser.h index 399858f..e7750e7 100644 --- a/music-chooser/src/include/music-chooser.h +++ b/music-chooser/src/include/music-chooser.h @@ -53,12 +53,12 @@ #define GET_STR(s) dgettext(DOMAIN_NAME, s) #define dgettext_noop(s) (s) #define N_(s) dgettext_noop(s) -#define GET_SYS_STR(str) dgettext(DOMAIN_NAME, str) +#define GET_SYS_STR(str) dgettext(DOMAIN_NAME, str) #define MC_SELECT_MODE_KEY "http://tizen.org/appcontrol/data/selection_mode" #define MC_SELECT_MULTIPLE "multiple" -typedef enum{ +typedef enum { MC_SELECT_SINGLE, MC_SELECT_SINGLE_RINGTONE, MC_SELECT_MULTI, @@ -68,9 +68,9 @@ typedef enum{ MC_SHORTCUT_ALBUM, MC_SHORTCUT_ARTIST, MC_SHORTCUT_PLAYLIST, -}ug_type; +} ug_type; -typedef enum{ +typedef enum { MC_TRACK, MC_ALBUM, MC_ALBUM_TRACK, @@ -78,10 +78,9 @@ typedef enum{ MC_ARTIST_TRACK, MC_FOLDER, MC_FOLDER_TRACK, -}mc_list_type_e; +} mc_list_type_e; -typedef struct -{ +typedef struct { int index; mc_list_type_e item_type; Elm_Object_Item *it; @@ -93,8 +92,7 @@ typedef struct void *plst_item; } mc_list_item_data_t; -struct app_data -{ +struct app_data { Evas_Object *base_layout; Evas_Object *navi_bar; int max_count; @@ -111,7 +109,7 @@ struct app_data int win_angle; //support light theme - Elm_Theme * th; + Elm_Theme *th; int auto_temp_max; @@ -124,4 +122,4 @@ struct app_data long long int limitsize; }; -#endif /* __msmc_efl_H__ */ +#endif /* __msmc_efl_H__ */ diff --git a/music-chooser/src/mc-common.c b/music-chooser/src/mc-common.c index a914c10..ba48720 100644 --- a/music-chooser/src/mc-common.c +++ b/music-chooser/src/mc-common.c @@ -31,8 +31,7 @@ bool detail_view = false; static int external_mmc_id = -1; -static Eina_Bool -_back_cb(void *data, Elm_Object_Item *it) +static Eina_Bool _back_cb(void *data, Elm_Object_Item * it) { startfunc; struct app_data *ad = data; @@ -42,7 +41,10 @@ _back_cb(void *data, Elm_Object_Item *it) return EINA_FALSE; } -void mc_common_push_track_view_by_group_name(void *data, int track_type, const char *name, int playlist_id, const char *folder_name) +void mc_common_push_track_view_by_group_name(void *data, int track_type, + const char *name, + int playlist_id, + const char *folder_name) { startfunc; struct app_data *ad = data; @@ -56,20 +58,22 @@ void mc_common_push_track_view_by_group_name(void *data, int track_type, const c ad->track_type = track_type; - char mc_edj_path[1024] = {0}; + char mc_edj_path[1024] = { 0 }; char *path = app_get_resource_path(); if (path == NULL) { return; } snprintf(mc_edj_path, 1024, "%s%s", path, MC_EDJ_FILE); free(path); - Evas_Object *navi_layout = mc_common_load_edj(ad->navi_bar, mc_edj_path, "view_layout_tabbar"); + Evas_Object *navi_layout = + mc_common_load_edj(ad->navi_bar, mc_edj_path, + "view_layout_tabbar"); g_navi_it = elm_naviframe_top_item_get(ad->navi_bar); -// g_ly = elm_object_item_part_content_get(g_navi_it, "elm.swallow.content"); +// g_ly = elm_object_item_part_content_get(g_navi_it, "elm.swallow.content"); tabbar = _create_tabbar(ad->navi_bar, ad); elm_object_part_content_set(navi_layout, "tabbar", tabbar); -// sub_view = elm_object_part_content_unset(g_ly, "list-content"); +// sub_view = elm_object_part_content_unset(g_ly, "list-content"); track_list = mc_track_list_create(ad->navi_bar, ad); mc_track_list_set_data(track_list, track_type, name, playlist_id); @@ -77,15 +81,19 @@ void mc_common_push_track_view_by_group_name(void *data, int track_type, const c elm_object_part_content_set(navi_layout, "list-content", track_list); detail_view = true; - it = elm_naviframe_item_push(ad->navi_bar, NULL, NULL, NULL, navi_layout, NULL); + it = elm_naviframe_item_push(ad->navi_bar, NULL, NULL, NULL, + navi_layout, NULL); mc_track_list_update(track_list, it, sub_view); if (track_type == MP_TRACK_BY_ALBUM) { - mc_common_obj_domain_text_translate(ad->navi_bar, MC_TEXT_SELECT_ALBUM); + mc_common_obj_domain_text_translate(ad->navi_bar, + MC_TEXT_SELECT_ALBUM); } else if (track_type == MP_TRACK_BY_ARTIST) { - mc_common_obj_domain_text_translate(ad->navi_bar, MC_TEXT_SELECT_ARTIST); + mc_common_obj_domain_text_translate(ad->navi_bar, + MC_TEXT_SELECT_ARTIST); } else if (track_type == MP_TRACK_BY_PLAYLIST) { - mc_common_obj_domain_text_translate(ad->navi_bar, MC_TEXT_SELECT_PLAYLIST); + mc_common_obj_domain_text_translate(ad->navi_bar, + MC_TEXT_SELECT_PLAYLIST); } else { mc_common_obj_domain_text_translate(ad->navi_bar, MC_TEXT_SELECT); } @@ -93,48 +101,65 @@ void mc_common_push_track_view_by_group_name(void *data, int track_type, const c #ifdef MC_AUTO_RECOMMENDED if (ad->auto_recommended_show) { elm_object_signal_emit(layout, "show.recommended", "*"); - Evas_Object *recommended_area = mc_common_load_edj(ad->navi_bar, MC_EDJ_FILE, "recommended_area"); - elm_object_part_content_set(layout, "recommended", recommended_area); - mc_common_obj_domain_translatable_part_text_set(recommended_area, "title_text", MC_TEXT_SET_AS_AUTO_RECOMMEND); - mc_common_obj_domain_translatable_part_text_set(recommended_area, "description_text", MC_TEXT_SET_AS_RECOMMENDED_TXT); - - /*add check box*/ + Evas_Object *recommended_area = + mc_common_load_edj(ad->navi_bar, MC_EDJ_FILE, + "recommended_area"); + elm_object_part_content_set(layout, "recommended", + recommended_area); + mc_common_obj_domain_translatable_part_text_set(recommended_area, + "title_text", + MC_TEXT_SET_AS_AUTO_RECOMMEND); + mc_common_obj_domain_translatable_part_text_set(recommended_area, + "description_text", + MC_TEXT_SET_AS_RECOMMENDED_TXT); + + /*add check box */ Evas_Object *check = elm_check_add(recommended_area); elm_check_state_set(check, ad->auto_recommended_on); elm_object_part_content_set(recommended_area, "check_box", check); - evas_object_smart_callback_add(check, "changed", mc_auto_recommended_check_cb, ad); + evas_object_smart_callback_add(check, "changed", + mc_auto_recommended_check_cb, ad); evas_object_show(recommended_area); } #endif - /*reset back button callback*/ + /*reset back button callback */ elm_naviframe_item_pop_cb_set(g_navi_it, _back_cb, ad); endfunc; } -Elm_Object_Item *mc_common_toolbar_item_append(Evas_Object *obj, const char *icon, - const char *label, Evas_Smart_Cb func, - const void *data) +Elm_Object_Item *mc_common_toolbar_item_append(Evas_Object * obj, + const char *icon, + const char *label, + Evas_Smart_Cb func, + const void *data) { - Elm_Object_Item *item = elm_toolbar_item_append(obj, icon, label, func, data); + Elm_Object_Item *item = + elm_toolbar_item_append(obj, icon, label, func, data); MP_CHECK_NULL(item); - elm_object_item_domain_text_translatable_set(item, DOMAIN_NAME, EINA_TRUE); + elm_object_item_domain_text_translatable_set(item, DOMAIN_NAME, + EINA_TRUE); return item; } -void mc_common_obj_domain_text_translate(Evas_Object *obj, const char *label) +void mc_common_obj_domain_text_translate(Evas_Object * obj, + const char *label) { MP_CHECK(obj); - elm_object_domain_translatable_text_set(obj, DOMAIN_NAME, (const char *)label); + elm_object_domain_translatable_text_set(obj, DOMAIN_NAME, + (const char *) label); } -void mc_common_obj_domain_translatable_part_text_set(Evas_Object *obj, const char* part, const char* label) +void mc_common_obj_domain_translatable_part_text_set(Evas_Object * obj, + const char *part, + const char *label) { MP_CHECK(obj); - elm_object_domain_translatable_part_text_set(obj, part, DOMAIN_NAME, label); + elm_object_domain_translatable_part_text_set(obj, part, DOMAIN_NAME, + label); } Evas_Object *mc_widget_genlist_create(Evas_Object * parent) @@ -164,21 +189,22 @@ bool mc_is_call_connected(void) telephony_handle_list_s tel_list; int tel_valid = telephony_init(&tel_list); if (tel_valid != 0) { - ERROR_TRACE("telephony is not initialized. ERROR Code is %d", tel_valid); + ERROR_TRACE("telephony is not initialized. ERROR Code is %d", + tel_valid); return false; } telephony_h *newhandle = tel_list.handle; - int error = telephony_call_get_voice_call_state(*newhandle , &state); + int error = telephony_call_get_voice_call_state(*newhandle, &state); telephony_deinit(&tel_list); if (error == TELEPHONY_ERROR_NONE) { if (state == TELEPHONY_CALL_STATE_IDLE) { - return false; /*There exists no calls*/ + return false; /*There exists no calls */ } - /* There exists at least one call that is dialing, alerting or incoming*/ + /* There exists at least one call that is dialing, alerting or incoming */ return true; } else { ERROR_TRACE("ERROR: state error is %d", error); @@ -186,7 +212,9 @@ bool mc_is_call_connected(void) return false; } -bool mc_get_supported_storages_callback(int storageId, storage_type_e type, storage_state_e state, const char *path, void *userData) +bool mc_get_supported_storages_callback(int storageId, storage_type_e type, + storage_state_e state, + const char *path, void *userData) { if (type == STORAGE_TYPE_EXTERNAL) { external_mmc_id = storageId; @@ -197,7 +225,9 @@ bool mc_get_supported_storages_callback(int storageId, storage_type_e type, stor bool mc_is_mmc_removed(void) { - int error = storage_foreach_device_supported(mc_get_supported_storages_callback, NULL); + int error = + storage_foreach_device_supported + (mc_get_supported_storages_callback, NULL); if (error == STORAGE_ERROR_NONE) { storage_state_e state; storage_get_state(external_mmc_id, &state); @@ -222,13 +252,16 @@ bool mc_check_file_exist(const char *path) } if (strstr(path, MC_FILE_PREFIX)) { - if (!g_file_test(path + strlen(MC_FILE_PREFIX), G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) { + if (!g_file_test + (path + strlen(MC_FILE_PREFIX), + G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) { ERROR_TRACE("file not exist: %s", path); return FALSE; } return TRUE; } else { - if (!g_file_test(path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) { + if (!g_file_test + (path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) { ERROR_TRACE("file not exist: %s", path); return FALSE; } @@ -237,7 +270,7 @@ bool mc_check_file_exist(const char *path) return TRUE; } -bool mc_check_image_valid(Evas *evas, const char *path) +bool mc_check_image_valid(Evas * evas, const char *path) { if (!path) { return false; @@ -269,10 +302,10 @@ bool mc_check_image_valid(Evas *evas, const char *path) return true; } -char *mc_artist_text_get(void *data, Evas_Object *obj, const char *part) +char *mc_artist_text_get(void *data, Evas_Object * obj, const char *part) { char *text = NULL; - list_item_data_t *item_data = (list_item_data_t*)data; + list_item_data_t *item_data = (list_item_data_t *) data; MP_CHECK_NULL(item_data); mp_media_info_h handle = item_data->media; @@ -284,25 +317,31 @@ char *mc_artist_text_get(void *data, Evas_Object *obj, const char *part) int song_count; int album_count = 0; - mp_media_info_group_get_album_thumnail_paths(handle, &album_thumbs, &album_count); + mp_media_info_group_get_album_thumnail_paths(handle, &album_thumbs, + &album_count); mp_media_info_group_get_main_info(handle, &text); - mp_media_info_list_count(MP_TRACK_BY_ARTIST, text, NULL, NULL, 0, &song_count); + mp_media_info_list_count(MP_TRACK_BY_ARTIST, text, NULL, NULL, 0, + &song_count); if (album_count == 1 && song_count == 1) { text = g_strdup(GET_STR(STR_MP_1_ALBUM_1_SONG)); } else if (album_count == 1 && song_count > 1) { - text = g_strdup_printf(GET_STR(STR_MP_1_ALBUM_PD_SONGS), song_count); + text = + g_strdup_printf(GET_STR(STR_MP_1_ALBUM_PD_SONGS), + song_count); } else { - text = g_strdup_printf(GET_STR(STR_MP_PD_ALBUMS_PD_SONGS), album_count, song_count); + text = + g_strdup_printf(GET_STR(STR_MP_PD_ALBUMS_PD_SONGS), + album_count, song_count); } return text; } return NULL; } -char *mc_album_text_get(void *data, Evas_Object *obj, const char *part) +char *mc_album_text_get(void *data, Evas_Object * obj, const char *part) { char *text = NULL; - list_item_data_t *item_data = (list_item_data_t*)data; + list_item_data_t *item_data = (list_item_data_t *) data; MP_CHECK_NULL(item_data); mp_media_info_h handle = item_data->media; @@ -319,7 +358,9 @@ char *mc_album_text_get(void *data, Evas_Object *obj, const char *part) int count; ret = mp_media_info_group_get_main_info(handle, &text); MP_CHECK_NULL(ret == 0); - ret = mp_media_info_list_count(MP_TRACK_BY_ALBUM, text, NULL, NULL, 0, &count); + ret = + mp_media_info_list_count(MP_TRACK_BY_ALBUM, text, NULL, NULL, + 0, &count); MP_CHECK_NULL(ret == 0); text = g_strdup_printf("(%d)", count); return text; @@ -327,10 +368,10 @@ char *mc_album_text_get(void *data, Evas_Object *obj, const char *part) return NULL; } -char * mc_playlist_text_get(void *data, Evas_Object *obj, const char *part) +char *mc_playlist_text_get(void *data, Evas_Object * obj, const char *part) { char *text = NULL; - list_item_data_t *item_data = (list_item_data_t*)data; + list_item_data_t *item_data = (list_item_data_t *) data; MP_CHECK_NULL(item_data); mp_media_info_h handle = item_data->media; @@ -345,15 +386,20 @@ char * mc_playlist_text_get(void *data, Evas_Object *obj, const char *part) int count = 0; mp_media_info_group_get_playlist_id(handle, &id); if (id == MP_SYS_PLST_MOST_PLAYED) { - mp_media_info_list_count(MP_TRACK_BY_PLAYED_COUNT, NULL, NULL, NULL, 0, &count); + mp_media_info_list_count(MP_TRACK_BY_PLAYED_COUNT, NULL, NULL, + NULL, 0, &count); } else if (id == MP_SYS_PLST_RECENTELY_ADDED) { - mp_media_info_list_count(MP_TRACK_BY_ADDED_TIME, NULL, NULL, NULL, 0, &count); + mp_media_info_list_count(MP_TRACK_BY_ADDED_TIME, NULL, NULL, + NULL, 0, &count); } else if (id == MP_SYS_PLST_RECENTELY_PLAYED) { - mp_media_info_list_count(MP_TRACK_BY_PLAYED_TIME, NULL, NULL, NULL, 0, &count); + mp_media_info_list_count(MP_TRACK_BY_PLAYED_TIME, NULL, NULL, + NULL, 0, &count); } else if (id == MP_SYS_PLST_QUICK_LIST) { - mp_media_info_list_count(MP_TRACK_BY_FAVORITE, NULL, NULL, NULL, 0, &count); + mp_media_info_list_count(MP_TRACK_BY_FAVORITE, NULL, NULL, + NULL, 0, &count); } else { - mp_media_info_list_count(MP_TRACK_BY_PLAYLIST, NULL, NULL, NULL, id, &count); + mp_media_info_list_count(MP_TRACK_BY_PLAYLIST, NULL, NULL, + NULL, id, &count); } text = g_strdup_printf("(%d)", count); return text; @@ -361,16 +407,18 @@ char * mc_playlist_text_get(void *data, Evas_Object *obj, const char *part) return NULL; } -char *mc_folder_list_label_get(void *data, Evas_Object * obj, const char *part) +char *mc_folder_list_label_get(void *data, Evas_Object * obj, + const char *part) { char *name = NULL; int ret = 0; - list_item_data_t *item_data = (list_item_data_t*)data; + list_item_data_t *item_data = (list_item_data_t *) data; MP_CHECK_NULL(item_data); mp_media_info_h svc_item = item_data->media; MP_CHECK_NULL(svc_item); - if (!strcmp(part, "elm.text.main.left.top") || !strcmp(part, "elm.slide.text.1")) { + if (!strcmp(part, "elm.text.main.left.top") + || !strcmp(part, "elm.slide.text.1")) { ret = mp_media_info_group_get_main_info(svc_item, &name); mp_retvm_if((ret != 0), NULL, "Fail to get value"); if (!name || !strlen(name)) { @@ -399,12 +447,13 @@ char *mc_folder_list_label_get(void *data, Evas_Object * obj, const char *part) } -Evas_Object * mc_group_content_get(void *data, Evas_Object *obj, const char *part) +Evas_Object *mc_group_content_get(void *data, Evas_Object * obj, + const char *part) { Evas_Object *content = NULL; Evas_Object *icon = NULL; char *thumbpath = NULL; - list_item_data_t *item_data = (list_item_data_t*)data; + list_item_data_t *item_data = (list_item_data_t *) data; MP_CHECK_NULL(item_data); mp_media_info_h handle = item_data->media; @@ -415,14 +464,16 @@ Evas_Object * mc_group_content_get(void *data, Evas_Object *obj, const char *par if (mc_check_image_valid(evas_object_evas_get(obj), thumbpath)) { elm_image_file_set(icon, thumbpath, NULL); } else { - char default_thumbnail[1024] = {0}; + char default_thumbnail[1024] = { 0 }; char *shared_path = app_get_shared_resource_path(); - snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, "shared_images", DEFAULT_THUMBNAIL); + snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, + "shared_images", DEFAULT_THUMBNAIL); free(shared_path); elm_image_file_set(icon, default_thumbnail, NULL); } - elm_layout_theme_set(content, "layout", "list/B/type.1", "default"); + elm_layout_theme_set(content, "layout", "list/B/type.1", + "default"); elm_layout_content_set(content, "elm.swallow.content", icon); evas_object_repeat_events_set(content, EINA_TRUE); @@ -432,14 +483,13 @@ Evas_Object * mc_group_content_get(void *data, Evas_Object *obj, const char *par return content; } -void -mc_eext_quit_cb(void *data, Evas_Object *obj, void *event_info) +void mc_eext_quit_cb(void *data, Evas_Object * obj, void *event_info) { DEBUG_TRACE(""); elm_exit(); } -Eina_Bool mc_quit_cb(void *data, Elm_Object_Item *it) +Eina_Bool mc_quit_cb(void *data, Elm_Object_Item * it) { DEBUG_TRACE(""); elm_exit(); @@ -448,7 +498,8 @@ Eina_Bool mc_quit_cb(void *data, Elm_Object_Item *it) } #ifdef MC_AUTO_RECOMMENDED -void mc_auto_recommended_check_cb(void *data, Evas_Object *obj, void *event_info) +void mc_auto_recommended_check_cb(void *data, Evas_Object * obj, + void *event_info) { //elm_object_signal_emit(g_ly, "hide.recommended", "*"); startfunc; @@ -458,17 +509,20 @@ void mc_auto_recommended_check_cb(void *data, Evas_Object *obj, void *event_info Eina_Bool state = elm_check_state_get(obj); ad->auto_recommended_on = state; - /*find the selected item*/ + /*find the selected item */ int index = mc_track_list_get_radio(); DEBUG_TRACE("pre play item is %d", index); - Evas_Object *genlist = elm_layout_content_get(ad->track_list, "list_content"); + Evas_Object *genlist = + elm_layout_content_get(ad->track_list, "list_content"); if (genlist) { ERROR_TRACE("genlist is NULL"); } - Elm_Object_Item *pre_play_item = elm_genlist_nth_item_get(genlist, index); + Elm_Object_Item *pre_play_item = + elm_genlist_nth_item_get(genlist, index); - list_item_data_t *pre_play_item_data = elm_object_item_data_get(pre_play_item); + list_item_data_t *pre_play_item_data = + elm_object_item_data_get(pre_play_item); if (pre_play_item_data) { ERROR_TRACE("item data is NULL"); } @@ -477,14 +531,14 @@ void mc_auto_recommended_check_cb(void *data, Evas_Object *obj, void *event_info } #endif -void -mc_quit_select_cb(void *data, Evas_Object *obj, void *event_info) +void mc_quit_select_cb(void *data, Evas_Object * obj, void *event_info) { DEBUG_TRACE(""); elm_exit(); } -Evas_Object *mc_common_load_edj(Evas_Object * parent, const char *file, const char *group) +Evas_Object *mc_common_load_edj(Evas_Object * parent, const char *file, + const char *group) { Evas_Object *eo = NULL; int r = -1; @@ -496,7 +550,8 @@ Evas_Object *mc_common_load_edj(Evas_Object * parent, const char *file, const ch evas_object_del(eo); return NULL; } - evas_object_size_hint_weight_set(eo, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(eo, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); evas_object_show(eo); } evas_object_name_set(eo, group); @@ -504,8 +559,7 @@ Evas_Object *mc_common_load_edj(Evas_Object * parent, const char *file, const ch return eo; } -Evas_Object * -mc_widget_navigation_new(Evas_Object * parent) +Evas_Object *mc_widget_navigation_new(Evas_Object * parent) { Evas_Object *navi_bar; mp_retv_if(parent == NULL, NULL); @@ -517,7 +571,9 @@ mc_widget_navigation_new(Evas_Object * parent) return navi_bar; } -void mc_common_create_fastscroller(Evas_Object *parent, Eina_Bool multiple, Evas_Object *genlist) +void mc_common_create_fastscroller(Evas_Object * parent, + Eina_Bool multiple, + Evas_Object * genlist) { startfunc; Evas_Object *index; @@ -527,11 +583,12 @@ void mc_common_create_fastscroller(Evas_Object *parent, Eina_Bool multiple, Evas } else { index = mc_index_create(parent, 0, genlist); } - elm_scroller_policy_set(genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); + elm_scroller_policy_set(genlist, ELM_SCROLLER_POLICY_OFF, + ELM_SCROLLER_POLICY_OFF); elm_layout_content_set(parent, "elm.swallow.content.index", index); mc_index_append_item(index, genlist); - return ; + return; } Evas_Object *mc_common_create_processing_popup(void *data) @@ -544,44 +601,51 @@ Evas_Object *mc_common_create_processing_popup(void *data) popup = elm_popup_add(ad->base_layout); //eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, eext_popup_back_cb, NULL); - char mc_edj_path[1024] = {0}; + char mc_edj_path[1024] = { 0 }; char *path = app_get_resource_path(); MP_CHECK_NULL(path); snprintf(mc_edj_path, 1024, "%s%s", path, MC_EDJ_FILE); free(path); Evas_Object *layout = elm_layout_add(popup); - elm_layout_file_set(layout, mc_edj_path, "popup_processingview_1button"); - /*create circle progressbar*/ + elm_layout_file_set(layout, mc_edj_path, + "popup_processingview_1button"); + /*create circle progressbar */ progressbar = elm_progressbar_add(popup); elm_object_style_set(progressbar, "process_large"); evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.5); - evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); evas_object_show(progressbar); elm_progressbar_pulse(progressbar, EINA_TRUE); - elm_object_part_content_set(layout, "elm.swallow.content", progressbar); - mc_common_obj_domain_translatable_part_text_set(layout, "elm.text", "IDS_COM_BODY_LOADING"); + elm_object_part_content_set(layout, "elm.swallow.content", + progressbar); + mc_common_obj_domain_translatable_part_text_set(layout, "elm.text", + "IDS_COM_BODY_LOADING"); elm_object_content_set(popup, layout); - evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); evas_object_show(popup); return popup; } #define DEF_BUF_LEN (512) -const char *mc_common_search_markup_keyword(const char *string, char *searchword, bool *result) +const char *mc_common_search_markup_keyword(const char *string, + char *searchword, + bool * result) { - char pstr[DEF_BUF_LEN + 1] = {0,}; + char pstr[DEF_BUF_LEN + 1] = { 0, }; static char return_string[DEF_BUF_LEN + 1] = { 0, }; int word_len = 0; int search_len = 0; int i = 0; bool found = false; - gchar* markup_text_start = NULL; - gchar* markup_text_end = NULL; - gchar* markup_text = NULL; + gchar *markup_text_start = NULL; + gchar *markup_text_end = NULL; + gchar *markup_text = NULL; MP_CHECK_NULL(string && strlen(string)); MP_CHECK_NULL(searchword && strlen(searchword)); @@ -591,15 +655,18 @@ const char *mc_common_search_markup_keyword(const char *string, char *searchword word_len = strlen(string); if (word_len > DEF_BUF_LEN) { - char *temp = (char*)calloc((word_len + 1), sizeof(char)); + char *temp = (char *) calloc((word_len + 1), sizeof(char)); MP_CHECK_NULL(temp); if (strlen(string) <= DEF_BUF_LEN) { - strncpy(temp, string , strlen(string)); + strncpy(temp, string, strlen(string)); } i = 0; while (word_len > DEF_BUF_LEN) { - /*truncate uft8 to byte_size DEF_BUF_LEN*/ - gchar *pre_ch = g_utf8_find_prev_char(temp, (temp + DEF_BUF_LEN - 1 - i * 3)); + /*truncate uft8 to byte_size DEF_BUF_LEN */ + gchar *pre_ch = + g_utf8_find_prev_char(temp, + (temp + DEF_BUF_LEN - 1 - + i * 3)); if (!pre_ch) { break; } @@ -607,7 +674,7 @@ const char *mc_common_search_markup_keyword(const char *string, char *searchword if (!next_ch) { break; } - /*truncate position*/ + /*truncate position */ *next_ch = '\0'; word_len = strlen(temp); i++; @@ -638,26 +705,28 @@ const char *mc_common_search_markup_keyword(const char *string, char *searchword if (found) { if (i == 0) { markup_text = g_markup_escape_text(&pstr[0], search_len); - markup_text_end = g_markup_escape_text(&pstr[search_len], word_len - search_len); + markup_text_end = + g_markup_escape_text(&pstr[search_len], + word_len - search_len); MP_CHECK_NULL(markup_text && markup_text_end); snprintf(return_string, - DEF_BUF_LEN, - "%s%s", - markup_text, - (char*)markup_text_end); + DEF_BUF_LEN, + "%s%s", + markup_text, (char *) markup_text_end); IF_FREE(markup_text); IF_FREE(markup_text_end); } else { markup_text_start = g_markup_escape_text(&pstr[0], i); markup_text = g_markup_escape_text(&pstr[i], search_len); - markup_text_end = g_markup_escape_text(&pstr[i + search_len], word_len - (i + search_len)); - MP_CHECK_NULL(markup_text_start && markup_text && markup_text_end); - snprintf(return_string, - DEF_BUF_LEN, - "%s%s%s", - (char*)markup_text_start, - markup_text, - (char*)markup_text_end); + markup_text_end = + g_markup_escape_text(&pstr[i + search_len], + word_len - (i + search_len)); + MP_CHECK_NULL(markup_text_start && markup_text + && markup_text_end); + snprintf(return_string, DEF_BUF_LEN, + "%s%s%s", + (char *) markup_text_start, markup_text, + (char *) markup_text_end); IF_FREE(markup_text); IF_FREE(markup_text_start); IF_FREE(markup_text_end); @@ -670,7 +739,8 @@ const char *mc_common_search_markup_keyword(const char *string, char *searchword return return_string; } -Evas_Object *mc_common_create_thumb_icon(Evas_Object * obj, const char *path, int w, int h) +Evas_Object *mc_common_create_thumb_icon(Evas_Object * obj, + const char *path, int w, int h) { Evas_Object *thumbnail = elm_image_add(obj); if (w == h) { @@ -678,20 +748,24 @@ Evas_Object *mc_common_create_thumb_icon(Evas_Object * obj, const char *path, in elm_image_fill_outside_set(thumbnail, true); } - if ((!path) || !g_file_test(path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR) || !strcmp(BROKEN_ALBUMART_IMAGE_PATH, path)) { - char default_thumbnail[1024] = {0}; + if ((!path) + || !g_file_test(path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR) + || !strcmp(BROKEN_ALBUMART_IMAGE_PATH, path)) { + char default_thumbnail[1024] = { 0 }; char *shared_path = app_get_shared_resource_path(); - snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, "shared_images", DEFAULT_THUMBNAIL); + snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, + "shared_images", DEFAULT_THUMBNAIL); free(shared_path); path = g_strdup(default_thumbnail); } elm_image_file_set(thumbnail, path, NULL); - evas_object_size_hint_align_set(thumbnail, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(thumbnail, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(thumbnail, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_size_hint_weight_set(thumbnail, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); evas_object_show(thumbnail); //endfunc; return thumbnail; } - diff --git a/music-chooser/src/mc-group-list.c b/music-chooser/src/mc-group-list.c index 90bf586..be8fabf 100644 --- a/music-chooser/src/mc-group-list.c +++ b/music-chooser/src/mc-group-list.c @@ -38,8 +38,7 @@ typedef struct { #define GET_LIST_DATA(obj) evas_object_data_get(obj, "list_data") -static Evas_Object * -_mc_create_genlist(Evas_Object *parent) +static Evas_Object *_mc_create_genlist(Evas_Object * parent) { Evas_Object *genlist = NULL; MP_CHECK_NULL(parent); @@ -52,10 +51,10 @@ _mc_create_genlist(Evas_Object *parent) return genlist; } -static void _gl_sel_cb(void *data, Evas_Object *obj, void *event_info) +static void _gl_sel_cb(void *data, Evas_Object * obj, void *event_info) { startfunc; - group_list_data_t *ld = data; + group_list_data_t *ld = data; char *name = NULL; char *folder = NULL; char *folder_name = NULL; @@ -65,7 +64,8 @@ static void _gl_sel_cb(void *data, Evas_Object *obj, void *event_info) elm_genlist_item_selected_set(event_info, EINA_FALSE); MP_CHECK(ld); - list_item_data_t *item_data = (list_item_data_t*)elm_object_item_data_get(event_info); + list_item_data_t *item_data = + (list_item_data_t *) elm_object_item_data_get(event_info); mp_media_info_h media = item_data->media; MP_CHECK(media); mp_media_info_group_get_main_info(media, &name); @@ -92,9 +92,11 @@ static void _gl_sel_cb(void *data, Evas_Object *obj, void *event_info) } if (ld->type == MP_GROUP_BY_FOLDER) { - mc_common_push_track_view_by_group_name(ld->ad, track_type, folder, playlist_id, folder_name); + mc_common_push_track_view_by_group_name(ld->ad, track_type, folder, + playlist_id, folder_name); } else { - mc_common_push_track_view_by_group_name(ld->ad, track_type, name, playlist_id, NULL); + mc_common_push_track_view_by_group_name(ld->ad, track_type, name, + playlist_id, NULL); } } @@ -102,7 +104,7 @@ static void _layout_del_cb(void *data, Evas * e, Evas_Object * obj, void *event_info) { startfunc; - group_list_data_t *ld = data; + group_list_data_t *ld = data; MP_CHECK(ld); if (ld->group_list) { @@ -119,8 +121,7 @@ _layout_del_cb(void *data, Evas * e, Evas_Object * obj, void *event_info) free(ld); } -static void -_mc_itc_init(int type, group_list_data_t *ld) +static void _mc_itc_init(int type, group_list_data_t * ld) { MP_CHECK(ld); @@ -153,16 +154,18 @@ _mc_itc_init(int type, group_list_data_t *ld) } -Evas_Object *mc_group_list_create(Evas_Object *parent, struct app_data *ad, Elm_Object_Item *navi_it) +Evas_Object *mc_group_list_create(Evas_Object * parent, + struct app_data *ad, + Elm_Object_Item * navi_it) { startfunc; - Evas_Object *layout ; + Evas_Object *layout; group_list_data_t *ld = NULL; MP_CHECK_NULL(parent); MP_CHECK_NULL(ad); - char mc_edj_path[1024] = {0}; + char mc_edj_path[1024] = { 0 }; char *path = app_get_resource_path(); MP_CHECK_NULL(path); snprintf(mc_edj_path, 1024, "%s%s", path, MC_EDJ_FILE); @@ -177,30 +180,32 @@ Evas_Object *mc_group_list_create(Evas_Object *parent, struct app_data *ad, Elm_ ld->win_navi_it = navi_it; /* - Evas_Object *title_btn = elm_object_item_part_content_unset(ld->win_navi_it, "title_right_btn"); - if (title_btn) - evas_object_del(title_btn); - */ + Evas_Object *title_btn = elm_object_item_part_content_unset(ld->win_navi_it, "title_right_btn"); + if (title_btn) + evas_object_del(title_btn); + */ - Evas_Object *done_btn = elm_object_item_part_content_unset(ld->win_navi_it, "toolbar"); + Evas_Object *done_btn = + elm_object_item_part_content_unset(ld->win_navi_it, "toolbar"); if (done_btn) { evas_object_del(done_btn); } evas_object_data_set(layout, "list_data", ld); - evas_object_event_callback_add(layout, EVAS_CALLBACK_FREE, _layout_del_cb, ld); + evas_object_event_callback_add(layout, EVAS_CALLBACK_FREE, + _layout_del_cb, ld); - /*elm_naviframe_item_pop_cb_set(navi_it, mc_quit_cb, ad);*/ + /*elm_naviframe_item_pop_cb_set(navi_it, mc_quit_cb, ad); */ return layout; } -int mc_group_list_update(Evas_Object *list) +int mc_group_list_update(Evas_Object * list) { startfunc; Evas_Object *content; int count = 0; - group_list_data_t *ld = GET_LIST_DATA(list); + group_list_data_t *ld = GET_LIST_DATA(list); MP_CHECK_VAL(ld, -1); if (ld->group_list) { @@ -220,19 +225,23 @@ int mc_group_list_update(Evas_Object *list) if (count || ld->type == MP_GROUP_BY_PLAYLIST) { content = _mc_create_genlist(list); - /*if playlist, add auto playlist firstly*/ + /*if playlist, add auto playlist firstly */ if (ld->type == MP_GROUP_BY_PLAYLIST) { mp_media_list_h playlists_auto = NULL; - mp_media_info_group_list_create(&playlists_auto, MP_GROUP_BY_SYS_PLAYLIST, NULL, NULL, 0, 0); + mp_media_info_group_list_create(&playlists_auto, + MP_GROUP_BY_SYS_PLAYLIST, NULL, + NULL, 0, 0); ld->playlists_auto = playlists_auto; int i = 0; for (i = 0; i < MP_SYS_PLST_COUNT; i++) { - mp_media_info_h media = mp_media_info_group_list_nth_item(playlists_auto, i); + mp_media_info_h media = + mp_media_info_group_list_nth_item(playlists_auto, i); if (!media) { continue; } - list_item_data_t *item_data = calloc(1, sizeof(list_item_data_t)); + list_item_data_t *item_data = + calloc(1, sizeof(list_item_data_t)); if (!item_data) { break; } @@ -240,21 +249,27 @@ int mc_group_list_update(Evas_Object *list) item_data->media = media; item_data->index = i; - item_data->it = elm_genlist_item_append(content, &ld->itc, item_data, NULL, ELM_GENLIST_ITEM_NONE, _gl_sel_cb, ld); + item_data->it = + elm_genlist_item_append(content, &ld->itc, item_data, + NULL, ELM_GENLIST_ITEM_NONE, + _gl_sel_cb, ld); elm_object_item_data_set(item_data->it, item_data); } } - mp_media_info_group_list_create(&ld->group_list, ld->type, ld->type_str, NULL, 0, count); + mp_media_info_group_list_create(&ld->group_list, ld->type, + ld->type_str, NULL, 0, count); int i = 0; for (i = 0; i < count; i++) { - mp_media_info_h media = mp_media_info_group_list_nth_item(ld->group_list, i); + mp_media_info_h media = + mp_media_info_group_list_nth_item(ld->group_list, i); if (!media) { continue; } - list_item_data_t *item_data = calloc(1, sizeof(list_item_data_t)); + list_item_data_t *item_data = + calloc(1, sizeof(list_item_data_t)); MP_CHECK_VAL(item_data, -1); item_data->media = media; item_data->index = i; @@ -266,12 +281,19 @@ int mc_group_list_update(Evas_Object *list) item_data->list_type = MC_FOLDER; } - item_data->it = elm_genlist_item_append(content, &ld->itc, item_data, NULL, ELM_GENLIST_ITEM_NONE, _gl_sel_cb, ld); + item_data->it = + elm_genlist_item_append(content, &ld->itc, item_data, NULL, + ELM_GENLIST_ITEM_NONE, _gl_sel_cb, + ld); elm_object_item_data_set(item_data->it, item_data); - Evas_Object* right_button = elm_object_item_part_content_get(ld->win_navi_it, "title_right_btn"); + Evas_Object *right_button = + elm_object_item_part_content_get(ld->win_navi_it, + "title_right_btn"); mc_evas_object_del(right_button); - Evas_Object* left_button = elm_object_item_part_content_get(ld->win_navi_it, "title_left_btn"); + Evas_Object *left_button = + elm_object_item_part_content_get(ld->win_navi_it, + "title_left_btn"); mc_evas_object_del(left_button); } } else { @@ -286,14 +308,14 @@ int mc_group_list_update(Evas_Object *list) } if (count > 0) { - /*create fastscroller*/ + /*create fastscroller */ if (ld->ad->select_type == MC_SELECT_MULTI) { mc_common_create_fastscroller(list, EINA_TRUE, content); } else { mc_common_create_fastscroller(list, EINA_FALSE, content); } } else { - /*hide fastscroller*/ + /*hide fastscroller */ elm_object_signal_emit(list, "hide.fastscroll", "*"); } @@ -301,10 +323,11 @@ int mc_group_list_update(Evas_Object *list) return 0; } -int mc_group_list_set_data(Evas_Object *list, int group_type, const char *type_str) +int mc_group_list_set_data(Evas_Object * list, int group_type, + const char *type_str) { startfunc; - group_list_data_t *ld = GET_LIST_DATA(list); + group_list_data_t *ld = GET_LIST_DATA(list); MP_CHECK_VAL(ld, -1); ld->type = group_type; @@ -316,5 +339,3 @@ int mc_group_list_set_data(Evas_Object *list, int group_type, const char *type_s return 0; } - - diff --git a/music-chooser/src/mc-group-play-list.c b/music-chooser/src/mc-group-play-list.c index d5a9313..9f7b85f 100644 --- a/music-chooser/src/mc-group-play-list.c +++ b/music-chooser/src/mc-group-play-list.c @@ -34,15 +34,14 @@ typedef struct { } group_play_list_data_t; typedef struct { - //Elm_Object_Item *it; // Genlist Item pointer - Eina_Bool checked; // Check status + //Elm_Object_Item *it; // Genlist Item pointer + Eina_Bool checked; // Check status mp_media_info_h media; } list_item_data_t; #define GET_LIST_DATA(obj) evas_object_data_get(obj, "list_data") -static Evas_Object * -_mc_create_genlist(Evas_Object *parent) +static Evas_Object *_mc_create_genlist(Evas_Object * parent) { Evas_Object *genlist = NULL; MP_CHECK_NULL(parent); @@ -53,7 +52,8 @@ _mc_create_genlist(Evas_Object *parent) return genlist; } -static Evas_Object *_gl_content_get(void *data, Evas_Object *obj, const char *part) +static Evas_Object *_gl_content_get(void *data, Evas_Object * obj, + const char *part) { Evas_Object *content = NULL; char *thumbpath = NULL; @@ -72,9 +72,10 @@ static Evas_Object *_gl_content_get(void *data, Evas_Object *obj, const char *pa if (mc_check_image_valid(evas_object_evas_get(obj), thumbpath)) { elm_bg_file_set(content, thumbpath, NULL); } else { - char default_thumbnail[1024] = {0}; + char default_thumbnail[1024] = { 0 }; char *shared_path = app_get_shared_resource_path(); - snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, "shared_images", DEFAULT_THUMBNAIL); + snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, + "shared_images", DEFAULT_THUMBNAIL); free(shared_path); elm_bg_file_set(content, default_thumbnail, NULL); } @@ -83,7 +84,7 @@ static Evas_Object *_gl_content_get(void *data, Evas_Object *obj, const char *pa return content; } -static char *_gl_text_get(void *data, Evas_Object *obj, const char *part) +static char *_gl_text_get(void *data, Evas_Object * obj, const char *part) { char *text = NULL; @@ -105,29 +106,27 @@ static char *_gl_text_get(void *data, Evas_Object *obj, const char *part) return NULL; } -static void _gl_del(void *data, Evas_Object *obj) +static void _gl_del(void *data, Evas_Object * obj) { list_item_data_t *it_data = data; IF_FREE(it_data); } -static Eina_Bool -_destroy_timer_cb(void *data) +static Eina_Bool _destroy_timer_cb(void *data) { - group_play_list_data_t *ld = data; + group_play_list_data_t *ld = data; MP_CHECK_FALSE(ld); ld->destroy_timer = NULL; elm_exit(); return EINA_FALSE; } -static unsigned int -_get_select_count(void *data)//(Evas_Object *genlist) +static unsigned int _get_select_count(void *data) //(Evas_Object *genlist) { startfunc; unsigned int count = 0; - group_play_list_data_t *ld = data; + group_play_list_data_t *ld = data; Elm_Object_Item *item; MP_CHECK_VAL(ld, 0); MP_CHECK_VAL(ld->genlist, 0); @@ -145,10 +144,10 @@ _get_select_count(void *data)//(Evas_Object *genlist) endfunc; } -static void _gl_sel_cb(void *data, Evas_Object *obj, void *event_info) +static void _gl_sel_cb(void *data, Evas_Object * obj, void *event_info) { startfunc; - group_play_list_data_t *ld = data; + group_play_list_data_t *ld = data; char *path = NULL; elm_genlist_item_selected_set(event_info, EINA_FALSE); @@ -168,7 +167,8 @@ static void _gl_sel_cb(void *data, Evas_Object *obj, void *event_info) app_control_add_extra_data(service, APP_CONTROL_DATA_PATH, path); app_control_add_extra_data(service, APP_CONTROL_DATA_SELECTED, path); - app_control_reply_to_launch_request(service, ld->ad->service, APP_CONTROL_RESULT_SUCCEEDED); + app_control_reply_to_launch_request(service, ld->ad->service, + APP_CONTROL_RESULT_SUCCEEDED); ld->destroy_timer = ecore_timer_add(0.1, _destroy_timer_cb, ld); @@ -179,22 +179,23 @@ static void _layout_del_cb(void *data, Evas * e, Evas_Object * obj, void *event_info) { startfunc; - group_play_list_data_t *ld = data; + group_play_list_data_t *ld = data; MP_CHECK(ld); - Evas_Object * right_btn = elm_object_item_part_content_get(ld->win_navi_it, "title_right_btn"); + Evas_Object *right_btn = + elm_object_item_part_content_get(ld->win_navi_it, + "title_right_btn"); evas_object_hide(right_btn); free(ld); } -static void -_done_cb(void *data, Evas_Object *obj, void *event_info) +static void _done_cb(void *data, Evas_Object * obj, void *event_info) { startfunc; char *fmt = ";%s"; GString *path = NULL; - group_play_list_data_t *ld = data; + group_play_list_data_t *ld = data; Elm_Object_Item *item; MP_CHECK(ld); @@ -221,9 +222,11 @@ _done_cb(void *data, Evas_Object *obj, void *event_info) app_control_h service = NULL; app_control_create(&service); app_control_add_extra_data(service, APP_CONTROL_DATA_PATH, path->str); - app_control_add_extra_data(service, APP_CONTROL_DATA_SELECTED, path->str); + app_control_add_extra_data(service, APP_CONTROL_DATA_SELECTED, + path->str); - app_control_reply_to_launch_request(service, ld->ad->service, APP_CONTROL_RESULT_SUCCEEDED); + app_control_reply_to_launch_request(service, ld->ad->service, + APP_CONTROL_RESULT_SUCCEEDED); ld->destroy_timer = ecore_timer_add(0.1, _destroy_timer_cb, ld); @@ -233,11 +236,12 @@ _done_cb(void *data, Evas_Object *obj, void *event_info) } -static void _mc_track_list_select_all_cb(void *data, Evas_Object *obj, void *event_info) +static void _mc_track_list_select_all_cb(void *data, Evas_Object * obj, + void *event_info) { startfunc; - group_play_list_data_t *ld = data; + group_play_list_data_t *ld = data; Elm_Object_Item *item; MP_CHECK(ld); @@ -260,7 +264,8 @@ static void _mc_track_list_select_all_cb(void *data, Evas_Object *obj, void *eve list_item_data_t *it_data = elm_object_item_data_get(item); it_data->checked = all_selected; - elm_genlist_item_fields_update(item, "elm.edit.icon.1", ELM_GENLIST_ITEM_FIELD_CONTENT); + elm_genlist_item_fields_update(item, "elm.edit.icon.1", + ELM_GENLIST_ITEM_FIELD_CONTENT); item = elm_genlist_item_next_get(item); } if (ld->btn_done) { @@ -273,10 +278,11 @@ static void _mc_track_list_select_all_cb(void *data, Evas_Object *obj, void *eve } -Evas_Object *mc_group_play_list_create(Evas_Object *parent, struct app_data *ad) +Evas_Object *mc_group_play_list_create(Evas_Object * parent, + struct app_data *ad) { startfunc; - Evas_Object *layout ; + Evas_Object *layout; group_play_list_data_t *ld = NULL; MP_CHECK_NULL(parent); @@ -292,7 +298,8 @@ Evas_Object *mc_group_play_list_create(Evas_Object *parent, struct app_data *ad) ld->ad = ad; evas_object_data_set(layout, "list_data", ld); - evas_object_event_callback_add(layout, EVAS_CALLBACK_FREE, _layout_del_cb, ld); + evas_object_event_callback_add(layout, EVAS_CALLBACK_FREE, + _layout_del_cb, ld); ld->itc.func.content_get = _gl_content_get; ld->itc.item_style = "2text.1icon.4"; @@ -303,24 +310,29 @@ Evas_Object *mc_group_play_list_create(Evas_Object *parent, struct app_data *ad) return layout; } -int mc_group_play_list_update(Evas_Object *list, Elm_Object_Item *navi_it) +int mc_group_play_list_update(Evas_Object * list, + Elm_Object_Item * navi_it) { startfunc; Evas_Object *content; int count = 0; - group_play_list_data_t *ld = GET_LIST_DATA(list); + group_play_list_data_t *ld = GET_LIST_DATA(list); MP_CHECK_VAL(ld, -1); - struct app_data *ad = ld->ad; + struct app_data *ad = ld->ad; MP_CHECK_VAL(ad, -1); ld->win_navi_it = navi_it; DEBUG_TRACE("add done button"); - Evas_Object *toolbar = mc_widget_create_naviframe_toolbar(ld->win_navi_it); - ld->btn_done = mc_widget_create_toolbar_item_btn(toolbar, - "naviframe/toolbar/default", GET_SYS_STR("IDS_COM_POP_DONE"), _done_cb, ld); + Evas_Object *toolbar = + mc_widget_create_naviframe_toolbar(ld->win_navi_it); + ld->btn_done = + mc_widget_create_toolbar_item_btn(toolbar, + "naviframe/toolbar/default", + GET_SYS_STR("IDS_COM_POP_DONE"), + _done_cb, ld); elm_object_item_disabled_set(ld->btn_done, true); @@ -329,20 +341,23 @@ int mc_group_play_list_update(Evas_Object *list, Elm_Object_Item *navi_it) elm_object_style_set(select_btn, "naviframe/title_icon"); ic = elm_icon_add(ad->navi_bar); - char image_path[1024] = {0}; + char image_path[1024] = { 0 }; char *path = app_get_resource_path(); MP_CHECK_VAL(path, -1); snprintf(image_path, 1024, "%s%s/%s", path, "edje", IMAGE_EDJ_NAME); elm_image_file_set(ic, image_path, "00_icon_edit.png"); free(path); - evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, + 1); elm_image_resizable_set(ic, EINA_TRUE, EINA_TRUE); elm_object_part_content_set(select_btn, "icon", ic); - evas_object_smart_callback_add(select_btn, "clicked", _mc_track_list_select_all_cb, ld); + evas_object_smart_callback_add(select_btn, "clicked", + _mc_track_list_select_all_cb, ld); evas_object_show(select_btn); - elm_object_item_part_content_set(ld->win_navi_it, "title_right_btn", select_btn); + elm_object_item_part_content_set(ld->win_navi_it, "title_right_btn", + select_btn); if (ld->track_list) { mp_media_info_list_destroy(ld->track_list); @@ -352,18 +367,23 @@ int mc_group_play_list_update(Evas_Object *list, Elm_Object_Item *navi_it) content = elm_layout_content_get(list, "elm.swallow.content"); evas_object_del(content); - mp_media_info_list_count(MP_TRACK_BY_GROUP_PLAY, NULL, NULL, NULL, 0, &count); + mp_media_info_list_count(MP_TRACK_BY_GROUP_PLAY, NULL, NULL, NULL, 0, + &count); if (count) { ld->genlist = content = _mc_create_genlist(list); - mp_media_info_list_create(&ld->track_list, MP_TRACK_BY_GROUP_PLAY, NULL, NULL, NULL, 0, 0, count); + mp_media_info_list_create(&ld->track_list, MP_TRACK_BY_GROUP_PLAY, + NULL, NULL, NULL, 0, 0, count); int i = 0; for (i = 0; i < count; i++) { - mp_media_info_h media = mp_media_info_list_nth_item(ld->track_list, i); + mp_media_info_h media = + mp_media_info_list_nth_item(ld->track_list, i); list_item_data_t *data = calloc(1, sizeof(list_item_data_t)); if (data) { data->media = media; - elm_genlist_item_append(content, &ld->itc, data, NULL, ELM_GENLIST_ITEM_NONE, _gl_sel_cb, ld); + elm_genlist_item_append(content, &ld->itc, data, NULL, + ELM_GENLIST_ITEM_NONE, _gl_sel_cb, + ld); } } } else { @@ -374,6 +394,3 @@ int mc_group_play_list_update(Evas_Object *list, Elm_Object_Item *navi_it) return 0; } - - - diff --git a/music-chooser/src/mc-index.c b/music-chooser/src/mc-index.c index 4eb183d..6018b6a 100644 --- a/music-chooser/src/mc-index.c +++ b/music-chooser/src/mc-index.c @@ -61,29 +61,29 @@ typedef struct { } MpIndexData_t; #define GET_WIDGET_DATA(o) evas_object_data_get(o, "widget_d"); -static const char *_mc_list_item_get_label(Elm_Object_Item *event_info) +static const char *_mc_list_item_get_label(Elm_Object_Item * event_info) { char *title = NULL; - list_item_data_t *item_data = elm_object_item_data_get(event_info); - if (!item_data || item_data->list_type < MC_TRACK || item_data->list_type > MC_FOLDER_TRACK) { + list_item_data_t *item_data = elm_object_item_data_get(event_info); + if (!item_data || item_data->list_type < MC_TRACK + || item_data->list_type > MC_FOLDER_TRACK) { return NULL; } if ((item_data->list_type == MC_TRACK) - || (item_data->list_type == MC_ALBUM_TRACK) - || (item_data->list_type == MC_ARTIST_TRACK) - || (item_data->list_type == MC_FOLDER_TRACK)) { + || (item_data->list_type == MC_ALBUM_TRACK) + || (item_data->list_type == MC_ARTIST_TRACK) + || (item_data->list_type == MC_FOLDER_TRACK)) { mp_media_info_get_title(item_data->media, &title); } else if ((item_data->list_type == MC_ALBUM) - || (item_data->list_type == MC_ARTIST) - || (item_data->list_type == MC_FOLDER)) { + || (item_data->list_type == MC_ARTIST) + || (item_data->list_type == MC_FOLDER)) { mp_media_info_group_get_main_info(item_data->media, &title); } return title; } -static gchar * -_mc_util_get_utf8_initial(const char *name) +static gchar *_mc_util_get_utf8_initial(const char *name) { gunichar first; char *next = NULL; @@ -95,17 +95,19 @@ _mc_util_get_utf8_initial(const char *name) first = g_utf8_get_char_validated(name, g_utf8_strlen(name, -1)); if (first == (gunichar) - 1 || first == (gunichar) - 2) { - DEBUG_TRACE("failed to convert a sequence of bytes encoded as UTF-8 to a Unicode character."); + DEBUG_TRACE + ("failed to convert a sequence of bytes encoded as UTF-8 to a Unicode character."); return strdup(""); } - next = (char *)name; + next = (char *) name; while (!g_unichar_isgraph(first)) { next = g_utf8_next_char(next); first = g_utf8_get_char_validated(next, g_utf8_strlen(name, -1)); if (first == (gunichar) - 1 || first == (gunichar) - 2) { - DEBUG_TRACE("failed to convert a sequence of bytes encoded as UTF-8 to a Unicode character."); + DEBUG_TRACE + ("failed to convert a sequence of bytes encoded as UTF-8 to a Unicode character."); return strdup(""); } } @@ -115,11 +117,12 @@ _mc_util_get_utf8_initial(const char *name) int index = 0; index = ((((first - 0xAC00) - ((first - 0xAC00) % 28)) / 28) / 21); if (index < 20 && index >= 0) { - const gunichar chosung[20] = { 0x3131, 0x3132, 0x3134, 0x3137, 0x3138, - 0x3139, 0x3141, 0x3142, 0x3143, 0x3145, - 0x3146, 0x3147, 0x3148, 0x3149, 0x314a, - 0x314b, 0x314c, 0x314d, 0x314e, 0 - }; + const gunichar chosung[20] = { + 0x3131, 0x3132, 0x3134, 0x3137, 0x3138, + 0x3139, 0x3141, 0x3142, 0x3143, 0x3145, + 0x3146, 0x3147, 0x3148, 0x3149, 0x314a, + 0x314b, 0x314c, 0x314d, 0x314e, 0 + }; gchar result[10] = { 0, }; int len = 0; @@ -136,19 +139,19 @@ _mc_util_get_utf8_initial(const char *name) } static void -_index_selected_cb(void *data, Evas_Object *obj, void *event_info) +_index_selected_cb(void *data, Evas_Object * obj, void *event_info) { - Elm_Object_Item *item = (Elm_Object_Item*)event_info; + Elm_Object_Item *item = (Elm_Object_Item *) event_info; elm_index_item_selected_set(item, EINA_FALSE); } static void -_mc_index_item_selected_cb(void *data, Evas_Object *obj, void *event_info) +_mc_index_item_selected_cb(void *data, Evas_Object * obj, void *event_info) { startfunc; const char *index_letter = NULL, *label = NULL; - Evas_Object *genlist = (Evas_Object *)data; + Evas_Object *genlist = (Evas_Object *) data; MP_CHECK(genlist); MpIndexData_t *wd = GET_WIDGET_DATA(obj); @@ -176,14 +179,16 @@ _mc_index_item_selected_cb(void *data, Evas_Object *obj, void *event_info) } if (!g_strcmp0(index_letter, wd->first)) { if (uni[0] < 'A' || uni[0] > 'z') { - elm_genlist_item_bring_in(gl_item, ELM_GENLIST_ITEM_SCROLLTO_TOP); + elm_genlist_item_bring_in(gl_item, + ELM_GENLIST_ITEM_SCROLLTO_TOP); IF_FREE(uni); break; } } if (!strcasecmp(uni, index_letter)) { - elm_genlist_item_bring_in(gl_item, ELM_GENLIST_ITEM_SCROLLTO_TOP); + elm_genlist_item_bring_in(gl_item, + ELM_GENLIST_ITEM_SCROLLTO_TOP); IF_FREE(uni); break; } else { @@ -193,8 +198,9 @@ _mc_index_item_selected_cb(void *data, Evas_Object *obj, void *event_info) continue; } - if (capital[0] > index_letter[0]) { //move to most close item - elm_genlist_item_bring_in(gl_item, ELM_GENLIST_ITEM_SCROLLTO_TOP); + if (capital[0] > index_letter[0]) { //move to most close item + elm_genlist_item_bring_in(gl_item, + ELM_GENLIST_ITEM_SCROLLTO_TOP); IF_FREE(uni); IF_FREE(capital); break; @@ -224,14 +230,14 @@ Eina_Bool ea_locale_latin_get(const char *locale) } -static void _mp_fastscoller_append_item(void *data, Evas_Object *obj) +static void _mp_fastscoller_append_item(void *data, Evas_Object * obj) { int i = 0, j, len; char *str = NULL; - char buf[PATH_MAX] = {0, }; + char buf[PATH_MAX] = { 0, }; Eina_Unicode uni; char *locale = NULL; - Evas_Object *list = (Evas_Object *)data; + Evas_Object *list = (Evas_Object *) data; MP_CHECK(obj); elm_index_item_clear(obj); @@ -242,9 +248,10 @@ static void _mp_fastscoller_append_item(void *data, Evas_Object *obj) if (!wd->first) { wd->first = g_strdup("#"); } - //2. Local language - str = dgettext("efl-extension", "IDS_EA_BODY_ABCDEFGHIJKLMNOPQRSTUVWXYZ"); + str = + dgettext("efl-extension", + "IDS_EA_BODY_ABCDEFGHIJKLMNOPQRSTUVWXYZ"); MP_CHECK(str); len = strlen(str); if (len == 0) { @@ -262,13 +269,19 @@ static void _mp_fastscoller_append_item(void *data, Evas_Object *obj) } //3. English - in case of non-latin - int retcode = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale); + int retcode = + system_settings_get_value_string + (SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale); MP_CHECK(locale); if (retcode != SYSTEM_SETTINGS_ERROR_NONE) { - ERROR_TRACE("Unable to fetch the current language setting with return value %d", retcode); + ERROR_TRACE + ("Unable to fetch the current language setting with return value %d", + retcode); } if (!ea_locale_latin_get(locale)) { - str = dgettext("efl-extension", "IDS_EA_BODY_ABCDEFGHIJKLMNOPQRSTUVWXYZ_SECOND"); + str = + dgettext("efl-extension", + "IDS_EA_BODY_ABCDEFGHIJKLMNOPQRSTUVWXYZ_SECOND"); MP_CHECK(str); len = strlen(str); @@ -280,7 +293,8 @@ static void _mp_fastscoller_append_item(void *data, Evas_Object *obj) snprintf(buf, i - j + 1, "%s", str + j); buf[i - j + 1] = 0; - elm_index_item_append(obj, buf, _mc_index_item_selected_cb, list); + elm_index_item_append(obj, buf, _mc_index_item_selected_cb, + list); //elm_index_item_priority_set(it, 1); } @@ -289,15 +303,18 @@ static void _mp_fastscoller_append_item(void *data, Evas_Object *obj) IF_FREE(locale); } -static void _append_item(Evas_Object *index, Evas_Object *list) + +static void _append_item(Evas_Object * index, Evas_Object * list) { - _mp_fastscoller_append_item((void*)list, index); + _mp_fastscoller_append_item((void *) list, index); elm_index_level_go(index, 0); - evas_object_smart_callback_add(index, "changed", _mc_index_item_selected_cb, list); - evas_object_smart_callback_add(index, "selected", _index_selected_cb, NULL); + evas_object_smart_callback_add(index, "changed", + _mc_index_item_selected_cb, list); + evas_object_smart_callback_add(index, "selected", _index_selected_cb, + NULL); } -static Evas_Object* _create_fastscroll(Evas_Object* parent) +static Evas_Object *_create_fastscroll(Evas_Object * parent) { Evas_Object *index; index = elm_index_add(parent); @@ -315,21 +332,25 @@ _widget_del_cb(void *data, Evas * e, Evas_Object * obj, void *event_info) IF_FREE(wd); } -void _language_changed(void *data, Evas_Object *obj, void *event_info) +void _language_changed(void *data, Evas_Object * obj, void *event_info) { MP_CHECK(data); MP_CHECK(obj); _mp_fastscoller_append_item(data, obj); elm_index_level_go(obj, 0); - evas_object_smart_callback_add(obj, "changed", _mc_index_item_selected_cb, (Evas_Object *)data); - evas_object_smart_callback_add(obj, "selected", _index_selected_cb, NULL); + evas_object_smart_callback_add(obj, "changed", + _mc_index_item_selected_cb, + (Evas_Object *) data); + evas_object_smart_callback_add(obj, "selected", _index_selected_cb, + NULL); } -Evas_Object *mc_index_create(Evas_Object *parent, int group_type, void *data) +Evas_Object *mc_index_create(Evas_Object * parent, int group_type, + void *data) { Evas_Object *index = NULL; MpIndexData_t *wd = NULL; - Evas_Object *list = (Evas_Object *)data; + Evas_Object *list = (Evas_Object *) data; MP_CHECK_NULL(list); // Create index @@ -351,18 +372,17 @@ Evas_Object *mc_index_create(Evas_Object *parent, int group_type, void *data) evas_object_data_set(index, "widget_d", wd); - evas_object_event_callback_add(index, EVAS_CALLBACK_FREE, _widget_del_cb, wd); + evas_object_event_callback_add(index, EVAS_CALLBACK_FREE, + _widget_del_cb, wd); //language change the fast scroll language will change too - evas_object_smart_callback_add(index, "language,changed", _language_changed, list); + evas_object_smart_callback_add(index, "language,changed", + _language_changed, list); return index; } -void mc_index_append_item(Evas_Object *index, Evas_Object *list) +void mc_index_append_item(Evas_Object * index, Evas_Object * list) { MP_CHECK(list); _append_item(index, list); elm_index_level_go(index, 0); } - - - diff --git a/music-chooser/src/mc-library-view.c b/music-chooser/src/mc-library-view.c index fb4e2b8..5eeea5c 100644 --- a/music-chooser/src/mc-library-view.c +++ b/music-chooser/src/mc-library-view.c @@ -45,12 +45,14 @@ extern bool detail_view; Evas_Object *mc_tabbar; -static void _all_cb(void *data, Evas_Object *obj, void *event_info) +static void _all_cb(void *data, Evas_Object * obj, void *event_info) { startfunc; struct app_data *ad = data; MP_CHECK(ad); - mc_common_obj_domain_text_translate(ad->navi_bar, mc_create_selectioninfo_text_with_count(0)); + mc_common_obj_domain_text_translate(ad->navi_bar, + mc_create_selectioninfo_text_with_count + (0)); Evas_Object *sub_view; if (detail_view) { elm_naviframe_item_pop(ad->navi_bar); @@ -72,17 +74,20 @@ static void _all_cb(void *data, Evas_Object *obj, void *event_info) elm_object_part_content_set(g_ly, "list-content", sub_view); evas_object_show(sub_view); - eext_object_event_callback_add(sub_view, EEXT_CALLBACK_BACK, mc_eext_quit_cb, ad); + eext_object_event_callback_add(sub_view, EEXT_CALLBACK_BACK, + mc_eext_quit_cb, ad); endfunc; } #ifdef MC_ENABLE_TAB -static void _artist_cb(void *data, Evas_Object *obj, void *event_info) +static void _artist_cb(void *data, Evas_Object * obj, void *event_info) { startfunc; struct app_data *ad = data; MP_CHECK(ad); - mc_common_obj_domain_text_translate(ad->navi_bar, mc_create_selectioninfo_text_with_count(0)); + mc_common_obj_domain_text_translate(ad->navi_bar, + mc_create_selectioninfo_text_with_count + (0)); Evas_Object *sub_view; if (detail_view) { elm_naviframe_item_pop(ad->navi_bar); @@ -101,17 +106,20 @@ static void _artist_cb(void *data, Evas_Object *obj, void *event_info) elm_object_part_content_set(g_ly, "list-content", sub_view); evas_object_show(sub_view); - eext_object_event_callback_add(sub_view, EEXT_CALLBACK_BACK, mc_eext_quit_cb, ad); + eext_object_event_callback_add(sub_view, EEXT_CALLBACK_BACK, + mc_eext_quit_cb, ad); endfunc; } #endif -static void _album_cb(void *data, Evas_Object *obj, void *event_info) +static void _album_cb(void *data, Evas_Object * obj, void *event_info) { startfunc; struct app_data *ad = data; MP_CHECK(ad); - mc_common_obj_domain_text_translate(ad->navi_bar, mc_create_selectioninfo_text_with_count(0)); + mc_common_obj_domain_text_translate(ad->navi_bar, + mc_create_selectioninfo_text_with_count + (0)); Evas_Object *sub_view; if (detail_view) { elm_naviframe_item_pop(ad->navi_bar); @@ -130,11 +138,12 @@ static void _album_cb(void *data, Evas_Object *obj, void *event_info) elm_object_part_content_set(g_ly, "list-content", sub_view); evas_object_show(sub_view); - eext_object_event_callback_add(sub_view, EEXT_CALLBACK_BACK, mc_eext_quit_cb, ad); + eext_object_event_callback_add(sub_view, EEXT_CALLBACK_BACK, + mc_eext_quit_cb, ad); endfunc; } -Evas_Object *_create_tabbar(Evas_Object *parent, struct app_data *ad) +Evas_Object *_create_tabbar(Evas_Object * parent, struct app_data * ad) { startfunc; int selected_tab; @@ -152,14 +161,14 @@ Evas_Object *_create_tabbar(Evas_Object *parent, struct app_data *ad) elm_toolbar_transverse_expanded_set(obj, EINA_TRUE); elm_toolbar_select_mode_set(obj, ELM_OBJECT_SELECT_MODE_ALWAYS); - char mc_edj_path[1024] = {0}; + char mc_edj_path[1024] = { 0 }; char *path = app_get_resource_path(); MP_CHECK_NULL(path); snprintf(mc_edj_path, 1024, "%s%s", path, MC_EDJ_FILE); free(path); elm_theme_extension_add(NULL, mc_edj_path); elm_object_style_set(obj, "scroll/tabbar"); -// elm_object_style_set(obj, "tabbar/item_with_title"); +// elm_object_style_set(obj, "tabbar/item_with_title"); if (ad->track_type == MP_TRACK_BY_ALBUM) { selected_tab = TAB_ALBUM; @@ -169,10 +178,15 @@ Evas_Object *_create_tabbar(Evas_Object *parent, struct app_data *ad) selected_tab = TAB_ALL; } - g_tab_item[TAB_ALL] = mc_common_toolbar_item_append(obj, NULL, MC_TEXT_ALL, _all_cb, ad); - g_tab_item[TAB_ALBUM] = mc_common_toolbar_item_append(obj, NULL, MC_TEXT_ALBUMS, _album_cb, ad); + g_tab_item[TAB_ALL] = + mc_common_toolbar_item_append(obj, NULL, MC_TEXT_ALL, _all_cb, ad); + g_tab_item[TAB_ALBUM] = + mc_common_toolbar_item_append(obj, NULL, MC_TEXT_ALBUMS, _album_cb, + ad); #ifdef MC_ENABLE_TAB - g_tab_item[TAB_ARTIST] = mc_common_toolbar_item_append(obj, NULL, MC_TEXT_ARTISTS, _artist_cb, ad); + g_tab_item[TAB_ARTIST] = + mc_common_toolbar_item_append(obj, NULL, MC_TEXT_ARTISTS, + _artist_cb, ad); #endif elm_toolbar_item_selected_set(g_tab_item[selected_tab], EINA_TRUE); @@ -183,7 +197,8 @@ Evas_Object *_create_tabbar(Evas_Object *parent, struct app_data *ad) return obj; } -void mc_create_search_view_cb(void *data, Evas_Object *obj, void *event_info) +void mc_create_search_view_cb(void *data, Evas_Object * obj, + void *event_info) { startfunc; @@ -195,46 +210,61 @@ void mc_create_search_view_cb(void *data, Evas_Object *obj, void *event_info) mc_search_view_update_options(search); } -static void mc_common_item_domain_text_translate(Elm_Object_Item* item, const char *part, const char *label) +static void mc_common_item_domain_text_translate(Elm_Object_Item * item, + const char *part, + const char *label) { - elm_object_item_domain_translatable_part_text_set(item, part, DOMAIN_NAME, (const char *)label); + elm_object_item_domain_translatable_part_text_set(item, part, + DOMAIN_NAME, + (const char *) + label); } -void -mc_library_view_create(struct app_data *ad) +void mc_library_view_create(struct app_data *ad) { startfunc; if (ad->select_type == MC_SELECT_VOICE_CLIP) { g_ly = mc_voice_clip_list_create(ad->navi_bar, ad); - g_navi_it = elm_naviframe_item_push(ad->navi_bar, NULL, NULL, NULL, g_ly, NULL); + g_navi_it = + elm_naviframe_item_push(ad->navi_bar, NULL, NULL, NULL, g_ly, + NULL); mc_voice_clip_list_update(g_ly); evas_object_show(g_ly); } else if (ad->select_type == MC_SELECT_GROUP_PLAY) { g_ly = mc_group_play_list_create(ad->navi_bar, ad); - g_navi_it = elm_naviframe_item_push(ad->navi_bar, NULL, NULL, NULL, g_ly, NULL); + g_navi_it = + elm_naviframe_item_push(ad->navi_bar, NULL, NULL, NULL, g_ly, + NULL); mc_group_play_list_update(g_ly, g_navi_it); evas_object_show(g_ly); } else { //g_ly = elm_layout_add(ad->navi_bar); //elm_layout_theme_set(g_ly, "layout", "application", "default"); - char mc_edj_path[1024] = {0}; + char mc_edj_path[1024] = { 0 }; char *path = app_get_resource_path(); if (path == NULL) { return; } snprintf(mc_edj_path, 1024, "%s%s", path, MC_EDJ_FILE); free(path); - g_ly = mc_common_load_edj(ad->navi_bar, mc_edj_path, "view_layout_tabbar"); - g_navi_it = elm_naviframe_item_push(ad->navi_bar, NULL, NULL, NULL, g_ly, NULL); + g_ly = + mc_common_load_edj(ad->navi_bar, mc_edj_path, + "view_layout_tabbar"); + g_navi_it = + elm_naviframe_item_push(ad->navi_bar, NULL, NULL, NULL, g_ly, + NULL); #if 0 Evas_Object *search_btn = NULL; - search_btn = mc_widget_create_title_icon_btn(g_ly, IMAGE_EDJ_NAME, MP_ICON_SEARCH, - (Evas_Smart_Cb)mc_create_search_view_cb, - ad); - elm_object_item_part_content_set(g_navi_it, "title_right_btn", search_btn); + search_btn = + mc_widget_create_title_icon_btn(g_ly, IMAGE_EDJ_NAME, + MP_ICON_SEARCH, + (Evas_Smart_Cb) + mc_create_search_view_cb, ad); + elm_object_item_part_content_set(g_navi_it, "title_right_btn", + search_btn); #endif mc_tabbar = _create_tabbar(ad->navi_bar, ad); @@ -243,25 +273,34 @@ mc_library_view_create(struct app_data *ad) #ifdef MC_AUTO_RECOMMENDED if (ad->auto_recommended_show) { elm_object_signal_emit(g_ly, "show.recommended", "*"); - Evas_Object *recommended_area = mc_common_load_edj(ad->navi_bar, mc_edj_path, "recommended_area"); - elm_object_part_content_set(g_ly, "recommended", recommended_area); - mc_common_obj_domain_translatable_part_text_set(recommended_area, "title_text", MC_TEXT_SET_AS_AUTO_RECOMMEND); - mc_common_obj_domain_translatable_part_text_set(recommended_area, "description_text", MC_TEXT_SET_AS_RECOMMENDED_TXT); - - /*add check box*/ + Evas_Object *recommended_area = + mc_common_load_edj(ad->navi_bar, mc_edj_path, + "recommended_area"); + elm_object_part_content_set(g_ly, "recommended", + recommended_area); + mc_common_obj_domain_translatable_part_text_set + (recommended_area, "title_text", + MC_TEXT_SET_AS_AUTO_RECOMMEND); + mc_common_obj_domain_translatable_part_text_set + (recommended_area, "description_text", + MC_TEXT_SET_AS_RECOMMENDED_TXT); + + /*add check box */ Evas_Object *check = elm_check_add(recommended_area); elm_check_state_set(check, ad->auto_recommended_on); - elm_object_part_content_set(recommended_area, "check_box", check); - evas_object_smart_callback_add(check, "changed", mc_auto_recommended_check_cb, ad); + elm_object_part_content_set(recommended_area, "check_box", + check); + evas_object_smart_callback_add(check, "changed", + mc_auto_recommended_check_cb, + ad); evas_object_show(recommended_area); } #endif } - mc_common_item_domain_text_translate(g_navi_it, "elm.text.title", MC_TEXT_SELECT); + mc_common_item_domain_text_translate(g_navi_it, "elm.text.title", + MC_TEXT_SELECT); elm_naviframe_item_pop_cb_set(g_navi_it, mc_quit_cb, ad); endfunc; } - - diff --git a/music-chooser/src/mc-list-play.c b/music-chooser/src/mc-list-play.c index e556588..4823ffb 100644 --- a/music-chooser/src/mc-list-play.c +++ b/music-chooser/src/mc-list-play.c @@ -33,10 +33,13 @@ int g_position = 0; static void _mc_pre_play_mgr_play_new_uri(void *data); static void _mc_pre_play_mgr_realize_player_mgr(void *data); static void _mc_pre_play_mgr_create_player_mgr(const char *uri); -static void _mc_pre_play_mgr_callback_pipe_handler(void *data, void *buffer, unsigned int nbyte); -static void _mc_pre_play_mgr_create_player(player_h *player); +static void _mc_pre_play_mgr_callback_pipe_handler(void *data, + void *buffer, + unsigned int nbyte); +static void _mc_pre_play_mgr_create_player(player_h * player); static void _mc_pre_play_mgr_prepare_cb(void *userdata); -static void _mc_pre_play_mgr_update_play_button_status(list_item_data_t *item_data); +static void _mc_pre_play_mgr_update_play_button_status(list_item_data_t * + item_data); static void _mc_pre_play_mgr_player_start(); static void _mc_pre_play_mgr_player_pause(); static void _mc_pre_play_mgr_player_stop(); @@ -79,7 +82,7 @@ void mc_vol_type_set(sound_type_e type) sound_manager_set_current_sound_type(type); } -void mc_vol_reset_default_value(void* data) +void mc_vol_reset_default_value(void *data) { startfunc; MP_CHECK(data); @@ -89,7 +92,7 @@ void mc_vol_reset_default_value(void* data) current_type = mc_get_sound_type(); DEBUG_TRACE("current type is %d", current_type); if (ad->select_type == MC_SELECT_SINGLE_RINGTONE) { - if (g_init_current_type != current_type) { + if (g_init_current_type != current_type) { mc_vol_type_set(g_init_current_type); } } @@ -131,23 +134,26 @@ player_h mc_pre_play_mgr_get_player_handle(void) void mc_pre_play_mgr_reset_song(void *data) { startfunc; - list_item_data_t *item_data = (list_item_data_t*)data; + list_item_data_t *item_data = (list_item_data_t *) data; MP_CHECK(item_data); _mc_pre_play_mgr_player_stop(); DEBUG_TRACE("update reset song item_data =%x, item_data", item_data); item_data->state = PLAYER_STATE_NONE; - elm_genlist_item_fields_update(item_data->it, MC_PRE_PLAY_BUTTON_PART_NAME, ELM_GENLIST_ITEM_FIELD_CONTENT); - DEBUG_TRACE("update reset song item_data =%x, state=%d", item_data, item_data->state); + elm_genlist_item_fields_update(item_data->it, + MC_PRE_PLAY_BUTTON_PART_NAME, + ELM_GENLIST_ITEM_FIELD_CONTENT); + DEBUG_TRACE("update reset song item_data =%x, state=%d", item_data, + item_data->state); _mc_pre_play_mgr_player_unprepare(); - return ; + return; } void mc_pre_play_mgr_reset_song_without_stop(void *data) { startfunc; - list_item_data_t *item_data = (list_item_data_t*)data; + list_item_data_t *item_data = (list_item_data_t *) data; MP_CHECK(item_data); if (mc_player) { @@ -191,7 +197,7 @@ void mc_pre_play_mgr_destroy_play(void) void mc_pre_play_mgr_play_control(void *data) { startfunc; - list_item_data_t *item_data = (list_item_data_t*)data; + list_item_data_t *item_data = (list_item_data_t *) data; player_state_e state = PLAYER_STATE_NONE; MP_CHECK(mc_player); @@ -205,25 +211,24 @@ void mc_pre_play_mgr_play_control(void *data) if (PLAYER_STATE_PAUSED == state) { _mc_pre_play_mgr_player_start(); } - //after complete click again if (PLAYER_STATE_IDLE == state) { mc_pre_play_mgr_play_song(item_data); } _mc_pre_play_mgr_update_play_button_status(item_data); - return ; + return; } void mc_pre_play_mgr_play_song(void *data) { - list_item_data_t *item_data = (list_item_data_t*)data; + list_item_data_t *item_data = (list_item_data_t *) data; MP_CHECK(item_data); DEBUG_TRACE("item_data = %x", item_data); _mc_pre_play_mgr_play_new_uri(item_data); - return ; + return; } void mc_player_pause(void) @@ -271,7 +276,7 @@ static void _mc_pre_play_error(int ret) static void _mc_pre_play_mgr_player_start() { startfunc; - int error_code = PLAYER_ERROR_NONE; + int error_code = PLAYER_ERROR_NONE; MP_CHECK(mc_player); error_code = player_start(mc_player); @@ -286,33 +291,33 @@ static void _mc_pre_play_mgr_player_start() static void _mc_pre_play_mgr_player_pause() { startfunc; - int error_code = PLAYER_ERROR_NONE; + int error_code = PLAYER_ERROR_NONE; MP_CHECK(mc_player); error_code = player_pause(mc_player); if (error_code) { DEBUG_TRACE("play pause error %d", error_code); } - return ; + return; } static void _mc_pre_play_mgr_player_stop() { startfunc; - int error_code = PLAYER_ERROR_NONE; + int error_code = PLAYER_ERROR_NONE; MP_CHECK(mc_player); error_code = player_stop(mc_player); if (error_code) { DEBUG_TRACE("play stop error %d", error_code); } - return ; + return; } static void _mc_pre_play_mgr_player_unprepare() { startfunc; - int error_code = PLAYER_ERROR_NONE; + int error_code = PLAYER_ERROR_NONE; MP_CHECK(mc_player); error_code = player_unprepare(mc_player); @@ -320,17 +325,20 @@ static void _mc_pre_play_mgr_player_unprepare() DEBUG_TRACE("player_unprepare %d", error_code); } - return ; + return; } -static void _mc_pre_play_mgr_update_play_button_status(list_item_data_t *item_data) +static void _mc_pre_play_mgr_update_play_button_status(list_item_data_t * + item_data) { //player_get_state(mc_player, &item_data->state); MP_CHECK(item_data); DEBUG_TRACE("get state = %d", item_data->state); - elm_genlist_item_fields_update(item_data->it, MC_PRE_PLAY_BUTTON_PART_NAME, ELM_GENLIST_ITEM_FIELD_CONTENT); + elm_genlist_item_fields_update(item_data->it, + MC_PRE_PLAY_BUTTON_PART_NAME, + ELM_GENLIST_ITEM_FIELD_CONTENT); - return ; + return; } static void _mc_pre_play_mgr_play_stop() @@ -341,26 +349,29 @@ static void _mc_pre_play_mgr_play_stop() MP_CHECK(mc_player); error_code = player_get_state(mc_player, &state); if (PLAYER_ERROR_NONE == error_code) { - if ((PLAYER_STATE_PLAYING == state) || (PLAYER_STATE_PAUSED == state)) { + if ((PLAYER_STATE_PLAYING == state) + || (PLAYER_STATE_PAUSED == state)) { _mc_pre_play_mgr_player_stop(); } else { DEBUG_TRACE("player state error %d", state); } } else { - DEBUG_TRACE("_mc_pre_play_mgr_play_stop get state error %d", error_code); + DEBUG_TRACE("_mc_pre_play_mgr_play_stop get state error %d", + error_code); } - return ; + return; } static void _mc_pre_play_complete_cb(void *data) { startfunc; - list_item_data_t *item_data = (list_item_data_t*)data; + list_item_data_t *item_data = (list_item_data_t *) data; _mc_pre_play_mgr_play_stop(); - Evas_Object *part_content = elm_object_item_part_content_get(item_data->it, "elm.icon.1"); + Evas_Object *part_content = + elm_object_item_part_content_get(item_data->it, "elm.icon.1"); if (part_content) { elm_object_signal_emit(part_content, "show_default", "*"); elm_object_item_signal_emit(item_data->it, "hide_color", "*"); @@ -374,31 +385,33 @@ static void _mc_pre_play_complete_cb(void *data) mc_pre_play_mgr_destroy_play(); } - return ; + return; } static void _mc_pre_play_buffering_cb(int percent, void *userdata) { DEBUG_TRACE("buffering percent = %d\%", percent); - list_item_data_t *item_data = (list_item_data_t*)userdata; + list_item_data_t *item_data = (list_item_data_t *) userdata; MP_CHECK(item_data); if (100 == percent) { _mc_pre_play_mgr_update_play_button_status(item_data); } - return ; + return; } -static void _mc_pre_play_interrupt_cb(player_interrupted_code_e code, void *data) +static void _mc_pre_play_interrupt_cb(player_interrupted_code_e code, + void *data) { startfunc; - list_item_data_t *item_data = (list_item_data_t*)data; + list_item_data_t *item_data = (list_item_data_t *) data; player_state_e state = PLAYER_STATE_NONE; switch (code) { case PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT: - DEBUG_TRACE("Interrupt :: PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT"); + DEBUG_TRACE + ("Interrupt :: PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT"); break; default: break; @@ -412,13 +425,13 @@ static void _mc_pre_play_interrupt_cb(player_interrupted_code_e code, void *data //mc_pre_play_mgr_play_control(item_data); - return ; + return; } static void _mc_pre_play_prepare_cb(void *data) { startfunc; - list_item_data_t *item_data = (list_item_data_t *)data; + list_item_data_t *item_data = (list_item_data_t *) data; MP_CHECK(item_data); player_get_state(mc_player, &item_data->state); @@ -427,13 +440,13 @@ static void _mc_pre_play_prepare_cb(void *data) _mc_pre_play_mgr_player_start(); _mc_pre_play_mgr_update_play_button_status(item_data); - return ; + return; } static void _mc_pre_play_error_cb(int error_code, void *userdata) { startfunc; - list_item_data_t *item_data = (list_item_data_t *)userdata; + list_item_data_t *item_data = (list_item_data_t *) userdata; MP_CHECK(item_data); DEBUG_TRACE("error code %d", error_code); @@ -457,11 +470,12 @@ static void _mc_pre_play_error_cb(int error_code, void *userdata) _mc_pre_play_mgr_play_stop(); _mc_pre_play_mgr_update_play_button_status(item_data); - return ; + return; } -void mc_pre_play_mgr_set_completed_cb(player_completed_cb callback, void *user_data) +void mc_pre_play_mgr_set_completed_cb(player_completed_cb callback, + void *user_data) { startfunc; MP_CHECK(g_player_cbs); @@ -470,7 +484,8 @@ void mc_pre_play_mgr_set_completed_cb(player_completed_cb callback, void *user_ g_player_cbs->user_data[MC_PLAYER_CB_TYPE_COMPLETED] = user_data; } -void mc_pre_play_mgr_set_interrupt_cb(player_interrupted_cb callback, void *user_data) +void mc_pre_play_mgr_set_interrupt_cb(player_interrupted_cb callback, + void *user_data) { startfunc; MP_CHECK(g_player_cbs); @@ -479,7 +494,8 @@ void mc_pre_play_mgr_set_interrupt_cb(player_interrupted_cb callback, void *use g_player_cbs->user_data[MC_PLAYER_CB_TYPE_INTURRUPTED] = user_data; } -void mc_pre_play_mgr_set_error_cb(player_error_cb callback, void *user_data) +void mc_pre_play_mgr_set_error_cb(player_error_cb callback, + void *user_data) { startfunc; MP_CHECK(g_player_cbs); @@ -488,7 +504,8 @@ void mc_pre_play_mgr_set_error_cb(player_error_cb callback, void *user_data) g_player_cbs->user_data[MC_PLAYER_CB_TYPE_ERROR] = user_data; } -void mc_pre_play_mgr_set_buffering_cb(player_error_cb callback, void *user_data) +void mc_pre_play_mgr_set_buffering_cb(player_error_cb callback, + void *user_data) { startfunc; MP_CHECK(g_player_cbs); @@ -497,7 +514,8 @@ void mc_pre_play_mgr_set_buffering_cb(player_error_cb callback, void *user_data g_player_cbs->user_data[MC_PLAYER_CB_TYPE_BUFFERING] = user_data; } -void mc_pre_play_mgr_set_prepare_cb(player_prepared_cb callback, void *user_data) +void mc_pre_play_mgr_set_prepare_cb(player_prepared_cb callback, + void *user_data) { startfunc; MP_CHECK(g_player_cbs); @@ -509,18 +527,18 @@ void mc_pre_play_mgr_set_prepare_cb(player_prepared_cb callback, void *user_dat static void _mc_pre_play_mgr_play_new_uri(void *data) { startfunc; - list_item_data_t *item_data = (list_item_data_t*)data; + list_item_data_t *item_data = (list_item_data_t *) data; MP_CHECK(item_data); char *uri = NULL; mp_media_info_h media_handle = NULL; - media_handle = (mp_media_info_h)item_data->media; + media_handle = (mp_media_info_h) item_data->media; mp_media_info_get_file_path(media_handle, &uri); DEBUG_TRACE("uri = %s", uri); if (NULL == uri) { DEBUG_TRACE("play uri fail, get null uri"); - return ; + return; } else { DEBUG_TRACE("play uri, get uri = %s", uri); @@ -530,23 +548,26 @@ static void _mc_pre_play_mgr_play_new_uri(void *data) //mc_player_mgr_set_started_cb(__mf_mc_list_play_start_cb, itemData); //mc_pre_play_mgr_set_paused_cb(_mc_list_play_paused_cb, item_data); - mc_pre_play_mgr_set_completed_cb(_mc_pre_play_complete_cb, item_data); - mc_pre_play_mgr_set_interrupt_cb(_mc_pre_play_interrupt_cb, item_data); + mc_pre_play_mgr_set_completed_cb(_mc_pre_play_complete_cb, + item_data); + mc_pre_play_mgr_set_interrupt_cb(_mc_pre_play_interrupt_cb, + item_data); mc_pre_play_mgr_set_prepare_cb(_mc_pre_play_prepare_cb, item_data); mc_pre_play_mgr_set_error_cb(_mc_pre_play_error_cb, item_data); - mc_pre_play_mgr_set_buffering_cb(_mc_pre_play_buffering_cb, item_data); + mc_pre_play_mgr_set_buffering_cb(_mc_pre_play_buffering_cb, + item_data); _mc_pre_play_mgr_realize_player_mgr(item_data); } _mc_pre_play_mgr_update_play_button_status(item_data); - return ; + return; } static void _mc_pre_play_mgr_realize_player_mgr(void *data) { startfunc; - list_item_data_t *item_data = (list_item_data_t*)data; + list_item_data_t *item_data = (list_item_data_t *) data; player_state_e state = PLAYER_STATE_NONE; int error = PLAYER_ERROR_NONE; @@ -555,13 +576,14 @@ static void _mc_pre_play_mgr_realize_player_mgr(void *data) item_data->state = state; if ((PLAYER_ERROR_NONE == error) && (PLAYER_STATE_IDLE == state)) { DEBUG_TRACE("prepare async"); - if (player_prepare_async(mc_player, _mc_pre_play_mgr_prepare_cb, item_data)) { + if (player_prepare_async + (mc_player, _mc_pre_play_mgr_prepare_cb, item_data)) { DEBUG_TRACE("prepare err"); } } } - return ; + return; } static void _mc_pre_play_mgr_prepare_cb(void *userdata) @@ -573,8 +595,9 @@ static void _mc_pre_play_mgr_prepare_cb(void *userdata) memset(&extra_data, 0x00, sizeof(mc_player_cb_extra_data)); extra_data.cb_type = MC_PLAYER_CB_TYPE_PREPARE; - ecore_pipe_write(g_player_pipe, &extra_data, sizeof(mc_player_cb_extra_data)); - return ; + ecore_pipe_write(g_player_pipe, &extra_data, + sizeof(mc_player_cb_extra_data)); + return; } static void _mc_pre_play_mgr_completed_cb(void *userdata) @@ -586,10 +609,12 @@ static void _mc_pre_play_mgr_completed_cb(void *userdata) memset(&extra_data, 0x00, sizeof(mc_player_cb_extra_data)); extra_data.cb_type = MC_PLAYER_CB_TYPE_COMPLETED; - ecore_pipe_write(g_player_pipe, &extra_data, sizeof(mc_player_cb_extra_data)); + ecore_pipe_write(g_player_pipe, &extra_data, + sizeof(mc_player_cb_extra_data)); } -static void _mc_pre_play_mgr_interrupt_cb(player_interrupted_code_e code, void *userdata) +static void _mc_pre_play_mgr_interrupt_cb(player_interrupted_code_e code, + void *userdata) { startfunc; MP_CHECK(g_player_pipe); @@ -599,7 +624,8 @@ static void _mc_pre_play_mgr_interrupt_cb(player_interrupted_code_e code, void * extra_data.cb_type = MC_PLAYER_CB_TYPE_INTURRUPTED; extra_data.param.interrupted_code = code; - ecore_pipe_write(g_player_pipe, &extra_data, sizeof(mc_player_cb_extra_data)); + ecore_pipe_write(g_player_pipe, &extra_data, + sizeof(mc_player_cb_extra_data)); } static void _mc_pre_play_mgr_error_cb(int error_code, void *userdata) @@ -612,7 +638,8 @@ static void _mc_pre_play_mgr_error_cb(int error_code, void *userdata) extra_data.cb_type = MC_PLAYER_CB_TYPE_ERROR; extra_data.param.error_code = error_code; - ecore_pipe_write(g_player_pipe, &extra_data, sizeof(mc_player_cb_extra_data)); + ecore_pipe_write(g_player_pipe, &extra_data, + sizeof(mc_player_cb_extra_data)); } static void _mc_pre_play_mgr_buffer_cb(int percent, void *user_data) @@ -625,9 +652,10 @@ static void _mc_pre_play_mgr_buffer_cb(int percent, void *user_data) extra_data.cb_type = MC_PLAYER_CB_TYPE_BUFFERING; extra_data.param.percent = percent; - ecore_pipe_write(g_player_pipe, &extra_data, sizeof(mc_player_cb_extra_data)); + ecore_pipe_write(g_player_pipe, &extra_data, + sizeof(mc_player_cb_extra_data)); - return ; + return; } static void _mc_pre_play_mgr_create_player_mgr(const char *uri) @@ -644,26 +672,33 @@ static void _mc_pre_play_mgr_create_player_mgr(const char *uri) if (NULL == g_player_pipe) { - g_player_pipe = ecore_pipe_add(_mc_pre_play_mgr_callback_pipe_handler, NULL); + g_player_pipe = + ecore_pipe_add(_mc_pre_play_mgr_callback_pipe_handler, + NULL); /*ecore_pipe_del(g_player_pipe); - g_player_pipe = NULL;*/ + g_player_pipe = NULL; */ } if (NULL == g_player_cbs) { g_player_cbs = calloc(1, sizeof(mc_player_cbs)); } - player_set_completed_cb(mc_player, _mc_pre_play_mgr_completed_cb, NULL); - player_set_interrupted_cb(mc_player, _mc_pre_play_mgr_interrupt_cb, NULL); + player_set_completed_cb(mc_player, _mc_pre_play_mgr_completed_cb, + NULL); + player_set_interrupted_cb(mc_player, _mc_pre_play_mgr_interrupt_cb, + NULL); player_set_error_cb(mc_player, _mc_pre_play_mgr_error_cb, NULL); - player_set_buffering_cb(mc_player, _mc_pre_play_mgr_buffer_cb, NULL); + player_set_buffering_cb(mc_player, _mc_pre_play_mgr_buffer_cb, + NULL); } - return ; + return; } -static void _mc_pre_play_mgr_callback_pipe_handler(void *data, void *buffer, unsigned int nbyte) +static void _mc_pre_play_mgr_callback_pipe_handler(void *data, + void *buffer, + unsigned int nbyte) { startfunc; mc_player_cb_extra_data *extra_data = buffer; @@ -671,60 +706,63 @@ static void _mc_pre_play_mgr_callback_pipe_handler(void *data, void *buffer, uns MP_CHECK(g_player_cbs); switch (extra_data->cb_type) { - /*note: start callback and paused callback for player have been removed*/ - /*case MC_PLAYER_CB_TYPE_STARTED: - if (g_player_cbs->started_cb) - g_player_cbs->started_cb(g_player_cbs->user_data[MF_PLAYER_CB_TYPE_STARTED]); - break; - - case MC_PLAYER_CB_TYPE_PAUSED: - if (g_player_cbs->paused_cb) - g_player_cbs->paused_cb(g_player_cbs->user_data[MC_PLAYER_CB_TYPE_PAUSED]); - break; */ - - case MC_PLAYER_CB_TYPE_COMPLETED: { + case MC_PLAYER_CB_TYPE_COMPLETED:{ if (g_player_cbs->completed_cb) { - g_player_cbs->completed_cb(g_player_cbs->user_data[MC_PLAYER_CB_TYPE_COMPLETED]); + g_player_cbs->completed_cb(g_player_cbs-> + user_data + [MC_PLAYER_CB_TYPE_COMPLETED]); } } break; - case MC_PLAYER_CB_TYPE_INTURRUPTED: { + case MC_PLAYER_CB_TYPE_INTURRUPTED:{ if (g_player_cbs->interrupted_cb) { - g_player_cbs->interrupted_cb(extra_data->param.interrupted_code, g_player_cbs->user_data[MC_PLAYER_CB_TYPE_INTURRUPTED]); + g_player_cbs->interrupted_cb(extra_data->param. + interrupted_code, + g_player_cbs-> + user_data + [MC_PLAYER_CB_TYPE_INTURRUPTED]); } } break; - case MC_PLAYER_CB_TYPE_ERROR: { + case MC_PLAYER_CB_TYPE_ERROR:{ if (g_player_cbs->error_cb) { - g_player_cbs->error_cb(extra_data->param.error_code, g_player_cbs->user_data[MC_PLAYER_CB_TYPE_ERROR]); + g_player_cbs->error_cb(extra_data->param.error_code, + g_player_cbs-> + user_data[MC_PLAYER_CB_TYPE_ERROR]); } } break; - case MC_PLAYER_CB_TYPE_BUFFERING: { + case MC_PLAYER_CB_TYPE_BUFFERING:{ if (g_player_cbs->buffering_cb) { - g_player_cbs->buffering_cb(extra_data->param.percent , g_player_cbs->user_data[MC_PLAYER_CB_TYPE_BUFFERING]); + g_player_cbs->buffering_cb(extra_data->param.percent, + g_player_cbs-> + user_data + [MC_PLAYER_CB_TYPE_BUFFERING]); } } break; - case MC_PLAYER_CB_TYPE_PREPARE: { + case MC_PLAYER_CB_TYPE_PREPARE:{ if (g_player_cbs->prepare_cb) { - g_player_cbs->prepare_cb(g_player_cbs->user_data[MC_PLAYER_CB_TYPE_PREPARE]); + g_player_cbs->prepare_cb(g_player_cbs-> + user_data + [MC_PLAYER_CB_TYPE_PREPARE]); } } break; default: - DEBUG_TRACE("Not suppoted callback type [%d]", extra_data->cb_type); + DEBUG_TRACE("Not suppoted callback type [%d]", + extra_data->cb_type); } - return ; + return; } -static void _mc_pre_play_mgr_create_player(player_h *player) +static void _mc_pre_play_mgr_create_player(player_h * player) { startfunc; int ret = 0; @@ -736,13 +774,14 @@ static void _mc_pre_play_mgr_create_player(player_h *player) ret = player_create(player); if (PLAYER_ERROR_NONE != ret) { DEBUG_TRACE("create player error %s", ret); - return ; + return; } - return ; + return; } -void mc_pre_play_control_play_no_pause_music_item(list_item_data_t *item_data) +void mc_pre_play_control_play_no_pause_music_item(list_item_data_t * + item_data) { startfunc; MP_CHECK(item_data); @@ -750,11 +789,12 @@ void mc_pre_play_control_play_no_pause_music_item(list_item_data_t *item_data) char *cur_uri = NULL; mp_media_info_h media_handle = NULL; - media_handle = (mp_media_info_h)item_data->media; + media_handle = (mp_media_info_h) item_data->media; mp_media_info_get_file_path(media_handle, &cur_uri); cur_item_data = item_data; if (pre_item_data) { - mp_media_info_get_file_path((mp_media_info_h)(pre_item_data->media), &pre_uri); + mp_media_info_get_file_path((mp_media_info_h) + (pre_item_data->media), &pre_uri); } if (NULL == pre_uri || NULL == mc_player) { @@ -776,10 +816,10 @@ void mc_pre_play_control_play_no_pause_music_item(list_item_data_t *item_data) previous_item_data = pre_item_data; pre_item_data = item_data; - return ; + return; } -void mc_pre_play_control_play_music_item(list_item_data_t *item_data) +void mc_pre_play_control_play_music_item(list_item_data_t * item_data) { startfunc; MP_CHECK(item_data); @@ -787,11 +827,12 @@ void mc_pre_play_control_play_music_item(list_item_data_t *item_data) char *cur_uri = NULL; mp_media_info_h media_handle = NULL; - media_handle = (mp_media_info_h)item_data->media; + media_handle = (mp_media_info_h) item_data->media; mp_media_info_get_file_path(media_handle, &cur_uri); cur_item_data = item_data; if (pre_item_data) { - mp_media_info_get_file_path((mp_media_info_h)(pre_item_data->media), &pre_uri); + mp_media_info_get_file_path((mp_media_info_h) + (pre_item_data->media), &pre_uri); } DEBUG_TRACE("pre uri = %s", pre_uri); @@ -813,7 +854,5 @@ void mc_pre_play_control_play_music_item(list_item_data_t *item_data) } pre_item_data = item_data; - return ; + return; } - - diff --git a/music-chooser/src/mc-search-list.c b/music-chooser/src/mc-search-list.c index 9ceb7dd..b626748 100644 --- a/music-chooser/src/mc-search-list.c +++ b/music-chooser/src/mc-search-list.c @@ -24,23 +24,26 @@ static void _mc_search_list_popup_to_bottom(struct app_data *ad) startfunc; MP_CHECK(ad); - Elm_Object_Item *navi_item = elm_naviframe_bottom_item_get(ad->navi_bar); + Elm_Object_Item *navi_item = + elm_naviframe_bottom_item_get(ad->navi_bar); elm_naviframe_item_pop_to(navi_item); } -static Evas_Object * -_mc_search_list_no_content_add(void *data) + +static Evas_Object *_mc_search_list_no_content_add(void *data) { DEBUG_TRACE_FUNC(); - UgMpSearchList_t *list = (UgMpSearchList_t *)data; + UgMpSearchList_t *list = (UgMpSearchList_t *) data; MP_CHECK_VAL(list, NULL); Evas_Object *no_contents = NULL; no_contents = elm_layout_add(list->box); - evas_object_size_hint_weight_set(no_contents, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(no_contents, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(no_contents, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(no_contents, EVAS_HINT_FILL, + EVAS_HINT_FILL); - char mc_edj_path[1024] = {0}; + char mc_edj_path[1024] = { 0 }; char *path = app_get_resource_path(); MP_CHECK_NULL(path); snprintf(mc_edj_path, 1024, "%s%s", path, MC_EDJ_FILE); @@ -58,10 +61,9 @@ _mc_search_list_no_content_add(void *data) return no_contents; } -static int -_mc_search_list_set_sentinel(void *thiz, int count) +static int _mc_search_list_set_sentinel(void *thiz, int count) { - UgMpSearchList_t *list = (UgMpSearchList_t *)thiz; + UgMpSearchList_t *list = (UgMpSearchList_t *) thiz; MP_CHECK_VAL(list, -1); if (0 >= count && (list->filter_str && strlen(list->filter_str))) { ERROR_TRACE("no tracks"); @@ -82,8 +84,8 @@ _mc_search_list_set_sentinel(void *thiz, int count) return 0; } -static char * -_mc_search_track_list_label_get(void *data, Evas_Object * obj, const char *part) +static char *_mc_search_track_list_label_get(void *data, Evas_Object * obj, + const char *part) { //startfunc; mc_list_item_data_t *item_data = data; @@ -99,13 +101,17 @@ _mc_search_track_list_label_get(void *data, Evas_Object * obj, const char *part) if (!strcmp(part, "elm.text.1") || !strcmp(part, "elm.slide.text.1")) { char *title = NULL; - mp_media_info_get_title(track, &title); + mp_media_info_get_title(track, &title); mp_retv_if(!title, NULL); if (!strcmp(part, "elm.text.1")) { bool res = false; - char *markup_name = (char *)mc_common_search_markup_keyword(title, list->filter_str, &res); - return (res) ? g_strdup(markup_name) : elm_entry_utf8_to_markup(title); + char *markup_name = + (char *) mc_common_search_markup_keyword(title, + list->filter_str, + &res); + return (res) ? g_strdup(markup_name) : + elm_entry_utf8_to_markup(title); } else { return g_strdup(title); } @@ -119,8 +125,8 @@ _mc_search_track_list_label_get(void *data, Evas_Object * obj, const char *part) return NULL; } -Evas_Object * -_mc_search_track_list_icon_get(void *data, Evas_Object * obj, const char *part) +Evas_Object *_mc_search_track_list_icon_get(void *data, Evas_Object * obj, + const char *part) { //startfunc; mc_list_item_data_t *item_data = data; @@ -134,7 +140,9 @@ _mc_search_track_list_icon_get(void *data, Evas_Object * obj, const char *part) Evas_Object *icon; mp_media_info_get_thumbnail_path(track, &thumbpath); - icon = mc_common_create_thumb_icon(obj, thumbpath, MC_LIST_ICON_SIZE, MC_LIST_ICON_SIZE); + icon = + mc_common_create_thumb_icon(obj, thumbpath, MC_LIST_ICON_SIZE, + MC_LIST_ICON_SIZE); return icon; } return NULL; @@ -149,11 +157,12 @@ _mc_search_track_sel_cb(void *data, Evas_Object * obj, void *event_info) Elm_Object_Item *gli = (Elm_Object_Item *) event_info; elm_genlist_item_selected_set(gli, FALSE); - UgMpSearchList_t *list = (UgMpSearchList_t *)data; + UgMpSearchList_t *list = (UgMpSearchList_t *) data; MP_CHECK(list); MP_CHECK(list->ad); - mc_list_item_data_t *item = (mc_list_item_data_t *) elm_object_item_data_get(gli); + mc_list_item_data_t *item = + (mc_list_item_data_t *) elm_object_item_data_get(gli); MP_CHECK(item); mp_media_info_get_file_path(item->handle, &uri); @@ -165,8 +174,8 @@ _mc_search_track_sel_cb(void *data, Evas_Object * obj, void *event_info) return; } -static char * -_mc_search_album_list_label_get(void *data, Evas_Object * obj, const char *part) +static char *_mc_search_album_list_label_get(void *data, Evas_Object * obj, + const char *part) { //startfunc; char *name = NULL; @@ -191,8 +200,12 @@ _mc_search_album_list_label_get(void *data, Evas_Object * obj, const char *part) if (!strcmp(part, "elm.text.1")) { bool res = false; - char *markup_name = (char *)mc_common_search_markup_keyword(name, list->filter_str, &res); - return (res) ? g_strdup(markup_name) : elm_entry_utf8_to_markup(name); + char *markup_name = + (char *) mc_common_search_markup_keyword(name, + list->filter_str, + &res); + return (res) ? g_strdup(markup_name) : + elm_entry_utf8_to_markup(name); } else { return g_strdup(name); } @@ -210,8 +223,8 @@ _mc_search_album_list_label_get(void *data, Evas_Object * obj, const char *part) return NULL; } -Evas_Object * -_mc_search_album_list_icon_get(void *data, Evas_Object * obj, const char *part) +Evas_Object *_mc_search_album_list_icon_get(void *data, Evas_Object * obj, + const char *part) { //startfunc; Evas_Object *icon = NULL; @@ -226,7 +239,9 @@ _mc_search_album_list_icon_get(void *data, Evas_Object * obj, const char *part) if (!strcmp(part, "elm.icon")) { char *thumb_name = NULL; mp_media_info_group_get_thumbnail_path(svc_item, &thumb_name); - icon = mc_common_create_thumb_icon(obj, thumb_name, MC_LIST_ICON_SIZE, MC_LIST_ICON_SIZE); + icon = + mc_common_create_thumb_icon(obj, thumb_name, MC_LIST_ICON_SIZE, + MC_LIST_ICON_SIZE); } return icon; @@ -262,12 +277,15 @@ _mc_search_album_select_cb(void *data, Evas_Object * obj, void *event_info) mp_retm_if(ret != 0, "Fail to get value"); mp_retm_if(name == NULL, "Fail to get value"); - mc_common_push_track_view_by_group_name(list->ad, MP_TRACK_BY_ALBUM, name, playlist_id, NULL); + mc_common_push_track_view_by_group_name(list->ad, + MP_TRACK_BY_ALBUM, name, + playlist_id, NULL); } } -static char * -_mc_search_artist_list_label_get(void *data, Evas_Object * obj, const char *part) +static char *_mc_search_artist_list_label_get(void *data, + Evas_Object * obj, + const char *part) { //startfunc; char *name = NULL; @@ -290,14 +308,18 @@ _mc_search_artist_list_label_get(void *data, Evas_Object * obj, const char *part } bool res = false; - char *markup_name = (char *)mc_common_search_markup_keyword(name, list->filter_str, &res); - return (res) ? g_strdup(markup_name) : elm_entry_utf8_to_markup(name); + char *markup_name = + (char *) mc_common_search_markup_keyword(name, + list->filter_str, + &res); + return (res) ? g_strdup(markup_name) : + elm_entry_utf8_to_markup(name); } return NULL; } -Evas_Object * -_mc_search_artist_list_icon_get(void *data, Evas_Object * obj, const char *part) +Evas_Object *_mc_search_artist_list_icon_get(void *data, Evas_Object * obj, + const char *part) { //startfunc; Evas_Object *icon = NULL; @@ -311,14 +333,17 @@ _mc_search_artist_list_icon_get(void *data, Evas_Object * obj, const char *part) if (!strcmp(part, "elm.icon")) { char *thumb_name = NULL; mp_media_info_group_get_thumbnail_path(svc_item, &thumb_name); - icon = mc_common_create_thumb_icon(obj, thumb_name, MC_LIST_ICON_SIZE, MC_LIST_ICON_SIZE); + icon = + mc_common_create_thumb_icon(obj, thumb_name, MC_LIST_ICON_SIZE, + MC_LIST_ICON_SIZE); } return icon; } static void -_mc_search_artist_select_cb(void *data, Evas_Object * obj, void *event_info) +_mc_search_artist_select_cb(void *data, Evas_Object * obj, + void *event_info) { DEBUG_TRACE(""); char *name = NULL; @@ -342,12 +367,14 @@ _mc_search_artist_select_cb(void *data, Evas_Object * obj, void *event_info) mp_media_info_group_get_main_info(gli_data->handle, &name); mp_retm_if(name == NULL, "Fail to get value"); - mc_common_push_track_view_by_group_name(list->ad, MP_TRACK_BY_ARTIST, name, playlist_id, NULL); + mc_common_push_track_view_by_group_name(list->ad, + MP_TRACK_BY_ARTIST, name, + playlist_id, NULL); } } -char * -_mc_search_list_gl_label_get_title(void *data, Evas_Object * obj, const char *part) +char *_mc_search_list_gl_label_get_title(void *data, Evas_Object * obj, + const char *part) { //startfunc; char *text = NULL; @@ -359,8 +386,7 @@ _mc_search_list_gl_label_get_title(void *data, Evas_Object * obj, const char *pa return NULL; } -static void -_mc_search_list_item_del(void *data, Evas_Object * obj) +static void _mc_search_list_item_del(void *data, Evas_Object * obj) { startfunc; mc_list_item_data_t *item_data = data; @@ -394,32 +420,36 @@ static void _mc_search_list_set_itc(void *thiz) MP_CHECK(list->itc_artist); list->itc_artist->item_style = "music/1text.1icon.2.tb"; list->itc_artist->func.text_get = _mc_search_artist_list_label_get; - list->itc_artist->func.content_get = _mc_search_artist_list_icon_get; + list->itc_artist->func.content_get = + _mc_search_artist_list_icon_get; list->itc_artist->func.del = _mc_search_list_item_del; } if (!list->itc_group_title) { list->itc_group_title = elm_genlist_item_class_new(); MP_CHECK(list->itc_group_title); list->itc_group_title->item_style = "music/groupindex"; - list->itc_group_title->func.text_get = _mc_search_list_gl_label_get_title; + list->itc_group_title->func.text_get = + _mc_search_list_gl_label_get_title; } } -static void -_mc_search_list_append_group_title(void * data, char *text_ID) +static void _mc_search_list_append_group_title(void *data, char *text_ID) { startfunc; - UgMpSearchList_t *list = (UgMpSearchList_t *)data; + UgMpSearchList_t *list = (UgMpSearchList_t *) data; MP_CHECK(list); list->search_group_git = - elm_genlist_item_append(list->genlist, list->itc_group_title, text_ID, NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL); - elm_genlist_item_select_mode_set(list->search_group_git, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + elm_genlist_item_append(list->genlist, list->itc_group_title, + text_ID, NULL, ELM_GENLIST_ITEM_GROUP, + NULL, NULL); + elm_genlist_item_select_mode_set(list->search_group_git, + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); } static void _mc_search_list_load_list(void *thiz) { startfunc; - UgMpSearchList_t *list = (UgMpSearchList_t *)thiz; + UgMpSearchList_t *list = (UgMpSearchList_t *) thiz; MP_CHECK(list); int count = 0; @@ -431,17 +461,23 @@ static void _mc_search_list_load_list(void *thiz) int ret = 0; mp_media_list_h svc_handle = NULL; - ret = mp_media_info_group_list_count(MP_GROUP_BY_ARTIST, NULL, list->filter_str, &artist_count); + ret = + mp_media_info_group_list_count(MP_GROUP_BY_ARTIST, NULL, + list->filter_str, &artist_count); if (ret != 0) { DEBUG_TRACE("Fail to create structure"); goto END; } - ret = mp_media_info_group_list_count(MP_GROUP_BY_ALBUM, NULL, list->filter_str, &album_count); + ret = + mp_media_info_group_list_count(MP_GROUP_BY_ALBUM, NULL, + list->filter_str, &album_count); if (ret != 0) { DEBUG_TRACE("Fail to create structure"); goto END; } - ret = mp_media_info_list_count(MP_TRACK_ALL, NULL, NULL, list->filter_str, 0, &track_count); + ret = + mp_media_info_list_count(MP_TRACK_ALL, NULL, NULL, + list->filter_str, 0, &track_count); if (ret != 0) { DEBUG_TRACE("Fail to create structure"); goto END; @@ -455,27 +491,35 @@ static void _mc_search_list_load_list(void *thiz) } - /*create new genlist*/ + /*create new genlist */ if (list->genlist != NULL) { evas_object_del(list->genlist); list->genlist = NULL; } list->genlist = mc_widget_genlist_create(list->box); - elm_scroller_policy_set(list->genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); - evas_object_size_hint_weight_set(list->genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(list->genlist, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_scroller_policy_set(list->genlist, ELM_SCROLLER_POLICY_OFF, + ELM_SCROLLER_POLICY_AUTO); + evas_object_size_hint_weight_set(list->genlist, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(list->genlist, EVAS_HINT_FILL, + EVAS_HINT_FILL); evas_object_show(list->genlist); - /*packet genlist to box*/ + /*packet genlist to box */ elm_box_pack_end(list->box, list->genlist); - evas_object_data_set(list->genlist, "list_handle", (void *)list); + evas_object_data_set(list->genlist, "list_handle", (void *) list); _mc_search_list_set_itc(list); if (artist_count) { DEBUG_TRACE("append artist list items"); - _mc_search_list_append_group_title(list, ("IDS_MUSIC_TAB4_ARTISTS")); - ret = mp_media_info_group_list_create(&svc_handle, MP_GROUP_BY_ARTIST, NULL, list->filter_str, 0, artist_count); + _mc_search_list_append_group_title(list, + ("IDS_MUSIC_TAB4_ARTISTS")); + ret = + mp_media_info_group_list_create(&svc_handle, + MP_GROUP_BY_ARTIST, NULL, + list->filter_str, 0, + artist_count); if (ret != 0) { DEBUG_TRACE("Fail to get items"); if (svc_handle) { @@ -489,18 +533,24 @@ static void _mc_search_list_load_list(void *thiz) item = mp_media_info_group_list_nth_item(svc_handle, index); if (item == NULL) { - DEBUG_TRACE("Fail to mp_media_info_group_list_nth_item, ret[%d], index[%d]", ret, index); + DEBUG_TRACE + ("Fail to mp_media_info_group_list_nth_item, ret[%d], index[%d]", + ret, index); continue; } - mc_list_item_data_t *item_data = calloc(1, sizeof(mc_list_item_data_t)); + mc_list_item_data_t *item_data = + calloc(1, sizeof(mc_list_item_data_t)); mp_assert(item_data); item_data->handle = item; item_data->group_type = MP_GROUP_BY_ARTIST; - item_data->it = elm_genlist_item_append(list->genlist, list->itc_artist, (void *)item_data, - list->search_group_git, ELM_GENLIST_ITEM_NONE, - _mc_search_artist_select_cb, list); + item_data->it = + elm_genlist_item_append(list->genlist, list->itc_artist, + (void *) item_data, + list->search_group_git, + ELM_GENLIST_ITEM_NONE, + _mc_search_artist_select_cb, list); } if (list->artist_handle) { @@ -514,9 +564,13 @@ static void _mc_search_list_load_list(void *thiz) if (album_count) { DEBUG_TRACE("append album_count list items"); - _mc_search_list_append_group_title(list, ("IDS_MUSIC_TAB4_ALBUMS")); + _mc_search_list_append_group_title(list, + ("IDS_MUSIC_TAB4_ALBUMS")); - ret = mp_media_info_group_list_create(&svc_handle, MP_GROUP_BY_ALBUM, NULL, list->filter_str, 0, album_count); + ret = + mp_media_info_group_list_create(&svc_handle, MP_GROUP_BY_ALBUM, + NULL, list->filter_str, 0, + album_count); if (ret != 0) { DEBUG_TRACE("Fail to get items"); if (svc_handle) { @@ -530,7 +584,9 @@ static void _mc_search_list_load_list(void *thiz) char *title = NULL; item = mp_media_info_group_list_nth_item(svc_handle, index); if (item == NULL) { - DEBUG_TRACE("Fail to mp_media_info_group_list_nth_item, ret[%d], index[%d]", ret, index); + DEBUG_TRACE + ("Fail to mp_media_info_group_list_nth_item, ret[%d], index[%d]", + ret, index); continue; } ret = mp_media_info_group_get_main_info(item, &title); @@ -541,9 +597,12 @@ static void _mc_search_list_load_list(void *thiz) item_data->handle = item; item_data->group_type = MP_GROUP_BY_ALBUM; - item_data->it = elm_genlist_item_append(list->genlist, list->itc_album, (void *)item_data, - list->search_group_git, ELM_GENLIST_ITEM_NONE, - _mc_search_album_select_cb, list); + item_data->it = + elm_genlist_item_append(list->genlist, list->itc_album, + (void *) item_data, + list->search_group_git, + ELM_GENLIST_ITEM_NONE, + _mc_search_album_select_cb, list); } @@ -560,7 +619,10 @@ static void _mc_search_list_load_list(void *thiz) DEBUG_TRACE("append track_count list items"); _mc_search_list_append_group_title(list, (STR_MP_TRACKS)); - ret = mp_media_info_list_create(&svc_handle, MP_TRACK_ALL, NULL, NULL, list->filter_str, 0, 0, track_count); + ret = + mp_media_info_list_create(&svc_handle, MP_TRACK_ALL, NULL, + NULL, list->filter_str, 0, 0, + track_count); if (ret != 0) { DEBUG_TRACE("Fail to get items"); if (svc_handle) { @@ -582,9 +644,12 @@ static void _mc_search_list_load_list(void *thiz) item_data->handle = item; item_data->group_type = MP_GROUP_NONE; - item_data->it = elm_genlist_item_append(list->genlist, list->itc_track, (void *)item_data, - list->search_group_git, ELM_GENLIST_ITEM_NONE, - _mc_search_track_sel_cb, list); + item_data->it = + elm_genlist_item_append(list->genlist, list->itc_track, + (void *) item_data, + list->search_group_git, + ELM_GENLIST_ITEM_NONE, + _mc_search_track_sel_cb, list); } if (list->track_handle) { @@ -596,11 +661,12 @@ static void _mc_search_list_load_list(void *thiz) } -END: + END: endfunc; } -void _mc_search_list_destory_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) +void _mc_search_list_destory_cb(void *data, Evas * evas, Evas_Object * obj, + void *event_info) { startfunc; UgMpSearchList_t *list = data; @@ -640,7 +706,8 @@ void mc_search_list_update(void *thiz) } -UgMpSearchList_t * mc_search_list_create(Evas_Object *parent, struct app_data *ad) +UgMpSearchList_t *mc_search_list_create(Evas_Object * parent, + struct app_data *ad) { startfunc; MP_CHECK_NULL(parent); @@ -650,7 +717,7 @@ UgMpSearchList_t * mc_search_list_create(Evas_Object *parent, struct app_data *a list->ad = ad; - char mc_edj_path[1024] = {0}; + char mc_edj_path[1024] = { 0 }; char *path = app_get_resource_path(); MP_CHECK_NULL(path); snprintf(mc_edj_path, 1024, "%s%s", path, MC_EDJ_FILE); @@ -667,17 +734,20 @@ UgMpSearchList_t * mc_search_list_create(Evas_Object *parent, struct app_data *a return NULL; } - evas_object_size_hint_weight_set(list->box, EVAS_HINT_EXPAND, EVAS_HINT_FILL); - evas_object_size_hint_align_set(list->box, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(list->box, EVAS_HINT_EXPAND, + EVAS_HINT_FILL); + evas_object_size_hint_align_set(list->box, EVAS_HINT_FILL, + EVAS_HINT_FILL); elm_object_part_content_set(list->layout, "list_content", list->box); evas_object_show(list->box); - evas_object_event_callback_add(list->layout, EVAS_CALLBACK_FREE, _mc_search_list_destory_cb, list); + evas_object_event_callback_add(list->layout, EVAS_CALLBACK_FREE, + _mc_search_list_destory_cb, list); return list; } -void mc_search_list_set_data(UgMpSearchList_t *list, ...) +void mc_search_list_set_data(UgMpSearchList_t * list, ...) { startfunc; MP_CHECK(list); @@ -691,14 +761,14 @@ void mc_search_list_set_data(UgMpSearchList_t *list, ...) DEBUG_TRACE("field is %d", field); switch (field) { - case MC_SEARCH_LIST_FILTER_STR: { - char *val = va_arg((var_args), char *); - SAFE_FREE(list->filter_str); - list->filter_str = g_strdup(val); - DEBUG_TRACE("list->filter_str = %s", list->filter_str); + case MC_SEARCH_LIST_FILTER_STR:{ + char *val = va_arg((var_args), char *); + SAFE_FREE(list->filter_str); + list->filter_str = g_strdup(val); + DEBUG_TRACE("list->filter_str = %s", list->filter_str); - break; - } + break; + } default: DEBUG_TRACE("Invalid arguments"); @@ -708,4 +778,3 @@ void mc_search_list_set_data(UgMpSearchList_t *list, ...) va_end(var_args); } - diff --git a/music-chooser/src/mc-search-view.c b/music-chooser/src/mc-search-view.c index 0517647..f8ef4cf 100644 --- a/music-chooser/src/mc-search-view.c +++ b/music-chooser/src/mc-search-view.c @@ -25,8 +25,8 @@ static void _mc_search_view_content_load(void *thiz); -/*************** functions for track list update *******************/ -static Eina_Bool _mc_search_view_back_cb(void *data, Elm_Object_Item *it) +/*************** functions for track list update *******************/ +static Eina_Bool _mc_search_view_back_cb(void *data, Elm_Object_Item * it) { eventfunc; search_view_data_t *search = (search_view_data_t *) data; @@ -43,18 +43,19 @@ static Eina_Bool _mc_search_view_back_cb(void *data, Elm_Object_Item *it) int mc_search_view_update_options(void *thiz) { startfunc; - search_view_data_t *search = (search_view_data_t *)thiz; + search_view_data_t *search = (search_view_data_t *) thiz; MP_CHECK_VAL(search, -1); - /*add search bar into title part of navi frame*/ - elm_object_item_part_content_set(search->navi_it, "title", search->search_bar); - elm_naviframe_item_pop_cb_set(search->navi_it, _mc_search_view_back_cb, search); + /*add search bar into title part of navi frame */ + elm_object_item_part_content_set(search->navi_it, "title", + search->search_bar); + elm_naviframe_item_pop_cb_set(search->navi_it, _mc_search_view_back_cb, + search); return 0; } -static Eina_Bool -_mc_search_view_update_list_timer_cb(void *data) +static Eina_Bool _mc_search_view_update_list_timer_cb(void *data) { eventfunc; search_view_data_t *search = (search_view_data_t *) data; @@ -71,7 +72,8 @@ _mc_search_view_update_list_timer_cb(void *data) static void -_mc_search_view_keyword_changed_cb(void *data, Evas_Object * obj, void *event_info) +_mc_search_view_keyword_changed_cb(void *data, Evas_Object * obj, + void *event_info) { search_view_data_t *search = (search_view_data_t *) data; MP_CHECK(search); @@ -94,21 +96,22 @@ _mc_search_view_keyword_changed_cb(void *data, Evas_Object * obj, void *event_in } mp_ecore_timer_del(search->search_timer); - search->search_timer = ecore_timer_add(0.1, _mc_search_view_update_list_timer_cb, search); + search->search_timer = + ecore_timer_add(0.1, _mc_search_view_update_list_timer_cb, search); } -static void -_mc_search_view_create_search_bar(void *thiz) +static void _mc_search_view_create_search_bar(void *thiz) { startfunc; - search_view_data_t *search = (search_view_data_t *)thiz; + search_view_data_t *search = (search_view_data_t *) thiz; MP_CHECK(search); MP_CHECK(search->layout); search->search_bar = mc_search_create_new(search->layout, - _mc_search_view_keyword_changed_cb, search, NULL, NULL, - NULL, search, NULL, search); + _mc_search_view_keyword_changed_cb, + search, NULL, NULL, NULL, + search, NULL, search); MP_CHECK(search->search_bar); evas_object_show(mc_search_entry_get(search->search_bar)); endfunc; @@ -117,52 +120,58 @@ _mc_search_view_create_search_bar(void *thiz) static void _mc_search_view_content_load(void *thiz) { startfunc; - search_view_data_t *search = (search_view_data_t *)thiz; + search_view_data_t *search = (search_view_data_t *) thiz; MP_CHECK(search); MP_CHECK(search->layout); - Evas_Object *content = elm_object_part_content_unset(search->layout, "list-content"); + Evas_Object *content = + elm_object_part_content_unset(search->layout, "list-content"); evas_object_del(content); - UgMpSearchList_t *list = mc_search_list_create(search->layout, search->ad); + UgMpSearchList_t *list = + mc_search_list_create(search->layout, search->ad); MP_CHECK(list); - mc_search_list_set_data(list, MC_SEARCH_LIST_FILTER_STR, search->needle, -1); + mc_search_list_set_data(list, MC_SEARCH_LIST_FILTER_STR, + search->needle, -1); mc_search_list_update(list); MP_CHECK(list->layout); - elm_object_part_content_set(search->layout, "list-content", list->layout); + elm_object_part_content_set(search->layout, "list-content", + list->layout); free(list); endfunc; } -static void _mc_search_layout_del_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) +static void _mc_search_layout_del_cb(void *data, Evas * evas, + Evas_Object * obj, void *event_info) { startfunc; } -static void -_mc_search_init(Evas_Object *parent, void *thiz) +static void _mc_search_init(Evas_Object * parent, void *thiz) { startfunc; - search_view_data_t *search = (search_view_data_t *)thiz; + search_view_data_t *search = (search_view_data_t *) thiz; - char mc_edj_path[1024] = {0}; + char mc_edj_path[1024] = { 0 }; char *path = app_get_resource_path(); if (path == NULL) { return; } snprintf(mc_edj_path, 1024, "%s%s", path, MC_EDJ_FILE); free(path); - Evas_Object *layout = mc_common_load_edj(parent, mc_edj_path, "view_layout"); + Evas_Object *layout = + mc_common_load_edj(parent, mc_edj_path, "view_layout"); search->layout = layout; /* search bar */ _mc_search_view_create_search_bar(search); - evas_object_event_callback_add(layout, EVAS_CALLBACK_DEL, _mc_search_layout_del_cb, search); + evas_object_event_callback_add(layout, EVAS_CALLBACK_DEL, + _mc_search_layout_del_cb, search); char *keyword = NULL; search->needle = g_strdup(keyword); @@ -173,7 +182,8 @@ _mc_search_init(Evas_Object *parent, void *thiz) return; } -search_view_data_t *mc_search_view_create(Evas_Object *parent, struct app_data *ad) +search_view_data_t *mc_search_view_create(Evas_Object * parent, + struct app_data * ad) { eventfunc; search_view_data_t *search = NULL; @@ -186,10 +196,13 @@ search_view_data_t *mc_search_view_create(Evas_Object *parent, struct app_data * _mc_search_init(ad->navi_bar, search); Evas_Object *searchbar_layout = NULL; - elm_object_part_content_set(search->layout, "searchbar", searchbar_layout); + elm_object_part_content_set(search->layout, "searchbar", + searchbar_layout); search->searchbar_layout = searchbar_layout; - Elm_Object_Item *navi_it = elm_naviframe_item_push(ad->navi_bar, NULL, NULL, NULL, search->layout, "empty/music"); + Elm_Object_Item *navi_it = + elm_naviframe_item_push(ad->navi_bar, NULL, NULL, NULL, + search->layout, "empty/music"); search->navi_it = navi_it; elm_naviframe_item_pop_cb_set(navi_it, mc_quit_cb, ad); @@ -198,7 +211,8 @@ search_view_data_t *mc_search_view_create(Evas_Object *parent, struct app_data * } void -mc_search_view_set_keyword(search_view_data_t *search, const char *keyword) +mc_search_view_set_keyword(search_view_data_t * search, + const char *keyword) { MP_CHECK(search); IF_FREE(search->needle); diff --git a/music-chooser/src/mc-search.c b/music-chooser/src/mc-search.c index 1e242f8..da46114 100644 --- a/music-chooser/src/mc-search.c +++ b/music-chooser/src/mc-search.c @@ -18,7 +18,8 @@ #include "music-chooser.h" void -_mc_search_view_activated_cb(void *data, Evas_Object * obj, void *event_info) +_mc_search_view_activated_cb(void *data, Evas_Object * obj, + void *event_info) { MP_CHECK(data); elm_object_focus_set(obj, FALSE); @@ -34,7 +35,8 @@ _mc_search_view_clicked_cb(void *data, Evas_Object * obj, void *event_info) } static void -_mc_search_entry_changed_cb(void *data, Evas_Object * obj, void *event_info) +_mc_search_entry_changed_cb(void *data, Evas_Object * obj, + void *event_info) { Evas_Object *searchbar = data; MP_CHECK(searchbar); @@ -52,7 +54,8 @@ _mc_search_entry_changed_cb(void *data, Evas_Object * obj, void *event_info) } static void -_mc_search_eraser_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source) +_mc_search_eraser_clicked_cb(void *data, Evas_Object * obj, + const char *emission, const char *source) { startfunc; Evas_Object *entry = data; @@ -62,7 +65,8 @@ _mc_search_eraser_clicked_cb(void *data, Evas_Object *obj, const char *emission, elm_object_focus_set(entry, TRUE); } -static void _entry_text_changed_cb(void *data, Evas_Object *obj, void *event_info) +static void _entry_text_changed_cb(void *data, Evas_Object * obj, + void *event_info) { startfunc; Evas_Object *searchbar = data; @@ -81,15 +85,22 @@ static void _entry_text_changed_cb(void *data, Evas_Object *obj, void *event_inf } static void -_mc_search_entry_maxlength_reached_cb(void *data, Evas_Object * obj, void *event_info) +_mc_search_entry_maxlength_reached_cb(void *data, Evas_Object * obj, + void *event_info) { //mp_popup_max_length(obj, STR_NH_COM_POPUP_CHARACTERS_MAXNUM_REACHED); } -Evas_Object * -mc_search_create_new(Evas_Object * parent, Evas_Smart_Cb change_cb, void *change_cb_data, Evas_Smart_Cb cancel_cb, void *cancel_cb_data, - Evas_Smart_Cb focus_cb, void *focus_cb_data, Evas_Smart_Cb unfocus_cb, void *unfocus_cb_data) +Evas_Object *mc_search_create_new(Evas_Object * parent, + Evas_Smart_Cb change_cb, + void *change_cb_data, + Evas_Smart_Cb cancel_cb, + void *cancel_cb_data, + Evas_Smart_Cb focus_cb, + void *focus_cb_data, + Evas_Smart_Cb unfocus_cb, + void *unfocus_cb_data) { startfunc; Evas_Object *sb = NULL; @@ -106,8 +117,10 @@ mc_search_create_new(Evas_Object * parent, Evas_Smart_Cb change_cb, void *change elm_object_style_set(cancel_btn, "searchbar/default"); //elm_object_text_set(cancel_btn, GET_SYS_STR("IDS_COM_SK_CANCEL")); //mp_language_mgr_register_object(cancel_btn, OBJ_TYPE_ELM_OBJECT, NULL, "IDS_COM_SK_CANCEL"); - mc_common_obj_domain_text_translate(cancel_btn, "IDS_COM_SK_CANCEL"); - evas_object_smart_callback_add(cancel_btn, "clicked", cancel_cb, cancel_cb_data); + mc_common_obj_domain_text_translate(cancel_btn, + "IDS_COM_SK_CANCEL"); + evas_object_smart_callback_add(cancel_btn, "clicked", cancel_cb, + cancel_cb_data); elm_object_part_content_set(sb, "button_cancel", cancel_btn); elm_object_signal_emit(sb, "cancel,show", ""); @@ -120,32 +133,45 @@ mc_search_create_new(Evas_Object * parent, Evas_Smart_Cb change_cb, void *change elm_object_part_content_set(sb, "elm.swallow.content", en); evas_object_data_set(sb, "entry", en); //elm_object_part_text_set(en, "elm.guide", GET_STR(STR_SEARCH_GUIDE)); - mc_common_obj_domain_translatable_part_text_set(en, "elm.guide", MC_TEXT_SEARCH); + mc_common_obj_domain_translatable_part_text_set(en, "elm.guide", + MC_TEXT_SEARCH); elm_entry_input_panel_layout_set(en, ELM_INPUT_PANEL_LAYOUT_NORMAL); - elm_entry_input_panel_return_key_type_set(en, ELM_INPUT_PANEL_RETURN_KEY_TYPE_SEARCH); + elm_entry_input_panel_return_key_type_set(en, + ELM_INPUT_PANEL_RETURN_KEY_TYPE_SEARCH); evas_object_size_hint_weight_set(sb, EVAS_HINT_EXPAND, 0); evas_object_size_hint_align_set(sb, EVAS_HINT_FILL, 0.0); - evas_object_smart_callback_add(en, "changed", _mc_search_entry_changed_cb, sb); - elm_object_signal_callback_add(sb, "elm,eraser,clicked", "elm", _mc_search_eraser_clicked_cb, en); + evas_object_smart_callback_add(en, "changed", + _mc_search_entry_changed_cb, sb); + elm_object_signal_callback_add(sb, "elm,eraser,clicked", "elm", + _mc_search_eraser_clicked_cb, en); - evas_object_smart_callback_add(en, "changed", change_cb, change_cb_data); - evas_object_smart_callback_add(en, "activated", _mc_search_view_activated_cb, sb); + evas_object_smart_callback_add(en, "changed", change_cb, + change_cb_data); + evas_object_smart_callback_add(en, "activated", + _mc_search_view_activated_cb, sb); evas_object_smart_callback_add(en, "focused", focus_cb, focus_cb_data); - evas_object_smart_callback_add(en, "unfocused", unfocus_cb, focus_cb_data); + evas_object_smart_callback_add(en, "unfocused", unfocus_cb, + focus_cb_data); - evas_object_smart_callback_add(en, "preedit,changed", _entry_text_changed_cb, sb); - evas_object_smart_callback_add(en, "preedit,changed", change_cb, change_cb_data); - evas_object_smart_callback_add(en, "clicked", _mc_search_view_clicked_cb, sb); + evas_object_smart_callback_add(en, "preedit,changed", + _entry_text_changed_cb, sb); + evas_object_smart_callback_add(en, "preedit,changed", change_cb, + change_cb_data); + evas_object_smart_callback_add(en, "clicked", + _mc_search_view_clicked_cb, sb); static Elm_Entry_Filter_Limit_Size limit_filter_data; limit_filter_data.max_char_count = 0; limit_filter_data.max_byte_count = 193; - elm_entry_markup_filter_append(en, elm_entry_filter_limit_size, &limit_filter_data); - evas_object_smart_callback_add(en, "maxlength,reached", _mc_search_entry_maxlength_reached_cb, NULL); + elm_entry_markup_filter_append(en, elm_entry_filter_limit_size, + &limit_filter_data); + evas_object_smart_callback_add(en, "maxlength,reached", + _mc_search_entry_maxlength_reached_cb, + NULL); evas_object_show(sb); //elm_object_focus_set(en,EINA_TRUE); @@ -153,24 +179,21 @@ mc_search_create_new(Evas_Object * parent, Evas_Smart_Cb change_cb, void *change return sb; } -void -mc_search_hide_imf_pannel(Evas_Object * search) +void mc_search_hide_imf_pannel(Evas_Object * search) { MP_CHECK(search); Evas_Object *en = mc_search_entry_get(search); elm_object_focus_set(en, EINA_FALSE); } -void -mc_search_show_imf_pannel(Evas_Object * search) +void mc_search_show_imf_pannel(Evas_Object * search) { MP_CHECK(search); Evas_Object *en = mc_search_entry_get(search); elm_object_focus_set(en, EINA_TRUE); } -Evas_Object * -mc_search_entry_get(Evas_Object *search) +Evas_Object *mc_search_entry_get(Evas_Object * search) { MP_CHECK_NULL(search); @@ -179,8 +202,7 @@ mc_search_entry_get(Evas_Object *search) return entry; } -char * -mc_search_text_get(Evas_Object *search) +char *mc_search_text_get(Evas_Object * search) { MP_CHECK_NULL(search); Evas_Object *entry = evas_object_data_get(search, "entry"); @@ -192,8 +214,7 @@ mc_search_text_get(Evas_Object *search) return markup_text; } -void -mc_search_text_set(Evas_Object *search, const char *text) +void mc_search_text_set(Evas_Object * search, const char *text) { MP_CHECK(search); Evas_Object *entry = evas_object_data_get(search, "entry"); @@ -208,4 +229,3 @@ mc_search_text_set(Evas_Object *search, const char *text) elm_entry_cursor_end_set(entry); //elm_object_text_set(entry, text); } - diff --git a/music-chooser/src/mc-select-view.c b/music-chooser/src/mc-select-view.c index 85f7ba8..89851fc 100644 --- a/music-chooser/src/mc-select-view.c +++ b/music-chooser/src/mc-select-view.c @@ -37,8 +37,8 @@ typedef struct { mp_group_type_e type; - char *filter_text; //free - char *title; //not free + char *filter_text; //free + char *title; //not free int count; mp_media_list_h media_list; @@ -47,9 +47,10 @@ typedef struct { } sel_view_data_t; static Elm_Genlist_Item_Class *itc; -static void _mc_list_update(sel_view_data_t *vd); +static void _mc_list_update(sel_view_data_t * vd); -static void _mc_layout_del_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) +static void _mc_layout_del_cb(void *data, Evas * evas, Evas_Object * obj, + void *event_info) { sel_view_data_t *vd = data; MP_CHECK(vd); @@ -61,7 +62,7 @@ static void _mc_layout_del_cb(void *data, Evas *evas, Evas_Object *obj, void *ev } #ifdef SHOW_SEARCHBAR -static void _mc_changed_cb(void *data, Evas_Object *obj, void *event_info) +static void _mc_changed_cb(void *data, Evas_Object * obj, void *event_info) { DEBUG_TRACE(""); sel_view_data_t *vd = data; @@ -73,41 +74,49 @@ static void _mc_changed_cb(void *data, Evas_Object *obj, void *event_info) if (elm_object_focus_get(vd->searchbar_layout)) { if (elm_entry_is_empty(obj)) { - elm_object_signal_emit(vd->searchbar_layout, "elm,state,eraser,hide", "elm"); + elm_object_signal_emit(vd->searchbar_layout, + "elm,state,eraser,hide", "elm"); } else { - elm_object_signal_emit(vd->searchbar_layout, "elm,state,eraser,show", "elm"); + elm_object_signal_emit(vd->searchbar_layout, + "elm,state,eraser,show", "elm"); } } _mc_list_update(vd); } -static void _mc_focused_cb(void *data, Evas_Object *obj, void *event_info) +static void _mc_focused_cb(void *data, Evas_Object * obj, void *event_info) { DEBUG_TRACE(""); sel_view_data_t *vd = data; MP_CHECK(vd); if (!elm_entry_is_empty(obj)) { - elm_object_signal_emit(vd->searchbar_layout, "elm,state,eraser,show", "elm"); + elm_object_signal_emit(vd->searchbar_layout, + "elm,state,eraser,show", "elm"); } - elm_object_signal_emit(vd->searchbar_layout, "elm,state,guidetext,hide", "elm"); + elm_object_signal_emit(vd->searchbar_layout, + "elm,state,guidetext,hide", "elm"); elm_object_signal_emit(vd->searchbar_layout, "cancel,in", ""); } -static void _mc_unfocused_cb(void *data, Evas_Object *obj, void *event_info) +static void _mc_unfocused_cb(void *data, Evas_Object * obj, + void *event_info) { DEBUG_TRACE(""); sel_view_data_t *vd = data; MP_CHECK(vd); if (elm_entry_is_empty(obj)) { - elm_object_signal_emit(vd->searchbar_layout, "elm,state,guidetext,show", "elm"); + elm_object_signal_emit(vd->searchbar_layout, + "elm,state,guidetext,show", "elm"); } - elm_object_signal_emit(vd->searchbar_layout, "elm,state,eraser,hide", "elm"); + elm_object_signal_emit(vd->searchbar_layout, "elm,state,eraser,hide", + "elm"); elm_object_signal_emit(vd->searchbar_layout, "cancel,out", ""); } -static void _mc_eraser_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source) +static void _mc_eraser_clicked_cb(void *data, Evas_Object * obj, + const char *emission, const char *source) { DEBUG_TRACE(""); sel_view_data_t *vd = data; @@ -115,7 +124,8 @@ static void _mc_eraser_clicked_cb(void *data, Evas_Object *obj, const char *emis elm_entry_entry_set(vd->entry, ""); } -static void _mc_bg_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source) +static void _mc_bg_clicked_cb(void *data, Evas_Object * obj, + const char *emission, const char *source) { DEBUG_TRACE(""); sel_view_data_t *vd = data; @@ -123,12 +133,13 @@ static void _mc_bg_clicked_cb(void *data, Evas_Object *obj, const char *emission elm_object_focus_set(vd->entry, EINA_TRUE); } -static void _mc_cancel_clicked_cb(void *data, Evas_Object *obj, void *event_info) +static void _mc_cancel_clicked_cb(void *data, Evas_Object * obj, + void *event_info) { DEBUG_TRACE(""); sel_view_data_t *vd = data; MP_CHECK(vd); - const char* text; + const char *text; evas_object_hide(obj); elm_object_signal_emit(vd->searchbar_layout, "cancel,out", ""); text = elm_entry_entry_get(vd->entry); @@ -139,7 +150,9 @@ static void _mc_cancel_clicked_cb(void *data, Evas_Object *obj, void *event_info elm_object_focus_set(vd->list_object, EINA_TRUE); } -static void _mc_searchsymbol_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source) +static void _mc_searchsymbol_clicked_cb(void *data, Evas_Object * obj, + const char *emission, + const char *source) { DEBUG_TRACE(""); sel_view_data_t *vd = data; @@ -147,15 +160,15 @@ static void _mc_searchsymbol_clicked_cb(void *data, Evas_Object *obj, const char elm_object_focus_set(vd->entry, EINA_TRUE); } -static Evas_Object * -_mc_create_searchbar(sel_view_data_t *vd) +static Evas_Object *_mc_create_searchbar(sel_view_data_t * vd) { Evas_Object *entry = NULL, *cancel_btn = NULL; Evas_Object *searchbar_layout = NULL; MP_CHECK_NULL(vd); searchbar_layout = elm_layout_add(vd->layout); - elm_layout_theme_set(searchbar_layout, "layout", "searchbar", "cancel_button"); + elm_layout_theme_set(searchbar_layout, "layout", "searchbar", + "cancel_button"); entry = elm_entry_add(searchbar_layout); vd->entry = entry; @@ -163,30 +176,40 @@ _mc_create_searchbar(sel_view_data_t *vd) elm_entry_single_line_set(entry, EINA_TRUE); evas_object_smart_callback_add(entry, "changed", _mc_changed_cb, vd); evas_object_smart_callback_add(entry, "focused", _mc_focused_cb, vd); - evas_object_smart_callback_add(entry, "unfocused", _mc_unfocused_cb, vd); - elm_object_part_content_set(searchbar_layout, "elm.swallow.content", entry); + evas_object_smart_callback_add(entry, "unfocused", _mc_unfocused_cb, + vd); + elm_object_part_content_set(searchbar_layout, "elm.swallow.content", + entry); //elm_object_part_text_set(searchbar_layout, "elm.guidetext", GET_STR(MC_TEXT_SEARCH)); - mc_common_obj_domain_translatable_part_text_set(searchbar_layout, "elm.guidetext", MC_TEXT_SEARCH); - elm_object_signal_callback_add(searchbar_layout, "elm,eraser,clicked", "elm", _mc_eraser_clicked_cb, vd); - elm_object_signal_callback_add(searchbar_layout, "elm,bg,clicked", "elm", _mc_bg_clicked_cb, vd); + mc_common_obj_domain_translatable_part_text_set(searchbar_layout, + "elm.guidetext", + MC_TEXT_SEARCH); + elm_object_signal_callback_add(searchbar_layout, "elm,eraser,clicked", + "elm", _mc_eraser_clicked_cb, vd); + elm_object_signal_callback_add(searchbar_layout, "elm,bg,clicked", + "elm", _mc_bg_clicked_cb, vd); elm_entry_input_panel_layout_set(entry, ELM_INPUT_PANEL_LAYOUT_NORMAL); - evas_object_size_hint_weight_set(searchbar_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(searchbar_layout, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(searchbar_layout, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(searchbar_layout, EVAS_HINT_FILL, + EVAS_HINT_FILL); cancel_btn = elm_button_add(searchbar_layout); - elm_object_part_content_set(searchbar_layout, "button_cancel", cancel_btn); + elm_object_part_content_set(searchbar_layout, "button_cancel", + cancel_btn); elm_object_style_set(cancel_btn, "searchbar/default"); elm_object_text_set(cancel_btn, GET_SYS_STR(MC_TEXT_CANCEL)); - evas_object_smart_callback_add(cancel_btn, "clicked", _mc_cancel_clicked_cb, vd); - elm_object_signal_callback_add(searchbar_layout, "elm,action,click", "", _mc_searchsymbol_clicked_cb, vd); + evas_object_smart_callback_add(cancel_btn, "clicked", + _mc_cancel_clicked_cb, vd); + elm_object_signal_callback_add(searchbar_layout, "elm,action,click", + "", _mc_searchsymbol_clicked_cb, vd); return searchbar_layout; } #endif -static Evas_Object * -_mc_create_genlist(sel_view_data_t *vd) +static Evas_Object *_mc_create_genlist(sel_view_data_t * vd) { Evas_Object *genlist = NULL; @@ -198,7 +221,7 @@ _mc_create_genlist(sel_view_data_t *vd) return genlist; } -static void _gl_sel(void *data, Evas_Object *obj, void *event_info) +static void _gl_sel(void *data, Evas_Object * obj, void *event_info) { sel_view_data_t *vd = data; MP_CHECK(vd); @@ -217,11 +240,10 @@ static void _gl_sel(void *data, Evas_Object *obj, void *event_info) mp_media_info_group_get_playlist_id(media, &playlist_id); } - //_add_to_home(vd, title, playlist_id, thumbnail_path); } -static void _mc_append_items(sel_view_data_t *vd) +static void _mc_append_items(sel_view_data_t * vd) { startfunc; int i; @@ -229,7 +251,9 @@ static void _mc_append_items(sel_view_data_t *vd) if (vd->type == MP_GROUP_BY_PLAYLIST) { mp_media_info_h media = NULL; - mp_media_info_group_list_create(&media_list, MP_GROUP_BY_SYS_PLAYLIST, NULL, NULL, 0, 0); + mp_media_info_group_list_create(&media_list, + MP_GROUP_BY_SYS_PLAYLIST, NULL, + NULL, 0, 0); i = 0; for (i = 0; i < 3; i++) { media = mp_media_info_group_list_nth_item(media_list, i); @@ -238,7 +262,8 @@ static void _mc_append_items(sel_view_data_t *vd) } elm_genlist_item_append(vd->genlist, itc, media, - NULL, ELM_GENLIST_ITEM_NONE, _gl_sel, vd); + NULL, ELM_GENLIST_ITEM_NONE, _gl_sel, + vd); } if (vd->defualt_playlist) { @@ -247,12 +272,14 @@ static void _mc_append_items(sel_view_data_t *vd) vd->defualt_playlist = media_list; } - mp_media_info_group_list_create(&media_list, vd->type, NULL, vd->filter_text, 0, vd->count); + mp_media_info_group_list_create(&media_list, vd->type, NULL, + vd->filter_text, 0, vd->count); for (i = 0; i < vd->count; i++) { elm_genlist_item_append(vd->genlist, itc, - mp_media_info_group_list_nth_item(media_list, i), - NULL, ELM_GENLIST_ITEM_NONE, _gl_sel, vd); + mp_media_info_group_list_nth_item + (media_list, i), NULL, + ELM_GENLIST_ITEM_NONE, _gl_sel, vd); } if (vd->media_list) { @@ -262,15 +289,15 @@ static void _mc_append_items(sel_view_data_t *vd) endfunc; } -static void -_mc_list_update(sel_view_data_t *vd) +static void _mc_list_update(sel_view_data_t * vd) { Evas_Object *list_object = NULL; int item_count = 0; MP_CHECK(vd); - mp_media_info_group_list_count(vd->type, NULL, vd->filter_text, &item_count); + mp_media_info_group_list_count(vd->type, NULL, vd->filter_text, + &item_count); DEBUG_TRACE("count: %d", item_count); vd->count = item_count; @@ -308,12 +335,12 @@ _mc_list_update(sel_view_data_t *vd) _mc_append_items(vd); } - elm_object_part_content_set(vd->layout, "elm.swallow.content", list_object); + elm_object_part_content_set(vd->layout, "elm.swallow.content", + list_object); vd->list_object = list_object; } -static void -_mc_select_view_init(int type, sel_view_data_t *vd) +static void _mc_select_view_init(int type, sel_view_data_t * vd) { MP_CHECK(vd); @@ -333,13 +360,13 @@ _mc_select_view_init(int type, sel_view_data_t *vd) itc->item_style = "music/2text.1icon"; itc->func.text_get = mc_artist_text_get; vd->type = MP_GROUP_BY_ARTIST; - vd->title = MC_TEXT_SELECT_ARTIST; + vd->title = MC_TEXT_SELECT_ARTIST; break; case MC_SHORTCUT_PLAYLIST: itc->item_style = "music/2text.1icon"; itc->func.text_get = mc_playlist_text_get; vd->type = MP_GROUP_BY_PLAYLIST; - vd->title = MC_TEXT_SELECT_PLAYLIST; + vd->title = MC_TEXT_SELECT_PLAYLIST; break; default: ERROR_TRACE("Invalid vd->type: %d", type); @@ -347,8 +374,7 @@ _mc_select_view_init(int type, sel_view_data_t *vd) } } -Evas_Object * -mc_select_view_create(struct app_data *ad) +Evas_Object *mc_select_view_create(struct app_data *ad) { startfunc; Evas_Object *layout = NULL; @@ -359,7 +385,8 @@ mc_select_view_create(struct app_data *ad) layout = elm_layout_add(ad->navi_bar); MP_CHECK_NULL(layout); - elm_layout_theme_set(layout, "layout", "application", "searchbar_base"); + elm_layout_theme_set(layout, "layout", "application", + "searchbar_base"); #ifdef SHOW_SEARCHBAR elm_object_signal_emit(layout, "elm,state,show,searchbar", "elm"); #endif @@ -368,7 +395,8 @@ mc_select_view_create(struct app_data *ad) vd->ad = ad; vd->layout = layout; evas_object_data_set(layout, "view_data", vd); - evas_object_event_callback_add(layout, EVAS_CALLBACK_DEL, _mc_layout_del_cb, vd); + evas_object_event_callback_add(layout, EVAS_CALLBACK_DEL, + _mc_layout_del_cb, vd); _mc_select_view_init(ad->select_type, vd); @@ -386,7 +414,9 @@ mc_select_view_create(struct app_data *ad) evas_object_smart_callback_add(btn, "clicked", mc_quit_select_cb, ad); - Elm_Object_Item *navi_it = elm_naviframe_item_push(ad->navi_bar, GET_STR(vd->title), btn, NULL, layout, NULL); + Elm_Object_Item *navi_it = + elm_naviframe_item_push(ad->navi_bar, GET_STR(vd->title), btn, + NULL, layout, NULL); MP_CHECK_NULL(navi_it); elm_naviframe_item_pop_cb_set(navi_it, mc_quit_cb, ad); @@ -394,4 +424,3 @@ mc_select_view_create(struct app_data *ad) endfunc; return layout; } - diff --git a/music-chooser/src/mc-track-list.c b/music-chooser/src/mc-track-list.c index bc2a09d..df50007 100644 --- a/music-chooser/src/mc-track-list.c +++ b/music-chooser/src/mc-track-list.c @@ -19,8 +19,8 @@ #include "mc-common.h" #include "mc-list-play.h" -static int state_index = -1; //selected radio index -static Evas_Object* g_radio_main = NULL; +static int state_index = -1; //selected radio index +static Evas_Object *g_radio_main = NULL; extern list_item_data_t *previous_item_data; extern list_item_data_t *pre_item_data; @@ -53,12 +53,11 @@ typedef struct { #define GET_LIST_DATA(obj) evas_object_data_get(obj, "list_data") -static void _gl_sel_cb(void *data, Evas_Object *obj, void *event_info); +static void _gl_sel_cb(void *data, Evas_Object * obj, void *event_info); static unsigned int _get_media_list_count(void *data); unsigned int _get_select_count(void *data); -static Evas_Object * -_mc_create_genlist(Evas_Object *parent) +static Evas_Object *_mc_create_genlist(Evas_Object * parent) { Evas_Object *genlist = NULL; MP_CHECK_NULL(parent); @@ -78,7 +77,8 @@ _mc_create_genlist(Evas_Object *parent) } static void -_mc_track_play_btn_cb(void *data, Evas_Object * obj, const char *emission, const char *source) +_mc_track_play_btn_cb(void *data, Evas_Object * obj, const char *emission, + const char *source) { startfunc; MP_CHECK(emission); @@ -88,10 +88,11 @@ _mc_track_play_btn_cb(void *data, Evas_Object * obj, const char *emission, const mc_pre_play_control_play_music_item(itemData); - return ; + return; } -static void _check_changed_cb(void *data, Evas_Object *obj, void *event_info) +static void _check_changed_cb(void *data, Evas_Object * obj, + void *event_info) { list_item_data_t *it_data = data; MP_CHECK(it_data); @@ -104,10 +105,12 @@ static void _check_changed_cb(void *data, Evas_Object *obj, void *event_info) _gl_sel_cb(ld, obj, it_data->it); } -static Evas_Object *_gl_select_all_content_get(void *data, Evas_Object *obj, const char *part) +static Evas_Object *_gl_select_all_content_get(void *data, + Evas_Object * obj, + const char *part) { if (!strcmp(part, "elm.swallow.end")) { - track_list_data_t *ld = data; + track_list_data_t *ld = data; unsigned int select_count = _get_select_count(ld); unsigned int total_count = _get_media_list_count(ld); Evas_Object *content = elm_check_add(obj); @@ -115,7 +118,9 @@ static Evas_Object *_gl_select_all_content_get(void *data, Evas_Object *obj, con if (select_count == total_count) { elm_check_state_set(content, EINA_TRUE); } - evas_object_smart_callback_add(content, "changed", _mc_track_list_select_all_selected_item_data_get, data); + evas_object_smart_callback_add(content, "changed", + _mc_track_list_select_all_selected_item_data_get, + data); evas_object_repeat_events_set(content, EINA_FALSE); evas_object_propagate_events_set(content, EINA_FALSE); return content; @@ -123,23 +128,28 @@ static Evas_Object *_gl_select_all_content_get(void *data, Evas_Object *obj, con return NULL; } -void mc_post_notification_indicator(list_item_data_t *it_data, player_state_e state) +void mc_post_notification_indicator(list_item_data_t * it_data, + player_state_e state) { startfunc; MP_CHECK(it_data); struct app_data *ad = it_data->ad; int ret = NOTIFICATION_ERROR_NONE; - notification_image_type_e img_type = NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR; + notification_image_type_e img_type = + NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR; char *path = app_get_shared_resource_path(); //DEBUG_TRACE("Shared Resource Path is %s", path); - char icon_path[1024] = {0}; + char icon_path[1024] = { 0 }; if (state == PLAYER_STATE_PLAYING || state == PLAYER_STATE_IDLE) { - snprintf(icon_path, 1024, "%sshared_images/T02_control_circle_icon_play.png", path); + snprintf(icon_path, 1024, + "%sshared_images/T02_control_circle_icon_play.png", path); } else { - snprintf(icon_path, 1024, "%sshared_images/T02_control_circle_icon_pause.png", path); + snprintf(icon_path, 1024, + "%sshared_images/T02_control_circle_icon_pause.png", + path); } free(path); @@ -154,7 +164,8 @@ void mc_post_notification_indicator(list_item_data_t *it_data, player_state_e st endfunc; } -static Evas_Object *_gl_content_get(void *data, Evas_Object *obj, const char *part) +static Evas_Object *_gl_content_get(void *data, Evas_Object * obj, + const char *part) { char *thumbpath = NULL; char *prev_uri = NULL; @@ -173,11 +184,15 @@ static Evas_Object *_gl_content_get(void *data, Evas_Object *obj, const char *pa it_data->checkbox_cb = EINA_FALSE; if (previous_item_data) { - mp_media_info_get_file_path((mp_media_info_h)(previous_item_data->media), &prev_uri); + mp_media_info_get_file_path((mp_media_info_h) + (previous_item_data->media), + &prev_uri); } if (previous_item_data && (g_strcmp0(prev_uri, cur_uri) != 0)) { - prev_part_content = elm_object_item_part_content_get(previous_item_data->it, "elm.swallow.icon"); + prev_part_content = + elm_object_item_part_content_get(previous_item_data->it, + "elm.swallow.icon"); DEBUG_TRACE("Previous URI: %s", prev_uri); if (prev_part_content) { elm_object_signal_emit(prev_part_content, "show_default", "*"); @@ -185,13 +200,17 @@ static Evas_Object *_gl_content_get(void *data, Evas_Object *obj, const char *pa } if (cur_item_data) { - mp_media_info_get_file_path((mp_media_info_h)(cur_item_data->media), &cur_uri); + mp_media_info_get_file_path((mp_media_info_h) + (cur_item_data->media), &cur_uri); DEBUG_TRACE("Current URI is: %s", cur_uri); - part_content = elm_object_item_part_content_get(cur_item_data->it, "elm.swallow.icon"); + part_content = + elm_object_item_part_content_get(cur_item_data->it, + "elm.swallow.icon"); player_state_e state = mc_pre_play_get_player_state(); if (part_content) { - if (state == PLAYER_STATE_PLAYING || state == PLAYER_STATE_IDLE) { + if (state == PLAYER_STATE_PLAYING + || state == PLAYER_STATE_IDLE) { elm_object_signal_emit(part_content, "show_play", "*"); } else { elm_object_signal_emit(part_content, "show_pause", "*"); @@ -207,25 +226,29 @@ static Evas_Object *_gl_content_get(void *data, Evas_Object *obj, const char *pa if (mc_check_image_valid(evas_object_evas_get(obj), thumbpath)) { elm_image_file_set(icon, thumbpath, NULL); } else { - char default_thumbnail[1024] = {0}; + char default_thumbnail[1024] = { 0 }; char *shared_path = app_get_shared_resource_path(); DEBUG_TRACE("Chooser Shared Path : %s", shared_path); - snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, "shared_images", DEFAULT_THUMBNAIL); + snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, + "shared_images", DEFAULT_THUMBNAIL); free(shared_path); elm_image_file_set(icon, default_thumbnail, NULL); } - elm_layout_theme_set(content, "layout", "list/B/type.1", "default"); + elm_layout_theme_set(content, "layout", "list/B/type.1", + "default"); elm_layout_content_set(content, "elm.swallow.content", icon); return content; } if ((!strcmp(part, "elm.swallow.end") && (it_data->ad->select_type == MC_SELECT_SINGLE_RINGTONE || it_data->ad->select_type == MC_SELECT_SINGLE))) { // swallow checkbox or radio button - if (it_data->ad->select_uri && it_data->ad->select_type == MC_SELECT_SINGLE_RINGTONE) { + if (it_data->ad->select_uri + && it_data->ad->select_type == MC_SELECT_SINGLE_RINGTONE) { char *filepath = NULL; mp_media_info_get_file_path(media, &filepath); - if (mc_check_file_exist(filepath) && !strcmp(it_data->ad->select_uri, filepath)) { + if (mc_check_file_exist(filepath) + && !strcmp(it_data->ad->select_uri, filepath)) { state_index = it_data->index; it_data->ad->select_uri = NULL; //elm_genlist_item_bring_in(it_data->it, ELM_GENLIST_ITEM_SCROLLTO_IN); @@ -234,11 +257,16 @@ static Evas_Object *_gl_content_get(void *data, Evas_Object *obj, const char *pa content = elm_radio_add(obj); elm_radio_state_value_set(content, it_data->index); elm_radio_group_add(content, g_radio_main); - evas_object_size_hint_weight_set(content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(content, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(content, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(content, EVAS_HINT_FILL, + EVAS_HINT_FILL); evas_object_propagate_events_set(content, EINA_TRUE); - } else if ((!strcmp(part, "elm.swallow.end") && (it_data->ad->select_type == MC_SELECT_MULTI))) { - track_list_data_t *ld = evas_object_data_get(obj, "track_list_data"); + } else + if ((!strcmp(part, "elm.swallow.end") + && (it_data->ad->select_type == MC_SELECT_MULTI))) { + track_list_data_t *ld = + evas_object_data_get(obj, "track_list_data"); MP_CHECK_NULL(ld); content = elm_check_add(obj); @@ -247,7 +275,8 @@ static Evas_Object *_gl_content_get(void *data, Evas_Object *obj, const char *pa evas_object_data_set(content, "track_list_data", ld); - evas_object_smart_callback_add(content, "changed", _check_changed_cb, it_data); + evas_object_smart_callback_add(content, "changed", + _check_changed_cb, it_data); evas_object_repeat_events_set(content, EINA_FALSE); evas_object_propagate_events_set(content, EINA_FALSE); } @@ -261,14 +290,19 @@ static Evas_Object *_gl_content_get(void *data, Evas_Object *obj, const char *pa player_state_e state = mc_pre_play_get_player_state(); if (state == PLAYER_STATE_PLAYING) { - elm_object_style_set(music_button, "music/ug_control_play"); + elm_object_style_set(music_button, + "music/ug_control_play"); } else if (state == PLAYER_STATE_PAUSED) { - elm_object_style_set(music_button, "music/ug_control_pause"); + elm_object_style_set(music_button, + "music/ug_control_pause"); } else { return NULL; } evas_object_propagate_events_set(music_button, EINA_FALSE); - elm_object_signal_callback_add(music_button, "mouse,clicked,1", "*", _mc_track_play_btn_cb, data); + elm_object_signal_callback_add(music_button, + "mouse,clicked,1", "*", + _mc_track_play_btn_cb, + data); return music_button; } @@ -282,14 +316,15 @@ char *mc_create_selectioninfo_text_with_count(int count) startfunc; char *name = NULL; if (count > 0) { - name = g_strdup_printf(GET_STR(STR_MP_SELECT_ITEMS), count); + name = g_strdup_printf(GET_STR(STR_MP_SELECT_ITEMS), count); } else { name = g_strdup_printf(GET_STR(MC_TEXT_SELECT)); } return name; } -static char *_gl_select_all_text_get(void *data, Evas_Object *obj, const char *part) +static char *_gl_select_all_text_get(void *data, Evas_Object * obj, + const char *part) { startfunc; if (!strcmp(part, "elm.text")) { @@ -299,7 +334,7 @@ static char *_gl_select_all_text_get(void *data, Evas_Object *obj, const char *p return NULL; } -static char *_gl_text_get(void *data, Evas_Object *obj, const char *part) +static char *_gl_text_get(void *data, Evas_Object * obj, const char *part) { char *title = NULL; char *cur_uri = NULL; @@ -317,7 +352,7 @@ static char *_gl_text_get(void *data, Evas_Object *obj, const char *part) int ret = 0; if ((!strcmp(part, "elm.text")) || (!strcmp(part, "elm.text.sub"))) { if (!strcmp(part, "elm.text")) { - ret = mp_media_info_get_title(media, &title); + ret = mp_media_info_get_title(media, &title); MP_CHECK_NULL(ret == 0); } else { ret = mp_media_info_get_artist(media, &title); @@ -325,7 +360,8 @@ static char *_gl_text_get(void *data, Evas_Object *obj, const char *part) } if (cur_item_data) { - mp_media_info_get_file_path((mp_media_info_h)(cur_item_data->media), &cur_uri); + mp_media_info_get_file_path((mp_media_info_h) + (cur_item_data->media), &cur_uri); if (cur_item_data && (g_strcmp0(cur_uri, uri) == 0)) { match = true; @@ -346,7 +382,8 @@ static char *_gl_text_get(void *data, Evas_Object *obj, const char *part) a = 255; memset(result, 0x00, DEF_STR_LEN + 1); snprintf(result, DEF_STR_LEN, - "%s", r, g, b, a, markup_title); + "%s", r, g, b, a, + markup_title); IF_FREE(markup_title); return g_strdup(result); @@ -358,31 +395,29 @@ static char *_gl_text_get(void *data, Evas_Object *obj, const char *part) return NULL; } -static void _gl_del(void *data, Evas_Object *obj) +static void _gl_del(void *data, Evas_Object * obj) { list_item_data_t *it_data = data; IF_FREE(it_data); } -static Eina_Bool -_destroy_timer_cb(void *data) +static Eina_Bool _destroy_timer_cb(void *data) { - track_list_data_t *ld = data; + track_list_data_t *ld = data; MP_CHECK_FALSE(ld); ld->destroy_timer = NULL; elm_exit(); return EINA_FALSE; } -static long long int -_get_total_size(void *data) +static long long int _get_total_size(void *data) { startfunc; long long int item_size = 0; struct stat mpFileInfo; char *path = NULL; - track_list_data_t *ld = data; + track_list_data_t *ld = data; Elm_Object_Item *item; MP_CHECK_VAL(ld, 0); MP_CHECK_VAL(ld->genlist, 0); @@ -406,13 +441,12 @@ _get_total_size(void *data) endfunc; } -static unsigned int -_get_media_list_count(void *data) +static unsigned int _get_media_list_count(void *data) { startfunc; unsigned int count = 0; - track_list_data_t *ld = data; + track_list_data_t *ld = data; Elm_Object_Item *item; MP_CHECK_VAL(ld, 0); MP_CHECK_VAL(ld->genlist, 0); @@ -438,13 +472,12 @@ _get_media_list_count(void *data) endfunc; } -unsigned int -_get_select_count(void *data)//(Evas_Object *genlist) +unsigned int _get_select_count(void *data) //(Evas_Object *genlist) { startfunc; unsigned int count = 0; - track_list_data_t *ld = data; + track_list_data_t *ld = data; Elm_Object_Item *item; MP_CHECK_VAL(ld, 0); MP_CHECK_VAL(ld->genlist, 0); @@ -466,11 +499,11 @@ _get_select_count(void *data)//(Evas_Object *genlist) return count; } -static Elm_Object_Item *_get_select_radio(void *data) +static Elm_Object_Item *_get_select_radio(void *data) { startfunc; - track_list_data_t *ld = data; + track_list_data_t *ld = data; Elm_Object_Item *item = NULL; item = elm_genlist_first_item_get(ld->genlist); @@ -492,10 +525,10 @@ static Elm_Object_Item *_get_select_radio(void *data) } -static void _gl_sel_cb(void *data, Evas_Object *obj, void *event_info) +static void _gl_sel_cb(void *data, Evas_Object * obj, void *event_info) { startfunc; - track_list_data_t *ld = data; + track_list_data_t *ld = data; static long long int item_size = 0; struct stat mpFileInfo; char *path = NULL; @@ -523,11 +556,12 @@ static void _gl_sel_cb(void *data, Evas_Object *obj, void *event_info) stat(path, &mpFileInfo); if (it_data->ad->select_type == MC_SELECT_SINGLE_RINGTONE) { - mc_pre_play_control_play_no_pause_music_item((void*)it_data); + mc_pre_play_control_play_no_pause_music_item((void *) it_data); g_position = 0; if (item) { index = it_data->index; - Evas_Object *radio = elm_object_item_part_content_get(item, "elm.swallow.end"); + Evas_Object *radio = + elm_object_item_part_content_get(item, "elm.swallow.end"); MP_CHECK(radio); state_index = index; @@ -561,7 +595,7 @@ static void _gl_sel_cb(void *data, Evas_Object *obj, void *event_info) } if (ld->ad->select_type == MC_SELECT_MULTI && !it_data->checkbox_cb) { - /*Launching Sound Manager on clicking a song*/ + /*Launching Sound Manager on clicking a song */ app_control_h app_control; int ret = APP_CONTROL_ERROR_NONE; ret = app_control_create(&app_control); @@ -575,14 +609,17 @@ static void _gl_sel_cb(void *data, Evas_Object *obj, void *event_info) return; } app_control_set_mime(app_control, "audio/*"); - ret = app_control_set_operation(app_control, APP_CONTROL_OPERATION_VIEW); + ret = + app_control_set_operation(app_control, + APP_CONTROL_OPERATION_VIEW); if (ret != APP_CONTROL_ERROR_NONE) { DEBUG_TRACE("app_control_set_operation()... [0x%x]", ret); return; } ret = app_control_send_launch_request(app_control, NULL, NULL); if (ret == APP_CONTROL_ERROR_APP_NOT_FOUND) { - ERROR_TRACE("Cannot launch sound-player. Application not found."); + ERROR_TRACE + ("Cannot launch sound-player. Application not found."); } else if (ret != APP_CONTROL_ERROR_NONE) { DEBUG_TRACE("app_control_send_launch_request()... [0x%x]"); } @@ -591,9 +628,13 @@ static void _gl_sel_cb(void *data, Evas_Object *obj, void *event_info) } } - elm_genlist_item_fields_update(event_info, "elm.swallow.end", ELM_GENLIST_ITEM_FIELD_CONTENT); + elm_genlist_item_fields_update(event_info, "elm.swallow.end", + ELM_GENLIST_ITEM_FIELD_CONTENT); - if ((ld->ad->select_type == MC_SELECT_MULTI) && ((ld->ad->limitsize > 0) && (item_size + mpFileInfo.st_size > ld->ad->limitsize)) && it_data->checked) { + if ((ld->ad->select_type == MC_SELECT_MULTI) + && ((ld->ad->limitsize > 0) + && (item_size + mpFileInfo.st_size > ld->ad->limitsize)) + && it_data->checked) { WARN_TRACE("Exceeded max size by caller"); size_exceeded = true; it_data->checked = !it_data->checked; @@ -602,18 +643,27 @@ static void _gl_sel_cb(void *data, Evas_Object *obj, void *event_info) IF_FREE(name); } - if ((ld->ad->select_type == MC_SELECT_MULTI) && ((ld->ad->max_count > 0) && _get_select_count(ld) > ld->ad->max_count)) { + if ((ld->ad->select_type == MC_SELECT_MULTI) + && ((ld->ad->max_count > 0) + && _get_select_count(ld) > ld->ad->max_count)) { WARN_TRACE("Exceeded max count by caller"); it_data->checked = !it_data->checked; - char *name = g_strdup_printf(GET_STR(STR_MC_MAX_COUNT_EXCEEDED), ld->ad->max_count); + char *name = + g_strdup_printf(GET_STR(STR_MC_MAX_COUNT_EXCEEDED), + ld->ad->max_count); mc_post_status_message(name); IF_FREE(name); } - mc_common_obj_domain_text_translate(ld->ad->navi_bar, mc_create_selectioninfo_text_with_count(_get_select_count(ld))); + mc_common_obj_domain_text_translate(ld->ad->navi_bar, + mc_create_selectioninfo_text_with_count + (_get_select_count(ld))); if (ld->ad->select_type == MC_SELECT_MULTI) { - Elm_Object_Item *selected_item = elm_genlist_first_item_get(ld->genlist); - Evas_Object *check = elm_object_item_part_content_get(selected_item, "elm.swallow.end"); + Elm_Object_Item *selected_item = + elm_genlist_first_item_get(ld->genlist); + Evas_Object *check = + elm_object_item_part_content_get(selected_item, + "elm.swallow.end"); if (!size_exceeded) { if (it_data->checked) { item_size = item_size + mpFileInfo.st_size; @@ -649,7 +699,8 @@ void mc_track_list_set_uri_selected(void *thiz, const char *uri) MP_CHECK(ad); MP_CHECK(ad->track_list); - track_list_data_t *ld = evas_object_data_get(ad->track_list, "list_data"); + track_list_data_t *ld = + evas_object_data_get(ad->track_list, "list_data"); MP_CHECK(ld); Elm_Object_Item *item; @@ -666,7 +717,8 @@ void mc_track_list_set_uri_selected(void *thiz, const char *uri) mp_media_info_get_file_path(media, &path); if (!strcmp(path, uri)) { - elm_genlist_item_bring_in(it_data->it, ELM_GENLIST_ITEM_SCROLLTO_TOP); + elm_genlist_item_bring_in(it_data->it, + ELM_GENLIST_ITEM_SCROLLTO_TOP); elm_radio_value_set(g_radio_main, it_data->index); elm_genlist_item_selected_set(item, EINA_TRUE); @@ -683,7 +735,7 @@ _layout_del_cb(void *data, Evas * e, Evas_Object * obj, void *event_info) pre_item_data = NULL; cur_item_data = NULL; - track_list_data_t *ld = data; + track_list_data_t *ld = data; MP_CHECK(ld); IF_G_FREE(ld->type_str); @@ -692,15 +744,15 @@ _layout_del_cb(void *data, Evas * e, Evas_Object * obj, void *event_info) mc_pre_play_control_clear_pre_item_data(); } -static void -_cancel_cb(void *data, Evas_Object *obj, void *event_info) +static void _cancel_cb(void *data, Evas_Object * obj, void *event_info) { - track_list_data_t *ld = (track_list_data_t *)data; + track_list_data_t *ld = (track_list_data_t *) data; MP_CHECK(ld); app_control_h service = NULL; app_control_create(&service); - app_control_reply_to_launch_request(service, ld->ad->service, APP_CONTROL_RESULT_SUCCEEDED); + app_control_reply_to_launch_request(service, ld->ad->service, + APP_CONTROL_RESULT_SUCCEEDED); if (ld->t_type == MP_TRACK_ALL) { mp_ecore_timer_del(ld->destroy_timer); ld->destroy_timer = ecore_timer_add(0.1, _destroy_timer_cb, ld); @@ -712,10 +764,9 @@ _cancel_cb(void *data, Evas_Object *obj, void *event_info) ld->destroy_timer = ecore_timer_add(0.1, _destroy_timer_cb, ld); } -static void -_set_cb(void *data, Evas_Object *obj, void *event_info) +static void _set_cb(void *data, Evas_Object * obj, void *event_info) { - track_list_data_t *ld = (track_list_data_t *)data; + track_list_data_t *ld = (track_list_data_t *) data; MP_CHECK(ld); char *fmt = ";%s"; @@ -764,10 +815,11 @@ _set_cb(void *data, Evas_Object *obj, void *event_info) app_control_h service = NULL; app_control_create(&service); app_control_add_extra_data_array(service, APP_CONTROL_DATA_PATH, - (const char **)path_array, - count); - app_control_add_extra_data_array(service, APP_CONTROL_DATA_SELECTED, (const char **)path_array, count); - app_control_reply_to_launch_request(service, ld->ad->service, APP_CONTROL_RESULT_SUCCEEDED); + (const char **) path_array, count); + app_control_add_extra_data_array(service, APP_CONTROL_DATA_SELECTED, + (const char **) path_array, count); + app_control_reply_to_launch_request(service, ld->ad->service, + APP_CONTROL_RESULT_SUCCEEDED); mp_ecore_timer_del(ld->destroy_timer); ld->destroy_timer = ecore_timer_add(0.1, _destroy_timer_cb, ld); @@ -785,15 +837,14 @@ _set_cb(void *data, Evas_Object *obj, void *event_info) void _mc_popup_view(void *data) { startfunc; - track_list_data_t *ld = data; + track_list_data_t *ld = data; MP_CHECK(ld); MP_CHECK(ld->win_navi_it); elm_object_item_del(ld->win_navi_it); ld->win_navi_it = NULL; } -static void -_done_cb(void *data, Evas_Object *obj, void *event_info) +static void _done_cb(void *data, Evas_Object * obj, void *event_info) { startfunc; char *fmt = ";%s"; @@ -847,17 +898,16 @@ _done_cb(void *data, Evas_Object *obj, void *event_info) app_control_h service = NULL; app_control_create(&service); app_control_add_extra_data_array(service, APP_CONTROL_DATA_PATH, - (const char **)path_array, - count); + (const char **) path_array, + count); app_control_add_extra_data_array(service, - APP_CONTROL_DATA_SELECTED, - (const char **)path_array, - count); + APP_CONTROL_DATA_SELECTED, + (const char **) path_array, + count); app_control_reply_to_launch_request(service, ld->ad->service, - APP_CONTROL_RESULT_SUCCEEDED); - ld->destroy_timer = ecore_timer_add(0.1, _destroy_timer_cb, - ld); + APP_CONTROL_RESULT_SUCCEEDED); + ld->destroy_timer = ecore_timer_add(0.1, _destroy_timer_cb, ld); app_control_destroy(service); } @@ -866,20 +916,24 @@ _done_cb(void *data, Evas_Object *obj, void *event_info) g_string_free(path, TRUE); } -void _mc_track_list_select_all_selected_item_data_get(void *data, Evas_Object *obj, void *event_info) +void _mc_track_list_select_all_selected_item_data_get(void *data, + Evas_Object * obj, + void *event_info) { - track_list_data_t *ld = data; + track_list_data_t *ld = data; Elm_Object_Item *item = NULL; MP_CHECK(ld); Eina_Bool all_selected = EINA_FALSE; item = elm_genlist_first_item_get(ld->genlist); - Evas_Object *check = elm_object_item_part_content_get(item, "elm.swallow.end"); + Evas_Object *check = + elm_object_item_part_content_get(item, "elm.swallow.end"); Eina_Bool state = elm_check_state_get(check); all_selected = state; - if ((ld->ad->limitsize > 0) && (_get_total_size(ld) > ld->ad->limitsize)) { + if ((ld->ad->limitsize > 0) + && (_get_total_size(ld) > ld->ad->limitsize)) { DEBUG_TRACE("total size: %lld", _get_total_size(ld)); elm_check_state_set(check, !state); char *name = g_strdup(GET_STR(STR_MC_MAX_SIZE_EXCEEDED)); @@ -889,9 +943,12 @@ void _mc_track_list_select_all_selected_item_data_get(void *data, Evas_Object *o return; } - if ((ld->ad->max_count > 0) && (_get_media_list_count(ld) > ld->ad->max_count)) { + if ((ld->ad->max_count > 0) + && (_get_media_list_count(ld) > ld->ad->max_count)) { elm_check_state_set(check, !state); - char *name = g_strdup_printf(GET_STR(STR_MC_MAX_COUNT_EXCEEDED), ld->ad->max_count); + char *name = + g_strdup_printf(GET_STR(STR_MC_MAX_COUNT_EXCEEDED), + ld->ad->max_count); mc_post_status_message(name); IF_FREE(name); WARN_TRACE("Exceeded max count by caller"); @@ -906,14 +963,17 @@ void _mc_track_list_select_all_selected_item_data_get(void *data, Evas_Object *o continue; } it_data->checked = all_selected; - Evas_Object *chk = elm_object_item_part_content_get(item, "elm.swallow.end"); + Evas_Object *chk = + elm_object_item_part_content_get(item, "elm.swallow.end"); if (chk) { elm_check_state_set(chk, all_selected); } item = elm_genlist_item_next_get(item); } - mc_common_obj_domain_text_translate(ld->ad->navi_bar, mc_create_selectioninfo_text_with_count(_get_select_count(ld))); + mc_common_obj_domain_text_translate(ld->ad->navi_bar, + mc_create_selectioninfo_text_with_count + (_get_select_count(ld))); if (ld->btn_done) { if (_get_select_count(ld) && all_selected) { @@ -924,39 +984,43 @@ void _mc_track_list_select_all_selected_item_data_get(void *data, Evas_Object *o } } -void _mc_track_list_select_cb(void *data, Evas_Object *obj, void *event_info) +void _mc_track_list_select_cb(void *data, Evas_Object * obj, + void *event_info) { startfunc; - track_list_data_t *ld = data; + track_list_data_t *ld = data; Elm_Object_Item *item = NULL; MP_CHECK(ld); elm_genlist_item_selected_set(event_info, EINA_FALSE); item = elm_genlist_first_item_get(ld->genlist); - Evas_Object *check = elm_object_item_part_content_get(item, "elm.swallow.end"); + Evas_Object *check = + elm_object_item_part_content_get(item, "elm.swallow.end"); Eina_Bool state = elm_check_state_get(check); if (ld->ad->max_count <= 0) { elm_check_state_set(check, !state); } - _mc_track_list_select_all_selected_item_data_get(data, obj, event_info); + _mc_track_list_select_all_selected_item_data_get(data, obj, + event_info); endfunc; } -Evas_Object *mc_track_list_create(Evas_Object *parent, struct app_data *ad) +Evas_Object *mc_track_list_create(Evas_Object * parent, + struct app_data *ad) { startfunc; - Evas_Object *layout ; + Evas_Object *layout; track_list_data_t *ld = NULL; MP_CHECK_NULL(parent); MP_CHECK_NULL(ad); - char mc_edj_path[1024] = {0}; + char mc_edj_path[1024] = { 0 }; char *path = app_get_resource_path(); MP_CHECK_NULL(path); snprintf(mc_edj_path, 1024, "%s%s", path, MC_EDJ_FILE); @@ -976,13 +1040,15 @@ Evas_Object *mc_track_list_create(Evas_Object *parent, struct app_data *ad) ld->single = true; } - Evas_Object *done_btn = elm_object_item_part_content_unset(ld->win_navi_it, "toolbar"); + Evas_Object *done_btn = + elm_object_item_part_content_unset(ld->win_navi_it, "toolbar"); if (done_btn) { evas_object_del(done_btn); } evas_object_data_set(layout, "list_data", ld); - evas_object_event_callback_add(layout, EVAS_CALLBACK_FREE, _layout_del_cb, ld); + evas_object_event_callback_add(layout, EVAS_CALLBACK_FREE, + _layout_del_cb, ld); ld->itc.item_style = "type1"; ld->itc.func.content_get = _gl_content_get; @@ -997,44 +1063,53 @@ Evas_Object *mc_track_list_create(Evas_Object *parent, struct app_data *ad) return layout; } -static void -_clear_cb(void *data, Evas_Object *obj, void *event_info) +static void _clear_cb(void *data, Evas_Object * obj, void *event_info) { startfunc; Evas_Object *sub_view = data; evas_object_del(sub_view); } -int mc_track_list_update(Evas_Object *list, Elm_Object_Item *navi_it, Evas_Object *sub_view) +int mc_track_list_update(Evas_Object * list, Elm_Object_Item * navi_it, + Evas_Object * sub_view) { startfunc; Evas_Object *content; int count = 0; - track_list_data_t *ld = GET_LIST_DATA(list); + track_list_data_t *ld = GET_LIST_DATA(list); MP_CHECK_VAL(ld, -1); - struct app_data *ad = ld->ad; + struct app_data *ad = ld->ad; MP_CHECK_VAL(ad, -1); ld->win_navi_it = navi_it; if (ld->win_navi_it && ad->navi_bar) { DEBUG_TRACE("In cancel button"); - ld->btn_cancel = mc_widget_create_navi_left_btn(ad->navi_bar, ld->win_navi_it, _cancel_cb, ld); + ld->btn_cancel = + mc_widget_create_navi_left_btn(ad->navi_bar, ld->win_navi_it, + _cancel_cb, ld); } if (ad->select_type == MC_SELECT_MULTI) { if (ld->win_navi_it && ad->navi_bar) { - ld->btn_done = mc_widget_create_navi_right_btn(ad->navi_bar, ld->win_navi_it, _done_cb, ld); + ld->btn_done = + mc_widget_create_navi_right_btn(ad->navi_bar, + ld->win_navi_it, _done_cb, + ld); } - } else if (ld->ad->select_type == MC_SELECT_SINGLE_RINGTONE || ld->ad->select_type == MC_SELECT_SINGLE) { + } else if (ld->ad->select_type == MC_SELECT_SINGLE_RINGTONE + || ld->ad->select_type == MC_SELECT_SINGLE) { if (ld->win_navi_it && ad->navi_bar) { - ld->btn_set = mc_widget_create_navi_right_btn(ad->navi_bar, ld->win_navi_it, _set_cb, ld); + ld->btn_set = + mc_widget_create_navi_right_btn(ad->navi_bar, + ld->win_navi_it, _set_cb, + ld); elm_object_disabled_set(ld->btn_set, EINA_TRUE); } - /*reset back button callback*/ - /* elm_naviframe_item_pop_cb_set(navi_it, _back_cb, ld);*/ + /*reset back button callback */ + /* elm_naviframe_item_pop_cb_set(navi_it, _back_cb, ld); */ } if (ld->track_list) { @@ -1045,19 +1120,27 @@ int mc_track_list_update(Evas_Object *list, Elm_Object_Item *navi_it, Evas_Objec content = elm_layout_content_get(list, "list_content"); evas_object_del(content); - mp_media_info_list_count(ld->t_type, ld->type_str, NULL, NULL, ld->playlist_id, &count); - mc_common_obj_domain_text_translate(ld->ad->navi_bar, mc_create_selectioninfo_text_with_count(0)); + mp_media_info_list_count(ld->t_type, ld->type_str, NULL, NULL, + ld->playlist_id, &count); + mc_common_obj_domain_text_translate(ld->ad->navi_bar, + mc_create_selectioninfo_text_with_count + (0)); if (count) { ld->genlist = content = _mc_create_genlist(list); evas_object_data_set(content, "track_list_data", ld); - mp_media_info_list_create(&ld->track_list, ld->t_type, ld->type_str, NULL, NULL, ld->playlist_id, 0, count); + mp_media_info_list_create(&ld->track_list, ld->t_type, + ld->type_str, NULL, NULL, + ld->playlist_id, 0, count); if (ld->ad->select_type == MC_SELECT_MULTI) { - elm_genlist_item_append(content, &ld->itc_select_all, ld, NULL, ELM_GENLIST_ITEM_NONE, _mc_track_list_select_cb, ld); + elm_genlist_item_append(content, &ld->itc_select_all, ld, NULL, + ELM_GENLIST_ITEM_NONE, + _mc_track_list_select_cb, ld); } int i = 0; for (i = 0; i < count; i++) { - mp_media_info_h media = mp_media_info_list_nth_item(ld->track_list, i); + mp_media_info_h media = + mp_media_info_list_nth_item(ld->track_list, i); list_item_data_t *data = calloc(1, sizeof(list_item_data_t)); if (data) { data->media = media; @@ -1073,7 +1156,10 @@ int mc_track_list_update(Evas_Object *list, Elm_Object_Item *navi_it, Evas_Objec data->list_type = MC_FOLDER_TRACK; } - data->it = elm_genlist_item_append(content, &ld->itc, data, NULL, ELM_GENLIST_ITEM_NONE, _gl_sel_cb, ld); + data->it = + elm_genlist_item_append(content, &ld->itc, data, NULL, + ELM_GENLIST_ITEM_NONE, + _gl_sel_cb, ld); elm_object_item_data_set(data->it, data); } } @@ -1082,7 +1168,7 @@ int mc_track_list_update(Evas_Object *list, Elm_Object_Item *navi_it, Evas_Objec } elm_layout_content_set(list, "list_content", content); - /*add index*/ + /*add index */ if (count > 0) { if (ld->ad->select_type == MC_SELECT_MULTI) { @@ -1096,16 +1182,18 @@ int mc_track_list_update(Evas_Object *list, Elm_Object_Item *navi_it, Evas_Objec } if (sub_view != NULL) { - evas_object_smart_callback_add(ld->genlist, "realized", _clear_cb, sub_view); + evas_object_smart_callback_add(ld->genlist, "realized", _clear_cb, + sub_view); } return 0; } -int mc_track_list_set_data(Evas_Object *list, int track_type, const char *type_str, int playlist_id) +int mc_track_list_set_data(Evas_Object * list, int track_type, + const char *type_str, int playlist_id) { startfunc; - track_list_data_t *ld = GET_LIST_DATA(list); + track_list_data_t *ld = GET_LIST_DATA(list); MP_CHECK_VAL(ld, -1); ld->t_type = track_type; @@ -1124,4 +1212,3 @@ int mc_track_list_get_radio() return index; } - diff --git a/music-chooser/src/mc-voice-clip-list.c b/music-chooser/src/mc-voice-clip-list.c index f3a1803..fc6a6fc 100644 --- a/music-chooser/src/mc-voice-clip-list.c +++ b/music-chooser/src/mc-voice-clip-list.c @@ -32,8 +32,7 @@ typedef struct { #define GET_LIST_DATA(obj) evas_object_data_get(obj, "list_data") -static Evas_Object * -_mc_create_genlist(Evas_Object *parent) +static Evas_Object *_mc_create_genlist(Evas_Object * parent) { Evas_Object *genlist = NULL; MP_CHECK_NULL(parent); @@ -44,7 +43,7 @@ _mc_create_genlist(Evas_Object *parent) return genlist; } -static char *_gl_text_get(void *data, Evas_Object *obj, const char *part) +static char *_gl_text_get(void *data, Evas_Object * obj, const char *part) { char *text = NULL; @@ -57,20 +56,19 @@ static char *_gl_text_get(void *data, Evas_Object *obj, const char *part) return NULL; } -static Eina_Bool -_destory_timer_cb(void *data) +static Eina_Bool _destory_timer_cb(void *data) { - voice_clip_list_data_t *ld = data; + voice_clip_list_data_t *ld = data; MP_CHECK_FALSE(ld); ld->destroy_timer = NULL; elm_exit(); return EINA_FALSE; } -static void _gl_sel_cb(void *data, Evas_Object *obj, void *event_info) +static void _gl_sel_cb(void *data, Evas_Object * obj, void *event_info) { startfunc; - voice_clip_list_data_t *ld = data; + voice_clip_list_data_t *ld = data; char *path = NULL; elm_genlist_item_selected_set(event_info, EINA_FALSE); @@ -86,7 +84,8 @@ static void _gl_sel_cb(void *data, Evas_Object *obj, void *event_info) app_control_create(&service); app_control_add_extra_data(service, APP_CONTROL_DATA_PATH, path); - app_control_reply_to_launch_request(service, ld->ad->service, APP_CONTROL_RESULT_SUCCEEDED); + app_control_reply_to_launch_request(service, ld->ad->service, + APP_CONTROL_RESULT_SUCCEEDED); ld->destroy_timer = ecore_timer_add(0.1, _destory_timer_cb, ld); @@ -97,16 +96,17 @@ static void _layout_del_cb(void *data, Evas * e, Evas_Object * obj, void *event_info) { startfunc; - voice_clip_list_data_t *ld = data; + voice_clip_list_data_t *ld = data; MP_CHECK(ld); free(ld); } -Evas_Object *mc_voice_clip_list_create(Evas_Object *parent, struct app_data *ad) +Evas_Object *mc_voice_clip_list_create(Evas_Object * parent, + struct app_data *ad) { startfunc; - Evas_Object *layout ; + Evas_Object *layout; voice_clip_list_data_t *ld = NULL; MP_CHECK_NULL(parent); @@ -122,7 +122,8 @@ Evas_Object *mc_voice_clip_list_create(Evas_Object *parent, struct app_data *ad) ld->ad = ad; evas_object_data_set(layout, "list_data", ld); - evas_object_event_callback_add(layout, EVAS_CALLBACK_FREE, _layout_del_cb, ld); + evas_object_event_callback_add(layout, EVAS_CALLBACK_FREE, + _layout_del_cb, ld); ld->itc.func.content_get = NULL; ld->itc.item_style = "1text"; @@ -131,13 +132,13 @@ Evas_Object *mc_voice_clip_list_create(Evas_Object *parent, struct app_data *ad) return layout; } -int mc_voice_clip_list_update(Evas_Object *list) +int mc_voice_clip_list_update(Evas_Object * list) { startfunc; Evas_Object *content; int count = 0; - voice_clip_list_data_t *ld = GET_LIST_DATA(list); + voice_clip_list_data_t *ld = GET_LIST_DATA(list); MP_CHECK_VAL(ld, -1); if (ld->voice_clip_list) { @@ -148,14 +149,19 @@ int mc_voice_clip_list_update(Evas_Object *list) content = elm_layout_content_get(list, "elm.swallow.content"); evas_object_del(content); - mp_media_info_list_count(MP_TRACK_BY_VOICE_CLIP, NULL, NULL, NULL, 0, &count); + mp_media_info_list_count(MP_TRACK_BY_VOICE_CLIP, NULL, NULL, NULL, 0, + &count); if (count) { content = _mc_create_genlist(list); - mp_media_info_list_create(&ld->voice_clip_list, MP_TRACK_BY_VOICE_CLIP, NULL, NULL, NULL, 0, 0, count); + mp_media_info_list_create(&ld->voice_clip_list, + MP_TRACK_BY_VOICE_CLIP, NULL, NULL, NULL, + 0, 0, count); int i = 0; for (i = 0; i < count; i++) { - mp_media_info_h media = mp_media_info_list_nth_item(ld->voice_clip_list, i); - elm_genlist_item_append(content, &ld->itc, media, NULL, ELM_GENLIST_ITEM_NONE, _gl_sel_cb, ld); + mp_media_info_h media = + mp_media_info_list_nth_item(ld->voice_clip_list, i); + elm_genlist_item_append(content, &ld->itc, media, NULL, + ELM_GENLIST_ITEM_NONE, _gl_sel_cb, ld); } } else { content = mc_widget_no_content_add(list, NO_CONTENT_SONG); @@ -165,5 +171,3 @@ int mc_voice_clip_list_update(Evas_Object *list) return 0; } - - diff --git a/music-chooser/src/mc-widget.c b/music-chooser/src/mc-widget.c index 4571295..a208cde 100644 --- a/music-chooser/src/mc-widget.c +++ b/music-chooser/src/mc-widget.c @@ -18,8 +18,8 @@ #include "music-chooser.h" #include "mc-common.h" -Evas_Object * -mc_widget_no_content_add(Evas_Object *parent, NoContentType_e type) +Evas_Object *mc_widget_no_content_add(Evas_Object * parent, + NoContentType_e type) { MP_CHECK_NULL(parent); Evas_Object *nocontents = NULL; @@ -28,8 +28,9 @@ mc_widget_no_content_add(Evas_Object *parent, NoContentType_e type) Evas_Object *icon = elm_image_add(nocontents); char *shared_path = app_get_shared_resource_path(); - char nocontent_mm[1024] = {0}; - snprintf(nocontent_mm, 1024, "%s%s/%s", shared_path, "shared_images", NOCONTENT_MULTIMEDIA); + char nocontent_mm[1024] = { 0 }; + snprintf(nocontent_mm, 1024, "%s%s/%s", shared_path, "shared_images", + NOCONTENT_MULTIMEDIA); free(shared_path); elm_image_file_set(icon, nocontent_mm, NULL); elm_object_part_content_set(nocontents, "nocontents.image", icon); @@ -52,15 +53,13 @@ mc_widget_no_content_add(Evas_Object *parent, NoContentType_e type) return nocontents; } -static void -_mc_win_del(void *data, Evas_Object * obj, void *event) +static void _mc_win_del(void *data, Evas_Object * obj, void *event) { elm_exit(); } -Evas_Object * -mc_create_win(const char *name) +Evas_Object *mc_create_win(const char *name) { Evas_Object *eo; int w, h; @@ -68,7 +67,8 @@ mc_create_win(const char *name) eo = elm_win_add(NULL, name, ELM_WIN_BASIC); if (eo) { elm_win_title_set(eo, name); - evas_object_smart_callback_add(eo, "delete,request", _mc_win_del, NULL); + evas_object_smart_callback_add(eo, "delete,request", _mc_win_del, + NULL); elm_win_screen_size_get(eo, NULL, NULL, &w, &h); evas_object_resize(eo, w, h); //set indicator as transparent @@ -79,7 +79,11 @@ mc_create_win(const char *name) return eo; } -Evas_Object *mc_widget_create_title_icon_btn(Evas_Object *parent, const char *file, const char *group, Evas_Smart_Cb func, void *data) +Evas_Object *mc_widget_create_title_icon_btn(Evas_Object * parent, + const char *file, + const char *group, + Evas_Smart_Cb func, + void *data) { Evas_Object *ic; Evas_Object *btn = elm_button_add(parent); @@ -99,9 +103,10 @@ Evas_Object *mc_widget_create_title_icon_btn(Evas_Object *parent, const char *fi return btn; } -Evas_Object *mc_widget_create_naviframe_toolbar(Elm_Object_Item *navi_it) +Evas_Object *mc_widget_create_naviframe_toolbar(Elm_Object_Item * navi_it) { - Evas_Object *toolbar = elm_object_item_part_content_unset(navi_it, "toolbar"); + Evas_Object *toolbar = + elm_object_item_part_content_unset(navi_it, "toolbar"); if (toolbar) { evas_object_del(toolbar); toolbar = NULL; @@ -118,7 +123,11 @@ Evas_Object *mc_widget_create_naviframe_toolbar(Elm_Object_Item *navi_it) return toolbar; } -Elm_Object_Item *mc_widget_create_toolbar_item_btn(Evas_Object *parent, const char *style, const char *text, Evas_Smart_Cb func, void *data) +Elm_Object_Item *mc_widget_create_toolbar_item_btn(Evas_Object * parent, + const char *style, + const char *text, + Evas_Smart_Cb func, + void *data) { Evas_Object *toolbar = parent; MP_CHECK_NULL(toolbar); @@ -126,10 +135,12 @@ Elm_Object_Item *mc_widget_create_toolbar_item_btn(Evas_Object *parent, const ch Elm_Object_Item *toolbar_item = NULL; //Evas_Object *toolbar_obj_item = NULL; - toolbar_item = elm_toolbar_item_append(toolbar, NULL, text, func, data); + toolbar_item = + elm_toolbar_item_append(toolbar, NULL, text, func, data); //toolbar_obj_item = elm_toolbar_item_object_get(toolbar_item); return toolbar_item; } + static inline const char *_mc_get_text_domain(const char *string_id) { const char *domain = DOMAIN_NAME; @@ -137,8 +148,10 @@ static inline const char *_mc_get_text_domain(const char *string_id) return domain; } -Evas_Object* mc_widget_create_navi_left_btn(Evas_Object *pParent, Elm_Object_Item *pNaviItem, - Evas_Smart_Cb pFunc, void *pUserData) +Evas_Object *mc_widget_create_navi_left_btn(Evas_Object * pParent, + Elm_Object_Item * pNaviItem, + Evas_Smart_Cb pFunc, + void *pUserData) { if (!pParent || !pNaviItem) { @@ -150,22 +163,26 @@ Evas_Object* mc_widget_create_navi_left_btn(Evas_Object *pParent, Elm_Object_Ite elm_object_style_set(pLeftbtn, "naviframe/title_left"); evas_object_smart_callback_add(pLeftbtn, "clicked", pFunc, pUserData); const char *domain = _mc_get_text_domain(STR_MP_NAVI_CANCEL); - elm_object_domain_translatable_text_set(pLeftbtn, domain, STR_MP_NAVI_CANCEL); + elm_object_domain_translatable_text_set(pLeftbtn, domain, + STR_MP_NAVI_CANCEL); if (!pLeftbtn) { ERROR_TRACE("[ERR] Fail to create pLeftbtn"); return NULL; } - elm_object_item_part_content_set(pNaviItem, "title_left_btn", pLeftbtn); + elm_object_item_part_content_set(pNaviItem, "title_left_btn", + pLeftbtn); evas_object_show(pLeftbtn); return pLeftbtn; } -Evas_Object* mc_widget_create_navi_right_btn(Evas_Object *pParent, Elm_Object_Item *pNaviItem, - Evas_Smart_Cb pFunc, void *pUserData) +Evas_Object *mc_widget_create_navi_right_btn(Evas_Object * pParent, + Elm_Object_Item * pNaviItem, + Evas_Smart_Cb pFunc, + void *pUserData) { if (!pParent || !pNaviItem) { @@ -179,18 +196,19 @@ Evas_Object* mc_widget_create_navi_right_btn(Evas_Object *pParent, Elm_Object_It elm_object_style_set(pRightbtn, "naviframe/title_right"); evas_object_smart_callback_add(pRightbtn, "clicked", pFunc, pUserData); const char *domain = _mc_get_text_domain(STR_MP_NAVI_DONE); - elm_object_domain_translatable_text_set(pRightbtn, domain, STR_MP_NAVI_DONE); + elm_object_domain_translatable_text_set(pRightbtn, domain, + STR_MP_NAVI_DONE); if (!pRightbtn) { ERROR_TRACE("[ERR] Fail to create pRightbtn"); return NULL; } - elm_object_item_part_content_set(pNaviItem, "title_right_btn", pRightbtn); + elm_object_item_part_content_set(pNaviItem, "title_right_btn", + pRightbtn); elm_object_disabled_set(pRightbtn, EINA_TRUE); evas_object_show(pRightbtn); return pRightbtn; } - diff --git a/music-chooser/src/music-chooser.c b/music-chooser/src/music-chooser.c index 3f682c2..9841c8e 100644 --- a/music-chooser/src/music-chooser.c +++ b/music-chooser/src/music-chooser.c @@ -35,7 +35,8 @@ extern Evas_Object *mc_tabbar; #define THEME_NAME "mp-custom-winset-style.edj" static bool -_mc_app_control_extra_data_cb(app_control_h service, const char *key, void *user_data) +_mc_app_control_extra_data_cb(app_control_h service, const char *key, + void *user_data) { startfunc; char *val = NULL; @@ -56,7 +57,8 @@ _mc_app_control_extra_data_cb(app_control_h service, const char *key, void *user ad->select_type = MC_SELECT_SINGLE; } else if (!g_strcmp0(val, MC_REQ_SELECT_SINGLE_RINGTONE)) { ad->select_type = MC_SELECT_SINGLE_RINGTONE; - app_control_get_extra_data(service, MC_SELECT_URI_KEY, &ad->select_uri); + app_control_get_extra_data(service, MC_SELECT_URI_KEY, + &ad->select_uri); } else if (!g_strcmp0(val, MC_REQ_SELECT_MULTI)) { ad->select_type = MC_SELECT_MULTI; } else if (!g_strcmp0(val, MC_REQ_VOICE_CLIP)) { @@ -77,8 +79,7 @@ _mc_app_control_extra_data_cb(app_control_h service, const char *key, void *user return true; } -static void -_parse_service(struct app_data *ad, app_control_h service) +static void _parse_service(struct app_data *ad, app_control_h service) { startfunc; char *operation = NULL; @@ -100,15 +101,16 @@ _parse_service(struct app_data *ad, app_control_h service) } IF_FREE(value); } - app_control_foreach_extra_data(service, _mc_app_control_extra_data_cb, ad); + app_control_foreach_extra_data(service, _mc_app_control_extra_data_cb, + ad); //END: IF_FREE(operation); endfunc; } -static Evas_Object * -_mc_create_fullview(Evas_Object * parent, struct app_data *ad) +static Evas_Object *_mc_create_fullview(Evas_Object * parent, + struct app_data *ad) { Evas_Object *base_layout; @@ -121,8 +123,7 @@ _mc_create_fullview(Evas_Object * parent, struct app_data *ad) return base_layout; } -static Evas_Object * -_mc_create_navigation_layout(Evas_Object * parent) +static Evas_Object *_mc_create_navigation_layout(Evas_Object * parent) { Evas_Object *navi_bar; @@ -132,30 +133,31 @@ _mc_create_navigation_layout(Evas_Object * parent) evas_object_show(navi_bar); elm_naviframe_prev_btn_auto_pushed_set(navi_bar, EINA_FALSE); - eext_object_event_callback_add(navi_bar, EEXT_CALLBACK_BACK, eext_naviframe_back_cb, NULL); - eext_object_event_callback_add(navi_bar, EEXT_CALLBACK_MORE, eext_naviframe_more_cb, NULL); + eext_object_event_callback_add(navi_bar, EEXT_CALLBACK_BACK, + eext_naviframe_back_cb, NULL); + eext_object_event_callback_add(navi_bar, EEXT_CALLBACK_MORE, + eext_naviframe_more_cb, NULL); return navi_bar; } -static Evas_Object * -_mc_crete_bg(Evas_Object *parent) +static Evas_Object *_mc_crete_bg(Evas_Object * parent) { Evas_Object *bg = elm_bg_add(parent); - evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); elm_object_style_set(bg, "group_list"); evas_object_show(bg); return bg; } -static bool -mc_create(void *data) +static bool mc_create(void *data) { DEBUG_TRACE(""); struct app_data *ad = NULL; - ad = (struct app_data *)data; + ad = (struct app_data *) data; ad->win = mc_create_win("music-lite-chooser"); @@ -164,19 +166,22 @@ mc_create(void *data) if (elm_win_wm_rotation_supported_get(ad->win)) { int rots[4] = { 0, 90, 180, 270 }; - elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 4); + elm_win_wm_rotation_available_rotations_set(ad->win, + (const int *) (&rots), + 4); } Evas_Object *conformant = NULL; conformant = elm_conformant_add(ad->win); - evas_object_size_hint_weight_set(conformant, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(conformant, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); elm_win_resize_object_add(ad->win, conformant); evas_object_show(conformant); ad->conformant = conformant; //support light theme - char edje_path[1024] ={0}; - char * path = app_get_resource_path(); + char edje_path[1024] = { 0 }; + char *path = app_get_resource_path(); MP_CHECK_VAL(path, EINA_FALSE); snprintf(edje_path, 1024, "%s%s/%s", path, "edje", THEME_NAME); elm_theme_extension_add(NULL, edje_path); @@ -187,20 +192,19 @@ mc_create(void *data) return EINA_TRUE; } -static void -mc_app_control(app_control_h app_control, void* data) +static void mc_app_control(app_control_h app_control, void *data) { eventfunc; Evas_Object *parent = NULL; struct app_data *ad = NULL; - ad = (struct app_data *)data; + ad = (struct app_data *) data; parent = ad->win; MP_CHECK(ad->win); app_control_clone(&ad->service, app_control); - char locale_path[1024] = {0}; + char locale_path[1024] = { 0 }; char *path = app_get_resource_path(); if (path == NULL) { return; @@ -223,7 +227,8 @@ mc_app_control(app_control_h app_control, void* data) elm_object_part_content_set(ad->base_layout, "elm.swallow.bg", bg); ad->navi_bar = _mc_create_navigation_layout(ad->base_layout); - elm_object_part_content_set(ad->base_layout, "elm.swallow.content", ad->navi_bar); + elm_object_part_content_set(ad->base_layout, "elm.swallow.content", + ad->navi_bar); } if (ad->select_type >= MC_SHORTCUT_ALBUM) { @@ -242,25 +247,23 @@ mc_app_control(app_control_h app_control, void* data) return; } -static void -mc_pause(void *data) +static void mc_pause(void *data) { DEBUG_TRACE(""); mc_pre_play_mgr_destroy_play(); struct app_data *ad = NULL; - ad = (struct app_data *)data; + ad = (struct app_data *) data; MP_CHECK(ad); mc_vol_reset_default_value(ad); return; } -static void -mc_resume(void *data) +static void mc_resume(void *data) { DEBUG_TRACE(""); struct app_data *ad = NULL; - ad = (struct app_data *)data; + ad = (struct app_data *) data; MP_CHECK(ad); if (ad->select_type == MC_SELECT_SINGLE_RINGTONE) { @@ -271,8 +274,7 @@ mc_resume(void *data) } -static void -mc_destroy(void *data) +static void mc_destroy(void *data) { DEBUG_TRACE(""); struct app_data *ad = data; @@ -283,7 +285,6 @@ mc_destroy(void *data) evas_object_del(ad->base_layout); ad->base_layout = NULL; } - //elm_theme_free(ad->th); mc_vol_reset_default_value(ad); @@ -310,8 +311,7 @@ __mc_language_changed_cb(app_event_info_h event_info, void *user_data) } } -EXPORT_API int -main(int argc, char *argv[]) +EXPORT_API int main(int argc, char *argv[]) { struct app_data ad; ui_app_lifecycle_callback_s event_callbacks; @@ -320,11 +320,11 @@ main(int argc, char *argv[]) memset(&ad, 0x0, sizeof(struct app_data)); int nRet = APP_ERROR_NONE; - app_event_handler_h hLowMemoryHandle; - app_event_handler_h hLowBatteryHandle; - app_event_handler_h hLanguageChangedHandle; -// app_event_handler_h hDeviceOrientationChangedHandle; - app_event_handler_h hRegionFormatChangedHandle; + app_event_handler_h hLowMemoryHandle; + app_event_handler_h hLowBatteryHandle; + app_event_handler_h hLanguageChangedHandle; +// app_event_handler_h hDeviceOrientationChangedHandle; + app_event_handler_h hRegionFormatChangedHandle; event_callbacks.create = mc_create; event_callbacks.app_control = mc_app_control; @@ -332,30 +332,47 @@ main(int argc, char *argv[]) event_callbacks.resume = mc_resume; event_callbacks.terminate = mc_destroy; - nRet = ui_app_add_event_handler(&hLowMemoryHandle, APP_EVENT_LOW_MEMORY, NULL, (void*)&ad); + nRet = + ui_app_add_event_handler(&hLowMemoryHandle, APP_EVENT_LOW_MEMORY, + NULL, (void *) &ad); if (nRet != APP_ERROR_NONE) { - WARN_TRACE("APP_EVENT_LOW_MEMORY ui_app_add_event_handler failed : [%d]!!!", nRet); + WARN_TRACE + ("APP_EVENT_LOW_MEMORY ui_app_add_event_handler failed : [%d]!!!", + nRet); } - nRet = ui_app_add_event_handler(&hLowBatteryHandle, APP_EVENT_LOW_BATTERY, NULL, (void*)&ad); + nRet = + ui_app_add_event_handler(&hLowBatteryHandle, APP_EVENT_LOW_BATTERY, + NULL, (void *) &ad); if (nRet != APP_ERROR_NONE) { - WARN_TRACE("APP_EVENT_LOW_BATTERY ui_app_add_event_handler failed : [%d]!!!", nRet); + WARN_TRACE + ("APP_EVENT_LOW_BATTERY ui_app_add_event_handler failed : [%d]!!!", + nRet); } - nRet = ui_app_add_event_handler(&hLanguageChangedHandle, APP_EVENT_LANGUAGE_CHANGED, __mc_language_changed_cb, (void*)&ad); + nRet = + ui_app_add_event_handler(&hLanguageChangedHandle, + APP_EVENT_LANGUAGE_CHANGED, + __mc_language_changed_cb, (void *) &ad); if (nRet != APP_ERROR_NONE) { - WARN_TRACE("APP_EVENT_LANGUAGE_CHANGED ui_app_add_event_handler failed : [%d]!!!", nRet); + WARN_TRACE + ("APP_EVENT_LANGUAGE_CHANGED ui_app_add_event_handler failed : [%d]!!!", + nRet); } - -// nRet = ui_app_add_event_handler( &hDeviceOrientationChangedHandle, APP_EVENT_DEVICE_ORIENTATION_CHANGED, mc_device_orientation, (void*)&ad ); -// if (nRet != APP_ERROR_NONE) { -// ERROR_TRACE("APP_EVENT_LANGUAGE_CHANGED ui_app_add_event_handler failed : [%d]!!!", nRet); -// return -1; -// } - - nRet = ui_app_add_event_handler(&hRegionFormatChangedHandle, APP_EVENT_REGION_FORMAT_CHANGED, NULL, (void*)&ad); +// nRet = ui_app_add_event_handler( &hDeviceOrientationChangedHandle, APP_EVENT_DEVICE_ORIENTATION_CHANGED, mc_device_orientation, (void*)&ad ); +// if (nRet != APP_ERROR_NONE) { +// ERROR_TRACE("APP_EVENT_LANGUAGE_CHANGED ui_app_add_event_handler failed : [%d]!!!", nRet); +// return -1; +// } + + nRet = + ui_app_add_event_handler(&hRegionFormatChangedHandle, + APP_EVENT_REGION_FORMAT_CHANGED, NULL, + (void *) &ad); if (nRet != APP_ERROR_NONE) { - WARN_TRACE("APP_EVENT_REGION_FORMAT_CHANGED ui_app_add_event_handler failed : [%d]!!!", nRet); + WARN_TRACE + ("APP_EVENT_REGION_FORMAT_CHANGED ui_app_add_event_handler failed : [%d]!!!", + nRet); } int ret = ui_app_main(argc, argv, &event_callbacks, &ad); diff --git a/res/edje/mp-defines.h b/res/edje/mp-defines.h index 8b99ffa..da46763 100644 --- a/res/edje/mp-defines.h +++ b/res/edje/mp-defines.h @@ -49,11 +49,11 @@ /* soft key*/ #define SOFTKEY_SY (722/MAIN_H) -#define MP_NAVI_BAR_H (35) +#define MP_NAVI_BAR_H (35) /* player info box*/ #define INFO_BOX_SY ((/*595*/634 - MP_NAVI_BAR_H)/MAIN_H) /* play control box*/ -#define CTL_BOX_HEIGHT 120/*86*/ +#define CTL_BOX_HEIGHT 120 /*86 */ #define CTL_BOX_SY 705/MAIN_H #define CTL_REW_SX (115/MAIN_W) #define CTL_REW_EX (165/MAIN_W) @@ -142,12 +142,12 @@ #define VOLUME_POPUP_TITLE_EY (56 / VOLUME_POPUP_HEIGHT) #define VOLUME_POPUP_ICON_SX (107 / VOLUME_POPUP_WIDTH) #define VOLUME_POPUP_ICON_EX (157 / VOLUME_POPUP_WIDTH) -#define VOLUME_POPUP_ICON_SY (62 / VOLUME_POPUP_HEIGHT) +#define VOLUME_POPUP_ICON_SY (62 / VOLUME_POPUP_HEIGHT) #define VOLUME_POPUP_ICON_EY (112 / VOLUME_POPUP_HEIGHT) -#define VOLUME_POPUP_SLIDER_SX (68/ VOLUME_POPUP_WIDTH) -#define VOLUME_POPUP_SLIDER_EX (194/ VOLUME_POPUP_WIDTH) -#define VOLUME_POPUP_SLIDER_SY (130/ VOLUME_POPUP_HEIGHT) -#define VOLUME_POPUP_SLIDER_EY (400/ VOLUME_POPUP_HEIGHT) +#define VOLUME_POPUP_SLIDER_SX (68 / VOLUME_POPUP_WIDTH) +#define VOLUME_POPUP_SLIDER_EX (194 / VOLUME_POPUP_WIDTH) +#define VOLUME_POPUP_SLIDER_SY (130 / VOLUME_POPUP_HEIGHT) +#define VOLUME_POPUP_SLIDER_EY (400 / VOLUME_POPUP_HEIGHT) #define VOLUME_PROGRESS_BOX_SX (400/MAIN_W) #define VOLUME_PROGRESS_BOX_SY (25/MAIN_H) @@ -206,4 +206,4 @@ #define MP_BUTTON_PRESSED_NAME "Tizen_touch.ogg" -#endif /* __MP_DEFINES_H__ */ +#endif /* __MP_DEFINES_H__ */ diff --git a/sound-player/src/include/sp-view-manager.h b/sound-player/src/include/sp-view-manager.h index 12e59e6..6695179 100644 --- a/sound-player/src/include/sp-view-manager.h +++ b/sound-player/src/include/sp-view-manager.h @@ -31,16 +31,24 @@ typedef enum { SP_VIEW_TYPE_NUM, } Sp_View_Type; -Sp_View_Manager* sp_view_mgr_create(Evas_Object *navi); -void sp_view_mgr_destroy(Sp_View_Manager* view_mgr); -Evas_Object* sp_view_mgr_get_naviframe(Sp_View_Manager *view_mgr); -void sp_view_mgr_push_view_content(Sp_View_Manager *view_mgr, Evas_Object *content, Sp_View_Type type); -void sp_view_mgr_pop_view_content(Sp_View_Manager *view_mgr, bool pop_to_first); -void sp_view_mgr_pop_view_to(Sp_View_Manager *view_mgr, Sp_View_Type type); -Elm_Object_Item * sp_view_mgr_get_play_view_navi_item(Sp_View_Manager *view_mgr); -void sp_view_mgr_play_view_title_label_set(Sp_View_Manager *view_mgr, const char *title); -void sp_view_mgr_set_title_label(Sp_View_Manager *view_mgr, const char *title); -void sp_view_mgr_set_title_visible(Sp_View_Manager *view_mgr, bool flag); -void sp_view_mgr_set_back_button(Sp_View_Manager *view_mgr, Evas_Smart_Cb cb, void *data); +Sp_View_Manager *sp_view_mgr_create(Evas_Object * navi); +void sp_view_mgr_destroy(Sp_View_Manager * view_mgr); +Evas_Object *sp_view_mgr_get_naviframe(Sp_View_Manager * view_mgr); +void sp_view_mgr_push_view_content(Sp_View_Manager * view_mgr, + Evas_Object * content, + Sp_View_Type type); +void sp_view_mgr_pop_view_content(Sp_View_Manager * view_mgr, + bool pop_to_first); +void sp_view_mgr_pop_view_to(Sp_View_Manager * view_mgr, + Sp_View_Type type); +Elm_Object_Item *sp_view_mgr_get_play_view_navi_item(Sp_View_Manager * + view_mgr); +void sp_view_mgr_play_view_title_label_set(Sp_View_Manager * view_mgr, + const char *title); +void sp_view_mgr_set_title_label(Sp_View_Manager * view_mgr, + const char *title); +void sp_view_mgr_set_title_visible(Sp_View_Manager * view_mgr, bool flag); +void sp_view_mgr_set_back_button(Sp_View_Manager * view_mgr, + Evas_Smart_Cb cb, void *data); -#endif /* __SP_VIEW_MANAGER_H__ */ +#endif /* __SP_VIEW_MANAGER_H__ */ diff --git a/src/common/include/mp-app.h b/src/common/include/mp-app.h index 8ed833e..d1cde9c 100644 --- a/src/common/include/mp-app.h +++ b/src/common/include/mp-app.h @@ -21,20 +21,20 @@ #include #include -typedef enum _mp_inotify_event -{ +typedef enum _mp_inotify_event { MP_INOTI_NONE = 0, - MP_INOTI_CREATE, // IN_CREATE - MP_INOTI_DELETE, // IN_DELETE - MP_INOTI_MODIFY, // IN_MODIFY - MP_INOTI_MOVE_OUT, // IN_MOVED_FROM - MP_INOTI_MOVE_IN, // IN_MOVED_TO + MP_INOTI_CREATE, // IN_CREATE + MP_INOTI_DELETE, // IN_DELETE + MP_INOTI_MODIFY, // IN_MODIFY + MP_INOTI_MOVE_OUT, // IN_MOVED_FROM + MP_INOTI_MOVE_IN, // IN_MOVED_TO //MP_INOTI_DELETE_SELF, // IN_DELETE_SELF //MP_INOTI_MOVE_SELF, // IN_MOVE_SELF MP_INOTI_MAX, } mp_inotify_event; -typedef void (*mp_inotify_cb) (mp_inotify_event event, char *name, void *data); +typedef void (*mp_inotify_cb) (mp_inotify_event event, char *name, + void *data); void mp_app_exit(void *data); bool mp_app_noti_init(void *data); @@ -56,4 +56,4 @@ void mp_app_auto_off_changed_cb(int min, void *data); void mp_app_play_speed_changed_cb(double speed, void *data); #endif -#endif // __MP_APP_H__ +#endif // __MP_APP_H__ diff --git a/src/common/include/mp-common.h b/src/common/include/mp-common.h index 002be3a..fc7fde4 100644 --- a/src/common/include/mp-common.h +++ b/src/common/include/mp-common.h @@ -26,8 +26,7 @@ #include "mp-player-control.h" #include "mp-all-view.h" -struct text_part -{ +struct text_part { char *part; char *msgid; }; @@ -38,100 +37,141 @@ typedef enum { MP_COMMON_ALL_IN, MP_COMMON_ALL_OUT, MP_COMMON_PART -}all_in_personal_e; +} all_in_personal_e; #endif void mp_common_show_player_view_after_play(); void mp_common_show_setting_view(void); void mp_common_show_set_as_view(); -void mp_common_show_edit_view(void *list_view,mp_done_operator_type_t type); +void mp_common_show_edit_view(void *list_view, + mp_done_operator_type_t type); void mp_common_add_to_playlsit_view(void *list_view); -void mp_common_view_cancel_cb(void *data, Evas_Object * obj, void *event_info); -void mp_common_create_search_view_cb(void *data, Evas_Object *obj, void *event_info); +void mp_common_view_cancel_cb(void *data, Evas_Object * obj, + void *event_info); +void mp_common_create_search_view_cb(void *data, Evas_Object * obj, + void *event_info); void mp_common_share_cb(void *data, Evas_Object * obj, void *event_info); -void mp_common_genlist_checkbox_tts_double_action_sel_cb(void *data, Evas_Object * obj, Elm_Object_Item *item_data); -void mp_common_genlist_checkbox_sel_cb(void *data, Evas_Object *obj, void *event_info); -void mp_common_ctxpopup_setting_cb(void *data, Evas_Object *obj, void *event_info); -void mp_common_ctxpopup_end_cb(void *data, Evas_Object *obj, void *event_info); -void mp_common_cloud_view_cb(void *data, Evas_Object *obj, void *event_info); -void mp_common_playlist_rename_cb(void *data, Evas_Object *obj, void *event_info); +void mp_common_genlist_checkbox_tts_double_action_sel_cb(void *data, + Evas_Object * obj, + Elm_Object_Item * + item_data); +void mp_common_genlist_checkbox_sel_cb(void *data, Evas_Object * obj, + void *event_info); +void mp_common_ctxpopup_setting_cb(void *data, Evas_Object * obj, + void *event_info); +void mp_common_ctxpopup_end_cb(void *data, Evas_Object * obj, + void *event_info); +void mp_common_cloud_view_cb(void *data, Evas_Object * obj, + void *event_info); +void mp_common_playlist_rename_cb(void *data, Evas_Object * obj, + void *event_info); void mp_common_playlist_album_update(mp_media_info_h playlist_handle); -void mp_common_ctxpopup_make_offline_cb(void *data, Evas_Object *obj, void *event_info); -void mp_common_ctxpopup_add_to_playlist_cb(void *data, Evas_Object *obj, void *event_info); -void mp_common_go_to_library_cb(void *data, Evas_Object *obj, void *event_info); -void mp_common_sweep_share_cb(void *data, Evas_Object * obj, void *event_info); +void mp_common_ctxpopup_make_offline_cb(void *data, Evas_Object * obj, + void *event_info); +void mp_common_ctxpopup_add_to_playlist_cb(void *data, Evas_Object * obj, + void *event_info); +void mp_common_go_to_library_cb(void *data, Evas_Object * obj, + void *event_info); +void mp_common_sweep_share_cb(void *data, Evas_Object * obj, + void *event_info); -void mp_common_list_delete_cb(void *data, Evas_Object * obj, void *event_info); -void mp_common_list_add_to_playlist_cb(void *data, Evas_Object * obj, void *event_info); -void mp_common_list_more_info_cb(void *data, Evas_Object * obj, void *event_info); -void mp_common_list_add_to_favorite_cb(void *data, Evas_Object * obj, void *event_info); -void mp_common_list_unfavorite_cb(void *data, Evas_Object * obj, void *event_info); -void mp_common_list_set_as_cb(void *data, Evas_Object * obj, void *event_info); -void mp_common_list_update_albumart_cb(void *data, Evas_Object * obj, void *event_info); +void mp_common_list_delete_cb(void *data, Evas_Object * obj, + void *event_info); +void mp_common_list_add_to_playlist_cb(void *data, Evas_Object * obj, + void *event_info); +void mp_common_list_more_info_cb(void *data, Evas_Object * obj, + void *event_info); +void mp_common_list_add_to_favorite_cb(void *data, Evas_Object * obj, + void *event_info); +void mp_common_list_unfavorite_cb(void *data, Evas_Object * obj, + void *event_info); +void mp_common_list_set_as_cb(void *data, Evas_Object * obj, + void *event_info); +void mp_common_list_update_albumart_cb(void *data, Evas_Object * obj, + void *event_info); -void mp_common_button_add_to_playlist_cb(void *data, Evas_Object * obj, void *event_info); +void mp_common_button_add_to_playlist_cb(void *data, Evas_Object * obj, + void *event_info); void mp_common_set_list_to_reorder_view(void *list_view); -void mp_common_button_share_list_cb(void *data, Evas_Object * obj, void *event_info); -void mp_common_button_delete_list_cb(void *data, Evas_Object * obj, void *event_info); +void mp_common_button_share_list_cb(void *data, Evas_Object * obj, + void *event_info); +void mp_common_button_delete_list_cb(void *data, Evas_Object * obj, + void *event_info); Evas_Object *mp_common_create_more_ctxpopup(void *view); void p_common_show_player_view_after_play(); void mp_common_create_default_playlist(); -void mp_common_show_player_view(int launch_type, bool disable_effect, bool start_playback, bool start_new_file); -void mp_common_play_track_list_with_playlist_id(mp_list_item_data_t *item, Evas_Object *genlist, int playlist_id); -void mp_common_play_track_list(mp_list_item_data_t *item, Evas_Object *genlist); +void mp_common_show_player_view(int launch_type, bool disable_effect, + bool start_playback, bool start_new_file); +void mp_common_play_track_list_with_playlist_id(mp_list_item_data_t * item, + Evas_Object * genlist, + int playlist_id); +void mp_common_play_track_list(mp_list_item_data_t * item, + Evas_Object * genlist); void mp_common_search_by(const char *keyword); -void mp_common_list_remove_cb(void *data, Evas_Object * obj, void *event_info); -void mp_common_view_check_changed_cb(void *data, Evas_Object *obj, void *event_info); -bool mp_common_track_is_current(mp_media_info_h media,MpList_t *list); -void mp_common_track_delete_cb(void *data, Evas_Object * obj, void *event_info); +void mp_common_list_remove_cb(void *data, Evas_Object * obj, + void *event_info); +void mp_common_view_check_changed_cb(void *data, Evas_Object * obj, + void *event_info); +bool mp_common_track_is_current(mp_media_info_h media, MpList_t * list); +void mp_common_track_delete_cb(void *data, Evas_Object * obj, + void *event_info); #ifndef MP_SOUND_PLAYER -bool _mp_common_parse_open_shortcut(app_control_h app_control, MpTab_e *tab, char **shortcut_main_info); +bool _mp_common_parse_open_shortcut(app_control_h app_control, + MpTab_e * tab, + char **shortcut_main_info); #endif MpView_t *mp_common_get_all_view(); void mp_common_show_add_tracks_view(int playlist_id); void mp_common_create_playlist_mgr(void); -void mp_common_popup_del_cb(void *data, Evas * e, Evas_Object * obj, void *event_info); +void mp_common_popup_del_cb(void *data, Evas * e, Evas_Object * obj, + void *event_info); bool mp_common_parse_view_operation(app_control_h app_control); -void mp_common_create_initial_view(void *ad, app_control_h app_control, int *launch_by_shortcut); +void mp_common_create_initial_view(void *ad, app_control_h app_control, + int *launch_by_shortcut); void mp_common_playall_cb(void *data, Evas_Object * obj, void *event_info); -void mp_common_add_to_home_cb(void *data, Evas_Object * obj, void *event_info); +void mp_common_add_to_home_cb(void *data, Evas_Object * obj, + void *event_info); void mp_common_force_close_delete(); -int mp_common_get_playlist_totaltime(mp_track_type_e track_type, int playlist_id, int count); +int mp_common_get_playlist_totaltime(mp_track_type_e track_type, + int playlist_id, int count); #ifdef MP_FEATURE_PERSONAL_PAGE -all_in_personal_e mp_common_is_all_in_personal_page(Evas_Object *genlist); -void mp_common_add_to_personal_page_cb(void *data, Evas_Object * obj, void *event_info); -void mp_common_remove_from_personal_page_cb(void *data, Evas_Object * obj, void *event_info); +all_in_personal_e mp_common_is_all_in_personal_page(Evas_Object * genlist); +void mp_common_add_to_personal_page_cb(void *data, Evas_Object * obj, + void *event_info); +void mp_common_remove_from_personal_page_cb(void *data, Evas_Object * obj, + void *event_info); all_in_personal_e mp_common_personal_status(void *thiz); -void mp_common_longpress_private_move_cb(void *data, Evas_Object * obj, void *event_info); +void mp_common_longpress_private_move_cb(void *data, Evas_Object * obj, + void *event_info); #endif #define MP_GENLIST_ITEM_LONG_PRESSED(genlist, popup, obj_item)\ -do{\ +do {\ elm_genlist_item_selected_set(obj_item, EINA_FALSE);\ - if(popup){\ + if (popup) {\ evas_object_data_set(genlist, "popup", popup);\ elm_object_scroll_freeze_push(genlist);\ evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, mp_common_popup_del_cb, genlist);\ - }\ -}while(0); + } \ +} while (0); #define MP_GENGRID_ITEM_LONG_PRESSED(genlist, popup, obj_item)\ -do{\ +do {\ elm_gengrid_item_selected_set(obj_item, EINA_FALSE);\ - if(popup){\ + if (popup) {\ evas_object_data_set(genlist, "popup", popup);\ elm_object_scroll_freeze_push(genlist);\ evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, mp_common_popup_del_cb, genlist);\ - }\ -}while(0); + } \ +} while (0); #define MP_LIST_ITEM_IGNORE_SELECT(obj)\ -do{\ +do {\ Evas_Object *popup = evas_object_data_get(obj, "popup");\ if (popup) return;\ -}while(0); +} while (0); -#endif // __mp_common_H__ +#endif // __mp_common_H__ diff --git a/src/common/include/mp-edit-callback.h b/src/common/include/mp-edit-callback.h index e59fcf4..e861732 100644 --- a/src/common/include/mp-edit-callback.h +++ b/src/common/include/mp-edit-callback.h @@ -17,8 +17,7 @@ #ifndef __MP_EDIT_CALLBACK_H__ #define __MP_EDIT_CALLBACK_H__ -typedef enum -{ +typedef enum { #ifdef MP_FEATURE_PERSONAL_PAGE MP_EDIT_MOVE, #endif @@ -34,7 +33,8 @@ void *mp_edit_get_delete_thread(); #endif /* if playlist_name is not null, playlist detail view will be displayed after add to playlist*/ -void mp_edit_cb_excute_add_to_playlist(void *data, int playlist_id, char *playlist_name, bool selected); +void mp_edit_cb_excute_add_to_playlist(void *data, int playlist_id, + char *playlist_name, bool selected); void mp_edit_cb_excute_delete(void *data); void mp_edit_cb_cencel_cb(void *data, Evas_Object * obj, void *event_info); void mp_edit_cb_excute_make_offline_available(void *data); diff --git a/src/common/include/mp-file-util.h b/src/common/include/mp-file-util.h index 9c2fe9e..dc3d934 100644 --- a/src/common/include/mp-file-util.h +++ b/src/common/include/mp-file-util.h @@ -25,43 +25,41 @@ #include #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif -int mp_file_exists(const char *path); + int mp_file_exists(const char *path); -int mp_file_is_dir(const char *path); + int mp_file_is_dir(const char *path); -int mp_file_path_dir_exists(const char *folderPath); + int mp_file_path_dir_exists(const char *folderPath); -int mp_file_unlink(const char *filename); + int mp_file_unlink(const char *filename); -int mp_file_size(const char *filename); + int mp_file_size(const char *filename); -int mp_file_rmdir(const char *filename); + int mp_file_rmdir(const char *filename); -int mp_file_dir_is_empty(const char *path); + int mp_file_dir_is_empty(const char *path); -Eina_List *mp_file_ls(const char *dir); + Eina_List *mp_file_ls(const char *dir); -int mp_file_recursive_rm(const char *dir); + int mp_file_recursive_rm(const char *dir); -char* mp_file_dir_get(const char path[]); + char *mp_file_dir_get(const char path[]); -int mp_file_mkpath(char *path); + int mp_file_mkpath(char *path); -int mp_file_mv(const char *src, const char *dst); + int mp_file_mv(const char *src, const char *dst); -int mp_file_cp(const char *src, const char *dst); + int mp_file_cp(const char *src, const char *dst); -int mp_file_remove(const char *path); + int mp_file_remove(const char *path); -char * mp_file_file_get(char path[]); + char *mp_file_file_get(char path[]); -char *mp_file_strip_ext(const char *path); + char *mp_file_strip_ext(const char *path); #ifdef __cplusplus } #endif - #endif diff --git a/src/common/include/mp-info-define.h b/src/common/include/mp-info-define.h index 03fc00c..60ff654 100644 --- a/src/common/include/mp-info-define.h +++ b/src/common/include/mp-info-define.h @@ -60,20 +60,20 @@ #define FREE(ptr) free(ptr); ptr = NULL; #undef IF_FREE -#define IF_FREE(ptr) if (ptr) {free(ptr); ptr = NULL;} +#define IF_FREE(ptr) if (ptr) {free(ptr); ptr = NULL; } #undef SAFE_FREE -#define SAFE_FREE(x) if(x) {free(x); x = NULL;} +#define SAFE_FREE(x) if (x) {free(x); x = NULL; } #define mp_evas_object_del(object) do { \ - if(object) { \ + if (object) { \ evas_object_del(object); \ object = NULL; \ } \ } while (0) #define mp_elm_genlist_del(list) do { \ - if(list) { \ + if (list) { \ elm_genlist_clear(list);\ evas_object_del(list); \ list = NULL; \ @@ -81,14 +81,14 @@ } while (0) #define mp_elm_genlist_item_class_free(itc) do { \ - if(itc) { \ + if (itc) { \ elm_genlist_item_class_free(itc); \ itc = NULL; \ } \ } while (0) #define mp_ecore_timer_del(timer) do { \ - if(timer) { \ + if (timer) { \ ecore_timer_del(timer);\ timer = NULL; \ } \ @@ -98,11 +98,11 @@ #undef MUSICDIR #endif #define MUSICDIR DATA_PREFIX -#define MP_RESDIR MUSICDIR"/res" +#define MP_RESDIR MUSICDIR"/res" #ifdef EDJDIR #undef EDJDIR #endif -#define EDJDIR MP_RESDIR"/edje" +#define EDJDIR MP_RESDIR"/edje" #ifdef RICH_INFO_EDJ #undef RICH_INFO_EDJ #endif @@ -123,4 +123,4 @@ #define MP_METADATA_LEN_MAX 193 -#endif /* __MP_INFO_DEFINE_H_ */ +#endif /* __MP_INFO_DEFINE_H_ */ diff --git a/src/common/include/mp-item.h b/src/common/include/mp-item.h index 9d63547..c339c68 100644 --- a/src/common/include/mp-item.h +++ b/src/common/include/mp-item.h @@ -31,24 +31,22 @@ int mp_item_share_by_bt(const char *formed_path, int file_cnt); #define AS_IPC_REQUEST_METHOD "Request" -typedef struct -{ - int param1; //Allshare_opp_req_t type - int param2; //the number of files - char *param3; //file path +typedef struct { + int param1; //Allshare_opp_req_t type + int param2; //the number of files + char *param3; //file path } Allshare_para_info_t; -typedef enum -{ +typedef enum { AS_OPP_REQ_FILE_PLAY } Allshare_opp_req_t; #define mp_object_free(obj) \ do { \ - if(obj != NULL) { \ + if (obj != NULL) { \ g_free(obj); \ obj = NULL; \ } \ -}while(0) +} while (0) #endif diff --git a/src/common/include/mp-media-info.h b/src/common/include/mp-media-info.h index 2e18cea..0fb5756 100644 --- a/src/common/include/mp-media-info.h +++ b/src/common/include/mp-media-info.h @@ -25,207 +25,292 @@ extern "C" { #define MAX_FILTER_LEN 4096 -typedef struct mp_media_list_s *mp_media_list_h; -typedef struct mp_media_info_s *mp_media_info_h; -typedef struct filter_s *mp_filter_h; -typedef struct playlist_s *mp_playlist_h; - -typedef bool(* mp_media_info_cb)(mp_media_info_h media, void *user_data); - - -typedef enum -{ - MP_MEDIA_CONTENT_COLLATE_DEFAULT = 0, /**< default collation BINARY */ - MP_MEDIA_CONTENT_COLLATE_NOCASE = 1, /**< collation NOCASE, not case sensitive */ - MP_MEDIA_CONTENT_COLLATE_RTRIM = 2, /**< collation RTRIM, trailing space characters are ignored */ -} mp_media_content_collation_e; - -typedef enum -{ - MP_MEDIA_TYPE_MUSIC, - MP_MEDIA_TYPE_SOUND, -}mp_media_type_e; - -typedef enum{ - MP_TRACK_ALL, /**< All tracks*/ - MP_TRACK_BY_ALBUM, /**< Album tracks*/ - MP_TRACK_BY_ARTIST_ALBUM, /** < Albums which has special artist condition */ - MP_TRACK_BY_ARTIST, /**< Artist tracks*/ - MP_TRACK_BY_ARTIST_GENRE, /**< Genre tracks which has special artist condition*/ - MP_TRACK_BY_GENRE, /**< Genre tracks*/ - MP_TRACK_BY_FOLDER, /**< Genre tracks*/ - MP_TRACK_BY_YEAR, /**< Year tracks*/ - MP_TRACK_BY_COMPOSER, /**< Author tracks*/ - MP_TRACK_BY_SQUARE, - - //To make edit confirm popup text as Remove, track type should be between MP_TRACK_TYPE_PLAYLIST_MIN and MP_TRACK_TYPE_PLAYLIST_MAX - MP_TRACK_TYPE_PLAYLIST_MIN, - MP_TRACK_BY_FAVORITE, /**< Toprating tracks*/ - MP_TRACK_BY_PLAYED_TIME, /**< Recently played tracks*/ - MP_TRACK_BY_ADDED_TIME, /**< Recently added tracks*/ - MP_TRACK_BY_PLAYED_COUNT, /**< Most played tracks*/ - MP_TRACK_BY_PLAYLIST, /**< User playlist tracks*/ - MP_TRACK_TYPE_PLAYLIST_MAX, - - MP_TRACK_BY_VOICE_CLIP, - MP_TRACK_BY_GROUP_PLAY, -}mp_track_type_e; - -typedef enum{ - MP_GROUP_NONE, - MP_GROUP_BY_ALBUM, /**< Group by album*/ - MP_GROUP_BY_ARTIST, /**< Group by artist*/ - MP_GROUP_BY_ARTIST_ALBUM, /**< Group by album which has special artist condition*/ - MP_GROUP_BY_GENRE, /**< Group by genre*/ - MP_GROUP_BY_FOLDER, /**< Group by folder*/ - MP_GROUP_BY_YEAR, /**< Group by year*/ - MP_GROUP_BY_COMPOSER, /**< Group by author*/ - MP_GROUP_BY_PLAYLIST, - MP_GROUP_BY_SYS_PLAYLIST, - MP_GROUP_BY_SQUARE, - MP_GROUP_BY_ALLSHARE, -}mp_group_type_e; - -typedef enum{ - MP_SYS_PLST_NONE = -5,//-4 - MP_SYS_PLST_MOST_PLAYED = -4,//-3 - MP_SYS_PLST_RECENTELY_ADDED = -3,//-2 - MP_SYS_PLST_RECENTELY_PLAYED = -2,//-1 - MP_SYS_PLST_QUICK_LIST = -1,//0 - MP_SYS_PLST_COUNT = 1, -}mp_sys_playlsit_id; - -typedef enum{ - MP_STORAGE_INTERNAL_EX, - MP_STORAGE_EXTERNAL_EX, - MP_STORAGE_CLOUD_EX, - MP_STORAGE_MUSICHUB_EX, -}mp_storage_type_e; + typedef struct mp_media_list_s *mp_media_list_h; + typedef struct mp_media_info_s *mp_media_info_h; + typedef struct filter_s *mp_filter_h; + typedef struct playlist_s *mp_playlist_h; + + typedef bool(*mp_media_info_cb) (mp_media_info_h media, + void *user_data); + + + typedef enum { + MP_MEDIA_CONTENT_COLLATE_DEFAULT = 0, /**< default collation BINARY */ + MP_MEDIA_CONTENT_COLLATE_NOCASE = 1, /**< collation NOCASE, not case sensitive */ + MP_MEDIA_CONTENT_COLLATE_RTRIM = 2, /**< collation RTRIM, trailing space characters are ignored */ + } mp_media_content_collation_e; + + typedef enum { + MP_MEDIA_TYPE_MUSIC, + MP_MEDIA_TYPE_SOUND, + } mp_media_type_e; + + typedef enum { + MP_TRACK_ALL, /**< All tracks*/ + MP_TRACK_BY_ALBUM, /**< Album tracks*/ + MP_TRACK_BY_ARTIST_ALBUM, /** < Albums which has special artist condition */ + MP_TRACK_BY_ARTIST, /**< Artist tracks*/ + MP_TRACK_BY_ARTIST_GENRE, /**< Genre tracks which has special artist condition*/ + MP_TRACK_BY_GENRE, /**< Genre tracks*/ + MP_TRACK_BY_FOLDER, /**< Genre tracks*/ + MP_TRACK_BY_YEAR, /**< Year tracks*/ + MP_TRACK_BY_COMPOSER, /**< Author tracks*/ + MP_TRACK_BY_SQUARE, + + //To make edit confirm popup text as Remove, track type should be between MP_TRACK_TYPE_PLAYLIST_MIN and MP_TRACK_TYPE_PLAYLIST_MAX + MP_TRACK_TYPE_PLAYLIST_MIN, + MP_TRACK_BY_FAVORITE, /**< Toprating tracks*/ + MP_TRACK_BY_PLAYED_TIME, /**< Recently played tracks*/ + MP_TRACK_BY_ADDED_TIME, /**< Recently added tracks*/ + MP_TRACK_BY_PLAYED_COUNT, /**< Most played tracks*/ + MP_TRACK_BY_PLAYLIST, /**< User playlist tracks*/ + MP_TRACK_TYPE_PLAYLIST_MAX, + + MP_TRACK_BY_VOICE_CLIP, + MP_TRACK_BY_GROUP_PLAY, + } mp_track_type_e; + + typedef enum { + MP_GROUP_NONE, + MP_GROUP_BY_ALBUM, /**< Group by album*/ + MP_GROUP_BY_ARTIST, /**< Group by artist*/ + MP_GROUP_BY_ARTIST_ALBUM, /**< Group by album which has special artist condition*/ + MP_GROUP_BY_GENRE, /**< Group by genre*/ + MP_GROUP_BY_FOLDER, /**< Group by folder*/ + MP_GROUP_BY_YEAR, /**< Group by year*/ + MP_GROUP_BY_COMPOSER, /**< Group by author*/ + MP_GROUP_BY_PLAYLIST, + MP_GROUP_BY_SYS_PLAYLIST, + MP_GROUP_BY_SQUARE, + MP_GROUP_BY_ALLSHARE, + } mp_group_type_e; + + typedef enum { + MP_SYS_PLST_NONE = -5, //-4 + MP_SYS_PLST_MOST_PLAYED = -4, //-3 + MP_SYS_PLST_RECENTELY_ADDED = -3, //-2 + MP_SYS_PLST_RECENTELY_PLAYED = -2, //-1 + MP_SYS_PLST_QUICK_LIST = -1, //0 + MP_SYS_PLST_COUNT = 1, + } mp_sys_playlsit_id; + + typedef enum { + MP_STORAGE_INTERNAL_EX, + MP_STORAGE_EXTERNAL_EX, + MP_STORAGE_CLOUD_EX, + MP_STORAGE_MUSICHUB_EX, + } mp_storage_type_e; /*connection*/ -int mp_media_info_connect(void); -int mp_media_info_disconnect(void); + int mp_media_info_connect(void); + int mp_media_info_disconnect(void); /*filter*/ -int mp_media_filter_create(mp_filter_h *filter); -int mp_media_filter_destory(mp_filter_h filter); -int mp_media_filter_set_offset(mp_filter_h filter, int offset, int count); -int mp_media_filter_set_order(mp_filter_h filter, bool asc, const char *order_keyword, mp_media_content_collation_e collation); -int mp_media_filter_set_condition(mp_filter_h filter, const char *condition, mp_media_content_collation_e collation ); -bool mp_media_info_uri_is_exist_in_db(const char *file_path); + int mp_media_filter_create(mp_filter_h * filter); + int mp_media_filter_destory(mp_filter_h filter); + int mp_media_filter_set_offset(mp_filter_h filter, int offset, + int count); + int mp_media_filter_set_order(mp_filter_h filter, bool asc, + const char *order_keyword, + mp_media_content_collation_e collation); + int mp_media_filter_set_condition(mp_filter_h filter, + const char *condition, + mp_media_content_collation_e + collation); + bool mp_media_info_uri_is_exist_in_db(const char *file_path); /*media infomation*/ -int mp_media_info_get_media_id(mp_media_info_h media, char **media_id); -int mp_media_info_get_file_path(mp_media_info_h media, char **path); -int mp_media_info_get_thumbnail_path(mp_media_info_h media, char **path); -int mp_media_info_get_favorite(mp_media_info_h media, bool *favorite); -int mp_media_info_is_drm(mp_media_info_h media, bool *drm); -int mp_media_info_get_title(mp_media_info_h media, char **title); -int mp_media_info_get_album(mp_media_info_h media, char **album); -int mp_media_info_get_recorded_date(mp_media_info_h media, char **date); -int mp_media_info_get_genre(mp_media_info_h media, char **genre); -int mp_media_info_get_artist(mp_media_info_h media, char **artist); -int mp_media_info_get_composer(mp_media_info_h media, char **composer); -int mp_media_info_get_year(mp_media_info_h media, char **year); -int mp_media_info_get_copyright(mp_media_info_h media, char **copyright); -int mp_media_info_get_track_num(mp_media_info_h media, char **track_num); -int mp_media_info_get_format(mp_media_info_h media, char **format); -int mp_media_info_get_media_type(mp_media_info_h media, int *media_type); -int mp_media_info_get_bit_rate(mp_media_info_h media, int *bitrate); -int mp_media_info_get_bitpersample(mp_media_info_h media, int *bitpersample); -int mp_media_info_get_sample_rate(mp_media_info_h media, int *sample_rate); -int mp_media_info_get_duration(mp_media_info_h media, int *duration); -int mp_media_info_get_played_time(mp_media_info_h media, time_t *time); -int mp_media_info_get_played_count(mp_media_info_h media, int *count); -int mp_media_info_get_added_time(mp_media_info_h media, time_t *time); -int mp_media_info_get_playlist_member_id(mp_media_info_h media, int *member_id); -int mp_media_info_get_storage_type(mp_media_info_h media, mp_storage_type_e *storage_type); -int mp_media_info_get_display_name(mp_media_info_h media, char **display_name); - -int mp_media_info_set_favorite_media_db_only(mp_media_info_h media, bool favorite); -int mp_media_info_set_favorite(mp_media_info_h media, bool favorite); -int mp_media_info_set_played_time(mp_media_info_h media, time_t time); -int mp_media_info_set_played_count(mp_media_info_h media, int count); -int mp_media_info_set_added_time(mp_media_info_h media, time_t time); + int mp_media_info_get_media_id(mp_media_info_h media, char **media_id); + int mp_media_info_get_file_path(mp_media_info_h media, char **path); + int mp_media_info_get_thumbnail_path(mp_media_info_h media, + char **path); + int mp_media_info_get_favorite(mp_media_info_h media, bool * favorite); + int mp_media_info_is_drm(mp_media_info_h media, bool * drm); + int mp_media_info_get_title(mp_media_info_h media, char **title); + int mp_media_info_get_album(mp_media_info_h media, char **album); + int mp_media_info_get_recorded_date(mp_media_info_h media, + char **date); + int mp_media_info_get_genre(mp_media_info_h media, char **genre); + int mp_media_info_get_artist(mp_media_info_h media, char **artist); + int mp_media_info_get_composer(mp_media_info_h media, char **composer); + int mp_media_info_get_year(mp_media_info_h media, char **year); + int mp_media_info_get_copyright(mp_media_info_h media, + char **copyright); + int mp_media_info_get_track_num(mp_media_info_h media, + char **track_num); + int mp_media_info_get_format(mp_media_info_h media, char **format); + int mp_media_info_get_media_type(mp_media_info_h media, + int *media_type); + int mp_media_info_get_bit_rate(mp_media_info_h media, int *bitrate); + int mp_media_info_get_bitpersample(mp_media_info_h media, + int *bitpersample); + int mp_media_info_get_sample_rate(mp_media_info_h media, + int *sample_rate); + int mp_media_info_get_duration(mp_media_info_h media, int *duration); + int mp_media_info_get_played_time(mp_media_info_h media, + time_t * time); + int mp_media_info_get_played_count(mp_media_info_h media, int *count); + int mp_media_info_get_added_time(mp_media_info_h media, time_t * time); + int mp_media_info_get_playlist_member_id(mp_media_info_h media, + int *member_id); + int mp_media_info_get_storage_type(mp_media_info_h media, + mp_storage_type_e * storage_type); + int mp_media_info_get_display_name(mp_media_info_h media, + char **display_name); + + int mp_media_info_set_favorite_media_db_only(mp_media_info_h media, + bool favorite); + int mp_media_info_set_favorite(mp_media_info_h media, bool favorite); + int mp_media_info_set_played_time(mp_media_info_h media, time_t time); + int mp_media_info_set_played_count(mp_media_info_h media, int count); + int mp_media_info_set_added_time(mp_media_info_h media, time_t time); //int mp_media_info_set_cloud_thumbnail_path(mp_media_info_h media, const char *path); /*media*/ -int mp_media_info_create(mp_media_info_h *media_list, const char *media_id); -int mp_media_info_create_by_path(mp_media_info_h *media_info, const char *file_path); -int mp_media_info_destroy(mp_media_info_h media_info); + int mp_media_info_create(mp_media_info_h * media_list, + const char *media_id); + int mp_media_info_create_by_path(mp_media_info_h * media_info, + const char *file_path); + int mp_media_info_destroy(mp_media_info_h media_info); /*media list*/ -int mp_media_info_list_count(mp_track_type_e track_type, const char *type_string,const char *type_string2, const char *filter_string, int playlist_id, int *count); -int mp_media_info_list_count_w_filter(mp_track_type_e track_type, const char *folder_id, int playlist_id, mp_filter_h filter, int *count); -int mp_media_info_list_create(mp_media_list_h *media_list, mp_track_type_e track_type, const char *type_string, const char *type_string2, const char *filter_string, int playlist_id, int offset, int count); -int mp_media_info_list_create_w_filter(mp_track_type_e track_type, const char *folder_id, int playlist_id, mp_filter_h filter, mp_media_list_h *media_list); -int mp_media_info_list_destroy(mp_media_list_h media_list); -mp_media_info_h mp_media_info_list_nth_item(mp_media_list_h media_list, int index); -int mp_media_infor_list_get_count(mp_media_list_h media_list); + int mp_media_info_list_count(mp_track_type_e track_type, + const char *type_string, + const char *type_string2, + const char *filter_string, + int playlist_id, int *count); + int mp_media_info_list_count_w_filter(mp_track_type_e track_type, + const char *folder_id, + int playlist_id, + mp_filter_h filter, int *count); + int mp_media_info_list_create(mp_media_list_h * media_list, + mp_track_type_e track_type, + const char *type_string, + const char *type_string2, + const char *filter_string, + int playlist_id, int offset, int count); + int mp_media_info_list_create_w_filter(mp_track_type_e track_type, + const char *folder_id, + int playlist_id, + mp_filter_h filter, + mp_media_list_h * media_list); + int mp_media_info_list_destroy(mp_media_list_h media_list); + mp_media_info_h mp_media_info_list_nth_item(mp_media_list_h media_list, + int index); + int mp_media_infor_list_get_count(mp_media_list_h media_list); /*for sound player*/ -int mp_media_info_sorted_track_list_create(mp_media_list_h *out_list, char *sort_type); + int mp_media_info_sorted_track_list_create(mp_media_list_h * out_list, + char *sort_type); /*group list*/ -int mp_media_info_group_list_count(mp_group_type_e group_type, const char *type_string, const char *filter_string, int *count); -int mp_media_info_group_list_count_w_filter(mp_group_type_e group_type, mp_filter_h filter, int *count); -int mp_media_info_group_list_create(mp_media_list_h *media_list, mp_group_type_e group_type, const char *type_string, const char *filter_string, int offset, int count); -int mp_media_info_group_list_create_w_filter(mp_filter_h filter, mp_group_type_e group_type, mp_media_list_h *media_list); -int mp_media_info_group_list_destroy(mp_media_list_h media_list); -mp_media_info_h mp_media_info_group_list_nth_item(mp_media_list_h media_list, int index); - -int mp_media_info_group_get_type(mp_media_info_h media, mp_group_type_e *group_type); -int mp_media_info_group_get_main_info(mp_media_info_h media, char **main_info); -int mp_media_info_group_get_sub_info(mp_media_info_h media, char **sub_info); -int mp_media_info_group_get_playlist_id(mp_media_info_h media, int *playlist_id); -int mp_media_info_group_get_folder_id(mp_media_info_h media, char **folder_id); -int mp_media_info_group_get_thumbnail_path(mp_media_info_h media, char **path); -int mp_media_info_group_get_track_count(mp_media_info_h media, int *count); + int mp_media_info_group_list_count(mp_group_type_e group_type, + const char *type_string, + const char *filter_string, + int *count); + int mp_media_info_group_list_count_w_filter(mp_group_type_e group_type, + mp_filter_h filter, + int *count); + int mp_media_info_group_list_create(mp_media_list_h * media_list, + mp_group_type_e group_type, + const char *type_string, + const char *filter_string, + int offset, int count); + int mp_media_info_group_list_create_w_filter(mp_filter_h filter, + mp_group_type_e + group_type, + mp_media_list_h * + media_list); + int mp_media_info_group_list_destroy(mp_media_list_h media_list); + mp_media_info_h mp_media_info_group_list_nth_item(mp_media_list_h + media_list, + int index); + + int mp_media_info_group_get_type(mp_media_info_h media, + mp_group_type_e * group_type); + int mp_media_info_group_get_main_info(mp_media_info_h media, + char **main_info); + int mp_media_info_group_get_sub_info(mp_media_info_h media, + char **sub_info); + int mp_media_info_group_get_playlist_id(mp_media_info_h media, + int *playlist_id); + int mp_media_info_group_get_folder_id(mp_media_info_h media, + char **folder_id); + int mp_media_info_group_get_thumbnail_path(mp_media_info_h media, + char **path); + int mp_media_info_group_get_track_count(mp_media_info_h media, + int *count); //only for artists -int mp_media_info_group_get_album_thumnail_paths(mp_media_info_h media, char ***thumbs, int *count); + int mp_media_info_group_get_album_thumnail_paths(mp_media_info_h media, + char ***thumbs, + int *count); -int mp_media_info_playlist_get_thumbnail_path(mp_media_info_h media, char **path); -int mp_media_info_playlist_set_thumbnail_path(mp_media_info_h media, const char *path); + int mp_media_info_playlist_get_thumbnail_path(mp_media_info_h media, + char **path); + int mp_media_info_playlist_set_thumbnail_path(mp_media_info_h media, + const char *path); /*playlist list*/ -int mp_media_info_playlist_get_id_by_name(const char *playlist_name, int *playlist_id); -int mp_media_info_playlist_delete_from_db(int playlist_id); -int mp_media_info_playlist_add_media(int playlist_id, const char *media_id); -int mp_media_info_playlist_remove_media(mp_media_info_h playlist, int memeber_id); -int mp_media_info_playlist_set_play_order(mp_media_info_h playlist, int memeber_id, int play_order); -int mp_media_info_playlist_update_db(mp_media_info_h playlist); -int mp_media_info_playlist_db_update(mp_playlist_h playlist_handle); -int mp_media_info_playlist_is_exist(const char *playlist_name, bool *exist); -int mp_media_info_playlist_unique_name(const char *orig_name, char *unique_name, size_t max_unique_name_length); -int mp_media_info_playlist_rename(mp_media_info_h playlist, const char *new_name); -int mp_media_info_playlist_get_play_order(mp_media_info_h playlist, int playlist_member_id, int * play_order); + int mp_media_info_playlist_get_id_by_name(const char *playlist_name, + int *playlist_id); + int mp_media_info_playlist_delete_from_db(int playlist_id); + int mp_media_info_playlist_add_media(int playlist_id, + const char *media_id); + int mp_media_info_playlist_remove_media(mp_media_info_h playlist, + int memeber_id); + int mp_media_info_playlist_set_play_order(mp_media_info_h playlist, + int memeber_id, + int play_order); + int mp_media_info_playlist_update_db(mp_media_info_h playlist); + int mp_media_info_playlist_db_update(mp_playlist_h playlist_handle); + int mp_media_info_playlist_is_exist(const char *playlist_name, + bool * exist); + int mp_media_info_playlist_unique_name(const char *orig_name, + char *unique_name, + size_t max_unique_name_length); + int mp_media_info_playlist_rename(mp_media_info_h playlist, + const char *new_name); + int mp_media_info_playlist_get_play_order(mp_media_info_h playlist, + int playlist_member_id, + int *play_order); /*playlist handle for add to playlist*/ -int mp_media_info_playlist_handle_create(mp_playlist_h *playlist_h, int playlist_id); -int mp_media_info_playlist_add_item(mp_playlist_h playlist_handle, const char *media_id, const char *thumbnail_path); -int mp_media_info_dup_playlist_handle_from_list_item(mp_media_info_h playlist, mp_playlist_h *playlist_handle); -int mp_media_info_playlist_insert_to_db(const char * name, int *playlist_id, mp_playlist_h *playlist_handle); -int mp_media_info_playlist_get_name_by_id(int playlist_id, char **playlist_name); -int mp_media_info_playlist_prepend_media(mp_playlist_h playlist_handle, const char *media_id); -int mp_media_info_playlist_handle_destroy(mp_playlist_h playlist_handle); + int mp_media_info_playlist_handle_create(mp_playlist_h * playlist_h, + int playlist_id); + int mp_media_info_playlist_add_item(mp_playlist_h playlist_handle, + const char *media_id, + const char *thumbnail_path); + int mp_media_info_dup_playlist_handle_from_list_item(mp_media_info_h + playlist, + mp_playlist_h * + playlist_handle); + int mp_media_info_playlist_insert_to_db(const char *name, + int *playlist_id, + mp_playlist_h * + playlist_handle); + int mp_media_info_playlist_get_name_by_id(int playlist_id, + char **playlist_name); + int mp_media_info_playlist_prepend_media(mp_playlist_h playlist_handle, + const char *media_id); + int mp_media_info_playlist_handle_destroy(mp_playlist_h + playlist_handle); //db sync -int mp_media_info_delete_from_db(const char *path); + int mp_media_info_delete_from_db(const char *path); /* util */ -int mp_media_info_get_folder_path_by_folder_id(const char *folder_id, char **path); -int mp_media_info_get_auto_playlist_id_by_name(const char *name); + int mp_media_info_get_folder_path_by_folder_id(const char *folder_id, + char **path); + int mp_media_info_get_auto_playlist_id_by_name(const char *name); //db update callback -typedef void (*db_update_cb)(void *data); -int mp_media_playlist_get_playlist_count_from_db(); -int mp_media_info_set_db_update_cb(db_update_cb cb, void *data); -int mp_media_info_unset_db_update_cb(void); + typedef void (*db_update_cb) (void *data); + int mp_media_playlist_get_playlist_count_from_db(); + int mp_media_info_set_db_update_cb(db_update_cb cb, void *data); + int mp_media_info_unset_db_update_cb(void); #ifdef __cplusplus } #endif - #endif - diff --git a/src/common/include/mp-menu.h b/src/common/include/mp-menu.h index b8f513a..ea144dc 100644 --- a/src/common/include/mp-menu.h +++ b/src/common/include/mp-menu.h @@ -19,27 +19,37 @@ #define __MP_MENU_H_ #include "mp-media-info.h" -typedef enum -{ +typedef enum { MP_MENU_FUNC_ADD_TO_LIST = 0, MP_MENU_FUNC_DELETE, } mp_menu_func_type; -void mp_menu_ctxpopup_share_select_cb(void *data, Evas_Object * obj, void *event_info); -void mp_menu_ctxpopup_set_as_select_cb(void *data, Evas_Object * obj, void *event_info); -void mp_menu_genlist_set_as_select_cb(void *data, Evas_Object * obj, void *event_info); +void mp_menu_ctxpopup_share_select_cb(void *data, Evas_Object * obj, + void *event_info); +void mp_menu_ctxpopup_set_as_select_cb(void *data, Evas_Object * obj, + void *event_info); +void mp_menu_genlist_set_as_select_cb(void *data, Evas_Object * obj, + void *event_info); -void mp_menu_genlist_popup_share_select_cb(void *data, Evas_Object * obj, void *event_info); -void mp_menu_genlist_popup_list_share_select_cb(void *data, Evas_Object * obj, void *event_info); +void mp_menu_genlist_popup_share_select_cb(void *data, Evas_Object * obj, + void *event_info); +void mp_menu_genlist_popup_list_share_select_cb(void *data, + Evas_Object * obj, + void *event_info); void mp_menu_share_cb(void *data, Evas_Object * obj, void *event_info); void mp_menu_set_cb(void *data, Evas_Object * obj, void *event_info); #ifndef MP_SOUND_PLAYER void mp_menu_delete_cb(void *data, Evas_Object * obj, void *event_info); -void mp_menu_add_to_playlist_cb(void *data, Evas_Object * obj, void *event_info); -mp_track_type_e mp_menu_get_track_type_by_group(mp_group_type_e group_type); -void mp_menu_add_to_play_list_cancel_create_cb(void *data, Evas_Object * obj, void *event_info); -void mp_menu_add_to_play_list_done_create_cb(void *data, Evas_Object * obj, void *event_info); +void mp_menu_add_to_playlist_cb(void *data, Evas_Object * obj, + void *event_info); +mp_track_type_e mp_menu_get_track_type_by_group(mp_group_type_e + group_type); +void mp_menu_add_to_play_list_cancel_create_cb(void *data, + Evas_Object * obj, + void *event_info); +void mp_menu_add_to_play_list_done_create_cb(void *data, Evas_Object * obj, + void *event_info); #endif #define ADD_TO_HOME ("IDS_MUSIC_SK2_ADD_TO_HOME") @@ -52,7 +62,7 @@ void mp_menu_add_to_play_list_done_create_cb(void *data, Evas_Object * obj, void #define ALLSHARE_SYS GET_SYS_STR("IDS_COM_BODY_ALLSHARE") #define EMAIL_SYS GET_SYS_STR("IDS_COM_BODY_EMAIL") #define MESSAGE_SYS GET_SYS_STR("IDS_COM_BODY_MESSAGE") -#define WIFI_SYS GET_SYS_STR("IDS_COM_BODY_WI_FI") +#define WIFI_SYS GET_SYS_STR("IDS_COM_BODY_WI_FI") #define NFC_SYS GET_SYS_STR("IDS_COM_BODY_NFC") -#endif // __MP_MENU_H_ +#endif // __MP_MENU_H_ diff --git a/src/common/include/mp-play.h b/src/common/include/mp-play.h index 4b16ffd..325f62d 100644 --- a/src/common/include/mp-play.h +++ b/src/common/include/mp-play.h @@ -32,7 +32,7 @@ bool mp_play_start_in_ready_state(void *data); int mp_play_new_file(void *data, bool check_drm); void mp_play_prev_file(void *data); void mp_play_next_file(void *data, bool forced); -void mp_play_prepare(void *data); +void mp_play_prepare(void *data); void mp_play_start(void *data); void mp_play_pause(void *data); void mp_play_stop(void *data); diff --git a/src/common/include/mp-ta.h b/src/common/include/mp-ta.h index e25503f..71ab934 100644 --- a/src/common/include/mp-ta.h +++ b/src/common/include/mp-ta.h @@ -25,14 +25,12 @@ #define MP_TA_MAX_CHECKPOINT 500 #define MP_TA_MAX_ACCUM 500 -typedef struct _mp_ta_checkpoint -{ +typedef struct _mp_ta_checkpoint { unsigned long timestamp; char *name; } mp_ta_checkpoint; -typedef struct _mp_ta_accum_item -{ +typedef struct _mp_ta_accum_item { unsigned long elapsed_accum; unsigned long num_calls; unsigned long elapsed_min; @@ -80,96 +78,86 @@ int mp_ta_accum_item_end(char *name, int show, char *filename, int line); void mp_ta_accum_show_result(int direction); // macro. -#define MP_TA_INIT() ( mp_ta_init() ) -#define MP_TA_RELEASE() ( mp_ta_release() ) -#define MP_TA_SET_ENABLE(enable) ( mp_ta_set_enable(enable) ) +#define MP_TA_INIT() (mp_ta_init()) +#define MP_TA_RELEASE() (mp_ta_release()) +#define MP_TA_SET_ENABLE(enable) (mp_ta_set_enable(enable)) // checkpoint handling -#define MP_TA_ADD_CHECKPOINT(name,show) ( mp_ta_add_checkpoint(name,show,__FILE__,__LINE__) ) -#define MP_TA_SHOW_CHECKPOINTS() ( mp_ta_show_checkpoints() ) -#define MP_TA_SHOW_DIFF(name1, name2) ( mp_ta_show_diff(name1, name2) ) -#define MP_TA_GET_NUMOF_CHECKPOINTS() ( mp_ta_get_numof_checkpoints() ) -#define MP_TA_GET_DIFF(name1, name2) ( mp_ta_get_diff(name1, name2) ) -//#define MP_TA_GET_NAME(idx) ( mp_ta_get_name(idx) ) - +#define MP_TA_ADD_CHECKPOINT(name, show) (mp_ta_add_checkpoint(name, show, __FILE__, __LINE__)) +#define MP_TA_SHOW_CHECKPOINTS() (mp_ta_show_checkpoints()) +#define MP_TA_SHOW_DIFF(name1, name2) (mp_ta_show_diff(name1, name2)) +#define MP_TA_GET_NUMOF_CHECKPOINTS() (mp_ta_get_numof_checkpoints()) +#define MP_TA_GET_DIFF(name1, name2) (mp_ta_get_diff(name1, name2)) // accum item handling -#define MP_TA_ACUM_ITEM_BEGIN(name,show) ( mp_ta_accum_item_begin(name,show,__FILE__,__LINE__) ) -#define MP_TA_ACUM_ITEM_END(name,show) ( mp_ta_accum_item_end(name,show,__FILE__,__LINE__) ) -#define MP_TA_ACUM_ITEM_SHOW_RESULT() ( mp_ta_accum_show_result(MP_TA_SHOW_STDOUT) ) -#define MP_TA_ACUM_ITEM_SHOW_RESULT_TO(x) ( mp_ta_accum_show_result(x) ) -/* -#define __mp_ta__(name, x) \ -MP_TA_ACUM_ITEM_BEGIN(name, 0); \ -x \ -MP_TA_ACUM_ITEM_END(name, 0); - -#define __mm_tafmt__(fmt, args...) ( mp_ta_fmt(fmt, ##args) ) -*/ +#define MP_TA_ACUM_ITEM_BEGIN(name, show) (mp_ta_accum_item_begin(name, show, __FILE__, __LINE__)) +#define MP_TA_ACUM_ITEM_END(name, show) (mp_ta_accum_item_end(name, show, __FILE__, __LINE__)) +#define MP_TA_ACUM_ITEM_SHOW_RESULT() (mp_ta_accum_show_result(MP_TA_SHOW_STDOUT)) +#define MP_TA_ACUM_ITEM_SHOW_RESULT_TO(x) (mp_ta_accum_show_result(x)) #define TA(start, label)\ -do{\ - if(start)\ +do {\ + if (start)\ TA_S(label);\ else\ TA_E(label);\ -}while(0) +} while (0) #define TA_PADDING " " #define TA_S(label)\ -do{\ - if(!mp_ta_is_init())\ +do {\ + if (!mp_ta_is_init())\ break;\ char buf[128] = {0,};\ int i = 0, pos = 0, level = 0;\ level = mp_ta_increase_level();\ - while(i < level){pos += snprintf(buf+pos, 128-pos, TA_PADDING); i++;}\ + while (i < level) {pos += snprintf(buf+pos, 128-pos, TA_PADDING); i++; } \ snprintf(buf+pos, 128-pos, "%s", label);\ - mp_ta_accum_item_begin(buf,0,__FILE__,__LINE__);\ -}while(0) + mp_ta_accum_item_begin(buf, 0, __FILE__, __LINE__);\ +} while (0) #define TA_E(label)\ -do{\ - if(!mp_ta_is_init())\ +do {\ + if (!mp_ta_is_init())\ break;\ char buf[128] = {0,};\ int i = 0, pos = 0, level = 0;\ level = mp_ta_decrease_level();\ - while(i < level){pos += snprintf(buf+pos, 128-pos, TA_PADDING); i++;}\ + while (i < level) {pos += snprintf(buf+pos, 128-pos, TA_PADDING); i++; } \ snprintf(&buf[pos], 128-pos, "%s", label);\ - mp_ta_accum_item_end(buf,0,__FILE__,__LINE__);\ -}while(0) + mp_ta_accum_item_end(buf, 0, __FILE__, __LINE__);\ +} while (0) #define TA_S_L(level, label)\ -do{\ - if(!mp_ta_is_init())\ +do {\ + if (!mp_ta_is_init())\ break;\ char buf[128] = {0,};\ int i = 0, pos = 0;\ - while(i < level){pos += snprintf(buf+pos, 128-pos, TA_PADDING); i++;}\ + while (i < level) {pos += snprintf(buf+pos, 128-pos, TA_PADDING); i++; } \ snprintf(buf+pos, 128-pos, "%s", label);\ - mp_ta_accum_item_begin(buf,0,__FILE__,__LINE__);\ -}while(0) + mp_ta_accum_item_begin(buf, 0, __FILE__, __LINE__);\ +} while (0) #define TA_E_L(level, label)\ -do{\ - if(!mp_ta_is_init())\ +do {\ + if (!mp_ta_is_init())\ break;\ char buf[128] = {0,};\ int i = 0, pos = 0;\ - while(i < level){pos += snprintf(buf+pos, 128-pos, TA_PADDING); i++;}\ + while (i < level) {pos += snprintf(buf+pos, 128-pos, TA_PADDING); i++; } \ snprintf(&buf[pos], 128-pos, "%s", label);\ - mp_ta_accum_item_end(buf,0,__FILE__,__LINE__);\ -}while(0) + mp_ta_accum_item_end(buf, 0, __FILE__, __LINE__);\ +} while (0) -#else //#ifdef ENABLE_MP_TA +#else //#ifdef ENABLE_MP_TA #define MP_TA_INIT() #define MP_TA_RELEASE() #define MP_TA_SET_ENABLE(enable) // checkpoint handling -#define MP_TA_ADD_CHECKPOINT(name,show) +#define MP_TA_ADD_CHECKPOINT(name, show) #define MP_TA_SHOW_CHECKPOINTS() #define MP_TA_SHOW_DIFF(name1, name2) #define MP_TA_GET_NUMOF_CHECKPOINTS() @@ -177,8 +165,8 @@ do{\ //#define MP_TA_GET_NAME(idx) // accum item handling -#define MP_TA_ACUM_ITEM_BEGIN(name,show) -#define MP_TA_ACUM_ITEM_END(name,show) +#define MP_TA_ACUM_ITEM_BEGIN(name, show) +#define MP_TA_ACUM_ITEM_END(name, show) #define MP_TA_ACUM_ITEM_SHOW_RESULT() #define MP_TA_ACUM_ITEM_SHOW_RESULT_TO(x) /* @@ -190,6 +178,6 @@ do{\ #define TA_E(label) #define TA_S_L(level, label) #define TA_E_L(level, label) -#endif //#ifdef ENABLE_MP_TA +#endif //#ifdef ENABLE_MP_TA -#endif // _MP_TA_H_ +#endif // _MP_TA_H_ diff --git a/src/common/include/mp-ug-launch.h b/src/common/include/mp-ug-launch.h index cfaf045..f5f8668 100644 --- a/src/common/include/mp-ug-launch.h +++ b/src/common/include/mp-ug-launch.h @@ -27,6 +27,7 @@ int mp_ug_gallery_get_picture(void *data); int mp_ug_contact_user_sel(const char *filepath, void *user_data); int mp_ug_set_as_alarm_tone(const char *filepath, int position); -bool mp_send_via_appcontrol(struct appdata *ad, mp_send_type_e send_type, const char *files); +bool mp_send_via_appcontrol(struct appdata *ad, mp_send_type_e send_type, + const char *files); -#endif // __MP_ug_launch_H_ +#endif // __MP_ug_launch_H_ diff --git a/src/common/include/mp-util.h b/src/common/include/mp-util.h index d95f0b2..df34acd 100644 --- a/src/common/include/mp-util.h +++ b/src/common/include/mp-util.h @@ -20,21 +20,19 @@ #include #include "music.h" -typedef enum -{ +typedef enum { MP_FILE_DELETE_ERR_USING = -2, MP_FILE_DELETE_ERR_REMOVE_FAIL = -1, MP_FILE_DELETE_ERR_INVALID_FID = 0, MP_FILE_DELETE_ERR_NONE, -}mp_file_delete_err_t; +} mp_file_delete_err_t; -typedef enum -{ +typedef enum { MP_DIR_NONE = 0, MP_DIR_PHONE, MP_DIR_MMC, MP_DIR_HTTP -}mp_dir_e; +} mp_dir_e; enum { PREF_PLAYER_OFF = 0x00, @@ -50,40 +48,51 @@ enum { }; #define GET_WINDOW() ((mp_util_get_appdata()) ? mp_util_get_appdata()->win_main : NULL) -#define CHECK_STORE mp_util_is_store_enable() +#define CHECK_STORE mp_util_is_store_enable() #define PREF_MUSIC_STATE "preference/org.tizen.music-player/state" #define PREF_SOUND_PLAYER_LAUNCH "preference/org.tizen.sound-player/launch_state" #define PREF_MUSIC_PLAYER_LAUNCH "preference/org.tizen.music-player/launch_state" void mp_to_lower(char *str); int mp_setting_get_nowplaying_id(void); -bool mp_util_text_multiline_check(Evas_Object *obj,const char*text, const char*textstyle, int text_width, int text_height); -bool mp_check_file_exist (const char *path); -void mp_util_format_duration(char *time, int ms); +bool mp_util_text_multiline_check(Evas_Object * obj, const char *text, + const char *textstyle, int text_width, + int text_height); +bool mp_check_file_exist(const char *path); +void mp_util_format_duration(char *time, int ms); void mp_util_song_format_duration(char *time, int ms); -bool mp_util_add_to_playlist_by_key(int playlist_id, char *key_id); -bool mp_util_delete_track_by_id(char *key_id); -Evas_Object * mp_util_create_image(Evas_Object * obj, const char *path, const char *group, int w, int h); -Evas_Object * mp_util_create_thumb_icon(Evas_Object *obj, const char *path, int w, int h); -Evas_Object * mp_util_create_lazy_update_thumb_icon(Evas_Object * obj, const char *path, int w, int h); -const char* mp_util_get_index(const char *p); -const char* mp_util_get_second_index(const char *p); -Evas_Object * mp_util_create_selectioninfo_with_count(void *data, int count); +bool mp_util_add_to_playlist_by_key(int playlist_id, char *key_id); +bool mp_util_delete_track_by_id(char *key_id); +Evas_Object *mp_util_create_image(Evas_Object * obj, const char *path, + const char *group, int w, int h); +Evas_Object *mp_util_create_thumb_icon(Evas_Object * obj, const char *path, + int w, int h); +Evas_Object *mp_util_create_lazy_update_thumb_icon(Evas_Object * obj, + const char *path, int w, + int h); +const char *mp_util_get_index(const char *p); +const char *mp_util_get_second_index(const char *p); +Evas_Object *mp_util_create_selectioninfo_with_count(void *data, + int count); void mp_util_post_status_message(struct appdata *ad, const char *text); void mp_util_post_add_to_playlist_popup_message(int count); -char * mp_util_get_new_playlist_name (void); +char *mp_util_get_new_playlist_name(void); void mp_post_notification_indicator(char *status); -mp_file_delete_err_t mp_util_delete_track(void *data, char *fid, char *file_path); +mp_file_delete_err_t mp_util_delete_track(void *data, char *fid, + char *file_path); -int mp_util_share_via_bt(const char *formed_path, int file_cnt); -int mp_util_file_is_in_phone_memory(const char *path); +int mp_util_share_via_bt(const char *formed_path, int file_cnt); +int mp_util_file_is_in_phone_memory(const char *path); -char* mp_util_get_path_by_handle(mp_media_info_h record); -char* mp_util_isf_get_edited_str(Evas_Object *isf_entry, bool permit_first_blank); -int mp_util_create_playlist(struct appdata *ad, char *name, mp_playlist_h *playlist_handle); +char *mp_util_get_path_by_handle(mp_media_info_h record); +char *mp_util_isf_get_edited_str(Evas_Object * isf_entry, + bool permit_first_blank); +int mp_util_create_playlist(struct appdata *ad, char *name, + mp_playlist_h * playlist_handle); -bool mp_util_set_screen_mode(void *data , int mode); -void mp_noti_read_ini_file(void *data, Ecore_File_Monitor *em, Ecore_File_Event event, const char *path); +bool mp_util_set_screen_mode(void *data, int mode); +void mp_noti_read_ini_file(void *data, Ecore_File_Monitor * em, + Ecore_File_Event event, const char *path); bool mp_util_launch_browser(const char *url, struct appdata *ad); const char *util_get_file_path(const char *relative); @@ -91,31 +100,32 @@ const char *util_get_file_path(const char *relative); #define mp_object_free(obj) \ do { \ - if(obj != NULL) { \ + if (obj != NULL) { \ g_free(obj); \ obj = NULL; \ } \ -}while(0) +} while (0) #define MMC_PATH MP_MMC_ROOT_PATH #define PKGNAME_SYSTEM "sys_string" gunichar mp_util_get_utf8_initial_value(const char *name); -gchar * mp_get_new_playlist_name (void); -gchar *mp_parse_get_title_from_path (const gchar *path); -char *mp_util_get_title_from_path (const char *path); -bool mp_util_is_playlist_name_valid(char *name); +gchar *mp_get_new_playlist_name(void); +gchar *mp_parse_get_title_from_path(const gchar * path); +char *mp_util_get_title_from_path(const char *path); +bool mp_util_is_playlist_name_valid(char *name); void mp_util_set_library_controlbar_items(void *data); -void mp_util_reset_genlist_mode_item(Evas_Object *genlist); +void mp_util_reset_genlist_mode_item(Evas_Object * genlist); -bool mp_util_is_image_valid(Evas *evas, const char *path); +bool mp_util_is_image_valid(Evas * evas, const char *path); char *mp_util_shorten_path(char *path_info); bool mp_util_is_earjack_inserted(void); -void mp_util_get_sound_path(mp_snd_path *snd_path); +void mp_util_get_sound_path(mp_snd_path * snd_path); -const char * mp_util_search_markup_keyword(const char *string, char *searchword, bool *result); +const char *mp_util_search_markup_keyword(const char *string, + char *searchword, bool * result); bool mp_util_is_other_player_playing(void); bool mp_util_is_now_active_player(void); @@ -127,24 +137,38 @@ bool mp_util_sleep_lock_set(bool lock, bool force_unlock); bool mp_util_is_nfc_feature_on(void); void mp_util_strncpy_safe(char *x_dst, const char *x_src, int max_len); -void mp_util_free_track_info(mp_track_info_t *track_info); -void mp_util_load_track_info(struct appdata *ad, mp_plst_item *cur_item, mp_track_info_t **info); -void mp_util_append_media_list_item_to_playlist(mp_plst_mgr *playlist_mgr, mp_media_list_h media_list, int count, int current_index, const char *uri); -char* mp_util_get_fid_by_full_path(const char *full_path, char **title, char **artist); +void mp_util_free_track_info(mp_track_info_t * track_info); +void mp_util_load_track_info(struct appdata *ad, mp_plst_item * cur_item, + mp_track_info_t ** info); +void mp_util_append_media_list_item_to_playlist(mp_plst_mgr * playlist_mgr, + mp_media_list_h media_list, + int count, + int current_index, + const char *uri); +char *mp_util_get_fid_by_full_path(const char *full_path, char **title, + char **artist); EXPORT_API struct appdata *mp_util_get_appdata(void); char *mp_util_get_text(const char *str); -void mp_util_more_btn_move_ctxpopup(Evas_Object *ctxpopup, Evas_Object *btn); -Elm_Object_Item *mp_util_ctxpopup_item_append_ext(Evas_Object *obj, const char *label, const char *file, - const char *group, Evas_Smart_Cb func, - const void *data); -Elm_Object_Item *mp_util_ctxpopup_item_append(Evas_Object *obj, const char *label, - const char *group, Evas_Smart_Cb func, - const void *data); -Elm_Object_Item *mp_util_toolbar_item_append(Evas_Object *obj, const char *icon, - const char *label, Evas_Smart_Cb func, - const void *data); - -Elm_Object_Item *mp_util_toolbar_nth_item(Evas_Object *obj, int n); +void mp_util_more_btn_move_ctxpopup(Evas_Object * ctxpopup, + Evas_Object * btn); +Elm_Object_Item *mp_util_ctxpopup_item_append_ext(Evas_Object * obj, + const char *label, + const char *file, + const char *group, + Evas_Smart_Cb func, + const void *data); +Elm_Object_Item *mp_util_ctxpopup_item_append(Evas_Object * obj, + const char *label, + const char *group, + Evas_Smart_Cb func, + const void *data); +Elm_Object_Item *mp_util_toolbar_item_append(Evas_Object * obj, + const char *icon, + const char *label, + Evas_Smart_Cb func, + const void *data); + +Elm_Object_Item *mp_util_toolbar_nth_item(Evas_Object * obj, int n); bool mp_util_get_sip_state(void); bool mp_util_is_landscape(void); @@ -152,34 +176,41 @@ bool mp_util_is_landscape(void); int mp_util_parse_device_type(const char *name); void mp_util_set_livebox_update_timer(void); -void mp_util_print_geometry(Evas_Object *obj, const char *name); +void mp_util_print_geometry(Evas_Object * obj, const char *name); void mp_util_hide_lock_screen(void); bool mp_util_is_lock_screen_exist(void); -void mp_util_object_item_translate_set(Elm_Object_Item *item, const char *ID); +void mp_util_object_item_translate_set(Elm_Object_Item * item, + const char *ID); bool mp_util_file_playable(const char *uri); -char * mp_util_file_mime_type_get(const char *uri); +char *mp_util_file_mime_type_get(const char *uri); bool mp_util_app_resume(void); bool mp_util_system_volume_popup_show(void); bool mp_util_is_call_connected(void); -void mp_util_domain_translatable_text_set(Evas_Object *obj, const char* text); -void mp_util_domain_translatable_part_text_set(Evas_Object *obj, const char* part, const char* text); -void mp_util_item_domain_translatable_part_text_set(Elm_Object_Item *item, const char* part, const char* text); +void mp_util_domain_translatable_text_set(Evas_Object * obj, + const char *text); +void mp_util_domain_translatable_part_text_set(Evas_Object * obj, + const char *part, + const char *text); +void mp_util_item_domain_translatable_part_text_set(Elm_Object_Item * item, + const char *part, + const char *text); bool mp_util_is_mmc_removed(void); -void dump_win(Evas_Object *obj, int max_depth); -void dump_obj(Evas_Object *obj, int lvl, int max_depth); -void dump_widget(Evas_Object *obj, int lvl, int max_depth); +void dump_win(Evas_Object * obj, int max_depth); +void dump_obj(Evas_Object * obj, int lvl, int max_depth); +void dump_widget(Evas_Object * obj, int lvl, int max_depth); #ifdef MP_FEATURE_PERSONAL_PAGE bool mp_util_is_in_personal_page(const char *path); bool mp_util_is_personal_page_on(); -void mp_util_get_unique_name(char *original_file_name, char **unique_file_name); +void mp_util_get_unique_name(char *original_file_name, + char **unique_file_name); int mp_util_is_duplicated_name(const char *dir, const char *name); int mp_util_get_file_ext(const char *filename, char **file_ext); #endif bool mp_util_mirroring_is_connected(void); -int mp_util_get_root_window_angle(Evas_Object *win); +int mp_util_get_root_window_angle(Evas_Object * win); bool mp_util_is_scan_nearby_available(); bool mp_util_is_store_enable(void); bool mp_util_free_space_check(double size); @@ -189,5 +220,4 @@ mp_dir_e mp_util_get_file_location(const char *uri); void mp_util_lock_cpu(); void mp_util_release_cpu(); -#endif //__MP_UTIL_H_ - +#endif //__MP_UTIL_H_ diff --git a/src/common/include/mp-widget.h b/src/common/include/mp-widget.h index 8956a9d..f20424a 100644 --- a/src/common/include/mp-widget.h +++ b/src/common/include/mp-widget.h @@ -22,7 +22,7 @@ #define _EDJ(obj) elm_layout_edje_get(obj) /**< get evas object from elm layout */ typedef enum { - MP_LOADING_ICON_SIZE_LARGE, // normal + MP_LOADING_ICON_SIZE_LARGE, // normal MP_LOADING_ICON_SIZE_MEDIUM, MP_LOADING_ICON_SIZE_SMALL, MP_LOADING_ICON_SIZE_XLARGE, @@ -31,26 +31,45 @@ typedef enum { Evas_Object *mp_widget_navigation_new(Evas_Object * parent); EXPORT_API Evas_Object *mp_widget_genlist_create(Evas_Object * parent); Evas_Object *mp_widget_text_popup(void *data, const char *message); -Evas_Object *mp_widget_text_popup_show(void *data, const char *message, bool show); -Evas_Object *mp_widget_text_cb_popup(void *data, const char *message, Evas_Smart_Cb cb); +Evas_Object *mp_widget_text_popup_show(void *data, const char *message, + bool show); +Evas_Object *mp_widget_text_cb_popup(void *data, const char *message, + Evas_Smart_Cb cb); -Evas_Object *mp_widget_create_icon(Evas_Object * obj, const char *path, int w, int h); -Evas_Object *mp_widget_create_button(Evas_Object * parent, char *style, char *caption, Evas_Object * icon, - void (*func) (void *, Evas_Object *, void *), void *data); +Evas_Object *mp_widget_create_icon(Evas_Object * obj, const char *path, + int w, int h); +Evas_Object *mp_widget_create_button(Evas_Object * parent, char *style, + char *caption, Evas_Object * icon, + void (*func) (void *, Evas_Object *, + void *), void *data); char *mp_widget_set_text_theme_color(const char *text, const char *color); -Evas_Object * mp_widget_create_editfield(Evas_Object * parent, int limit_size, char *guide_txt, struct appdata *ad); -Evas_Object * mp_widget_editfield_entry_get(Evas_Object *editfield); -Evas_Object *mp_create_title_text_btn(Evas_Object *parent, const char *text, Evas_Smart_Cb func, void *data); -Evas_Object * mp_widget_create_title_btn(Evas_Object *parent, const char *text, const char * icon_path, Evas_Smart_Cb func, void *data); -Evas_Object * mp_common_create_naviframe_title_button(Evas_Object *parent, const char * text_id, void *save_cb, void *user_data); -Evas_Object * mp_widget_create_layout_main(Evas_Object * parent); -EXPORT_API Evas_Object *mp_common_load_edj(Evas_Object * parent, const char *file, const char *group); +Evas_Object *mp_widget_create_editfield(Evas_Object * parent, + int limit_size, char *guide_txt, + struct appdata *ad); +Evas_Object *mp_widget_editfield_entry_get(Evas_Object * editfield); +Evas_Object *mp_create_title_text_btn(Evas_Object * parent, + const char *text, Evas_Smart_Cb func, + void *data); +Evas_Object *mp_widget_create_title_btn(Evas_Object * parent, + const char *text, + const char *icon_path, + Evas_Smart_Cb func, void *data); +Evas_Object *mp_common_create_naviframe_title_button(Evas_Object * parent, + const char *text_id, + void *save_cb, + void *user_data); +Evas_Object *mp_widget_create_layout_main(Evas_Object * parent); +EXPORT_API Evas_Object *mp_common_load_edj(Evas_Object * parent, + const char *file, + const char *group); Evas_Object *mp_create_win(const char *name); Evas_Object *mp_widget_text_button_popup(void *data, const char *message); -EXPORT_API Evas_Object * mp_widget_notify_cb_popup(void *data, const char *message, Evas_Smart_Cb cb, void *cb_data); +EXPORT_API Evas_Object *mp_widget_notify_cb_popup(void *data, + const char *message, + Evas_Smart_Cb cb, + void *cb_data); -typedef enum -{ +typedef enum { MP_NOCONTENT_NORMAL, MP_NOCONTENT_TRACKS, MP_NOCONTENT_PLAYLIST, @@ -59,42 +78,100 @@ typedef enum MP_NOCONTENT_FOLDERS, MP_NOCONTENT_GENRES, MP_NOCONTENT_DEVICE, -}MpNocontent_e; +} MpNocontent_e; -Evas_Object * -mp_widget_create_no_contents(Evas_Object *parent, MpNocontent_e type, void(*callback)(void *data, Evas_Object *obj, void *event_info), void *user_data); -Evas_Object * -mp_widget_create_no_content_playlist(Evas_Object *parent, char *helptext, void(*callback)(void *data, Evas_Object *obj, void *event_info), void *user_data); -Evas_Object *mp_widget_no_contents_default_add(Evas_Object *parent, const char *text, const char *help_text); -Evas_Object *mp_widget_shorcut_box_add(Evas_Object *parent, const char *title, const char *file, const char *group, int w, int h, Edje_Signal_Cb func, void *data); -Evas_Object *mp_widget_create_tabbar(Evas_Object *obj); -Evas_Object *mp_widget_slide_title_create(Evas_Object *parent, const char *style, const char *text); -Evas_Object *mp_widget_device_icon_add(Evas_Object *parent, int device_type); -Evas_Object *mp_widget_connection_info_add(Evas_Object *parent, Evas_Object *src_icon, const char *src_name, Evas_Object *dest_icon, const char *dest_name); -Evas_Object *mp_widget_create_title_icon(Evas_Object *parent, const char *file, const char *group); -Evas_Object *mp_widget_create_bg(Evas_Object *parent); +Evas_Object *mp_widget_create_no_contents(Evas_Object * parent, + MpNocontent_e type, + void (*callback) (void *data, + Evas_Object * + obj, + void + *event_info), + void *user_data); +Evas_Object *mp_widget_create_no_content_playlist(Evas_Object * parent, + char *helptext, + void (*callback) (void + *data, + Evas_Object + *obj, + void + *event_info), + void *user_data); +Evas_Object *mp_widget_no_contents_default_add(Evas_Object * parent, + const char *text, + const char *help_text); +Evas_Object *mp_widget_shorcut_box_add(Evas_Object * parent, + const char *title, const char *file, + const char *group, int w, int h, + Edje_Signal_Cb func, void *data); +Evas_Object *mp_widget_create_tabbar(Evas_Object * obj); +Evas_Object *mp_widget_slide_title_create(Evas_Object * parent, + const char *style, + const char *text); +Evas_Object *mp_widget_device_icon_add(Evas_Object * parent, + int device_type); +Evas_Object *mp_widget_connection_info_add(Evas_Object * parent, + Evas_Object * src_icon, + const char *src_name, + Evas_Object * dest_icon, + const char *dest_name); +Evas_Object *mp_widget_create_title_icon(Evas_Object * parent, + const char *file, + const char *group); +Evas_Object *mp_widget_create_bg(Evas_Object * parent); #define MP_TOOLBAR_BTN_DEFAULT "naviframe/toolbar/default" #define MP_TOOLBAR_BTN_LEFT "naviframe/toolbar/left" #define MP_TOOLBAR_BTN_RIGHT "naviframe/toolbar/right" #define MP_TOOLBAR_BTN_MORE "naviframe/more/default" -Evas_Object * -mp_widget_create_toolbar_btn(Evas_Object *parent, - const char *style, const char *text, Evas_Smart_Cb func, void *data); -Evas_Object *mp_widget_create_naviframe_toolbar(Elm_Object_Item *navi_it); -Elm_Object_Item *mp_widget_create_toolbar_item_btn(Evas_Object *parent, const char *style, const char *text, Evas_Smart_Cb func, void *data); -Evas_Object *mp_widget_create_title_icon_btn(Evas_Object *parent, const char *file, const char *group, Evas_Smart_Cb func, void *data); -Evas_Object *mp_widget_create_title_icon_btn_second(Evas_Object *parent, const char *file, const char *group, Evas_Smart_Cb func, void *data); -Evas_Object *mp_widget_create_title_icon_btn_black(Evas_Object *parent, const char *file, const char *group, Evas_Smart_Cb func, void *data); -Evas_Object *mp_widget_loading_icon_add(Evas_Object *parent, mp_loading_icon_size_e size); -Evas_Object* mp_widget_create_navi_right_btn(Evas_Object *pParent, Elm_Object_Item *pNaviItem,Evas_Smart_Cb pFunc, void *pUserData); -Evas_Object* mp_widget_create_navi_left_btn(Evas_Object *pParent, Elm_Object_Item *pNaviItem,Evas_Smart_Cb pFunc, void *pUserData); -bool mp_widget_create_select_all_layout(Evas_Object *pParent, Evas_Smart_Cb pChangeFunc,Evas_Object_Event_Cb pMouseDownFunc, void *pUserData, Evas_Object **pCheckBox, Evas_Object **pSelectLayout); +Evas_Object *mp_widget_create_toolbar_btn(Evas_Object * parent, + const char *style, + const char *text, + Evas_Smart_Cb func, void *data); +Evas_Object *mp_widget_create_naviframe_toolbar(Elm_Object_Item * navi_it); +Elm_Object_Item *mp_widget_create_toolbar_item_btn(Evas_Object * parent, + const char *style, + const char *text, + Evas_Smart_Cb func, + void *data); +Evas_Object *mp_widget_create_title_icon_btn(Evas_Object * parent, + const char *file, + const char *group, + Evas_Smart_Cb func, + void *data); +Evas_Object *mp_widget_create_title_icon_btn_second(Evas_Object * parent, + const char *file, + const char *group, + Evas_Smart_Cb func, + void *data); +Evas_Object *mp_widget_create_title_icon_btn_black(Evas_Object * parent, + const char *file, + const char *group, + Evas_Smart_Cb func, + void *data); +Evas_Object *mp_widget_loading_icon_add(Evas_Object * parent, + mp_loading_icon_size_e size); +Evas_Object *mp_widget_create_navi_right_btn(Evas_Object * pParent, + Elm_Object_Item * pNaviItem, + Evas_Smart_Cb pFunc, + void *pUserData); +Evas_Object *mp_widget_create_navi_left_btn(Evas_Object * pParent, + Elm_Object_Item * pNaviItem, + Evas_Smart_Cb pFunc, + void *pUserData); +bool mp_widget_create_select_all_layout(Evas_Object * pParent, + Evas_Smart_Cb pChangeFunc, + Evas_Object_Event_Cb + pMouseDownFunc, void *pUserData, + Evas_Object ** pCheckBox, + Evas_Object ** pSelectLayout); #ifdef MP_FEATURE_PERSONAL_PAGE -Evas_Object *mp_widget_lock_icon_create(Evas_Object *obj, const char *thumbpath); +Evas_Object *mp_widget_lock_icon_create(Evas_Object * obj, + const char *thumbpath); #endif -Evas_Object *mp_widget_rich_info_text_add(Evas_Object *parent, const char *text); +Evas_Object *mp_widget_rich_info_text_add(Evas_Object * parent, + const char *text); #endif diff --git a/src/common/mp-app.c b/src/common/mp-app.c index 52a82b1..d760cbf 100644 --- a/src/common/mp-app.c +++ b/src/common/mp-app.c @@ -60,7 +60,7 @@ typedef struct { mp_app_pipe_cb_type_e type; void *user_data; //Replaced for _prod dependency - sound_device_changed_info_e out; + sound_device_changed_info_e out; } mp_app_pipe_data_s; #ifdef MP_FEATURE_USB_OTG @@ -72,11 +72,10 @@ typedef struct { #define USB_STORAGE_REMOVED "removed" #endif -static Eina_Bool -_mp_app_ear_key_timer_cb(void *data) +static Eina_Bool _mp_app_ear_key_timer_cb(void *data) { EVENT_TRACE(""); - struct appdata *ad = (struct appdata *)data; + struct appdata *ad = (struct appdata *) data; if (ad->ear_key_press_cnt == 1) { DEBUG_TRACE("play/pause ctrl"); if (ad->player_state == PLAY_STATE_PLAYING) { @@ -113,12 +112,11 @@ _mp_app_ear_key_timer_cb(void *data) return EINA_FALSE; } -void -_mp_app_noti_key_changed_cb(const char *key, void *data) +void _mp_app_noti_key_changed_cb(const char *key, void *data) { EVENT_TRACE(""); - struct appdata *ad = (struct appdata *)data; + struct appdata *ad = (struct appdata *) data; MP_CHECK(ad); if (strcmp(key, MP_PREFKEY_PLAYING_PID) == 0) { @@ -127,7 +125,8 @@ _mp_app_noti_key_changed_cb(const char *key, void *data) #ifndef MP_SOUND_PLAYER if (!playing_pid) { if (ad->player_state == PLAY_STATE_PAUSED) { - DEBUG_TRACE("sound-player terminated.. show minicontroller"); + DEBUG_TRACE + ("sound-player terminated.. show minicontroller"); if (!ad->win_minicon) { mp_minicontroller_create(ad); @@ -147,27 +146,28 @@ _mp_app_noti_key_changed_cb(const char *key, void *data) } } else #endif - if (playing_pid != getpid()) { - DEBUG_TRACE("other player activated : [pid:%d]", playing_pid); - if (ad->player_state == PLAY_STATE_PLAYING) { - ad->paused_by_other_player = TRUE; - mp_play_control_play_pause(ad, false); - } - mp_minicontroller_destroy(ad); + if (playing_pid != getpid()) { + DEBUG_TRACE("other player activated : [pid:%d]", playing_pid); + if (ad->player_state == PLAY_STATE_PLAYING) { + ad->paused_by_other_player = TRUE; + mp_play_control_play_pause(ad, false); + } + mp_minicontroller_destroy(ad); #ifdef MP_FEATURE_LOCKSCREEN - mp_lockscreenmini_destroy(ad); + mp_lockscreenmini_destroy(ad); #endif - } + } } } void -_mp_app_storage_state_changed_cb(int storage_id, storage_state_e state, void *user_data) +_mp_app_storage_state_changed_cb(int storage_id, storage_state_e state, + void *user_data) { EVENT_TRACE(""); - struct appdata *ad = (struct appdata *)user_data; + struct appdata *ad = (struct appdata *) user_data; MP_CHECK(ad); char *path = NULL; ad->is_sdcard_removed = true; @@ -179,8 +179,10 @@ _mp_app_storage_state_changed_cb(int storage_id, storage_state_e state, void *us #endif } else if (state == STORAGE_STATE_UNMOUNTABLE) { char *mmc_path = MP_MMC_ROOT_PATH; - if (mmc_path && ad->current_track_info && ad->current_track_info->uri && (strstr(ad->current_track_info->uri, mmc_path) - == ad->current_track_info->uri)) { + if (mmc_path && ad->current_track_info + && ad->current_track_info->uri + && (strstr(ad->current_track_info->uri, mmc_path) + == ad->current_track_info->uri)) { IF_FREE(mmc_path); mp_play_next_and_updateview(ad); } else { @@ -194,7 +196,8 @@ _mp_app_storage_state_changed_cb(int storage_id, storage_state_e state, void *us } void -_mp_app_system_settings_changed_cb(system_settings_key_e key, void *user_data) +_mp_app_system_settings_changed_cb(system_settings_key_e key, + void *user_data) { EVENT_TRACE(""); DEBUG_TRACE("System Settings changed cb. Key is : %d", key); @@ -205,25 +208,29 @@ _mp_app_system_settings_changed_cb(system_settings_key_e key, void *user_data) if (key == SYSTEM_SETTINGS_KEY_LOCK_STATE) { system_settings_get_value_int(key, &lock_state); - if (lock_state == SYSTEM_SETTINGS_LOCK_STATE_LOCK && ad->player_state == PLAY_STATE_PAUSED) { + if (lock_state == SYSTEM_SETTINGS_LOCK_STATE_LOCK + && ad->player_state == PLAY_STATE_PAUSED) { /* Hide Lock Screen Handle */ ad->idle_unlocked = true; mp_ecore_timer_del(ad->lockmini_idle_timer); if (ad->win_lockmini) { mp_lockscreenmini_hide(ad); } - } else if (lock_state == SYSTEM_SETTINGS_LOCK_STATE_UNLOCK && ad->player_state == PLAY_STATE_PAUSED) { + } else if (lock_state == SYSTEM_SETTINGS_LOCK_STATE_UNLOCK + && ad->player_state == PLAY_STATE_PAUSED) { /* Starting Timer */ ad->idle_unlocked = false; mp_ecore_timer_del(ad->lockmini_idle_timer); - ad->lockmini_idle_timer = ecore_timer_add((2 * 60), _mp_lockscreenmini_hide_music_controller, ad); + ad->lockmini_idle_timer = + ecore_timer_add((2 * 60), + _mp_lockscreenmini_hide_music_controller, + ad); } } } #ifdef MP_FEATURE_PERSONAL_PAGE -void -_mp_app_personal_page_changed_cb(const char *key, void *data) +void _mp_app_personal_page_changed_cb(const char *key, void *data) { DEBUG_TRACE("personal page case changed"); @@ -239,7 +246,8 @@ _mp_app_personal_page_changed_cb(const char *key, void *data) //Replaced for _prod dependency start static void -_mp_add_available_route_changed_cb(sound_device_h device, bool available, void *user_data) +_mp_add_available_route_changed_cb(sound_device_h device, bool available, + void *user_data) { EVENT_TRACE("route: 0x%x, available: %d", device, available); MP_CHECK(gNotiPipe); @@ -252,15 +260,18 @@ _mp_add_available_route_changed_cb(sound_device_h device, bool available, void ecore_pipe_write(gNotiPipe, &pipe_data, sizeof(mp_app_pipe_data_s)); if (!available) { - struct appdata *ad = user_data; - MP_CHECK(ad); + struct appdata *ad = user_data; + MP_CHECK(ad); - mp_player_mgr_pause(ad); - } + mp_player_mgr_pause(ad); + } } + static void -_mp_app_active_device_chaged_cb(sound_device_h in, sound_device_changed_info_e out, void *user_data) +_mp_app_active_device_chaged_cb(sound_device_h in, + sound_device_changed_info_e out, + void *user_data) { EVENT_TRACE("input=[0x%x], output=[0x%x]", in, out); MP_CHECK(gNotiPipe); @@ -330,14 +341,18 @@ void _mp_app_db_update_cb(void *data) next_play = true; } - mp_playlist_mgr_check_existance_and_refresh(ad->playlist_mgr, ¤t_removed); + mp_playlist_mgr_check_existance_and_refresh(ad->playlist_mgr, + ¤t_removed); if (current_removed) { mp_play_destory(ad); if (mp_playlist_mgr_get_current(ad->playlist_mgr) == NULL) { if (ad->current_track_info) { //for lock-screen deleting thumbnail - if (mp_setting_read_playing_status(ad->current_track_info->uri, "stop") != 1) { - mp_setting_write_playing_status(ad->current_track_info->uri, "stop"); + if (mp_setting_read_playing_status + (ad->current_track_info->uri, "stop") != 1) { + mp_setting_write_playing_status(ad-> + current_track_info-> + uri, "stop"); } mp_util_free_track_info(ad->current_track_info); ad->current_track_info = NULL; @@ -352,19 +367,22 @@ void _mp_app_db_update_cb(void *data) } #endif - /*as all the items are removed, remove now-playing.ini to avoid copy the same track but in DB, they are different*/ + /*as all the items are removed, remove now-playing.ini to avoid copy the same track but in DB, they are different */ char *data_path = app_get_data_path(); - char nowplaying_ini[1024] = {0}; - snprintf(nowplaying_ini, 1024, "%s%s", data_path, MP_NOWPLAYING_INI_FILE_NAME); + char nowplaying_ini[1024] = { 0 }; + snprintf(nowplaying_ini, 1024, "%s%s", data_path, + MP_NOWPLAYING_INI_FILE_NAME); mp_file_remove(nowplaying_ini); - /* remove playing_track.ini to avoid lockscreen still using the file content*/ - char playing_ini[1024] = {0}; + /* remove playing_track.ini to avoid lockscreen still using the file content */ + char playing_ini[1024] = { 0 }; #ifndef MP_SOUND_PLAYER - snprintf(playing_ini, 1024, "%s%s", data_path, MP_PLAYING_INI_FILE_NAME_MUSIC); + snprintf(playing_ini, 1024, "%s%s", data_path, + MP_PLAYING_INI_FILE_NAME_MUSIC); free(data_path); mp_file_remove(playing_ini); #else - snprintf(playing_ini, 1024, "%s%s", data_path, MP_PLAYING_INI_FILE_NAME_SOUND); + snprintf(playing_ini, 1024, "%s%s", data_path, + MP_PLAYING_INI_FILE_NAME_SOUND); free(data_path); mp_file_remove(playing_ini); #endif @@ -380,51 +398,68 @@ void _mp_app_db_update_cb(void *data) MpView_t *view = mp_view_mgr_get_view(GET_VIEW_MGR, MP_VIEW_PLAYER); if (view) { - mp_view_update_options((MpView_t *)view); + mp_view_update_options((MpView_t *) view); } } -bool mp_app_get_supported_storages_callback(int storageId, storage_type_e type, storage_state_e state, const char *path, void *userData) +bool mp_app_get_supported_storages_callback(int storageId, + storage_type_e type, + storage_state_e state, + const char *path, + void *userData) { if (type == STORAGE_TYPE_EXTERNAL) { - struct appdata *ad = (struct appdata *)userData; + struct appdata *ad = (struct appdata *) userData; ad->mmc_id = storageId; return false; } return true; } -bool -mp_app_noti_init(void *data) +bool mp_app_noti_init(void *data) { startfunc; int retcode = -1; - struct appdata *ad = (struct appdata *)data; - int error = storage_foreach_device_supported(mp_app_get_supported_storages_callback, ad); + struct appdata *ad = (struct appdata *) data; + int error = + storage_foreach_device_supported + (mp_app_get_supported_storages_callback, ad); if (error == STORAGE_ERROR_NONE) { storage_state_e state; storage_get_state(ad->mmc_id, &state); } ad->idle_unlocked = false; bool res = TRUE; - retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE, _mp_app_system_settings_changed_cb, ad); + retcode = + system_settings_set_changed_cb + (SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE, + _mp_app_system_settings_changed_cb, ad); if (retcode != SYSTEM_SETTINGS_ERROR_NONE) { - ERROR_TRACE("Fail to register SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE key callback [%d]", retcode); + ERROR_TRACE + ("Fail to register SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE key callback [%d]", + retcode); res = FALSE; } - retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_LOCK_STATE, _mp_app_system_settings_changed_cb, ad); + retcode = + system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_LOCK_STATE, + _mp_app_system_settings_changed_cb, + ad); if (retcode != SYSTEM_SETTINGS_ERROR_NONE) { - ERROR_TRACE("Fail to register SYSTEM_SETTINGS_KEY_LOCK_STATE key callback [%d]", retcode); + ERROR_TRACE + ("Fail to register SYSTEM_SETTINGS_KEY_LOCK_STATE key callback [%d]", + retcode); res = FALSE; } - if (storage_set_state_changed_cb(ad->mmc_id, _mp_app_storage_state_changed_cb, ad) < 0) { + if (storage_set_state_changed_cb + (ad->mmc_id, _mp_app_storage_state_changed_cb, ad) < 0) { ERROR_TRACE("Fail to register storage state changed callback"); res = FALSE; } #ifdef MP_FEATURE_PERSONAL_PAGE - if (preference_set_changed_cb(KEY_MP_PERSONAL_PAGE, _mp_app_personal_page_changed_cb, ad) < 0) { + if (preference_set_changed_cb + (KEY_MP_PERSONAL_PAGE, _mp_app_personal_page_changed_cb, ad) < 0) { ERROR_TRACE("Fail to register KEY_MP_PERSONAL_PAGE key callback"); res = FALSE; } @@ -433,42 +468,54 @@ mp_app_noti_init(void *data) gNotiPipe = ecore_pipe_add(_mp_app_noti_pipe_handler, ad); //Replaced for _prod dependency start WARN_TRACE("Enter sound_manager_set_available_route_changed_cb"); - int ret = sound_manager_set_device_connected_cb(SOUND_DEVICE_ALL_MASK, _mp_add_available_route_changed_cb, ad); + int ret = + sound_manager_set_device_connected_cb(SOUND_DEVICE_ALL_MASK, + _mp_add_available_route_changed_cb, + ad); if (ret != SOUND_MANAGER_ERROR_NONE) { - ERROR_TRACE("sound_manager_set_available_route_changed_cb().. [0x%x]", ret); + ERROR_TRACE + ("sound_manager_set_available_route_changed_cb().. [0x%x]", + ret); res = FALSE; } WARN_TRACE("Leave sound_manager_set_available_route_changed_cb"); WARN_TRACE("Enter sound_manager_set_active_device_changed_cb"); - ret = sound_manager_set_device_information_changed_cb(SOUND_DEVICE_ALL_MASK, _mp_app_active_device_chaged_cb, ad); + ret = + sound_manager_set_device_information_changed_cb + (SOUND_DEVICE_ALL_MASK, _mp_app_active_device_chaged_cb, ad); if (ret != SOUND_MANAGER_ERROR_NONE) { - ERROR_TRACE("sound_manager_set_active_device_changed_cb().. [0x%x]", ret); + ERROR_TRACE + ("sound_manager_set_active_device_changed_cb().. [0x%x]", ret); res = FALSE; } WARN_TRACE("Leave sound_manager_set_active_device_changed_cb"); ret = mp_media_info_set_db_update_cb(_mp_app_db_update_cb, NULL); if (ret != 0) { - ERROR_TRACE("Error from mp_media_info_set_db_update_cb [0x%x]", ret); + ERROR_TRACE("Error from mp_media_info_set_db_update_cb [0x%x]", + ret); } return res; } -bool -mp_app_noti_ignore(void *data) +bool mp_app_noti_ignore(void *data) { - struct appdata *ad = (struct appdata *)data; + struct appdata *ad = (struct appdata *) data; int retcode = -1; int ret = 0; - retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE); + retcode = + system_settings_unset_changed_cb + (SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE); if (retcode != SYSTEM_SETTINGS_ERROR_NONE) { ERROR_TRACE("Error when ignore callback [%d]", retcode); return FALSE; } - if (storage_unset_state_changed_cb(ad->mmc_id, _mp_app_storage_state_changed_cb) != STORAGE_ERROR_NONE) { + if (storage_unset_state_changed_cb + (ad->mmc_id, + _mp_app_storage_state_changed_cb) != STORAGE_ERROR_NONE) { ERROR_TRACE("Error when ignore callback"); return FALSE; } @@ -480,14 +527,14 @@ mp_app_noti_ignore(void *data) ret = mp_media_info_unset_db_update_cb(); if (ret != 0) { - ERROR_TRACE("Error from mp_media_info_unset_db_update_cb [0x%x]", ret); + ERROR_TRACE("Error from mp_media_info_unset_db_update_cb [0x%x]", + ret); } return TRUE; } -Eina_Bool -mp_app_key_down_cb(void *data, int type, void *event) +Eina_Bool mp_app_key_down_cb(void *data, int type, void *event) { struct appdata *ad = data; MP_CHECK_VAL(ad, ECORE_CALLBACK_PASS_ON); @@ -505,9 +552,13 @@ mp_app_key_down_cb(void *data, int type, void *event) } else if (!g_strcmp0(key->keyname, "XF86AudioMedia")) { ad->press_time = key->timestamp; } else if (!g_strcmp0(key->keyname, "Down")) { - DEBUG_TRACE("focused object is %s", elm_object_widget_type_get(elm_object_focused_object_get(ad->win_main))); + DEBUG_TRACE("focused object is %s", + elm_object_widget_type_get + (elm_object_focused_object_get(ad->win_main))); } else if (!g_strcmp0(key->keyname, "Up")) { - DEBUG_TRACE("focused object is %s", elm_object_widget_type_get(elm_object_focused_object_get(ad->win_main))); + DEBUG_TRACE("focused object is %s", + elm_object_widget_type_get + (elm_object_focused_object_get(ad->win_main))); } else if (!g_strcmp0(key->keyname, "XF86AudioPrev")) { mp_play_control_prev(); } else if (!g_strcmp0(key->keyname, "XF86AudioNext")) { @@ -517,8 +568,7 @@ mp_app_key_down_cb(void *data, int type, void *event) return ECORE_CALLBACK_PASS_ON; } -Eina_Bool -mp_app_key_up_cb(void *data, int type, void *event) +Eina_Bool mp_app_key_up_cb(void *data, int type, void *event) { struct appdata *ad = data; MP_CHECK_VAL(ad, ECORE_CALLBACK_PASS_ON); @@ -549,7 +599,8 @@ mp_app_key_up_cb(void *data, int type, void *event) app_control_destroy(app_control); ad->ear_key_press_cnt = 0; } else { - ad->ear_key_timer = ecore_timer_add(0.5, _mp_app_ear_key_timer_cb, ad); + ad->ear_key_timer = + ecore_timer_add(0.5, _mp_app_ear_key_timer_cb, ad); ad->ear_key_press_cnt++; } } @@ -563,8 +614,7 @@ mp_app_key_up_cb(void *data, int type, void *event) } -Eina_Bool -mp_app_mouse_event_cb(void *data, int type, void *event) +Eina_Bool mp_app_mouse_event_cb(void *data, int type, void *event) { struct appdata *ad = data; @@ -576,7 +626,7 @@ mp_app_mouse_event_cb(void *data, int type, void *event) ad->mouse.downed = TRUE; ad->mouse.sx = ev->root.x; ad->mouse.sy = ev->root.y; - // buttons = ev->buttons; + // buttons = ev->buttons; } } else if (type == ECORE_EVENT_MOUSE_BUTTON_UP) { ad->mouse.sx = 0; @@ -595,8 +645,7 @@ void mp_exit_job_cb(void *data) elm_exit(); } -void -mp_app_exit(void *data) +void mp_app_exit(void *data) { struct appdata *ad = data; mp_retm_if(ad == NULL, "appdata is NULL"); @@ -622,15 +671,18 @@ _mp_app_create_default_playing_list(struct appdata *ad, int index) MP_CHECK(ad->playlist_mgr); mp_playlist_mgr_clear(ad->playlist_mgr); mp_media_info_list_count(MP_TRACK_ALL, NULL, NULL, NULL, 0, &count); - mp_media_info_list_create(&all, MP_TRACK_ALL, NULL, NULL, NULL, 0, 0, count); - mp_util_append_media_list_item_to_playlist(ad->playlist_mgr, all, count, index, NULL); + mp_media_info_list_create(&all, MP_TRACK_ALL, NULL, NULL, NULL, 0, 0, + count); + mp_util_append_media_list_item_to_playlist(ad->playlist_mgr, all, + count, index, NULL); mp_media_info_list_destroy(all); } void -_mp_app_media_key_event_cb(media_key_e key, media_key_event_e event, void *user_data) +_mp_app_media_key_event_cb(media_key_e key, media_key_event_e event, + void *user_data) { - struct appdata *ad = (struct appdata *)user_data; + struct appdata *ad = (struct appdata *) user_data; MP_CHECK(ad); EVENT_TRACE("key [%d], event [%d]", key, event); @@ -647,19 +699,26 @@ _mp_app_media_key_event_cb(media_key_e key, media_key_event_e event, void *user_ DEBUG_TRACE("Media Key : %d", key); if (_mp_is_current_focus_available(ad) != 0) { if (key == MEDIA_KEY_PLAY) { - ERROR_TRACE("Some other application has the focus currently... Returning..."); + ERROR_TRACE + ("Some other application has the focus currently... Returning..."); char *message = STR_MP_UNABLE_TO_PLAY_DURING_CALL; if (message) { - int ret = notification_status_message_post(dgettext("music-player", message)); + int ret = + notification_status_message_post(dgettext + ("music-player", + message)); if (ret != 0) { - ERROR_TRACE("notification_status_message_post()... [0x%x]", ret); + ERROR_TRACE + ("notification_status_message_post()... [0x%x]", + ret); } else { DEBUG_TRACE("message: [%s]", message); } } return; } else { - ERROR_TRACE("Some other application has the focus currently... Changing state in paused state..."); + ERROR_TRACE + ("Some other application has the focus currently... Changing state in paused state..."); ad->paused_by_user = TRUE; } } @@ -669,9 +728,10 @@ _mp_app_media_key_event_cb(media_key_e key, media_key_event_e event, void *user_ if (released) { if (ad->player_state != PLAY_STATE_PLAYING) { if (ad->player_state == PLAY_STATE_PAUSED) { - mp_play_control_resume_via_media_key(ad); // workaround for Audi car-kit + mp_play_control_resume_via_media_key(ad); // workaround for Audi car-kit } else { - if (ad->playlist_mgr == NULL || mp_playlist_mgr_count(ad->playlist_mgr) == 0) { + if (ad->playlist_mgr == NULL + || mp_playlist_mgr_count(ad->playlist_mgr) == 0) { _mp_app_create_default_playing_list(ad, 0); } mp_play_control_play_pause(ad, true); @@ -691,9 +751,10 @@ _mp_app_media_key_event_cb(media_key_e key, media_key_event_e event, void *user_ if (ad->player_state == PLAY_STATE_PLAYING) { mp_play_control_play_pause(ad, false); } else if (ad->player_state == PLAY_STATE_PAUSED) { - mp_play_control_resume_via_media_key(ad); // workaround for Audi car-kit + mp_play_control_resume_via_media_key(ad); // workaround for Audi car-kit } else { - if (ad->playlist_mgr == NULL || mp_playlist_mgr_count(ad->playlist_mgr) == 0) { + if (ad->playlist_mgr == NULL + || mp_playlist_mgr_count(ad->playlist_mgr) == 0) { _mp_app_create_default_playing_list(ad, 0); } mp_play_control_play_pause(ad, true); @@ -722,7 +783,8 @@ _mp_app_media_key_event_cb(media_key_e key, media_key_event_e event, void *user_ mp_player_mgr_set_position(0, NULL, NULL); ad->music_pos = 0; - MpView_t *view = mp_view_mgr_get_view(GET_VIEW_MGR, MP_VIEW_PLAYER); + MpView_t *view = + mp_view_mgr_get_view(GET_VIEW_MGR, MP_VIEW_PLAYER); if (view) { mp_player_view_update_progressbar(view); } @@ -734,8 +796,7 @@ _mp_app_media_key_event_cb(media_key_e key, media_key_event_e event, void *user_ } } -bool -mp_app_grab_mm_keys(struct appdata *ad) +bool mp_app_grab_mm_keys(struct appdata *ad) { WARN_TRACE(""); Eina_Bool error = EINA_FALSE; @@ -752,8 +813,7 @@ mp_app_grab_mm_keys(struct appdata *ad) return true; } -void -mp_app_ungrab_mm_keys(struct appdata *ad) +void mp_app_ungrab_mm_keys(struct appdata *ad) { WARN_TRACE(""); media_key_release(); @@ -767,8 +827,7 @@ mp_app_ungrab_mm_keys(struct appdata *ad) } #ifdef MP_FEATURE_AUTO_OFF -Eina_Bool -mp_app_auto_off_timer_expired_cb(void *data) +Eina_Bool mp_app_auto_off_timer_expired_cb(void *data) { struct appdata *ad = data; MP_CHECK_VAL(ad, ECORE_CALLBACK_CANCEL); @@ -783,7 +842,9 @@ mp_app_auto_off_timer_expired_cb(void *data) } else { mp_debug("auto off expired but not playing"); MpView_t *top_view = mp_view_mgr_get_top_view(GET_VIEW_MGR); - if (top_view && top_view == mp_view_mgr_get_view(GET_VIEW_MGR, MP_VIEW_SETTING)) { + if (top_view + && top_view == mp_view_mgr_get_view(GET_VIEW_MGR, + MP_VIEW_SETTING)) { mp_view_update(top_view); } } @@ -791,8 +852,7 @@ mp_app_auto_off_timer_expired_cb(void *data) return ECORE_CALLBACK_DONE; } -void -mp_app_auto_off_changed_cb(int min, void *data) +void mp_app_auto_off_changed_cb(int min, void *data) { struct appdata *ad = data; MP_CHECK(ad); @@ -806,12 +866,12 @@ mp_app_auto_off_changed_cb(int min, void *data) } double timeout = min * 60; - ad->auto_off_timer = ecore_timer_add(timeout, mp_app_auto_off_timer_expired_cb, ad); + ad->auto_off_timer = + ecore_timer_add(timeout, mp_app_auto_off_timer_expired_cb, ad); } #endif #ifdef MP_FEATURE_PLAY_SPEED -void -mp_app_play_speed_changed_cb(double speed, void *data) +void mp_app_play_speed_changed_cb(double speed, void *data) { struct appdata *ad = data; MP_CHECK(ad); @@ -820,4 +880,3 @@ mp_app_play_speed_changed_cb(double speed, void *data) mp_player_mgr_set_play_speed(speed); } #endif - diff --git a/src/common/mp-common.c b/src/common/mp-common.c index 6118347..13ba537 100644 --- a/src/common/mp-common.c +++ b/src/common/mp-common.c @@ -56,11 +56,12 @@ #ifndef MP_SOUND_PLAYER -void -mp_common_show_setting_view(void) +void mp_common_show_setting_view(void) { MpViewMgr_t *view_mgr = GET_VIEW_MGR; - MpView_t *setting_view = (MpView_t*)mp_setting_view_create(view_mgr->navi, MP_SETTING_VIEW_DEFAULT, NULL); + MpView_t *setting_view = + (MpView_t *) mp_setting_view_create(view_mgr->navi, + MP_SETTING_VIEW_DEFAULT, NULL); mp_view_mgr_push_view(view_mgr, setting_view, NULL); mp_view_set_title(setting_view, STR_MP_SETTINGS); mp_view_update_options(setting_view); @@ -75,35 +76,40 @@ mp_common_view_cancel_cb(void *data, Evas_Object * obj, void *event_info) elm_naviframe_item_pop(view_mgr->navi); } -void -mp_common_add_to_playlsit_view(void *list_view) +void mp_common_add_to_playlsit_view(void *list_view) { MpListView_t *view = list_view; #ifdef MP_FEATURE_PERSONAL_PAGE - MpEditView_t *edit_view = mp_edit_view_create(GET_NAVIFRAME, view->content_to_show, false, MP_EDIT_VIEW_PERSONAL_PAGE_NONE); + MpEditView_t *edit_view = + mp_edit_view_create(GET_NAVIFRAME, view->content_to_show, false, + MP_EDIT_VIEW_PERSONAL_PAGE_NONE); MP_CHECK(edit_view); #else - MpEditView_t *edit_view = mp_edit_view_create(GET_NAVIFRAME, view->content_to_show, false); + MpEditView_t *edit_view = + mp_edit_view_create(GET_NAVIFRAME, view->content_to_show, false); #endif edit_view->create_playlist = true; - mp_view_mgr_push_view(GET_VIEW_MGR, (MpView_t *)edit_view, NULL); - mp_view_update((MpView_t *)edit_view); - mp_view_update_options((MpView_t *)edit_view); - mp_view_set_title((MpView_t *)edit_view, STR_MP_TILTE_SELECT_ITEM); - mp_list_view_set_select_all((MpListView_t*)edit_view, true); - mp_list_view_set_done_btn((MpListView_t*)edit_view, true, MP_DONE_ADD_TO_TYPE); - mp_list_view_set_cancel_btn((MpListView_t*)edit_view, true); + mp_view_mgr_push_view(GET_VIEW_MGR, (MpView_t *) edit_view, NULL); + mp_view_update((MpView_t *) edit_view); + mp_view_update_options((MpView_t *) edit_view); + mp_view_set_title((MpView_t *) edit_view, STR_MP_TILTE_SELECT_ITEM); + mp_list_view_set_select_all((MpListView_t *) edit_view, true); + mp_list_view_set_done_btn((MpListView_t *) edit_view, true, + MP_DONE_ADD_TO_TYPE); + mp_list_view_set_cancel_btn((MpListView_t *) edit_view, true); } -void -mp_common_set_list_to_reorder_view(void *list_view) +void mp_common_set_list_to_reorder_view(void *list_view) { MpListView_t *view = list_view; #ifdef MP_FEATURE_PERSONAL_PAGE - MpEditView_t *edit_view = mp_edit_view_create(GET_NAVIFRAME, view->content_to_show, false, MP_EDIT_VIEW_PERSONAL_PAGE_NONE); + MpEditView_t *edit_view = + mp_edit_view_create(GET_NAVIFRAME, view->content_to_show, false, + MP_EDIT_VIEW_PERSONAL_PAGE_NONE); #else - MpEditView_t *edit_view = mp_edit_view_create(GET_NAVIFRAME, view->content_to_show, false); + MpEditView_t *edit_view = + mp_edit_view_create(GET_NAVIFRAME, view->content_to_show, false); #endif if (edit_view == NULL) { ERROR_TRACE("Unable to create edit view"); @@ -112,13 +118,14 @@ mp_common_set_list_to_reorder_view(void *list_view) edit_view->list_mode = MP_EDIT_VIEW_REORDER; edit_view->content_to_show->reorderable = 1; - mp_view_mgr_push_view(GET_VIEW_MGR, (MpView_t *)edit_view, NULL); - mp_view_update((MpView_t *)edit_view); - mp_view_update_options((MpView_t *)edit_view); - mp_view_set_title((MpView_t *)edit_view, STR_MP_REORDER); - mp_list_view_set_select_all((MpListView_t*)edit_view, false); - mp_list_view_set_done_btn((MpListView_t*)edit_view, true, MP_DONE_REORDER_TYPE); - mp_list_view_set_cancel_btn((MpListView_t*)edit_view, true); + mp_view_mgr_push_view(GET_VIEW_MGR, (MpView_t *) edit_view, NULL); + mp_view_update((MpView_t *) edit_view); + mp_view_update_options((MpView_t *) edit_view); + mp_view_set_title((MpView_t *) edit_view, STR_MP_REORDER); + mp_list_view_set_select_all((MpListView_t *) edit_view, false); + mp_list_view_set_done_btn((MpListView_t *) edit_view, true, + MP_DONE_REORDER_TYPE); + mp_list_view_set_cancel_btn((MpListView_t *) edit_view, true); } void @@ -126,37 +133,43 @@ mp_common_show_edit_view(void *list_view, mp_done_operator_type_t type) { MpListView_t *view = list_view; #ifdef MP_FEATURE_PERSONAL_PAGE - MpEditView_t *edit_view = mp_edit_view_create(GET_NAVIFRAME, view->content_to_show, false, MP_EDIT_VIEW_PERSONAL_PAGE_NONE); + MpEditView_t *edit_view = + mp_edit_view_create(GET_NAVIFRAME, view->content_to_show, false, + MP_EDIT_VIEW_PERSONAL_PAGE_NONE); #else - MpEditView_t *edit_view = mp_edit_view_create(GET_NAVIFRAME, view->content_to_show, false); + MpEditView_t *edit_view = + mp_edit_view_create(GET_NAVIFRAME, view->content_to_show, false); #endif - mp_view_mgr_push_view(GET_VIEW_MGR, (MpView_t *)edit_view, NULL); - mp_view_update((MpView_t *)edit_view); - mp_view_update_options((MpView_t *)edit_view); + mp_view_mgr_push_view(GET_VIEW_MGR, (MpView_t *) edit_view, NULL); + mp_view_update((MpView_t *) edit_view); + mp_view_update_options((MpView_t *) edit_view); - mp_view_set_title((MpView_t *)edit_view, STR_MP_TILTE_SELECT_ITEM); - mp_list_view_set_select_all((MpListView_t*)edit_view, true); - mp_list_view_set_cancel_btn((MpListView_t*)edit_view, true); - mp_list_view_set_done_btn((MpListView_t*)edit_view, true, type); + mp_view_set_title((MpView_t *) edit_view, STR_MP_TILTE_SELECT_ITEM); + mp_list_view_set_select_all((MpListView_t *) edit_view, true); + mp_list_view_set_cancel_btn((MpListView_t *) edit_view, true); + mp_list_view_set_done_btn((MpListView_t *) edit_view, true, type); } -void mp_common_genlist_checkbox_sel_cb(void *data, Evas_Object *obj, void *event_info) +void mp_common_genlist_checkbox_sel_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; - mp_list_item_data_t *it_data = (mp_list_item_data_t *)data; + mp_list_item_data_t *it_data = (mp_list_item_data_t *) data; MP_CHECK(it_data); - Elm_Object_Item *gli = (Elm_Object_Item *)it_data->it; + Elm_Object_Item *gli = (Elm_Object_Item *) it_data->it; mp_list_item_selected_set(gli, EINA_FALSE); it_data->checked = !it_data->checked; - elm_genlist_item_fields_update(gli, "elm.edit.icon.1", ELM_GENLIST_ITEM_FIELD_CONTENT); + elm_genlist_item_fields_update(gli, "elm.edit.icon.1", + ELM_GENLIST_ITEM_FIELD_CONTENT); return; } -void mp_common_ctxpopup_setting_cb(void *data, Evas_Object *obj, void *event_info) +void mp_common_ctxpopup_setting_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; MpView_t *view = data; @@ -165,7 +178,8 @@ void mp_common_ctxpopup_setting_cb(void *data, Evas_Object *obj, void *event_inf } -void mp_common_ctxpopup_end_cb(void *data, Evas_Object *obj, void *event_info) +void mp_common_ctxpopup_end_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; MpView_t *view = data; @@ -173,7 +187,8 @@ void mp_common_ctxpopup_end_cb(void *data, Evas_Object *obj, void *event_info) elm_exit(); } -void mp_common_go_to_library_cb(void *data, Evas_Object *obj, void *event_info) +void mp_common_go_to_library_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; MpView_t *view = data; @@ -182,7 +197,8 @@ void mp_common_go_to_library_cb(void *data, Evas_Object *obj, void *event_info) mp_view_mgr_pop_to_view(GET_VIEW_MGR, MP_VIEW_ALL); } -void mp_common_ctxpopup_add_to_playlist_cb(void *data, Evas_Object *obj, void *event_info) +void mp_common_ctxpopup_add_to_playlist_cb(void *data, Evas_Object * obj, + void *event_info) { startfunc; MpListView_t *view = data; @@ -195,7 +211,8 @@ void mp_common_ctxpopup_add_to_playlist_cb(void *data, Evas_Object *obj, void *e } //sweep button callback (genlist type should be ctx) and popup need to be destoryed in idler -void mp_common_sweep_share_cb(void *data, Evas_Object * obj, void *event_info) +void mp_common_sweep_share_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; MP_CHECK(data); @@ -214,17 +231,17 @@ void mp_common_sweep_share_cb(void *data, Evas_Object * obj, void *event_info) //common button callback (genlist type should be center) void -mp_common_button_add_to_playlist_cb(void *data, Evas_Object * obj, void *event_info) +mp_common_button_add_to_playlist_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; mp_edit_create_add_to_playlist_popup(data); } -void -mp_common_share_cb(void *data, Evas_Object * obj, void *event_info) +void mp_common_share_cb(void *data, Evas_Object * obj, void *event_info) { eventfunc; - MpListView_t *view = (MpListView_t *)data; + MpListView_t *view = (MpListView_t *) data; MP_CHECK(view); MpList_t *list = view->content_to_show; MP_CHECK(list); @@ -233,35 +250,40 @@ mp_common_share_cb(void *data, Evas_Object * obj, void *event_info) #ifdef MP_FEATURE_PERSONAL_PAGE - MpEditView_t *edit_view = mp_edit_view_create(GET_NAVIFRAME, view->content_to_show, true, MP_EDIT_VIEW_PERSONAL_PAGE_NONE); + MpEditView_t *edit_view = + mp_edit_view_create(GET_NAVIFRAME, view->content_to_show, true, + MP_EDIT_VIEW_PERSONAL_PAGE_NONE); #else - MpEditView_t *edit_view = mp_edit_view_create(GET_NAVIFRAME, view->content_to_show, true); + MpEditView_t *edit_view = + mp_edit_view_create(GET_NAVIFRAME, view->content_to_show, true); #endif - mp_view_mgr_push_view(GET_VIEW_MGR, (MpView_t *)edit_view, NULL); - mp_view_update((MpView_t *)edit_view); - mp_view_update_options((MpView_t *)edit_view); - mp_view_set_title((MpView_t *)edit_view, STR_MP_SHARE); - mp_list_view_set_select_all((MpListView_t*)edit_view, true); + mp_view_mgr_push_view(GET_VIEW_MGR, (MpView_t *) edit_view, NULL); + mp_view_update((MpView_t *) edit_view); + mp_view_update_options((MpView_t *) edit_view); + mp_view_set_title((MpView_t *) edit_view, STR_MP_SHARE); + mp_list_view_set_select_all((MpListView_t *) edit_view, true); } void -mp_common_button_share_list_cb(void *data, Evas_Object * obj, void *event_info) +mp_common_button_share_list_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); - MpListView_t *view = (MpListView_t *)data; + MpListView_t *view = (MpListView_t *) data; MP_CHECK(view); MpList_t *list = view->content_to_show; MP_CHECK(list); GList *sel_list = NULL; - mp_list_selected_item_data_get(list, &sel_list); + mp_list_selected_item_data_get(list, &sel_list); if (g_list_length(sel_list) == 0) { - mp_widget_text_popup(ad, GET_STR("IDS_MUSIC_POP_NOTHING_SELECTED")); + mp_widget_text_popup(ad, + GET_STR("IDS_MUSIC_POP_NOTHING_SELECTED")); return; } @@ -281,13 +303,15 @@ mp_common_button_share_list_cb(void *data, Evas_Object * obj, void *event_info) node = g_list_next(node); } - mp_genlist_popup_create(view->layout, MP_POPUP_LIST_SHARE, sel_list, ad); + mp_genlist_popup_create(view->layout, MP_POPUP_LIST_SHARE, sel_list, + ad); //evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, _popup_del_free_resource_cb, sel_list); return; } void -mp_common_button_delete_list_cb(void *data, Evas_Object * obj, void *event_info) +mp_common_button_delete_list_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; mp_edit_create_delete_popup(data); @@ -297,7 +321,7 @@ mp_common_button_delete_list_cb(void *data, Evas_Object * obj, void *event_info) #endif static void -_ctx_popup_dismissed_cb(void *data, Evas_Object *obj, void *event_info) +_ctx_popup_dismissed_cb(void *data, Evas_Object * obj, void *event_info) { startfunc; MP_CHECK(data); @@ -305,7 +329,8 @@ _ctx_popup_dismissed_cb(void *data, Evas_Object *obj, void *event_info) } static void -_ctx_popup_naviframe_resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +_ctx_popup_naviframe_resize_cb(void *data, Evas * e, Evas_Object * obj, + void *event_info) { MpView_t *view = data; MP_CHECK(view); @@ -340,9 +365,11 @@ _ctx_popup_naviframe_resize_cb(void *data, Evas *e, Evas_Object *obj, void *even } static void -_ctx_popup_top_widget_rotation_changed_cb(void *data, Evas_Object *obj, void *event_info) +_ctx_popup_top_widget_rotation_changed_cb(void *data, Evas_Object * obj, + void *event_info) { - _ctx_popup_naviframe_resize_cb(data, evas_object_evas_get(obj), obj, event_info); + _ctx_popup_naviframe_resize_cb(data, evas_object_evas_get(obj), obj, + event_info); } static void @@ -358,38 +385,51 @@ _ctx_popup_del_cb(void *data, Evas * e, Evas_Object * eo, void *event_info) Evas_Object *navi = GET_NAVIFRAME; if (navi) { - evas_object_event_callback_del(navi, EVAS_CALLBACK_RESIZE, _ctx_popup_naviframe_resize_cb); + evas_object_event_callback_del(navi, EVAS_CALLBACK_RESIZE, + _ctx_popup_naviframe_resize_cb); } - evas_object_smart_callback_del(elm_object_top_widget_get(eo), "rotation,changed", _ctx_popup_top_widget_rotation_changed_cb); + evas_object_smart_callback_del(elm_object_top_widget_get(eo), + "rotation,changed", + _ctx_popup_top_widget_rotation_changed_cb); MpView_t *view = data; MP_CHECK(view); view->more_btn_ctxpopup = NULL; } -Evas_Object * -mp_common_create_more_ctxpopup(void *view) +Evas_Object *mp_common_create_more_ctxpopup(void *view) { Evas_Object *popup = elm_ctxpopup_add(GET_WINDOW()); elm_object_style_set(popup, "more/default"); - evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, _ctx_popup_del_cb, view); - evas_object_smart_callback_add(popup, "dismissed", _ctx_popup_dismissed_cb, popup); - eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, eext_ctxpopup_back_cb, NULL); - eext_object_event_callback_add(popup, EEXT_CALLBACK_MORE, eext_ctxpopup_back_cb, NULL); + evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, + _ctx_popup_del_cb, view); + evas_object_smart_callback_add(popup, "dismissed", + _ctx_popup_dismissed_cb, popup); + eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, + eext_ctxpopup_back_cb, NULL); + eext_object_event_callback_add(popup, EEXT_CALLBACK_MORE, + eext_ctxpopup_back_cb, NULL); elm_ctxpopup_auto_hide_disabled_set(popup, EINA_TRUE); - evas_object_event_callback_add(elm_object_top_widget_get(popup), EVAS_CALLBACK_RESIZE, _ctx_popup_naviframe_resize_cb, view); - evas_object_smart_callback_add(elm_object_top_widget_get(popup), "rotation,changed", _ctx_popup_top_widget_rotation_changed_cb, view); - elm_ctxpopup_direction_priority_set(popup, ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_UNKNOWN, ELM_CTXPOPUP_DIRECTION_UNKNOWN, ELM_CTXPOPUP_DIRECTION_UNKNOWN); + evas_object_event_callback_add(elm_object_top_widget_get(popup), + EVAS_CALLBACK_RESIZE, + _ctx_popup_naviframe_resize_cb, view); + evas_object_smart_callback_add(elm_object_top_widget_get(popup), + "rotation,changed", + _ctx_popup_top_widget_rotation_changed_cb, + view); + elm_ctxpopup_direction_priority_set(popup, ELM_CTXPOPUP_DIRECTION_UP, + ELM_CTXPOPUP_DIRECTION_UNKNOWN, + ELM_CTXPOPUP_DIRECTION_UNKNOWN, + ELM_CTXPOPUP_DIRECTION_UNKNOWN); return popup; } #ifndef MP_SOUND_PLAYER -static Eina_Bool -_mp_timer_delay_cb(void *data) +static Eina_Bool _mp_timer_delay_cb(void *data) { TIMER_TRACE(); @@ -401,10 +441,11 @@ _mp_timer_delay_cb(void *data) GList *sel_list = NULL; mp_list_item_data_t *item_data = NULL; - mp_list_selected_item_data_get(list, &sel_list); + mp_list_selected_item_data_get(list, &sel_list); if (g_list_length(sel_list) == 0) { - mp_widget_text_popup(ad, GET_STR("IDS_MUSIC_POP_NOTHING_SELECTED")); + mp_widget_text_popup(ad, + GET_STR("IDS_MUSIC_POP_NOTHING_SELECTED")); return false; } @@ -416,7 +457,8 @@ _mp_timer_delay_cb(void *data) if (MP_POPUP_PV_SET_AS == list->popup_type) { if (item_data && item_data->handle) { - mp_genlist_popup_create(list->genlist, MP_POPUP_PV_SET_AS, item_data->handle, ad); + mp_genlist_popup_create(list->genlist, MP_POPUP_PV_SET_AS, + item_data->handle, ad); } } else if (MP_POPUP_ADD_TO_PLST == list->popup_type) { mp_edit_create_add_to_playlist_popup(data); @@ -430,7 +472,8 @@ _mp_timer_delay_cb(void *data) } #endif -static void _mp_common_set_label_for_detail(Evas_Object *pBox, char *szString) +static void _mp_common_set_label_for_detail(Evas_Object * pBox, + char *szString) { Evas_Object *pLabel = NULL; @@ -440,9 +483,13 @@ static void _mp_common_set_label_for_detail(Evas_Object *pBox, char *szString) pLabel = elm_label_add(pBox); elm_object_text_set(pLabel, szString); elm_label_line_wrap_set(pLabel, ELM_WRAP_MIXED); - evas_object_size_hint_weight_set(pLabel, EVAS_HINT_FILL, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(pLabel, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_min_set(pLabel, 0, MP_POPUP_DETAIL_ITEM_H * elm_config_scale_get()); + evas_object_size_hint_weight_set(pLabel, EVAS_HINT_FILL, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(pLabel, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_size_hint_min_set(pLabel, 0, + MP_POPUP_DETAIL_ITEM_H * + elm_config_scale_get()); elm_box_pack_end(pBox, pLabel); evas_object_show(pLabel); @@ -462,13 +509,14 @@ static void _mp_common_list_track_more_detail(void *parent, void *data) Evas_Object *pBox = NULL; Evas_Object *pop_scroller = NULL; - char szTmpStr[MP_STR_LEN_MAX] = {0,}; + char szTmpStr[MP_STR_LEN_MAX] = { 0, }; mp_list_item_data_t *item_data = NULL; - mp_list_selected_item_data_get(list, &sel_list); + mp_list_selected_item_data_get(list, &sel_list); if (g_list_length(sel_list) == 0) { - mp_widget_text_popup(ad, GET_STR("IDS_MUSIC_POP_NOTHING_SELECTED")); + mp_widget_text_popup(ad, + GET_STR("IDS_MUSIC_POP_NOTHING_SELECTED")); return; } @@ -480,8 +528,8 @@ static void _mp_common_list_track_more_detail(void *parent, void *data) pop_layout = elm_layout_add(popup); MP_CHECK(pop_layout); - char edje_path[1024] ={0}; - char * path = app_get_resource_path(); + char edje_path[1024] = { 0 }; + char *path = app_get_resource_path(); MP_CHECK(path); snprintf(edje_path, 1024, "%s%s/%s", path, "edje", MP_EDJ_NAME); @@ -490,7 +538,8 @@ static void _mp_common_list_track_more_detail(void *parent, void *data) pBox = elm_box_add(popup); elm_box_horizontal_set(pBox, EINA_FALSE); - evas_object_size_hint_weight_set(pBox, EVAS_HINT_FILL, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(pBox, EVAS_HINT_FILL, + EVAS_HINT_EXPAND); evas_object_size_hint_align_set(pBox, EVAS_HINT_FILL, EVAS_HINT_FILL); mp_media_info_h svc_item = NULL; @@ -498,7 +547,8 @@ static void _mp_common_list_track_more_detail(void *parent, void *data) svc_item = item_data->handle; } - char *pathname = NULL, *title = NULL, *album = NULL, *artist = NULL, *thumbname = NULL, *date = NULL; + char *pathname = NULL, *title = NULL, *album = NULL, *artist = + NULL, *thumbname = NULL, *date = NULL; char *author = NULL, *copyright = NULL, *format = NULL, *track = NULL; int duration = 0; @@ -519,18 +569,21 @@ static void _mp_common_list_track_more_detail(void *parent, void *data) char *info_format = "%s: %s "; - snprintf(szTmpStr, MP_STR_LEN_MAX, info_format, GET_SYS_STR("IDS_COM_BODY_DETAILS_TITLE"), title); + snprintf(szTmpStr, MP_STR_LEN_MAX, info_format, + GET_SYS_STR("IDS_COM_BODY_DETAILS_TITLE"), title); _mp_common_set_label_for_detail(pBox, szTmpStr); memset(szTmpStr, 0, MP_STR_LEN_MAX); if (artist && strlen(artist)) { - snprintf(szTmpStr, MP_STR_LEN_MAX, info_format, GET_SYS_STR("IDS_MUSIC_BODY_ARTIST"), artist); + snprintf(szTmpStr, MP_STR_LEN_MAX, info_format, + GET_SYS_STR("IDS_MUSIC_BODY_ARTIST"), artist); _mp_common_set_label_for_detail(pBox, szTmpStr); memset(szTmpStr, 0, MP_STR_LEN_MAX); } if (album && strlen(album)) { - snprintf(szTmpStr, MP_STR_LEN_MAX, info_format, GET_STR("IDS_MUSIC_BODY_ALBUM"), album); + snprintf(szTmpStr, MP_STR_LEN_MAX, info_format, + GET_STR("IDS_MUSIC_BODY_ALBUM"), album); _mp_common_set_label_for_detail(pBox, szTmpStr); memset(szTmpStr, 0, MP_STR_LEN_MAX); } @@ -540,30 +593,36 @@ static void _mp_common_list_track_more_detail(void *parent, void *data) int sec = dur_sec % 60; int min = dur_sec / 60; - snprintf(duration_format, sizeof(duration_format), "%02u:%02u", min, sec); + snprintf(duration_format, sizeof(duration_format), "%02u:%02u", + min, sec); - snprintf(szTmpStr, MP_STR_LEN_MAX, info_format, GET_STR("IDS_MUSIC_BODY_TRACK_LENGTH"), duration_format); + snprintf(szTmpStr, MP_STR_LEN_MAX, info_format, + GET_STR("IDS_MUSIC_BODY_TRACK_LENGTH"), duration_format); _mp_common_set_label_for_detail(pBox, szTmpStr); memset(szTmpStr, 0, MP_STR_LEN_MAX); if (date && strlen(date)) { - snprintf(szTmpStr, MP_STR_LEN_MAX, info_format, GET_STR("IDS_MUSIC_BODY_RECORDED_DATE"), date); + snprintf(szTmpStr, MP_STR_LEN_MAX, info_format, + GET_STR("IDS_MUSIC_BODY_RECORDED_DATE"), date); _mp_common_set_label_for_detail(pBox, szTmpStr); memset(szTmpStr, 0, MP_STR_LEN_MAX); } if (track && strlen(track)) { - snprintf(szTmpStr, MP_STR_LEN_MAX, info_format, GET_STR("IDS_MUSIC_BODY_TRACK_NUMBER"), track); + snprintf(szTmpStr, MP_STR_LEN_MAX, info_format, + GET_STR("IDS_MUSIC_BODY_TRACK_NUMBER"), track); _mp_common_set_label_for_detail(pBox, szTmpStr); memset(szTmpStr, 0, MP_STR_LEN_MAX); } if (format && strlen(format)) { - snprintf(szTmpStr, MP_STR_LEN_MAX, info_format, GET_STR("IDS_MUSIC_BODY_FORMAT"), format); + snprintf(szTmpStr, MP_STR_LEN_MAX, info_format, + GET_STR("IDS_MUSIC_BODY_FORMAT"), format); _mp_common_set_label_for_detail(pBox, szTmpStr); memset(szTmpStr, 0, MP_STR_LEN_MAX); } - snprintf(szTmpStr, MP_STR_LEN_MAX, info_format, GET_STR("IDS_MUSIC_BODY_MUSIC_LOCATION"), pathname); + snprintf(szTmpStr, MP_STR_LEN_MAX, info_format, + GET_STR("IDS_MUSIC_BODY_MUSIC_LOCATION"), pathname); _mp_common_set_label_for_detail(pBox, szTmpStr); memset(szTmpStr, 0, MP_STR_LEN_MAX); @@ -574,12 +633,14 @@ static void _mp_common_list_track_more_detail(void *parent, void *data) } elm_scroller_bounce_set(pop_scroller, EINA_TRUE, EINA_TRUE); - elm_scroller_policy_set(pop_scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); + elm_scroller_policy_set(pop_scroller, ELM_SCROLLER_POLICY_OFF, + ELM_SCROLLER_POLICY_AUTO); evas_object_show(pop_scroller); elm_object_content_set(pop_scroller, pBox); - elm_object_part_content_set(pop_layout, "elm.swallow.layout", pop_scroller); + elm_object_part_content_set(pop_layout, "elm.swallow.layout", + pop_scroller); elm_object_content_set(popup, pop_layout); IF_FREE(date); @@ -594,10 +655,11 @@ static void _mp_common_list_track_more_detail(void *parent, void *data) } } -void mp_common_track_delete_cb(void *data, Evas_Object * obj, void *event_info) +void mp_common_track_delete_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); mp_evas_object_del(view->more_btn_ctxpopup); @@ -609,7 +671,8 @@ void mp_common_track_delete_cb(void *data, Evas_Object * obj, void *event_info) return; } -void mp_common_create_search_view_cb(void *data, Evas_Object *obj, void *event_info) +void mp_common_create_search_view_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; MpView_t *parent = data; @@ -619,34 +682,37 @@ void mp_common_create_search_view_cb(void *data, Evas_Object *obj, void *event_i MpViewMgr_t *view_manager = mp_view_mgr_get_view_manager(); - MpSearchView_t *view = (MpSearchView_t *)mp_view_mgr_get_view(view_manager, MP_VIEW_SEARCH); + MpSearchView_t *view = + (MpSearchView_t *) mp_view_mgr_get_view(view_manager, + MP_VIEW_SEARCH); if (view) { mp_view_mgr_pop_to_view(view_manager, MP_VIEW_SEARCH); mp_search_view_set_keyword(view, NULL); } else { view = mp_search_view_create(view_manager->navi, NULL); - mp_view_mgr_push_view(view_manager, (MpView_t *)view, MP_SEARCH_VIEW_STYLE_EMPTY); - mp_view_update_options((MpView_t *)view); + mp_view_mgr_push_view(view_manager, (MpView_t *) view, + MP_SEARCH_VIEW_STYLE_EMPTY); + mp_view_update_options((MpView_t *) view); } } -void -mp_common_show_set_as_view(char* path) +void mp_common_show_set_as_view(char *path) { startfunc; MpViewMgr_t *view_mgr = mp_view_mgr_get_view_manager(); MP_CHECK(view_mgr); MpSetAsView_t *view = mp_set_as_view_create(view_mgr->navi, path); MP_CHECK(view); - mp_view_mgr_push_view(view_mgr, (MpView_t *)view, NULL); + mp_view_mgr_push_view(view_mgr, (MpView_t *) view, NULL); mp_view_set_title((MpView_t *) view, STR_MP_SET_AS); - mp_view_update_options((MpView_t *)view); + mp_view_update_options((MpView_t *) view); endfunc; } -void mp_common_list_set_as_cb(void *data, Evas_Object * obj, void *event_info) +void mp_common_list_set_as_cb(void *data, Evas_Object * obj, + void *event_info) { EVENT_TRACE(); @@ -661,14 +727,14 @@ void mp_common_list_set_as_cb(void *data, Evas_Object * obj, void *event_info) GList *sel_list = NULL; mp_list_item_data_t *item_data = NULL; - mp_list_selected_item_data_get(list, &sel_list); + mp_list_selected_item_data_get(list, &sel_list); GList *node = g_list_first(sel_list); while (node) { item_data = node->data; node = g_list_next(node); } - char* path = NULL; + char *path = NULL; MP_CHECK(item_data); mp_media_info_get_file_path(item_data->handle, &path); MP_CHECK(path); @@ -676,7 +742,8 @@ void mp_common_list_set_as_cb(void *data, Evas_Object * obj, void *event_info) } -void mp_common_list_add_to_playlist_cb(void *data, Evas_Object * obj, void *event_info) +void mp_common_list_add_to_playlist_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; @@ -692,7 +759,8 @@ void mp_common_list_add_to_playlist_cb(void *data, Evas_Object * obj, void *even list->pop_delay_timer = ecore_timer_add(0.1, _mp_timer_delay_cb, data); } -void mp_common_list_delete_cb(void *data, Evas_Object * obj, void *event_info) +void mp_common_list_delete_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; @@ -705,7 +773,8 @@ void mp_common_list_delete_cb(void *data, Evas_Object * obj, void *event_info) return; } -void mp_common_list_remove_cb(void *data, Evas_Object * obj, void *event_info) +void mp_common_list_remove_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; @@ -717,14 +786,17 @@ void mp_common_list_remove_cb(void *data, Evas_Object * obj, void *event_info) MP_CHECK(list); if (mp_list_get_checked_count(list) <= 0) { - mp_widget_text_popup(ad, GET_STR("IDS_MUSIC_POP_NOTHING_SELECTED")); + mp_widget_text_popup(ad, + GET_STR("IDS_MUSIC_POP_NOTHING_SELECTED")); return; } mp_edit_cb_excute_delete(data); return; } -static void _mp_common_list_set_same_id_favorite(void *data, mp_media_info_h media, bool favorite) +static void _mp_common_list_set_same_id_favorite(void *data, + mp_media_info_h media, + bool favorite) { MpList_t *list = data; MP_CHECK(list); @@ -744,9 +816,11 @@ static void _mp_common_list_set_same_id_favorite(void *data, mp_media_info_h med while (node) { item_data = node->data; if (item_data && (!item_data->checked) && item_data->handle) { - mp_media_info_get_media_id(item_data->handle, &tmp_media_id); + mp_media_info_get_media_id(item_data->handle, + &tmp_media_id); if (g_strcmp0(tmp_media_id, media_id) == 0) { - mp_media_info_set_favorite(item_data->handle, favorite); + mp_media_info_set_favorite(item_data->handle, + favorite); } } node = g_list_next(node); @@ -756,7 +830,8 @@ static void _mp_common_list_set_same_id_favorite(void *data, mp_media_info_h med all_list = NULL; } -void mp_common_list_add_to_favorite_cb(void *data, Evas_Object * obj, void *event_info) +void mp_common_list_add_to_favorite_cb(void *data, Evas_Object * obj, + void *event_info) { EVENT_TRACE(); @@ -771,10 +846,11 @@ void mp_common_list_add_to_favorite_cb(void *data, Evas_Object * obj, void *even GList *sel_list = NULL; mp_list_item_data_t *item_data = NULL; - mp_list_selected_item_data_get(list, &sel_list); + mp_list_selected_item_data_get(list, &sel_list); if (g_list_length(sel_list) == 0) { - mp_widget_text_popup(ad, GET_STR("IDS_MUSIC_POP_NOTHING_SELECTED")); + mp_widget_text_popup(ad, + GET_STR("IDS_MUSIC_POP_NOTHING_SELECTED")); return; } @@ -783,7 +859,8 @@ void mp_common_list_add_to_favorite_cb(void *data, Evas_Object * obj, void *even item_data = node->data; if (item_data && item_data->handle) { mp_media_info_set_favorite(item_data->handle, true); - _mp_common_list_set_same_id_favorite(list, item_data->handle, true); + _mp_common_list_set_same_id_favorite(list, item_data->handle, + true); } node = g_list_next(node); } @@ -798,7 +875,8 @@ void mp_common_list_add_to_favorite_cb(void *data, Evas_Object * obj, void *even } } -void mp_common_list_unfavorite_cb(void *data, Evas_Object * obj, void *event_info) +void mp_common_list_unfavorite_cb(void *data, Evas_Object * obj, + void *event_info) { EVENT_TRACE(); struct appdata *ad = mp_util_get_appdata(); @@ -811,9 +889,10 @@ void mp_common_list_unfavorite_cb(void *data, Evas_Object * obj, void *event_inf GList *sel_list = NULL; mp_list_item_data_t *item_data = NULL; - mp_list_selected_item_data_get(list, &sel_list); + mp_list_selected_item_data_get(list, &sel_list); if (g_list_length(sel_list) == 0) { - mp_widget_text_popup(ad, GET_STR("IDS_MUSIC_POP_NOTHING_SELECTED")); + mp_widget_text_popup(ad, + GET_STR("IDS_MUSIC_POP_NOTHING_SELECTED")); return; } @@ -822,13 +901,16 @@ void mp_common_list_unfavorite_cb(void *data, Evas_Object * obj, void *event_inf item_data = node->data; if (item_data && item_data->handle) { mp_media_info_set_favorite(item_data->handle, false); - _mp_common_list_set_same_id_favorite(list, item_data->handle, false); + _mp_common_list_set_same_id_favorite(list, item_data->handle, + false); } node = g_list_next(node); } - mp_util_post_status_message(ad, GET_STR(STR_MP_POPUP_REMOVE_FROM_FAVORITE)); + mp_util_post_status_message(ad, + GET_STR + (STR_MP_POPUP_REMOVE_FROM_FAVORITE)); if (sel_list) { g_list_free(sel_list); @@ -836,7 +918,8 @@ void mp_common_list_unfavorite_cb(void *data, Evas_Object * obj, void *event_inf } } -void mp_common_list_more_info_cb(void *data, Evas_Object * obj, void *event_info) +void mp_common_list_more_info_cb(void *data, Evas_Object * obj, + void *event_info) { EVENT_TRACE(); @@ -848,7 +931,9 @@ void mp_common_list_more_info_cb(void *data, Evas_Object * obj, void *event_info mp_popup_destroy(ad); - Evas_Object *popup = mp_popup_create(ad->win_main, MP_POPUP_NORMAL, STR_MP_POPUP_MORE_INFO, NULL, NULL, ad); + Evas_Object *popup = + mp_popup_create(ad->win_main, MP_POPUP_NORMAL, + STR_MP_POPUP_MORE_INFO, NULL, NULL, ad); MP_CHECK(popup); mp_popup_button_set(popup, MP_POPUP_BTN_1, STR_MP_OK, MP_POPUP_YES); @@ -858,7 +943,8 @@ void mp_common_list_more_info_cb(void *data, Evas_Object * obj, void *event_info _mp_common_list_track_more_detail(popup, list); } -void mp_common_list_update_albumart_cb(void *data, Evas_Object * obj, void *event_info) +void mp_common_list_update_albumart_cb(void *data, Evas_Object * obj, + void *event_info) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); @@ -872,9 +958,10 @@ void mp_common_list_update_albumart_cb(void *data, Evas_Object * obj, void *even MP_CHECK(list); - mp_list_selected_item_data_get(list, &sel_list); + mp_list_selected_item_data_get(list, &sel_list); if (g_list_length(sel_list) == 0) { - mp_widget_text_popup(ad, GET_STR("IDS_MUSIC_POP_NOTHING_SELECTED")); + mp_widget_text_popup(ad, + GET_STR("IDS_MUSIC_POP_NOTHING_SELECTED")); return; } GList *node = g_list_first(sel_list); @@ -900,27 +987,36 @@ void mp_common_list_update_albumart_cb(void *data, Evas_Object * obj, void *even ** start_new_file : it indicates that after start player view, it will play the file from start */ void -mp_common_show_player_view(int launch_type, bool disable_effect, bool start_playback, bool start_new_file) +mp_common_show_player_view(int launch_type, bool disable_effect, + bool start_playback, bool start_new_file) { startfunc; - WARN_TRACE("launch type[%d] disable_effect[%d], start_playback[%d], start_new_file[%d]", launch_type, disable_effect, start_playback, start_new_file); + WARN_TRACE + ("launch type[%d] disable_effect[%d], start_playback[%d], start_new_file[%d]", + launch_type, disable_effect, start_playback, start_new_file); MpViewMgr_t *view_manager = mp_view_mgr_get_view_manager(); - MpPlayerView_t *player_view = (MpPlayerView_t *)mp_view_mgr_get_view(view_manager, MP_VIEW_PLAYER); + MpPlayerView_t *player_view = + (MpPlayerView_t *) mp_view_mgr_get_view(view_manager, + MP_VIEW_PLAYER); #ifndef MP_SOUND_PLAYER if (player_view) { mp_view_mgr_pop_to_view(view_manager, MP_VIEW_PLAYER); - mp_list_update((MpList_t *)player_view->queue_list); + mp_list_update((MpList_t *) player_view->queue_list); } else #endif { - player_view = mp_player_view_create(view_manager->navi, launch_type, start_new_file); + player_view = + mp_player_view_create(view_manager->navi, launch_type, + start_new_file); if (player_view == NULL) { - return ; + return; } - mp_view_mgr_push_view_with_effect(view_manager, (MpView_t *)player_view, NULL, disable_effect); + mp_view_mgr_push_view_with_effect(view_manager, + (MpView_t *) player_view, NULL, + disable_effect); } if (start_playback) { @@ -929,36 +1025,42 @@ mp_common_show_player_view(int launch_type, bool disable_effect, bool start_play player_view->start_on_transition_finish = true; ad->player_state = PLAY_STATE_PLAYING; } - mp_view_update((MpView_t *)player_view); - mp_view_update_options((MpView_t *)player_view); + mp_view_update((MpView_t *) player_view); + mp_view_update_options((MpView_t *) player_view); - int show = ((int)mp_player_mgr_get_state() == (int)PLAYER_STATE_PLAYING); + int show = + ((int) mp_player_mgr_get_state() == (int) PLAYER_STATE_PLAYING); mp_player_view_set_play_image(player_view, show); mp_player_view_set_album_playing(player_view, true); endfunc; } -void -mp_common_show_player_view_after_play() +void mp_common_show_player_view_after_play() { startfunc; MpViewMgr_t *view_manager = mp_view_mgr_get_view_manager(); - MpPlayerView_t *player_view = (MpPlayerView_t *)mp_view_mgr_get_view(view_manager, MP_VIEW_PLAYER); + MpPlayerView_t *player_view = + (MpPlayerView_t *) mp_view_mgr_get_view(view_manager, + MP_VIEW_PLAYER); struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); if (player_view) { mp_view_mgr_pop_to_view(view_manager, MP_VIEW_PLAYER); } else { - ad->preload_player_view = (Evas_Object *)mp_player_view_create(view_manager->navi, 0, false); + ad->preload_player_view = + (Evas_Object *) mp_player_view_create(view_manager->navi, 0, + false); ad->create_view_on_play = true; } endfunc; } -void mp_common_play_track_list_with_playlist_id(mp_list_item_data_t *item, Evas_Object *genlist, int playlist_id) +void mp_common_play_track_list_with_playlist_id(mp_list_item_data_t * item, + Evas_Object * genlist, + int playlist_id) { startfunc; MP_CHECK(item); @@ -974,7 +1076,7 @@ void mp_common_play_track_list_with_playlist_id(mp_list_item_data_t *item, Evas_ mp_plst_item *plst_item = NULL; mp_plst_item *to_play = NULL; bool track_update = true; //indicate if playing the same track - bool playlist_update = true; //indicate if playing item is in the same play list + bool playlist_update = true; //indicate if playing item is in the same play list bool start_new_file = true; //only when same track and same playlist, we will set it false. if (!ad->playlist_mgr) { @@ -990,7 +1092,8 @@ void mp_common_play_track_list_with_playlist_id(mp_list_item_data_t *item, Evas_ /* check if the same track as current playing */ char *to_play_uid = NULL; char *playing_uid = NULL; - mp_plst_item *playing_item = mp_playlist_mgr_get_current(ad->playlist_mgr); + mp_plst_item *playing_item = + mp_playlist_mgr_get_current(ad->playlist_mgr); if (playing_item != NULL) { playing_uid = playing_item->uid; } @@ -1003,7 +1106,7 @@ void mp_common_play_track_list_with_playlist_id(mp_list_item_data_t *item, Evas_ track_update = false; } - if (track_update == false && playlist_update == false) { + if (track_update == false && playlist_update == false) { start_new_file = false; } } @@ -1015,10 +1118,14 @@ void mp_common_play_track_list_with_playlist_id(mp_list_item_data_t *item, Evas_ PROFILE_IN("playlist_item_append"); gli2 = elm_genlist_first_item_get(genlist); while (gli2) { - if (elm_genlist_item_select_mode_get(gli2) != ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) { - mp_list_item_data_t *item_data = elm_object_item_data_get(gli2); - if (item_data && item_data->item_type == MP_LIST_ITEM_TYPE_NORMAL) { - if (item_data->group_type == MP_GROUP_NONE || item_data->group_type == MP_GROUP_BY_ALLSHARE) { + if (elm_genlist_item_select_mode_get(gli2) != + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) { + mp_list_item_data_t *item_data = + elm_object_item_data_get(gli2); + if (item_data + && item_data->item_type == MP_LIST_ITEM_TYPE_NORMAL) { + if (item_data->group_type == MP_GROUP_NONE + || item_data->group_type == MP_GROUP_BY_ALLSHARE) { char *uri = NULL; char *uid = NULL; char *title = NULL; @@ -1031,14 +1138,21 @@ void mp_common_play_track_list_with_playlist_id(mp_list_item_data_t *item, Evas_ mp_media_info_get_artist(item_data->handle, &artist); mp_storage_type_e storage; - mp_media_info_get_storage_type(item_data->handle, &storage); + mp_media_info_get_storage_type(item_data->handle, + &storage); - plst_item = mp_playlist_mgr_item_append(ad->playlist_mgr, uri, uid, title, artist, track_type); + plst_item = + mp_playlist_mgr_item_append(ad->playlist_mgr, uri, + uid, title, artist, + track_type); if (playlist_id) { int member_id = 0; - mp_media_info_get_playlist_member_id(item_data->handle, &member_id); + mp_media_info_get_playlist_member_id(item_data-> + handle, + &member_id); //mp_debug("playlist memeber id = %d", member_id); - mp_playlist_mgr_item_set_playlist_memeber_id(plst_item, member_id); + mp_playlist_mgr_item_set_playlist_memeber_id + (plst_item, member_id); } if (gli2 == item->it && plst_item) { @@ -1062,12 +1176,16 @@ void mp_common_play_track_list_with_playlist_id(mp_list_item_data_t *item, Evas_ PROFILE_IN("mp_playlist_mgr_set_current"); if (to_play == NULL) { - mp_playlist_mgr_set_current(ad->playlist_mgr, mp_playlist_mgr_get_nth(ad->playlist_mgr, 0)); + mp_playlist_mgr_set_current(ad->playlist_mgr, + mp_playlist_mgr_get_nth(ad-> + playlist_mgr, + 0)); } else { int shuffle = false; mp_setting_get_shuffle_state(&shuffle); - if (shuffle) { //Make selected item to the first item. to play all tracks in case of repeat none - mp_playlist_mgr_set_shuffle_first_item(ad->playlist_mgr, to_play); + if (shuffle) { //Make selected item to the first item. to play all tracks in case of repeat none + mp_playlist_mgr_set_shuffle_first_item(ad->playlist_mgr, + to_play); } mp_playlist_mgr_set_current(ad->playlist_mgr, to_play); @@ -1095,7 +1213,8 @@ void mp_common_play_track_list_with_playlist_id(mp_list_item_data_t *item, Evas_ return; } -void mp_common_play_track_list(mp_list_item_data_t *item, Evas_Object *genlist) +void mp_common_play_track_list(mp_list_item_data_t * item, + Evas_Object * genlist) { mp_common_play_track_list_with_playlist_id(item, genlist, 0); } @@ -1106,10 +1225,10 @@ enum { MP_SEARCH_BY_MAX, }; -static char * -_popup_label_get(void *data, Evas_Object * obj, const char *part) +static char *_popup_label_get(void *data, Evas_Object * obj, + const char *part) { - int mode = (int)data; + int mode = (int) data; char *label = NULL; if (mode == MP_SEARCH_BY_INTERNET) { @@ -1139,15 +1258,17 @@ static void _search_by_internet(const char *keyword) static void _searcy_by_music_app(const char *keyword) { startfunc; - MpView_t *search_view = (MpView_t *)mp_search_view_create(GET_NAVIFRAME, keyword); - mp_view_mgr_push_view(GET_VIEW_MGR, search_view, MP_SEARCH_VIEW_STYLE_EMPTY); + MpView_t *search_view = + (MpView_t *) mp_search_view_create(GET_NAVIFRAME, keyword); + mp_view_mgr_push_view(GET_VIEW_MGR, search_view, + MP_SEARCH_VIEW_STYLE_EMPTY); mp_view_update_options(search_view); } static void -_popup_item_sel(void *data, Evas_Object *obj, void *event_info) +_popup_item_sel(void *data, Evas_Object * obj, void *event_info) { - int type = (int)elm_object_item_data_get(event_info); + int type = (int) elm_object_item_data_get(event_info); EVENT_TRACE("Search by Selected. Search type: %d", type); if (type == MP_SEARCH_BY_INTERNET) { @@ -1162,13 +1283,13 @@ _popup_item_sel(void *data, Evas_Object *obj, void *event_info) mp_popup_destroy(ad); } -void -mp_common_search_by(const char *keyword) +void mp_common_search_by(const char *keyword) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); - Evas_Object *popup = mp_genlist_popup_create(ad->win_main, MP_POPUP_SEARCH, NULL, ad); + Evas_Object *popup = + mp_genlist_popup_create(ad->win_main, MP_POPUP_SEARCH, NULL, ad); MP_CHECK(popup); Evas_Object *genlist = evas_object_data_get(popup, "genlist"); @@ -1182,8 +1303,9 @@ mp_common_search_by(const char *keyword) int i = 0; while (i < MP_SEARCH_BY_MAX) { - elm_genlist_item_append(genlist, &itc, (void *)i, NULL, ELM_GENLIST_ITEM_NONE, - _popup_item_sel, keyword); + elm_genlist_item_append(genlist, &itc, (void *) i, NULL, + ELM_GENLIST_ITEM_NONE, _popup_item_sel, + keyword); ++i; } @@ -1204,25 +1326,28 @@ MpView_t *mp_common_get_all_view() void mp_common_show_add_tracks_view(int playlist_id) { MpViewMgr_t *view_manager = mp_view_mgr_get_view_manager(); - MpAddTrackView_t *view = mp_add_track_view_create(view_manager->navi, playlist_id); + MpAddTrackView_t *view = + mp_add_track_view_create(view_manager->navi, playlist_id); if (view == NULL) { ERROR_TRACE("Unable to show add tracks"); return; } - mp_view_mgr_push_view(view_manager, (MpView_t *)view, NULL); + mp_view_mgr_push_view(view_manager, (MpView_t *) view, NULL); - mp_view_update_options((MpView_t *)view); - mp_list_set_edit((MpList_t *)view->content_to_show, TRUE); - mp_view_set_title((MpView_t *)view, STR_MP_TILTE_SELECT_ITEM); + mp_view_update_options((MpView_t *) view); + mp_list_set_edit((MpList_t *) view->content_to_show, TRUE); + mp_view_set_title((MpView_t *) view, STR_MP_TILTE_SELECT_ITEM); mp_add_track_view_select_tab(view, MP_ADD_TRACK_VIEW_TAB_SONGS); - mp_list_view_set_cancel_btn((MpListView_t*)view, true); - mp_list_view_set_done_btn((MpListView_t*)view, true, MP_DONE_ADD_TRACK_TYPE); + mp_list_view_set_cancel_btn((MpListView_t *) view, true); + mp_list_view_set_done_btn((MpListView_t *) view, true, + MP_DONE_ADD_TRACK_TYPE); } #endif static void -_mp_common_playlist_item_change_callback(mp_plst_item *item, void *userdata) +_mp_common_playlist_item_change_callback(mp_plst_item * item, + void *userdata) { struct appdata *ad = userdata; MP_CHECK(ad); @@ -1249,7 +1374,9 @@ void mp_common_create_playlist_mgr(void) DEBUG_TRACE("create playlist mgr"); ad->playlist_mgr = mp_playlist_mgr_create(); - mp_playlist_mgr_set_item_change_callback(ad->playlist_mgr, _mp_common_playlist_item_change_callback, ad); + mp_playlist_mgr_set_item_change_callback(ad->playlist_mgr, + _mp_common_playlist_item_change_callback, + ad); int val = 0; mp_setting_get_shuffle_state(&val); mp_playlist_mgr_set_shuffle(ad->playlist_mgr, val); @@ -1280,22 +1407,28 @@ void mp_common_create_default_playlist() mp_playlist_mgr_clear(ad->playlist_mgr); char *data_path = app_get_data_path(); - char nowplaying_list_data[1024] = {0}; - snprintf(nowplaying_list_data, 1024, "%s%s", data_path, MP_NOWPLAYING_LIST_DATA); + char nowplaying_list_data[1024] = { 0 }; + snprintf(nowplaying_list_data, 1024, "%s%s", data_path, + MP_NOWPLAYING_LIST_DATA); free(data_path); - mp_playlist_mgr_lazy_append_with_file(ad->playlist_mgr, nowplaying_list_data, last_played_path, -1); + mp_playlist_mgr_lazy_append_with_file(ad->playlist_mgr, + nowplaying_list_data, + last_played_path, -1); if (mp_playlist_mgr_count(ad->playlist_mgr) == 0) { - mp_media_info_list_count(MP_TRACK_ALL, NULL, NULL, NULL, 0, &count); - mp_media_info_list_create(&all, MP_TRACK_ALL, NULL, NULL, NULL, 0, 0, count); - mp_util_append_media_list_item_to_playlist(ad->playlist_mgr, all, count, 0, last_played_path); + mp_media_info_list_count(MP_TRACK_ALL, NULL, NULL, NULL, 0, + &count); + mp_media_info_list_create(&all, MP_TRACK_ALL, NULL, NULL, NULL, 0, + 0, count); + mp_util_append_media_list_item_to_playlist(ad->playlist_mgr, all, + count, 0, + last_played_path); mp_media_info_list_destroy(all); } IF_FREE(last_played_path); } -void -mp_common_playlist_album_update(mp_media_info_h playlist_handle) +void mp_common_playlist_album_update(mp_media_info_h playlist_handle) { startfunc; int ret = 0; @@ -1305,10 +1438,13 @@ mp_common_playlist_album_update(mp_media_info_h playlist_handle) char *path = NULL; mp_media_info_group_get_playlist_id(playlist_handle, &playlist_id); - mp_media_info_list_count(MP_TRACK_BY_PLAYLIST, NULL, NULL, NULL, playlist_id, &count); + mp_media_info_list_count(MP_TRACK_BY_PLAYLIST, NULL, NULL, NULL, + playlist_id, &count); /* get music item data */ - ret = mp_media_info_list_create(&svc_handle, MP_TRACK_BY_PLAYLIST, NULL, NULL, NULL, playlist_id, 0, count); + ret = + mp_media_info_list_create(&svc_handle, MP_TRACK_BY_PLAYLIST, NULL, + NULL, NULL, playlist_id, 0, count); if (ret != 0) { DEBUG_TRACE("fail to get list item: %d", ret); ret = mp_media_info_list_destroy(svc_handle); @@ -1318,10 +1454,13 @@ mp_common_playlist_album_update(mp_media_info_h playlist_handle) media_info = mp_media_info_list_nth_item(svc_handle, count - 1); mp_media_info_get_thumbnail_path(media_info, &path); - if (!path || !g_file_test(path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR) || !strcmp(BROKEN_ALBUMART_IMAGE_PATH, path)) { - char default_thumbnail[1024] = {0}; + if (!path + || !g_file_test(path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR) + || !strcmp(BROKEN_ALBUMART_IMAGE_PATH, path)) { + char default_thumbnail[1024] = { 0 }; char *shared_path = app_get_shared_resource_path(); - snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, "shared_images", DEFAULT_THUMBNAIL); + snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, + "shared_images", DEFAULT_THUMBNAIL); free(shared_path); path = g_strdup(default_thumbnail); } @@ -1332,20 +1471,20 @@ mp_common_playlist_album_update(mp_media_info_h playlist_handle) } void -mp_common_popup_del_cb(void *data, Evas * e, Evas_Object * obj, void *event_info) +mp_common_popup_del_cb(void *data, Evas * e, Evas_Object * obj, + void *event_info) { Evas_Object *genlist = data; - evas_object_data_set(genlist, "popup", NULL); // Set popup data as NULL when popup is deleted. - elm_object_scroll_freeze_pop(genlist); // Enable scrolling + evas_object_data_set(genlist, "popup", NULL); // Set popup data as NULL when popup is deleted. + elm_object_scroll_freeze_pop(genlist); // Enable scrolling } #ifdef MP_SOUND_PLAYER -static char * -_mp_util_convert_url(char *uri) +static char *_mp_util_convert_url(char *uri) { char *path = NULL; MP_CHECK_NULL(uri); - if (strstr(uri, MP_FILE_PREFIX)) { + if (strstr(uri, MP_FILE_PREFIX)) { path = g_strdup(uri + strlen(MP_FILE_PREFIX)); } else { path = g_strdup(uri); @@ -1353,8 +1492,7 @@ _mp_util_convert_url(char *uri) return path; } -static bool -_mp_common_set_current_playing_item(const char *path) +static bool _mp_common_set_current_playing_item(const char *path) { startfunc; struct appdata *ad = mp_util_get_appdata(); @@ -1362,14 +1500,15 @@ _mp_common_set_current_playing_item(const char *path) mp_common_create_playlist_mgr(); mp_playlist_mgr_clear(ad->playlist_mgr); - mp_plst_item *item = mp_playlist_mgr_item_append(ad->playlist_mgr, path, NULL, NULL, NULL, MP_TRACK_URI); + mp_plst_item *item = + mp_playlist_mgr_item_append(ad->playlist_mgr, path, NULL, NULL, + NULL, MP_TRACK_URI); mp_playlist_mgr_set_current(ad->playlist_mgr, item); return true; } -static bool -_mp_common_multiple_view_operation(app_control_h app_control) +static bool _mp_common_multiple_view_operation(app_control_h app_control) { startfunc; bool res = false; @@ -1377,32 +1516,42 @@ _mp_common_multiple_view_operation(app_control_h app_control) char **thumbs = NULL; char **titles = NULL; char **artist = NULL; - int i, length = 0, thumb_length = 0, title_length = 0, artist_length = 0; + int i, length = 0, thumb_length = 0, title_length = 0, artist_length = + 0; struct appdata *ad = mp_util_get_appdata(); MP_CHECK_FALSE(ad); mp_common_create_playlist_mgr(); mp_playlist_mgr_clear(ad->playlist_mgr); - if (app_control_get_extra_data_array(app_control, APP_CONTROL_DATA_PATH, &value, &length) == APP_CONTROL_ERROR_NONE) { - app_control_get_extra_data_array(app_control, "thumbnail/path", &thumbs, &thumb_length); + if (app_control_get_extra_data_array + (app_control, APP_CONTROL_DATA_PATH, &value, + &length) == APP_CONTROL_ERROR_NONE) { + app_control_get_extra_data_array(app_control, "thumbnail/path", + &thumbs, &thumb_length); if (thumbs && thumb_length != length) { WARN_TRACE("uri & thumbnail count is not same..."); IF_FREE(thumbs); } - app_control_get_extra_data_array(app_control, APP_CONTROL_DATA_TITLE, &titles, &title_length); + app_control_get_extra_data_array(app_control, + APP_CONTROL_DATA_TITLE, &titles, + &title_length); if (titles && length != title_length) { WARN_TRACE("uri & title count is not same..."); IF_FREE(titles); } - app_control_get_extra_data_array(app_control, MP_SAMSUNG_LINK_ARTIST, &artist, &artist_length); + app_control_get_extra_data_array(app_control, + MP_SAMSUNG_LINK_ARTIST, &artist, + &artist_length); if (artist && length != artist_length) { WARN_TRACE("uri & artist count is not same..."); IF_FREE(artist); } for (i = 0; i < length; i++) { char *path = _mp_util_convert_url(value[i]); - mp_plst_item *item = mp_playlist_mgr_item_append(ad->playlist_mgr, path, NULL, NULL, NULL, MP_TRACK_URI); + mp_plst_item *item = + mp_playlist_mgr_item_append(ad->playlist_mgr, path, NULL, + NULL, NULL, MP_TRACK_URI); MP_CHECK_FALSE(item); if (thumbs) { item->thumbnail_path = g_strdup(thumbs[i]); @@ -1418,7 +1567,10 @@ _mp_common_multiple_view_operation(app_control_h app_control) IF_FREE(item->title); IF_FREE(item->artist); } - mp_playlist_mgr_set_current(ad->playlist_mgr, mp_playlist_mgr_get_nth(ad->playlist_mgr, 0)); + mp_playlist_mgr_set_current(ad->playlist_mgr, + mp_playlist_mgr_get_nth(ad-> + playlist_mgr, + 0)); res = true; } @@ -1435,8 +1587,7 @@ char *_get_folder_path(const char *path) return mp_file_dir_get(path); } -static Eina_List * -_mp_common_get_track_list_by_folder(const char *folder) +static Eina_List *_mp_common_get_track_list_by_folder(const char *folder) { MP_CHECK_NULL(folder); MP_CHECK_NULL(mp_file_path_dir_exists(folder)); @@ -1455,7 +1606,7 @@ _mp_common_get_track_list_by_folder(const char *folder) char *mime = mp_util_file_mime_type_get(path); DEBUG_TRACE("mime_type: %s", mime); if (mime && strstr(mime, "audio/")) { - audio_list = eina_list_append(audio_list, (void *)path); + audio_list = eina_list_append(audio_list, (void *) path); } IF_FREE(mime); } @@ -1477,7 +1628,7 @@ _mp_common_view_by_folder(const char *path, app_control_h app_control) char *value = NULL; char *folder = NULL; char *hidden_file_path = NULL; - /* Handling dot(hidden) file path*/ + /* Handling dot(hidden) file path */ app_control_get_uri(app_control, &hidden_file_path); SECURE_DEBUG("The Hidden file path is %s", hidden_file_path); @@ -1489,7 +1640,8 @@ _mp_common_view_by_folder(const char *path, app_control_h app_control) //app_control_add_extra_data(service, "sort_type", "MYFILE_SORT_BY_SIZE_L2S"); - if (app_control_get_extra_data(app_control, "View By", &value) == APP_CONTROL_ERROR_NONE) { + if (app_control_get_extra_data(app_control, "View By", &value) == + APP_CONTROL_ERROR_NONE) { if (!g_strcmp0(value, "By Folder")) { folder = _get_folder_path(path); SECURE_DEBUG("View By folder %s", folder); @@ -1499,7 +1651,8 @@ _mp_common_view_by_folder(const char *path, app_control_h app_control) } if (ret) { - if (app_control_get_extra_data(app_control, "sort_type", &value) == APP_CONTROL_ERROR_NONE) { + if (app_control_get_extra_data(app_control, "sort_type", &value) == + APP_CONTROL_ERROR_NONE) { struct appdata *ad = mp_util_get_appdata(); mp_media_list_h list = NULL; mp_media_info_h media = NULL; @@ -1526,7 +1679,7 @@ _mp_common_view_by_folder(const char *path, app_control_h app_control) } mp_media_info_get_file_path(media, &file_path); - i ++; + i++; DEBUG_TRACE("file path:%s", file_path); if (!file_path) { continue; @@ -1536,7 +1689,10 @@ _mp_common_view_by_folder(const char *path, app_control_h app_control) IF_FREE(folder_path); continue; } - item = mp_playlist_mgr_item_append(ad->playlist_mgr, file_path, NULL, NULL, NULL, MP_TRACK_URI); + item = + mp_playlist_mgr_item_append(ad->playlist_mgr, + file_path, NULL, NULL, + NULL, MP_TRACK_URI); ++count; if (!cur && !g_strcmp0(path, file_path)) { @@ -1549,12 +1705,17 @@ _mp_common_view_by_folder(const char *path, app_control_h app_control) list = 0; } if (count == 0) { - Eina_List *file_list = _mp_common_get_track_list_by_folder(folder); + Eina_List *file_list = + _mp_common_get_track_list_by_folder(folder); if (file_list) { Eina_List *l = NULL; EINA_LIST_FOREACH(file_list, l, file_path) { DEBUG_TRACE("file_path: %s", file_path); - item = mp_playlist_mgr_item_append(ad->playlist_mgr, file_path, NULL, NULL, NULL, MP_TRACK_URI); + item = + mp_playlist_mgr_item_append(ad->playlist_mgr, + file_path, NULL, + NULL, NULL, + MP_TRACK_URI); if (!cur && !g_strcmp0(path, file_path)) { cur = item; } @@ -1569,7 +1730,10 @@ _mp_common_view_by_folder(const char *path, app_control_h app_control) mp_playlist_mgr_set_current(ad->playlist_mgr, cur); } else { DEBUG_TRACE("Setting hidden file"); - item = mp_playlist_mgr_item_append(ad->playlist_mgr, hidden_file_path, NULL, NULL, NULL, MP_TRACK_URI); + item = + mp_playlist_mgr_item_append(ad->playlist_mgr, + hidden_file_path, NULL, + NULL, NULL, MP_TRACK_URI); cur = item; mp_playlist_mgr_set_current(ad->playlist_mgr, cur); } @@ -1586,8 +1750,7 @@ _mp_common_view_by_folder(const char *path, app_control_h app_control) return ret; } -bool -mp_common_parse_view_operation(app_control_h app_control) +bool mp_common_parse_view_operation(app_control_h app_control) { char *uri = NULL; char *operation = NULL; @@ -1603,7 +1766,7 @@ mp_common_parse_view_operation(app_control_h app_control) goto END; } - if (!strcmp(APP_CONTROL_OPERATION_VIEW , operation)) { + if (!strcmp(APP_CONTROL_OPERATION_VIEW, operation)) { struct appdata *ad = mp_util_get_appdata(); char *value = NULL; @@ -1615,7 +1778,8 @@ mp_common_parse_view_operation(app_control_h app_control) } IF_FREE(value); - app_control_get_extra_data(app_control, "enableChangePlayer", &value); + app_control_get_extra_data(app_control, "enableChangePlayer", + &value); if (value && !g_strcmp0(value, "true")) { ad->disable_change_player = false; } else { @@ -1643,11 +1807,12 @@ mp_common_parse_view_operation(app_control_h app_control) goto END; } } else { - WARN_TRACE("Operation is not APP_CONTROL_OPERATION_VIEW [%s]", operation); + WARN_TRACE("Operation is not APP_CONTROL_OPERATION_VIEW [%s]", + operation); goto END; } -END: + END: SAFE_FREE(operation); return res; } @@ -1655,7 +1820,8 @@ END: #ifndef MP_SOUND_PLAYER bool -_mp_common_parse_open_shortcut(app_control_h app_control, MpTab_e *tab, char **shortcut_main_info) +_mp_common_parse_open_shortcut(app_control_h app_control, MpTab_e * tab, + char **shortcut_main_info) { MP_CHECK_FALSE(app_control); MP_CHECK_FALSE(tab); @@ -1663,24 +1829,31 @@ _mp_common_parse_open_shortcut(app_control_h app_control, MpTab_e *tab, char **s char *shortcut_type = NULL; - if (app_control_get_extra_data(app_control, MP_REQ_TYPE_SHORTCUT_TYPE, &shortcut_type) == APP_CONTROL_ERROR_NONE) { + if (app_control_get_extra_data + (app_control, MP_REQ_TYPE_SHORTCUT_TYPE, + &shortcut_type) == APP_CONTROL_ERROR_NONE) { if (!g_strcmp0(shortcut_type, MP_SHORTCUT_PLAYLIST)) { *tab = MP_TAB_PLAYLISTS; - app_control_get_extra_data(app_control, MP_REQ_TYPE_SHORTCUT_DESC, shortcut_main_info); + app_control_get_extra_data(app_control, + MP_REQ_TYPE_SHORTCUT_DESC, + shortcut_main_info); } else if (!g_strcmp0(shortcut_type, MP_SHORTCUT_ALBUM)) { *tab = MP_TAB_ALBUMS; - app_control_get_extra_data(app_control, MP_REQ_TYPE_SHORTCUT_DESC, shortcut_main_info); + app_control_get_extra_data(app_control, + MP_REQ_TYPE_SHORTCUT_DESC, + shortcut_main_info); } else if (!g_strcmp0(shortcut_type, MP_SHORTCUT_ARTIST)) { *tab = MP_TAB_ARTISTS; - app_control_get_extra_data(app_control, MP_REQ_TYPE_SHORTCUT_DESC, shortcut_main_info); + app_control_get_extra_data(app_control, + MP_REQ_TYPE_SHORTCUT_DESC, + shortcut_main_info); } } mp_debug("load all_viwe type [%d][%s]", *tab, *shortcut_main_info); return true; } -static bool -_mp_common_load_playlist_detail_view(char *shortcut_main_info) +static bool _mp_common_load_playlist_detail_view(char *shortcut_main_info) { startfunc; @@ -1704,17 +1877,18 @@ _mp_common_load_playlist_detail_view(char *shortcut_main_info) } MpViewMgr_t *view_manager = mp_view_mgr_get_view_manager(); - MpPlaylistDetailView_t *view_plst_detail = mp_playlist_detail_view_create(view_manager->navi, type, name, id); - mp_view_mgr_push_view(view_manager, (MpView_t *)view_plst_detail, NULL); + MpPlaylistDetailView_t *view_plst_detail = + mp_playlist_detail_view_create(view_manager->navi, type, name, id); + mp_view_mgr_push_view(view_manager, (MpView_t *) view_plst_detail, + NULL); - mp_view_update_options((MpView_t *)view_plst_detail); - mp_view_set_title((MpView_t *)view_plst_detail, name); + mp_view_update_options((MpView_t *) view_plst_detail); + mp_view_set_title((MpView_t *) view_plst_detail, name); return true; } -static bool -_mp_common_load_album_detail_view(char *shortcut_main_info) +static bool _mp_common_load_album_detail_view(char *shortcut_main_info) { mp_media_list_h media_list = NULL; @@ -1724,7 +1898,8 @@ _mp_common_load_album_detail_view(char *shortcut_main_info) int count = 0, index = 0; mp_media_info_group_list_count(MP_GROUP_BY_ALBUM, NULL, NULL, &count); - mp_media_info_group_list_create(&media_list, MP_GROUP_BY_ALBUM, NULL, NULL, 0, count); + mp_media_info_group_list_create(&media_list, MP_GROUP_BY_ALBUM, NULL, + NULL, 0, count); MP_CHECK_FALSE(media_list); mp_media_info_h media = NULL; @@ -1747,11 +1922,14 @@ _mp_common_load_album_detail_view(char *shortcut_main_info) MP_CHECK_FALSE(media); MpViewMgr_t *view_manager = mp_view_mgr_get_view_manager(); - MpAlbumDetailView_t *view_album_detail = mp_album_detail_view_create(view_manager->navi, shortcut_main_info, artist, thumbnail); - mp_view_mgr_push_view(view_manager, (MpView_t *)view_album_detail, NULL); + MpAlbumDetailView_t *view_album_detail = + mp_album_detail_view_create(view_manager->navi, shortcut_main_info, + artist, thumbnail); + mp_view_mgr_push_view(view_manager, (MpView_t *) view_album_detail, + NULL); - mp_view_update_options((MpView_t *)view_album_detail); - mp_view_set_title((MpView_t *)view_album_detail, shortcut_main_info); + mp_view_update_options((MpView_t *) view_album_detail); + mp_view_set_title((MpView_t *) view_album_detail, shortcut_main_info); mp_media_info_group_list_destroy(media_list); @@ -1759,8 +1937,7 @@ _mp_common_load_album_detail_view(char *shortcut_main_info) } -static bool -_mp_common_load_artist_detail_view(char *shortcut_main_info) +static bool _mp_common_load_artist_detail_view(char *shortcut_main_info) { mp_media_list_h media_list = NULL; @@ -1770,7 +1947,8 @@ _mp_common_load_artist_detail_view(char *shortcut_main_info) int count = 0, index = 0; mp_media_info_group_list_count(MP_GROUP_BY_ARTIST, NULL, NULL, &count); - mp_media_info_group_list_create(&media_list, MP_GROUP_BY_ARTIST, NULL, NULL, 0, count); + mp_media_info_group_list_create(&media_list, MP_GROUP_BY_ARTIST, NULL, + NULL, 0, count); MP_CHECK_FALSE(media_list); mp_media_info_h media = NULL; @@ -1793,11 +1971,14 @@ _mp_common_load_artist_detail_view(char *shortcut_main_info) MP_CHECK_FALSE(media); MpViewMgr_t *view_manager = mp_view_mgr_get_view_manager(); - MpArtistDetailView_t *view_artist_detail = mp_artist_detail_view_create(view_manager->navi, shortcut_main_info, thumbnail); - mp_view_mgr_push_view(view_manager, (MpView_t *)view_artist_detail, NULL); + MpArtistDetailView_t *view_artist_detail = + mp_artist_detail_view_create(view_manager->navi, + shortcut_main_info, thumbnail); + mp_view_mgr_push_view(view_manager, (MpView_t *) view_artist_detail, + NULL); - mp_view_update_options((MpView_t *)view_artist_detail); - mp_view_set_title((MpView_t *)view_artist_detail, shortcut_main_info); + mp_view_update_options((MpView_t *) view_artist_detail); + mp_view_set_title((MpView_t *) view_artist_detail, shortcut_main_info); mp_media_info_group_list_destroy(media_list); @@ -1807,19 +1988,20 @@ _mp_common_load_artist_detail_view(char *shortcut_main_info) static void _mp_common_load_view_by_shortcut(MpTab_e tab, char *shortcut_main_info) { - struct appdata *ad = mp_util_get_appdata(); + struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); mp_popup_destroy(ad); - if (mp_view_mgr_pop_to_view(GET_VIEW_MGR, MP_VIEW_ALL)) { + if (mp_view_mgr_pop_to_view(GET_VIEW_MGR, MP_VIEW_ALL)) { DEBUG_TRACE("Error: unable to pop to all view"); } switch (tab) { case MP_TAB_PLAYLISTS: if (!_mp_common_load_playlist_detail_view(shortcut_main_info)) { - mp_widget_text_popup(ad, GET_STR("IDS_MUSIC_BODY_NO_PLAYLISTS")); + mp_widget_text_popup(ad, + GET_STR("IDS_MUSIC_BODY_NO_PLAYLISTS")); elm_win_activate(ad->win_main); } break; @@ -1841,11 +2023,14 @@ _mp_common_load_view_by_shortcut(MpTab_e tab, char *shortcut_main_info) } static void -_mp_common_transition_finish_cb(void *data, Evas_Object * obj, void *event_info) +_mp_common_transition_finish_cb(void *data, Evas_Object * obj, + void *event_info) { startfunc; - evas_object_smart_callback_del(GET_VIEW_MGR->navi , "transition,finished", _mp_common_transition_finish_cb); - struct appdata *ad = mp_util_get_appdata(); + evas_object_smart_callback_del(GET_VIEW_MGR->navi, + "transition,finished", + _mp_common_transition_finish_cb); + struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); evas_object_show(ad->win_main); @@ -1853,8 +2038,7 @@ _mp_common_transition_finish_cb(void *data, Evas_Object * obj, void *event_info) ad->app_is_foreground = true; } -static void -_mp_common_create_all_view(MpViewMgr_t *view_manager) +static void _mp_common_create_all_view(MpViewMgr_t * view_manager) { MpAllView_t *view = NULL; if (mp_view_mgr_count_view(view_manager) == 0) { @@ -1863,33 +2047,33 @@ _mp_common_create_all_view(MpViewMgr_t *view_manager) PROFILE_OUT("mp_all_view_create"); PROFILE_IN("mp_view_update"); - mp_view_update((MpView_t*)view); + mp_view_update((MpView_t *) view); //mp_all_view_select_tab((MpView_t*)view, tab); PROFILE_OUT("mp_view_update"); PROFILE_IN("mp_view_mgr_push_view"); - mp_view_mgr_push_view(view_manager, (MpView_t *)view, NULL); + mp_view_mgr_push_view(view_manager, (MpView_t *) view, NULL); PROFILE_OUT("mp_view_mgr_push_view"); PROFILE_IN("mp_view_update_options"); - mp_view_update_options((MpView_t *)view); + mp_view_update_options((MpView_t *) view); PROFILE_OUT("mp_view_update_options"); PROFILE_IN("mp_view_set_title"); - mp_view_set_title((MpView_t *)view, STR_MP_MUSIC); + mp_view_set_title((MpView_t *) view, STR_MP_MUSIC); PROFILE_OUT("mp_view_set_title"); } } -static void -_mp_common_create_main_view(MpViewMgr_t *view_manager) +static void _mp_common_create_main_view(MpViewMgr_t * view_manager) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); - bool ready_current_track = (ad->current_track_info == NULL) ? true : false; + bool ready_current_track = + (ad->current_track_info == NULL) ? true : false; if (ready_current_track) { PROFILE_IN("ready_recent_track_info"); @@ -1902,13 +2086,15 @@ _mp_common_create_main_view(MpViewMgr_t *view_manager) char *last_played_path = NULL; mp_setting_get_now_playing_path_from_file(&last_played_path); if (mp_check_file_exist(last_played_path)) { - plst_item = mp_playlist_mgr_custom_item_new(last_played_path); + plst_item = + mp_playlist_mgr_custom_item_new(last_played_path); } IF_FREE(last_played_path); } if (plst_item) { - mp_util_load_track_info(ad, plst_item, &ad->current_track_info); + mp_util_load_track_info(ad, plst_item, + &ad->current_track_info); mp_playlist_mgr_custom_item_free(plst_item); plst_item = NULL; } @@ -1920,9 +2106,11 @@ _mp_common_create_main_view(MpViewMgr_t *view_manager) #endif -void mp_common_create_initial_view(void *appdata, app_control_h app_control, int *launch_by_shortcut) +void mp_common_create_initial_view(void *appdata, + app_control_h app_control, + int *launch_by_shortcut) { - struct appdata *ad = appdata; + struct appdata *ad = appdata; MP_CHECK(ad); #ifdef MP_SOUND_PLAYER @@ -1931,8 +2119,8 @@ void mp_common_create_initial_view(void *appdata, app_control_h app_control, int if (!player_view) { mp_common_show_player_view(MP_PLAYER_NORMAL, false, false, false); } - mp_player_view_refresh((MpPlayerView_t *)player_view); -#else //MP_SOUND_PLAYER + mp_player_view_refresh((MpPlayerView_t *) player_view); +#else //MP_SOUND_PLAYER MpTab_e tab = MP_TAB_SONGS; char *shortcut_main_info = NULL; @@ -1949,7 +2137,10 @@ void mp_common_create_initial_view(void *appdata, app_control_h app_control, int } free(shortcut_main_info); - evas_object_smart_callback_add(GET_VIEW_MGR->navi , "transition,finished", _mp_common_transition_finish_cb, NULL); + evas_object_smart_callback_add(GET_VIEW_MGR->navi, + "transition,finished", + _mp_common_transition_finish_cb, + NULL); DEBUG_TRACE("Create shortcut view done"); return; @@ -1957,14 +2148,14 @@ void mp_common_create_initial_view(void *appdata, app_control_h app_control, int _mp_common_create_main_view(GET_VIEW_MGR); -#endif //MP_SOUND_PLAYER +#endif //MP_SOUND_PLAYER } #ifndef MP_SOUND_PLAYER /*used for long press playall*/ static void -_mp_common_selected_item_data_get(void *thiz, GList **selected) +_mp_common_selected_item_data_get(void *thiz, GList ** selected) { startfunc; MpList_t *list = thiz; @@ -1988,7 +2179,8 @@ _mp_common_selected_item_data_get(void *thiz, GList **selected) } while (item) { - if (mp_list_item_select_mode_get(item) != ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) { + if (mp_list_item_select_mode_get(item) != + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) { gl_item = elm_object_item_data_get(item); if (gl_item && gl_item->checked) { sel_list = g_list_append(sel_list, gl_item); @@ -1996,7 +2188,7 @@ _mp_common_selected_item_data_get(void *thiz, GList **selected) } item = mp_list_item_next_get(item); } -END: + END: if (selected) { *selected = sel_list; } @@ -2023,10 +2215,11 @@ void mp_common_playall_cb(void *data, Evas_Object * obj, void *event_info) mp_list_item_data_t *item_data = NULL; mp_media_list_h svc_handle = NULL; - _mp_common_selected_item_data_get((MpList_t*)list, &sel_list); + _mp_common_selected_item_data_get((MpList_t *) list, &sel_list); if (g_list_length(sel_list) == 0) { - mp_widget_text_popup(ad, GET_STR("IDS_MUSIC_POP_NOTHING_SELECTED")); + mp_widget_text_popup(ad, + GET_STR("IDS_MUSIC_POP_NOTHING_SELECTED")); return; } @@ -2040,64 +2233,86 @@ void mp_common_playall_cb(void *data, Evas_Object * obj, void *event_info) mp_common_create_playlist_mgr(); } - mp_group_type_e group_type = mp_list_get_group_type((MpList_t*)list); + mp_group_type_e group_type = mp_list_get_group_type((MpList_t *) list); DEBUG_TRACE("group_type: %d", group_type); if (group_type == MP_GROUP_BY_PLAYLIST) { /* get playlist name */ if (item_data) { - ret = mp_media_info_group_get_playlist_id(item_data->handle, &playlist_id); + ret = + mp_media_info_group_get_playlist_id(item_data->handle, + &playlist_id); mp_debug("get playlist name ret = %d", ret); } /* create playlist */ - count = mp_playlist_list_set_playlist(ad->playlist_mgr, playlist_id); + count = + mp_playlist_list_set_playlist(ad->playlist_mgr, playlist_id); ad->paused_by_user = FALSE; } else if (group_type == MP_GROUP_BY_ALBUM) { /* get playlist name */ if (item_data) { - ret = mp_media_info_group_get_main_info(item_data->handle, &type_str); + ret = + mp_media_info_group_get_main_info(item_data->handle, + &type_str); } - mp_media_info_list_count(MP_TRACK_BY_ALBUM, type_str, NULL, NULL, 0, &count); - mp_media_info_list_create(&svc_handle, - MP_TRACK_BY_ALBUM, type_str, NULL, NULL, 0, 0, count); + mp_media_info_list_count(MP_TRACK_BY_ALBUM, type_str, NULL, NULL, + 0, &count); + mp_media_info_list_create(&svc_handle, MP_TRACK_BY_ALBUM, type_str, + NULL, NULL, 0, 0, count); if (count) { mp_playlist_mgr_clear(ad->playlist_mgr); - mp_util_append_media_list_item_to_playlist(ad->playlist_mgr, svc_handle, count, 0, NULL); + mp_util_append_media_list_item_to_playlist(ad->playlist_mgr, + svc_handle, count, + 0, NULL); ad->paused_by_user = FALSE; } } else if (group_type == MP_GROUP_BY_ARTIST) { /* get playlist name */ if (item_data) { - ret = mp_media_info_group_get_main_info(item_data->handle, &type_str); + ret = + mp_media_info_group_get_main_info(item_data->handle, + &type_str); } - mp_media_info_list_count(MP_TRACK_BY_ARTIST, type_str, NULL, NULL, 0, &count); - mp_media_info_list_create(&svc_handle, - MP_TRACK_BY_ARTIST, type_str, NULL, NULL, 0, 0, count); + mp_media_info_list_count(MP_TRACK_BY_ARTIST, type_str, NULL, NULL, + 0, &count); + mp_media_info_list_create(&svc_handle, MP_TRACK_BY_ARTIST, + type_str, NULL, NULL, 0, 0, count); - mp_util_append_media_list_item_to_playlist(ad->playlist_mgr, svc_handle, count, 0, NULL); + mp_util_append_media_list_item_to_playlist(ad->playlist_mgr, + svc_handle, count, 0, + NULL); if (count) { mp_playlist_mgr_clear(ad->playlist_mgr); - mp_util_append_media_list_item_to_playlist(ad->playlist_mgr, svc_handle, count, 0, NULL); + mp_util_append_media_list_item_to_playlist(ad->playlist_mgr, + svc_handle, count, + 0, NULL); ad->paused_by_user = FALSE; } } else if (group_type == MP_GROUP_BY_GENRE) { /* get playlist name */ if (item_data) { - ret = mp_media_info_group_get_main_info(item_data->handle, &type_str); + ret = + mp_media_info_group_get_main_info(item_data->handle, + &type_str); } - mp_media_info_list_count(MP_TRACK_BY_GENRE, type_str, NULL, NULL, 0, &count); - mp_media_info_list_create(&svc_handle, - MP_TRACK_BY_GENRE, type_str, NULL, NULL, 0, 0, count); + mp_media_info_list_count(MP_TRACK_BY_GENRE, type_str, NULL, NULL, + 0, &count); + mp_media_info_list_create(&svc_handle, MP_TRACK_BY_GENRE, type_str, + NULL, NULL, 0, 0, count); - mp_util_append_media_list_item_to_playlist(ad->playlist_mgr, svc_handle, count, 0, NULL); + mp_util_append_media_list_item_to_playlist(ad->playlist_mgr, + svc_handle, count, 0, + NULL); if (count) { mp_playlist_mgr_clear(ad->playlist_mgr); - mp_util_append_media_list_item_to_playlist(ad->playlist_mgr, svc_handle, count, 0, NULL); + mp_util_append_media_list_item_to_playlist(ad->playlist_mgr, + svc_handle, count, + 0, NULL); ad->paused_by_user = FALSE; } } @@ -2110,7 +2325,9 @@ void mp_common_playall_cb(void *data, Evas_Object * obj, void *event_info) if (ret) { ERROR_TRACE("Error: mp_play_new_file.."); if (ret == MP_PLAY_ERROR_NO_SONGS) { - mp_widget_text_popup(NULL, GET_STR(STR_MP_UNABLE_TO_PLAY_ERROR_OCCURED)); + mp_widget_text_popup(NULL, + GET_STR + (STR_MP_UNABLE_TO_PLAY_ERROR_OCCURED)); } } @@ -2121,11 +2338,12 @@ void mp_common_playall_cb(void *data, Evas_Object * obj, void *event_info) endfunc; } -void mp_common_playlist_rename_cb(void *data, Evas_Object *obj, void *event_info) +void mp_common_playlist_rename_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; - MpPlaylistList_t *view = (MpPlaylistList_t *)data; + MpPlaylistList_t *view = (MpPlaylistList_t *) data; MP_CHECK(view); struct appdata *ad = mp_util_get_appdata(); @@ -2139,10 +2357,11 @@ void mp_common_playlist_rename_cb(void *data, Evas_Object *obj, void *event_info GList *sel_list = NULL; mp_list_item_data_t *item_data = NULL; - _mp_common_selected_item_data_get((MpList_t*)list, &sel_list); + _mp_common_selected_item_data_get((MpList_t *) list, &sel_list); if (g_list_length(sel_list) == 0) { - mp_widget_text_popup(ad, GET_STR("IDS_MUSIC_POP_NOTHING_SELECTED")); + mp_widget_text_popup(ad, + GET_STR("IDS_MUSIC_POP_NOTHING_SELECTED")); return; } @@ -2152,11 +2371,12 @@ void mp_common_playlist_rename_cb(void *data, Evas_Object *obj, void *event_info node = g_list_next(node); } - mp_group_type_e group_type = mp_list_get_group_type((MpList_t*)list); + mp_group_type_e group_type = mp_list_get_group_type((MpList_t *) list); DEBUG_TRACE("group_type: %d", group_type); if (group_type == MP_GROUP_BY_PLAYLIST) { - Mp_Playlist_Data *mp_playlist_data = mp_edit_playlist_create(MP_PLST_RENAME); + Mp_Playlist_Data *mp_playlist_data = + mp_edit_playlist_create(MP_PLST_RENAME); MP_CHECK(mp_playlist_data); MP_CHECK(item_data); mp_playlist_data->playlist_handle = item_data->handle; @@ -2165,7 +2385,8 @@ void mp_common_playlist_rename_cb(void *data, Evas_Object *obj, void *event_info } #endif -int mp_common_get_playlist_totaltime(mp_track_type_e track_type, int playlist_id, int count) +int mp_common_get_playlist_totaltime(mp_track_type_e track_type, + int playlist_id, int count) { mp_media_list_h media_list = NULL; mp_media_info_h item = NULL; @@ -2174,7 +2395,9 @@ int mp_common_get_playlist_totaltime(mp_track_type_e track_type, int playlist_id int time = 0; int total = 0; - res = mp_media_info_list_create(&media_list, track_type, NULL, NULL, NULL, playlist_id, 0, count); + res = + mp_media_info_list_create(&media_list, track_type, NULL, NULL, + NULL, playlist_id, 0, count); MP_CHECK_VAL((res == 0), 0); MP_CHECK_VAL(media_list, 0); @@ -2195,7 +2418,7 @@ int mp_common_get_playlist_totaltime(mp_track_type_e track_type, int playlist_id #ifndef MP_SOUND_PLAYER #ifdef MP_FEATURE_PERSONAL_PAGE -all_in_personal_e mp_common_is_all_in_personal_page(Evas_Object *genlist) +all_in_personal_e mp_common_is_all_in_personal_page(Evas_Object * genlist) { MP_CHECK_VAL(genlist, MP_COMMON_ALL_ERROR); int count = elm_genlist_items_count(genlist); @@ -2239,7 +2462,7 @@ all_in_personal_e mp_common_is_all_in_personal_page(Evas_Object *genlist) continue; } - if (mp_util_is_in_personal_page((const char *)path)) { + if (mp_util_is_in_personal_page((const char *) path)) { in_count++; } else { out_count++; @@ -2255,7 +2478,8 @@ all_in_personal_e mp_common_is_all_in_personal_page(Evas_Object *genlist) } } -void mp_common_add_to_personal_page_cb(void *data, Evas_Object * obj, void *event_info) +void mp_common_add_to_personal_page_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; MpListView_t *view = (MpListView_t *) data; @@ -2263,7 +2487,10 @@ void mp_common_add_to_personal_page_cb(void *data, Evas_Object * obj, void *even mp_evas_object_del(view->more_btn_ctxpopup); - MpView_t *edit_view = (MpView_t *)mp_edit_view_create(GET_NAVIFRAME, view->content_to_show, false, MP_EDIT_VIEW_PERSONAL_PAGE_ADD); + MpView_t *edit_view = + (MpView_t *) mp_edit_view_create(GET_NAVIFRAME, + view->content_to_show, false, + MP_EDIT_VIEW_PERSONAL_PAGE_ADD); if (edit_view == NULL) { return; } @@ -2272,11 +2499,13 @@ void mp_common_add_to_personal_page_cb(void *data, Evas_Object * obj, void *even mp_view_update_options(edit_view); mp_view_set_title(edit_view, STR_MP_TILTE_SELECT_ITEM); - mp_list_view_set_select_all((MpListView_t*)edit_view, true); - mp_list_show_fast_scroll(((MpListView_t*)edit_view)->content_to_show); + mp_list_view_set_select_all((MpListView_t *) edit_view, true); + mp_list_show_fast_scroll(((MpListView_t *) edit_view)-> + content_to_show); } -void mp_common_remove_from_personal_page_cb(void *data, Evas_Object * obj, void *event_info) +void mp_common_remove_from_personal_page_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; MpListView_t *view = (MpListView_t *) data; @@ -2284,7 +2513,10 @@ void mp_common_remove_from_personal_page_cb(void *data, Evas_Object * obj, void mp_evas_object_del(view->more_btn_ctxpopup); - MpView_t *edit_view = (MpView_t *)mp_edit_view_create(GET_NAVIFRAME, view->content_to_show, false, MP_EDIT_VIEW_PERSONAL_PAGE_REMOVE); + MpView_t *edit_view = + (MpView_t *) mp_edit_view_create(GET_NAVIFRAME, + view->content_to_show, false, + MP_EDIT_VIEW_PERSONAL_PAGE_REMOVE); if (edit_view == NULL) { return; @@ -2294,18 +2526,20 @@ void mp_common_remove_from_personal_page_cb(void *data, Evas_Object * obj, void mp_view_update_options(edit_view); mp_view_set_title(edit_view, STR_MP_TILTE_SELECT_ITEM); - mp_list_view_set_select_all((MpListView_t*)edit_view, true); - mp_list_show_fast_scroll(((MpListView_t*)edit_view)->content_to_show); + mp_list_view_set_select_all((MpListView_t *) edit_view, true); + mp_list_show_fast_scroll(((MpListView_t *) edit_view)-> + content_to_show); } all_in_personal_e mp_common_personal_status(void *thiz) { - MpList_t *list = (MpList_t *)thiz; + MpList_t *list = (MpList_t *) thiz; return mp_common_is_all_in_personal_page(list->genlist); } void -mp_common_longpress_private_move_cb(void *data, Evas_Object * obj, void *event_info) +mp_common_longpress_private_move_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; struct appdata *ad = mp_util_get_appdata(); @@ -2314,8 +2548,9 @@ mp_common_longpress_private_move_cb(void *data, Evas_Object * obj, void *event_i MpList_t *list = data; MP_CHECK(list); - DEBUG_TRACE("list->personal_page_storage is %d", list->personal_page_storage); - /*0. check if is remove from personal page*/ + DEBUG_TRACE("list->personal_page_storage is %d", + list->personal_page_storage); + /*0. check if is remove from personal page */ if (list->personal_page_storage == MP_LIST_PERSONAL_PAGE_NORMAL) { mp_edit_cb_excute_move(list); } else { @@ -2335,14 +2570,16 @@ mp_common_longpress_private_move_cb(void *data, Evas_Object * obj, void *event_i void mp_common_force_close_delete() { - Ecore_Thread *delete_thread = (Ecore_Thread *)mp_edit_get_delete_thread(); + Ecore_Thread *delete_thread = + (Ecore_Thread *) mp_edit_get_delete_thread(); MP_CHECK(delete_thread); ecore_thread_cancel(delete_thread); delete_thread = NULL; } #endif -void mp_common_view_check_changed_cb(void *data, Evas_Object *obj, void *event_info) +void mp_common_view_check_changed_cb(void *data, Evas_Object * obj, + void *event_info) { MpViewMgr_t *view_mgr = mp_view_mgr_get_view_manager(); MP_CHECK(view_mgr); @@ -2351,11 +2588,11 @@ void mp_common_view_check_changed_cb(void *data, Evas_Object *obj, void *event_i mp_view_update_options_edit(view); } -bool mp_common_track_is_current(mp_media_info_h media, MpList_t *list) +bool mp_common_track_is_current(mp_media_info_h media, MpList_t * list) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK_FALSE(ad); - mp_track_info_t* current = ad->current_track_info; + mp_track_info_t *current = ad->current_track_info; MP_CHECK_FALSE(current); char *uri = NULL; @@ -2367,5 +2604,3 @@ bool mp_common_track_is_current(mp_media_info_h media, MpList_t *list) } return match; } - - diff --git a/src/common/mp-edit-callback.c b/src/common/mp-edit-callback.c index 76d8425..a16bce4 100644 --- a/src/common/mp-edit-callback.c +++ b/src/common/mp-edit-callback.c @@ -68,15 +68,15 @@ static int g_selected_tracklist_count; static void *g_playlist_handle; static char *g_playlist_name; -void -mp_edit_cb_excute_track_delete(void *data); +void mp_edit_cb_excute_track_delete(void *data); static void -_mp_edit_cb_create_playlist_cb(void *data, Evas_Object * obj, void *event_info) +_mp_edit_cb_create_playlist_cb(void *data, Evas_Object * obj, + void *event_info) { startfunc; evas_object_del(obj); - int response = (int)event_info; + int response = (int) event_info; if (response == MP_POPUP_NO) { DEBUG_TRACE("cancel btn click"); mp_view_mgr_post_event(GET_VIEW_MGR, MP_POPUP_CANCEL); @@ -84,7 +84,8 @@ _mp_edit_cb_create_playlist_cb(void *data, Evas_Object * obj, void *event_info) } MP_CHECK(response); - Mp_Playlist_Data *mp_playlist_data = mp_edit_playlist_create(MP_PLST_CREATE); + Mp_Playlist_Data *mp_playlist_data = + mp_edit_playlist_create(MP_PLST_CREATE); MP_CHECK(mp_playlist_data); mp_edit_playlist_set_edit_list(mp_playlist_data, data); mp_edit_playlist_content_create(mp_playlist_data); @@ -93,7 +94,8 @@ _mp_edit_cb_create_playlist_cb(void *data, Evas_Object * obj, void *event_info) } void -_mp_edit_delete_track_popup_response_cb(void *data, Evas_Object * obj, void *event_info) +_mp_edit_delete_track_popup_response_cb(void *data, Evas_Object * obj, + void *event_info) { startfunc; DEBUG_TRACE(""); @@ -103,7 +105,7 @@ _mp_edit_delete_track_popup_response_cb(void *data, Evas_Object * obj, void *eve mp_evas_object_del(obj); ad->popup_delete = NULL; - int response = (int)event_info; + int response = (int) event_info; if (response == MP_POPUP_NO) { mp_view_mgr_post_event(GET_VIEW_MGR, MP_POPUP_CANCEL); return; @@ -125,8 +127,11 @@ void mp_edit_create_track_delete_popup(void *data) char *help_txt = NULL; title = STR_MP_DELETE; - title_txt = g_strconcat("", GET_STR(title), "", NULL); - Evas_Object *popup = mp_popup_create(ad->win_main, MP_POPUP_NORMAL, title_txt, data, _mp_edit_delete_track_popup_response_cb, ad); + title_txt = + g_strconcat("", GET_STR(title), "", NULL); + Evas_Object *popup = + mp_popup_create(ad->win_main, MP_POPUP_NORMAL, title_txt, data, + _mp_edit_delete_track_popup_response_cb, ad); ad->popup_delete = popup; //making help_txt char *markup = NULL; @@ -138,20 +143,23 @@ void mp_edit_create_track_delete_popup(void *data) IF_FREE(markup); mp_popup_button_set(popup, MP_POPUP_BTN_1, STR_MP_CANCEL, MP_POPUP_NO); - mp_popup_button_set(popup, MP_POPUP_BTN_2, STR_MP_DELETE, MP_POPUP_YES); + mp_popup_button_set(popup, MP_POPUP_BTN_2, STR_MP_DELETE, + MP_POPUP_YES); evas_object_show(popup); } static void -_mp_edit_cb_add_to_playlist_cb(void *data, Evas_Object * obj, void *event_info) +_mp_edit_cb_add_to_playlist_cb(void *data, Evas_Object * obj, + void *event_info) { startfunc; struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); Elm_Object_Item *selected_item = event_info; - Popup_genlist_item *gli_data = (Popup_genlist_item *)elm_object_item_data_get(selected_item); + Popup_genlist_item *gli_data = + (Popup_genlist_item *) elm_object_item_data_get(selected_item); if (!gli_data) { return; } @@ -163,17 +171,18 @@ _mp_edit_cb_add_to_playlist_cb(void *data, Evas_Object * obj, void *event_info) mp_media_info_group_get_main_info(item, &playlist_name); mp_popup_destroy(ad); - mp_edit_cb_excute_add_to_playlist(gli_data->item_data, g_playlist_id, playlist_name, true); + mp_edit_cb_excute_add_to_playlist(gli_data->item_data, g_playlist_id, + playlist_name, true); } -static void _mp_edit_cb_popup_del_cb(void *data, Evas * e, Evas_Object * eo, void *event_info) +static void _mp_edit_cb_popup_del_cb(void *data, Evas * e, + Evas_Object * eo, void *event_info) { mp_media_list_h list = data; mp_media_info_group_list_destroy(list); } -void -mp_edit_create_add_to_playlist_popup(void *data) +void mp_edit_create_add_to_playlist_popup(void *data) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); @@ -183,18 +192,24 @@ mp_edit_create_add_to_playlist_popup(void *data) Evas_Object *popup = NULL; if (mp_list_get_checked_count(list) <= 0) { - mp_widget_text_popup(ad, GET_STR("IDS_MUSIC_POP_NOTHING_SELECTED")); + mp_widget_text_popup(ad, + GET_STR("IDS_MUSIC_POP_NOTHING_SELECTED")); return; } - popup = mp_genlist_popup_create(ad->win_main, MP_POPUP_ADD_TO_PLST, data, ad); + popup = + mp_genlist_popup_create(ad->win_main, MP_POPUP_ADD_TO_PLST, data, + ad); mp_retm_if(!popup, "popup is NULL !!!"); - mp_popup_response_callback_set(popup, _mp_edit_cb_create_playlist_cb, data); + mp_popup_response_callback_set(popup, _mp_edit_cb_create_playlist_cb, + data); int i = 0, count = -1, ret = -1; - ret = mp_media_info_group_list_count(MP_GROUP_BY_PLAYLIST, NULL, NULL, &count); + ret = + mp_media_info_group_list_count(MP_GROUP_BY_PLAYLIST, NULL, NULL, + &count); if (ret != 0) { ERROR_TRACE("Error in mp_media_info_group_list_count (%d)", ret); return; @@ -203,7 +218,10 @@ mp_edit_create_add_to_playlist_popup(void *data) if (count) { mp_media_list_h media_list = NULL; - ret = mp_media_info_group_list_create(&media_list, MP_GROUP_BY_PLAYLIST, NULL, NULL, 0, count); + ret = + mp_media_info_group_list_create(&media_list, + MP_GROUP_BY_PLAYLIST, NULL, + NULL, 0, count); if (ret != 0) { WARN_TRACE("Fail to get playlist"); return; @@ -215,20 +233,30 @@ mp_edit_create_add_to_playlist_popup(void *data) ret = mp_media_info_group_get_main_info(item, &name); mp_retm_if(ret != 0, "Fail to get value"); - mp_genlist_popup_item_append(popup, name, NULL, NULL, (void *)list, _mp_edit_cb_add_to_playlist_cb, (void *)item); + mp_genlist_popup_item_append(popup, name, NULL, NULL, + (void *) list, + _mp_edit_cb_add_to_playlist_cb, + (void *) item); } - evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, _mp_edit_cb_popup_del_cb, media_list); + evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, + _mp_edit_cb_popup_del_cb, + media_list); } else { - Elm_Object_Item *it = mp_genlist_popup_item_append(popup, GET_STR(STR_MP_NO_PLAYLISTS), NULL, NULL, NULL, NULL, ad); - elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + Elm_Object_Item *it = + mp_genlist_popup_item_append(popup, + GET_STR(STR_MP_NO_PLAYLISTS), + NULL, NULL, NULL, NULL, ad); + elm_genlist_item_select_mode_set(it, + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); } evas_object_show(popup); } static void -_mp_edit_progress_popup_response_cb(void *data, Evas_Object * obj, void *event_info) +_mp_edit_progress_popup_response_cb(void *data, Evas_Object * obj, + void *event_info) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); @@ -242,28 +270,36 @@ _mp_edit_progress_popup_response_cb(void *data, Evas_Object * obj, void *event_i } WARN_TRACE("EDIT progress has been completed. Now update views.."); - DEBUG_TRACE("selected_count, %d, error_count: %d", g_selected_count, g_error_count); + DEBUG_TRACE("selected_count, %d, error_count: %d", g_selected_count, + g_error_count); if (g_edit_operation == MP_EDIT_ADD_TO_PLAYLIST) { - mp_view_update(mp_view_mgr_get_view(GET_VIEW_MGR, MP_VIEW_PLAYLIST_DETAIL)); + mp_view_update(mp_view_mgr_get_view + (GET_VIEW_MGR, MP_VIEW_PLAYLIST_DETAIL)); mp_view_mgr_post_event(GET_VIEW_MGR, MP_ADD_TO_PLAYLIST_DONE); } else if (g_edit_operation == MP_EDIT_DELETE) { if ((g_selected_count == 1) && g_error_count) { - mp_util_post_status_message(ad, GET_SYS_STR("IDS_COM_POP_FAILED")); + mp_util_post_status_message(ad, + GET_SYS_STR("IDS_COM_POP_FAILED")); } if (g_group_type == MP_GROUP_BY_FOLDER) { DEBUG_TRACE("update all view"); - mp_view_update(mp_view_mgr_get_view(GET_VIEW_MGR, MP_VIEW_ALL)); + mp_view_update(mp_view_mgr_get_view + (GET_VIEW_MGR, MP_VIEW_ALL)); } - //set selection info && update buttons - MpListView_t *view = (MpListView_t *)mp_view_mgr_get_top_view(GET_VIEW_MGR); + MpListView_t *view = + (MpListView_t *) mp_view_mgr_get_top_view(GET_VIEW_MGR); MP_CHECK(view); bool list_view = false; mp_list_view_is_list_view(view, &list_view); if (list_view && mp_list_get_edit(view->content_to_show)) { - mp_view_update_options_edit((MpView_t *)view); - view->selection_info = mp_util_create_selectioninfo_with_count(view, mp_list_get_checked_count(view->content_to_show)); + mp_view_update_options_edit((MpView_t *) view); + view->selection_info = + mp_util_create_selectioninfo_with_count(view, + mp_list_get_checked_count + (view-> + content_to_show)); } mp_view_mgr_post_event(GET_VIEW_MGR, MP_DELETE_DONE); @@ -274,7 +310,7 @@ _mp_edit_progress_popup_response_cb(void *data, Evas_Object * obj, void *event_i } static void -_mp_edit_cb_add_to_plst_thread(void *data, Ecore_Thread *thread) +_mp_edit_cb_add_to_plst_thread(void *data, Ecore_Thread * thread) { startfunc; struct appdata *ad = mp_util_get_appdata(); @@ -308,7 +344,9 @@ _mp_edit_cb_add_to_plst_thread(void *data, Ecore_Thread *thread) node = g_list_previous(node); if (!item) { WARN_TRACE("CHECK here..."); - ecore_thread_feedback(thread, (void *)MP_EDIT_THREAD_FEEDBACK_CANCEL_BY_EXCEPTION); + ecore_thread_feedback(thread, + (void *) + MP_EDIT_THREAD_FEEDBACK_CANCEL_BY_EXCEPTION); goto mp_exception; } item_handle = (item->handle); @@ -320,82 +358,33 @@ _mp_edit_cb_add_to_plst_thread(void *data, Ecore_Thread *thread) case MP_LIST_TYPE_TRACK: case MP_LIST_TYPE_ARTIST_DETAIL: case MP_LIST_TYPE_ALBUM_DETAIL: - case MP_LIST_TYPE_ALL: { - ret = mp_media_info_get_media_id(item_handle, &fid); - if (ret != 0) { - ERROR_TRACE("CRITICAL ERROR ## CHECK BELOW ITEM"); - - goto mp_exception; - } - - int res = 0; - if (g_playlist_id == -1) { /*favoriate playlist*/ - res = mp_media_info_set_favorite(item_handle, true); - - } else { - mp_media_info_get_thumbnail_path(item_handle, &thumbnail_path); - res = mp_media_info_playlist_add_item(playlist_h, fid, thumbnail_path); - } - if (res) { - WARN_TRACE(""); - ecore_thread_feedback(thread, (void *)MP_EDIT_THREAD_FEEDBACK_UNABLE_TO_ADD_PLST); - ecore_thread_feedback(thread, (void *)MP_EDIT_THREAD_FEEDBACK_CANCEL_BY_EXCEPTION); - goto mp_exception; - } else { - g_playlist_track_count++; - } - -#ifdef MP_PLAYLIST_MAX_ITEM_COUNT - if (g_playlist_track_count >= MP_PLAYLIST_MAX_ITEM_COUNT) { - DEBUG_TRACE("unable to add more tracks..."); - //ecore_thread_feedback(thread, (void *)MP_EDIT_THREAD_FEEDBACK_CANCEL_BY_EXCEPTION); - goto mp_exception; - } -#endif - g_selected_tracklist_count += 1; + case MP_LIST_TYPE_ALL:{ + ret = mp_media_info_get_media_id(item_handle, &fid); + if (ret != 0) { + ERROR_TRACE("CRITICAL ERROR ## CHECK BELOW ITEM"); - break; - } - case MP_LIST_TYPE_GROUP: { - mp_track_type_e item_type = MP_TRACK_ALL; - int count = 0, i; - mp_media_info_h item = NULL; - - if (g_group_type == MP_GROUP_BY_FOLDER) { - ret = mp_media_info_group_get_folder_id(item_handle, &title); - } else { - ret = mp_media_info_group_get_main_info(item_handle, &title); - } - MP_CHECK_EXCEP(ret == 0); - - item_type = mp_menu_get_track_type_by_group(g_group_type); - ret = mp_media_info_list_count(item_type, title, NULL, NULL, 0, &count); - MP_CHECK_EXCEP(ret == 0); - if (group_track_handle) { - mp_media_info_list_destroy(group_track_handle); - group_track_handle = NULL; - } - ret = mp_media_info_list_create(&group_track_handle, item_type, title, NULL, NULL, 0, 0, count); - MP_CHECK_EXCEP(ret == 0); - - for (i = 0; i < count; i++) { - char *fid = NULL; - char *thumbnail_path = NULL; - item = mp_media_info_list_nth_item(group_track_handle, i); - ret = mp_media_info_get_media_id(item, &fid); - MP_CHECK_EXCEP(ret == 0); + goto mp_exception; + } int res = 0; - if (g_playlist_id == -1) { /*favoriate playlist*/ - res = mp_media_info_set_favorite(item, true); + if (g_playlist_id == -1) { /*favoriate playlist */ + res = mp_media_info_set_favorite(item_handle, true); + } else { - mp_media_info_get_thumbnail_path(item, &thumbnail_path); - res = mp_media_info_playlist_add_item(playlist_h, fid, thumbnail_path); + mp_media_info_get_thumbnail_path(item_handle, + &thumbnail_path); + res = + mp_media_info_playlist_add_item(playlist_h, fid, + thumbnail_path); } if (res) { WARN_TRACE(""); - ecore_thread_feedback(thread, (void *)MP_EDIT_THREAD_FEEDBACK_UNABLE_TO_ADD_PLST); - ecore_thread_feedback(thread, (void *)MP_EDIT_THREAD_FEEDBACK_CANCEL_BY_EXCEPTION); + ecore_thread_feedback(thread, + (void *) + MP_EDIT_THREAD_FEEDBACK_UNABLE_TO_ADD_PLST); + ecore_thread_feedback(thread, + (void *) + MP_EDIT_THREAD_FEEDBACK_CANCEL_BY_EXCEPTION); goto mp_exception; } else { g_playlist_track_count++; @@ -404,22 +393,101 @@ _mp_edit_cb_add_to_plst_thread(void *data, Ecore_Thread *thread) #ifdef MP_PLAYLIST_MAX_ITEM_COUNT if (g_playlist_track_count >= MP_PLAYLIST_MAX_ITEM_COUNT) { DEBUG_TRACE("unable to add more tracks..."); - ecore_thread_feedback(thread, (void *)MP_EDIT_THREAD_FEEDBACK_CANCEL_BY_EXCEPTION); + //ecore_thread_feedback(thread, (void *)MP_EDIT_THREAD_FEEDBACK_CANCEL_BY_EXCEPTION); goto mp_exception; } #endif + g_selected_tracklist_count += 1; + + break; + } + case MP_LIST_TYPE_GROUP:{ + mp_track_type_e item_type = MP_TRACK_ALL; + int count = 0, i; + mp_media_info_h item = NULL; + + if (g_group_type == MP_GROUP_BY_FOLDER) { + ret = + mp_media_info_group_get_folder_id(item_handle, + &title); + } else { + ret = + mp_media_info_group_get_main_info(item_handle, + &title); + } + MP_CHECK_EXCEP(ret == 0); + + item_type = mp_menu_get_track_type_by_group(g_group_type); + ret = + mp_media_info_list_count(item_type, title, NULL, NULL, + 0, &count); + MP_CHECK_EXCEP(ret == 0); + if (group_track_handle) { + mp_media_info_list_destroy(group_track_handle); + group_track_handle = NULL; + } + ret = + mp_media_info_list_create(&group_track_handle, + item_type, title, NULL, NULL, + 0, 0, count); + MP_CHECK_EXCEP(ret == 0); + + for (i = 0; i < count; i++) { + char *fid = NULL; + char *thumbnail_path = NULL; + item = + mp_media_info_list_nth_item(group_track_handle, i); + ret = mp_media_info_get_media_id(item, &fid); + MP_CHECK_EXCEP(ret == 0); + + int res = 0; + if (g_playlist_id == -1) { /*favoriate playlist */ + res = mp_media_info_set_favorite(item, true); + } else { + mp_media_info_get_thumbnail_path(item, + &thumbnail_path); + res = + mp_media_info_playlist_add_item(playlist_h, + fid, + thumbnail_path); + } + if (res) { + WARN_TRACE(""); + ecore_thread_feedback(thread, + (void *) + MP_EDIT_THREAD_FEEDBACK_UNABLE_TO_ADD_PLST); + ecore_thread_feedback(thread, + (void *) + MP_EDIT_THREAD_FEEDBACK_CANCEL_BY_EXCEPTION); + goto mp_exception; + } else { + g_playlist_track_count++; + } + +#ifdef MP_PLAYLIST_MAX_ITEM_COUNT + if (g_playlist_track_count >= + MP_PLAYLIST_MAX_ITEM_COUNT) { + DEBUG_TRACE("unable to add more tracks..."); + ecore_thread_feedback(thread, + (void *) + MP_EDIT_THREAD_FEEDBACK_CANCEL_BY_EXCEPTION); + goto mp_exception; + } +#endif + } + g_selected_tracklist_count += count; + break; } - g_selected_tracklist_count += count; - break; - } default: - ecore_thread_feedback(thread, (void *)MP_EDIT_THREAD_FEEDBACK_CANCEL_BY_EXCEPTION); + ecore_thread_feedback(thread, + (void *) + MP_EDIT_THREAD_FEEDBACK_CANCEL_BY_EXCEPTION); WARN_TRACE("unexpected case... [%d]", g_list_type); goto mp_exception; } IF_FREE(title); } -mp_exception: + mp_exception: mp_media_info_playlist_handle_destroy(playlist_h); if (group_track_handle) { @@ -433,8 +501,7 @@ mp_exception: sleep(1); } -inline static int -_delete_track(mp_media_info_h item_handle) +inline static int _delete_track(mp_media_info_h item_handle) { int ret = 0; char *uri = NULL, *fid = NULL; @@ -442,55 +509,62 @@ _delete_track(mp_media_info_h item_handle) MP_CHECK_VAL(item_handle, -1); switch (g_track_type) { - case MP_TRACK_BY_PLAYLIST: { - int member_id = 0; - ret = mp_media_info_get_playlist_member_id(item_handle, &member_id); - MP_CHECK_VAL(ret == 0, -1); - ret = mp_media_info_playlist_remove_media(g_playlist_handle, member_id); - MP_CHECK_VAL(ret == 0, -1); - - mp_common_playlist_album_update(g_playlist_handle); + case MP_TRACK_BY_PLAYLIST:{ + int member_id = 0; + ret = + mp_media_info_get_playlist_member_id(item_handle, + &member_id); + MP_CHECK_VAL(ret == 0, -1); + ret = + mp_media_info_playlist_remove_media(g_playlist_handle, + member_id); + MP_CHECK_VAL(ret == 0, -1); + + mp_common_playlist_album_update(g_playlist_handle); - break; - } - case MP_TRACK_BY_ADDED_TIME: { - ret = mp_media_info_set_added_time(item_handle, 0); - MP_CHECK_VAL(ret == 0, -1); - break; - } - case MP_TRACK_BY_PLAYED_TIME: { - ret = mp_media_info_set_played_time(item_handle, 0); - MP_CHECK_VAL(ret == 0, -1); - break; - } - case MP_TRACK_BY_FAVORITE: { - ret = mp_media_info_set_favorite(item_handle, 0); - MP_CHECK_VAL(ret == 0, -1); - break; - } - case MP_TRACK_BY_PLAYED_COUNT: { - ret = mp_media_info_set_played_count(item_handle, 0); - MP_CHECK_VAL(ret == 0, -1); - break; - } - default: { - ret = mp_media_info_get_media_id(item_handle, &fid); - ret = mp_media_info_get_file_path(item_handle, &uri); - MP_CHECK_VAL(ret == 0, -1); - - if (mp_util_delete_track(NULL, fid, uri) != MP_FILE_DELETE_ERR_NONE) { - DEBUG_TRACE("Fail to delete item, fid: %d, path: %s", fid, uri); - return -1; + break; + } + case MP_TRACK_BY_ADDED_TIME:{ + ret = mp_media_info_set_added_time(item_handle, 0); + MP_CHECK_VAL(ret == 0, -1); + break; + } + case MP_TRACK_BY_PLAYED_TIME:{ + ret = mp_media_info_set_played_time(item_handle, 0); + MP_CHECK_VAL(ret == 0, -1); + break; + } + case MP_TRACK_BY_FAVORITE:{ + ret = mp_media_info_set_favorite(item_handle, 0); + MP_CHECK_VAL(ret == 0, -1); + break; + } + case MP_TRACK_BY_PLAYED_COUNT:{ + ret = mp_media_info_set_played_count(item_handle, 0); + MP_CHECK_VAL(ret == 0, -1); + break; + } + default:{ + ret = mp_media_info_get_media_id(item_handle, &fid); + ret = mp_media_info_get_file_path(item_handle, &uri); + MP_CHECK_VAL(ret == 0, -1); + + if (mp_util_delete_track(NULL, fid, uri) != + MP_FILE_DELETE_ERR_NONE) { + DEBUG_TRACE("Fail to delete item, fid: %d, path: %s", fid, + uri); + return -1; + } + ecore_thread_feedback(g_edit_thread, + (void *) + MP_EDIT_THREAD_FEEDBACK_TRACK_DELETED); + break; } - ecore_thread_feedback(g_edit_thread, (void *)MP_EDIT_THREAD_FEEDBACK_TRACK_DELETED); - break; - } } return 0; } -inline static int -_delete_playlist(mp_media_info_h item_handle) +inline static int _delete_playlist(mp_media_info_h item_handle) { int ret = 0; int plst_id; @@ -501,8 +575,7 @@ _delete_playlist(mp_media_info_h item_handle) return 0; } -inline static int -_delete_group(mp_media_info_h item_handle) +inline static int _delete_group(mp_media_info_h item_handle) { int ret = 0; mp_track_type_e item_type = MP_TRACK_ALL; @@ -523,13 +596,16 @@ _delete_group(mp_media_info_h item_handle) } item_type = mp_menu_get_track_type_by_group(g_group_type); - ret = mp_media_info_list_count(item_type, title, NULL, NULL, 0, &count); + ret = + mp_media_info_list_count(item_type, title, NULL, NULL, 0, &count); if (ret != 0) { IF_FREE(title); return -1; } - ret = mp_media_info_list_create(&group_track_handle, item_type, title, NULL, NULL, 0, 0, count); + ret = + mp_media_info_list_create(&group_track_handle, item_type, title, + NULL, NULL, 0, 0, count); if (ret != 0) { IF_FREE(title); return -1; @@ -539,21 +615,22 @@ _delete_group(mp_media_info_h item_handle) item = mp_media_info_list_nth_item(group_track_handle, i); mp_media_info_get_media_id(item, &fid); mp_media_info_get_file_path(item, &uri); - if (mp_util_delete_track(NULL, fid, uri) != MP_FILE_DELETE_ERR_NONE) { + if (mp_util_delete_track(NULL, fid, uri) != + MP_FILE_DELETE_ERR_NONE) { WARN_TRACE("Fail to delete group"); ret = -1; } } IF_FREE(title); - ecore_thread_feedback(g_edit_thread, (void *)MP_EDIT_THREAD_FEEDBACK_TRACK_DELETED); + ecore_thread_feedback(g_edit_thread, + (void *) MP_EDIT_THREAD_FEEDBACK_TRACK_DELETED); mp_media_info_list_destroy(group_track_handle); return ret; } -static void -_mp_edit_cb_delete_thread(void *data, Ecore_Thread *thread) +static void _mp_edit_cb_delete_thread(void *data, Ecore_Thread * thread) { startfunc; struct appdata *ad = mp_util_get_appdata(); @@ -562,7 +639,8 @@ _mp_edit_cb_delete_thread(void *data, Ecore_Thread *thread) mp_list_item_data_t *item = NULL; mp_media_info_h item_handle = NULL; - DEBUG_TRACE("g_list_type: %d, track_type: %d, g_group_type: %d", g_list_type, g_track_type, g_group_type); + DEBUG_TRACE("g_list_type: %d, track_type: %d, g_group_type: %d", + g_list_type, g_track_type, g_group_type); mp_media_info_connect(); @@ -578,7 +656,9 @@ _mp_edit_cb_delete_thread(void *data, Ecore_Thread *thread) node = g_list_previous(node); if (!item) { WARN_TRACE("CHECK here..."); - ecore_thread_feedback(thread, (void *)MP_EDIT_THREAD_FEEDBACK_CANCEL_BY_EXCEPTION); + ecore_thread_feedback(thread, + (void *) + MP_EDIT_THREAD_FEEDBACK_CANCEL_BY_EXCEPTION); goto mp_exception; } item_handle = (item->handle); @@ -590,33 +670,35 @@ _mp_edit_cb_delete_thread(void *data, Ecore_Thread *thread) case MP_LIST_TYPE_TRACK: case MP_LIST_TYPE_ALBUM_DETAIL: case MP_LIST_TYPE_ARTIST_DETAIL: - case MP_LIST_TYPE_ALL: { - if (_delete_track(item_handle)) { - g_error_count++; - } else { - ecore_thread_feedback(thread, item->it); + case MP_LIST_TYPE_ALL:{ + if (_delete_track(item_handle)) { + g_error_count++; + } else { + ecore_thread_feedback(thread, item->it); + } + break; } - break; - } - case MP_LIST_TYPE_PLAYLIST: { - if (!_delete_playlist(item_handle)) { - ecore_thread_feedback(thread, item->it); + case MP_LIST_TYPE_PLAYLIST:{ + if (!_delete_playlist(item_handle)) { + ecore_thread_feedback(thread, item->it); + } + break; } - break; - } - case MP_LIST_TYPE_GROUP: { - if (!_delete_group(item_handle)) { - ecore_thread_feedback(thread, item->it); + case MP_LIST_TYPE_GROUP:{ + if (!_delete_group(item_handle)) { + ecore_thread_feedback(thread, item->it); + } + break; } - break; - } default: - ecore_thread_feedback(thread, (void *)MP_EDIT_THREAD_FEEDBACK_CANCEL_BY_EXCEPTION); + ecore_thread_feedback(thread, + (void *) + MP_EDIT_THREAD_FEEDBACK_CANCEL_BY_EXCEPTION); WARN_TRACE("unexpected case..."); goto mp_exception; } } -mp_exception: + mp_exception: //To make progress popup visible if only one item deleted. sleep(1); @@ -635,7 +717,8 @@ static void _mp_edit_cb_check_playlist() next_play = true; } - mp_playlist_mgr_check_existance_and_refresh(ad->playlist_mgr, ¤t_removed); + mp_playlist_mgr_check_existance_and_refresh(ad->playlist_mgr, + ¤t_removed); if (current_removed) { mp_play_destory(ad); if (mp_playlist_mgr_count(ad->playlist_mgr) == 0) { @@ -654,19 +737,22 @@ static void _mp_edit_cb_check_playlist() #endif char *data_path = app_get_data_path(); - /*as all the items are removed, remove now-playing.ini to avoid copy the same track but in DB, they are different*/ - char nowplaying_ini[1024] = {0}; - snprintf(nowplaying_ini, 1024, "%s%s", data_path, MP_NOWPLAYING_INI_FILE_NAME); + /*as all the items are removed, remove now-playing.ini to avoid copy the same track but in DB, they are different */ + char nowplaying_ini[1024] = { 0 }; + snprintf(nowplaying_ini, 1024, "%s%s", data_path, + MP_NOWPLAYING_INI_FILE_NAME); mp_file_remove(nowplaying_ini); - /* remove playing_track.ini to avoid lockscreen still using the file content*/ + /* remove playing_track.ini to avoid lockscreen still using the file content */ - char playing_ini[1024] = {0}; + char playing_ini[1024] = { 0 }; #ifndef MP_SOUND_PLAYER - snprintf(playing_ini, 1024, "%s%s", data_path, MP_PLAYING_INI_FILE_NAME_MUSIC); + snprintf(playing_ini, 1024, "%s%s", data_path, + MP_PLAYING_INI_FILE_NAME_MUSIC); free(data_path); mp_file_remove(playing_ini); #else - snprintf(playing_ini, 1024, "%s%s", data_path, MP_PLAYING_INI_FILE_NAME_SOUND); + snprintf(playing_ini, 1024, "%s%s", data_path, + MP_PLAYING_INI_FILE_NAME_SOUND); free(data_path); mp_file_remove(playing_ini); #endif @@ -678,12 +764,14 @@ static void _mp_edit_cb_check_playlist() static void -_mp_edit_cb_edit_thread_notify_cb(void *data, Ecore_Thread *thread, void *msg_data) +_mp_edit_cb_edit_thread_notify_cb(void *data, Ecore_Thread * thread, + void *msg_data) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); - mp_edit_thread_feedback_e feedback = (mp_edit_thread_feedback_e)msg_data; + mp_edit_thread_feedback_e feedback = + (mp_edit_thread_feedback_e) msg_data; switch (feedback) { case MP_EDIT_THREAD_FEEDBACK_UNABLE_TO_ADD_PLST: mp_widget_text_popup(ad, GET_STR("IDS_MUSIC_POP_UNABLE_TO_ADD")); @@ -693,31 +781,46 @@ _mp_edit_cb_edit_thread_notify_cb(void *data, Ecore_Thread *thread, void *msg_da mp_popup_response(ad->popup[MP_POPUP_PROGRESS], MP_POPUP_NO); break; - case MP_EDIT_THREAD_FEEDBACK_TRACK_DELETED: { - _mp_edit_cb_check_playlist(); - } - break; + case MP_EDIT_THREAD_FEEDBACK_TRACK_DELETED:{ + _mp_edit_cb_check_playlist(); + } + break; default: DEBUG_TRACE("delete genlist item"); - if (g_track_type == MP_TRACK_BY_PLAYLIST && g_playlist_handle && ad->playlist_mgr) { + if (g_track_type == MP_TRACK_BY_PLAYLIST && g_playlist_handle + && ad->playlist_mgr) { int item_playlist_id = 0; - mp_media_info_group_get_playlist_id(g_playlist_handle, &item_playlist_id); - int current_playlist_id = mp_playlist_mgr_get_playlist_id(ad->playlist_mgr); - if (current_playlist_id && current_playlist_id == item_playlist_id) { - mp_list_item_data_t *item_data = elm_object_item_data_get(msg_data); + mp_media_info_group_get_playlist_id(g_playlist_handle, + &item_playlist_id); + int current_playlist_id = + mp_playlist_mgr_get_playlist_id(ad->playlist_mgr); + if (current_playlist_id + && current_playlist_id == item_playlist_id) { + mp_list_item_data_t *item_data = + elm_object_item_data_get(msg_data); if (item_data && item_data->handle) { int member_id = 0; - mp_media_info_get_playlist_member_id(item_data->handle, &member_id); - mp_debug("item playlist_id = %d, member_id = %d", item_playlist_id, member_id); - mp_plst_item *plst_item = mp_playlist_mgr_get_item_by_playlist_memeber_id(ad->playlist_mgr, member_id); + mp_media_info_get_playlist_member_id(item_data->handle, + &member_id); + mp_debug("item playlist_id = %d, member_id = %d", + item_playlist_id, member_id); + mp_plst_item *plst_item = + mp_playlist_mgr_get_item_by_playlist_memeber_id + (ad->playlist_mgr, member_id); if (plst_item) { - if (plst_item == mp_playlist_mgr_get_current(ad->playlist_mgr)) { + if (plst_item == + mp_playlist_mgr_get_current(ad-> + playlist_mgr)) { mp_play_destory(ad); - mp_playlist_mgr_item_remove_item(ad->playlist_mgr, plst_item); + mp_playlist_mgr_item_remove_item(ad-> + playlist_mgr, + plst_item); mp_play_new_file(ad, true); } else { - mp_playlist_mgr_item_remove_item(ad->playlist_mgr, plst_item); + mp_playlist_mgr_item_remove_item(ad-> + playlist_mgr, + plst_item); } } } @@ -736,9 +839,9 @@ _mp_edit_cb_edit_thread_notify_cb(void *data, Ecore_Thread *thread, void *msg_da static Eina_Bool _del_old_playlist_detail_view_cb(void *data) { startfunc; - MpView_t *view = (MpView_t *)data; + MpView_t *view = (MpView_t *) data; if (view) { - elm_object_item_del(view->navi_it); //elm_naviframe_item_pop does not work + elm_object_item_del(view->navi_it); //elm_naviframe_item_pop does not work } mp_view_mgr_post_event(GET_VIEW_MGR, MP_ADD_TO_PLAYLIST_DONE); @@ -746,7 +849,7 @@ static Eina_Bool _del_old_playlist_detail_view_cb(void *data) } static void -_mp_edit_cb_edit_thread_end_cb(void *data, Ecore_Thread *thread) +_mp_edit_cb_edit_thread_end_cb(void *data, Ecore_Thread * thread) { WARN_TRACE("thread_end"); struct appdata *ad = mp_util_get_appdata(); @@ -762,15 +865,22 @@ _mp_edit_cb_edit_thread_end_cb(void *data, Ecore_Thread *thread) _mp_edit_cb_check_playlist(); if (g_edit_operation == MP_EDIT_ADD_TO_PLAYLIST && g_playlist_name) { - /*keep previous playlist detail view, which to be popped after new view pushed*/ - MpView_t *previous_view = mp_view_mgr_get_view(GET_VIEW_MGR, MP_VIEW_PLAYLIST_DETAIL); + /*keep previous playlist detail view, which to be popped after new view pushed */ + MpView_t *previous_view = + mp_view_mgr_get_view(GET_VIEW_MGR, MP_VIEW_PLAYLIST_DETAIL); MpView_t *view = NULL; - if (playlist_id == -1) { /*favoriate playlist*/ - view = (MpView_t *)mp_playlist_detail_view_create(GET_NAVIFRAME, - MP_TRACK_BY_FAVORITE, g_playlist_name, playlist_id); + if (playlist_id == -1) { /*favoriate playlist */ + view = + (MpView_t *) mp_playlist_detail_view_create(GET_NAVIFRAME, + MP_TRACK_BY_FAVORITE, + g_playlist_name, + playlist_id); } else { - view = (MpView_t *)mp_playlist_detail_view_create(GET_NAVIFRAME, - MP_TRACK_BY_PLAYLIST, g_playlist_name, playlist_id); + view = + (MpView_t *) mp_playlist_detail_view_create(GET_NAVIFRAME, + MP_TRACK_BY_PLAYLIST, + g_playlist_name, + playlist_id); } mp_view_mgr_push_view(GET_VIEW_MGR, view, NULL); mp_view_update_options(view); @@ -778,11 +888,11 @@ _mp_edit_cb_edit_thread_end_cb(void *data, Ecore_Thread *thread) IF_FREE(g_playlist_name); /* - **in this case, only need to delete popup and send MP_ADD_TO_PLAYLIST_DONE, - **don't need to update the view to be popped - */ + **in this case, only need to delete popup and send MP_ADD_TO_PLAYLIST_DONE, + **don't need to update the view to be popped + */ mp_evas_object_del(ad->popup[MP_POPUP_PROGRESS]); - /*idler is used to delete old playlist detail view to avoid blink*/ + /*idler is used to delete old playlist detail view to avoid blink */ ecore_idler_add(_del_old_playlist_detail_view_cb, previous_view); } else { mp_popup_response(ad->popup[MP_POPUP_PROGRESS], MP_POPUP_YES); @@ -790,7 +900,7 @@ _mp_edit_cb_edit_thread_end_cb(void *data, Ecore_Thread *thread) } static void -_mp_edit_cb_edit_thread_cancel_cb(void *data, Ecore_Thread *thread) +_mp_edit_cb_edit_thread_cancel_cb(void *data, Ecore_Thread * thread) { WARN_TRACE("thread_cancel"); struct appdata *ad = mp_util_get_appdata(); @@ -805,7 +915,7 @@ _mp_edit_cb_edit_thread_cancel_cb(void *data, Ecore_Thread *thread) mp_view_mgr_delete_view(GET_VIEW_MGR, MP_VIEW_EDIT); - /*update top view*/ + /*update top view */ MpView_t *top_view = mp_view_mgr_get_top_view(GET_VIEW_MGR); MP_CHECK(top_view); mp_view_update(top_view); @@ -816,7 +926,8 @@ _mp_edit_cb_edit_thread_cancel_cb(void *data, Ecore_Thread *thread) if (top_view->view_type == MP_VIEW_FOLDER_DETAIL) { //update folder view - MpView_t *folder_view = mp_view_mgr_get_view(GET_VIEW_MGR, MP_VIEW_FOLDER); + MpView_t *folder_view = + mp_view_mgr_get_view(GET_VIEW_MGR, MP_VIEW_FOLDER); MP_CHECK(folder_view); mp_view_update(folder_view); } @@ -824,7 +935,8 @@ _mp_edit_cb_edit_thread_cancel_cb(void *data, Ecore_Thread *thread) void -mp_edit_cb_excute_add_to_playlist(void *data, int playlist_id, char *playlist_name, bool selected) +mp_edit_cb_excute_add_to_playlist(void *data, int playlist_id, + char *playlist_name, bool selected) { startfunc; struct appdata *ad = mp_util_get_appdata(); @@ -850,28 +962,34 @@ mp_edit_cb_excute_add_to_playlist(void *data, int playlist_id, char *playlist_na DEBUG_TRACE("playlist name = %s", g_playlist_name); #ifdef MP_PLAYLIST_MAX_ITEM_COUNT - mp_media_info_list_count(MP_TRACK_BY_PLAYLIST, NULL, NULL, NULL, g_playlist_id, &g_playlist_track_count); - DEBUG_TRACE("number of tracks in playlist: %d", g_playlist_track_count); + mp_media_info_list_count(MP_TRACK_BY_PLAYLIST, NULL, NULL, NULL, + g_playlist_id, &g_playlist_track_count); + DEBUG_TRACE("number of tracks in playlist: %d", + g_playlist_track_count); if (g_playlist_track_count >= MP_PLAYLIST_MAX_ITEM_COUNT) { - char *fmt_str = GET_STR("IDS_MUSIC_POP_UNABLE_TO_ADD_MORE_THAN_PD_MUSIC_FILE"); - char *noti_str = g_strdup_printf(fmt_str, MP_PLAYLIST_MAX_ITEM_COUNT); + char *fmt_str = + GET_STR("IDS_MUSIC_POP_UNABLE_TO_ADD_MORE_THAN_PD_MUSIC_FILE"); + char *noti_str = + g_strdup_printf(fmt_str, MP_PLAYLIST_MAX_ITEM_COUNT); mp_util_post_status_message(ad, noti_str); IF_FREE(noti_str); return; } #endif - Evas_Object *popup = mp_popup_create(ad->win_main, MP_POPUP_PROGRESS, GET_STR("IDS_MUSIC_BODY_ADD_TO_PLAYLIST"), list, - _mp_edit_progress_popup_response_cb, ad); + Evas_Object *popup = + mp_popup_create(ad->win_main, MP_POPUP_PROGRESS, + GET_STR("IDS_MUSIC_BODY_ADD_TO_PLAYLIST"), list, + _mp_edit_progress_popup_response_cb, ad); evas_object_show(popup); - g_edit_thread = ecore_thread_feedback_run( - _mp_edit_cb_add_to_plst_thread, - _mp_edit_cb_edit_thread_notify_cb, - _mp_edit_cb_edit_thread_end_cb, - _mp_edit_cb_edit_thread_cancel_cb, - (const void *)g_selected_list, - EINA_TRUE); + g_edit_thread = + ecore_thread_feedback_run(_mp_edit_cb_add_to_plst_thread, + _mp_edit_cb_edit_thread_notify_cb, + _mp_edit_cb_edit_thread_end_cb, + _mp_edit_cb_edit_thread_cancel_cb, + (const void *) g_selected_list, + EINA_TRUE); if (!g_edit_thread) { mp_popup_response(ad->popup[MP_POPUP_PROGRESS], MP_POPUP_NO); @@ -886,8 +1004,7 @@ void *mp_edit_get_delete_thread() } #endif -void -mp_edit_cb_excute_delete(void *data) +void mp_edit_cb_excute_delete(void *data) { startfunc; DEBUG_TRACE(""); @@ -910,23 +1027,25 @@ mp_edit_cb_excute_delete(void *data) char *title = NULL; mp_track_type_e type = mp_list_get_track_type(list); - if (type > MP_TRACK_TYPE_PLAYLIST_MIN && type < MP_TRACK_TYPE_PLAYLIST_MAX) { + if (type > MP_TRACK_TYPE_PLAYLIST_MIN + && type < MP_TRACK_TYPE_PLAYLIST_MAX) { title = STR_MP_REMOVING; } else { title = MP_POPUP_DELETING; } - Evas_Object *popup = mp_popup_message_create(ad->win_main, MP_POPUP_PROGRESS, NULL, title, list, - _mp_edit_progress_popup_response_cb, ad); + Evas_Object *popup = + mp_popup_message_create(ad->win_main, MP_POPUP_PROGRESS, NULL, + title, list, + _mp_edit_progress_popup_response_cb, ad); evas_object_show(popup); - g_edit_thread = ecore_thread_feedback_run( - _mp_edit_cb_delete_thread, - _mp_edit_cb_edit_thread_notify_cb, - _mp_edit_cb_edit_thread_end_cb, - _mp_edit_cb_edit_thread_cancel_cb, - (const void *)g_selected_list, - EINA_TRUE); + g_edit_thread = ecore_thread_feedback_run(_mp_edit_cb_delete_thread, + _mp_edit_cb_edit_thread_notify_cb, + _mp_edit_cb_edit_thread_end_cb, + _mp_edit_cb_edit_thread_cancel_cb, + (const void *) + g_selected_list, EINA_TRUE); if (!g_edit_thread) { mp_popup_response(ad->popup[MP_POPUP_PROGRESS], MP_POPUP_NO); @@ -936,7 +1055,7 @@ mp_edit_cb_excute_delete(void *data) } static void -_mp_edit_cb_delete_track_thread(void *data, Ecore_Thread *thread) +_mp_edit_cb_delete_track_thread(void *data, Ecore_Thread * thread) { startfunc; struct appdata *ad = mp_util_get_appdata(); @@ -946,18 +1065,21 @@ _mp_edit_cb_delete_track_thread(void *data, Ecore_Thread *thread) MP_CHECK(item); mp_media_info_connect(); - if (mp_util_delete_track(NULL, item->uid, item->uri) != MP_FILE_DELETE_ERR_NONE) { - DEBUG_TRACE("Fail to delete item, fid: %d, path: %s", item->uid, item->uri); + if (mp_util_delete_track(NULL, item->uid, item->uri) != + MP_FILE_DELETE_ERR_NONE) { + DEBUG_TRACE("Fail to delete item, fid: %d, path: %s", item->uid, + item->uri); } - ecore_thread_feedback(thread, (void *)MP_EDIT_THREAD_FEEDBACK_TRACK_DELETED); + ecore_thread_feedback(thread, + (void *) MP_EDIT_THREAD_FEEDBACK_TRACK_DELETED); //To make progress popup visible if only one item deleted. mp_media_info_disconnect(); } static void -_mp_edit_cb_delete_track_thread_end_cb(void *data, Ecore_Thread *thread) +_mp_edit_cb_delete_track_thread_end_cb(void *data, Ecore_Thread * thread) { WARN_TRACE("thread_end"); struct appdata *ad = mp_util_get_appdata(); @@ -968,12 +1090,15 @@ _mp_edit_cb_delete_track_thread_end_cb(void *data, Ecore_Thread *thread) } static void -_mp_edit_cb_delete_track_thread_notify_cb(void *data, Ecore_Thread *thread, void *msg_data) +_mp_edit_cb_delete_track_thread_notify_cb(void *data, + Ecore_Thread * thread, + void *msg_data) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); - mp_edit_thread_feedback_e feedback = (mp_edit_thread_feedback_e)msg_data; + mp_edit_thread_feedback_e feedback = + (mp_edit_thread_feedback_e) msg_data; switch (feedback) { @@ -984,9 +1109,9 @@ _mp_edit_cb_delete_track_thread_notify_cb(void *data, Ecore_Thread *thread, void mp_playlist_mgr_item_remove_item(ad->playlist_mgr, item); /* - when the playlist has same track,then delete the track, - the playlist should remove the deleted track - */ + when the playlist has same track,then delete the track, + the playlist should remove the deleted track + */ mp_playlist_mgr_item_remove_deleted_item(ad->playlist_mgr); mp_play_destory(ad); break; @@ -996,7 +1121,8 @@ _mp_edit_cb_delete_track_thread_notify_cb(void *data, Ecore_Thread *thread, void } static void -_mp_edit_cb_delete_track_thread_cancel_cb(void *data, Ecore_Thread *thread) +_mp_edit_cb_delete_track_thread_cancel_cb(void *data, + Ecore_Thread * thread) { WARN_TRACE("thread_cancel"); struct appdata *ad = mp_util_get_appdata(); @@ -1008,7 +1134,8 @@ _mp_edit_cb_delete_track_thread_cancel_cb(void *data, Ecore_Thread *thread) } static void -_mp_edit_message_popup_response_cb(void *data, Evas_Object * obj, void *event_info) +_mp_edit_message_popup_response_cb(void *data, Evas_Object * obj, + void *event_info) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); @@ -1029,8 +1156,7 @@ _mp_edit_message_popup_response_cb(void *data, Evas_Object * obj, void *event_in } -void -mp_edit_cb_excute_track_delete(void *data) +void mp_edit_cb_excute_track_delete(void *data) { startfunc; DEBUG_TRACE(""); @@ -1040,18 +1166,19 @@ mp_edit_cb_excute_track_delete(void *data) char *title = NULL; title = MP_POPUP_DELETING; - Evas_Object *popup = mp_popup_message_create(ad->win_main, MP_POPUP_PROGRESS, NULL, title, NULL, - _mp_edit_message_popup_response_cb, ad); + Evas_Object *popup = + mp_popup_message_create(ad->win_main, MP_POPUP_PROGRESS, NULL, + title, NULL, + _mp_edit_message_popup_response_cb, ad); elm_popup_align_set(popup, 0.5, 0.90); evas_object_show(popup); - g_delete_thread = ecore_thread_feedback_run( - _mp_edit_cb_delete_track_thread, - _mp_edit_cb_delete_track_thread_notify_cb, - _mp_edit_cb_delete_track_thread_end_cb, - _mp_edit_cb_delete_track_thread_cancel_cb, - NULL, - EINA_TRUE); + g_delete_thread = + ecore_thread_feedback_run(_mp_edit_cb_delete_track_thread, + _mp_edit_cb_delete_track_thread_notify_cb, + _mp_edit_cb_delete_track_thread_end_cb, + _mp_edit_cb_delete_track_thread_cancel_cb, + NULL, EINA_TRUE); if (!g_delete_thread) { mp_popup_response(ad->popup[MP_POPUP_PROGRESS], MP_POPUP_NO); @@ -1074,12 +1201,13 @@ int _mp_edit_cb_get_item_size(const char *item, unsigned long long *size) } if (S_ISREG(info.st_mode)) { - *size = (unsigned long long)info.st_size; + *size = (unsigned long long) info.st_size; } return 0; } -int _mp_edit_cb_get_remain_space(const char *path, unsigned long long *size) +int _mp_edit_cb_get_remain_space(const char *path, + unsigned long long *size) { struct statfs dst_fs; @@ -1088,7 +1216,9 @@ int _mp_edit_cb_get_remain_space(const char *path, unsigned long long *size) } if (statfs(path, &dst_fs) == 0) { - *size = ((unsigned long long)(dst_fs.f_bsize) * (unsigned long long)(dst_fs.f_bavail)); + *size = + ((unsigned long long) (dst_fs.f_bsize) * + (unsigned long long) (dst_fs.f_bavail)); } return 0; } @@ -1110,14 +1240,18 @@ static int _mp_edit_cb_get_store_type_by_full(const char *filepath) return 0; } else if (strncmp(filepath, MP_MMC_DIR, strlen(MP_MMC_DIR)) == 0) { return 1; - } else if (strncmp(filepath, MP_PERSONAL_PAGE_DIR, strlen(MP_PERSONAL_PAGE_DIR)) == 0) { + } else + if (strncmp + (filepath, MP_PERSONAL_PAGE_DIR, + strlen(MP_PERSONAL_PAGE_DIR)) == 0) { return 2; } else { return -1; } } -static int _mp_edit_cb_get_root_path_by_full(const char *full_path, char **path) +static int _mp_edit_cb_get_root_path_by_full(const char *full_path, + char **path) { assert(full_path); assert(path); @@ -1142,7 +1276,8 @@ static int _mp_edit_cb_get_root_path_by_full(const char *full_path, char **path) return 0; } -static int _mp_edit_cb_get_logical_path_by_full(const char *full_path, char **path) +static int _mp_edit_cb_get_logical_path_by_full(const char *full_path, + char **path) { assert(full_path); assert(path); @@ -1172,10 +1307,10 @@ static int _mp_edit_cb_get_logical_path_by_full(const char *full_path, char **pa } /* - ** *path has the same length with full_path - ** strlen(*path) is 0 since the memset called - ** we use length of full_path to reprecent the *path's - */ + ** *path has the same length with full_path + ** strlen(*path) is 0 since the memset called + ** we use length of full_path to reprecent the *path's + */ g_strlcpy(*path, full_path + root_len, strlen(full_path)); if (strlen(*path) == 0) { IF_FREE(*path); @@ -1185,13 +1320,14 @@ static int _mp_edit_cb_get_logical_path_by_full(const char *full_path, char **pa return 0; } -static void _mp_edit_cb_delete_empty_dir(const char *full_path, const char *root) +static void _mp_edit_cb_delete_empty_dir(const char *full_path, + const char *root) { MP_CHECK(full_path); - char* path = NULL; + char *path = NULL; while (full_path && g_strcmp0(full_path, root)) { if (mp_file_dir_is_empty(full_path)) { - /*if not, delete the folder*/ + /*if not, delete the folder */ mp_file_recursive_rm(full_path); path = g_strrstr(full_path, "/"); if (path != NULL) { @@ -1213,28 +1349,29 @@ _move_track_spec_path(mp_media_info_h item_handle, char *dest_path) mp_media_info_get_file_path(item_handle, &path); char *filename = NULL; - filename = g_strdup((char *)mp_file_file_get(path)); + filename = g_strdup((char *) mp_file_file_get(path)); char *dest = NULL; char *dest_root_path = dest_path; - if (mp_util_is_in_personal_page((const char *)path)) { + if (mp_util_is_in_personal_page((const char *) path)) { if (dest_root_path == NULL) { dest_root_path = MP_MUSIC_DIR; } - /*if dest_root_path does not exist, create it*/ + /*if dest_root_path does not exist, create it */ bool mkdir_ret = mp_file_mkpath(dest_root_path); if (mkdir_ret == false) { DEBUG_TRACE("failed to make new directory"); } char *unique_filename = NULL; - while (mp_util_is_duplicated_name(dest_root_path, (const char *)filename)) { + while (mp_util_is_duplicated_name + (dest_root_path, (const char *) filename)) { IF_FREE(unique_filename); - mp_util_get_unique_name((char *)filename, &unique_filename); + mp_util_get_unique_name((char *) filename, &unique_filename); IF_FREE(filename); filename = g_strdup(unique_filename); } - /*remove from personal page*/ + /*remove from personal page */ dest = g_strconcat(dest_root_path, "/", filename, NULL); if (dest == NULL) { IF_FREE(unique_filename); @@ -1249,21 +1386,22 @@ _move_track_spec_path(mp_media_info_h item_handle, char *dest_path) dest_root_path = MP_PERSONAL_PAGE_DIR; } - /*if dest_root_path does not exist, create it*/ + /*if dest_root_path does not exist, create it */ bool mkdir_ret = mp_file_mkpath(dest_root_path); if (mkdir_ret == false) { DEBUG_TRACE("failed to make new directory"); } char *unique_filename = NULL; - while (mp_util_is_duplicated_name(dest_root_path, (const char *)filename)) { + while (mp_util_is_duplicated_name + (dest_root_path, (const char *) filename)) { IF_FREE(unique_filename); - mp_util_get_unique_name((char *)filename, &unique_filename); + mp_util_get_unique_name((char *) filename, &unique_filename); IF_FREE(filename); filename = g_strdup(unique_filename); } dest = g_strconcat(dest_root_path, "/", filename, NULL); - /*add to personal page*/ + /*add to personal page */ if (dest == NULL) { IF_FREE(unique_filename); IF_FREE(filename); @@ -1279,8 +1417,7 @@ _move_track_spec_path(mp_media_info_h item_handle, char *dest_path) return 0; } -inline static int -_move_folder(mp_media_info_h item_handle) +inline static int _move_folder(mp_media_info_h item_handle) { MP_CHECK_VAL(item_handle, -1); @@ -1294,15 +1431,17 @@ _move_folder(mp_media_info_h item_handle) _mp_edit_cb_get_root_path_by_full(path, &root_path); char *dest = NULL; - if (mp_util_is_in_personal_page((const char *)path)) { - /*remove from personal page*/ - /*1. check if the selected item is root path(/opt/storaget/PersonalStorage)*/ + if (mp_util_is_in_personal_page((const char *) path)) { + /*remove from personal page */ + /*1. check if the selected item is root path(/opt/storaget/PersonalStorage) */ if (!g_strcmp0(path, MP_PERSONAL_PAGE_DIR)) { - /*move music related item to sounds*/ + /*move music related item to sounds */ int ret = 0; int count = 0; - /*1. get track count*/ - ret = mp_media_info_list_count(MP_TRACK_BY_FOLDER, folder_id, NULL, NULL, 0, &count); + /*1. get track count */ + ret = + mp_media_info_list_count(MP_TRACK_BY_FOLDER, folder_id, + NULL, NULL, 0, &count); if (ret) { DEBUG_TRACE("get track in folder failed"); } @@ -1315,11 +1454,12 @@ _move_folder(mp_media_info_h item_handle) return -1; } - /*2. get content from DB*/ + /*2. get content from DB */ mp_media_list_h svc_handle = NULL; - mp_media_info_list_create(&svc_handle, MP_TRACK_BY_FOLDER, folder_id, NULL, NULL, 0, 0, count); + mp_media_info_list_create(&svc_handle, MP_TRACK_BY_FOLDER, + folder_id, NULL, NULL, 0, 0, count); - /*3. move item one by one*/ + /*3. move item one by one */ int index = 0; for (index = 0; index < count; index++) { mp_media_info_h item = NULL; @@ -1330,7 +1470,7 @@ _move_folder(mp_media_info_h item_handle) _move_track_spec_path(item, NULL); } - } else { /*2. other folder*/ + } else { /*2. other folder */ char *related_path = NULL; _mp_edit_cb_get_logical_path_by_full(path, &related_path); @@ -1338,28 +1478,33 @@ _move_folder(mp_media_info_h item_handle) char *dir_name = g_strdup(dir_levels[0]); char *semi_path = NULL; semi_path = g_strjoinv("/", dir_levels + 1); - /*create folder in destination*/ - /*1. check if duplicated Directory exists*/ + /*create folder in destination */ + /*1. check if duplicated Directory exists */ char *unique_filename = NULL; - while (mp_util_is_duplicated_name(MP_MUSIC_DIR, (const char *)dir_name)) { + while (mp_util_is_duplicated_name + (MP_MUSIC_DIR, (const char *) dir_name)) { IF_FREE(unique_filename); mp_util_get_unique_name(dir_name, &unique_filename); IF_FREE(dir_name); dir_name = g_strdup(unique_filename); } - dest = g_strconcat(MP_MUSIC_DIR, "/", dir_name, "/", semi_path, NULL); + dest = + g_strconcat(MP_MUSIC_DIR, "/", dir_name, "/", semi_path, + NULL); IF_FREE(unique_filename); IF_FREE(dir_name); - /*2. create new directory*/ + /*2. create new directory */ bool mkdir_ret = mp_file_mkpath(dest); if (mkdir_ret == false) { DEBUG_TRACE("failed to make new directory"); } - /*move music related item to new folder*/ + /*move music related item to new folder */ int ret = 0; int count = 0; - /*1. get track count*/ - ret = mp_media_info_list_count(MP_TRACK_BY_FOLDER, folder_id, NULL, NULL, 0, &count); + /*1. get track count */ + ret = + mp_media_info_list_count(MP_TRACK_BY_FOLDER, folder_id, + NULL, NULL, 0, &count); if (ret) { DEBUG_TRACE("get track in folder failed"); } @@ -1372,11 +1517,12 @@ _move_folder(mp_media_info_h item_handle) return -1; } - /*2. get content from DB*/ + /*2. get content from DB */ mp_media_list_h svc_handle = NULL; - mp_media_info_list_create(&svc_handle, MP_TRACK_BY_FOLDER, folder_id, NULL, NULL, 0, 0, count); + mp_media_info_list_create(&svc_handle, MP_TRACK_BY_FOLDER, + folder_id, NULL, NULL, 0, 0, count); - /*3. move item one by one*/ + /*3. move item one by one */ int index = 0; for (index = 0; index < count; index++) { mp_media_info_h item = NULL; @@ -1387,18 +1533,20 @@ _move_folder(mp_media_info_h item_handle) _move_track_spec_path(item, dest); } - /*check if there is other item in the folder*/ + /*check if there is other item in the folder */ _mp_edit_cb_delete_empty_dir(path, root_path); } } else { - /*add to personal page*/ - /*1. check if the selected item is root path(/opt/storaget/PersonalStorage)*/ + /*add to personal page */ + /*1. check if the selected item is root path(/opt/storaget/PersonalStorage) */ if (!g_strcmp0(path, MP_MUSIC_DIR)) { - /*move music related item to sounds*/ + /*move music related item to sounds */ int ret = 0; int count = 0; - /*1. get track count*/ - ret = mp_media_info_list_count(MP_TRACK_BY_FOLDER, folder_id, NULL, NULL, 0, &count); + /*1. get track count */ + ret = + mp_media_info_list_count(MP_TRACK_BY_FOLDER, folder_id, + NULL, NULL, 0, &count); if (ret) { DEBUG_TRACE("get track in folder failed"); } @@ -1411,11 +1559,12 @@ _move_folder(mp_media_info_h item_handle) return -1; } - /*2. get content from DB*/ + /*2. get content from DB */ mp_media_list_h svc_handle = NULL; - mp_media_info_list_create(&svc_handle, MP_TRACK_BY_FOLDER, folder_id, NULL, NULL, 0, 0, count); + mp_media_info_list_create(&svc_handle, MP_TRACK_BY_FOLDER, + folder_id, NULL, NULL, 0, 0, count); - /*3. move item one by one*/ + /*3. move item one by one */ int index = 0; for (index = 0; index < count; index++) { mp_media_info_h item = NULL; @@ -1426,7 +1575,7 @@ _move_folder(mp_media_info_h item_handle) _move_track_spec_path(item, NULL); } - } else { /*2. other folder*/ + } else { /*2. other folder */ char *related_path = NULL; _mp_edit_cb_get_logical_path_by_full(path, &related_path); @@ -1434,28 +1583,33 @@ _move_folder(mp_media_info_h item_handle) char *dir_name = g_strdup(dir_levels[0]); char *semi_path = NULL; semi_path = g_strjoinv("/", dir_levels + 1); - /*create folder in destination*/ - /*1. check if duplicated Directory exists*/ + /*create folder in destination */ + /*1. check if duplicated Directory exists */ char *unique_filename = NULL; - while (mp_util_is_duplicated_name(MP_PERSONAL_PAGE_DIR, (const char *)dir_name)) { + while (mp_util_is_duplicated_name + (MP_PERSONAL_PAGE_DIR, (const char *) dir_name)) { IF_FREE(unique_filename); mp_util_get_unique_name(dir_name, &unique_filename); IF_FREE(dir_name); dir_name = g_strdup(unique_filename); } - dest = g_strconcat(MP_PERSONAL_PAGE_DIR, "/", dir_name, "/", semi_path, NULL); + dest = + g_strconcat(MP_PERSONAL_PAGE_DIR, "/", dir_name, "/", + semi_path, NULL); IF_FREE(unique_filename); IF_FREE(dir_name); - /*2. create new directory*/ + /*2. create new directory */ bool mkdir_ret = mp_file_mkpath(dest); if (mkdir_ret == false) { DEBUG_TRACE("failed to make new directory"); } - /*move music related item to new folder*/ + /*move music related item to new folder */ int ret = 0; int count = 0; - /*1. get track count*/ - ret = mp_media_info_list_count(MP_TRACK_BY_FOLDER, folder_id, NULL, NULL, 0, &count); + /*1. get track count */ + ret = + mp_media_info_list_count(MP_TRACK_BY_FOLDER, folder_id, + NULL, NULL, 0, &count); if (ret) { DEBUG_TRACE("get track in folder failed"); } @@ -1468,11 +1622,12 @@ _move_folder(mp_media_info_h item_handle) return -1; } - /*2. get content from DB*/ + /*2. get content from DB */ mp_media_list_h svc_handle = NULL; - mp_media_info_list_create(&svc_handle, MP_TRACK_BY_FOLDER, folder_id, NULL, NULL, 0, 0, count); + mp_media_info_list_create(&svc_handle, MP_TRACK_BY_FOLDER, + folder_id, NULL, NULL, 0, 0, count); - /*3. move item one by one*/ + /*3. move item one by one */ int index = 0; for (index = 0; index < count; index++) { mp_media_info_h item = NULL; @@ -1483,7 +1638,7 @@ _move_folder(mp_media_info_h item_handle) _move_track_spec_path(item, dest); } - /*check if there is other item in the folder*/ + /*check if there is other item in the folder */ _mp_edit_cb_delete_empty_dir(path, root_path); } } @@ -1493,8 +1648,7 @@ _move_folder(mp_media_info_h item_handle) return 0; } -static Evas_Object * -_mp_edit_cb_get_progressbar() +static Evas_Object *_mp_edit_cb_get_progressbar() { startfunc; struct appdata *ad = mp_util_get_appdata(); @@ -1503,12 +1657,12 @@ _mp_edit_cb_get_progressbar() MP_CHECK_NULL(popup); Evas_Object *layout = elm_object_content_get(popup); MP_CHECK_NULL(layout); - Evas_Object *progressbar = elm_object_part_content_get(layout, "elm.swallow.content"); + Evas_Object *progressbar = + elm_object_part_content_get(layout, "elm.swallow.content"); return progressbar; } -static Evas_Object * -_mp_edit_cb_get_popup_layout() +static Evas_Object *_mp_edit_cb_get_popup_layout() { startfunc; struct appdata *ad = mp_util_get_appdata(); @@ -1520,7 +1674,8 @@ _mp_edit_cb_get_popup_layout() } static void -_mp_edit_move_popup_response_cb(void *data, Evas_Object * obj, void *event_info) +_mp_edit_move_popup_response_cb(void *data, Evas_Object * obj, + void *event_info) { if (g_personal_storage_thread) { ecore_thread_cancel(g_personal_storage_thread); @@ -1528,8 +1683,7 @@ _mp_edit_move_popup_response_cb(void *data, Evas_Object * obj, void *event_info) } } -static void -_mp_edit_cb_move_thread(void *data, Ecore_Thread *thread) +static void _mp_edit_cb_move_thread(void *data, Ecore_Thread * thread) { startfunc; struct appdata *ad = mp_util_get_appdata(); @@ -1554,7 +1708,7 @@ _mp_edit_cb_move_thread(void *data, Ecore_Thread *thread) node = g_list_previous(node); if (!item) { WARN_TRACE("CHECK here..."); - ecore_thread_feedback(thread, (void *) - 1); + ecore_thread_feedback(thread, (void *) -1); goto mp_exception; } item_handle = (item->handle); @@ -1567,7 +1721,8 @@ _mp_edit_cb_move_thread(void *data, Ecore_Thread *thread) mp_media_info_get_file_path(item_handle, &path); } else if (g_list_type == MP_LIST_TYPE_GROUP) { mp_media_info_group_get_sub_info(item_handle, &path); - } else if (g_list_type == MP_LIST_TYPE_ALBUM_DETAIL || g_list_type == MP_LIST_TYPE_ARTIST_DETAIL) { + } else if (g_list_type == MP_LIST_TYPE_ALBUM_DETAIL + || g_list_type == MP_LIST_TYPE_ARTIST_DETAIL) { mp_media_info_get_file_path(item_handle, &path); } else { @@ -1582,44 +1737,45 @@ _mp_edit_cb_move_thread(void *data, Ecore_Thread *thread) DEBUG_TRACE("folder"); if (_move_folder(item_handle)) { g_error_count++; - ecore_thread_feedback(thread, (void *) - 1); + ecore_thread_feedback(thread, (void *) -1); } else { moved_count++; - ecore_thread_feedback(thread, (void *)moved_count); + ecore_thread_feedback(thread, (void *) moved_count); } - } else { /*track*/ + } else { /*track */ DEBUG_TRACE("track --> path is %s", path); - /*get related path information*/ + /*get related path information */ char *related_path = NULL; _mp_edit_cb_get_logical_path_by_full(path, &related_path); - /*generate dest path*/ + /*generate dest path */ char *dest_path = NULL; - if (mp_util_is_in_personal_page((const char *)path)) { - /*remove from personal page*/ + if (mp_util_is_in_personal_page((const char *) path)) { + /*remove from personal page */ dest_path = g_strconcat(MP_MUSIC_DIR, related_path, NULL); MP_CHECK(dest_path); } else { - /*remove from personal page*/ - dest_path = g_strconcat(MP_PERSONAL_PAGE_DIR, related_path, NULL); + /*remove from personal page */ + dest_path = + g_strconcat(MP_PERSONAL_PAGE_DIR, related_path, NULL); MP_CHECK(dest_path); } char *dest_dir = mp_file_dir_get(dest_path); - /*for exception handle, if dest_dir is NULL, in _move_track_spec_path, it will use root path as dest*/ + /*for exception handle, if dest_dir is NULL, in _move_track_spec_path, it will use root path as dest */ if (_move_track_spec_path(item_handle, dest_dir)) { g_error_count++; - ecore_thread_feedback(thread, (void *) - 1); + ecore_thread_feedback(thread, (void *) -1); } else { moved_count++; - ecore_thread_feedback(thread, (void *)moved_count); + ecore_thread_feedback(thread, (void *) moved_count); } IF_FREE(dest_dir); IF_FREE(dest_path); } } -mp_exception: + mp_exception: //To make progress popup visible if only one item deleted. sleep(1); @@ -1627,32 +1783,36 @@ mp_exception: } static void -_mp_edit_cb_move_notify_cb(void *data, Ecore_Thread *thread, void *msg_data) +_mp_edit_cb_move_notify_cb(void *data, Ecore_Thread * thread, + void *msg_data) { startfunc; - int feedback = (int)msg_data; + int feedback = (int) msg_data; if (feedback == -1) { DEBUG_TRACE("----------->error happened in main thread"); } else { - /*1. set progress bar value*/ + /*1. set progress bar value */ Evas_Object *progressbar = _mp_edit_cb_get_progressbar(); - double progress_value = (double)feedback / (double)g_total_count; + double progress_value = (double) feedback / (double) g_total_count; elm_progressbar_value_set(progressbar, progress_value); - /*2. set text*/ - char *popup_information = g_strdup_printf("%d / %d", feedback, g_total_count); + /*2. set text */ + char *popup_information = + g_strdup_printf("%d / %d", feedback, g_total_count); Evas_Object *layout = _mp_edit_cb_get_popup_layout(); - elm_object_part_text_set(layout, "elm.text.right", popup_information); + elm_object_part_text_set(layout, "elm.text.right", + popup_information); IF_FREE(popup_information); - char *progress_text = g_strdup_printf("%d%%", (int)(progress_value * 100)); + char *progress_text = + g_strdup_printf("%d%%", (int) (progress_value * 100)); elm_object_part_text_set(layout, "elm.text.left", progress_text); IF_FREE(progress_text); } } static void -_mp_edit_cb_move_thread_end_cb(void *data, Ecore_Thread *thread) +_mp_edit_cb_move_thread_end_cb(void *data, Ecore_Thread * thread) { WARN_TRACE("thread_end"); struct appdata *ad = mp_util_get_appdata(); @@ -1670,7 +1830,7 @@ _mp_edit_cb_move_thread_end_cb(void *data, Ecore_Thread *thread) mp_view_mgr_delete_view(GET_VIEW_MGR, MP_VIEW_EDIT); mp_view_mgr_post_event(GET_VIEW_MGR, MP_VIEW_TRANSITION_FINISHED); - /*update top view*/ + /*update top view */ MpView_t *top_view = mp_view_mgr_get_top_view(GET_VIEW_MGR); MP_CHECK(top_view); mp_view_update(top_view); @@ -1681,14 +1841,14 @@ _mp_edit_cb_move_thread_end_cb(void *data, Ecore_Thread *thread) if (top_view->view_type == MP_VIEW_FOLDER_DETAIL) { //update folder view - MpView_t *folder_view = mp_view_mgr_get_view(GET_VIEW_MGR, MP_VIEW_FOLDER); + MpView_t *folder_view = + mp_view_mgr_get_view(GET_VIEW_MGR, MP_VIEW_FOLDER); MP_CHECK(folder_view); mp_view_update(folder_view); } } -static void -_mp_edit_cb_move_cancel_cb(void *data, Ecore_Thread *thread) +static void _mp_edit_cb_move_cancel_cb(void *data, Ecore_Thread * thread) { WARN_TRACE("thread_cancel"); struct appdata *ad = mp_util_get_appdata(); @@ -1704,7 +1864,7 @@ _mp_edit_cb_move_cancel_cb(void *data, Ecore_Thread *thread) mp_view_mgr_delete_view(GET_VIEW_MGR, MP_VIEW_EDIT); mp_view_mgr_post_event(GET_VIEW_MGR, MP_VIEW_TRANSITION_FINISHED); - /*update top view*/ + /*update top view */ MpView_t *top_view = mp_view_mgr_get_top_view(GET_VIEW_MGR); MP_CHECK(top_view); mp_view_update(top_view); @@ -1715,14 +1875,14 @@ _mp_edit_cb_move_cancel_cb(void *data, Ecore_Thread *thread) if (top_view->view_type == MP_VIEW_FOLDER_DETAIL) { //update folder view - MpView_t *folder_view = mp_view_mgr_get_view(GET_VIEW_MGR, MP_VIEW_FOLDER); + MpView_t *folder_view = + mp_view_mgr_get_view(GET_VIEW_MGR, MP_VIEW_FOLDER); MP_CHECK(folder_view); mp_view_update(folder_view); } } -void -mp_edit_cb_excute_move(void *data) +void mp_edit_cb_excute_move(void *data) { startfunc; struct appdata *ad = mp_util_get_appdata(); @@ -1731,11 +1891,11 @@ mp_edit_cb_excute_move(void *data) MpList_t *list = data; MP_CHECK(list); - mp_list_selected_item_data_get((MpList_t *)list, &g_selected_list); + mp_list_selected_item_data_get((MpList_t *) list, &g_selected_list); MP_CHECK(g_selected_list); g_list_type = list->list_type; - g_group_type = mp_list_get_group_type((MpList_t *)list); + g_group_type = mp_list_get_group_type((MpList_t *) list); g_selected_count = g_list_length(g_selected_list); g_error_count = 0; g_edit_operation = MP_EDIT_MOVE; @@ -1743,19 +1903,22 @@ mp_edit_cb_excute_move(void *data) DEBUG_TRACE("g_list_type is %d", g_list_type); char *title = NULL; unsigned long long remained_size = 0; - if (list->personal_page_type == MP_LIST_PERSONAL_PAGE_ADD || list->personal_page_storage == MP_LIST_PERSONAL_PAGE_NORMAL) { + if (list->personal_page_type == MP_LIST_PERSONAL_PAGE_ADD + || list->personal_page_storage == MP_LIST_PERSONAL_PAGE_NORMAL) { title = STR_MP_ADDIND; _mp_edit_cb_get_remain_space(MP_PERSONAL_PAGE_DIR, &remained_size); - } else if (list->personal_page_type == MP_LIST_PERSONAL_PAGE_REMOVE || list->personal_page_storage == MP_LIST_PERSONAL_PAGE_PRIVATE) { + } else if (list->personal_page_type == MP_LIST_PERSONAL_PAGE_REMOVE + || list->personal_page_storage == + MP_LIST_PERSONAL_PAGE_PRIVATE) { title = STR_MP_REMOVING; _mp_edit_cb_get_remain_space(MP_MUSIC_DIR, &remained_size); } - /*recover list personal page type to prepare update list*/ + /*recover list personal page type to prepare update list */ list->personal_page_type = MP_LIST_PERSONAL_PAGE_NONE; - /*check selected file size*/ + /*check selected file size */ mp_list_item_data_t *item = NULL; mp_media_info_h item_handle = NULL; @@ -1802,8 +1965,10 @@ mp_edit_cb_excute_move(void *data) int ret = 0; int count = 0; - /*1. get track count*/ - ret = mp_media_info_list_count(MP_TRACK_BY_FOLDER, folder_id, NULL, NULL, 0, &count); + /*1. get track count */ + ret = + mp_media_info_list_count(MP_TRACK_BY_FOLDER, folder_id, + NULL, NULL, 0, &count); if (ret) { DEBUG_TRACE("get track in folder failed"); } @@ -1814,11 +1979,12 @@ mp_edit_cb_excute_move(void *data) continue; } - /*2. get content from DB*/ + /*2. get content from DB */ mp_media_list_h svc_handle = NULL; - mp_media_info_list_create(&svc_handle, MP_TRACK_BY_FOLDER, folder_id, NULL, NULL, 0, 0, count); + mp_media_info_list_create(&svc_handle, MP_TRACK_BY_FOLDER, + folder_id, NULL, NULL, 0, 0, count); - /*3. move item one by one*/ + /*3. move item one by one */ int index = 0; for (index = 0; index < count; index++) { mp_media_info_h item = NULL; @@ -1841,43 +2007,49 @@ mp_edit_cb_excute_move(void *data) DEBUG_TRACE("remained size is %f", remained_size); if (selected_size > remained_size) { - Evas_Object *popup = mp_popup_create(ad->win_main, MP_POPUP_NORMAL, NULL, NULL, NULL, ad); + Evas_Object *popup = + mp_popup_create(ad->win_main, MP_POPUP_NORMAL, NULL, NULL, + NULL, ad); MP_CHECK(popup); char *desc = g_strdup("not enough space"); mp_popup_desc_set(popup, desc); SAFE_FREE(desc); - mp_popup_button_set(popup, MP_POPUP_BTN_1, STR_MP_OK, MP_POPUP_YES); + mp_popup_button_set(popup, MP_POPUP_BTN_1, STR_MP_OK, + MP_POPUP_YES); evas_object_show(popup); return; } - Evas_Object *popup = mp_popup_create(ad->win_main, MP_POPUP_OPERATION_PROGRESS, NULL, list, - _mp_edit_move_popup_response_cb, ad); + Evas_Object *popup = + mp_popup_create(ad->win_main, MP_POPUP_OPERATION_PROGRESS, NULL, + list, + _mp_edit_move_popup_response_cb, ad); evas_object_show(popup); Evas_Object *layout = _mp_edit_cb_get_popup_layout(); mp_util_domain_translatable_part_text_set(layout, "elm.title", title); - /*set text*/ - char *popup_information = g_strdup_printf("%d / %d", 0, g_total_count); + /*set text */ + char *popup_information = g_strdup_printf("%d / %d", 0, g_total_count); elm_object_part_text_set(layout, "elm.text.right", popup_information); IF_FREE(popup_information); - char *progress_text = g_strdup_printf("%d%%", (int)0); + char *progress_text = g_strdup_printf("%d%%", (int) 0); elm_object_part_text_set(layout, "elm.text.left", progress_text); IF_FREE(progress_text); - g_personal_storage_thread = ecore_thread_feedback_run( - _mp_edit_cb_move_thread, - _mp_edit_cb_move_notify_cb, - _mp_edit_cb_move_thread_end_cb, - _mp_edit_cb_move_cancel_cb, - (const void *)g_selected_list, - EINA_TRUE); + g_personal_storage_thread = + ecore_thread_feedback_run(_mp_edit_cb_move_thread, + _mp_edit_cb_move_notify_cb, + _mp_edit_cb_move_thread_end_cb, + _mp_edit_cb_move_cancel_cb, + (const void *) g_selected_list, + EINA_TRUE); if (!g_personal_storage_thread) { - mp_popup_response(ad->popup[MP_POPUP_OPERATION_PROGRESS], MP_POPUP_NO); + mp_popup_response(ad->popup[MP_POPUP_OPERATION_PROGRESS], + MP_POPUP_NO); } ad->edit_in_progress = true; @@ -1885,7 +2057,8 @@ mp_edit_cb_excute_move(void *data) #endif static void -_mp_edit_delete_popup_response_cb(void *data, Evas_Object * obj, void *event_info) +_mp_edit_delete_popup_response_cb(void *data, Evas_Object * obj, + void *event_info) { startfunc; DEBUG_TRACE(""); @@ -1896,7 +2069,7 @@ _mp_edit_delete_popup_response_cb(void *data, Evas_Object * obj, void *event_inf ad->del_cb_invoked = 0; mp_evas_object_del(obj); - int response = (int)event_info; + int response = (int) event_info; if (response == MP_POPUP_NO) { mp_view_mgr_post_event(GET_VIEW_MGR, MP_POPUP_CANCEL); return; @@ -1908,8 +2081,7 @@ _mp_edit_delete_popup_response_cb(void *data, Evas_Object * obj, void *event_inf return; } -void -mp_edit_create_delete_popup(void *data) +void mp_edit_create_delete_popup(void *data) { DEBUG_TRACE(""); struct appdata *ad = mp_util_get_appdata(); @@ -1919,7 +2091,8 @@ mp_edit_create_delete_popup(void *data) MP_CHECK(list); int selected_count = mp_list_get_checked_count(list); if (selected_count <= 0) { - mp_widget_text_popup(ad, GET_STR("IDS_MUSIC_POP_NOTHING_SELECTED")); + mp_widget_text_popup(ad, + GET_STR("IDS_MUSIC_POP_NOTHING_SELECTED")); return; } @@ -1930,7 +2103,8 @@ mp_edit_create_delete_popup(void *data) mp_track_type_e type = mp_list_get_track_type(list); WARN_TRACE("track_type is %d", type); - if (type > MP_TRACK_TYPE_PLAYLIST_MIN && type < MP_TRACK_TYPE_PLAYLIST_MAX) { + if (type > MP_TRACK_TYPE_PLAYLIST_MIN + && type < MP_TRACK_TYPE_PLAYLIST_MAX) { btn_txt = STR_MP_REMOVE; title = STR_MP_REMOVE; } else { @@ -1938,8 +2112,11 @@ mp_edit_create_delete_popup(void *data) title = STR_MP_DELETE; } - title_txt = g_strconcat("", GET_STR(title), "", NULL); - Evas_Object *popup = mp_popup_create(ad->win_main, MP_POPUP_NORMAL, title_txt, data, _mp_edit_delete_popup_response_cb, ad); + title_txt = + g_strconcat("", GET_STR(title), "", NULL); + Evas_Object *popup = + mp_popup_create(ad->win_main, MP_POPUP_NORMAL, title_txt, data, + _mp_edit_delete_popup_response_cb, ad); ad->popup_delete = popup; //making help_txt //1. get group type @@ -1950,57 +2127,115 @@ mp_edit_create_delete_popup(void *data) case MP_GROUP_NONE: DEBUG_TRACE("MP_GROUP_NONE"); if (selected_count == 1) { - help_txt = g_strconcat("", GET_STR(STR_MP_ONE_TRACK_DETELED), "", NULL); - } else if (selected_count == mp_list_get_editable_count(list, MP_LIST_EDIT_TYPE_NORMAL)) { - help_txt = g_strconcat("", GET_STR(STR_MP_ALL_TRACKS_DETELED), "", NULL); + help_txt = + g_strconcat("", + GET_STR(STR_MP_ONE_TRACK_DETELED), "", + NULL); + } else if (selected_count == + mp_list_get_editable_count(list, + MP_LIST_EDIT_TYPE_NORMAL)) { + help_txt = + g_strconcat("", + GET_STR(STR_MP_ALL_TRACKS_DETELED), "", + NULL); } else { - help_txt = g_strconcat("", GET_STR(STR_MP_PLURAL_TRACKS_DETELED), "", NULL); + help_txt = + g_strconcat("", + GET_STR(STR_MP_PLURAL_TRACKS_DETELED), + "", NULL); } break; - case MP_GROUP_BY_ALBUM: /**< Group by album*/ + case MP_GROUP_BY_ALBUM: /**< Group by album*/ DEBUG_TRACE("MP_GROUP_BY_ALBUM"); if (selected_count == 1) { - help_txt = g_strconcat("", GET_STR(STR_MP_ONE_ALBUM_DETELED), "", NULL); - } else if (selected_count == mp_list_get_editable_count(list, MP_LIST_EDIT_TYPE_NORMAL)) { - help_txt = g_strconcat("", GET_STR(STR_MP_ALL_ALBUMS_DETELED), "", NULL); + help_txt = + g_strconcat("", + GET_STR(STR_MP_ONE_ALBUM_DETELED), "", + NULL); + } else if (selected_count == + mp_list_get_editable_count(list, + MP_LIST_EDIT_TYPE_NORMAL)) { + help_txt = + g_strconcat("", + GET_STR(STR_MP_ALL_ALBUMS_DETELED), "", + NULL); } else { - help_txt = g_strconcat("", GET_STR(STR_MP_PLURAL_ALBUMS_DETELED), "", NULL); + help_txt = + g_strconcat("", + GET_STR(STR_MP_PLURAL_ALBUMS_DETELED), + "", NULL); } break; case MP_GROUP_BY_ARTIST: /**< Group by artist*/ DEBUG_TRACE("MP_GROUP_BY_ARTIST"); if (selected_count == 1) { - help_txt = g_strconcat("", GET_STR(STR_MP_ONE_ARTIST_DETELED), "", NULL); - } else if (selected_count == mp_list_get_editable_count(list, MP_LIST_EDIT_TYPE_NORMAL)) { - help_txt = g_strconcat("", GET_STR(STR_MP_ALL_ARTISTS_DETELED), "", NULL); + help_txt = + g_strconcat("", + GET_STR(STR_MP_ONE_ARTIST_DETELED), "", + NULL); + } else if (selected_count == + mp_list_get_editable_count(list, + MP_LIST_EDIT_TYPE_NORMAL)) { + help_txt = + g_strconcat("", + GET_STR(STR_MP_ALL_ARTISTS_DETELED), + "", NULL); } else { - help_txt = g_strconcat("", GET_STR(STR_MP_PLURAL_ARTISTS_DETELED), "", NULL); + help_txt = + g_strconcat("", + GET_STR(STR_MP_PLURAL_ARTISTS_DETELED), + "", NULL); } break; case MP_GROUP_BY_FOLDER: /**< Group by folder*/ DEBUG_TRACE("MP_GROUP_BY_FOLDER"); if (selected_count == 1) { - help_txt = g_strconcat("", GET_STR(STR_MP_ONE_FOLDER_DETELED), "", NULL); - } else if (selected_count == mp_list_get_editable_count(list, MP_LIST_EDIT_TYPE_NORMAL)) { - help_txt = g_strconcat("", GET_STR(STR_MP_ALL_FOLDERS_DETELED), "", NULL); + help_txt = + g_strconcat("", + GET_STR(STR_MP_ONE_FOLDER_DETELED), "", + NULL); + } else if (selected_count == + mp_list_get_editable_count(list, + MP_LIST_EDIT_TYPE_NORMAL)) { + help_txt = + g_strconcat("", + GET_STR(STR_MP_ALL_FOLDERS_DETELED), + "", NULL); } else { - help_txt = g_strconcat("", GET_STR(STR_MP_PLURAL_FOLDERS_DETELED), "", NULL); + help_txt = + g_strconcat("", + GET_STR(STR_MP_PLURAL_FOLDERS_DETELED), + "", NULL); } break; case MP_GROUP_BY_PLAYLIST: DEBUG_TRACE("MP_GROUP_BY_PLAYLIST"); if (selected_count == 1) { - help_txt = g_strconcat("", GET_STR(STR_MP_ONE_PLAYLIST_DETELED), "", NULL); - } else if (selected_count == mp_list_get_editable_count(list, MP_LIST_EDIT_TYPE_NORMAL)) { - help_txt = g_strconcat("", GET_STR(STR_MP_ALL_PLAYLISTS_DETELED), "", NULL); + help_txt = + g_strconcat("", + GET_STR(STR_MP_ONE_PLAYLIST_DETELED), + "", NULL); + } else if (selected_count == + mp_list_get_editable_count(list, + MP_LIST_EDIT_TYPE_NORMAL)) { + help_txt = + g_strconcat("", + GET_STR(STR_MP_ALL_PLAYLISTS_DETELED), + "", NULL); } else { - help_txt = g_strconcat("", GET_STR(STR_MP_PLURAL_PLAYLISTS_DETELED), "", NULL); + help_txt = + g_strconcat("", + GET_STR(STR_MP_PLURAL_PLAYLISTS_DETELED), + "", NULL); } break; default: DEBUG_TRACE("Other -1"); - help_txt = g_strconcat("", GET_SYS_STR("IDS_COM_POP_DELETE_Q"), "", NULL); + help_txt = + g_strconcat("", + GET_SYS_STR("IDS_COM_POP_DELETE_Q"), "", + NULL); break; } @@ -2011,4 +2246,3 @@ mp_edit_create_delete_popup(void *data) evas_object_show(popup); } - diff --git a/src/common/mp-file-util.c b/src/common/mp-file-util.c index 8f1ea7b..2d76fb3 100644 --- a/src/common/mp-file-util.c +++ b/src/common/mp-file-util.c @@ -18,13 +18,14 @@ #include "mp-player-debug.h" #include -static mode_t default_mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; +static mode_t default_mode = + S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; -char* mp_file_dir_get(const char path[]) +char *mp_file_dir_get(const char path[]) { char *p = NULL; - char buf[256] = {0,}; - struct stat info = {0,}; + char buf[256] = { 0, }; + struct stat info = { 0, }; if (stat(path, &info) == 0) { strncpy(buf, path, 256); @@ -38,7 +39,7 @@ char* mp_file_dir_get(const char path[]) int mp_file_exists(const char *path) { - struct stat info = {0,}; + struct stat info = { 0, }; if (!path) { return 0; @@ -53,7 +54,7 @@ int mp_file_exists(const char *path) int mp_file_is_dir(const char *path) { - struct stat info = {0,}; + struct stat info = { 0, }; if (!path) { return 0; @@ -88,7 +89,7 @@ int mp_file_path_dir_exists(const char *folderPath) int mp_file_dir_is_empty(const char *path) { - struct stat info = {0,}; + struct stat info = { 0, }; struct dirent *dp = NULL; struct dirent entry; DIR *dirp = NULL; @@ -102,8 +103,9 @@ int mp_file_dir_is_empty(const char *path) return -1; } - while ((readdir_r(dirp, &entry , &dp) == 0) && dp != NULL) { - if (stat(dp->d_name, &info) == 0 && (strcmp(dp->d_name, ".")) && (strcmp(dp->d_name, ".."))) { + while ((readdir_r(dirp, &entry, &dp) == 0) && dp != NULL) { + if (stat(dp->d_name, &info) == 0 && (strcmp(dp->d_name, ".")) + && (strcmp(dp->d_name, ".."))) { closedir(dirp); return 0; } @@ -125,10 +127,9 @@ int mp_mkdir(const char *dir) } } -static int -mp_mkpath_if_not_exists(const char *path) +static int mp_mkpath_if_not_exists(const char *path) { - struct stat st = {0,}; + struct stat st = { 0, }; if (!path) { return 0; @@ -145,7 +146,7 @@ mp_mkpath_if_not_exists(const char *path) int mp_file_mkpath(char *path) { - char ss[100] = {0,}; + char ss[100] = { 0, }; unsigned int i = 0; if (!path) { @@ -189,7 +190,7 @@ int mp_file_unlink(const char *filename) int mp_file_size(const char *filename) { - struct stat info = {0,}; + struct stat info = { 0, }; if (!filename) { return 0; @@ -235,22 +236,24 @@ Eina_List *mp_file_ls(const char *dir) return NULL; } - while ((readdir_r(dirp, &entry , &dp) == 0) && dp != NULL) { - if ((strcmp(dp->d_name , ".")) && (strcmp(dp->d_name , ".."))) { + while ((readdir_r(dirp, &entry, &dp) == 0) && dp != NULL) { + if ((strcmp(dp->d_name, ".")) && (strcmp(dp->d_name, ".."))) { f = strdup(dp->d_name); - list = eina_list_append(list , f); + list = eina_list_append(list, f); } } closedir(dirp); - list = eina_list_sort(list, eina_list_count(list), EINA_COMPARE_CB(strcoll)); + list = + eina_list_sort(list, eina_list_count(list), + EINA_COMPARE_CB(strcoll)); return list; } int mp_file_recursive_rm(const char *dir) { - char buf[PATH_MAX] = {0,}; + char buf[PATH_MAX] = { 0, }; struct dirent *dp = NULL; struct dirent entry; DIR *dirp = NULL; @@ -269,7 +272,8 @@ int mp_file_recursive_rm(const char *dir) dirp = opendir(dir); if (dirp) { while (((readdir_r(dirp, &entry, &dp)) == 0) && dp != NULL) { - if ((strcmp(dp->d_name , ".")) && (strcmp(dp->d_name, ".."))) { + if ((strcmp(dp->d_name, ".")) + && (strcmp(dp->d_name, ".."))) { if (!mp_file_recursive_rm(dp->d_name)) { ret = 0; } @@ -290,7 +294,7 @@ int mp_file_recursive_rm(const char *dir) int mp_file_mv(const char *src, const char *dst) { - struct stat info = {0,}; + struct stat info = { 0, }; if (stat(dst, &info) == 0) { return 0; } @@ -313,9 +317,9 @@ int mp_file_cp(const char *src, const char *dst) { FILE *f1 = NULL; FILE *f2 = NULL; - char buf[16384] = {0,}; - char* realpath1 = NULL; - char* realpath2 = NULL; + char buf[16384] = { 0, }; + char *realpath1 = NULL; + char *realpath2 = NULL; size_t num = 0; int ret = 1; @@ -329,7 +333,8 @@ int mp_file_cp(const char *src, const char *dst) return 0; } - if (realpath(dst, realpath2) && realpath2 && !strcmp(realpath1, realpath2)) { + if (realpath(dst, realpath2) && realpath2 + && !strcmp(realpath1, realpath2)) { DEBUG_TRACE("realpath check failed"); return 0; } @@ -380,8 +385,8 @@ int mp_file_remove(const char *path) char *mp_file_file_get(char path[]) { - char * file = NULL; - struct stat info = {0,}; + char *file = NULL; + struct stat info = { 0, }; if (stat(path, &info) == 0) { file = strrchr(path, '/'); diff --git a/src/common/mp-item.c b/src/common/mp-item.c index 85f30a5..1205846 100644 --- a/src/common/mp-item.c +++ b/src/common/mp-item.c @@ -24,8 +24,7 @@ #include "mp-ug-launch.h" #include "mp-player-debug.h" -bool -mp_item_update_db(char *fid) +bool mp_item_update_db(char *fid) { mp_media_info_h media; @@ -48,4 +47,3 @@ mp_item_update_db(char *fid) return TRUE; } - diff --git a/src/common/mp-media-info.c b/src/common/mp-media-info.c index 9ce3b84..796788f 100644 --- a/src/common/mp-media-info.c +++ b/src/common/mp-media-info.c @@ -29,17 +29,17 @@ #include #include -#define PRINT_STR(s) //DEBUG_TRACE("%s", s); -#define PRINT_INT(i) //DEBUG_TRACE("%d", i); +#define PRINT_STR(s) //DEBUG_TRACE("%s", s); +#define PRINT_INT(i) //DEBUG_TRACE("%d", i); -#define MP_MEDIA_COND_COMMON "(MEDIA_STORAGE_TYPE IS NOT 101)" // exclude dropbox +#define MP_MEDIA_COND_COMMON "(MEDIA_STORAGE_TYPE IS NOT 101)" // exclude dropbox #ifdef UG_MUSIC_PLAYER -#define MP_MEDIA_TYPE MP_MEDIA_COND_COMMON"AND ((MEDIA_TYPE=3) OR (MEDIA_TYPE=2))" +#define MP_MEDIA_TYPE MP_MEDIA_COND_COMMON"AND ((MEDIA_TYPE=3) OR (MEDIA_TYPE=2))" #else -#define MP_MEDIA_TYPE MP_MEDIA_COND_COMMON"AND (MEDIA_TYPE=3)" +#define MP_MEDIA_TYPE MP_MEDIA_COND_COMMON"AND (MEDIA_TYPE=3)" #endif -#define MP_SOUND_TYPE MP_MEDIA_COND_COMMON"AND (MEDIA_TYPE=2)" +#define MP_SOUND_TYPE MP_MEDIA_COND_COMMON"AND (MEDIA_TYPE=2)" struct mp_media_list_s { GList *list; @@ -70,7 +70,7 @@ struct mp_ginfo_s { char *main_info; char *sub_info; char *thumb_path; - int track_count; + int track_count; //for artist list char **album_thumb_paths; @@ -79,12 +79,12 @@ struct mp_ginfo_s { struct mp_media_info_s { union { - media_info_h media; //media_info_h + media_info_h media; //media_info_h void *group; //handle for group item like media_playlist_h, media_album_h, media_folder_h... } h; union { - audio_meta_h meta; //audio_meta_h for a media + audio_meta_h meta; //audio_meta_h for a media mp_group_type_e group_type; } s; @@ -98,7 +98,8 @@ struct mp_media_info_s { media_content_noti_h noti_handle; -static void _mp_media_info_sql_strncat(char *buf, const char *query, int size) +static void _mp_media_info_sql_strncat(char *buf, const char *query, + int size) { char *sql = sqlite3_mprintf("%q", query); SECURE_DEBUG("sql: %s", sql); @@ -106,10 +107,10 @@ static void _mp_media_info_sql_strncat(char *buf, const char *query, int size) sqlite3_free(sql); } -static inline int _mp_media_info_compare_cb(const void *a , const void *b) +static inline int _mp_media_info_compare_cb(const void *a, const void *b) { - mp_media_info_h media_info_a = (mp_media_info_h)a; - mp_media_info_h media_info_b = (mp_media_info_h)b; + mp_media_info_h media_info_a = (mp_media_info_h) a; + mp_media_info_h media_info_b = (mp_media_info_h) b; char *s_a = NULL, *s_b = NULL; int n_a = 0, n_b = 0, res = 0; @@ -127,9 +128,9 @@ static inline int _mp_media_info_compare_cb(const void *a , const void *b) n_b = atoi(s_b); if (n_a < n_b) { - res = 1; - } else if (n_a > n_b) { - res = -1; + res = 1; + } else if (n_a > n_b) { + res = -1; } DEBUG_TRACE("a: %d, b: %d, res: %d", n_a, n_b, res); @@ -137,7 +138,8 @@ static inline int _mp_media_info_compare_cb(const void *a , const void *b) return res; } -static inline bool __mp_media_info_of_album_cb(media_info_h media, void *user_data) +static inline bool __mp_media_info_of_album_cb(media_info_h media, + void *user_data) { int res = MEDIA_CONTENT_ERROR_NONE; mp_media_list_h media_list = user_data; @@ -170,7 +172,9 @@ static inline bool __mp_media_info_of_album_cb(media_info_h media, void *user_da } media_info->h.media = m; - media_list->list = g_list_insert_sorted(media_list->list, media_info, _mp_media_info_compare_cb); + media_list->list = + g_list_insert_sorted(media_list->list, media_info, + _mp_media_info_compare_cb); return true; } @@ -210,7 +214,9 @@ static inline bool __mp_media_info_cb(media_info_h media, void *user_data) return true; } -static inline bool __mp_playlist_media_info_cb(int playlist_member_id, media_info_h media, void *user_data) +static inline bool __mp_playlist_media_info_cb(int playlist_member_id, + media_info_h media, + void *user_data) { int res = MEDIA_CONTENT_ERROR_NONE; mp_media_list_h media_list = user_data; @@ -245,7 +251,8 @@ static inline bool __mp_playlist_media_info_cb(int playlist_member_id, media_inf return true; } -static inline bool __mp_media_album_cb(media_album_h album, void *user_data) +static inline bool __mp_media_album_cb(media_album_h album, + void *user_data) { mp_media_info_h media_info = NULL; mp_media_list_h media_list = user_data; @@ -271,7 +278,7 @@ static inline bool __mp_media_album_cb(media_album_h album, void *user_data) return false; } - media_album_clone((media_album_h *)&media_info->h.group, album); + media_album_clone((media_album_h *) & media_info->h.group, album); media_info->s.group_type = media_list->group_type; media_list->list = g_list_prepend(media_list->list, media_info); @@ -279,7 +286,8 @@ static inline bool __mp_media_album_cb(media_album_h album, void *user_data) return true; } -static inline bool __mp_media_folder_cb(media_folder_h folder, void *user_data) +static inline bool __mp_media_folder_cb(media_folder_h folder, + void *user_data) { mp_media_info_h media_info = NULL; mp_media_list_h media_list = user_data; @@ -294,7 +302,7 @@ static inline bool __mp_media_folder_cb(media_folder_h folder, void *user_data) return false; } - media_folder_clone((media_folder_h *)&media_info->h.group, folder); + media_folder_clone((media_folder_h *) & media_info->h.group, folder); media_info->s.group_type = media_list->group_type; media_list->list = g_list_prepend(media_list->list, media_info); @@ -302,7 +310,8 @@ static inline bool __mp_media_folder_cb(media_folder_h folder, void *user_data) return true; } -static inline bool __mp_media_playlist_cb(media_playlist_h playlist, void *user_data) +static inline bool __mp_media_playlist_cb(media_playlist_h playlist, + void *user_data) { mp_media_info_h media_info = NULL; mp_media_list_h media_list = user_data; @@ -317,7 +326,8 @@ static inline bool __mp_media_playlist_cb(media_playlist_h playlist, void *user_ return false; } - media_playlist_clone((media_playlist_h *)&media_info->h.group, playlist); + media_playlist_clone((media_playlist_h *) & media_info->h.group, + playlist); media_info->s.group_type = media_list->group_type; media_list->list = g_list_prepend(media_list->list, media_info); @@ -332,7 +342,7 @@ static inline bool __mp_media_playlist_cb(media_playlist_h playlist, void *user_ return true; } -static inline bool __mp_media_group_cb(const char* name, void *user_data) +static inline bool __mp_media_group_cb(const char *name, void *user_data) { mp_media_info_h media_info = NULL; mp_media_list_h media_list = user_data; @@ -382,7 +392,8 @@ static void __mp_media_group_destory(void *data) while (media_info->i.ginfo->album_count) { media_info->i.ginfo->album_count--; - IF_FREE(media_info->i.ginfo->album_thumb_paths[media_info->i.ginfo->album_count]); + IF_FREE(media_info->i.ginfo-> + album_thumb_paths[media_info->i.ginfo->album_count]); } IF_FREE(media_info->i.ginfo->album_thumb_paths); @@ -393,105 +404,134 @@ static void __mp_media_group_destory(void *data) } -static void __mp_media_info_set_group_filter(mp_filter_h filter, mp_group_type_e group_type, const char *type_string, const char *filter_string) +static void __mp_media_info_set_group_filter(mp_filter_h filter, + mp_group_type_e group_type, + const char *type_string, + const char *filter_string) { - char cond[MAX_FILTER_LEN] = {0,}; + char cond[MAX_FILTER_LEN] = { 0, }; if (group_type != MP_GROUP_BY_PLAYLIST) { strncat(cond, MP_MEDIA_TYPE, STRNCAT_LEN(cond)); } else { - strncat(cond, "((MEDIA_TYPE=3 and PLAYLIST_MEDIA_COUNT>0) or PLAYLIST_MEDIA_COUNT=0)", STRNCAT_LEN(cond)); + strncat(cond, + "((MEDIA_TYPE=3 and PLAYLIST_MEDIA_COUNT>0) or PLAYLIST_MEDIA_COUNT=0)", + STRNCAT_LEN(cond)); } switch (group_type) { case MP_GROUP_BY_ALBUM: if (type_string) { strncat(cond, " AND MEDIA_ALBUM = '\%", STRNCAT_LEN(cond)); - _mp_media_info_sql_strncat(cond, type_string, STRNCAT_LEN(cond)); + _mp_media_info_sql_strncat(cond, type_string, + STRNCAT_LEN(cond)); strncat(cond, "\%'", STRNCAT_LEN(cond)); } if (filter_string) { strncat(cond, " AND MEDIA_ALBUM like '\%", STRNCAT_LEN(cond)); - _mp_media_info_sql_strncat(cond, filter_string, STRNCAT_LEN(cond)); + _mp_media_info_sql_strncat(cond, filter_string, + STRNCAT_LEN(cond)); strncat(cond, "\%'", STRNCAT_LEN(cond)); } - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_ALBUM, MEDIA_CONTENT_COLLATE_NOCASE); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, + MEDIA_ALBUM, MEDIA_CONTENT_COLLATE_NOCASE); break; case MP_GROUP_BY_ARTIST: if (type_string) { strncat(cond, " AND MEDIA_ARTIST = '\%", STRNCAT_LEN(cond)); - _mp_media_info_sql_strncat(cond, type_string, STRNCAT_LEN(cond)); + _mp_media_info_sql_strncat(cond, type_string, + STRNCAT_LEN(cond)); strncat(cond, "\%'", STRNCAT_LEN(cond)); } if (filter_string) { strncat(cond, " AND MEDIA_ARTIST like '\%", STRNCAT_LEN(cond)); - _mp_media_info_sql_strncat(cond, filter_string, STRNCAT_LEN(cond)); + _mp_media_info_sql_strncat(cond, filter_string, + STRNCAT_LEN(cond)); strncat(cond, "\%'", STRNCAT_LEN(cond)); } - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_ARTIST, MEDIA_CONTENT_COLLATE_NOCASE); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, + MEDIA_ARTIST, MEDIA_CONTENT_COLLATE_NOCASE); break; case MP_GROUP_BY_ARTIST_ALBUM: MP_CHECK(type_string && strlen(type_string)); if (filter_string) { strncat(cond, " AND MEDIA_ALBUM like '\%", STRNCAT_LEN(cond)); - _mp_media_info_sql_strncat(cond, filter_string, STRNCAT_LEN(cond)); + _mp_media_info_sql_strncat(cond, filter_string, + STRNCAT_LEN(cond)); strncat(cond, "\%' AND ", STRNCAT_LEN(cond)); } strncat(cond, " AND MEDIA_ARTIST = '", STRNCAT_LEN(cond)); _mp_media_info_sql_strncat(cond, type_string, STRNCAT_LEN(cond)); strncat(cond, "'", STRNCAT_LEN(cond)); - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_ALBUM, MEDIA_CONTENT_COLLATE_NOCASE); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, + MEDIA_ALBUM, MEDIA_CONTENT_COLLATE_NOCASE); break; case MP_GROUP_BY_GENRE: if (filter_string) { strncat(cond, " AND MEDIA_GENRE like '\%", STRNCAT_LEN(cond)); - _mp_media_info_sql_strncat(cond, filter_string, STRNCAT_LEN(cond)); + _mp_media_info_sql_strncat(cond, filter_string, + STRNCAT_LEN(cond)); strncat(cond, "\%'", STRNCAT_LEN(cond)); } - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_GENRE, MEDIA_CONTENT_COLLATE_NOCASE); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, + MEDIA_GENRE, MEDIA_CONTENT_COLLATE_NOCASE); break; case MP_GROUP_BY_FOLDER: if (filter_string) { strncat(cond, " AND FOLDER_PATH like '\%", STRNCAT_LEN(cond)); - _mp_media_info_sql_strncat(cond, filter_string, STRNCAT_LEN(cond)); + _mp_media_info_sql_strncat(cond, filter_string, + STRNCAT_LEN(cond)); strncat(cond, "\%'", STRNCAT_LEN(cond)); } - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, FOLDER_NAME, MEDIA_CONTENT_COLLATE_NOCASE); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, + FOLDER_NAME, MEDIA_CONTENT_COLLATE_NOCASE); break; case MP_GROUP_BY_YEAR: if (filter_string) { strncat(cond, " AND MEDIA_YEAR like '\%", STRNCAT_LEN(cond)); - _mp_media_info_sql_strncat(cond, filter_string, STRNCAT_LEN(cond)); + _mp_media_info_sql_strncat(cond, filter_string, + STRNCAT_LEN(cond)); strncat(cond, "\%'", STRNCAT_LEN(cond)); } - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_YEAR, MEDIA_CONTENT_COLLATE_NOCASE); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_YEAR, + MEDIA_CONTENT_COLLATE_NOCASE); break; case MP_GROUP_BY_COMPOSER: if (filter_string) { - strncat(cond, " AND MEDIA_COMPOSER like '\%", STRNCAT_LEN(cond)); - _mp_media_info_sql_strncat(cond, filter_string, STRNCAT_LEN(cond)); + strncat(cond, " AND MEDIA_COMPOSER like '\%", + STRNCAT_LEN(cond)); + _mp_media_info_sql_strncat(cond, filter_string, + STRNCAT_LEN(cond)); strncat(cond, "\%'", STRNCAT_LEN(cond)); } - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_COMPOSER, MEDIA_CONTENT_COLLATE_NOCASE); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, + MEDIA_COMPOSER, + MEDIA_CONTENT_COLLATE_NOCASE); break; case MP_GROUP_BY_PLAYLIST: if (filter_string) { - strncat(cond, " AND PLAYLIST_NAME like '\%", STRNCAT_LEN(cond)); - _mp_media_info_sql_strncat(cond, filter_string, STRNCAT_LEN(cond)); + strncat(cond, " AND PLAYLIST_NAME like '\%", + STRNCAT_LEN(cond)); + _mp_media_info_sql_strncat(cond, filter_string, + STRNCAT_LEN(cond)); strncat(cond, "\%'", STRNCAT_LEN(cond)); } - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, PLAYLIST_NAME, MEDIA_CONTENT_COLLATE_NOCASE); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, + PLAYLIST_NAME, + MEDIA_CONTENT_COLLATE_NOCASE); break; default: WARN_TRACE("Unhandled type: %d", group_type); break; } if (strlen(cond)) { - media_filter_set_condition(filter, cond, MEDIA_CONTENT_COLLATE_NOCASE); + media_filter_set_condition(filter, cond, + MEDIA_CONTENT_COLLATE_NOCASE); } } -static int __mp_media_info_get_thumbnail_path(media_info_h media, char **path) +static int __mp_media_info_get_thumbnail_path(media_info_h media, + char **path) { int res = 0; res = media_info_get_thumbnail_path(media, path); @@ -502,9 +542,13 @@ static int __mp_media_info_get_thumbnail_path(media_info_h media, char **path) return res; } -static void __mp_media_info_set_filter(filter_h filter, mp_track_type_e track_type, const char *type_string, const char *type_string2, const char *filter_string) +static void __mp_media_info_set_filter(filter_h filter, + mp_track_type_e track_type, + const char *type_string, + const char *type_string2, + const char *filter_string) { - char cond[MAX_FILTER_LEN] = {0,}; + char cond[MAX_FILTER_LEN] = { 0, }; if (track_type == MP_TRACK_BY_VOICE_CLIP) { strncat(cond, MP_SOUND_TYPE, STRNCAT_LEN(cond)); } else { @@ -513,12 +557,14 @@ static void __mp_media_info_set_filter(filter_h filter, mp_track_type_e track_ty switch (track_type) { case MP_TRACK_ALL: - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_TITLE, MEDIA_CONTENT_COLLATE_NOCASE); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, + MEDIA_TITLE, MEDIA_CONTENT_COLLATE_NOCASE); break; case MP_TRACK_BY_ALBUM: if (type_string) { strncat(cond, " AND MEDIA_ALBUM='", STRNCAT_LEN(cond)); - _mp_media_info_sql_strncat(cond, type_string, STRNCAT_LEN(cond)); + _mp_media_info_sql_strncat(cond, type_string, + STRNCAT_LEN(cond)); strncat(cond, "'", STRNCAT_LEN(cond)); } else { strncat(cond, " AND MEDIA_ALBUM is null", STRNCAT_LEN(cond)); @@ -526,59 +572,73 @@ static void __mp_media_info_set_filter(filter_h filter, mp_track_type_e track_ty //strncat(cond, " ORDER BY CAST(MEDIA_TRACK_NUM as integer)", STRNCAT_LEN(cond)); break; case MP_TRACK_BY_ARTIST: - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, "MEDIA_ALBUM, MEDIA_TITLE", MEDIA_CONTENT_COLLATE_NOCASE); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, + "MEDIA_ALBUM, MEDIA_TITLE", + MEDIA_CONTENT_COLLATE_NOCASE); if (type_string) { strncat(cond, " AND MEDIA_ARTIST='", STRNCAT_LEN(cond)); - _mp_media_info_sql_strncat(cond, type_string, STRNCAT_LEN(cond)); + _mp_media_info_sql_strncat(cond, type_string, + STRNCAT_LEN(cond)); strncat(cond, "'", STRNCAT_LEN(cond)); } else { strncat(cond, " AND MEDIA_ARTIST is null", STRNCAT_LEN(cond)); } break; case MP_TRACK_BY_GENRE: - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_TITLE, MEDIA_CONTENT_COLLATE_NOCASE); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, + MEDIA_TITLE, MEDIA_CONTENT_COLLATE_NOCASE); if (type_string) { strncat(cond, " AND MEDIA_GENRE='", STRNCAT_LEN(cond)); - _mp_media_info_sql_strncat(cond, type_string, STRNCAT_LEN(cond)); + _mp_media_info_sql_strncat(cond, type_string, + STRNCAT_LEN(cond)); strncat(cond, "'", STRNCAT_LEN(cond)); } else { strncat(cond, " AND MEDIA_GENRE is null", STRNCAT_LEN(cond)); } break; case MP_TRACK_BY_FOLDER: - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_DISPLAY_NAME, MEDIA_CONTENT_COLLATE_NOCASE); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, + MEDIA_DISPLAY_NAME, + MEDIA_CONTENT_COLLATE_NOCASE); break; case MP_TRACK_BY_YEAR: - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_TITLE, MEDIA_CONTENT_COLLATE_NOCASE); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, + MEDIA_TITLE, MEDIA_CONTENT_COLLATE_NOCASE); if (type_string) { strncat(cond, " AND MEDIA_YEAR='", STRNCAT_LEN(cond)); - _mp_media_info_sql_strncat(cond, type_string, STRNCAT_LEN(cond)); + _mp_media_info_sql_strncat(cond, type_string, + STRNCAT_LEN(cond)); strncat(cond, "'", STRNCAT_LEN(cond)); } else { strncat(cond, " AND MEDIA_YEAR is null", STRNCAT_LEN(cond)); } break; case MP_TRACK_BY_COMPOSER: - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_TITLE, MEDIA_CONTENT_COLLATE_NOCASE); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, + MEDIA_TITLE, MEDIA_CONTENT_COLLATE_NOCASE); if (type_string) { strncat(cond, " AND MEDIA_COMPOSER='", STRNCAT_LEN(cond)); - _mp_media_info_sql_strncat(cond, type_string, STRNCAT_LEN(cond)); + _mp_media_info_sql_strncat(cond, type_string, + STRNCAT_LEN(cond)); strncat(cond, "'", STRNCAT_LEN(cond)); } else { - strncat(cond, " AND MEDIA_COMPOSER is null", STRNCAT_LEN(cond)); + strncat(cond, " AND MEDIA_COMPOSER is null", + STRNCAT_LEN(cond)); } break; case MP_TRACK_BY_ARTIST_ALBUM: if (type_string) { strncat(cond, " AND MEDIA_ALBUM='", STRNCAT_LEN(cond)); - _mp_media_info_sql_strncat(cond, type_string, STRNCAT_LEN(cond)); + _mp_media_info_sql_strncat(cond, type_string, + STRNCAT_LEN(cond)); strncat(cond, "'", STRNCAT_LEN(cond)); } else { strncat(cond, " AND MEDIA_ALBUM is null", STRNCAT_LEN(cond)); } if (type_string2) { strncat(cond, " AND MEDIA_ARTIST='", STRNCAT_LEN(cond)); - _mp_media_info_sql_strncat(cond, type_string2, STRNCAT_LEN(cond)); + _mp_media_info_sql_strncat(cond, type_string2, + STRNCAT_LEN(cond)); strncat(cond, "'", STRNCAT_LEN(cond)); } else { strncat(cond, " AND MEDIA_ARTIST is null", STRNCAT_LEN(cond)); @@ -586,31 +646,47 @@ static void __mp_media_info_set_filter(filter_h filter, mp_track_type_e track_ty //strncat(cond, " ORDER BY CAST(MEDIA_TRACK_NUM as integer)", STRNCAT_LEN(cond)); break; case MP_TRACK_BY_FAVORITE: - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_DESC, MEDIA_FAVOURITE, MEDIA_CONTENT_COLLATE_NOCASE); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_DESC, + MEDIA_FAVOURITE, + MEDIA_CONTENT_COLLATE_NOCASE); strncat(cond, " AND MEDIA_FAVOURITE>0", STRNCAT_LEN(cond)); break; case MP_TRACK_BY_PLAYED_TIME: - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_DESC, MEDIA_LAST_PLAYED_TIME, MEDIA_CONTENT_COLLATE_NOCASE); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_DESC, + MEDIA_LAST_PLAYED_TIME, + MEDIA_CONTENT_COLLATE_NOCASE); strncat(cond, " AND MEDIA_LAST_PLAYED_TIME>0", STRNCAT_LEN(cond)); break; case MP_TRACK_BY_ADDED_TIME: - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_DESC, MEDIA_ADDED_TIME, MEDIA_CONTENT_COLLATE_NOCASE); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_DESC, + MEDIA_ADDED_TIME, + MEDIA_CONTENT_COLLATE_NOCASE); strncat(cond, " AND MEDIA_ADDED_TIME>0", STRNCAT_LEN(cond)); break; case MP_TRACK_BY_PLAYED_COUNT: - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_DESC, MEDIA_PLAYED_COUNT, MEDIA_CONTENT_COLLATE_NOCASE); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_DESC, + MEDIA_PLAYED_COUNT, + MEDIA_CONTENT_COLLATE_NOCASE); strncat(cond, " AND MEDIA_PLAYED_COUNT>0", STRNCAT_LEN(cond)); break; case MP_TRACK_BY_PLAYLIST: - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_DESC, PLAYLIST_MEMBER_ORDER, MEDIA_CONTENT_COLLATE_NOCASE); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_DESC, + PLAYLIST_MEMBER_ORDER, + MEDIA_CONTENT_COLLATE_NOCASE); break; case MP_TRACK_BY_VOICE_CLIP: - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_TITLE, MEDIA_CONTENT_COLLATE_NOCASE); - strncat(cond, " AND MEDIA_MIME_TYPE=\"audio/AMR\" OR MEDIA_MIME_TYPE=\"audio/mp4\" OR MEDIA_MIME_TYPE=\"audio/3gpp\"", STRNCAT_LEN(cond)); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, + MEDIA_TITLE, MEDIA_CONTENT_COLLATE_NOCASE); + strncat(cond, + " AND MEDIA_MIME_TYPE=\"audio/AMR\" OR MEDIA_MIME_TYPE=\"audio/mp4\" OR MEDIA_MIME_TYPE=\"audio/3gpp\"", + STRNCAT_LEN(cond)); break; case MP_TRACK_BY_GROUP_PLAY: - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_TITLE, MEDIA_CONTENT_COLLATE_NOCASE); - strncat(cond, " AND MEDIA_MIME_TYPE=\"audio/x-wav\" OR MEDIA_MIME_TYPE=\"audio/mpeg\"", STRNCAT_LEN(cond)); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, + MEDIA_TITLE, MEDIA_CONTENT_COLLATE_NOCASE); + strncat(cond, + " AND MEDIA_MIME_TYPE=\"audio/x-wav\" OR MEDIA_MIME_TYPE=\"audio/mpeg\"", + STRNCAT_LEN(cond)); break; default: WARN_TRACE("Unhandled type: %d", track_type); @@ -622,7 +698,6 @@ static void __mp_media_info_set_filter(filter_h filter, mp_track_type_e track_ty _mp_media_info_sql_strncat(cond, filter_string, STRNCAT_LEN(cond)); strncat(cond, "\%'", STRNCAT_LEN(cond)); } - //DEBUG_TRACE("cond: %s", cond); media_filter_set_condition(filter, cond, MEDIA_CONTENT_COLLATE_NOCASE); @@ -638,6 +713,7 @@ int mp_media_info_connect(void) return res; } + int mp_media_info_disconnect(void) { int res = media_content_disconnect(); @@ -649,7 +725,7 @@ int mp_media_info_disconnect(void) } /*filter*/ -int mp_media_filter_create(mp_filter_h *filter) +int mp_media_filter_create(mp_filter_h * filter) { int res = media_filter_create(filter); if (res != MEDIA_CONTENT_ERROR_NONE) { @@ -657,6 +733,7 @@ int mp_media_filter_create(mp_filter_h *filter) } return res; } + int mp_media_filter_destory(mp_filter_h filter) { int res = media_filter_destroy(filter); @@ -665,6 +742,7 @@ int mp_media_filter_destory(mp_filter_h filter) } return res; } + int mp_media_filter_set_offset(mp_filter_h filter, int offset, int count) { int res = media_filter_set_offset(filter, offset, count); @@ -673,17 +751,27 @@ int mp_media_filter_set_offset(mp_filter_h filter, int offset, int count) } return res; } -int mp_media_filter_set_order(mp_filter_h filter, bool descending, const char *order_keyword, mp_media_content_collation_e collation) + +int mp_media_filter_set_order(mp_filter_h filter, bool descending, + const char *order_keyword, + mp_media_content_collation_e collation) { - int res = media_filter_set_order(filter, descending, order_keyword, (media_content_collation_e)collation); + int res = + media_filter_set_order(filter, descending, order_keyword, + (media_content_collation_e) collation); if (res != MEDIA_CONTENT_ERROR_NONE) { ERROR_TRACE("Error code 0x%x", res); } return res; } -int mp_media_filter_set_condition(mp_filter_h filter, const char *condition, mp_media_content_collation_e collation) + +int mp_media_filter_set_condition(mp_filter_h filter, + const char *condition, + mp_media_content_collation_e collation) { - int res = media_filter_set_condition(filter, condition, (media_content_collation_e)collation); + int res = + media_filter_set_condition(filter, condition, + (media_content_collation_e) collation); if (res != MEDIA_CONTENT_ERROR_NONE) { ERROR_TRACE("Error code 0x%x", res); } @@ -691,13 +779,19 @@ int mp_media_filter_set_condition(mp_filter_h filter, const char *condition, mp_ } /*media infomation*/ -int mp_media_info_list_count_w_filter(mp_track_type_e track_type, const char * folder_id, int playlist_id, mp_filter_h filter, int *count) +int mp_media_info_list_count_w_filter(mp_track_type_e track_type, + const char *folder_id, + int playlist_id, mp_filter_h filter, + int *count) { int res = MEDIA_CONTENT_ERROR_NONE; if (track_type == MP_TRACK_BY_FOLDER) { - res = media_folder_get_media_count_from_db(folder_id, filter, count); + res = + media_folder_get_media_count_from_db(folder_id, filter, count); } else if (track_type == MP_TRACK_BY_PLAYLIST) { - res = media_playlist_get_media_count_from_db(playlist_id, filter, count); + res = + media_playlist_get_media_count_from_db(playlist_id, filter, + count); } else { res = media_info_get_media_count_from_db(filter, count); } @@ -705,7 +799,9 @@ int mp_media_info_list_count_w_filter(mp_track_type_e track_type, const char * f ERROR_TRACE("Error code 0x%x", res); } - if (track_type == MP_TRACK_BY_PLAYED_TIME || track_type == MP_TRACK_BY_ADDED_TIME || track_type == MP_TRACK_BY_PLAYED_COUNT) { + if (track_type == MP_TRACK_BY_PLAYED_TIME + || track_type == MP_TRACK_BY_ADDED_TIME + || track_type == MP_TRACK_BY_PLAYED_COUNT) { if (*count > MP_AUTO_PLAYLIST_ITEM_MAX) { *count = MP_AUTO_PLAYLIST_ITEM_MAX; } @@ -718,7 +814,11 @@ int mp_media_info_list_count_w_filter(mp_track_type_e track_type, const char * f return res; } -int mp_media_info_list_count(mp_track_type_e track_type, const char *type_string, const char *type_string2, const char *filter_string, int playlist_id, int *count) +int mp_media_info_list_count(mp_track_type_e track_type, + const char *type_string, + const char *type_string2, + const char *filter_string, int playlist_id, + int *count) { int res = MEDIA_CONTENT_ERROR_NONE; filter_h filter = NULL; @@ -726,14 +826,20 @@ int mp_media_info_list_count(mp_track_type_e track_type, const char *type_string res = media_filter_create(&filter); MP_CHECK_VAL(res == MEDIA_CONTENT_ERROR_NONE, res); - __mp_media_info_set_filter(filter, track_type, type_string, type_string2, filter_string); + __mp_media_info_set_filter(filter, track_type, type_string, + type_string2, filter_string); - res = mp_media_info_list_count_w_filter(track_type, type_string, playlist_id, filter, count); + res = + mp_media_info_list_count_w_filter(track_type, type_string, + playlist_id, filter, count); media_filter_destroy(filter); return res; } -int mp_media_info_list_create_w_filter(mp_track_type_e track_type, const char *folder_id, int playlist_id, mp_filter_h filter, mp_media_list_h *media_list) +int mp_media_info_list_create_w_filter(mp_track_type_e track_type, + const char *folder_id, + int playlist_id, mp_filter_h filter, + mp_media_list_h * media_list) { int res = MEDIA_CONTENT_ERROR_NONE; @@ -744,14 +850,28 @@ int mp_media_info_list_create_w_filter(mp_track_type_e track_type, const char *f (*media_list)->group_type = MP_GROUP_NONE; if (track_type == MP_TRACK_BY_FOLDER) { - res = media_folder_foreach_media_from_db(folder_id, filter, __mp_media_info_cb, *media_list); + res = + media_folder_foreach_media_from_db(folder_id, filter, + __mp_media_info_cb, + *media_list); } else if (track_type == MP_TRACK_BY_PLAYLIST) { - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, PLAYLIST_MEMBER_ORDER, MEDIA_CONTENT_COLLATE_NOCASE); - res = media_playlist_foreach_media_from_db(playlist_id, filter, __mp_playlist_media_info_cb, *media_list); - } else if (track_type == MP_TRACK_BY_ALBUM || track_type == MP_TRACK_BY_ARTIST_ALBUM) { - res = media_info_foreach_media_from_db(filter, __mp_media_info_of_album_cb, *media_list); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, + PLAYLIST_MEMBER_ORDER, + MEDIA_CONTENT_COLLATE_NOCASE); + res = + media_playlist_foreach_media_from_db(playlist_id, filter, + __mp_playlist_media_info_cb, + *media_list); + } else if (track_type == MP_TRACK_BY_ALBUM + || track_type == MP_TRACK_BY_ARTIST_ALBUM) { + res = + media_info_foreach_media_from_db(filter, + __mp_media_info_of_album_cb, + *media_list); } else { - res = media_info_foreach_media_from_db(filter, __mp_media_info_cb, *media_list); + res = + media_info_foreach_media_from_db(filter, __mp_media_info_cb, + *media_list); } if (res != MEDIA_CONTENT_ERROR_NONE) { @@ -769,8 +889,12 @@ int mp_media_info_list_create_w_filter(mp_track_type_e track_type, const char *f return res; } -int mp_media_info_list_create(mp_media_list_h *out_list, - mp_track_type_e track_type, const char *type_string, const char *type_string2, const char *filter_string, int playlist_id, int offset, int count) +int mp_media_info_list_create(mp_media_list_h * out_list, + mp_track_type_e track_type, + const char *type_string, + const char *type_string2, + const char *filter_string, int playlist_id, + int offset, int count) { int res = MEDIA_CONTENT_ERROR_NONE; filter_h filter = NULL; @@ -780,16 +904,20 @@ int mp_media_info_list_create(mp_media_list_h *out_list, MP_CHECK_VAL(res == MEDIA_CONTENT_ERROR_NONE, res); res = media_filter_set_offset(filter, offset, count); - __mp_media_info_set_filter(filter, track_type, type_string, type_string2, filter_string); + __mp_media_info_set_filter(filter, track_type, type_string, + type_string2, filter_string); - res = mp_media_info_list_create_w_filter(track_type, type_string, playlist_id, filter, out_list); + res = + mp_media_info_list_create_w_filter(track_type, type_string, + playlist_id, filter, out_list); media_filter_destroy(filter); return res; } #ifdef MP_SOUND_PLAYER -int mp_media_info_sorted_track_list_create(mp_media_list_h *out_list, char *sort_type) +int mp_media_info_sorted_track_list_create(mp_media_list_h * out_list, + char *sort_type) { int res = MEDIA_CONTENT_ERROR_NONE; filter_h filter = NULL; @@ -797,21 +925,30 @@ int mp_media_info_sorted_track_list_create(mp_media_list_h *out_list, char *sort res = media_filter_create(&filter); MP_CHECK_VAL(res == MEDIA_CONTENT_ERROR_NONE, res); - char cond[MAX_FILTER_LEN] = {0,}; + char cond[MAX_FILTER_LEN] = { 0, }; strncat(cond, "(MEDIA_TYPE=3) OR (MEDIA_TYPE=2)", STRNCAT_LEN(cond)); media_filter_set_condition(filter, cond, MEDIA_CONTENT_COLLATE_NOCASE); if (!g_strcmp0(sort_type, "MYFILE_SORT_BY_NAME_A2Z")) { - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_DESC, MEDIA_DISPLAY_NAME, MEDIA_CONTENT_COLLATE_NOCASE); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_DESC, + MEDIA_DISPLAY_NAME, + MEDIA_CONTENT_COLLATE_NOCASE); } else if (!g_strcmp0(sort_type, "MYFILE_SORT_BY_NAME_Z2A")) { - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_DISPLAY_NAME, MEDIA_CONTENT_COLLATE_NOCASE); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, + MEDIA_DISPLAY_NAME, + MEDIA_CONTENT_COLLATE_NOCASE); } else if (!g_strcmp0(sort_type, "MYFILE_SORT_BY_DATE_O2R")) { - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_DESC, MEDIA_MODIFIED_TIME, MEDIA_CONTENT_COLLATE_NOCASE); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_DESC, + MEDIA_MODIFIED_TIME, + MEDIA_CONTENT_COLLATE_NOCASE); } else if (!g_strcmp0(sort_type, "MYFILE_SORT_BY_SIZE_L2S")) { - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_SIZE, MEDIA_CONTENT_COLLATE_NOCASE); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_SIZE, + MEDIA_CONTENT_COLLATE_NOCASE); } - res = mp_media_info_list_create_w_filter(MP_TRACK_ALL, NULL, 0, filter, out_list); + res = + mp_media_info_list_create_w_filter(MP_TRACK_ALL, NULL, 0, filter, + out_list); media_filter_destroy(filter); MP_CHECK_VAL(*out_list, -1); @@ -835,7 +972,8 @@ int mp_media_info_list_destroy(mp_media_list_h media_list) return 0; } -mp_media_info_h mp_media_info_list_nth_item(mp_media_list_h media_list, int index) +mp_media_info_h mp_media_info_list_nth_item(mp_media_list_h media_list, + int index) { MP_CHECK_NULL(media_list); MP_CHECK_NULL(index < media_list->count); @@ -849,7 +987,8 @@ int mp_media_infor_list_get_count(mp_media_list_h media_list) return media_list->count; } -int mp_media_info_create(mp_media_info_h *media_info, const char *media_id) +int mp_media_info_create(mp_media_info_h * media_info, + const char *media_id) { int res = MEDIA_CONTENT_ERROR_NONE; *media_info = calloc(1, sizeof(struct mp_media_info_s)); @@ -869,7 +1008,9 @@ int mp_media_info_create(mp_media_info_h *media_info, const char *media_id) return res; } - res = media_info_get_audio((*media_info)->h.media, &(*media_info)->s.meta); + res = + media_info_get_audio((*media_info)->h.media, + &(*media_info)->s.meta); if (res != MEDIA_CONTENT_ERROR_NONE) { SAFE_FREE((*media_info)->i.minfo); SAFE_FREE(*media_info); @@ -879,11 +1020,12 @@ int mp_media_info_create(mp_media_info_h *media_info, const char *media_id) return res; } -int mp_media_info_create_by_path(mp_media_info_h *media_info, const char *file_path) +int mp_media_info_create_by_path(mp_media_info_h * media_info, + const char *file_path) { int res = MEDIA_CONTENT_ERROR_NONE; mp_filter_h filter = NULL; - char sql[MAX_NAM_LEN] = {0,}; + char sql[MAX_NAM_LEN] = { 0, }; char *cond = NULL; mp_media_list_h list = NULL; @@ -897,7 +1039,9 @@ int mp_media_info_create_by_path(mp_media_info_h *media_info, const char *file_p media_filter_set_offset(filter, 0, 1); - res = mp_media_info_list_create_w_filter(MP_TRACK_ALL, NULL, 0, filter, &list); + res = + mp_media_info_list_create_w_filter(MP_TRACK_ALL, NULL, 0, filter, + &list); media_filter_destroy(filter); MP_CHECK_VAL(res == MEDIA_CONTENT_ERROR_NONE, res); MP_CHECK_VAL(list, -1); @@ -954,7 +1098,7 @@ bool mp_media_info_uri_is_exist_in_db(const char *file_path) startfunc; int res = MEDIA_CONTENT_ERROR_NONE; mp_filter_h filter = NULL; - char sql[MAX_NAM_LEN] = {0,}; + char sql[MAX_NAM_LEN] = { 0, }; char *cond = NULL; bool exist = false; int count = 0; @@ -988,7 +1132,9 @@ int mp_media_info_get_media_id(mp_media_info_h media, char **media_id) int res = MEDIA_CONTENT_ERROR_NONE; if (!media->i.minfo->media_id) { - res = media_info_get_media_id(media->h.media, &media->i.minfo->media_id); + res = + media_info_get_media_id(media->h.media, + &media->i.minfo->media_id); if (res != MEDIA_CONTENT_ERROR_NONE) { ERROR_TRACE("Error code 0x%x", res); } @@ -1006,7 +1152,9 @@ int mp_media_info_get_file_path(mp_media_info_h media, char **path) int res = MEDIA_CONTENT_ERROR_NONE; if (!media->i.minfo->file_path) { - res = media_info_get_file_path(media->h.media, &media->i.minfo->file_path); + res = + media_info_get_file_path(media->h.media, + &media->i.minfo->file_path); if (res != MEDIA_CONTENT_ERROR_NONE) { ERROR_TRACE("Error code 0x%x", res); } @@ -1015,6 +1163,7 @@ int mp_media_info_get_file_path(mp_media_info_h media, char **path) PRINT_STR(*path); return res; } + int mp_media_info_get_thumbnail_path(mp_media_info_h media, char **path) { MP_CHECK_VAL(media, -1); @@ -1024,12 +1173,16 @@ int mp_media_info_get_thumbnail_path(mp_media_info_h media, char **path) if (media->i.minfo->thumbnail_path) { IF_FREE(media->i.minfo->thumbnail_path); } - res = __mp_media_info_get_thumbnail_path(media->h.media, &media->i.minfo->thumbnail_path); + res = + __mp_media_info_get_thumbnail_path(media->h.media, + &media->i.minfo-> + thumbnail_path); *path = media->i.minfo->thumbnail_path; PRINT_STR(*path); return res; } -int mp_media_info_get_favorite(mp_media_info_h media, bool *favorite) + +int mp_media_info_get_favorite(mp_media_info_h media, bool * favorite) { MP_CHECK_VAL(media, -1); @@ -1040,7 +1193,7 @@ int mp_media_info_get_favorite(mp_media_info_h media, bool *favorite) return res; } -int mp_media_info_is_drm(mp_media_info_h media, bool *drm) +int mp_media_info_is_drm(mp_media_info_h media, bool * drm) { MP_CHECK_VAL(media, -1); int res = media_info_is_drm(media->h.media, drm); @@ -1072,14 +1225,17 @@ int mp_media_info_get_media_type(mp_media_info_h media, int *media_type) return res; } -int mp_media_info_get_display_name(mp_media_info_h media, char **display_name) +int mp_media_info_get_display_name(mp_media_info_h media, + char **display_name) { MP_CHECK_VAL(media, -1); MP_CHECK_VAL(media->i.minfo, -1); int res = MEDIA_CONTENT_ERROR_NONE; if (!media->i.minfo->display_name) { - res = media_info_get_display_name(media->h.media, &media->i.minfo->display_name); + res = + media_info_get_display_name(media->h.media, + &media->i.minfo->display_name); if (res != MEDIA_CONTENT_ERROR_NONE) { ERROR_TRACE("Error code 0x%x", res); } @@ -1106,6 +1262,7 @@ int mp_media_info_get_title(mp_media_info_h media, char **title) PRINT_STR(*title); return res; } + int mp_media_info_get_album(mp_media_info_h media, char **album) { int res = MEDIA_CONTENT_ERROR_NONE; @@ -1123,6 +1280,7 @@ int mp_media_info_get_album(mp_media_info_h media, char **album) PRINT_STR(*album); return res; } + int mp_media_info_get_artist(mp_media_info_h media, char **artist) { int res = MEDIA_CONTENT_ERROR_NONE; @@ -1131,7 +1289,8 @@ int mp_media_info_get_artist(mp_media_info_h media, char **artist) MP_CHECK_VAL(media->i.minfo, -1); if (!media->i.minfo->artist) { - res = audio_meta_get_artist(media->s.meta, &media->i.minfo->artist); + res = + audio_meta_get_artist(media->s.meta, &media->i.minfo->artist); if (res != MEDIA_CONTENT_ERROR_NONE) { ERROR_TRACE("Error code 0x%x", res); } @@ -1149,7 +1308,9 @@ int mp_media_info_get_recorded_date(mp_media_info_h media, char **date) MP_CHECK_VAL(media->i.minfo, -1); if (!media->i.minfo->date) { - res = audio_meta_get_recorded_date(media->s.meta, &media->i.minfo->date); + res = + audio_meta_get_recorded_date(media->s.meta, + &media->i.minfo->date); if (res != MEDIA_CONTENT_ERROR_NONE) { ERROR_TRACE("Error code 0x%x", res); } @@ -1181,11 +1342,12 @@ int mp_media_info_get_genre(mp_media_info_h media, char **genre) PRINT_STR(*genre); return res; } + int mp_media_playlist_get_playlist_count_from_db() { mp_filter_h filter = NULL; int res = media_filter_create(&filter); - ERROR_TRACE("media filter %d" , res); + ERROR_TRACE("media filter %d", res); int count = 0; res = media_playlist_get_playlist_count_from_db(filter, &count); if (res == 0) { @@ -1195,6 +1357,7 @@ int mp_media_playlist_get_playlist_count_from_db() ERROR_TRACE("%d the count is", count); return count; } + int mp_media_info_get_composer(mp_media_info_h media, char **composer) { int res = MEDIA_CONTENT_ERROR_NONE; @@ -1203,7 +1366,9 @@ int mp_media_info_get_composer(mp_media_info_h media, char **composer) MP_CHECK_VAL(media->i.minfo, -1); if (!media->i.minfo->composer) { - res = audio_meta_get_composer(media->s.meta, &media->i.minfo->composer); + res = + audio_meta_get_composer(media->s.meta, + &media->i.minfo->composer); if (res != MEDIA_CONTENT_ERROR_NONE) { ERROR_TRACE("Error code 0x%x", res); } @@ -1212,6 +1377,7 @@ int mp_media_info_get_composer(mp_media_info_h media, char **composer) PRINT_STR(*composer); return res; } + int mp_media_info_get_year(mp_media_info_h media, char **year) { int res = MEDIA_CONTENT_ERROR_NONE; @@ -1237,6 +1403,7 @@ int mp_media_info_get_year(mp_media_info_h media, char **year) } return res; } + int mp_media_info_get_copyright(mp_media_info_h media, char **copyright) { int res = MEDIA_CONTENT_ERROR_NONE; @@ -1245,7 +1412,9 @@ int mp_media_info_get_copyright(mp_media_info_h media, char **copyright) MP_CHECK_VAL(media->i.minfo, -1); if (!media->i.minfo->copyright) { - res = audio_meta_get_copyright(media->s.meta, &media->i.minfo->copyright); + res = + audio_meta_get_copyright(media->s.meta, + &media->i.minfo->copyright); if (res != MEDIA_CONTENT_ERROR_NONE) { ERROR_TRACE("Error code 0x%x", res); } @@ -1263,7 +1432,9 @@ int mp_media_info_get_track_num(mp_media_info_h media, char **track_num) MP_CHECK_VAL(media->i.minfo, -1); if (!media->i.minfo->track_num) { - res = audio_meta_get_track_num(media->s.meta, &media->i.minfo->track_num); + res = + audio_meta_get_track_num(media->s.meta, + &media->i.minfo->track_num); if (res != MEDIA_CONTENT_ERROR_NONE) { ERROR_TRACE("Error code 0x%x", res); } @@ -1298,7 +1469,9 @@ int mp_media_info_get_format(mp_media_info_h media, char **format) ERROR_TRACE("Error code 0x%x", res); } - media->i.minfo->format = g_strdup_printf("%dKbps %.1fKHz %dch", bit_rate / 1000, sample_rate / 1000.0, channel); + media->i.minfo->format = + g_strdup_printf("%dKbps %.1fKHz %dch", bit_rate / 1000, + sample_rate / 1000.0, channel); } *format = media->i.minfo->format; PRINT_STR(*format); @@ -1318,7 +1491,8 @@ int mp_media_info_get_bit_rate(mp_media_info_h media, int *bitrate) return res; } -int mp_media_info_get_bitpersample(mp_media_info_h media, int *bitpersample) +int mp_media_info_get_bitpersample(mp_media_info_h media, + int *bitpersample) { int res = MEDIA_CONTENT_ERROR_NONE; MP_CHECK_VAL(media, -1); @@ -1329,7 +1503,7 @@ int mp_media_info_get_bitpersample(mp_media_info_h media, int *bitpersample) if (res != MEDIA_CONTENT_ERROR_NONE) { ERROR_TRACE("Error code 0x%x", res); } - if (*bitpersample == 0) { //get 0 except wav/flac, show 16 + if (*bitpersample == 0) { //get 0 except wav/flac, show 16 *bitpersample = 16; } return res; @@ -1347,6 +1521,7 @@ int mp_media_info_get_sample_rate(mp_media_info_h media, int *sample_rate) } return res; } + int mp_media_info_get_duration(mp_media_info_h media, int *duration) { int res = MEDIA_CONTENT_ERROR_NONE; @@ -1365,7 +1540,7 @@ int mp_media_info_get_duration(mp_media_info_h media, int *duration) return res; } -int mp_media_info_get_played_time(mp_media_info_h media, time_t *time) +int mp_media_info_get_played_time(mp_media_info_h media, time_t * time) { int res = MEDIA_CONTENT_ERROR_NONE; MP_CHECK_VAL(media, -1); @@ -1391,7 +1566,7 @@ int mp_media_info_get_played_count(mp_media_info_h media, int *count) return res; } -int mp_media_info_get_added_time(mp_media_info_h media, time_t *time) +int mp_media_info_get_added_time(mp_media_info_h media, time_t * time) { int res = MEDIA_CONTENT_ERROR_NONE; MP_CHECK_VAL(media, -1); @@ -1406,7 +1581,8 @@ int mp_media_info_get_added_time(mp_media_info_h media, time_t *time) return res; } -int mp_media_info_get_playlist_member_id(mp_media_info_h media, int *member_id) +int mp_media_info_get_playlist_member_id(mp_media_info_h media, + int *member_id) { int res = MEDIA_CONTENT_ERROR_NONE; MP_CHECK_VAL(media, -1); @@ -1416,7 +1592,8 @@ int mp_media_info_get_playlist_member_id(mp_media_info_h media, int *member_id) return res; } -int mp_media_info_get_storage_type(mp_media_info_h media, mp_storage_type_e *storage_type) +int mp_media_info_get_storage_type(mp_media_info_h media, + mp_storage_type_e * storage_type) { int res = MEDIA_CONTENT_ERROR_NONE; @@ -1427,7 +1604,8 @@ int mp_media_info_get_storage_type(mp_media_info_h media, mp_storage_type_e *sto return res; } -int mp_media_info_set_favorite_media_db_only(mp_media_info_h media, bool favorite) +int mp_media_info_set_favorite_media_db_only(mp_media_info_h media, + bool favorite) { int res = MEDIA_CONTENT_ERROR_NONE; MP_CHECK_VAL(media, -1); @@ -1474,6 +1652,7 @@ int mp_media_info_set_played_time(mp_media_info_h media, time_t time) } return res; } + int mp_media_info_set_played_count(mp_media_info_h media, int count) { int res = MEDIA_CONTENT_ERROR_NONE; @@ -1510,18 +1689,23 @@ int mp_media_info_set_added_time(mp_media_info_h media, time_t time) return res; } -int mp_media_info_group_list_count(mp_group_type_e group_type, const char *type_string, const char *filter_string, int *count) +int mp_media_info_group_list_count(mp_group_type_e group_type, + const char *type_string, + const char *filter_string, int *count) { mp_filter_h filter = NULL; int res = MEDIA_CONTENT_ERROR_NONE; res = media_filter_create(&filter); MP_CHECK_VAL(res == MEDIA_CONTENT_ERROR_NONE, res); - DEBUG_TRACE("group_type: %d, type_string:%s, filter_string:%s", group_type, type_string, filter_string); + DEBUG_TRACE("group_type: %d, type_string:%s, filter_string:%s", + group_type, type_string, filter_string); - __mp_media_info_set_group_filter(filter, group_type, type_string, filter_string); + __mp_media_info_set_group_filter(filter, group_type, type_string, + filter_string); - res = mp_media_info_group_list_count_w_filter(group_type, filter, count); + res = + mp_media_info_group_list_count_w_filter(group_type, filter, count); if (res != MEDIA_CONTENT_ERROR_NONE) { media_filter_destroy(filter); return res; @@ -1531,7 +1715,9 @@ int mp_media_info_group_list_count(mp_group_type_e group_type, const char *type_ return res; } -int mp_media_info_group_list_count_w_filter(mp_group_type_e group_type, mp_filter_h filter, int *count) + +int mp_media_info_group_list_count_w_filter(mp_group_type_e group_type, + mp_filter_h filter, int *count) { int res = MEDIA_CONTENT_ERROR_NONE; MP_CHECK_VAL(filter, -1); @@ -1541,19 +1727,31 @@ int mp_media_info_group_list_count_w_filter(mp_group_type_e group_type, mp_filte res = media_album_get_album_count_from_db(filter, count); break; case MP_GROUP_BY_ARTIST: - res = media_group_get_group_count_from_db(filter, MEDIA_CONTENT_GROUP_ARTIST, count); + res = + media_group_get_group_count_from_db(filter, + MEDIA_CONTENT_GROUP_ARTIST, + count); break; case MP_GROUP_BY_GENRE: - res = media_group_get_group_count_from_db(filter, MEDIA_CONTENT_GROUP_GENRE, count); + res = + media_group_get_group_count_from_db(filter, + MEDIA_CONTENT_GROUP_GENRE, + count); break; case MP_GROUP_BY_FOLDER: res = media_folder_get_folder_count_from_db(filter, count); break; case MP_GROUP_BY_YEAR: - res = media_group_get_group_count_from_db(filter, MEDIA_CONTENT_GROUP_YEAR, count); + res = + media_group_get_group_count_from_db(filter, + MEDIA_CONTENT_GROUP_YEAR, + count); break; case MP_GROUP_BY_COMPOSER: - res = media_group_get_group_count_from_db(filter, MEDIA_CONTENT_GROUP_COMPOSER, count); + res = + media_group_get_group_count_from_db(filter, + MEDIA_CONTENT_GROUP_COMPOSER, + count); break; case MP_GROUP_BY_PLAYLIST: res = media_playlist_get_playlist_count_from_db(filter, count); @@ -1571,16 +1769,17 @@ int mp_media_info_group_list_count_w_filter(mp_group_type_e group_type, mp_filte } typedef struct { - char *info; //album, artist, folder name - char *album; //album name for artist list - int count; //track_count - char *thumb_path; //thumbnail of first track - char **album_thumnails; //thumbnail list of albums - int thumb_count; //album thumbnail count - int track_num; //tracknumber for album + char *info; //album, artist, folder name + char *album; //album name for artist list + int count; //track_count + char *thumb_path; //thumbnail of first track + char **album_thumnails; //thumbnail list of albums + int thumb_count; //album thumbnail count + int track_num; //tracknumber for album } MpCountData_t; -static inline bool _folder_track_foreach_cb(media_info_h media, void *user_data) +static inline bool _folder_track_foreach_cb(media_info_h media, + void *user_data) { char *path = NULL; char *folder = NULL; @@ -1608,7 +1807,7 @@ static inline bool _folder_track_foreach_cb(media_info_h media, void *user_data) *list = g_list_last(*list); data = (*list)->data; - if (!g_strcmp0(data->info, folder)) { + if (!g_strcmp0(data->info, folder)) { IF_FREE(folder); data->count++; } else { @@ -1627,7 +1826,8 @@ static inline bool _folder_track_foreach_cb(media_info_h media, void *user_data) return true; } -static inline bool _album_track_foreach_cb(media_info_h media, void *user_data) +static inline bool _album_track_foreach_cb(media_info_h media, + void *user_data) { char *album = NULL; MpCountData_t *data = NULL; @@ -1637,25 +1837,25 @@ static inline bool _album_track_foreach_cb(media_info_h media, void *user_data) audio_meta_h audio; res = media_info_get_audio(media, &audio); - if (res != MEDIA_CONTENT_ERROR_NONE) { + if (res != MEDIA_CONTENT_ERROR_NONE) { audio_meta_destroy(audio); IF_FREE(album); return false; } res = audio_meta_get_album(audio, &album); - if (res != MEDIA_CONTENT_ERROR_NONE) { + if (res != MEDIA_CONTENT_ERROR_NONE) { audio_meta_destroy(audio); IF_FREE(album); return false; } res = audio_meta_get_track_num(audio, &track_num); - if (res != MEDIA_CONTENT_ERROR_NONE) { + if (res != MEDIA_CONTENT_ERROR_NONE) { audio_meta_destroy(audio); IF_FREE(album); IF_FREE(track_num) - return false; + return false; } GList **list = user_data; @@ -1691,7 +1891,7 @@ static inline bool _album_track_foreach_cb(media_info_h media, void *user_data) audio_meta_destroy(audio); return EINA_TRUE; } - if (!g_strcmp0(data->info, album)) { + if (!g_strcmp0(data->info, album)) { data->count++; IF_FREE(album); int track = 0; @@ -1699,7 +1899,8 @@ static inline bool _album_track_foreach_cb(media_info_h media, void *user_data) track = atoi(track_num); if (track < data->track_num) { IF_FREE(data->thumb_path); - __mp_media_info_get_thumbnail_path(media, &data->thumb_path); + __mp_media_info_get_thumbnail_path(media, + &data->thumb_path); } free(track_num); } @@ -1732,7 +1933,8 @@ static inline bool _album_track_foreach_cb(media_info_h media, void *user_data) return true; } -static inline bool _artist_track_foreach_cb(media_info_h media, void *user_data) +static inline bool _artist_track_foreach_cb(media_info_h media, + void *user_data) { char *album = NULL, *artist = NULL; MpCountData_t *data = NULL; @@ -1741,20 +1943,20 @@ static inline bool _artist_track_foreach_cb(media_info_h media, void *user_data) audio_meta_h audio; res = media_info_get_audio(media, &audio); - if (res != MEDIA_CONTENT_ERROR_NONE) { + if (res != MEDIA_CONTENT_ERROR_NONE) { audio_meta_destroy(audio); return false; } res = audio_meta_get_album(audio, &album); - if (res != MEDIA_CONTENT_ERROR_NONE) { + if (res != MEDIA_CONTENT_ERROR_NONE) { audio_meta_destroy(audio); IF_FREE(album); return false; } res = audio_meta_get_artist(audio, &artist); - if (res != MEDIA_CONTENT_ERROR_NONE) { + if (res != MEDIA_CONTENT_ERROR_NONE) { audio_meta_destroy(audio); IF_FREE(artist); IF_FREE(album); @@ -1779,7 +1981,10 @@ static inline bool _artist_track_foreach_cb(media_info_h media, void *user_data) data->info = strdup(artist); data->album = strdup(album); data->album_thumnails = calloc(1, sizeof(char *)); - __mp_media_info_get_thumbnail_path(media, &(data->album_thumnails[data->thumb_count])); + __mp_media_info_get_thumbnail_path(media, + &(data-> + album_thumnails[data-> + thumb_count])); data->thumb_count++; data->count++; @@ -1799,15 +2004,20 @@ static inline bool _artist_track_foreach_cb(media_info_h media, void *user_data) audio_meta_destroy(audio); return EINA_TRUE; } - if (!g_strcmp0(data->info, artist)) { + if (!g_strcmp0(data->info, artist)) { data->count++; if (g_strcmp0(data->album, album)) { if (data->album != NULL) { free(data->album); } data->album = strdup(album); - data->album_thumnails = realloc(data->album_thumnails, sizeof(char *) * (data->thumb_count + 1)); - __mp_media_info_get_thumbnail_path(media, &(data->album_thumnails[data->thumb_count])); + data->album_thumnails = + realloc(data->album_thumnails, + sizeof(char *) * (data->thumb_count + 1)); + __mp_media_info_get_thumbnail_path(media, + &(data-> + album_thumnails[data-> + thumb_count])); data->thumb_count++; IF_FREE(album); } else { @@ -1832,7 +2042,10 @@ static inline bool _artist_track_foreach_cb(media_info_h media, void *user_data) data->info = strdup(artist); data->album = strdup(album); data->album_thumnails = calloc(1, sizeof(char *)); - __mp_media_info_get_thumbnail_path(media, &(data->album_thumnails[data->thumb_count])); + __mp_media_info_get_thumbnail_path(media, + &(data-> + album_thumnails[data-> + thumb_count])); data->thumb_count++; data->count++; @@ -1846,10 +2059,13 @@ static inline bool _artist_track_foreach_cb(media_info_h media, void *user_data) } static void -_mp_media_info_set_group_extra_info(mp_media_list_h media_list, mp_group_type_e group_type, const char *type_string, const char *filter_string) +_mp_media_info_set_group_extra_info(mp_media_list_h media_list, + mp_group_type_e group_type, + const char *type_string, + const char *filter_string) { mp_filter_h filter = NULL; - char cond[MAX_FILTER_LEN] = {0,}; + char cond[MAX_FILTER_LEN] = { 0, }; GList *list = NULL; GList *node = NULL; @@ -1865,17 +2081,22 @@ _mp_media_info_set_group_extra_info(mp_media_list_h media_list, mp_group_type_e //create track list switch (group_type) { case MP_GROUP_BY_ALBUM: - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_ALBUM, MEDIA_CONTENT_COLLATE_NOCASE); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, + MEDIA_ALBUM, MEDIA_CONTENT_COLLATE_NOCASE); media_foreach_cb = _album_track_foreach_cb; break; case MP_GROUP_BY_ARTIST: - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, "MEDIA_ARTIST, MEDIA_ALBUM", MEDIA_CONTENT_COLLATE_NOCASE); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, + "MEDIA_ARTIST, MEDIA_ALBUM", + MEDIA_CONTENT_COLLATE_NOCASE); media_foreach_cb = _artist_track_foreach_cb; break; case MP_GROUP_BY_GENRE: break; case MP_GROUP_BY_FOLDER: - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, "folder_uuid", MEDIA_CONTENT_COLLATE_NOCASE); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, + "folder_uuid", + MEDIA_CONTENT_COLLATE_NOCASE); media_foreach_cb = _folder_track_foreach_cb; break; default: @@ -1884,7 +2105,8 @@ _mp_media_info_set_group_extra_info(mp_media_list_h media_list, mp_group_type_e return; } media_filter_set_condition(filter, cond, MEDIA_CONTENT_COLLATE_NOCASE); - res = media_info_foreach_media_from_db(filter, media_foreach_cb, &list); + res = + media_info_foreach_media_from_db(filter, media_foreach_cb, &list); media_filter_destroy(filter); MP_CHECK(res == MEDIA_CONTENT_ERROR_NONE); @@ -1912,10 +2134,12 @@ _mp_media_info_set_group_extra_info(mp_media_list_h media_list, mp_group_type_e if (data->thumb_path) { media->i.ginfo->thumb_path = data->thumb_path; } else if (data->album_thumnails && data->thumb_count) { - media->i.ginfo->thumb_path = g_strdup(data->album_thumnails[0]); + media->i.ginfo->thumb_path = + g_strdup(data->album_thumnails[0]); } - media->i.ginfo->album_thumb_paths = data->album_thumnails; + media->i.ginfo->album_thumb_paths = + data->album_thumnails; media->i.ginfo->album_count = data->thumb_count; IF_FREE(data->info); @@ -1955,13 +2179,21 @@ _mp_media_info_set_group_extra_info(mp_media_list_h media_list, mp_group_type_e } static int -_mp_media_info_set_extra_info(mp_media_list_h media_list, mp_group_type_e group_type, const char *type_string, const char *filter_string) +_mp_media_info_set_extra_info(mp_media_list_h media_list, + mp_group_type_e group_type, + const char *type_string, + const char *filter_string) { - _mp_media_info_set_group_extra_info(media_list, group_type, type_string, filter_string); + _mp_media_info_set_group_extra_info(media_list, group_type, + type_string, filter_string); return 0; } -int mp_media_info_group_list_create(mp_media_list_h *media_list, mp_group_type_e group_type, const char *type_string, const char *filter_string, int offset, int count) +int mp_media_info_group_list_create(mp_media_list_h * media_list, + mp_group_type_e group_type, + const char *type_string, + const char *filter_string, int offset, + int count) { mp_filter_h filter = NULL; int res = MEDIA_CONTENT_ERROR_NONE; @@ -1971,13 +2203,17 @@ int mp_media_info_group_list_create(mp_media_list_h *media_list, mp_group_type_e MP_CHECK_VAL(res == MEDIA_CONTENT_ERROR_NONE, res); media_filter_set_offset(filter, offset, count); - __mp_media_info_set_group_filter(filter, group_type, type_string, filter_string); + __mp_media_info_set_group_filter(filter, group_type, type_string, + filter_string); - res = mp_media_info_group_list_create_w_filter(filter, group_type, media_list); + res = + mp_media_info_group_list_create_w_filter(filter, group_type, + media_list); media_filter_destroy(filter); MP_CHECK_VAL(res == MEDIA_CONTENT_ERROR_NONE, res); - _mp_media_info_set_extra_info(*media_list, group_type, type_string, filter_string); + _mp_media_info_set_extra_info(*media_list, group_type, type_string, + filter_string); } else { int i; @@ -1986,11 +2222,11 @@ int mp_media_info_group_list_create(mp_media_list_h *media_list, mp_group_type_e MP_CHECK_VAL(*media_list, -1); (*media_list)->group_type = group_type; - char names[][50] = - { STR_MP_FAVOURITES, STR_MP_RECENTLY_ADDED, STR_MP_MOST_PLAYED, STR_MP_RECENTLY_PLAYED}; + char names[][50] = { STR_MP_FAVOURITES, STR_MP_RECENTLY_ADDED, STR_MP_MOST_PLAYED, + STR_MP_RECENTLY_PLAYED }; - char thumb[][4096] = - { THUMBNAIL_QUICK_LIST, THUMBNAIL_RECENTLY_ADDED, THUMBNAIL_MOST_PLAYED, THUMBNAIL_RECENTLY_PLAYED}; + char thumb[][4096] = { THUMBNAIL_QUICK_LIST, THUMBNAIL_RECENTLY_ADDED, + THUMBNAIL_MOST_PLAYED, THUMBNAIL_RECENTLY_PLAYED }; for (i = 0; i < 4; i++) { media_info = calloc(1, sizeof(struct mp_media_info_s)); @@ -2005,7 +2241,8 @@ int mp_media_info_group_list_create(mp_media_list_h *media_list, mp_group_type_e media_info->i.ginfo->main_info = g_strdup(names[i]); media_info->i.ginfo->thumb_path = g_strdup(thumb[i]); media_info->s.group_type = group_type; - (*media_list)->list = g_list_append((*media_list)->list, media_info); + (*media_list)->list = + g_list_append((*media_list)->list, media_info); } (*media_list)->count = g_list_length((*media_list)->list); @@ -2013,7 +2250,9 @@ int mp_media_info_group_list_create(mp_media_list_h *media_list, mp_group_type_e return res; } -int mp_media_info_group_list_create_w_filter(mp_filter_h filter, mp_group_type_e group_type, mp_media_list_h *media_list) +int mp_media_info_group_list_create_w_filter(mp_filter_h filter, + mp_group_type_e group_type, + mp_media_list_h * media_list) { MP_CHECK_VAL(media_list, -1); @@ -2025,25 +2264,49 @@ int mp_media_info_group_list_create_w_filter(mp_filter_h filter, mp_group_type_e switch (group_type) { case MP_GROUP_BY_ALBUM: case MP_GROUP_BY_ARTIST_ALBUM: - res = media_album_foreach_album_from_db(filter, __mp_media_album_cb, *media_list); + res = + media_album_foreach_album_from_db(filter, __mp_media_album_cb, + *media_list); break; case MP_GROUP_BY_ARTIST: - res = media_group_foreach_group_from_db(filter, MEDIA_CONTENT_GROUP_ARTIST, __mp_media_group_cb, *media_list); + res = + media_group_foreach_group_from_db(filter, + MEDIA_CONTENT_GROUP_ARTIST, + __mp_media_group_cb, + *media_list); break; case MP_GROUP_BY_GENRE: - res = media_group_foreach_group_from_db(filter, MEDIA_CONTENT_GROUP_GENRE, __mp_media_group_cb, *media_list); + res = + media_group_foreach_group_from_db(filter, + MEDIA_CONTENT_GROUP_GENRE, + __mp_media_group_cb, + *media_list); break; case MP_GROUP_BY_FOLDER: - res = media_folder_foreach_folder_from_db(filter, __mp_media_folder_cb, *media_list); + res = + media_folder_foreach_folder_from_db(filter, + __mp_media_folder_cb, + *media_list); break; case MP_GROUP_BY_YEAR: - res = media_group_foreach_group_from_db(filter, MEDIA_CONTENT_GROUP_YEAR, __mp_media_group_cb, *media_list); + res = + media_group_foreach_group_from_db(filter, + MEDIA_CONTENT_GROUP_YEAR, + __mp_media_group_cb, + *media_list); break; case MP_GROUP_BY_COMPOSER: - res = media_group_foreach_group_from_db(filter, MEDIA_CONTENT_GROUP_COMPOSER, __mp_media_group_cb, *media_list); + res = + media_group_foreach_group_from_db(filter, + MEDIA_CONTENT_GROUP_COMPOSER, + __mp_media_group_cb, + *media_list); break; case MP_GROUP_BY_PLAYLIST: - res = media_playlist_foreach_playlist_from_db(filter, __mp_media_playlist_cb, *media_list); + res = + media_playlist_foreach_playlist_from_db(filter, + __mp_media_playlist_cb, + *media_list); break; default: WARN_TRACE("Unhandled type: %d", group_type); @@ -2070,7 +2333,9 @@ int mp_media_info_group_list_destroy(mp_media_list_h media_list) free(media_list); return 0; } -mp_media_info_h mp_media_info_group_list_nth_item(mp_media_list_h media_list, int index) + +mp_media_info_h mp_media_info_group_list_nth_item(mp_media_list_h + media_list, int index) { MP_CHECK_NULL(media_list); MP_CHECK_NULL(index < media_list->count); @@ -2079,7 +2344,8 @@ mp_media_info_h mp_media_info_group_list_nth_item(mp_media_list_h media_list, in } -int mp_media_info_group_get_type(mp_media_info_h media, mp_group_type_e *group_type) +int mp_media_info_group_get_type(mp_media_info_h media, + mp_group_type_e * group_type) { MP_CHECK_VAL(media, -1); MP_CHECK_VAL(group_type, -1); @@ -2088,20 +2354,29 @@ int mp_media_info_group_get_type(mp_media_info_h media, mp_group_type_e *group_t return MEDIA_CONTENT_ERROR_NONE; } -int mp_media_info_group_get_main_info(mp_media_info_h media, char **main_info) +int mp_media_info_group_get_main_info(mp_media_info_h media, + char **main_info) { int res = MEDIA_CONTENT_ERROR_NONE; MP_CHECK_VAL(main_info, -1); MP_CHECK_VAL(media, -1); MP_CHECK_VAL(media->i.ginfo, -1); - if (!media->i.ginfo->main_info && media->s.group_type != MP_GROUP_BY_SYS_PLAYLIST) { + if (!media->i.ginfo->main_info + && media->s.group_type != MP_GROUP_BY_SYS_PLAYLIST) { if (media->s.group_type == MP_GROUP_BY_FOLDER) { - res = media_folder_get_name(media->h.group, &media->i.ginfo->main_info); - } else if (media->s.group_type == MP_GROUP_BY_ALBUM || media->s.group_type == MP_GROUP_BY_ARTIST_ALBUM) { - res = media_album_get_name(media->h.group, &media->i.ginfo->main_info); + res = + media_folder_get_name(media->h.group, + &media->i.ginfo->main_info); + } else if (media->s.group_type == MP_GROUP_BY_ALBUM + || media->s.group_type == MP_GROUP_BY_ARTIST_ALBUM) { + res = + media_album_get_name(media->h.group, + &media->i.ginfo->main_info); } else if (media->s.group_type == MP_GROUP_BY_PLAYLIST) { - res = media_playlist_get_name(media->h.group, &media->i.ginfo->main_info); + res = + media_playlist_get_name(media->h.group, + &media->i.ginfo->main_info); } else { media->i.ginfo->main_info = g_strdup(media->h.group); } @@ -2111,18 +2386,25 @@ int mp_media_info_group_get_main_info(mp_media_info_h media, char **main_info) return res; } -int mp_media_info_group_get_sub_info(mp_media_info_h media, char **sub_info) +int mp_media_info_group_get_sub_info(mp_media_info_h media, + char **sub_info) { int res = MEDIA_CONTENT_ERROR_NONE; MP_CHECK_VAL(sub_info, -1); MP_CHECK_VAL(media, -1); MP_CHECK_VAL(media->i.ginfo, -1); - if (!media->i.ginfo->sub_info && media->s.group_type != MP_GROUP_BY_SYS_PLAYLIST) { + if (!media->i.ginfo->sub_info + && media->s.group_type != MP_GROUP_BY_SYS_PLAYLIST) { if (media->s.group_type == MP_GROUP_BY_FOLDER) { - res = media_folder_get_path(media->h.group, &media->i.ginfo->sub_info); - } else if (media->s.group_type == MP_GROUP_BY_ALBUM || media->s.group_type == MP_GROUP_BY_ARTIST_ALBUM) { - res = media_album_get_artist(media->h.group, &media->i.ginfo->sub_info); + res = + media_folder_get_path(media->h.group, + &media->i.ginfo->sub_info); + } else if (media->s.group_type == MP_GROUP_BY_ALBUM + || media->s.group_type == MP_GROUP_BY_ARTIST_ALBUM) { + res = + media_album_get_artist(media->h.group, + &media->i.ginfo->sub_info); } } *sub_info = media->i.ginfo->sub_info; @@ -2130,16 +2412,20 @@ int mp_media_info_group_get_sub_info(mp_media_info_h media, char **sub_info) return res; } -int mp_media_info_group_get_playlist_id(mp_media_info_h media, int *playlist_id) +int mp_media_info_group_get_playlist_id(mp_media_info_h media, + int *playlist_id) { int res = MEDIA_CONTENT_ERROR_NONE; MP_CHECK_VAL(playlist_id, -1); MP_CHECK_VAL(media, -1); - MP_CHECK_VAL(media->s.group_type == MP_GROUP_BY_PLAYLIST || media->s.group_type == MP_GROUP_BY_SYS_PLAYLIST, -1); + MP_CHECK_VAL(media->s.group_type == MP_GROUP_BY_PLAYLIST + || media->s.group_type == MP_GROUP_BY_SYS_PLAYLIST, -1); if (media->s.group_type == MP_GROUP_BY_SYS_PLAYLIST) { - *playlist_id = mp_media_info_get_auto_playlist_id_by_name(media->i.ginfo->main_info); + *playlist_id = + mp_media_info_get_auto_playlist_id_by_name(media->i.ginfo-> + main_info); } else { res = media_playlist_get_playlist_id(media->h.group, playlist_id); } @@ -2147,7 +2433,8 @@ int mp_media_info_group_get_playlist_id(mp_media_info_h media, int *playlist_id) return res; } -int mp_media_info_group_get_folder_id(mp_media_info_h media, char **folder_id) +int mp_media_info_group_get_folder_id(mp_media_info_h media, + char **folder_id) { int res = MEDIA_CONTENT_ERROR_NONE; @@ -2160,7 +2447,8 @@ int mp_media_info_group_get_folder_id(mp_media_info_h media, char **folder_id) return res; } -int mp_media_info_group_get_thumbnail_path(mp_media_info_h media, char **path) +int mp_media_info_group_get_thumbnail_path(mp_media_info_h media, + char **path) { int res = MEDIA_CONTENT_ERROR_NONE; @@ -2174,7 +2462,7 @@ int mp_media_info_group_get_thumbnail_path(mp_media_info_h media, char **path) mp_media_list_h list = NULL; mp_media_info_h minfo = NULL; char *type_string = NULL; - char cond[MAX_FILTER_LEN] = {0,}; + char cond[MAX_FILTER_LEN] = { 0, }; int count = 0; mp_media_info_group_get_main_info(media, &type_string); @@ -2188,90 +2476,132 @@ int mp_media_info_group_get_thumbnail_path(mp_media_info_h media, char **path) strncat(cond, MP_MEDIA_TYPE, STRNCAT_LEN(cond)); if (media->s.group_type == MP_GROUP_BY_PLAYLIST) { - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, PLAYLIST_MEMBER_ORDER, MEDIA_CONTENT_COLLATE_NOCASE); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, + PLAYLIST_MEMBER_ORDER, + MEDIA_CONTENT_COLLATE_NOCASE); } else { - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_TITLE, MEDIA_CONTENT_COLLATE_NOCASE); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, + MEDIA_TITLE, + MEDIA_CONTENT_COLLATE_NOCASE); } - if (media->s.group_type == MP_GROUP_BY_ALBUM || media->s.group_type == MP_GROUP_BY_ARTIST_ALBUM) { + if (media->s.group_type == MP_GROUP_BY_ALBUM + || media->s.group_type == MP_GROUP_BY_ARTIST_ALBUM) { strncat(cond, " AND MEDIA_ALBUM='", STRNCAT_LEN(cond)); - _mp_media_info_sql_strncat(cond, type_string, STRNCAT_LEN(cond)); - strncat(cond, "' AND MEDIA_THUMBNAIL_PATH is not null", STRNCAT_LEN(cond)); - media_filter_set_condition(filter, cond, MEDIA_CONTENT_COLLATE_NOCASE); - - mp_media_info_list_count_w_filter(MP_TRACK_ALL, NULL, 0, filter, &count); + _mp_media_info_sql_strncat(cond, type_string, + STRNCAT_LEN(cond)); + strncat(cond, "' AND MEDIA_THUMBNAIL_PATH is not null", + STRNCAT_LEN(cond)); + media_filter_set_condition(filter, cond, + MEDIA_CONTENT_COLLATE_NOCASE); + + mp_media_info_list_count_w_filter(MP_TRACK_ALL, NULL, 0, + filter, &count); if (count > 0) { media_filter_set_offset(filter, 0, 1); - mp_media_info_list_create_w_filter(MP_TRACK_ALL, NULL, 0, filter, &list); + mp_media_info_list_create_w_filter(MP_TRACK_ALL, NULL, 0, + filter, &list); } - } else if (media->s.group_type == MP_GROUP_BY_ARTIST && type_string) { + } else if (media->s.group_type == MP_GROUP_BY_ARTIST + && type_string) { strncat(cond, " AND MEDIA_ARTIST='", STRNCAT_LEN(cond)); - _mp_media_info_sql_strncat(cond, type_string, STRNCAT_LEN(cond)); - strncat(cond, "' AND MEDIA_THUMBNAIL_PATH is not null", STRNCAT_LEN(cond)); - media_filter_set_condition(filter, cond, MEDIA_CONTENT_COLLATE_NOCASE); - - mp_media_info_list_count_w_filter(MP_TRACK_ALL, NULL, 0, filter, &count); + _mp_media_info_sql_strncat(cond, type_string, + STRNCAT_LEN(cond)); + strncat(cond, "' AND MEDIA_THUMBNAIL_PATH is not null", + STRNCAT_LEN(cond)); + media_filter_set_condition(filter, cond, + MEDIA_CONTENT_COLLATE_NOCASE); + + mp_media_info_list_count_w_filter(MP_TRACK_ALL, NULL, 0, + filter, &count); if (count > 0) { media_filter_set_offset(filter, 0, 1); - mp_media_info_list_create_w_filter(MP_TRACK_ALL, NULL, 0, filter, &list); + mp_media_info_list_create_w_filter(MP_TRACK_ALL, NULL, 0, + filter, &list); } } else if (media->s.group_type == MP_GROUP_BY_GENRE && type_string) { strncat(cond, " AND MEDIA_GENRE='", STRNCAT_LEN(cond)); - _mp_media_info_sql_strncat(cond, type_string, STRNCAT_LEN(cond)); - strncat(cond, "' AND MEDIA_THUMBNAIL_PATH is not NULL", STRNCAT_LEN(cond)); - media_filter_set_condition(filter, cond, MEDIA_CONTENT_COLLATE_NOCASE); - - mp_media_info_list_count_w_filter(MP_TRACK_ALL, NULL, 0, filter, &count); + _mp_media_info_sql_strncat(cond, type_string, + STRNCAT_LEN(cond)); + strncat(cond, "' AND MEDIA_THUMBNAIL_PATH is not NULL", + STRNCAT_LEN(cond)); + media_filter_set_condition(filter, cond, + MEDIA_CONTENT_COLLATE_NOCASE); + + mp_media_info_list_count_w_filter(MP_TRACK_ALL, NULL, 0, + filter, &count); if (count > 0) { media_filter_set_offset(filter, 0, 1); - mp_media_info_list_create_w_filter(MP_TRACK_ALL, NULL, 0, filter, &list); + mp_media_info_list_create_w_filter(MP_TRACK_ALL, NULL, 0, + filter, &list); } } else if (media->s.group_type == MP_GROUP_BY_FOLDER) { mp_media_info_group_get_folder_id(media, &folde_id); - strncat(cond, " AND MEDIA_THUMBNAIL_PATH is not NULL", STRNCAT_LEN(cond)); + strncat(cond, " AND MEDIA_THUMBNAIL_PATH is not NULL", + STRNCAT_LEN(cond)); - media_filter_set_condition(filter, cond, MEDIA_CONTENT_COLLATE_NOCASE); - mp_media_info_list_count_w_filter(MP_TRACK_BY_FOLDER, folde_id, 0, filter, &count); + media_filter_set_condition(filter, cond, + MEDIA_CONTENT_COLLATE_NOCASE); + mp_media_info_list_count_w_filter(MP_TRACK_BY_FOLDER, folde_id, + 0, filter, &count); if (count > 0) { media_filter_set_offset(filter, 0, 1); - mp_media_info_list_create_w_filter(MP_TRACK_BY_FOLDER, folde_id, 0, filter, &list); + mp_media_info_list_create_w_filter(MP_TRACK_BY_FOLDER, + folde_id, 0, filter, + &list); } } else if (media->s.group_type == MP_GROUP_BY_YEAR && type_string) { strncat(cond, " AND MEDIA_YEAR='", STRNCAT_LEN(cond)); - _mp_media_info_sql_strncat(cond, type_string, STRNCAT_LEN(cond)); - strncat(cond, "' AND MEDIA_THUMBNAIL_PATH is not NULL", STRNCAT_LEN(cond)); - media_filter_set_condition(filter, cond, MEDIA_CONTENT_COLLATE_NOCASE); - - mp_media_info_list_count_w_filter(MP_TRACK_ALL, NULL, 0, filter, &count); + _mp_media_info_sql_strncat(cond, type_string, + STRNCAT_LEN(cond)); + strncat(cond, "' AND MEDIA_THUMBNAIL_PATH is not NULL", + STRNCAT_LEN(cond)); + media_filter_set_condition(filter, cond, + MEDIA_CONTENT_COLLATE_NOCASE); + + mp_media_info_list_count_w_filter(MP_TRACK_ALL, NULL, 0, + filter, &count); if (count > 0) { media_filter_set_offset(filter, 0, 1); - mp_media_info_list_create_w_filter(MP_TRACK_ALL, NULL, 0, filter, &list); + mp_media_info_list_create_w_filter(MP_TRACK_ALL, NULL, 0, + filter, &list); } - } else if (media->s.group_type == MP_GROUP_BY_COMPOSER && type_string) { + } else if (media->s.group_type == MP_GROUP_BY_COMPOSER + && type_string) { strncat(cond, " AND MEDIA_COMPOSER='", STRNCAT_LEN(cond)); - _mp_media_info_sql_strncat(cond, type_string, STRNCAT_LEN(cond)); - strncat(cond, "' AND MEDIA_THUMBNAIL_PATH is not NULL", STRNCAT_LEN(cond)); - media_filter_set_condition(filter, cond, MEDIA_CONTENT_COLLATE_NOCASE); - - mp_media_info_list_count_w_filter(MP_TRACK_ALL, NULL, 0, filter, &count); + _mp_media_info_sql_strncat(cond, type_string, + STRNCAT_LEN(cond)); + strncat(cond, "' AND MEDIA_THUMBNAIL_PATH is not NULL", + STRNCAT_LEN(cond)); + media_filter_set_condition(filter, cond, + MEDIA_CONTENT_COLLATE_NOCASE); + + mp_media_info_list_count_w_filter(MP_TRACK_ALL, NULL, 0, + filter, &count); if (count > 0) { media_filter_set_offset(filter, 0, 1); - mp_media_info_list_create_w_filter(MP_TRACK_ALL, NULL, 0, filter, &list); + mp_media_info_list_create_w_filter(MP_TRACK_ALL, NULL, 0, + filter, &list); } } else if (media->s.group_type == MP_GROUP_BY_PLAYLIST) { int playlist_id = 0; mp_media_info_group_get_playlist_id(media, &playlist_id); - strncat(cond, " AND MEDIA_THUMBNAIL_PATH is not NULL", STRNCAT_LEN(cond)); + strncat(cond, " AND MEDIA_THUMBNAIL_PATH is not NULL", + STRNCAT_LEN(cond)); - media_filter_set_condition(filter, cond, MEDIA_CONTENT_COLLATE_NOCASE); - mp_media_info_list_count_w_filter(MP_TRACK_BY_PLAYLIST, NULL, playlist_id, filter, &count); + media_filter_set_condition(filter, cond, + MEDIA_CONTENT_COLLATE_NOCASE); + mp_media_info_list_count_w_filter(MP_TRACK_BY_PLAYLIST, NULL, + playlist_id, filter, &count); if (count > 0) { media_filter_set_offset(filter, 0, 1); - mp_media_info_list_create_w_filter(MP_TRACK_BY_PLAYLIST, NULL, playlist_id, filter, &list); + mp_media_info_list_create_w_filter(MP_TRACK_BY_PLAYLIST, + NULL, playlist_id, + filter, &list); } } else { WARN_TRACE("Unhandled type: %d", media->s.group_type); @@ -2293,7 +2623,7 @@ int mp_media_info_group_get_thumbnail_path(mp_media_info_h media, char **path) } media_filter_destroy(filter); } -END: + END: IF_FREE(folde_id); *path = media->i.ginfo->thumb_path; PRINT_STR(*path); @@ -2309,7 +2639,9 @@ int mp_media_info_group_get_track_count(mp_media_info_h media, int *count) return 0; } -int mp_media_info_group_get_album_thumnail_paths(mp_media_info_h media, char ***thumbs, int *count) +int mp_media_info_group_get_album_thumnail_paths(mp_media_info_h media, + char ***thumbs, + int *count) { MP_CHECK_VAL(media, -1); if (thumbs) { @@ -2321,9 +2653,10 @@ int mp_media_info_group_get_album_thumnail_paths(mp_media_info_h media, char *** return 0; } -int mp_media_info_playlist_get_thumbnail_path(mp_media_info_h media, char **path) +int mp_media_info_playlist_get_thumbnail_path(mp_media_info_h media, + char **path) { - /*currently, it only works for playlist thumbnail update*/ + /*currently, it only works for playlist thumbnail update */ int res = MEDIA_CONTENT_ERROR_NONE; MP_CHECK_VAL(path, -1); @@ -2335,9 +2668,10 @@ int mp_media_info_playlist_get_thumbnail_path(mp_media_info_h media, char **path return res; } -int mp_media_info_playlist_set_thumbnail_path(mp_media_info_h media, const char *path) +int mp_media_info_playlist_set_thumbnail_path(mp_media_info_h media, + const char *path) { - /*currently, it only works for playlist thumbnail update*/ + /*currently, it only works for playlist thumbnail update */ int res = MEDIA_CONTENT_ERROR_NONE; MP_CHECK_VAL(path, -1); @@ -2352,18 +2686,19 @@ int mp_media_info_playlist_set_thumbnail_path(mp_media_info_h media, const char media_playlist_update_to_db(media->h.group); - IF_FREE(media->i.ginfo->thumb_path) ; + IF_FREE(media->i.ginfo->thumb_path); media->i.ginfo->thumb_path = g_strdup(path); return res; } -int mp_media_info_playlist_get_id_by_name(const char *playlist_name, int *playlist_id) +int mp_media_info_playlist_get_id_by_name(const char *playlist_name, + int *playlist_id) { mp_filter_h filter = NULL; mp_media_list_h list; mp_media_info_h media; char *cond = NULL; - char sql[MAX_FILTER_LEN] = {0,}; + char sql[MAX_FILTER_LEN] = { 0, }; int res = MEDIA_CONTENT_ERROR_NONE; res = mp_media_filter_create(&filter); @@ -2375,7 +2710,9 @@ int mp_media_info_playlist_get_id_by_name(const char *playlist_name, int *playli media_filter_destroy(filter); return -1; } - res = mp_media_filter_set_condition(filter, cond, MP_MEDIA_CONTENT_COLLATE_DEFAULT); + res = + mp_media_filter_set_condition(filter, cond, + MP_MEDIA_CONTENT_COLLATE_DEFAULT); free(cond); if (res != 0) { media_filter_destroy(filter); @@ -2387,7 +2724,10 @@ int mp_media_info_playlist_get_id_by_name(const char *playlist_name, int *playli return res; } - res = mp_media_info_group_list_create_w_filter(filter, MP_GROUP_BY_PLAYLIST, &list); + res = + mp_media_info_group_list_create_w_filter(filter, + MP_GROUP_BY_PLAYLIST, + &list); mp_media_filter_destory(filter); MP_CHECK_VAL(res == 0, res); MP_CHECK_VAL(list, -1); @@ -2411,12 +2751,13 @@ int mp_media_info_playlist_delete_from_db(int playlist_id) return res; } -int mp_media_info_playlist_handle_create(mp_playlist_h *playlist_h, int playlist_id) +int mp_media_info_playlist_handle_create(mp_playlist_h * playlist_h, + int playlist_id) { int res = MEDIA_CONTENT_ERROR_NONE; media_playlist_h playlist = NULL; res = media_playlist_get_playlist_from_db(playlist_id, &playlist); - *playlist_h = (mp_playlist_h)playlist; + *playlist_h = (mp_playlist_h) playlist; return res; } @@ -2431,7 +2772,7 @@ int mp_media_info_playlist_add_media(int playlist_id, const char *media_id) return res; } - res = media_playlist_add_media(playlist, media_id); + res = media_playlist_add_media(playlist, media_id); if (res != 0) { media_playlist_destroy(playlist); return res; @@ -2448,32 +2789,38 @@ int mp_media_info_playlist_add_media(int playlist_id, const char *media_id) return res; } -int mp_media_info_playlist_remove_media(mp_media_info_h playlist, int memeber_id) +int mp_media_info_playlist_remove_media(mp_media_info_h playlist, + int memeber_id) { int res = MEDIA_CONTENT_ERROR_NONE; MP_CHECK_VAL(playlist, -1); - res = media_playlist_remove_media(playlist->h.group, memeber_id); + res = media_playlist_remove_media(playlist->h.group, memeber_id); MP_CHECK_VAL(res == 0, res); media_playlist_update_to_db(playlist->h.group); return res; } -int mp_media_info_playlist_is_exist(const char *playlist_name, bool *exist) +int mp_media_info_playlist_is_exist(const char *playlist_name, + bool * exist) { int res = MEDIA_CONTENT_ERROR_NONE; filter_h filter = NULL; - char cond[MAX_FILTER_LEN] = {0,}; + char cond[MAX_FILTER_LEN] = { 0, }; int count = 0; res = media_filter_create(&filter); MP_CHECK_VAL(res == 0, res); - strncat(cond, "((MEDIA_TYPE=3 and PLAYLIST_MEDIA_COUNT>0) or PLAYLIST_MEDIA_COUNT=0) and PLAYLIST_NAME = '", STRNCAT_LEN(cond)); + strncat(cond, + "((MEDIA_TYPE=3 and PLAYLIST_MEDIA_COUNT>0) or PLAYLIST_MEDIA_COUNT=0) and PLAYLIST_NAME = '", + STRNCAT_LEN(cond)); _mp_media_info_sql_strncat(cond, playlist_name, STRNCAT_LEN(cond)); strncat(cond, "'", STRNCAT_LEN(cond)); media_filter_set_condition(filter, cond, MEDIA_CONTENT_COLLATE_NOCASE); - res = mp_media_info_group_list_count_w_filter(MP_GROUP_BY_PLAYLIST, filter, &count); + res = + mp_media_info_group_list_count_w_filter(MP_GROUP_BY_PLAYLIST, + filter, &count); media_filter_destroy(filter); if (count == 0) { *exist = false; @@ -2483,7 +2830,9 @@ int mp_media_info_playlist_is_exist(const char *playlist_name, bool *exist) return res; } -int mp_media_info_playlist_unique_name(const char *orig_name, char *unique_name, size_t max_unique_name_length) +int mp_media_info_playlist_unique_name(const char *orig_name, + char *unique_name, + size_t max_unique_name_length) { bool exist = false; int i = 1; @@ -2493,9 +2842,10 @@ int mp_media_info_playlist_unique_name(const char *orig_name, char *unique_name, if (exist) { while (i < 1000) { - char id_str[4] = {0}; + char id_str[4] = { 0 }; snprintf(id_str, 4, "%.3d", i + 1); - snprintf(unique_name, max_unique_name_length, orig_name, id_str); + snprintf(unique_name, max_unique_name_length, orig_name, + id_str); mp_media_info_playlist_is_exist(unique_name, &exist); if (!exist) { return 0; @@ -2508,7 +2858,8 @@ int mp_media_info_playlist_unique_name(const char *orig_name, char *unique_name, return 0; } -int mp_media_info_playlist_rename(mp_media_info_h playlist, const char *new_name) +int mp_media_info_playlist_rename(mp_media_info_h playlist, + const char *new_name) { int res = MEDIA_CONTENT_ERROR_NONE; @@ -2518,7 +2869,9 @@ int mp_media_info_playlist_rename(mp_media_info_h playlist, const char *new_name MP_CHECK_VAL(new_name, -1); MP_CHECK_VAL(playlist->s.group_type == MP_GROUP_BY_PLAYLIST, -1); - res = media_playlist_set_name((media_playlist_h)playlist->h.group, new_name); + res = + media_playlist_set_name((media_playlist_h) playlist->h.group, + new_name); MP_CHECK_VAL(res == 0, res); res = media_playlist_update_to_db(playlist->h.group); @@ -2536,13 +2889,15 @@ int mp_media_info_playlist_db_update(mp_playlist_h playlist_handle) MP_CHECK_VAL(playlist_handle, -1); - res = media_playlist_update_to_db((media_playlist_h)playlist_handle); + res = media_playlist_update_to_db((media_playlist_h) playlist_handle); MP_CHECK_VAL(res == 0, res); return res; } -int mp_media_info_playlist_get_play_order(mp_media_info_h playlist, int playlist_member_id, int * play_order) +int mp_media_info_playlist_get_play_order(mp_media_info_h playlist, + int playlist_member_id, + int *play_order) { int res = MEDIA_CONTENT_ERROR_NONE; @@ -2550,13 +2905,17 @@ int mp_media_info_playlist_get_play_order(mp_media_info_h playlist, int playlist MP_CHECK_VAL(playlist->h.group, -1); MP_CHECK_VAL(playlist->s.group_type == MP_GROUP_BY_PLAYLIST, -1); - res = media_playlist_get_play_order(playlist->h.group, playlist_member_id, play_order); + res = + media_playlist_get_play_order(playlist->h.group, + playlist_member_id, play_order); MP_CHECK_VAL(res == 0, res); return res; } -int mp_media_info_playlist_set_play_order(mp_media_info_h playlist, int playlist_member_id, int play_order) +int mp_media_info_playlist_set_play_order(mp_media_info_h playlist, + int playlist_member_id, + int play_order) { int res = MEDIA_CONTENT_ERROR_NONE; @@ -2564,7 +2923,9 @@ int mp_media_info_playlist_set_play_order(mp_media_info_h playlist, int playlist MP_CHECK_VAL(playlist->h.group, -1); MP_CHECK_VAL(playlist->s.group_type == MP_GROUP_BY_PLAYLIST, -1); - res = media_playlist_set_play_order(playlist->h.group, playlist_member_id, play_order); + res = + media_playlist_set_play_order(playlist->h.group, + playlist_member_id, play_order); MP_CHECK_VAL(res == 0, res); return res; @@ -2584,8 +2945,7 @@ int mp_media_info_playlist_update_db(mp_media_info_h playlist) return res; } -int -mp_media_info_delete_from_db(const char *path) +int mp_media_info_delete_from_db(const char *path) { int res = MEDIA_CONTENT_ERROR_NONE; res = media_content_scan_file(path); @@ -2593,31 +2953,41 @@ mp_media_info_delete_from_db(const char *path) return res; } -int mp_media_info_playlist_add_item(mp_playlist_h playlist_handle, const char *media_id, const char *thumbnail_path) +int mp_media_info_playlist_add_item(mp_playlist_h playlist_handle, + const char *media_id, + const char *thumbnail_path) { MP_CHECK_VAL(playlist_handle, -1); MP_CHECK_VAL(media_id, -1); if (thumbnail_path) { - media_playlist_set_thumbnail_path((media_playlist_h)playlist_handle, thumbnail_path); + media_playlist_set_thumbnail_path((media_playlist_h) + playlist_handle, thumbnail_path); } - return media_playlist_add_media((media_playlist_h)playlist_handle, media_id);; + return media_playlist_add_media((media_playlist_h) playlist_handle, + media_id);; } -int mp_media_info_dup_playlist_handle_from_list_item(mp_media_info_h playlist, mp_playlist_h *playlist_handle) +int mp_media_info_dup_playlist_handle_from_list_item(mp_media_info_h + playlist, + mp_playlist_h * + playlist_handle) { int res = 0; MP_CHECK_VAL(playlist, -1); MP_CHECK_VAL(playlist_handle, -1); - res = media_playlist_clone((media_playlist_h *)playlist_handle, playlist->h.group); + res = + media_playlist_clone((media_playlist_h *) playlist_handle, + playlist->h.group); MP_CHECK_VAL(res == 0, res); return res; } -int mp_media_info_playlist_insert_to_db(const char * name, int *playlist_id, mp_playlist_h *playlist_handle) +int mp_media_info_playlist_insert_to_db(const char *name, int *playlist_id, + mp_playlist_h * playlist_handle) { int res = MEDIA_CONTENT_ERROR_NONE; media_playlist_h playlist = NULL; @@ -2628,14 +2998,15 @@ int mp_media_info_playlist_insert_to_db(const char * name, int *playlist_id, mp_ res = media_playlist_get_playlist_id(playlist, playlist_id); if (playlist_handle) { - *playlist_handle = (mp_playlist_h)playlist; + *playlist_handle = (mp_playlist_h) playlist; } else { media_playlist_destroy(playlist); } return res; } -int mp_media_info_playlist_get_name_by_id(int playlist_id, char **playlist_name) +int mp_media_info_playlist_get_name_by_id(int playlist_id, + char **playlist_name) { mp_filter_h filter = NULL; mp_media_list_h list; @@ -2672,7 +3043,10 @@ int mp_media_info_playlist_get_name_by_id(int playlist_id, char **playlist_name) return res; } - res = mp_media_info_group_list_create_w_filter(filter, MP_GROUP_BY_PLAYLIST, &list); + res = + mp_media_info_group_list_create_w_filter(filter, + MP_GROUP_BY_PLAYLIST, + &list); mp_media_filter_destory(filter); MP_CHECK_VAL(res == 0, res); if (list == NULL) { @@ -2709,18 +3083,23 @@ int mp_media_info_playlist_get_name_by_id(int playlist_id, char **playlist_name) return res; } -static bool _mp_media_info_playlist_foreach_cb_by_media_id(int playlist_member_id, media_info_h media, void *user_data) +static bool _mp_media_info_playlist_foreach_cb_by_media_id(int + playlist_member_id, + media_info_h + media, + void *user_data) { - GList **list = (GList **)user_data; + GList **list = (GList **) user_data; MP_CHECK_FALSE(list); - *list = g_list_append(*list, (void *)playlist_member_id); + *list = g_list_append(*list, (void *) playlist_member_id); return true; } -int mp_media_info_playlist_prepend_media(mp_playlist_h playlist_handle, const char *media_id) +int mp_media_info_playlist_prepend_media(mp_playlist_h playlist_handle, + const char *media_id) { int res = MEDIA_CONTENT_ERROR_NONE; - media_playlist_h playlist = (media_playlist_h)playlist_handle; + media_playlist_h playlist = (media_playlist_h) playlist_handle; MP_CHECK_VAL(playlist, -1); MP_CHECK_VAL(media_id, -1); @@ -2751,8 +3130,13 @@ int mp_media_info_playlist_prepend_media(mp_playlist_h playlist_handle, const ch mp_error("media_filter_create() .. [0x%x]", res); return res; } - media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, PLAYLIST_MEMBER_ORDER, MEDIA_CONTENT_COLLATE_NOCASE); - res = media_playlist_foreach_media_from_db(playlist_id, filter, _mp_media_info_playlist_foreach_cb_by_media_id, &member_id_list); + media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, + PLAYLIST_MEMBER_ORDER, + MEDIA_CONTENT_COLLATE_NOCASE); + res = + media_playlist_foreach_media_from_db(playlist_id, filter, + _mp_media_info_playlist_foreach_cb_by_media_id, + &member_id_list); media_filter_destroy(filter); filter = NULL; if (res) { @@ -2764,7 +3148,7 @@ int mp_media_info_playlist_prepend_media(mp_playlist_h playlist_handle, const ch int index = 0; while (list) { int order = ++index; - int member_id = (int)list->data; + int member_id = (int) list->data; if (list == g_list_last(member_id_list)) { order = 0; } @@ -2792,11 +3176,12 @@ int mp_media_info_playlist_prepend_media(mp_playlist_h playlist_handle, const ch int mp_media_info_playlist_handle_destroy(mp_playlist_h playlist_handle) { MP_CHECK_VAL(playlist_handle, -1); - media_playlist_update_to_db((media_playlist_h)playlist_handle); - return media_playlist_destroy((media_playlist_h)playlist_handle); + media_playlist_update_to_db((media_playlist_h) playlist_handle); + return media_playlist_destroy((media_playlist_h) playlist_handle); } -int mp_media_info_get_folder_path_by_folder_id(const char *folder_id, char **path) +int mp_media_info_get_folder_path_by_folder_id(const char *folder_id, + char **path) { MP_CHECK_VAL(folder_id, -1); MP_CHECK_VAL(path, -1); @@ -2814,7 +3199,7 @@ int mp_media_info_get_folder_path_by_folder_id(const char *folder_id, char **pat goto END; } -END: + END: if (folder) { media_folder_destroy(folder); } @@ -2844,8 +3229,7 @@ static db_update_cb g_db_update_cb; static void *g_db_update_data; static Ecore_Timer *g_db_update_timer; -static Eina_Bool -_mp_media_content_db_update_timer_cb(void *data) +static Eina_Bool _mp_media_content_db_update_timer_cb(void *data) { DEBUG_TRACE("Trigger Update list"); @@ -2858,10 +3242,12 @@ _mp_media_content_db_update_timer_cb(void *data) } void -mp_media_content_db_update_cb( - media_content_error_e error, int pid, media_content_db_update_item_type_e update_item, - media_content_db_update_type_e update_type, media_content_type_e media_type, - char *uuid, char *path, char *mime_type, void *user_data) +mp_media_content_db_update_cb(media_content_error_e error, int pid, + media_content_db_update_item_type_e + update_item, + media_content_db_update_type_e update_type, + media_content_type_e media_type, char *uuid, + char *path, char *mime_type, void *user_data) { //if music-player update db, do not update views @@ -2869,22 +3255,26 @@ mp_media_content_db_update_cb( return; } - DEBUG_TRACE("url: %s, media_type: %d, update_type: %d, item_type: %d", path, media_type, update_type, update_item); + DEBUG_TRACE("url: %s, media_type: %d, update_type: %d, item_type: %d", + path, media_type, update_type, update_item); /* - if (update_type == MEDIA_CONTENT_UPDATE) - { - DEBUG_TRACE("don't update list when some item is just updated"); - return; - } - */ - - if ((media_type != MEDIA_CONTENT_TYPE_MUSIC) && (media_type != MEDIA_CONTENT_TYPE_SOUND) && (update_item == MEDIA_ITEM_FILE)) { + if (update_type == MEDIA_CONTENT_UPDATE) + { + DEBUG_TRACE("don't update list when some item is just updated"); + return; + } + */ + + if ((media_type != MEDIA_CONTENT_TYPE_MUSIC) + && (media_type != MEDIA_CONTENT_TYPE_SOUND) + && (update_item == MEDIA_ITEM_FILE)) { DEBUG_TRACE("ignore not music file type"); return; } mp_ecore_timer_del(g_db_update_timer); - g_db_update_timer = ecore_timer_add(1, _mp_media_content_db_update_timer_cb, NULL); + g_db_update_timer = + ecore_timer_add(1, _mp_media_content_db_update_timer_cb, NULL); } int mp_media_info_set_db_update_cb(db_update_cb cb, void *data) @@ -2897,7 +3287,8 @@ int mp_media_info_set_db_update_cb(db_update_cb cb, void *data) g_db_update_cb = cb; g_db_update_data = data; - return media_content_add_db_updated_cb(mp_media_content_db_update_cb, NULL, ¬i_handle); + return media_content_add_db_updated_cb(mp_media_content_db_update_cb, + NULL, ¬i_handle); } int mp_media_info_unset_db_update_cb(void) diff --git a/src/common/mp-menu.c b/src/common/mp-menu.c index 414d49f..39de657 100644 --- a/src/common/mp-menu.c +++ b/src/common/mp-menu.c @@ -50,10 +50,9 @@ enum { #define MP_MENU_FID "mp_menu_fid" #define MP_MENU_PLAY_LIST_FID "mp_menu_playlist_id" -#define MP_MENU_GROUP_ITEM_HANDLER "mp_menu_group_item_handler" +#define MP_MENU_GROUP_ITEM_HANDLER "mp_menu_group_item_handler" -mp_track_type_e -mp_menu_get_track_type_by_group(mp_group_type_e group_type) +mp_track_type_e mp_menu_get_track_type_by_group(mp_group_type_e group_type) { mp_track_type_e item_type = MP_TRACK_ALL; @@ -76,8 +75,7 @@ mp_menu_get_track_type_by_group(mp_group_type_e group_type) return item_type; } -static int -_mp_menu_get_share_type(const char *label) +static int _mp_menu_get_share_type(const char *label) { MP_CHECK_VAL(label, -1); int share_type = -1; @@ -95,8 +93,7 @@ _mp_menu_get_share_type(const char *label) return share_type; } -void -_mp_menu_share_file(GList *sel_list, const char *label) +void _mp_menu_share_file(GList * sel_list, const char *label) { startfunc; MP_CHECK(sel_list); @@ -141,8 +138,7 @@ _mp_menu_share_file(GList *sel_list, const char *label) if (share_type == MP_SHARE_EMAIL) { mp_ug_email_attatch_file(path->str, ad); - } - else { + } else { WARN_TRACE("unsupported type"); } g_string_free(path, TRUE); @@ -154,11 +150,13 @@ _mp_menu_share_file(GList *sel_list, const char *label) //ctx popup single select void -mp_menu_ctxpopup_share_select_cb(void *data, Evas_Object * obj, void *event_info) +mp_menu_ctxpopup_share_select_cb(void *data, Evas_Object * obj, + void *event_info) { startfunc; GList *list = g_list_append(NULL, data); - const char *label = elm_object_item_text_get((Elm_Object_Item *)event_info); + const char *label = + elm_object_item_text_get((Elm_Object_Item *) event_info); _mp_menu_share_file(list, label); mp_ctxpopup_destroy(obj); g_list_free(list); @@ -166,11 +164,13 @@ mp_menu_ctxpopup_share_select_cb(void *data, Evas_Object * obj, void *event_info //genlist popup single select void -mp_menu_genlist_popup_share_select_cb(void *data, Evas_Object * obj, void *event_info) +mp_menu_genlist_popup_share_select_cb(void *data, Evas_Object * obj, + void *event_info) { startfunc; GList *list = g_list_append(NULL, data); - const char *label = elm_object_item_data_get((Elm_Object_Item *)event_info); + const char *label = + elm_object_item_data_get((Elm_Object_Item *) event_info); _mp_menu_share_file(list, label); mp_popup_destroy(mp_util_get_appdata()); g_list_free(list); @@ -178,11 +178,13 @@ mp_menu_genlist_popup_share_select_cb(void *data, Evas_Object * obj, void *event //genlist popup single select void -mp_menu_genlist_popup_list_share_select_cb(void *data, Evas_Object * obj, void *event_info) +mp_menu_genlist_popup_list_share_select_cb(void *data, Evas_Object * obj, + void *event_info) { startfunc; - GList *list = (GList *)data; - const char *label = elm_object_item_data_get((Elm_Object_Item *)event_info); + GList *list = (GList *) data; + const char *label = + elm_object_item_data_get((Elm_Object_Item *) event_info); _mp_menu_share_file(list, label); mp_popup_destroy(mp_util_get_appdata()); g_list_free(list); diff --git a/src/common/mp-play.c b/src/common/mp-play.c index 2d498bb..45ae54d 100644 --- a/src/common/mp-play.c +++ b/src/common/mp-play.c @@ -40,11 +40,10 @@ extern bool track_deleted; -static Eina_Bool -_mp_play_set_pos(void *data) +static Eina_Bool _mp_play_set_pos(void *data) { TIMER_TRACE(); - struct appdata *ad = (struct appdata *)data; + struct appdata *ad = (struct appdata *) data; MP_CHECK_FALSE(ad); if (ad->is_lcd_off) { @@ -65,15 +64,15 @@ static Eina_Bool _mp_item_update_db_idler(void *data) } //this function should be called in player ready state. -bool -mp_play_start_in_ready_state(void *data) +bool mp_play_start_in_ready_state(void *data) { startfunc; struct appdata *ad = data; MP_CHECK_FALSE(ad); MP_CHECK_FALSE(ad->player_state == PLAY_STATE_READY); - mp_plst_item * current_item = mp_playlist_mgr_get_current(ad->playlist_mgr); + mp_plst_item *current_item = + mp_playlist_mgr_get_current(ad->playlist_mgr); MP_CHECK_FALSE(current_item); if (!ad->paused_by_user) { @@ -113,11 +112,10 @@ mp_play_start_in_ready_state(void *data) if (current_item->uid) { - if (current_item->track_type == MP_TRACK_URI) { + if (current_item->track_type == MP_TRACK_URI) { ecore_idler_add(_mp_item_update_db_idler, current_item->uid); } } - #ifndef MP_SOUND_PLAYER mp_view_mgr_post_event(GET_VIEW_MGR, MP_PLAY_TIME_COUNT_UPDATED); #endif @@ -126,14 +124,14 @@ mp_play_start_in_ready_state(void *data) return TRUE; } -int -mp_play_new_file(void *data, bool check_drm) +int mp_play_new_file(void *data, bool check_drm) { startfunc; struct appdata *ad = data; mp_retvm_if(ad == NULL, -1, "appdata is NULL"); PROFILE_IN("mp_playlist_mgr_get_current"); - mp_plst_item * current_item = mp_playlist_mgr_get_current(ad->playlist_mgr); + mp_plst_item *current_item = + mp_playlist_mgr_get_current(ad->playlist_mgr); PROFILE_OUT("mp_playlist_mgr_get_current"); MP_CHECK_VAL(current_item, -1); int res = 0; @@ -145,17 +143,17 @@ mp_play_new_file(void *data, bool check_drm) return res; } -bool -mp_play_item_play_current_item(void *data) +bool mp_play_item_play_current_item(void *data) { startfunc; MP_CHECK_FALSE(data); - struct appdata *ad = (struct appdata *)data; + struct appdata *ad = (struct appdata *) data; MP_CHECK_FALSE(ad); - mp_plst_item * current_item = mp_playlist_mgr_get_current(ad->playlist_mgr); + mp_plst_item *current_item = + mp_playlist_mgr_get_current(ad->playlist_mgr); MP_CHECK_FALSE(current_item); mp_play_destory(ad); @@ -172,8 +170,7 @@ mp_play_item_play_current_item(void *data) } -void -mp_play_prev_file(void *data) +void mp_play_prev_file(void *data) { struct appdata *ad = data; mp_retm_if(ad == NULL, "appdata is NULL"); @@ -194,14 +191,15 @@ mp_play_prev_file(void *data) } else #endif { - mp_widget_text_popup(data, GET_SYS_STR("IDS_COM_POP_FILE_NOT_FOUND")); + mp_widget_text_popup(data, + GET_SYS_STR + ("IDS_COM_POP_FILE_NOT_FOUND")); mp_play_stop_and_updateview(data, FALSE); } } } -void -mp_play_next_file(void *data, bool forced) +void mp_play_next_file(void *data, bool forced) { struct appdata *ad = data; mp_plst_item *item = NULL; @@ -214,7 +212,8 @@ mp_play_next_file(void *data, bool forced) if (!forced) { ad->auto_next = true; if (repeat == MP_PLST_REPEAT_ONE - || (repeat == MP_PLST_REPEAT_ALL && mp_playlist_mgr_count(ad->playlist_mgr) == 1)) { + || (repeat == MP_PLST_REPEAT_ALL + && mp_playlist_mgr_count(ad->playlist_mgr) == 1)) { DEBUG_TRACE("play same track"); if (ad->camcoder_start) { WARN_TRACE("Camera is camcording. unable to play next"); @@ -234,7 +233,7 @@ mp_play_next_file(void *data, bool forced) DEBUG_TRACE("No playlist and windows focus out"); } #endif - MpPlayerView_t *player_view = (MpPlayerView_t *)GET_PLAYER_VIEW; + MpPlayerView_t *player_view = (MpPlayerView_t *) GET_PLAYER_VIEW; if (item) { mp_playlist_mgr_set_current(ad->playlist_mgr, item); @@ -259,15 +258,15 @@ mp_play_next_file(void *data, bool forced) #ifdef MP_SOUND_PLAYER if (ad->is_focus_out) { //if (!mp_minicontroller_visible_get(ad)) - // mp_app_exit(ad); + // mp_app_exit(ad); DEBUG_TRACE("End of playlist and windows focus out"); } else #endif { DEBUG_TRACE("End of playlist"); #ifdef MP_FEATURE_AUTO_OFF - if (mp_playlist_mgr_get_repeat(ad->playlist_mgr) == MP_PLST_REPEAT_NONE - && ad->auto_off_timer) { + if (mp_playlist_mgr_get_repeat(ad->playlist_mgr) == + MP_PLST_REPEAT_NONE && ad->auto_off_timer) { mp_ecore_timer_del(ad->auto_off_timer); mp_setting_reset_auto_off_time(); mp_app_exit(ad); @@ -278,8 +277,7 @@ mp_play_next_file(void *data, bool forced) } -void -mp_play_prepare(void *data) +void mp_play_prepare(void *data) { startfunc; struct appdata *ad = data; @@ -314,18 +312,20 @@ mp_play_prepare(void *data) mp_setting_save_playing_info(ad); #endif /*if (ad->current_track_info) - mp_setting_write_playing_status(ad->current_track_info->uri, "paused");*/ + mp_setting_write_playing_status(ad->current_track_info->uri, "paused"); */ if (ad->create_view_on_play) { - mp_view_mgr_push_view_with_effect(GET_VIEW_MGR, (MpView_t *)ad->preload_player_view, NULL, false); - mp_view_update((MpView_t *)ad->preload_player_view); + mp_view_mgr_push_view_with_effect(GET_VIEW_MGR, + (MpView_t *) ad-> + preload_player_view, NULL, + false); + mp_view_update((MpView_t *) ad->preload_player_view); ad->create_view_on_play = false; ad->preload_player_view = NULL; } } -static void -_mp_play_start_lazy(void *data) +static void _mp_play_start_lazy(void *data) { eventfunc; struct appdata *ad = data; @@ -341,16 +341,18 @@ _mp_play_start_lazy(void *data) _mp_play_set_pos(ad); #endif - mp_plst_item * item = mp_playlist_mgr_get_current(ad->playlist_mgr); + mp_plst_item *item = mp_playlist_mgr_get_current(ad->playlist_mgr); MP_CHECK(item); if (!item->uid && !mp_check_file_exist(item->uri)) { - char *title = NULL, *album = NULL, * artist = NULL, * genre = NULL; + char *title = NULL, *album = NULL, *artist = NULL, *genre = NULL; - mp_player_mgr_get_content_info(&title, &album, &artist, NULL, &genre, NULL); + mp_player_mgr_get_content_info(&title, &album, &artist, NULL, + &genre, NULL); if (ad->current_track_info) { - if (ad->current_track_info->title == 0 || strlen(ad->current_track_info->title) == 0) { + if (ad->current_track_info->title == 0 + || strlen(ad->current_track_info->title) == 0) { if (title == NULL || strlen(title) == 0) { title = mp_util_get_title_from_path(item->uri); DEBUG_TRACE("title from path: %s", title); @@ -361,7 +363,8 @@ _mp_play_start_lazy(void *data) IF_FREE(title); } - if (ad->current_track_info->artist == NULL || strlen(ad->current_track_info->artist) == 0) { + if (ad->current_track_info->artist == NULL + || strlen(ad->current_track_info->artist) == 0) { IF_FREE(ad->current_track_info->artist); ad->current_track_info->artist = artist; } else { @@ -403,8 +406,10 @@ _mp_play_start_lazy(void *data) mp_view_mgr_post_event(GET_VIEW_MGR, MP_START_PLAYBACK); if (ad->current_track_info) { - if (mp_setting_read_playing_status(ad->current_track_info->uri, "playing") != 1) { - mp_setting_write_playing_status(ad->current_track_info->uri, "playing"); + if (mp_setting_read_playing_status + (ad->current_track_info->uri, "playing") != 1) { + mp_setting_write_playing_status(ad->current_track_info->uri, + "playing"); } } mp_setting_set_player_state(MP_PLAY_STATE_PLAYING); @@ -442,8 +447,7 @@ _mp_play_start_lazy_idler(void *data) }*/ -void -mp_play_start(void *data) +void mp_play_start(void *data) { startfunc; struct appdata *ad = data; @@ -462,7 +466,8 @@ mp_play_start(void *data) int applist = NOTIFICATION_DISPLAY_APP_INDICATOR; notification_type_e noti_type = NOTIFICATION_TYPE_NOTI; - notification_image_type_e img_type = NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR; + notification_image_type_e img_type = + NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR; int ret = NOTIFICATION_ERROR_NONE; char *shared_path = app_get_shared_resource_path(); @@ -470,14 +475,18 @@ mp_play_start(void *data) ERROR_TRACE("Shared Resource Path is NULL"); } - char icon_path[1024] = {0}; - snprintf(icon_path, 1024, "%sshared_images/T02_control_circle_icon_play.png", shared_path); + char icon_path[1024] = { 0 }; + snprintf(icon_path, 1024, + "%sshared_images/T02_control_circle_icon_play.png", + shared_path); free(shared_path); #ifdef MP_SOUND_PLAYER - notification_delete_all_by_type("org.tizen.music-player", NOTIFICATION_TYPE_NOTI); + notification_delete_all_by_type("org.tizen.music-player", + NOTIFICATION_TYPE_NOTI); #else - notification_delete_all_by_type("org.tizen.sound-player", NOTIFICATION_TYPE_NOTI); + notification_delete_all_by_type("org.tizen.sound-player", + NOTIFICATION_TYPE_NOTI); #endif ad->noti = notification_create(noti_type); #ifdef MP_SOUND_PLAYER @@ -489,7 +498,9 @@ mp_play_start(void *data) if (ret != NOTIFICATION_ERROR_NONE) { DEBUG_TRACE("Unable to set tag [%d]", ret); } - ret = notification_set_property(ad->noti, NOTIFICATION_PROP_VOLATILE_DISPLAY); + ret = + notification_set_property(ad->noti, + NOTIFICATION_PROP_VOLATILE_DISPLAY); if (ret != NOTIFICATION_ERROR_NONE) { DEBUG_TRACE("Cannot set the notification property [%d]", ret); } @@ -506,15 +517,18 @@ mp_play_start(void *data) char *data_path = app_get_data_path(); DEBUG_TRACE("Path is: %s", data_path); - char playing_status[1024] = {0}; + char playing_status[1024] = { 0 }; if (data_path == NULL) { ERROR_TRACE("unable to get data path"); } - snprintf(playing_status, 1024, "%s%s", data_path, "NowPlayingStatus"); + snprintf(playing_status, 1024, "%s%s", data_path, + "NowPlayingStatus"); free(data_path); if (ad->monitor == NULL) { - ad->monitor = ecore_file_monitor_add(playing_status, mp_noti_read_ini_file, NULL); + ad->monitor = + ecore_file_monitor_add(playing_status, + mp_noti_read_ini_file, NULL); } } @@ -524,8 +538,11 @@ mp_play_start(void *data) } if (ad->create_view_on_play) { - mp_view_mgr_push_view_with_effect(GET_VIEW_MGR, (MpView_t *)ad->preload_player_view, NULL, false); - mp_view_update((MpView_t *)ad->preload_player_view); + mp_view_mgr_push_view_with_effect(GET_VIEW_MGR, + (MpView_t *) ad-> + preload_player_view, NULL, + false); + mp_view_update((MpView_t *) ad->preload_player_view); ad->create_view_on_play = false; ad->preload_player_view = NULL; } @@ -538,8 +555,7 @@ mp_play_start(void *data) } #ifdef MP_FEATURE_AUTO_OFF -static Eina_Bool -_mp_play_control_paused_off_timer_cb(void *data) +static Eina_Bool _mp_play_control_paused_off_timer_cb(void *data) { TIMER_TRACE(); struct appdata *ad = data; @@ -568,8 +584,7 @@ _mp_play_control_paused_off_timer_cb(void *data) } #endif -void -mp_play_pause(void *data) +void mp_play_pause(void *data) { startfunc; struct appdata *ad = data; @@ -598,7 +613,6 @@ mp_play_pause(void *data) if (ad->win_minicon) { mp_minicontroller_update_control(ad); } - #ifdef MP_FEATURE_LOCKSCREEN if (ad->win_lockmini) { mp_lockscreenmini_update_control(ad); @@ -609,8 +623,10 @@ mp_play_pause(void *data) mp_view_mgr_post_event(GET_VIEW_MGR, MP_PAUSE_PLAYBACK); if (ad->current_track_info) { - if (mp_setting_read_playing_status(ad->current_track_info->uri, "paused") != 1) { - mp_setting_write_playing_status(ad->current_track_info->uri, "paused"); + if (mp_setting_read_playing_status + (ad->current_track_info->uri, "paused") != 1) { + mp_setting_write_playing_status(ad->current_track_info->uri, + "paused"); } } mp_setting_set_player_state(MP_PLAY_STATE_PAUSED); @@ -621,13 +637,14 @@ mp_play_pause(void *data) #ifdef MP_FEATURE_AUTO_OFF mp_ecore_timer_del(ad->pause_off_timer); mp_debug("pause off timer set"); - ad->pause_off_timer = ecore_timer_add(PAUSE_OFF_TIMEOUT, _mp_play_control_paused_off_timer_cb, ad); + ad->pause_off_timer = + ecore_timer_add(PAUSE_OFF_TIMEOUT, + _mp_play_control_paused_off_timer_cb, ad); #endif endfunc; } -void -mp_play_stop(void *data) +void mp_play_stop(void *data) { startfunc; struct appdata *ad = data; @@ -660,8 +677,10 @@ mp_play_stop(void *data) mp_util_sleep_lock_set(FALSE, FALSE); if (ad->current_track_info) { - if (mp_setting_read_playing_status(ad->current_track_info->uri, "stop") != 1) { - mp_setting_write_playing_status(ad->current_track_info->uri, "stop"); + if (mp_setting_read_playing_status + (ad->current_track_info->uri, "stop") != 1) { + mp_setting_write_playing_status(ad->current_track_info->uri, + "stop"); } } mp_setting_set_player_state(MP_PLAY_STATE_STOP); @@ -670,8 +689,7 @@ mp_play_stop(void *data) endfunc; } -void -mp_play_resume(void *data) +void mp_play_resume(void *data) { startfunc; struct appdata *ad = data; @@ -697,7 +715,6 @@ mp_play_resume(void *data) if (ad->b_minicontroller_show) { mp_minicontroller_update_control(ad); } - #ifdef MP_FEATURE_LOCKSCREEN if (!ad->win_lockmini) { mp_lockscreenmini_create(ad); @@ -715,8 +732,10 @@ mp_play_resume(void *data) mp_app_grab_mm_keys(ad); if (ad->current_track_info) { - if (mp_setting_read_playing_status(ad->current_track_info->uri, "playing") != 1) { - mp_setting_write_playing_status(ad->current_track_info->uri, "playing"); + if (mp_setting_read_playing_status + (ad->current_track_info->uri, "playing") != 1) { + mp_setting_write_playing_status(ad->current_track_info->uri, + "playing"); } } ad->freeze_indicator_icon = false; @@ -730,16 +749,17 @@ mp_play_resume(void *data) endfunc; } -bool -mp_play_destory(void *data) +bool mp_play_destory(void *data) { startfunc; struct appdata *ad = data; mp_retvm_if(ad == NULL, FALSE, "appdata is NULL"); if (ad->current_track_info) { - if (mp_setting_read_playing_status(ad->current_track_info->uri, "stop") != 1) { - mp_setting_write_playing_status(ad->current_track_info->uri, "stop"); + if (mp_setting_read_playing_status + (ad->current_track_info->uri, "stop") != 1) { + mp_setting_write_playing_status(ad->current_track_info->uri, + "stop"); } } @@ -753,8 +773,7 @@ mp_play_destory(void *data) return TRUE; } -bool -mp_play_fast_destory(void *data) +bool mp_play_fast_destory(void *data) { startfunc; struct appdata *ad = data; @@ -768,8 +787,7 @@ mp_play_fast_destory(void *data) return TRUE; } -void -mp_play_stop_and_updateview(void *data, bool mmc_removed) +void mp_play_stop_and_updateview(void *data, bool mmc_removed) { startfunc; @@ -781,7 +799,6 @@ mp_play_stop_and_updateview(void *data, bool mmc_removed) ad->freeze_indicator_icon = false; mp_play_destory(ad); } - #ifndef MP_SOUND_PLAYER mp_view_mgr_pop_to_view(GET_VIEW_MGR, MP_VIEW_ALL); mp_view_mgr_post_event(GET_VIEW_MGR, MP_UNSET_NOW_PLAYING); @@ -792,7 +809,6 @@ mp_play_stop_and_updateview(void *data, bool mmc_removed) if (ad->b_minicontroller_show) { mp_minicontroller_hide(ad); } - #ifdef MP_FEATURE_LOCKSCREEN if (ad->b_lockmini_show) { mp_lockscreenmini_hide(ad); @@ -802,8 +818,7 @@ mp_play_stop_and_updateview(void *data, bool mmc_removed) return; } -void -mp_play_next_and_updateview(void *data) +void mp_play_next_and_updateview(void *data) { startfunc; @@ -817,7 +832,6 @@ mp_play_next_and_updateview(void *data) if (ad->b_minicontroller_show) { mp_minicontroller_hide(ad); } - #ifdef MP_FEATURE_LOCKSCREEN if (ad->b_lockmini_show) { mp_lockscreenmini_hide(ad); @@ -826,4 +840,3 @@ mp_play_next_and_updateview(void *data) return; } - diff --git a/src/common/mp-ta.c b/src/common/mp-ta.c index 67795fa..b58a97d 100644 --- a/src/common/mp-ta.c +++ b/src/common/mp-ta.c @@ -48,19 +48,22 @@ static int mm_g_accum_longest_name = 0; static unsigned long mm_g_accum_first_time = 0xFFFFFFFF; // jmlee static int mm_g_enable = 1; -int -mp_ta_init(void) +int mp_ta_init(void) { if (mm_g_accums) { return 0; } - mm_g_cps = (mp_ta_checkpoint **) malloc(MP_TA_MAX_CHECKPOINT * sizeof(mp_ta_checkpoint *)); + mm_g_cps = + (mp_ta_checkpoint **) malloc(MP_TA_MAX_CHECKPOINT * + sizeof(mp_ta_checkpoint *)); if (!mm_g_cps) { return -1; } - mm_g_accums = (mp_ta_accum_item **) malloc(MP_TA_MAX_CHECKPOINT * sizeof(mp_ta_accum_item *)); + mm_g_accums = + (mp_ta_accum_item **) malloc(MP_TA_MAX_CHECKPOINT * + sizeof(mp_ta_accum_item *)); if (!mm_g_accums) { return -1; } @@ -70,8 +73,7 @@ mp_ta_init(void) return 0; } -int -mp_ta_release(void) +int mp_ta_release(void) { if (!mm_g_accums) { return 0; @@ -85,20 +87,17 @@ mp_ta_release(void) return 0; } -void -mp_ta_set_enable(int enable) +void mp_ta_set_enable(int enable) { mm_g_enable = enable; } -int -mp_ta_get_numof_checkpoints() +int mp_ta_get_numof_checkpoints() { return mm_g_cp_index; } -char * -mp_ta_fmt(const char *fmt, ...) +char *mp_ta_fmt(const char *fmt, ...) { static char ta_buf[512]; va_list args; @@ -113,8 +112,7 @@ mp_ta_fmt(const char *fmt, ...) } -int -mp_ta_add_checkpoint(char *name, int show, char *filename, int line) +int mp_ta_add_checkpoint(char *name, int show, char *filename, int line) { mp_ta_checkpoint *cp = NULL; struct timeval t; @@ -145,16 +143,14 @@ mp_ta_add_checkpoint(char *name, int show, char *filename, int line) } int name_len = strlen(name); - cp->name = (char *)malloc(name_len + 1); + cp->name = (char *) malloc(name_len + 1); if (!cp->name) { free(cp); return -1; } strncpy(cp->name, name, name_len); cp->name[name_len] = 0; - if (show) - - { + if (show) { gettimeofday(&t, NULL); } cp->timestamp = t.tv_sec * 1000000L + t.tv_usec; @@ -169,8 +165,7 @@ mp_ta_add_checkpoint(char *name, int show, char *filename, int line) return 0; } -void -mp_ta_show_checkpoints(void) +void mp_ta_show_checkpoints(void) { int i = 0; if (!mm_g_accums) { @@ -183,8 +178,7 @@ mp_ta_show_checkpoints(void) DEBUG_TRACE("END RESULT ============================"); } -void -mp_ta_show_diff(char *name1, char *name2) +void mp_ta_show_diff(char *name1, char *name2) { if (!mm_g_accums) { return; @@ -193,8 +187,7 @@ mp_ta_show_diff(char *name1, char *name2) } -unsigned long -mp_ta_get_diff(char *name1, char *name2) +unsigned long mp_ta_get_diff(char *name1, char *name2) { int cp1, cp2; @@ -202,17 +195,14 @@ mp_ta_get_diff(char *name1, char *name2) return 0; } - // fail if bad param. if (!name1 || !name2) { return -1; } - // fail if same. if (strcmp(name1, name2) == 0) { return -1; } - // get index if ((cp1 = __get_cp_index(name1)) == -1) { return -1; @@ -221,7 +211,6 @@ mp_ta_get_diff(char *name1, char *name2) if ((cp2 = __get_cp_index(name2)) == -1) { return -1; } - // NOTE : // return value must be positive value. // bcz the value of higher index of mm_g_cps always higher than lower one. @@ -229,8 +218,7 @@ mp_ta_get_diff(char *name1, char *name2) } -static int -__get_cp_index(char *name) +static int __get_cp_index(char *name) { int i; @@ -246,8 +234,7 @@ __get_cp_index(char *name) return -1; } -static int -__get_accum_index(char *name) +static int __get_accum_index(char *name) { int i; @@ -263,8 +250,7 @@ __get_accum_index(char *name) return -1; } -static void -__free_cps(void) +static void __free_cps(void) { int i = 0; @@ -290,8 +276,7 @@ __free_cps(void) mm_g_cp_index = 0; } -static void -__free_accums(void) +static void __free_accums(void) { int i = 0; @@ -319,8 +304,7 @@ __free_accums(void) } -int -mp_ta_accum_item_begin(char *name, int show, char *filename, int line) +int mp_ta_accum_item_begin(char *name, int show, char *filename, int line) { mp_ta_accum_item *accum = NULL; int index = 0; @@ -349,19 +333,17 @@ mp_ta_accum_item_begin(char *name, int show, char *filename, int line) if (name_len == 0) { return -1; } - // if 'name' is new one. create new item. if ((index = __get_accum_index(name)) == -1) { accum = (mp_ta_accum_item *) malloc(sizeof(mp_ta_accum_item)); if (!accum) { return -1; } - // clear first. memset(accum, 0, sizeof(mp_ta_accum_item)); accum->elapsed_min = 0xFFFFFFFF; - accum->name = (char *)malloc(name_len + 1); + accum->name = (char *) malloc(name_len + 1); if (!accum->name) { free(accum); return -1; @@ -385,12 +367,12 @@ mp_ta_accum_item_begin(char *name, int show, char *filename, int line) accum->num_unpair++; return -1; } - // get timestamp gettimeofday(&t, NULL); accum->timestamp = t.tv_sec * 1000000L + t.tv_usec; #ifdef MP_TA_UNIT_MSEC - accum->timestamp = (accum->timestamp >= 1000) ? accum->timestamp / 1000 : 0; + accum->timestamp = + (accum->timestamp >= 1000) ? accum->timestamp / 1000 : 0; #endif accum->on_estimate = 1; @@ -408,8 +390,7 @@ mp_ta_accum_item_begin(char *name, int show, char *filename, int line) return 0; } -int -mp_ta_accum_item_end(char *name, int show, char *filename, int line) +int mp_ta_accum_item_end(char *name, int show, char *filename, int line) { mp_ta_accum_item *accum = NULL; unsigned int tval = 0; @@ -424,7 +405,6 @@ mp_ta_accum_item_end(char *name, int show, char *filename, int line) return 0; } - // get time first for more accuracy. gettimeofday(&t, NULL); @@ -439,7 +419,6 @@ mp_ta_accum_item_end(char *name, int show, char *filename, int line) if (strlen(name) == 0) { return -1; } - // varify the 'name' is already exist. if ((index = __get_accum_index(name)) == -1) { return -1; @@ -452,7 +431,6 @@ mp_ta_accum_item_end(char *name, int show, char *filename, int line) accum->num_unpair++; return -1; } - // get current timestamp. tval = t.tv_sec * 1000000L + t.tv_usec; #ifdef MP_TA_UNIT_MSEC @@ -466,8 +444,10 @@ mp_ta_accum_item_end(char *name, int show, char *filename, int line) tval = tval - accum->timestamp; // update min/max - accum->elapsed_max = tval > accum->elapsed_max ? tval : accum->elapsed_max; - accum->elapsed_min = tval < accum->elapsed_min ? tval : accum->elapsed_min; + accum->elapsed_max = + tval > accum->elapsed_max ? tval : accum->elapsed_max; + accum->elapsed_min = + tval < accum->elapsed_min ? tval : accum->elapsed_min; // add elapsed time accum->elapsed_accum += tval; @@ -476,13 +456,11 @@ mp_ta_accum_item_end(char *name, int show, char *filename, int line) return 0; } -void -__print_some_info(FILE * fp) +void __print_some_info(FILE * fp) { if (!fp) { return; } - // comment { fprintf(fp, "\nb~ b~ b~\n\n"); @@ -492,7 +470,7 @@ __print_some_info(FILE * fp) { time_t t_val; char hostname[MP_TA_BUFF_SIZE] = { '\0', }; - char buf[MP_TA_BUFF_SIZE] = {'\0', }; + char buf[MP_TA_BUFF_SIZE] = { '\0', }; struct utsname uts; struct rusage r_usage; @@ -512,13 +490,13 @@ __print_some_info(FILE * fp) fprintf(fp, "Release : %s \n", uts.release); fprintf(fp, "Version : %s \n", uts.version); } - // process info. - fprintf(fp, "Process priority : %d\n", getpriority(PRIO_PROCESS, getpid())); + fprintf(fp, "Process priority : %d\n", + getpriority(PRIO_PROCESS, getpid())); getrusage(RUSAGE_SELF, &r_usage); fprintf(fp, "CPU usage : User = %ld.%06ld, System = %ld.%06ld\n", - r_usage.ru_utime.tv_sec, r_usage.ru_utime.tv_usec, - r_usage.ru_stime.tv_sec, r_usage.ru_stime.tv_usec); + r_usage.ru_utime.tv_sec, r_usage.ru_utime.tv_usec, + r_usage.ru_stime.tv_sec, r_usage.ru_stime.tv_usec); } @@ -536,8 +514,7 @@ __print_some_info(FILE * fp) } } -void -mp_ta_accum_show_result(int direction) +void mp_ta_accum_show_result(int direction) { int i = 0; char format[MP_TA_BUFF_SIZE]; @@ -554,25 +531,29 @@ mp_ta_accum_show_result(int direction) case MP_TA_SHOW_STDERR: fp = stderr; break; - case MP_TA_SHOW_FILE: { - fp = fopen(MP_TA_RESULT_FILE, "wt"); - if (!fp) { - return; + case MP_TA_SHOW_FILE:{ + fp = fopen(MP_TA_RESULT_FILE, "wt"); + if (!fp) { + return; + } } } - } __print_some_info(fp); #ifdef MP_TA_UNIT_MSEC snprintf(format, sizeof(format), - "[%%3d]| %%-%ds | \tavg : %%7ld\tcalls : %%7ld\ttotal : %%9ld\tmin : %%9ld\tmax : %%9ld\tstart : %%9lu\tend : %%9lu\tunpair : %%3ld\n", - mm_g_accum_longest_name); - fprintf(fp, "BEGIN RESULT ACCUM============================ : NumOfItems : %d, unit(msec)\n", mm_g_accum_index); + "[%%3d]| %%-%ds | \tavg : %%7ld\tcalls : %%7ld\ttotal : %%9ld\tmin : %%9ld\tmax : %%9ld\tstart : %%9lu\tend : %%9lu\tunpair : %%3ld\n", + mm_g_accum_longest_name); + fprintf(fp, + "BEGIN RESULT ACCUM============================ : NumOfItems : %d, unit(msec)\n", + mm_g_accum_index); #else snprintf(format, sizeof(format), - "[%%3d]%%-%ds\t|avg:\t%%7ld\tcalls:%%3ld total: %%7ld min:%%7ld max:%%7ld\n", - mm_g_accum_longest_name); - fprintf(fp, "BEGIN RESULT ACCUM============================ : NumOfItems : %d, unit(usec)\n", mm_g_accum_index); + "[%%3d]%%-%ds\t|avg:\t%%7ld\tcalls:%%3ld total: %%7ld min:%%7ld max:%%7ld\n", + mm_g_accum_longest_name); + fprintf(fp, + "BEGIN RESULT ACCUM============================ : NumOfItems : %d, unit(usec)\n", + mm_g_accum_index); #endif for (i = 0; i < mm_g_accum_index; i++) { @@ -581,11 +562,12 @@ mp_ta_accum_show_result(int direction) mm_g_accums[i]->num_calls = 1; } - fprintf(fp, format, i, mm_g_accums[i]->name, (mm_g_accums[i]->elapsed_accum == 0) ? 0 : (int)(mm_g_accums[i]->elapsed_accum / mm_g_accums[i]->num_calls), mm_g_accums[i]->num_calls, mm_g_accums[i]->elapsed_accum, // Fix it! : devide by zero. - mm_g_accums[i]->elapsed_min, - mm_g_accums[i]->elapsed_max, - mm_g_accums[i]->first_start - mm_g_accum_first_time, - mm_g_accums[i]->last_end - mm_g_accum_first_time, mm_g_accums[i]->num_unpair); + fprintf(fp, format, i, mm_g_accums[i]->name, (mm_g_accums[i]->elapsed_accum == 0) ? 0 : (int) (mm_g_accums[i]->elapsed_accum / mm_g_accums[i]->num_calls), mm_g_accums[i]->num_calls, mm_g_accums[i]->elapsed_accum, // Fix it! : devide by zero. + mm_g_accums[i]->elapsed_min, + mm_g_accums[i]->elapsed_max, + mm_g_accums[i]->first_start - mm_g_accum_first_time, + mm_g_accums[i]->last_end - mm_g_accum_first_time, + mm_g_accums[i]->num_unpair); } fprintf(fp, "END RESULT ACCUM ============================\n"); @@ -596,7 +578,7 @@ mp_ta_accum_show_result(int direction) bool mp_ta_is_init(void) { - return (bool)mm_g_accums; + return (bool) mm_g_accums; } static int g_level; diff --git a/src/common/mp-ug-launch.c b/src/common/mp-ug-launch.c index 259057c..bf8408d 100644 --- a/src/common/mp-ug-launch.c +++ b/src/common/mp-ug-launch.c @@ -69,15 +69,18 @@ #define CT_UG_BUNDLE_PATH "ct_path" #define UG_CONTACTS_LIST "contacts-list-efl" -int -mp_ug_email_attatch_file(const char *filepath, void *user_data) +int mp_ug_email_attatch_file(const char *filepath, void *user_data) { - bool ret = mp_send_via_appcontrol(user_data, MP_SEND_TYPE_EMAIL, filepath); + bool ret = + mp_send_via_appcontrol(user_data, MP_SEND_TYPE_EMAIL, filepath); return (ret) ? 0 : -1; } #ifndef MP_SOUND_PLAYER -static void __mp_ug_gallery_result_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *data) +static void __mp_ug_gallery_result_cb(app_control_h request, + app_control_h reply, + app_control_result_e result, + void *data) { startfunc; int ret = 0; @@ -92,15 +95,19 @@ static void __mp_ug_gallery_result_cb(app_control_h request, app_control_h reply char *result_filename; ret = app_control_get_extra_data(reply, "path", &result_filename); if (ret != APP_CONTROL_ERROR_NONE) { - ERROR_TRACE("app_control_get_extra_data() is failed : %d", ret); + ERROR_TRACE("app_control_get_extra_data() is failed : %d", + ret); return; } if (result_filename) { - /*update thumbnail in db*/ - ret = mp_media_info_playlist_set_thumbnail_path(data, result_filename); + /*update thumbnail in db */ + ret = + mp_media_info_playlist_set_thumbnail_path(data, + result_filename); ERROR_TRACE("ret from set thumbnail is %d", ret); - mp_view_mgr_post_event(GET_VIEW_MGR, MP_PLAYLIST_IMAGE_UPDATED); + mp_view_mgr_post_event(GET_VIEW_MGR, + MP_PLAYLIST_IMAGE_UPDATED); char *popup_txt = NULL; if (!ret) { popup_txt = GET_SYS_STR("IDS_COM_POP_SUCCESS"); @@ -117,8 +124,7 @@ static void __mp_ug_gallery_result_cb(app_control_h request, app_control_h reply endfunc; } -int -mp_ug_gallery_get_picture(void *data) +int mp_ug_gallery_get_picture(void *data) { startfunc; @@ -142,9 +148,12 @@ mp_ug_gallery_get_picture(void *data) app_control_add_extra_data(svc_handle, "launch-type", "select-one"); app_control_add_extra_data(svc_handle, "file-type", "image"); - ret = app_control_send_launch_request(svc_handle, __mp_ug_gallery_result_cb, data); + ret = + app_control_send_launch_request(svc_handle, + __mp_ug_gallery_result_cb, data); if (ret != APP_CONTROL_ERROR_NONE) { - ERROR_TRACE("app_control_send_launch_request is failed ret = %d", ret); + ERROR_TRACE("app_control_send_launch_request is failed ret = %d", + ret); app_control_destroy(svc_handle); return -1; } @@ -156,7 +165,10 @@ mp_ug_gallery_get_picture(void *data) } -static void __mp_ug_camera_result_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *data) +static void __mp_ug_camera_result_cb(app_control_h request, + app_control_h reply, + app_control_result_e result, + void *data) { startfunc; int ret = 0; @@ -165,15 +177,21 @@ static void __mp_ug_camera_result_cb(app_control_h request, app_control_h reply, if (result == APP_CONTROL_RESULT_SUCCEEDED) { char *result_filename; - ret = app_control_get_extra_data(reply, APP_CONTROL_DATA_SELECTED, &result_filename); + ret = + app_control_get_extra_data(reply, APP_CONTROL_DATA_SELECTED, + &result_filename); if (ret != APP_CONTROL_ERROR_NONE) { - ERROR_TRACE("app_control_get_extra_data() is failed : %d", ret); + ERROR_TRACE("app_control_get_extra_data() is failed : %d", + ret); return; } if (result_filename) { - ret = mp_media_info_playlist_set_thumbnail_path(data, result_filename); - mp_view_mgr_post_event(GET_VIEW_MGR, MP_PLAYLIST_IMAGE_UPDATED); + ret = + mp_media_info_playlist_set_thumbnail_path(data, + result_filename); + mp_view_mgr_post_event(GET_VIEW_MGR, + MP_PLAYLIST_IMAGE_UPDATED); } else { ERROR_TRACE("No result"); @@ -183,8 +201,7 @@ static void __mp_ug_camera_result_cb(app_control_h request, app_control_h reply, endfunc; } -int -mp_ug_camera_take_picture(void *data) +int mp_ug_camera_take_picture(void *data) { startfunc; @@ -205,14 +222,18 @@ mp_ug_camera_take_picture(void *data) - app_control_set_operation(svc_handle, APP_CONTROL_OPERATION_CREATE_CONTENT); + app_control_set_operation(svc_handle, + APP_CONTROL_OPERATION_CREATE_CONTENT); app_control_set_mime(svc_handle, "image/jpg"); app_control_add_extra_data(svc_handle, "CALLER", "music-player"); app_control_add_extra_data(svc_handle, "RESOLUTION", "VGA"); - ret = app_control_send_launch_request(svc_handle, __mp_ug_camera_result_cb, data); + ret = + app_control_send_launch_request(svc_handle, + __mp_ug_camera_result_cb, data); if (ret != APP_CONTROL_ERROR_NONE) { - ERROR_TRACE("app_control_send_launch_request is failed ret = %d", ret); + ERROR_TRACE("app_control_send_launch_request is failed ret = %d", + ret); app_control_destroy(svc_handle); return -1; } @@ -224,7 +245,10 @@ mp_ug_camera_take_picture(void *data) } #endif -static void _mp_ug_contact_reply_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *user_data) +static void _mp_ug_contact_reply_cb(app_control_h request, + app_control_h reply, + app_control_result_e result, + void *user_data) { startfunc; char *value = NULL; @@ -232,14 +256,15 @@ static void _mp_ug_contact_reply_cb(app_control_h request, app_control_h reply, DEBUG_TRACE("is_success: %s", value); if (!g_strcmp0(value, "1")) { - mp_util_post_status_message(NULL, GET_STR(STR_MP_POP_CALLER_RINGTONE_SAVED)); + mp_util_post_status_message(NULL, + GET_STR + (STR_MP_POP_CALLER_RINGTONE_SAVED)); } IF_FREE(value); } -int -mp_ug_contact_user_sel(const char *filepath, void *user_data) +int mp_ug_contact_user_sel(const char *filepath, void *user_data) { startfunc; app_control_h service = NULL; @@ -264,7 +289,8 @@ mp_ug_contact_user_sel(const char *filepath, void *user_data) return -1; } - err = app_control_set_operation(service, APP_CONTROL_OPERATION_DEFAULT); + err = + app_control_set_operation(service, APP_CONTROL_OPERATION_DEFAULT); if (err != APP_CONTROL_ERROR_NONE) { ERROR_TRACE("Error: app_control_set_operation().. [0x%x]", err); app_control_destroy(service); @@ -277,9 +303,12 @@ mp_ug_contact_user_sel(const char *filepath, void *user_data) app_control_destroy(service); return -1; } - err = app_control_send_launch_request(service, _mp_ug_contact_reply_cb, NULL); + err = + app_control_send_launch_request(service, _mp_ug_contact_reply_cb, + NULL); if (err != APP_CONTROL_ERROR_NONE) { - ERROR_TRACE("Error: app_control_send_launch_request().. [0x%x]", err); + ERROR_TRACE("Error: app_control_send_launch_request().. [0x%x]", + err); app_control_destroy(service); return -1; } @@ -292,8 +321,7 @@ mp_ug_contact_user_sel(const char *filepath, void *user_data) return 0; } -int -mp_ug_set_as_alarm_tone(const char *filepath, int position) +int mp_ug_set_as_alarm_tone(const char *filepath, int position) { startfunc; app_control_h service = NULL; @@ -320,7 +348,8 @@ mp_ug_set_as_alarm_tone(const char *filepath, int position) err = app_control_add_extra_data(service, "position", pos); IF_FREE(pos); if (err != APP_CONTROL_ERROR_NONE) { - ERROR_TRACE("Error: app_control_add_extra_data().. [0x%x]", err); + ERROR_TRACE("Error: app_control_add_extra_data().. [0x%x]", + err); app_control_destroy(service); return -1; } @@ -348,7 +377,8 @@ mp_ug_set_as_alarm_tone(const char *filepath, int position) } err = app_control_send_launch_request(service, NULL, NULL); if (err != APP_CONTROL_ERROR_NONE) { - ERROR_TRACE("Error: app_control_send_launch_request().. [0x%x]", err); + ERROR_TRACE("Error: app_control_send_launch_request().. [0x%x]", + err); app_control_destroy(service); return -1; } @@ -362,7 +392,8 @@ mp_ug_set_as_alarm_tone(const char *filepath, int position) } bool -mp_send_via_appcontrol(struct appdata *ad, mp_send_type_e send_type, const char *files) +mp_send_via_appcontrol(struct appdata * ad, mp_send_type_e send_type, + const char *files) { startfunc; MP_CHECK_FALSE(ad); @@ -418,7 +449,7 @@ mp_send_via_appcontrol(struct appdata *ad, mp_send_type_e send_type, const char result = true; -END: + END: if (service) { app_control_destroy(service); service = NULL; diff --git a/src/common/mp-util.c b/src/common/mp-util.c index 1b7c036..a4feb8d 100644 --- a/src/common/mp-util.c +++ b/src/common/mp-util.c @@ -105,9 +105,9 @@ static char *single_numeric_index[] = { }; static const char *kor_sec[] = { - "\xe3\x85\x8f", /* A */ - "\xe3\x85\x90", /* AE */ - "\xe3\x85\x91", /* YA */ + "\xe3\x85\x8f", /* A */ + "\xe3\x85\x90", /* AE */ + "\xe3\x85\x91", /* YA */ "\xe3\x85\x92", "\xe3\x85\x93", "\xe3\x85\x94", @@ -130,20 +130,19 @@ static const char *kor_sec[] = { extern struct appdata *g_ad; -EXPORT_API struct appdata *mp_util_get_appdata(void) { +EXPORT_API struct appdata *mp_util_get_appdata(void) +{ return g_ad; } -static int -_mp_util_get_len(const char *p) +static int _mp_util_get_len(const char *p) { int r = -1; return r; } -static unsigned short -_mp_util_utf8_to_ucs2(const char *p) +static unsigned short _mp_util_utf8_to_ucs2(const char *p) { unsigned short r = 0; int len; @@ -154,21 +153,21 @@ _mp_util_utf8_to_ucs2(const char *p) } switch (len) { - case 1: { - r = *p & 0x7F; - break; - } - case 2: { - r = *p & 0x1F; - break; - } - case 3: { - r = *p & 0x0F; - break; - } - default: { - break; - } + case 1:{ + r = *p & 0x7F; + break; + } + case 2:{ + r = *p & 0x1F; + break; + } + case 3:{ + r = *p & 0x0F; + break; + } + default:{ + break; + } } while (len > 1) { @@ -181,10 +180,9 @@ _mp_util_utf8_to_ucs2(const char *p) return r; } -static const char * -_mp_util_get_single(const char *p) +static const char *_mp_util_get_single(const char *p) { - int c = (int) * p; + int c = (int) *p; if (islower(c) != 0) { return single_lower_index[c - 'a']; @@ -199,8 +197,7 @@ _mp_util_get_single(const char *p) return NULL; } -static const char * -_mp_util_get_multi(unsigned short u) +static const char *_mp_util_get_multi(unsigned short u) { int i; @@ -212,8 +209,7 @@ _mp_util_get_multi(unsigned short u) return NULL; } -static char * -_mp_util_get_next_char(const char *p) +static char *_mp_util_get_next_char(const char *p) { int n; @@ -230,12 +226,11 @@ _mp_util_get_next_char(const char *p) DEBUG_TRACE("%s", &p[n]); - return (char *)&p[n]; + return (char *) &p[n]; } -static const char * -_mp_util_get_second_kor(unsigned short u) +static const char *_mp_util_get_second_kor(unsigned short u) { unsigned short t; @@ -245,46 +240,44 @@ _mp_util_get_second_kor(unsigned short u) return kor_sec[t]; } -void -mp_util_format_duration(char *time, int ms) +void mp_util_format_duration(char *time, int ms) { int sec = (ms) / 1000; int min = sec / 60; int hour = min / 60; - snprintf(time, TIME_FORMAT_LEN, "%02u:%02u:%02u", hour, min % 60, sec % 60); + snprintf(time, TIME_FORMAT_LEN, "%02u:%02u:%02u", hour, min % 60, + sec % 60); } -void -mp_util_song_format_duration(char *time, int ms) +void mp_util_song_format_duration(char *time, int ms) { int sec = (ms) / 1000; int min = sec / 60; if (min >= 10) { int hour = min / 60; - snprintf(time, TIME_FORMAT_LEN, "%02u:%02u:%02u", hour, min % 60, sec % 60); + snprintf(time, TIME_FORMAT_LEN, "%02u:%02u:%02u", hour, min % 60, + sec % 60); } else { snprintf(time, TIME_FORMAT_LEN, "%02u:%02u", min, sec % 60); } } -const char * -mp_util_get_index(const char *p) +const char *mp_util_get_index(const char *p) { if (p == NULL) { return NULL; } - if ((unsigned char)*p < SINGLE_BYTE_MAX) { + if ((unsigned char) *p < SINGLE_BYTE_MAX) { return _mp_util_get_single(p); } return _mp_util_get_multi(_mp_util_utf8_to_ucs2(p)); } -const char * -mp_util_get_second_index(const char *p) +const char *mp_util_get_second_index(const char *p) { unsigned short u2; @@ -292,7 +285,7 @@ mp_util_get_second_index(const char *p) return NULL; } - if ((unsigned char)*p < SINGLE_BYTE_MAX) { + if ((unsigned char) *p < SINGLE_BYTE_MAX) { return mp_util_get_index(_mp_util_get_next_char(p)); } @@ -304,22 +297,22 @@ mp_util_get_second_index(const char *p) return mp_util_get_index(_mp_util_get_next_char(p)); } -bool -mp_util_add_to_playlist_by_key(int playlist_id, char *key_id) +bool mp_util_add_to_playlist_by_key(int playlist_id, char *key_id) { int err; { err = mp_media_info_playlist_add_media(playlist_id, key_id); if (err != 0) { - ERROR_TRACE("Error in mp_media_info_playlist_add_media (%d)\n", err); + ERROR_TRACE("Error in mp_media_info_playlist_add_media (%d)\n", + err); return FALSE; } } return TRUE; } -Evas_Object * -mp_util_create_image(Evas_Object * obj, const char *path, const char *group, int w, int h) +Evas_Object *mp_util_create_image(Evas_Object * obj, const char *path, + const char *group, int w, int h) { MP_CHECK_NULL(obj); @@ -334,18 +327,20 @@ mp_util_create_image(Evas_Object * obj, const char *path, const char *group, int int path_allocated = 0; if (!path) { - char default_thumbnail[1024] = {0}; + char default_thumbnail[1024] = { 0 }; char *shared_path = app_get_shared_resource_path(); - snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, "shared_images", DEFAULT_THUMBNAIL); + snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, + "shared_images", DEFAULT_THUMBNAIL); free(shared_path); path = g_strdup(default_thumbnail); path_allocated = 1; } - char mp_image_path[1024] = {0}; + char mp_image_path[1024] = { 0 }; char *shared_path = app_get_shared_resource_path(); if (shared_path) { - snprintf(mp_image_path, 1024, "%s%s", shared_path, "shared_images/play_icon_shuffle.png"); + snprintf(mp_image_path, 1024, "%s%s", shared_path, + "shared_images/play_icon_shuffle.png"); free(shared_path); DEBUG_TRACE("Shuffle Icon path is: %s", mp_image_path); elm_image_file_set(image, mp_image_path, NULL); @@ -359,14 +354,15 @@ mp_util_create_image(Evas_Object * obj, const char *path, const char *group, int elm_image_resizable_set(image, EINA_TRUE, EINA_TRUE); evas_object_size_hint_align_set(image, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(image, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(image, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); evas_object_show(image); return image; } -Evas_Object * -mp_util_create_thumb_icon(Evas_Object * obj, const char *path, int w, int h) +Evas_Object *mp_util_create_thumb_icon(Evas_Object * obj, const char *path, + int w, int h) { Evas_Object *thumbnail = elm_image_add(obj); if (w == h) { @@ -375,37 +371,42 @@ mp_util_create_thumb_icon(Evas_Object * obj, const char *path, int w, int h) elm_image_aspect_fixed_set(thumbnail, EINA_TRUE); } - if ((!path) || !g_file_test(path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR) || !strcmp(BROKEN_ALBUMART_IMAGE_PATH, path)) { - char default_thumbnail[1024] = {0}; + if ((!path) + || !g_file_test(path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR) + || !strcmp(BROKEN_ALBUMART_IMAGE_PATH, path)) { + char default_thumbnail[1024] = { 0 }; char *shared_path = app_get_shared_resource_path(); - snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, "shared_images", DEFAULT_THUMBNAIL); + snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, + "shared_images", DEFAULT_THUMBNAIL); free(shared_path); path = g_strdup(default_thumbnail); } elm_image_file_set(thumbnail, path, NULL); - evas_object_size_hint_align_set(thumbnail, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(thumbnail, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(thumbnail, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_size_hint_weight_set(thumbnail, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); evas_object_show(thumbnail); return thumbnail; } -Evas_Object * -mp_util_create_lazy_update_thumb_icon(Evas_Object * obj, const char *path, int w, int h) +Evas_Object *mp_util_create_lazy_update_thumb_icon(Evas_Object * obj, + const char *path, int w, + int h) { return mp_util_create_thumb_icon(obj, path, w, h); } -Evas_Object * -mp_util_create_selectioninfo_with_count(void *data, int count) +Evas_Object *mp_util_create_selectioninfo_with_count(void *data, int count) { startfunc; MpView_t *view = data; MP_CHECK_NULL(view); if (count > 0) { - char *text = g_strdup_printf(GET_STR(STR_MP_SELECT_ITEMS), count); + char *text = g_strdup_printf(GET_STR(STR_MP_SELECT_ITEMS), count); mp_view_set_title(view, text); IF_FREE(text); } else { @@ -416,8 +417,7 @@ mp_util_create_selectioninfo_with_count(void *data, int count) } -void -mp_util_post_status_message(struct appdata *ad, const char *text) +void mp_util_post_status_message(struct appdata *ad, const char *text) { int ret = notification_status_message_post(text); if (ret != 0) { @@ -427,26 +427,27 @@ mp_util_post_status_message(struct appdata *ad, const char *text) } } -void -mp_util_post_add_to_playlist_popup_message(int count) +void mp_util_post_add_to_playlist_popup_message(int count) { MP_CHECK(count > 0); int ret = 0; char *message = NULL; if (count > 1) { - message = g_strdup_printf(GET_STR(STR_MP_POP_ADDED_TO_PLAYLIST), count); + message = + g_strdup_printf(GET_STR(STR_MP_POP_ADDED_TO_PLAYLIST), count); ret = notification_status_message_post(message); IF_FREE(message); } else if (count == 1) { - ret = notification_status_message_post(GET_STR(STR_MP_POP_ADDED_1_TO_PLAYLIST)); + ret = + notification_status_message_post(GET_STR + (STR_MP_POP_ADDED_1_TO_PLAYLIST)); } if (ret != 0) { ERROR_TRACE("notification_status_message_post()... [0x%x]", ret); } } -int -mp_util_share_via_email(const char *formed_path, void *data) +int mp_util_share_via_email(const char *formed_path, void *data) { if (mp_ug_email_attatch_file(formed_path, data)) { return -1; @@ -455,12 +456,14 @@ mp_util_share_via_email(const char *formed_path, void *data) return 0; } -char * -mp_util_get_new_playlist_name(void) +char *mp_util_get_new_playlist_name(void) { char unique_name[MP_PLAYLIST_NAME_SIZE] = "\0"; int ret = 0; - ret = mp_media_info_playlist_unique_name(GET_STR(STR_MP_MY_PLAYLIST), unique_name, MP_PLAYLIST_NAME_SIZE); + ret = + mp_media_info_playlist_unique_name(GET_STR(STR_MP_MY_PLAYLIST), + unique_name, + MP_PLAYLIST_NAME_SIZE); if (ret == 0) { if (strlen(unique_name) <= 0) { ERROR_TRACE("playlist name is NULL"); @@ -469,7 +472,9 @@ mp_util_get_new_playlist_name(void) return g_strdup(unique_name); } } else { - ERROR_TRACE("fail to mp_media_info_playlist_unique_name() : error code [%x] ", ret); + ERROR_TRACE + ("fail to mp_media_info_playlist_unique_name() : error code [%x] ", + ret); return NULL; } @@ -523,8 +528,7 @@ mp_util_delete_track(void *data, char *fid, char *file_path) return MP_FILE_DELETE_ERR_NONE; } -int -mp_util_file_is_in_phone_memory(const char *path) +int mp_util_file_is_in_phone_memory(const char *path) { MP_CHECK_VAL(path, 0); int phone_len = 0; @@ -546,8 +550,8 @@ mp_util_file_is_in_phone_memory(const char *path) } // return value must be freed. -char * -mp_util_isf_get_edited_str(Evas_Object * isf_entry, bool permit_first_blank) +char *mp_util_isf_get_edited_str(Evas_Object * isf_entry, + bool permit_first_blank) { const char *buf = NULL; @@ -574,13 +578,15 @@ mp_util_isf_get_edited_str(Evas_Object * isf_entry, bool permit_first_blank) return strdup(""); } - if (strip_msg[strip_len - 1] == '\n' || strip_msg[strip_len - 1] == '\r') { + if (strip_msg[strip_len - 1] == '\n' + || strip_msg[strip_len - 1] == '\r') { strip_msg[strip_len - 1] = '\0'; } DEBUG_TRACE("===== The new edited str = %s", strip_msg); return strip_msg; } else { - DEBUG_TRACE(" strip_msg length is [%d], strip_msg [%s]", strip_len, strip_msg); + DEBUG_TRACE(" strip_msg length is [%d], strip_msg [%s]", + strip_len, strip_msg); return strip_msg; } } else { @@ -589,36 +595,38 @@ mp_util_isf_get_edited_str(Evas_Object * isf_entry, bool permit_first_blank) } } -bool -mp_util_set_screen_mode(void *data, int mode) +bool mp_util_set_screen_mode(void *data, int mode) { struct appdata *ad = data; ad->current_appcore_rm = mode; //set current appcore rm - elm_win_screen_size_get(ad->win_main, NULL, NULL, &ad->screen_width, &ad->screen_height); + elm_win_screen_size_get(ad->win_main, NULL, NULL, &ad->screen_width, + &ad->screen_height); - if (mode == APP_DEVICE_ORIENTATION_270 || mode == APP_DEVICE_ORIENTATION_90) { + if (mode == APP_DEVICE_ORIENTATION_270 + || mode == APP_DEVICE_ORIENTATION_90) { ad->screen_mode = MP_SCREEN_MODE_LANDSCAPE; mp_debug("Set MP_SCREEN_MODE_LANDSCAPE"); - } else if (mode == APP_DEVICE_ORIENTATION_0 || mode == APP_DEVICE_ORIENTATION_180) { + } else if (mode == APP_DEVICE_ORIENTATION_0 + || mode == APP_DEVICE_ORIENTATION_180) { ad->screen_mode = MP_SCREEN_MODE_PORTRAIT; mp_debug("Set MP_SCREEN_MODE_PORTRAIT"); } return true; } -void mp_to_lower(char *str) { +void mp_to_lower(char *str) +{ int i = 0; - while(str[i] != '\0') { + while (str[i] != '\0') { if (str[i] >= 'A' && str[i] <= 'Z') { str[i] = str[i] + 32; } - i++; + i++; } } -bool -mp_check_file_exist(const char *path) +bool mp_check_file_exist(const char *path) { if (path == NULL || strlen(path) == 0) { return FALSE; @@ -635,13 +643,16 @@ mp_check_file_exist(const char *path) IF_G_FREE(temp_path); if (strstr(path, MP_FILE_PREFIX)) { - if (!g_file_test(path + strlen(MP_FILE_PREFIX), G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) { + if (!g_file_test + (path + strlen(MP_FILE_PREFIX), + G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) { ERROR_TRACE("file not exist: %s", path); return FALSE; } return TRUE; } else { - if (!g_file_test(path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) { + if (!g_file_test + (path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) { ERROR_TRACE("file not exist: %s", path); return FALSE; } @@ -650,7 +661,9 @@ mp_check_file_exist(const char *path) return TRUE; } -bool mp_util_text_multiline_check(Evas_Object *obj, const char*text, const char*textstyle, int text_width, int text_height) +bool mp_util_text_multiline_check(Evas_Object * obj, const char *text, + const char *textstyle, int text_width, + int text_height) { MP_CHECK_FALSE(obj); Evas_Object *tb; @@ -681,7 +694,7 @@ bool mp_util_text_multiline_check(Evas_Object *obj, const char*text, const char* evas_object_resize(tb, text_width, 1000); evas_object_textblock_size_formatted_get(tb, &ww, &hh); -END: + END: IF_FREE(strbuf); mp_evas_object_del(tb); @@ -735,7 +748,7 @@ bool mp_util_file_playable(const char *uri) return res; } -char * mp_util_file_mime_type_get(const char *uri) +char *mp_util_file_mime_type_get(const char *uri) { int retcode = -1; char *mime = NULL; @@ -749,7 +762,8 @@ char * mp_util_file_mime_type_get(const char *uri) retcode = mime_type_get_mime_type(file_ext, &mime); if ((mime == NULL) || (retcode != MIME_TYPE_ERROR_NONE)) { free(file_ext); - WARN_TRACE("Fail to get mime type with return value [%d]", retcode); + WARN_TRACE("Fail to get mime type with return value [%d]", + retcode); return NULL; } if (file_ext) { @@ -758,8 +772,7 @@ char * mp_util_file_mime_type_get(const char *uri) return mime; } -bool -mp_util_launch_browser(const char *url, struct appdata * ad) +bool mp_util_launch_browser(const char *url, struct appdata * ad) { app_control_h service; @@ -769,7 +782,8 @@ mp_util_launch_browser(const char *url, struct appdata * ad) app_control_set_app_id(service, "com.samsung.browser"); app_control_set_uri(service, url); - if (app_control_send_launch_request(service, NULL, NULL) == APP_CONTROL_ERROR_NONE) { + if (app_control_send_launch_request(service, NULL, NULL) == + APP_CONTROL_ERROR_NONE) { DEBUG_TRACE("Succeeded to launch a calculator app."); res = true; } else { @@ -783,8 +797,7 @@ mp_util_launch_browser(const char *url, struct appdata * ad) //korean initial consonant -gunichar -mp_util_get_utf8_initial_value(const char *name) +gunichar mp_util_get_utf8_initial_value(const char *name) { gunichar first; char *next = NULL; @@ -796,17 +809,19 @@ mp_util_get_utf8_initial_value(const char *name) first = g_utf8_get_char_validated(name, g_utf8_strlen(name, -1)); if (first == (gunichar) - 1 || first == (gunichar) - 2) { - DEBUG_TRACE("failed to convert a sequence of bytes encoded as UTF-8 to a Unicode character."); + DEBUG_TRACE + ("failed to convert a sequence of bytes encoded as UTF-8 to a Unicode character."); return 0; } - next = (char *)name; + next = (char *) name; while (!g_unichar_isgraph(first)) { next = g_utf8_next_char(next); first = g_utf8_get_char_validated(next, g_utf8_strlen(name, -1)); if (first == (gunichar) - 1 || first == (gunichar) - 2) { - DEBUG_TRACE("failed to convert a sequence of bytes encoded as UTF-8 to a Unicode character."); + DEBUG_TRACE + ("failed to convert a sequence of bytes encoded as UTF-8 to a Unicode character."); return 0; } } @@ -816,11 +831,12 @@ mp_util_get_utf8_initial_value(const char *name) int index = 0; index = ((((first - 0xAC00) - ((first - 0xAC00) % 28)) / 28) / 21); if (index < 20 && index >= 0) { - const gunichar chosung[20] = { 0x3131, 0x3132, 0x3134, 0x3137, 0x3138, - 0x3139, 0x3141, 0x3142, 0x3143, 0x3145, - 0x3146, 0x3147, 0x3148, 0x3149, 0x314a, - 0x314b, 0x314c, 0x314d, 0x314e, 0 - }; + const gunichar chosung[20] = { + 0x3131, 0x3132, 0x3134, 0x3137, 0x3138, + 0x3139, 0x3141, 0x3142, 0x3143, 0x3145, + 0x3146, 0x3147, 0x3148, 0x3149, 0x314a, + 0x314b, 0x314c, 0x314d, 0x314e, 0 + }; return chosung[index]; } @@ -831,8 +847,7 @@ mp_util_get_utf8_initial_value(const char *name) } -char * -mp_util_get_title_from_path(const char *path) +char *mp_util_get_title_from_path(const char *path) { gchar *file_ext = NULL, *file_name = NULL, *title = NULL; @@ -844,7 +859,8 @@ mp_util_get_title_from_path(const char *path) if (file_name) { file_ext = g_strrstr(file_name, "."); if (file_ext) { - title = g_strndup(file_name, strlen(file_name) - strlen(file_ext)); + title = + g_strndup(file_name, strlen(file_name) - strlen(file_ext)); } free(file_name); } @@ -852,8 +868,7 @@ mp_util_get_title_from_path(const char *path) return title; } -bool -mp_util_is_playlist_name_valid(char *name) +bool mp_util_is_playlist_name_valid(char *name) { MP_CHECK_FALSE(name); @@ -867,7 +882,8 @@ mp_util_is_playlist_name_valid(char *name) } int -mp_util_create_playlist(struct appdata *ad, char *name, mp_playlist_h *playlist_handle) +mp_util_create_playlist(struct appdata *ad, char *name, + mp_playlist_h * playlist_handle) { MP_CHECK_VAL(ad, -1); MP_CHECK_VAL(name, -1); @@ -875,7 +891,9 @@ mp_util_create_playlist(struct appdata *ad, char *name, mp_playlist_h *playlist_ int plst_uid = -1; if (!mp_util_is_playlist_name_valid(name)) { - mp_widget_text_popup(ad, GET_STR("IDS_MUSIC_POP_UNABLE_CREATE_PLAYLIST")); + mp_widget_text_popup(ad, + GET_STR + ("IDS_MUSIC_POP_UNABLE_CREATE_PLAYLIST")); return -1; } @@ -883,21 +901,27 @@ mp_util_create_playlist(struct appdata *ad, char *name, mp_playlist_h *playlist_ int ret = mp_media_info_playlist_is_exist(name, &exist); if (ret != 0) { ERROR_TRACE("Fail to get playlist count by name: %d", ret); - mp_widget_text_popup(ad, GET_STR("IDS_MUSIC_POP_UNABLE_CREATE_PLAYLIST")); + mp_widget_text_popup(ad, + GET_STR + ("IDS_MUSIC_POP_UNABLE_CREATE_PLAYLIST")); return -1; } if (exist) { - char *text = g_strdup_printf(GET_STR(STR_MP_POP_PLAYLIST_EXISTS), name); + char *text = + g_strdup_printf(GET_STR(STR_MP_POP_PLAYLIST_EXISTS), name); mp_widget_text_popup(ad, text); IF_FREE(text); return -1; } - ret = mp_media_info_playlist_insert_to_db(name, &plst_uid, playlist_handle); + ret = + mp_media_info_playlist_insert_to_db(name, &plst_uid, + playlist_handle); if (ret != 0) { ERROR_TRACE("Fail to get playlist count by name: %d", ret); - mp_widget_text_popup(ad, GET_SYS_STR("IDS_COM_BODY_UNABLE_TO_ADD")); + mp_widget_text_popup(ad, + GET_SYS_STR("IDS_COM_BODY_UNABLE_TO_ADD")); *playlist_handle = NULL; return -1; } @@ -905,23 +929,22 @@ mp_util_create_playlist(struct appdata *ad, char *name, mp_playlist_h *playlist_ return plst_uid; } -void -mp_util_reset_genlist_mode_item(Evas_Object *genlist) +void mp_util_reset_genlist_mode_item(Evas_Object * genlist) { MP_CHECK(genlist); Elm_Object_Item *gl_item = - (Elm_Object_Item *)elm_genlist_decorated_item_get(genlist); + (Elm_Object_Item *) elm_genlist_decorated_item_get(genlist); if (gl_item) { elm_genlist_item_decorate_mode_set(gl_item, "slide", EINA_FALSE); - elm_genlist_item_select_mode_set(gl_item, ELM_OBJECT_SELECT_MODE_DEFAULT); + elm_genlist_item_select_mode_set(gl_item, + ELM_OBJECT_SELECT_MODE_DEFAULT); mp_list_item_data_t *item_data = elm_object_item_data_get(gl_item); MP_CHECK(item_data); item_data->checked = true; } } -bool -mp_util_is_image_valid(Evas *evas, const char *path) +bool mp_util_is_image_valid(Evas * evas, const char *path) { if (!path) { return false; @@ -957,8 +980,7 @@ mp_util_is_image_valid(Evas *evas, const char *path) #define MP_PATH_INFO_SEP "/" #define MP_PATH_INFO_RETRENCH 128 -bool -mp_util_is_string_elipsized(char *path) +bool mp_util_is_string_elipsized(char *path) { MP_CHECK_FALSE(path); if (strlen(path) < MP_PATH_INFO_MAX_LENGTH) { @@ -970,7 +992,8 @@ mp_util_is_string_elipsized(char *path) char *mp_util_path_info_retrench(const char *string) { - mp_retvm_if(string == NULL, g_strdup(MP_PATH_INFO_TRANS_OMIT), "input path is NULL"); + mp_retvm_if(string == NULL, g_strdup(MP_PATH_INFO_TRANS_OMIT), + "input path is NULL"); char *retrench = NULL; if (strlen(string) > MP_PATH_INFO_LEN_THRESHOLD) { char *utf8_string = elm_entry_utf8_to_markup(string); @@ -980,7 +1003,8 @@ char *mp_util_path_info_retrench(const char *string) if (retrench) { g_utf8_strncpy(retrench, utf8_string, 2); char *temp = retrench; - retrench = g_strconcat(retrench, MP_PATH_INFO_TRANS_OMIT, NULL); + retrench = + g_strconcat(retrench, MP_PATH_INFO_TRANS_OMIT, NULL); free(utf8_string); free(temp); } else { @@ -996,13 +1020,12 @@ char *mp_util_path_info_retrench(const char *string) return retrench; } -char * -mp_util_shorten_path(char *path_info) +char *mp_util_shorten_path(char *path_info) { int start = 0; gchar **params = NULL; int count = 0; -// int len; +// int len; int i = 0; int j = 0; char *output = NULL; @@ -1029,10 +1052,10 @@ mp_util_shorten_path(char *path_info) } MP_CHECK_EXCEP(output); - for (i = start ; i < count; i++) { + for (i = start; i < count; i++) { base = g_strdup(output); MP_CHECK_EXCEP(base); - for (j = i ; j < count; j++) { + for (j = i; j < count; j++) { temp = g_strconcat(base, MP_PATH_INFO_SEP, params[j], NULL); IF_FREE(base); base = temp; @@ -1059,7 +1082,7 @@ mp_util_shorten_path(char *path_info) exception = false; -mp_exception: + mp_exception: if (params) { @@ -1075,11 +1098,11 @@ mp_exception: } } -bool -mp_util_is_earjack_inserted(void) +bool mp_util_is_earjack_inserted(void) { int value; - if (runtime_info_get_value_int(RUNTIME_INFO_KEY_AUDIO_JACK_STATUS, &value)) { + if (runtime_info_get_value_int + (RUNTIME_INFO_KEY_AUDIO_JACK_STATUS, &value)) { DEBUG_TRACE("Failed to get ear jack status"); return false; } @@ -1091,8 +1114,7 @@ mp_util_is_earjack_inserted(void) } } -void -mp_util_get_sound_path(mp_snd_path *snd_path) +void mp_util_get_sound_path(mp_snd_path * snd_path) { //Replaced for _prod dependency start sound_device_h device; @@ -1101,7 +1123,9 @@ mp_util_get_sound_path(mp_snd_path *snd_path) sound_device_mask_e g_device_mask = SOUND_DEVICE_IO_DIRECTION_OUT_MASK; WARN_TRACE("Enter sound_manager_get_active_device"); int ret; - if ((ret = sound_manager_get_current_device_list(g_device_mask, &g_device_list))) { + if ((ret = + sound_manager_get_current_device_list(g_device_mask, + &g_device_list))) { ERROR_TRACE("sound_manager_get_active_device()... [0x%x]", ret); } @@ -1139,18 +1163,18 @@ mp_util_get_sound_path(mp_snd_path *snd_path) } #define DEF_BUF_LEN (512) -const char * -mp_util_search_markup_keyword(const char *string, char *searchword, bool *result) +const char *mp_util_search_markup_keyword(const char *string, + char *searchword, bool * result) { - char pstr[DEF_BUF_LEN + 1] = {0,}; + char pstr[DEF_BUF_LEN + 1] = { 0, }; static char return_string[DEF_BUF_LEN + 1] = { 0, }; int word_len = 0; int search_len = 0; int i = 0; bool found = false; - gchar* markup_text_start = NULL; - gchar* markup_text_end = NULL; - gchar* markup_text = NULL; + gchar *markup_text_start = NULL; + gchar *markup_text_end = NULL; + gchar *markup_text = NULL; MP_CHECK_NULL(string && strlen(string)); MP_CHECK_NULL(searchword && strlen(searchword)); @@ -1160,13 +1184,16 @@ mp_util_search_markup_keyword(const char *string, char *searchword, bool *result word_len = strlen(string); if (word_len > DEF_BUF_LEN) { - char *temp = (char*)calloc((word_len + 1), sizeof(char)); + char *temp = (char *) calloc((word_len + 1), sizeof(char)); MP_CHECK_NULL(temp); strncpy(temp, string, strlen(string)); i = 0; while (word_len > DEF_BUF_LEN) { - /*truncate uft8 to byte_size DEF_BUF_LEN*/ - gchar *pre_ch = g_utf8_find_prev_char(temp, (temp + DEF_BUF_LEN - 1 - i * 3)); + /*truncate uft8 to byte_size DEF_BUF_LEN */ + gchar *pre_ch = + g_utf8_find_prev_char(temp, + (temp + DEF_BUF_LEN - 1 - + i * 3)); if (!pre_ch) { break; } @@ -1174,7 +1201,7 @@ mp_util_search_markup_keyword(const char *string, char *searchword, bool *result if (!next_ch) { break; } - /*truncate position*/ + /*truncate position */ *next_ch = '\0'; word_len = strlen(temp); i++; @@ -1211,17 +1238,18 @@ mp_util_search_markup_keyword(const char *string, char *searchword, bool *result if (i == 0) { markup_text = g_markup_escape_text(&pstr[0], search_len); MP_CHECK_NULL(markup_text); - markup_text_end = g_markup_escape_text(&pstr[search_len], word_len - search_len); + markup_text_end = + g_markup_escape_text(&pstr[search_len], + word_len - search_len); if (!markup_text_end) { IF_FREE(markup_text); ERROR_TRACE("markup_text_end NULL !!!"); return NULL; } snprintf(return_string, - DEF_BUF_LEN, - "%s%s", r, g, b, a, - markup_text, - (char*)markup_text_end); + DEF_BUF_LEN, + "%s%s", r, g, b, + a, markup_text, (char *) markup_text_end); IF_FREE(markup_text); IF_FREE(markup_text_end); } else { @@ -1233,7 +1261,9 @@ mp_util_search_markup_keyword(const char *string, char *searchword, bool *result ERROR_TRACE("markup_text NULL !!!"); return NULL; } - markup_text_end = g_markup_escape_text(&pstr[i + search_len], word_len - (i + search_len)); + markup_text_end = + g_markup_escape_text(&pstr[i + search_len], + word_len - (i + search_len)); if (!markup_text_end) { IF_FREE(markup_text_start); IF_FREE(markup_text); @@ -1242,12 +1272,11 @@ mp_util_search_markup_keyword(const char *string, char *searchword, bool *result } snprintf(return_string, - DEF_BUF_LEN, - "%s%s%s", - (char*)markup_text_start, - r, g, b, a, - markup_text, - (char*)markup_text_end); + DEF_BUF_LEN, + "%s%s%s", + (char *) markup_text_start, + r, g, b, a, + markup_text, (char *) markup_text_end); IF_FREE(markup_text); IF_FREE(markup_text_start); IF_FREE(markup_text_end); @@ -1261,8 +1290,7 @@ mp_util_search_markup_keyword(const char *string, char *searchword, bool *result } -bool -mp_util_is_other_player_playing(void) +bool mp_util_is_other_player_playing(void) { bool ret = FALSE; @@ -1286,15 +1314,15 @@ mp_util_is_other_player_playing(void) return ret; } -bool -mp_util_is_now_active_player(void) +bool mp_util_is_now_active_player(void) { bool ret = FALSE; struct appdata *ad = mp_util_get_appdata(); MP_CHECK_FALSE(ad); - if (ad->player_state == PLAY_STATE_PLAYING || ad->player_state == PLAY_STATE_PAUSED) { + if (ad->player_state == PLAY_STATE_PLAYING + || ad->player_state == PLAY_STATE_PAUSED) { int pid = mp_setting_get_nowplaying_id(); if (pid != -1) { if (pid == 0 || pid == getpid()) { @@ -1308,41 +1336,40 @@ mp_util_is_now_active_player(void) return ret; } -int -mp_commmon_check_rotate_lock(void) +int mp_commmon_check_rotate_lock(void) { bool lock = FALSE; int retcode = -1; - retcode = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO, &lock); + retcode = + system_settings_get_value_bool + (SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO, &lock); if (retcode == SYSTEM_SETTINGS_ERROR_NONE) { mp_debug("lock state: %d", lock); - return (int)lock; + return (int) lock; } else { - ERROR_TRACE("Could not get the lock state.Invalid parameter return [%d]", retcode); + ERROR_TRACE + ("Could not get the lock state.Invalid parameter return [%d]", + retcode); return -1; } } -int -mp_check_mass_storage_mode(void) +int mp_check_mass_storage_mode(void) { return 0; } -bool -mp_util_sleep_lock_set(bool lock, bool force_unlock) +bool mp_util_sleep_lock_set(bool lock, bool force_unlock) { return TRUE; } -bool -mp_util_is_nfc_feature_on(void) +bool mp_util_is_nfc_feature_on(void) { return false; } -void -mp_util_strncpy_safe(char *x_dst, const char *x_src, int max_len) +void mp_util_strncpy_safe(char *x_dst, const char *x_src, int max_len) { if (!x_src || strlen(x_src) == 0) { mp_error("x_src is NULL"); @@ -1358,8 +1385,7 @@ mp_util_strncpy_safe(char *x_dst, const char *x_src, int max_len) x_dst[max_len - 1] = '\0'; } -void -mp_util_free_track_info(mp_track_info_t *track_info) +void mp_util_free_track_info(mp_track_info_t * track_info) { if (!track_info) { return; @@ -1386,7 +1412,8 @@ mp_util_free_track_info(mp_track_info_t *track_info) } void -mp_util_load_track_info(struct appdata *ad, mp_plst_item *cur_item, mp_track_info_t **info) +mp_util_load_track_info(struct appdata *ad, mp_plst_item * cur_item, + mp_track_info_t ** info) { MP_CHECK(ad); MP_CHECK(cur_item); @@ -1405,7 +1432,8 @@ mp_util_load_track_info(struct appdata *ad, mp_plst_item *cur_item, mp_track_inf if (!cur_item->uid) { char *media_id = NULL; - ret = mp_media_info_create_by_path(&svc_audio_item, track_info->uri); + ret = + mp_media_info_create_by_path(&svc_audio_item, track_info->uri); if (ret == 0) { mp_media_info_get_media_id(svc_audio_item, &media_id); cur_item->uid = g_strdup(media_id); @@ -1420,13 +1448,16 @@ mp_util_load_track_info(struct appdata *ad, mp_plst_item *cur_item, mp_track_inf mp_media_info_get_title(svc_audio_item, &track_info->title); mp_media_info_get_album(svc_audio_item, &track_info->album); mp_media_info_get_artist(svc_audio_item, &track_info->artist); - mp_media_info_get_thumbnail_path(svc_audio_item, &track_info->thumbnail_path); + mp_media_info_get_thumbnail_path(svc_audio_item, + &track_info->thumbnail_path); mp_media_info_get_genre(svc_audio_item, &track_info->genre); mp_media_info_get_recorded_date(svc_audio_item, &track_info->date); - mp_media_info_get_copyright(svc_audio_item, &track_info->copyright); + mp_media_info_get_copyright(svc_audio_item, + &track_info->copyright); mp_media_info_get_composer(svc_audio_item, &track_info->author); mp_media_info_get_duration(svc_audio_item, &track_info->duration); - mp_media_info_get_track_num(svc_audio_item, &track_info->track_num); + mp_media_info_get_track_num(svc_audio_item, + &track_info->track_num); mp_media_info_get_format(svc_audio_item, &track_info->format); mp_media_info_get_favorite(svc_audio_item, &track_info->favorite); mp_media_info_get_year(svc_audio_item, &track_info->year); @@ -1466,15 +1497,18 @@ mp_util_load_track_info(struct appdata *ad, mp_plst_item *cur_item, mp_track_inf GString *format = g_string_new(""); if (format) { if (tag_info.audio_bitrate > 0) { - g_string_append_printf(format, "%dbps ", tag_info.audio_bitrate); + g_string_append_printf(format, "%dbps ", + tag_info.audio_bitrate); } if (tag_info.audio_samplerate > 0) { - g_string_append_printf(format, "%.1fHz ", (double)tag_info.audio_samplerate); + g_string_append_printf(format, "%.1fHz ", + (double) tag_info.audio_samplerate); } if (tag_info.audio_channel > 0) { - g_string_append_printf(format, "%dch", tag_info.audio_channel); + g_string_append_printf(format, "%dch", + tag_info.audio_channel); } track_info->format = g_strdup(format->str); @@ -1500,7 +1534,10 @@ mp_util_load_track_info(struct appdata *ad, mp_plst_item *cur_item, mp_track_inf } void -mp_util_append_media_list_item_to_playlist(mp_plst_mgr *playlist_mgr, mp_media_list_h media_list, int count, int current_index, const char *path) +mp_util_append_media_list_item_to_playlist(mp_plst_mgr * playlist_mgr, + mp_media_list_h media_list, + int count, int current_index, + const char *path) { int i; char *uid = NULL; @@ -1517,7 +1554,9 @@ mp_util_append_media_list_item_to_playlist(mp_plst_mgr *playlist_mgr, mp_media_l mp_media_info_get_file_path(item, &uri); mp_media_info_get_title(item, &title); mp_media_info_get_artist(item, &artist); - plst_item = mp_playlist_mgr_item_append(playlist_mgr, uri, uid, title, artist, track_type); + plst_item = + mp_playlist_mgr_item_append(playlist_mgr, uri, uid, title, + artist, track_type); if (i == current_index || !g_strcmp0(uri, path)) { cur_item = plst_item; } @@ -1526,7 +1565,8 @@ mp_util_append_media_list_item_to_playlist(mp_plst_mgr *playlist_mgr, mp_media_l } -char* mp_util_get_fid_by_full_path(const char *full_path, char **title, char **artist) +char *mp_util_get_fid_by_full_path(const char *full_path, char **title, + char **artist) { startfunc; @@ -1563,9 +1603,10 @@ static inline const char *_mp_util_get_text_domain(const char *string_id) if (string_id) { #ifdef STORE_DOMAIN_NAME - else if (strstr(string_id, "IDS_MH") || strstr(string_id, "IDS_IS")) { - domain = STORE_DOMAIN_NAME; - } + else + if (strstr(string_id, "IDS_MH") || strstr(string_id, "IDS_IS")) { + domain = STORE_DOMAIN_NAME; + } #endif } @@ -1580,7 +1621,8 @@ EXPORT_API char *mp_util_get_text(const char *str) return dgettext(domain_name, str); } -void mp_util_more_btn_move_ctxpopup(Evas_Object *ctxpopup, Evas_Object *btn) +void mp_util_more_btn_move_ctxpopup(Evas_Object * ctxpopup, + Evas_Object * btn) { MP_CHECK(ctxpopup); struct appdata *ad = mp_util_get_appdata(); @@ -1609,7 +1651,8 @@ void mp_util_more_btn_move_ctxpopup(Evas_Object *ctxpopup, Evas_Object *btn) } } -void mp_util_object_item_translate_set(Elm_Object_Item *item, const char *ID) +void mp_util_object_item_translate_set(Elm_Object_Item * item, + const char *ID) { MP_CHECK(ID); MP_CHECK(item); @@ -1617,30 +1660,38 @@ void mp_util_object_item_translate_set(Elm_Object_Item *item, const char *ID) elm_object_item_domain_text_translatable_set(item, domain, EINA_TRUE); } -Elm_Object_Item * -mp_util_ctxpopup_item_append_ext(Evas_Object *obj, const char *label, const char *file, - const char *group, Evas_Smart_Cb func, - const void *data) +Elm_Object_Item *mp_util_ctxpopup_item_append_ext(Evas_Object * obj, + const char *label, + const char *file, + const char *group, + Evas_Smart_Cb func, + const void *data) { - Elm_Object_Item *item = elm_ctxpopup_item_append(obj, label, NULL, func, data); + Elm_Object_Item *item = + elm_ctxpopup_item_append(obj, label, NULL, func, data); MP_CHECK_NULL(item); mp_util_object_item_translate_set(item, label); return item; } -Elm_Object_Item * -mp_util_ctxpopup_item_append(Evas_Object *obj, const char *label, - const char *group, Evas_Smart_Cb func, - const void *data) +Elm_Object_Item *mp_util_ctxpopup_item_append(Evas_Object * obj, + const char *label, + const char *group, + Evas_Smart_Cb func, + const void *data) { - return mp_util_ctxpopup_item_append_ext(obj, label, NULL, group, func, data); + return mp_util_ctxpopup_item_append_ext(obj, label, NULL, group, func, + data); } -Elm_Object_Item *mp_util_toolbar_item_append(Evas_Object *obj, const char *icon, - const char *label, Evas_Smart_Cb func, - const void *data) +Elm_Object_Item *mp_util_toolbar_item_append(Evas_Object * obj, + const char *icon, + const char *label, + Evas_Smart_Cb func, + const void *data) { - Elm_Object_Item *item = elm_toolbar_item_append(obj, icon, label, func, data); + Elm_Object_Item *item = + elm_toolbar_item_append(obj, icon, label, func, data); MP_CHECK_NULL(item); const char *domain = _mp_util_get_text_domain(label); @@ -1648,19 +1699,18 @@ Elm_Object_Item *mp_util_toolbar_item_append(Evas_Object *obj, const char *icon, return item; } -Elm_Object_Item *mp_util_toolbar_nth_item(Evas_Object *obj, int n) +Elm_Object_Item *mp_util_toolbar_nth_item(Evas_Object * obj, int n) { MP_CHECK_NULL(obj); Elm_Object_Item *it = elm_toolbar_first_item_get(obj); int i = 0; for (i = 0; i < n; i++) { - it = elm_toolbar_item_next_get(it); + it = elm_toolbar_item_next_get(it); } return it; } -bool -mp_util_get_sip_state(void) +bool mp_util_get_sip_state(void) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK_FALSE(ad); @@ -1668,8 +1718,7 @@ mp_util_get_sip_state(void) return ad->sip_state; } -bool -mp_util_is_landscape(void) +bool mp_util_is_landscape(void) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK_FALSE(ad); @@ -1677,8 +1726,7 @@ mp_util_is_landscape(void) return (ad->win_angle == 90 || ad->win_angle == -90) ? true : false; } -int -mp_util_parse_device_type(const char *name) +int mp_util_parse_device_type(const char *name) { MP_CHECK_VAL(name, MP_DEVICE_TYPE_UNKNOWN); @@ -1688,9 +1736,9 @@ mp_util_parse_device_type(const char *name) } else { return MP_DEVICE_TYPE_UNKNOWN; } - char * str = NULL; - p = g_strdup(p); /* strtok make string dirty */ - char *device = strtok_r(p, "]" , &str); + char *str = NULL; + p = g_strdup(p); /* strtok make string dirty */ + char *device = strtok_r(p, "]", &str); int type = MP_DEVICE_TYPE_UNKNOWN; if (!g_strcmp0(device, "TV")) { type = MP_DEVICE_TYPE_TV; @@ -1708,17 +1756,19 @@ mp_util_parse_device_type(const char *name) return type; } -void -mp_util_set_livebox_update_timer(void) +void mp_util_set_livebox_update_timer(void) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); - DEBUG_TRACE("ad->is_lcd_off[%d] ad->is_focus_out[%d] ad->app_is_foreground[%d] ", ad->is_lcd_off, ad->is_focus_out, ad->app_is_foreground); + DEBUG_TRACE + ("ad->is_lcd_off[%d] ad->is_focus_out[%d] ad->app_is_foreground[%d] ", + ad->is_lcd_off, ad->is_focus_out, ad->app_is_foreground); if (ad->live_pos_timer) { if (ad->is_focus_out && !ad->app_is_foreground) { - if (!ad->is_lcd_off && mp_player_mgr_get_state() == PLAYER_STATE_PLAYING) { + if (!ad->is_lcd_off + && mp_player_mgr_get_state() == PLAYER_STATE_PLAYING) { WARN_TRACE("thaw livebox pos timer"); MP_TIMER_THAW(ad->live_pos_timer); return; @@ -1739,7 +1789,7 @@ static Eina_Bool _print_geometry_cb(void *data) return false; } -void mp_util_print_geometry(Evas_Object *obj, const char *name) +void mp_util_print_geometry(Evas_Object * obj, const char *name) { ecore_timer_add(3, _print_geometry_cb, obj); evas_object_data_set(obj, "obj_name", name); @@ -1786,8 +1836,7 @@ void mp_util_hide_lock_screen() } } -bool -mp_util_app_resume(void) +bool mp_util_app_resume(void) { char *app_id = NULL; int ret = app_get_id(&app_id); @@ -1819,8 +1868,7 @@ mp_util_app_resume(void) return true; } -bool -mp_util_system_volume_popup_show(void) +bool mp_util_system_volume_popup_show(void) { bool ret = false; app_control_h service = NULL; @@ -1852,7 +1900,7 @@ mp_util_system_volume_popup_show(void) ret = true; -END: + END: if (service) { app_control_destroy(service); } @@ -1860,28 +1908,28 @@ END: return ret; } -bool -mp_util_is_call_connected(void) +bool mp_util_is_call_connected(void) { telephony_call_state_e state; telephony_handle_list_s tel_list; int tel_valid = telephony_init(&tel_list); if (tel_valid != 0) { - ERROR_TRACE("telephony is not initialized. ERROR Code is %d", tel_valid); + ERROR_TRACE("telephony is not initialized. ERROR Code is %d", + tel_valid); return false; } telephony_h *newhandle = tel_list.handle; - int error = telephony_call_get_voice_call_state(*newhandle , &state); + int error = telephony_call_get_voice_call_state(*newhandle, &state); telephony_deinit(&tel_list); if (error == TELEPHONY_ERROR_NONE) { if (state == TELEPHONY_CALL_STATE_IDLE) { - return false; /*There exists no calls*/ + return false; /*There exists no calls */ } - /* There exists at least one call that is dialing, alerting or incoming*/ + /* There exists at least one call that is dialing, alerting or incoming */ return true; } else { ERROR_TRACE("ERROR: state error is %d", error); @@ -1890,27 +1938,37 @@ mp_util_is_call_connected(void) return false; } -void mp_util_domain_translatable_text_set(Evas_Object *obj, const char* text) +void mp_util_domain_translatable_text_set(Evas_Object * obj, + const char *text) { const char *domain = _mp_util_get_text_domain(text); elm_object_domain_translatable_text_set(obj, domain, text); } -void mp_util_domain_translatable_part_text_set(Evas_Object *obj, const char* part, const char* text) +void mp_util_domain_translatable_part_text_set(Evas_Object * obj, + const char *part, + const char *text) { const char *domain = _mp_util_get_text_domain(text); elm_object_domain_translatable_part_text_set(obj, part, domain, text); } -void mp_util_item_domain_translatable_part_text_set(Elm_Object_Item *item, const char* part, const char* text) +void mp_util_item_domain_translatable_part_text_set(Elm_Object_Item * item, + const char *part, + const char *text) { const char *domain = _mp_util_get_text_domain(text); - char * text_id = elm_entry_utf8_to_markup(text); - elm_object_item_domain_translatable_part_text_set(item, part, domain, text_id); + char *text_id = elm_entry_utf8_to_markup(text); + elm_object_item_domain_translatable_part_text_set(item, part, domain, + text_id); IF_FREE(text_id); } -bool mp_util_get_supported_storages_callback(int storageId, storage_type_e type, storage_state_e state, const char *path, void *userData) +bool mp_util_get_supported_storages_callback(int storageId, + storage_type_e type, + storage_state_e state, + const char *path, + void *userData) { if (type == STORAGE_TYPE_EXTERNAL) { external_mmc_id = storageId; @@ -1921,11 +1979,14 @@ bool mp_util_get_supported_storages_callback(int storageId, storage_type_e type, bool mp_util_is_mmc_removed(void) { - int error = storage_foreach_device_supported(mp_util_get_supported_storages_callback, NULL); + int error = + storage_foreach_device_supported + (mp_util_get_supported_storages_callback, NULL); if (error == STORAGE_ERROR_NONE) { storage_state_e state; storage_get_state(external_mmc_id, &state); - if (state == STORAGE_STATE_REMOVED || state == STORAGE_STATE_UNMOUNTABLE) { + if (state == STORAGE_STATE_REMOVED + || state == STORAGE_STATE_UNMOUNTABLE) { return true; } } @@ -1936,7 +1997,7 @@ bool mp_util_is_mmc_removed(void) #define ELM_INTERNAL_API_ARGESFSDFEFC #include -EXPORT_API void dump_win(Evas_Object *obj, int max_depth) +EXPORT_API void dump_win(Evas_Object * obj, int max_depth) { if (evas_object_smart_type_check(obj, "elm_win") == false) { @@ -1950,11 +2011,13 @@ EXPORT_API void dump_win(Evas_Object *obj, int max_depth) Diff = 0xC4; - Eina_List **ppList = (Eina_List **)((char *)pData + ((Diff)) /* B - A */); + Eina_List **ppList = + (Eina_List **) ((char *) pData + ((Diff)) /* B - A */); Eina_List *subobjs = *ppList; DEBUG_TRACE("pData=0x%08x SubObj=0x%08x pData+C4=0x%08x SubObjCnt=%d", - pData, subobjs, (unsigned int)(pData) + (Diff), eina_list_count(subobjs)); + pData, subobjs, (unsigned int) (pData) + (Diff), + eina_list_count(subobjs)); { int x, y, w, h; @@ -1965,8 +2028,11 @@ EXPORT_API void dump_win(Evas_Object *obj, int max_depth) Eina_Bool visible = evas_object_visible_get(obj); Eina_Bool propagate = evas_object_propagate_events_get(obj); - DEBUG_TRACE("Win=%s(%s,0x%08x) %s(%d,%d,%d,%d) P%d|R%d|V%d|E%d", evas_object_name_get(obj), - elm_object_widget_type_get(obj), obj, evas_object_type_get(obj), x, y, w, h, pass, repeat, visible, propagate); + DEBUG_TRACE("Win=%s(%s,0x%08x) %s(%d,%d,%d,%d) P%d|R%d|V%d|E%d", + evas_object_name_get(obj), + elm_object_widget_type_get(obj), obj, + evas_object_type_get(obj), x, y, w, h, pass, repeat, + visible, propagate); } const Eina_List *l; @@ -1975,14 +2041,14 @@ EXPORT_API void dump_win(Evas_Object *obj, int max_depth) void *MyData = NULL; EINA_LIST_FOREACH(subobjs, l, MyData) { - child = (Evas_Object *)MyData; + child = (Evas_Object *) MyData; dump_obj(child, 0, max_depth - 1); } } -EXPORT_API void dump_obj(Evas_Object *obj, int lvl, int max_depth) +EXPORT_API void dump_obj(Evas_Object * obj, int lvl, int max_depth) { Eina_List *list = evas_object_smart_members_get(obj); @@ -2004,14 +2070,19 @@ EXPORT_API void dump_obj(Evas_Object *obj, int lvl, int max_depth) evas_object_size_hint_min_get(obj, &mW, &mH); evas_object_size_hint_max_get(obj, &MW, &MH); - DEBUG_TRACE("Obj=%s(%s,0x%08x) (%d,%d,%d,%d) m(%d,%d) M(%d,%d) P%d|R%d|V%d|E%d", evas_object_name_get(obj), evas_object_type_get(obj), obj, x, y, w, h, mW, mH, MW, MH, pass, repeat, visible, propagate); + DEBUG_TRACE + ("Obj=%s(%s,0x%08x) (%d,%d,%d,%d) m(%d,%d) M(%d,%d) P%d|R%d|V%d|E%d", + evas_object_name_get(obj), evas_object_type_get(obj), obj, x, + y, w, h, mW, mH, MW, MH, pass, repeat, visible, propagate); lvl++; } Evas_Object *data; Eina_List *l; - for (l = list, data = (Evas_Object *)eina_list_data_get(l); l; l = eina_list_next(l), data = (Evas_Object *)eina_list_data_get(l)) { + for (l = list, data = (Evas_Object *) eina_list_data_get(l); l; + l = eina_list_next(l), data = + (Evas_Object *) eina_list_data_get(l)) { int x, y, w, h; evas_object_geometry_get(data, &x, &y, &w, &h); @@ -2034,8 +2105,11 @@ EXPORT_API void dump_obj(Evas_Object *obj, int lvl, int max_depth) space[lvl * 2] = '\0'; - DEBUG_TRACE("%sObj=%s(%s,0x%08x) (%d,%d,%d,%d) m(%d,%d) M(%d,%d) P%d|R%d|V%d|E%d", - space, evas_object_name_get(data), evas_object_type_get(data), data, x, y, w, h, mW, mH, MW, MH, pass, repeat, visible, propagate); + DEBUG_TRACE + ("%sObj=%s(%s,0x%08x) (%d,%d,%d,%d) m(%d,%d) M(%d,%d) P%d|R%d|V%d|E%d", + space, evas_object_name_get(data), + evas_object_type_get(data), data, x, y, w, h, mW, mH, MW, + MH, pass, repeat, visible, propagate); } IF_FREE(space); @@ -2045,7 +2119,7 @@ EXPORT_API void dump_obj(Evas_Object *obj, int lvl, int max_depth) } } -EXPORT_API void dump_widget(Evas_Object *obj, int lvl, int max_depth) +EXPORT_API void dump_widget(Evas_Object * obj, int lvl, int max_depth) { Eina_List *list = evas_object_smart_members_get(obj); @@ -2062,14 +2136,19 @@ EXPORT_API void dump_widget(Evas_Object *obj, int lvl, int max_depth) Eina_Bool visible = evas_object_visible_get(obj); Eina_Bool propagate = evas_object_propagate_events_get(obj); - SECURE_DEBUG("Obj=%s(%s,0x%08x) (%d,%d,%d,%d) P%d|R%d|V%d|E%d", evas_object_name_get(obj), elm_object_widget_type_get(obj), obj, x, y, w, h, pass, repeat, visible, propagate); + SECURE_DEBUG("Obj=%s(%s,0x%08x) (%d,%d,%d,%d) P%d|R%d|V%d|E%d", + evas_object_name_get(obj), + elm_object_widget_type_get(obj), obj, x, y, w, h, + pass, repeat, visible, propagate); lvl++; } Evas_Object *data; Eina_List *l; - for (l = list, data = (Evas_Object *)eina_list_data_get(l); l; l = eina_list_next(l), data = (Evas_Object *)eina_list_data_get(l)) { + for (l = list, data = (Evas_Object *) eina_list_data_get(l); l; + l = eina_list_next(l), data = + (Evas_Object *) eina_list_data_get(l)) { int x, y, w, h; evas_object_geometry_get(data, &x, &y, &w, &h); @@ -2078,7 +2157,8 @@ EXPORT_API void dump_widget(Evas_Object *obj, int lvl, int max_depth) Eina_Bool visible = evas_object_visible_get(data); Eina_Bool propagate = evas_object_propagate_events_get(data); - if (elm_object_widget_type_get(data) != NULL || evas_object_name_get(data) != NULL) { + if (elm_object_widget_type_get(data) != NULL + || evas_object_name_get(data) != NULL) { char *space = calloc(sizeof(char), (lvl * 2 + 1)); if (space) { int i; @@ -2088,8 +2168,11 @@ EXPORT_API void dump_widget(Evas_Object *obj, int lvl, int max_depth) space[lvl * 2] = '\0'; - SECURE_DEBUG("%sObj=%s(%s,0x%08x) (%d,%d,%d,%d) P%d|R%d|V%d|E%d", - space, evas_object_name_get(data), elm_object_widget_type_get(data), data, x, y, w, h, pass, repeat, visible, propagate); + SECURE_DEBUG + ("%sObj=%s(%s,0x%08x) (%d,%d,%d,%d) P%d|R%d|V%d|E%d", + space, evas_object_name_get(data), + elm_object_widget_type_get(data), data, x, y, w, h, + pass, repeat, visible, propagate); } IF_FREE(space); } @@ -2142,9 +2225,9 @@ static int _mp_util_get_next_number(char *file_name_without_ext) /* check _02d format */ nLength = strlen(file_name_without_ext); - if (nLength < 3) { /*4 means the # of minimum characters (*_n) */ - return 1; /*doesn't match */ - } else { /* input is more than 3 bytes */ + if (nLength < 3) { /*4 means the # of minimum characters (*_n) */ + return 1; /*doesn't match */ + } else { /* input is more than 3 bytes */ /* find '_' */ for (nUnderline = nLength - 1; nUnderline >= 0; nUnderline--) { if (file_name_without_ext[nUnderline] == '_') { @@ -2153,11 +2236,12 @@ static int _mp_util_get_next_number(char *file_name_without_ext) } if (nUnderline == 0 && file_name_without_ext[0] != '_') { - return 1; /* doesn't match */ + return 1; /* doesn't match */ } /* check the right characters are all digits */ for (i = nUnderline + 1; i < nLength; i++) { - if (file_name_without_ext[i] < '0' || file_name_without_ext[i] > '9') { + if (file_name_without_ext[i] < '0' + || file_name_without_ext[i] > '9') { bAllDigits = false; break; } @@ -2179,7 +2263,8 @@ static int _mp_util_get_next_number(char *file_name_without_ext) return nCount; } -void mp_util_get_unique_name(char *original_file_name, char **unique_file_name) +void mp_util_get_unique_name(char *original_file_name, + char **unique_file_name) { assert(unique_file_name); @@ -2203,12 +2288,14 @@ void mp_util_get_unique_name(char *original_file_name, char **unique_file_name) /* add a condition, whether extention is or not. */ if (bExt == 0) { - file_name_without_ext[strlen(file_name_without_ext) - strlen(file_ext) - 1] = '\0'; + file_name_without_ext[strlen(file_name_without_ext) - + strlen(file_ext) - 1] = '\0'; } nCount = _mp_util_get_next_number(file_name_without_ext); if (nCount == 1) { - char *file_name_with_space = g_strconcat(file_name_without_ext, " ", NULL); + char *file_name_with_space = + g_strconcat(file_name_without_ext, " ", NULL); if (file_name_with_space) { IF_FREE(file_name_without_ext); file_name_without_ext = file_name_with_space; @@ -2217,16 +2304,19 @@ void mp_util_get_unique_name(char *original_file_name, char **unique_file_name) } if (bExt == 0) { - new_file_name = g_strdup_printf("%s_%d.%s", file_name_without_ext, nCount, file_ext); + new_file_name = + g_strdup_printf("%s_%d.%s", file_name_without_ext, nCount, + file_ext); } else { - new_file_name = g_strdup_printf("%s_%d", file_name_without_ext, nCount); + new_file_name = + g_strdup_printf("%s_%d", file_name_without_ext, nCount); } mp_debug("new_file_name [%s]", new_file_name); IF_FREE(file_name_without_ext); *unique_file_name = g_strdup(new_file_name); -Exception: + Exception: IF_FREE(file_ext); IF_FREE(new_file_name); @@ -2253,28 +2343,24 @@ bool mp_util_is_personal_page_on() } #endif -bool -mp_util_mirroring_is_connected(void) +bool mp_util_mirroring_is_connected(void) { return false; } -bool -mp_util_is_scan_nearby_available() +bool mp_util_is_scan_nearby_available() { return false; } -bool -mp_util_is_store_enable(void) +bool mp_util_is_store_enable(void) { struct appdata *ad = g_ad; MP_CHECK_FALSE(ad); return ad->store_enable; } -bool -mp_util_free_space_check(double size) +bool mp_util_free_space_check(double size) { struct statvfs s; memset(&s, 0, sizeof(struct statvfs)); @@ -2285,14 +2371,18 @@ mp_util_free_space_check(double size) mp_error("get free space failed"); return false; } else { - if ((double)s.f_bsize*s.f_bavail >= size) { + if ((double) s.f_bsize * s.f_bavail >= size) { return true; } else { struct appdata *ad = mp_util_get_appdata(); if (ad) { - Evas_Object *popup = mp_popup_create(ad->win_main, MP_POPUP_NORMAL, NULL, NULL, NULL, ad); - mp_util_domain_translatable_text_set(popup, STR_MP_NOT_ENOUGH_SPACE_ERROR_MSG); - mp_popup_button_set(popup, MP_POPUP_BTN_1, STR_MP_OK, MP_POPUP_YES); + Evas_Object *popup = + mp_popup_create(ad->win_main, MP_POPUP_NORMAL, NULL, + NULL, NULL, ad); + mp_util_domain_translatable_text_set(popup, + STR_MP_NOT_ENOUGH_SPACE_ERROR_MSG); + mp_popup_button_set(popup, MP_POPUP_BTN_1, STR_MP_OK, + MP_POPUP_YES); evas_object_show(popup); } return false; @@ -2300,8 +2390,7 @@ mp_util_free_space_check(double size) } } -bool -mp_util_media_is_uhqa(const char *media_id) +bool mp_util_media_is_uhqa(const char *media_id) { MP_CHECK_FALSE(media_id); @@ -2317,10 +2406,14 @@ mp_util_media_is_uhqa(const char *media_id) media_info = NULL; DEBUG_TRACE("sample_rate = %d", sample_rate); - return (bool)(sample_rate >= 192000); + return (bool) (sample_rate >= 192000); } -static bool __mp_get_all_supported_storageids_cb(int storageId, storage_type_e type, storage_state_e state, const char *path, void *userData) +static bool __mp_get_all_supported_storageids_cb(int storageId, + storage_type_e type, + storage_state_e state, + const char *path, + void *userData) { if (type == STORAGE_TYPE_EXTERNAL) { external_mmc_id = storageId; @@ -2332,16 +2425,20 @@ static bool __mp_get_all_supported_storageids_cb(int storageId, storage_type_e t return true; } -char *mp_get_media_directory(storage_type_e storage_type) { +char *mp_get_media_directory(storage_type_e storage_type) +{ char *path = NULL; - int error_code = storage_foreach_device_supported(__mp_get_all_supported_storageids_cb, NULL); + int error_code = + storage_foreach_device_supported + (__mp_get_all_supported_storageids_cb, NULL); if (error_code != STORAGE_ERROR_NONE) { ERROR_TRACE("Failed to get Storage Id"); return NULL; } if (storage_type == STORAGE_TYPE_INTERNAL && internal_device_id != -1) { storage_get_root_directory(internal_device_id, &path); - } else if (storage_type == STORAGE_TYPE_EXTERNAL && external_mmc_id != -1) { + } else if (storage_type == STORAGE_TYPE_EXTERNAL + && external_mmc_id != -1) { storage_get_root_directory(external_mmc_id, &path); } else { ERROR_TRACE("Invalid Storage Id"); @@ -2361,7 +2458,8 @@ mp_dir_e mp_util_get_file_location(const char *uri) if (!mp_get_media_directory(STORAGE_TYPE_INTERNAL)) { ERROR_TRACE("Internal Storage Path cannot be determined"); } else { - internalPath = g_strdup(mp_get_media_directory(STORAGE_TYPE_INTERNAL)); + internalPath = + g_strdup(mp_get_media_directory(STORAGE_TYPE_INTERNAL)); if (!internalPath) { return MP_DIR_NONE; } @@ -2372,7 +2470,8 @@ mp_dir_e mp_util_get_file_location(const char *uri) if (!mp_get_media_directory(STORAGE_TYPE_EXTERNAL)) { ERROR_TRACE("External Storage Path cannot be determined"); } else { - externalPath = g_strdup(mp_get_media_directory(STORAGE_TYPE_EXTERNAL)); + externalPath = + g_strdup(mp_get_media_directory(STORAGE_TYPE_EXTERNAL)); if (!externalPath) { return MP_DIR_NONE; } @@ -2414,8 +2513,7 @@ const char *util_get_file_path(const char *relative) return NULL; } - if (!ecore_file_exists(&buf[0])) - { + if (!ecore_file_exists(&buf[0])) { DEBUG_TRACE("icon file does not exist!!: %s", &buf[0]); return NULL; } @@ -2430,19 +2528,23 @@ void mp_post_notification_indicator(char *status) MP_CHECK(ad); int ret = NOTIFICATION_ERROR_NONE; - notification_image_type_e img_type = NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR; + notification_image_type_e img_type = + NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR; char *path = app_get_shared_resource_path(); if (!path) { ERROR_TRACE("Shared Resource Path is NULL"); return; } - char icon_path[1024] = {0}; + char icon_path[1024] = { 0 }; if (!strcmp(status, "playing")) { - snprintf(icon_path, 1024, "%sshared_images/T02_control_circle_icon_play.png", path); + snprintf(icon_path, 1024, + "%sshared_images/T02_control_circle_icon_play.png", path); } else { - snprintf(icon_path, 1024, "%sshared_images/T02_control_circle_icon_pause.png", path); + snprintf(icon_path, 1024, + "%sshared_images/T02_control_circle_icon_pause.png", + path); } free(path); @@ -2457,7 +2559,8 @@ void mp_post_notification_indicator(char *status) endfunc; } -void mp_noti_read_ini_file(void *data, Ecore_File_Monitor *em, Ecore_File_Event event, const char *path) +void mp_noti_read_ini_file(void *data, Ecore_File_Monitor * em, + Ecore_File_Event event, const char *path) { startfunc; DEBUG_TRACE("Path of file monitor is: %s", path); @@ -2465,7 +2568,7 @@ void mp_noti_read_ini_file(void *data, Ecore_File_Monitor *em, Ecore_File_Event DEBUG_TRACE("Invalid path information"); return; } - char str[1000] = {0,}; + char str[1000] = { 0, }; FILE *file = fopen(path, "r"); if (!file) { ERROR_TRACE("File doesn't exists"); diff --git a/src/common/mp-widget.c b/src/common/mp-widget.c index 2a1447b..7620d38 100644 --- a/src/common/mp-widget.c +++ b/src/common/mp-widget.c @@ -28,8 +28,7 @@ #define MAX_LEN_VIB_DURATION 0.5 #define DEF_BUF_LEN (512) -Evas_Object * -mp_widget_navigation_new(Evas_Object * parent) +Evas_Object *mp_widget_navigation_new(Evas_Object * parent) { Evas_Object *navi_bar; mp_retv_if(parent == NULL, NULL); @@ -41,61 +40,70 @@ mp_widget_navigation_new(Evas_Object * parent) return navi_bar; } -static void mp_language_changed(void *data, Evas_Object *obj, void *event_info) +static void mp_language_changed(void *data, Evas_Object * obj, + void *event_info) { elm_genlist_realized_items_update(obj); } -EXPORT_API Evas_Object * -mp_widget_genlist_create(Evas_Object * parent) +EXPORT_API Evas_Object *mp_widget_genlist_create(Evas_Object * parent) { Evas_Object *list = NULL; list = elm_genlist_add(parent); MP_CHECK_NULL(list); - evas_object_smart_callback_add(list, "language,changed", mp_language_changed, list); + evas_object_smart_callback_add(list, "language,changed", + mp_language_changed, list); elm_scroller_bounce_set(list, EINA_FALSE, EINA_TRUE); return list; } static void -_mp_widget_text_popup_timeout_cb(void *data, Evas_Object *obj, void *event_info) +_mp_widget_text_popup_timeout_cb(void *data, Evas_Object * obj, + void *event_info) { startfunc; mp_evas_object_del(obj); } -EXPORT_API Evas_Object * -mp_widget_text_popup(void *data, const char *message) +EXPORT_API Evas_Object *mp_widget_text_popup(void *data, + const char *message) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK_NULL(ad); Evas_Object *popup = NULL; - popup = mp_popup_create(ad->win_main, MP_POPUP_NOTIFY, NULL, ad, _mp_widget_text_popup_timeout_cb, ad); + popup = + mp_popup_create(ad->win_main, MP_POPUP_NOTIFY, NULL, ad, + _mp_widget_text_popup_timeout_cb, ad); - evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); char *text = g_strconcat("", message, "", NULL); - elm_object_text_set(popup, (const char *)text); + elm_object_text_set(popup, (const char *) text); mp_popup_timeout_set(popup, MP_POPUP_TIMEOUT); evas_object_show(popup); IF_FREE(text); return popup; } -EXPORT_API Evas_Object * -mp_widget_text_popup_show(void *data, const char *message, bool show) +EXPORT_API Evas_Object *mp_widget_text_popup_show(void *data, + const char *message, + bool show) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK_NULL(ad); Evas_Object *popup = NULL; - popup = mp_popup_create(ad->win_main, MP_POPUP_NOTIFY, NULL, ad, _mp_widget_text_popup_timeout_cb, ad); + popup = + mp_popup_create(ad->win_main, MP_POPUP_NOTIFY, NULL, ad, + _mp_widget_text_popup_timeout_cb, ad); - evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); char *text = g_strconcat("", message, "", NULL); - elm_object_text_set(popup, (const char *)text); + elm_object_text_set(popup, (const char *) text); mp_popup_timeout_set(popup, MP_POPUP_TIMEOUT); if (show) { evas_object_show(popup); @@ -104,17 +112,22 @@ mp_widget_text_popup_show(void *data, const char *message, bool show) return popup; } -EXPORT_API Evas_Object * -mp_widget_notify_cb_popup(void *data, const char *message, Evas_Smart_Cb cb, void *cb_data) +EXPORT_API Evas_Object *mp_widget_notify_cb_popup(void *data, + const char *message, + Evas_Smart_Cb cb, + void *cb_data) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK_NULL(ad); Evas_Object *popup = NULL; - popup = mp_popup_create(ad->win_main, MP_POPUP_NOTIFY, NULL, cb_data, cb, ad); + popup = + mp_popup_create(ad->win_main, MP_POPUP_NOTIFY, NULL, cb_data, cb, + ad); - evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); char *text = g_strconcat("", message, "", NULL); - elm_object_text_set(popup, (const char *)text); + elm_object_text_set(popup, (const char *) text); mp_popup_timeout_set(popup, MP_POPUP_TIMEOUT); evas_object_show(popup); IF_FREE(text); @@ -122,39 +135,45 @@ mp_widget_notify_cb_popup(void *data, const char *message, Evas_Smart_Cb cb, voi } -EXPORT_API Evas_Object * -mp_widget_text_cb_popup(void *data, const char *message, Evas_Smart_Cb cb) +EXPORT_API Evas_Object *mp_widget_text_cb_popup(void *data, + const char *message, + Evas_Smart_Cb cb) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK_NULL(ad); Evas_Object *popup = NULL; - popup = mp_popup_create(ad->win_main, MP_POPUP_NOTIFY, NULL, ad, cb, ad); + popup = + mp_popup_create(ad->win_main, MP_POPUP_NOTIFY, NULL, ad, cb, ad); - evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); char *text = g_strconcat("", message, "", NULL); - elm_object_text_set(popup, (const char *)text); + elm_object_text_set(popup, (const char *) text); mp_popup_timeout_set(popup, MP_POPUP_TIMEOUT); evas_object_show(popup); IF_FREE(text); return popup; } -EXPORT_API Evas_Object* mp_widget_text_button_popup(void *data, const char *message) +EXPORT_API Evas_Object *mp_widget_text_button_popup(void *data, + const char *message) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK_NULL(ad); - ad->popup[MP_POPUP_NORMAL] = mp_popup_create(ad->win_main, MP_POPUP_NORMAL, NULL, NULL, NULL, ad); + ad->popup[MP_POPUP_NORMAL] = + mp_popup_create(ad->win_main, MP_POPUP_NORMAL, NULL, NULL, NULL, + ad); MP_CHECK_NULL(ad->popup[MP_POPUP_NORMAL]); mp_popup_desc_set(ad->popup[MP_POPUP_NORMAL], message); - mp_popup_button_set(ad->popup[MP_POPUP_NORMAL], MP_POPUP_BTN_1, STR_MP_OK, MP_POPUP_YES); + mp_popup_button_set(ad->popup[MP_POPUP_NORMAL], MP_POPUP_BTN_1, + STR_MP_OK, MP_POPUP_YES); evas_object_show(ad->popup[MP_POPUP_NORMAL]); return ad->popup[MP_POPUP_NORMAL]; } -Evas_Object * -mp_widget_create_tabbar(Evas_Object *obj) +Evas_Object *mp_widget_create_tabbar(Evas_Object * obj) { Evas_Object *tabbar; @@ -174,8 +193,7 @@ mp_widget_create_tabbar(Evas_Object *obj) return tabbar; } -char * -mp_widget_set_text_theme_color(const char *text, const char *color) +char *mp_widget_set_text_theme_color(const char *text, const char *color) { ERROR_TRACE(""); MP_CHECK_NULL(text); @@ -190,7 +208,7 @@ mp_widget_set_text_theme_color(const char *text, const char *color) memset(return_str, 0x00, DEF_BUF_LEN + 1); snprintf(return_str, DEF_BUF_LEN, - "%s", r, g, b, a, text); + "%s", r, g, b, a, text); ERROR_TRACE("return_str %s", return_str); @@ -198,9 +216,10 @@ mp_widget_set_text_theme_color(const char *text, const char *color) } -Evas_Object * -mp_widget_create_button(Evas_Object * parent, char *style, char *caption, Evas_Object * icon, - void (*func)(void *, Evas_Object *, void *), void *data) +Evas_Object *mp_widget_create_button(Evas_Object * parent, char *style, + char *caption, Evas_Object * icon, + void (*func) (void *, Evas_Object *, + void *), void *data) { if (!parent) { return NULL; @@ -225,13 +244,14 @@ mp_widget_create_button(Evas_Object * parent, char *style, char *caption, Evas_O elm_object_focus_allow_set(btn, EINA_TRUE); evas_object_propagate_events_set(btn, EINA_FALSE); - evas_object_smart_callback_add(btn, "clicked", func, (void *)data); + evas_object_smart_callback_add(btn, "clicked", func, (void *) data); return btn; } static void -_mp_widget_entry_maxlength_reached_cb(void *data, Evas_Object * obj, void *event_info) +_mp_widget_entry_maxlength_reached_cb(void *data, Evas_Object * obj, + void *event_info) { struct appdata *ad = data; MP_CHECK(ad); @@ -239,7 +259,8 @@ _mp_widget_entry_maxlength_reached_cb(void *data, Evas_Object * obj, void *event } static void -_mp_widget_entry_changed_cb(void *data, Evas_Object * obj, void *event_info) +_mp_widget_entry_changed_cb(void *data, Evas_Object * obj, + void *event_info) { struct appdata *ad = data; MP_CHECK(ad); @@ -254,18 +275,17 @@ _mp_widget_entry_changed_cb(void *data, Evas_Object * obj, void *event_info) const char *eraser_signal = NULL; const char *guidetext_signal = NULL; if (entry_empty) { - eraser_signal = "elm,state,eraser,hide"; + eraser_signal = "elm,state,eraser,hide"; guidetext_signal = "elm,state,guidetext,show"; } else { - eraser_signal = "elm,state,eraser,show"; + eraser_signal = "elm,state,eraser,show"; guidetext_signal = "elm,state,guidetext,hide"; } elm_object_signal_emit(editfield, eraser_signal, "elm"); elm_object_signal_emit(editfield, guidetext_signal, "elm"); } -static void -_mp_widget_entry_eraser_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source) // When X marked button is clicked, empty entry's contents. +static void _mp_widget_entry_eraser_clicked_cb(void *data, Evas_Object * obj, const char *emission, const char *source) // When X marked button is clicked, empty entry's contents. { Evas_Object *entry = data; MP_CHECK(entry); @@ -274,8 +294,9 @@ _mp_widget_entry_eraser_clicked_cb(void *data, Evas_Object *obj, const char *emi } -Evas_Object * -mp_widget_create_editfield(Evas_Object * parent, int limit_size, char *guide_txt, struct appdata *ad) +Evas_Object *mp_widget_create_editfield(Evas_Object * parent, + int limit_size, char *guide_txt, + struct appdata *ad) { startfunc; Evas_Object *editfield = NULL; @@ -284,9 +305,9 @@ mp_widget_create_editfield(Evas_Object * parent, int limit_size, char *guide_txt elm_layout_theme_set(editfield, "layout", "editfield", "default"); MP_CHECK_NULL(editfield); evas_object_size_hint_weight_set(editfield, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); + EVAS_HINT_EXPAND); evas_object_size_hint_align_set(editfield, EVAS_HINT_FILL, - EVAS_HINT_FILL); + EVAS_HINT_FILL); entry = elm_entry_add(editfield); MP_CHECK_NULL(entry); @@ -299,17 +320,22 @@ mp_widget_create_editfield(Evas_Object * parent, int limit_size, char *guide_txt evas_object_data_set(editfield, "entry", entry); elm_object_part_content_set(editfield, "elm.swallow.content", entry); - evas_object_smart_callback_add(entry, "changed", _mp_widget_entry_changed_cb, editfield); - elm_object_signal_callback_add(editfield, "elm,eraser,clicked", "elm", _mp_widget_entry_eraser_clicked_cb, entry); + evas_object_smart_callback_add(entry, "changed", + _mp_widget_entry_changed_cb, editfield); + elm_object_signal_callback_add(editfield, "elm,eraser,clicked", "elm", + _mp_widget_entry_eraser_clicked_cb, + entry); if (limit_size > 0) { static Elm_Entry_Filter_Limit_Size limit_filter_data; limit_filter_data.max_char_count = 0; limit_filter_data.max_byte_count = limit_size; - elm_entry_markup_filter_append(entry, elm_entry_filter_limit_size, &limit_filter_data); - evas_object_smart_callback_add(entry, "maxlength,reached", _mp_widget_entry_maxlength_reached_cb, - ad); + elm_entry_markup_filter_append(entry, elm_entry_filter_limit_size, + &limit_filter_data); + evas_object_smart_callback_add(entry, "maxlength,reached", + _mp_widget_entry_maxlength_reached_cb, + ad); } if (guide_txt) { @@ -320,8 +346,7 @@ mp_widget_create_editfield(Evas_Object * parent, int limit_size, char *guide_txt } -Evas_Object * -mp_widget_editfield_entry_get(Evas_Object *editfield) +Evas_Object *mp_widget_editfield_entry_get(Evas_Object * editfield) { MP_CHECK_NULL(editfield); @@ -330,11 +355,13 @@ mp_widget_editfield_entry_get(Evas_Object *editfield) return entry; } -Evas_Object * -mp_widget_create_title_btn(Evas_Object *parent, const char *text, const char * icon_path, Evas_Smart_Cb func, void *data) +Evas_Object *mp_widget_create_title_btn(Evas_Object * parent, + const char *text, + const char *icon_path, + Evas_Smart_Cb func, void *data) { Evas_Object *btn = elm_button_add(parent); - Evas_Object * icon = NULL; + Evas_Object *icon = NULL; MP_CHECK_NULL(btn); if (text) { @@ -350,8 +377,7 @@ mp_widget_create_title_btn(Evas_Object *parent, const char *text, const char * i return btn; } -Evas_Object * -mp_widget_create_layout_main(Evas_Object * parent) +Evas_Object *mp_widget_create_layout_main(Evas_Object * parent) { Evas_Object *layout; @@ -360,7 +386,8 @@ mp_widget_create_layout_main(Evas_Object * parent) mp_retvm_if(layout == NULL, NULL, "Failed elm_layout_add."); elm_layout_theme_set(layout, "layout", "application", "default"); - evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); elm_win_resize_object_add(parent, layout); evas_object_show(layout); @@ -368,16 +395,17 @@ mp_widget_create_layout_main(Evas_Object * parent) return layout; } -EXPORT_API Evas_Object * -mp_common_load_edj(Evas_Object * parent, const char *file, const char *group) +EXPORT_API Evas_Object *mp_common_load_edj(Evas_Object * parent, + const char *file, + const char *group) { Evas_Object *eo = NULL; int r = -1; eo = elm_layout_add(parent); if (eo) { - char edje_path[1024] ={0}; - char * path = app_get_resource_path(); + char edje_path[1024] = { 0 }; + char *path = app_get_resource_path(); MP_CHECK_NULL(path); snprintf(edje_path, 1024, "%s%s/%s", path, "edje", file); @@ -387,7 +415,8 @@ mp_common_load_edj(Evas_Object * parent, const char *file, const char *group) evas_object_del(eo); return NULL; } - evas_object_size_hint_weight_set(eo, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(eo, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); evas_object_show(eo); } evas_object_name_set(eo, group); @@ -395,14 +424,12 @@ mp_common_load_edj(Evas_Object * parent, const char *file, const char *group) return eo; } -static void -_mp_common_win_del(void *data, Evas_Object * obj, void *event) +static void _mp_common_win_del(void *data, Evas_Object * obj, void *event) { elm_exit(); } -Evas_Object * -mp_create_win(const char *name) +Evas_Object *mp_create_win(const char *name) { startfunc; Evas_Object *eo; @@ -411,7 +438,8 @@ mp_create_win(const char *name) eo = elm_win_add(NULL, name, ELM_WIN_BASIC); if (eo) { elm_win_title_set(eo, name); - evas_object_smart_callback_add(eo, "delete,request", _mp_common_win_del, NULL); + evas_object_smart_callback_add(eo, "delete,request", + _mp_common_win_del, NULL); elm_win_screen_size_get(eo, NULL, NULL, &w, &h); evas_object_resize(eo, w, h); //set indicator as transparent @@ -422,27 +450,33 @@ mp_create_win(const char *name) return eo; } -Evas_Object * -mp_common_create_naviframe_title_button(Evas_Object *parent, const char * text_id, void *save_cb, void *user_data) +Evas_Object *mp_common_create_naviframe_title_button(Evas_Object * parent, + const char *text_id, + void *save_cb, + void *user_data) { Evas_Object *btn_save = NULL; btn_save = elm_button_add(parent); elm_object_style_set(btn_save, "naviframe/title1/default"); - evas_object_size_hint_align_set(btn_save, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_align_set(btn_save, EVAS_HINT_FILL, + EVAS_HINT_FILL); - evas_object_smart_callback_add(btn_save, "clicked", save_cb, user_data); + evas_object_smart_callback_add(btn_save, "clicked", save_cb, + user_data); elm_object_text_set(btn_save, GET_SYS_STR(text_id)); - mp_language_mgr_register_object(btn_save, OBJ_TYPE_ELM_OBJECT, NULL, text_id); + mp_language_mgr_register_object(btn_save, OBJ_TYPE_ELM_OBJECT, NULL, + text_id); evas_object_show(btn_save); return btn_save; } -Evas_Object * -mp_widget_create_toolbar_btn(Evas_Object *parent, - const char *style, const char *text, Evas_Smart_Cb func, void *data) +Evas_Object *mp_widget_create_toolbar_btn(Evas_Object * parent, + const char *style, + const char *text, + Evas_Smart_Cb func, void *data) { startfunc; Evas_Object *btn = elm_button_add(parent); @@ -455,10 +489,11 @@ mp_widget_create_toolbar_btn(Evas_Object *parent, return btn; } -Evas_Object *mp_widget_create_naviframe_toolbar(Elm_Object_Item *navi_it) +Evas_Object *mp_widget_create_naviframe_toolbar(Elm_Object_Item * navi_it) { startfunc; - Evas_Object *toolbar = elm_object_item_part_content_get(navi_it, "toolbar"); + Evas_Object *toolbar = + elm_object_item_part_content_get(navi_it, "toolbar"); if (!toolbar) { toolbar = elm_toolbar_add(GET_NAVIFRAME); MP_CHECK_NULL(toolbar); @@ -478,7 +513,11 @@ Evas_Object *mp_widget_create_naviframe_toolbar(Elm_Object_Item *navi_it) return toolbar; } -Elm_Object_Item *mp_widget_create_toolbar_item_btn(Evas_Object *parent, const char *style, const char *text, Evas_Smart_Cb func, void *data) +Elm_Object_Item *mp_widget_create_toolbar_item_btn(Evas_Object * parent, + const char *style, + const char *text, + Evas_Smart_Cb func, + void *data) { startfunc; Evas_Object *toolbar = parent; @@ -487,13 +526,19 @@ Elm_Object_Item *mp_widget_create_toolbar_item_btn(Evas_Object *parent, const ch Elm_Object_Item *toolbar_item = NULL; //Evas_Object *toolbar_obj_item = NULL; - toolbar_item = elm_toolbar_item_append(toolbar, NULL, NULL, func, data); + toolbar_item = + elm_toolbar_item_append(toolbar, NULL, NULL, func, data); //toolbar_obj_item = elm_toolbar_item_object_get(toolbar_item); - mp_util_item_domain_translatable_part_text_set(toolbar_item, "elm.text", text); + mp_util_item_domain_translatable_part_text_set(toolbar_item, + "elm.text", text); return toolbar_item; } -Evas_Object *mp_widget_create_title_icon_btn_black(Evas_Object *parent, const char *file, const char *group, Evas_Smart_Cb func, void *data) +Evas_Object *mp_widget_create_title_icon_btn_black(Evas_Object * parent, + const char *file, + const char *group, + Evas_Smart_Cb func, + void *data) { startfunc; Evas_Object *ic; @@ -505,7 +550,8 @@ Evas_Object *mp_widget_create_title_icon_btn_black(Evas_Object *parent, const ch ic = elm_icon_add(parent); elm_image_file_set(ic, file, group); - evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, + 1); elm_image_resizable_set(ic, EINA_TRUE, EINA_TRUE); elm_object_part_content_set(btn, "icon", ic); @@ -514,7 +560,11 @@ Evas_Object *mp_widget_create_title_icon_btn_black(Evas_Object *parent, const ch return btn; } -Evas_Object *mp_widget_create_title_icon_btn_second(Evas_Object *parent, const char *file, const char *group, Evas_Smart_Cb func, void *data) +Evas_Object *mp_widget_create_title_icon_btn_second(Evas_Object * parent, + const char *file, + const char *group, + Evas_Smart_Cb func, + void *data) { startfunc; Evas_Object *ic; @@ -526,7 +576,8 @@ Evas_Object *mp_widget_create_title_icon_btn_second(Evas_Object *parent, const c ic = elm_icon_add(parent); elm_image_file_set(ic, file, group); - evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, + 1); elm_image_resizable_set(ic, EINA_TRUE, EINA_TRUE); elm_object_part_content_set(btn, "icon", ic); @@ -535,7 +586,9 @@ Evas_Object *mp_widget_create_title_icon_btn_second(Evas_Object *parent, const c return btn; } -Evas_Object *mp_create_title_text_btn(Evas_Object *parent, const char *text, Evas_Smart_Cb func, void *data) +Evas_Object *mp_create_title_text_btn(Evas_Object * parent, + const char *text, Evas_Smart_Cb func, + void *data) { startfunc; Evas_Object *btn = elm_button_add(parent); @@ -547,7 +600,12 @@ Evas_Object *mp_create_title_text_btn(Evas_Object *parent, const char *text, Eva evas_object_smart_callback_add(btn, "clicked", func, data); return btn; } -Evas_Object *mp_widget_create_title_icon_btn(Evas_Object *parent, const char *file, const char *group, Evas_Smart_Cb func, void *data) + +Evas_Object *mp_widget_create_title_icon_btn(Evas_Object * parent, + const char *file, + const char *group, + Evas_Smart_Cb func, + void *data) { startfunc; Evas_Object *ic; @@ -568,8 +626,10 @@ Evas_Object *mp_widget_create_title_icon_btn(Evas_Object *parent, const char *fi return btn; } -Evas_Object* mp_widget_create_navi_left_btn(Evas_Object *pParent, Elm_Object_Item *pNaviItem, - Evas_Smart_Cb pFunc, void *pUserData) +Evas_Object *mp_widget_create_navi_left_btn(Evas_Object * pParent, + Elm_Object_Item * pNaviItem, + Evas_Smart_Cb pFunc, + void *pUserData) { startfunc; @@ -588,14 +648,18 @@ Evas_Object* mp_widget_create_navi_left_btn(Evas_Object *pParent, Elm_Object_Ite return NULL; } - elm_object_item_part_content_set(pNaviItem, "title_left_btn", pLeftbtn); + elm_object_item_part_content_set(pNaviItem, "title_left_btn", + pLeftbtn); evas_object_show(pLeftbtn); return pLeftbtn; } -Evas_Object* mp_widget_create_navi_right_btn(Evas_Object *pParent, Elm_Object_Item *pNaviItem, - Evas_Smart_Cb pFunc, void *pUserData) + +Evas_Object *mp_widget_create_navi_right_btn(Evas_Object * pParent, + Elm_Object_Item * pNaviItem, + Evas_Smart_Cb pFunc, + void *pUserData) { startfunc; @@ -616,7 +680,8 @@ Evas_Object* mp_widget_create_navi_right_btn(Evas_Object *pParent, Elm_Object_It return NULL; } - elm_object_item_part_content_set(pNaviItem, "title_right_btn", pRightbtn); + elm_object_item_part_content_set(pNaviItem, "title_right_btn", + pRightbtn); evas_object_show(pRightbtn); @@ -625,36 +690,45 @@ Evas_Object* mp_widget_create_navi_right_btn(Evas_Object *pParent, Elm_Object_It } -Evas_Object *mp_widget_create_title_icon(Evas_Object *parent, const char *file, const char *group) +Evas_Object *mp_widget_create_title_icon(Evas_Object * parent, + const char *file, + const char *group) { startfunc; Evas_Object *pIcon = elm_icon_add(parent); elm_image_file_set(pIcon, file, group); - evas_object_size_hint_aspect_set(pIcon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + evas_object_size_hint_aspect_set(pIcon, EVAS_ASPECT_CONTROL_VERTICAL, + 1, 1); elm_image_resizable_set(pIcon, EINA_TRUE, EINA_TRUE); return pIcon; } -Evas_Object *mp_widget_create_bg(Evas_Object *parent) + +Evas_Object *mp_widget_create_bg(Evas_Object * parent) { startfunc; Evas_Object *bg = NULL; bg = evas_object_rectangle_add(evas_object_evas_get(parent)); - evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); evas_object_repeat_events_set(bg, EINA_FALSE); evas_object_color_set(bg, 248, 246, 239, 255); evas_object_show(bg); return bg; } -Evas_Object * -_mp_widget_no_content_w_help_add(Evas_Object *parent, char *text, char *helptext, char *btntext, void *cb, void *data) + +Evas_Object *_mp_widget_no_content_w_help_add(Evas_Object * parent, + char *text, char *helptext, + char *btntext, void *cb, + void *data) { Evas_Object *lay = NULL, *btn = NULL; /* Full view layout */ lay = elm_layout_add(parent); elm_layout_theme_set(lay, "layout", "nocontents", "default"); - evas_object_size_hint_weight_set(lay, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(lay, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); evas_object_size_hint_align_set(lay, EVAS_HINT_FILL, EVAS_HINT_FILL); mp_util_domain_translatable_part_text_set(lay, "elm.text", text); @@ -662,7 +736,8 @@ _mp_widget_no_content_w_help_add(Evas_Object *parent, char *text, char *helptext elm_layout_signal_emit(lay, "align.center", "elm"); if (helptext) { - mp_util_domain_translatable_part_text_set(lay, "elm.help.text", helptext); + mp_util_domain_translatable_part_text_set(lay, "elm.help.text", + helptext); } if (cb) { @@ -679,18 +754,28 @@ _mp_widget_no_content_w_help_add(Evas_Object *parent, char *text, char *helptext } -Evas_Object *mp_widget_create_no_contents(Evas_Object *parent, MpNocontent_e type, void(*callback)(void *data, Evas_Object *obj, void *event_info), void *user_data) +Evas_Object *mp_widget_create_no_contents(Evas_Object * parent, + MpNocontent_e type, + void (*callback) (void *data, + Evas_Object * + obj, + void + *event_info), + void *user_data) { MP_CHECK_NULL(parent); startfunc; Evas_Object *content = NULL; - if (type == MP_NOCONTENT_NORMAL || type == MP_NOCONTENT_PLAYLIST || type == MP_NOCONTENT_DEVICE) { + if (type == MP_NOCONTENT_NORMAL || type == MP_NOCONTENT_PLAYLIST + || type == MP_NOCONTENT_DEVICE) { content = elm_layout_add(parent); elm_layout_theme_set(content, "layout", "nocontents", "default"); - evas_object_size_hint_weight_set(content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(content, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(content, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(content, EVAS_HINT_FILL, + EVAS_HINT_FILL); const char *text = NULL; if (type == MP_NOCONTENT_PLAYLIST) { text = STR_MP_NO_PLAYLISTS; @@ -702,21 +787,34 @@ Evas_Object *mp_widget_create_no_contents(Evas_Object *parent, MpNocontent_e typ mp_util_domain_translatable_text_set(content, text); evas_object_show(content); } else if (type == MP_NOCONTENT_ARTISTS || type == MP_NOCONTENT_ALBUMS) { - char *text = (type == MP_NOCONTENT_ARTISTS) ? STR_MP_NO_ARTISTS : STR_MP_NO_ALBUMS; - content = _mp_widget_no_content_w_help_add(parent, text, - STR_MP_AFTER_ADD_TRACKS_HELP, NULL, NULL, NULL); + char *text = + (type == + MP_NOCONTENT_ARTISTS) ? STR_MP_NO_ARTISTS : STR_MP_NO_ALBUMS; + content = + _mp_widget_no_content_w_help_add(parent, text, + STR_MP_AFTER_ADD_TRACKS_HELP, + NULL, NULL, NULL); } else { - content = _mp_widget_no_content_w_help_add(parent, STR_MP_NO_TRACKS, - STR_MP_AFTER_YOU_ADD_TRACKS, NULL, NULL, NULL); + content = + _mp_widget_no_content_w_help_add(parent, STR_MP_NO_TRACKS, + STR_MP_AFTER_YOU_ADD_TRACKS, + NULL, NULL, NULL); } return content; } -Evas_Object *mp_widget_create_no_content_playlist(Evas_Object *parent, - char *helptext, void(*callback)(void *data, Evas_Object *obj, void *event_info), void *user_data) +Evas_Object *mp_widget_create_no_content_playlist(Evas_Object * parent, + char *helptext, + void (*callback) (void + *data, + Evas_Object + *obj, + void + *event_info), + void *user_data) { MP_CHECK_NULL(parent); startfunc; @@ -724,16 +822,19 @@ Evas_Object *mp_widget_create_no_content_playlist(Evas_Object *parent, Evas_Object *lay = NULL, *btn = NULL; lay = elm_layout_add(parent); elm_layout_theme_set(lay, "layout", "nocontents", "default"); - evas_object_size_hint_weight_set(lay, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(lay, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); evas_object_size_hint_align_set(lay, EVAS_HINT_FILL, EVAS_HINT_FILL); //elm_object_part_text_set(lay, "elm.text", GET_STR(STR_MP_NO_TRACKS)); - mp_util_domain_translatable_part_text_set(lay, "elm.text", STR_MP_NO_TRACKS); + mp_util_domain_translatable_part_text_set(lay, "elm.text", + STR_MP_NO_TRACKS); elm_layout_signal_emit(lay, "text,disabled", ""); elm_layout_signal_emit(lay, "align.center", "elm"); if (helptext) { - mp_util_domain_translatable_part_text_set(lay, "elm.help.text", (const char*)helptext); + mp_util_domain_translatable_part_text_set(lay, "elm.help.text", + (const char *) helptext); //avoid text skip edje_object_message_signal_process(elm_layout_edje_get(lay)); } @@ -742,22 +843,31 @@ Evas_Object *mp_widget_create_no_content_playlist(Evas_Object *parent, btn = elm_button_add(lay); elm_object_style_set(btn, "style1"); mp_util_domain_translatable_text_set(btn, STR_MP_ADD_TRACKS); - evas_object_smart_callback_add(btn, "clicked", callback, user_data); + evas_object_smart_callback_add(btn, "clicked", callback, + user_data); //elm_object_part_content_set(lay, "swallow_area", btn); } evas_object_show(lay); return lay; } -Evas_Object *mp_widget_no_contents_default_add(Evas_Object *parent, const char *text, const char *help_text) +Evas_Object *mp_widget_no_contents_default_add(Evas_Object * parent, + const char *text, + const char *help_text) { MP_CHECK_NULL(parent); - Evas_Object *content = _mp_widget_no_content_w_help_add(parent, (char *)text, (char *)help_text, NULL, NULL, NULL); + Evas_Object *content = + _mp_widget_no_content_w_help_add(parent, (char *) text, + (char *) help_text, NULL, NULL, + NULL); return content; } -Evas_Object *mp_widget_shorcut_box_add(Evas_Object *parent, const char *title, const char *file, const char *group, int w, int h, Edje_Signal_Cb func, void *data) +Evas_Object *mp_widget_shorcut_box_add(Evas_Object * parent, + const char *title, const char *file, + const char *group, int w, int h, + Edje_Signal_Cb func, void *data) { Evas_Object *layout = NULL; layout = mp_common_load_edj(parent, MP_EDJ_NAME, "shortcut_box"); @@ -774,7 +884,8 @@ Evas_Object *mp_widget_shorcut_box_add(Evas_Object *parent, const char *title, c elm_object_part_content_set(layout, "bg", image); if (title) { elm_object_part_text_set(layout, "label", GET_STR(title)); - mp_language_mgr_register_object(layout, OBJ_TYPE_EDJE_OBJECT, "label", title); + mp_language_mgr_register_object(layout, OBJ_TYPE_EDJE_OBJECT, + "label", title); } if (func) { @@ -784,7 +895,9 @@ Evas_Object *mp_widget_shorcut_box_add(Evas_Object *parent, const char *title, c return layout; } -Evas_Object *mp_widget_slide_title_create(Evas_Object *parent, const char *style, const char *text) +Evas_Object *mp_widget_slide_title_create(Evas_Object * parent, + const char *style, + const char *text) { Evas_Object *label = elm_label_add(parent); @@ -798,18 +911,19 @@ Evas_Object *mp_widget_slide_title_create(Evas_Object *parent, const char *style elm_object_text_set(label, text); evas_object_show(label); /* - double duration = strlen(text) / (double)10; - if (duration < 1.0) - duration = 1.0; - elm_label_slide_duration_set(label, duration); - */ + double duration = strlen(text) / (double)10; + if (duration < 1.0) + duration = 1.0; + elm_label_slide_duration_set(label, duration); + */ //elm_label_ellipsis_set(label, EINA_TRUE); return label; } -Evas_Object *mp_widget_device_icon_add(Evas_Object *parent, int device_type) +Evas_Object *mp_widget_device_icon_add(Evas_Object * parent, + int device_type) { MP_CHECK_NULL(parent); @@ -821,14 +935,14 @@ Evas_Object *mp_widget_device_icon_add(Evas_Object *parent, int device_type) } Evas_Object *icon = mp_common_load_edj(parent, IMAGE_EDJ_NAME, group); - evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); evas_object_size_hint_align_set(icon, EVAS_HINT_FILL, EVAS_HINT_FILL); return icon; } -static Eina_Bool -_mp_widget_connection_info_timer_cb(void *data) +static Eina_Bool _mp_widget_connection_info_timer_cb(void *data) { TIMER_TRACE(); Evas_Object *layout = data; @@ -840,7 +954,8 @@ _mp_widget_connection_info_timer_cb(void *data) } static void -_mp_widget_connection_info_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +_mp_widget_connection_info_del_cb(void *data, Evas * e, Evas_Object * obj, + void *event_info) { Ecore_Timer *timer = data; MP_CHECK(timer); @@ -848,13 +963,20 @@ _mp_widget_connection_info_del_cb(void *data, Evas *e, Evas_Object *obj, void *e ecore_timer_del(timer); } -Evas_Object *mp_widget_connection_info_add(Evas_Object *parent, Evas_Object *src_icon, const char *src_name, Evas_Object *dest_icon, const char *dest_name) +Evas_Object *mp_widget_connection_info_add(Evas_Object * parent, + Evas_Object * src_icon, + const char *src_name, + Evas_Object * dest_icon, + const char *dest_name) { MP_CHECK_NULL(parent); - Evas_Object *layout = mp_common_load_edj(parent, MP_EDJ_NAME, "connection_info_layout"); - 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 *layout = + mp_common_load_edj(parent, MP_EDJ_NAME, "connection_info_layout"); + 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); /* from */ elm_object_part_content_set(layout, "elm.icon.source", src_icon); @@ -864,15 +986,19 @@ Evas_Object *mp_widget_connection_info_add(Evas_Object *parent, Evas_Object *src elm_object_part_content_set(layout, "elm.icon.destination", dest_icon); elm_object_part_text_set(layout, "elm.text.destination", dest_name); - Ecore_Timer *progress_timer = ecore_timer_add(0.5, _mp_widget_connection_info_timer_cb, layout); + Ecore_Timer *progress_timer = + ecore_timer_add(0.5, _mp_widget_connection_info_timer_cb, layout); evas_object_data_set(layout, "timer", progress_timer); - evas_object_event_callback_add(layout, EVAS_CALLBACK_DEL, _mp_widget_connection_info_del_cb, progress_timer); + evas_object_event_callback_add(layout, EVAS_CALLBACK_DEL, + _mp_widget_connection_info_del_cb, + progress_timer); return layout; } -Evas_Object *mp_widget_loading_icon_add(Evas_Object *parent, mp_loading_icon_size_e size) +Evas_Object *mp_widget_loading_icon_add(Evas_Object * parent, + mp_loading_icon_size_e size) { Evas_Object *progressbar = NULL; progressbar = elm_progressbar_add(parent); @@ -889,37 +1015,41 @@ Evas_Object *mp_widget_loading_icon_add(Evas_Object *parent, mp_loading_icon_siz } elm_object_style_set(progressbar, style); evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.5); - evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); evas_object_show(progressbar); elm_progressbar_pulse(progressbar, EINA_TRUE); return progressbar; } + #ifdef MP_FEATURE_PERSONAL_PAGE -Evas_Object *mp_widget_lock_icon_create(Evas_Object *obj, const char *thumbpath) +Evas_Object *mp_widget_lock_icon_create(Evas_Object * obj, + const char *thumbpath) { MP_CHECK_NULL(obj); - /*create layout*/ + /*create layout */ Evas_Object *layout = NULL; layout = mp_common_load_edj(obj, MP_EDJ_NAME, "thumbnail_only"); if (layout == NULL) { mp_error("layout create failed"); } - /*create thumbnail*/ + /*create thumbnail */ Evas_Object *thumb = elm_image_add(layout); elm_object_focus_set(thumb, EINA_FALSE); if (thumbpath != NULL) { elm_image_file_set(thumb, thumbpath, NULL); } else { - char default_thumbnail[1024] = {0}; + char default_thumbnail[1024] = { 0 }; char *shared_path = app_get_shared_resource_path(); - snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, "shared_images", DEFAULT_THUMBNAIL); + snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, + "shared_images", DEFAULT_THUMBNAIL); free(shared_path); elm_image_file_set(thumb, default_thumbnail, NULL); } elm_object_part_content_set(layout, "default_thumbnail", thumb); - /*check if it is in personal page*/ + /*check if it is in personal page */ Evas_Object *personal_page = NULL; personal_page = elm_image_add(layout); elm_object_focus_set(personal_page, EINA_FALSE); @@ -931,17 +1061,22 @@ Evas_Object *mp_widget_lock_icon_create(Evas_Object *obj, const char *thumbpath) } #endif -Evas_Object *mp_widget_rich_info_text_add(Evas_Object *parent, const char *text) +Evas_Object *mp_widget_rich_info_text_add(Evas_Object * parent, + const char *text) { MP_CHECK_NULL(parent); - Evas_Object *obj = mp_common_load_edj(parent, MP_EDJ_NAME, "rich_info_label_layout"); + Evas_Object *obj = + mp_common_load_edj(parent, MP_EDJ_NAME, "rich_info_label_layout"); MP_CHECK_NULL(obj); Evas_Object *label = elm_label_add(obj); elm_label_line_wrap_set(label, ELM_WRAP_WORD); - char *label_text = g_strdup_printf("%s", text); + char *label_text = + g_strdup_printf + ("%s", + text); elm_object_text_set(label, label_text); IF_FREE(label_text); @@ -949,8 +1084,12 @@ Evas_Object *mp_widget_rich_info_text_add(Evas_Object *parent, const char *text) return obj; } -bool mp_widget_create_select_all_layout(Evas_Object *pParent, Evas_Smart_Cb pChangeFunc, - Evas_Object_Event_Cb pMouseDownFunc, void *pUserData, Evas_Object **pCheckBox, Evas_Object **pSelectLayout) +bool mp_widget_create_select_all_layout(Evas_Object * pParent, + Evas_Smart_Cb pChangeFunc, + Evas_Object_Event_Cb + pMouseDownFunc, void *pUserData, + Evas_Object ** pCheckBox, + Evas_Object ** pSelectLayout) { if (!pParent) { ERROR_TRACE("parent is NULL."); @@ -958,20 +1097,27 @@ bool mp_widget_create_select_all_layout(Evas_Object *pParent, Evas_Smart_Cb pCha } Evas_Object *pSelectAllLayout = elm_layout_add(pParent); - elm_layout_theme_set(pSelectAllLayout, "genlist", "item", "group_index/default"); - evas_object_size_hint_weight_set(pSelectAllLayout, EVAS_HINT_EXPAND, EVAS_HINT_FILL); - evas_object_size_hint_align_set(pSelectAllLayout, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_event_callback_add(pSelectAllLayout, EVAS_CALLBACK_MOUSE_DOWN, pMouseDownFunc, pUserData); + elm_layout_theme_set(pSelectAllLayout, "genlist", "item", + "group_index/default"); + evas_object_size_hint_weight_set(pSelectAllLayout, EVAS_HINT_EXPAND, + EVAS_HINT_FILL); + evas_object_size_hint_align_set(pSelectAllLayout, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_event_callback_add(pSelectAllLayout, + EVAS_CALLBACK_MOUSE_DOWN, + pMouseDownFunc, pUserData); *pSelectLayout = pSelectAllLayout; Evas_Object *pSelectAllCheckbox = elm_check_add(pSelectAllLayout); - evas_object_smart_callback_add(pSelectAllCheckbox, "changed", pChangeFunc, pUserData); + evas_object_smart_callback_add(pSelectAllCheckbox, "changed", + pChangeFunc, pUserData); evas_object_propagate_events_set(pSelectAllCheckbox, EINA_FALSE); - elm_object_part_content_set(pSelectAllLayout, "elm.swallow.end", pSelectAllCheckbox); - mp_util_domain_translatable_part_text_set(pSelectAllLayout, "elm.text", MP_SCREEN_READER_SELECT_ALL); + elm_object_part_content_set(pSelectAllLayout, "elm.swallow.end", + pSelectAllCheckbox); + mp_util_domain_translatable_part_text_set(pSelectAllLayout, "elm.text", + MP_SCREEN_READER_SELECT_ALL); evas_object_show(pSelectAllLayout); *pCheckBox = pSelectAllCheckbox; return TRUE; } - diff --git a/src/core/include/mp-file-tag-info.h b/src/core/include/mp-file-tag-info.h index 2e2b287..95451fe 100644 --- a/src/core/include/mp-file-tag-info.h +++ b/src/core/include/mp-file-tag-info.h @@ -19,8 +19,7 @@ #ifndef __mp_file_tag_info_H__ #define __mp_file_tag_info_H__ -typedef struct _tag_info_t -{ +typedef struct _tag_info_t { char *album; char *genre; char *author; @@ -39,10 +38,12 @@ typedef struct _tag_info_t } mp_tag_info_t; /* tag_info which must be freed with mp_file_tag_free() after use. */ -int mp_file_tag_info_get_all_tag(const char *filename, mp_tag_info_t * tag_info); +int mp_file_tag_info_get_all_tag(const char *filename, + mp_tag_info_t * tag_info); char *mp_file_tag_info_get_genre(const char *filename); -int mp_file_tag_info_get_albumart(const char *filename, char **albumart_path); +int mp_file_tag_info_get_albumart(const char *filename, + char **albumart_path); void mp_file_tag_free(mp_tag_info_t * tag_info); -#endif //__mp_file_tag_info_H__ +#endif //__mp_file_tag_info_H__ diff --git a/src/core/include/mp-http-mgr.h b/src/core/include/mp-http-mgr.h index acb256b..ac96bca 100644 --- a/src/core/include/mp-http-mgr.h +++ b/src/core/include/mp-http-mgr.h @@ -21,42 +21,38 @@ #include "mp-define.h" #define HTTP_ADDR_LEN_MAX 64 -typedef enum -{ +typedef enum { MP_HTTP_SVC_DEFAULT, MP_HTTP_SVC_SHAZAM, MP_HTTP_SVC_STREAMING, MP_HTTP_SVC_MAX, } mp_http_svc_type; -typedef enum -{ +typedef enum { MP_HTTP_RESPONSE_NORMAL, MP_HTTP_RESPONSE_DISCONNECT, } mp_http_response_type; -typedef enum -{ +typedef enum { MP_HTTP_RESP_FAIL, MP_HTTP_RESP_SUCCESS, } MpHttpRespResultType_t; typedef void (*MpHttpOpenCb) (gpointer user_data); -typedef bool (*MpHttpRespExcuteCb)(gpointer user_data, mp_http_response_type response_type); +typedef bool(*MpHttpRespExcuteCb) (gpointer user_data, + mp_http_response_type response_type); typedef bool(*MpHttpOpenExcuteCb) (gpointer user_data); -typedef enum -{ +typedef enum { MP_HTTP_STATE_NONE = 0, MP_HTTP_STATE_OFF = 0, MP_HTTP_STATE_CELLULAR, MP_HTTP_STATE_WIFI, } MpHttpState_t; -typedef struct mp_http_mgr_t -{ +typedef struct mp_http_mgr_t { struct appdata *ad; - MpHttpState_t http_state; //the state of the http + MpHttpState_t http_state; //the state of the http } mp_http_mgr_t; bool mp_http_mgr_create(void *data); @@ -65,4 +61,4 @@ MpHttpState_t mp_http_mgr_get_state(void *data); inline bool mp_http_mgr_is_connected(void *data); #define TOKEN "025B58C0" -#endif //__MP_HTTP_MGR_H__ +#endif //__MP_HTTP_MGR_H__ diff --git a/src/core/include/mp-language-mgr.h b/src/core/include/mp-language-mgr.h index 4f0e192..74270d6 100644 --- a/src/core/include/mp-language-mgr.h +++ b/src/core/include/mp-language-mgr.h @@ -19,30 +19,37 @@ #include -typedef enum -{ - OBJ_TYPE_ELM_OBJECT, //elm_object_text_set(obj, text) - OBJ_TYPE_EDJE_OBJECT, //edje_object_part_text_set(obj, part, text) +typedef enum { + OBJ_TYPE_ELM_OBJECT, //elm_object_text_set(obj, text) + OBJ_TYPE_EDJE_OBJECT, //edje_object_part_text_set(obj, part, text) OBJ_TYPE_MAX, -}obj_type; +} obj_type; -typedef void (*Mp_Language_Update_Func)(Evas_Object *obj, const char *part, const char *ids); +typedef void (*Mp_Language_Update_Func) (Evas_Object * obj, + const char *part, + const char *ids); int mp_language_mgr_create(); int mp_language_mgr_destroy(); /*part and string_id must be static*/ -void mp_language_mgr_register_object(Evas_Object *obj, obj_type type, const char *part, const char *string_id); -void mp_language_mgr_register_object_func_set(Evas_Object *obj, const char *part, const char *text_id, Mp_Language_Update_Func func); -void mp_language_mgr_unregister_object_item(Elm_Object_Item *object_item); -void mp_language_mgr_object_item_text_ID_set(Elm_Object_Item *object_item, const char *text_ID); - -void mp_language_mgr_unregister_genlist_item(Elm_Object_Item *item); - -void mp_language_mgr_register_gengrid_item(Elm_Object_Item *item); -void mp_language_mgr_unregister_gengrid_item(Elm_Object_Item *item); +void mp_language_mgr_register_object(Evas_Object * obj, obj_type type, + const char *part, + const char *string_id); +void mp_language_mgr_register_object_func_set(Evas_Object * obj, + const char *part, + const char *text_id, + Mp_Language_Update_Func + func); +void mp_language_mgr_unregister_object_item(Elm_Object_Item * object_item); +void mp_language_mgr_object_item_text_ID_set(Elm_Object_Item * object_item, + const char *text_ID); + +void mp_language_mgr_unregister_genlist_item(Elm_Object_Item * item); + +void mp_language_mgr_register_gengrid_item(Elm_Object_Item * item); +void mp_language_mgr_unregister_gengrid_item(Elm_Object_Item * item); void mp_language_mgr_update(); #endif - diff --git a/src/core/include/mp-lyric-mgr.h b/src/core/include/mp-lyric-mgr.h index 49c5bbc..db18aa9 100644 --- a/src/core/include/mp-lyric-mgr.h +++ b/src/core/include/mp-lyric-mgr.h @@ -20,33 +20,30 @@ #include "mp-define.h" -#define MP_LRC_LINE_BUF_LEN (int)255 /* The max length of one line string buffer */ +#define MP_LRC_LINE_BUF_LEN (int)255 /* The max length of one line string buffer */ -typedef enum -{ - MP_LYRIC_SOURCE_BUFFER=0, +typedef enum { + MP_LYRIC_SOURCE_BUFFER = 0, MP_LYRIC_SOURCE_LIST, MP_LYRIC_SOURCE_FILE, -}mp_lyric_source_type; +} mp_lyric_source_type; -typedef struct -{ +typedef struct { long time; char *lyric; -}mp_lrc_node_t; +} mp_lrc_node_t; -typedef struct -{ +typedef struct { char *title; char *artist; char *album; - long offset; /* The offset of all time tags */ + long offset; /* The offset of all time tags */ Eina_List *synclrc_list; Eina_List *unsynclrc_list; -}mp_lyric_mgr_t; +} mp_lyric_mgr_t; mp_lyric_mgr_t *mp_lyric_mgr_create(const char *path); -void mp_lyric_mgr_destory(mp_lyric_mgr_t *lyric_mgr); +void mp_lyric_mgr_destory(mp_lyric_mgr_t * lyric_mgr); -#endif /* __MP_LYRIC_MGR_H__ */ +#endif /* __MP_LYRIC_MGR_H__ */ diff --git a/src/core/include/mp-player-control.h b/src/core/include/mp-player-control.h index 944a31f..b529909 100644 --- a/src/core/include/mp-player-control.h +++ b/src/core/include/mp-player-control.h @@ -27,7 +27,8 @@ void mp_player_control_stop(struct appdata *ad); void mp_play_control_ff(int press, bool event_by_mediakey, bool clicked); void mp_play_control_rew(int press, bool event_by_mediakey, bool clicked); void mp_play_control_reset_ff_rew(void); -void mp_play_control_menu_cb(void *data, Evas_Object * o, const char *emission, const char *source); +void mp_play_control_menu_cb(void *data, Evas_Object * o, + const char *emission, const char *source); void mp_play_control_end_of_stream(void *data); int mp_player_control_ready_new_file(void *data, bool check_drm); void mp_play_control_on_error(struct appdata *ad, int ret, bool add_watch); diff --git a/src/core/include/mp-player-mgr.h b/src/core/include/mp-player-mgr.h index d369c4a..a8af92c 100644 --- a/src/core/include/mp-player-mgr.h +++ b/src/core/include/mp-player-mgr.h @@ -26,27 +26,35 @@ typedef enum { MP_PLAYER_TYPE_MMFW, } mp_player_type_e; -typedef void (*Seek_Done_Cb)(void *data); -typedef void (*mp_player_started_cb)(void *user_data); -typedef void (*mp_player_paused_cb)(void *user_data); -typedef void (*mp_player_duration_changed_cb)(void *user_data); +typedef void (*Seek_Done_Cb) (void *data); +typedef void (*mp_player_started_cb) (void *user_data); +typedef void (*mp_player_paused_cb) (void *user_data); +typedef void (*mp_player_duration_changed_cb) (void *user_data); player_h mp_player_mgr_get_player(void); bool mp_player_mgr_is_active(void); -void mp_player_mgr_set_started_db(mp_player_started_cb callback, void *user_data); -void mp_player_mgr_set_completed_cb(player_completed_cb callback, void *user_data); -void mp_player_mgr_set_interrupted_cb(player_interrupted_cb callback, void *user_data); -void mp_player_mgr_set_error_cb(player_error_cb callback, void *user_data); -void mp_player_mgr_set_buffering_cb(player_buffering_cb callback, void *user_data); -void mp_player_mgr_set_prepare_cb(player_prepared_cb callback, void *user_data); -void mp_player_mgr_set_paused_cb(mp_player_paused_cb callback, void *user_data); -void mp_player_mgr_set_duration_changed_cb(mp_player_duration_changed_cb callback, void *user_data); +void mp_player_mgr_set_started_db(mp_player_started_cb callback, + void *user_data); +void mp_player_mgr_set_completed_cb(player_completed_cb callback, + void *user_data); +void mp_player_mgr_set_interrupted_cb(player_interrupted_cb callback, + void *user_data); +void mp_player_mgr_set_error_cb(player_error_cb callback, void *user_data); +void mp_player_mgr_set_buffering_cb(player_buffering_cb callback, + void *user_data); +void mp_player_mgr_set_prepare_cb(player_prepared_cb callback, + void *user_data); +void mp_player_mgr_set_paused_cb(mp_player_paused_cb callback, + void *user_data); +void mp_player_mgr_set_duration_changed_cb(mp_player_duration_changed_cb + callback, void *user_data); void mp_player_mgr_unset_completed_cb(void); void mp_player_mgr_unset_interrupted_cb(void); void mp_player_mgr_unset_error_cb(void); void mp_player_mgr_unset_buffering_cb(void); -int mp_player_mgr_create(void *data, const char * path, mp_player_type_e type, void *extra_data); +int mp_player_mgr_create(void *data, const char *path, + mp_player_type_e type, void *extra_data); int mp_player_mgr_create_with_buffer(void *data, void *buffer, int size); // buffer will be managed by player_mgr bool mp_player_mgr_destroy(void *data); int mp_player_mgr_realize(void *data); @@ -57,7 +65,8 @@ int mp_player_mgr_resume(void *data); bool mp_player_mgr_pause(void *data); void mp_player_mgr_set_mute(bool bMuteEnable); bool mp_player_mgr_is_seeking(void); -bool mp_player_mgr_set_position(unsigned int pos, Seek_Done_Cb done_cb, void *data); +bool mp_player_mgr_set_position(unsigned int pos, Seek_Done_Cb done_cb, + void *data); Eina_Bool mp_player_mgr_seek_done(void *data); void mp_player_mgr_unset_seek_done_cb(); bool mp_player_mgr_set_play_speed(double speed); @@ -78,11 +87,16 @@ bool mp_player_mgr_volume_set(int volume); bool mp_player_mgr_volume_up(); bool mp_player_mgr_volume_down(); int mp_player_mgr_safety_volume_set(int foreground); -bool mp_player_mgr_get_content_info(char **title, char **album, char **artist, char **author, char **genre, char **year); -void mp_playlist_mgr_item_remove_deleted_item(mp_plst_mgr *playlist_mgr); +bool mp_player_mgr_get_content_info(char **title, char **album, + char **artist, char **author, + char **genre, char **year); +void mp_playlist_mgr_item_remove_deleted_item(mp_plst_mgr * playlist_mgr); -int mp_player_mgr_set_progressive_download(const char *path, player_pd_message_cb callback, void *user_data); -int _mp_player_mgr_create_common(struct appdata *ad, mp_player_type_e type); +int mp_player_mgr_set_progressive_download(const char *path, + player_pd_message_cb callback, + void *user_data); +int _mp_player_mgr_create_common(struct appdata *ad, + mp_player_type_e type); int mp_player_mgr_prepare(void *data); -#endif //__MP_player_mgr_H_ +#endif //__MP_player_mgr_H_ diff --git a/src/core/include/mp-playlist-mgr.h b/src/core/include/mp-playlist-mgr.h index 19f5944..eddc07d 100644 --- a/src/core/include/mp-playlist-mgr.h +++ b/src/core/include/mp-playlist-mgr.h @@ -21,24 +21,22 @@ #include #include "mp-define.h" -typedef enum{ +typedef enum { MP_TRACK_URI, -}mp_track_type; +} mp_track_type; typedef enum { MP_PLST_TYPE_NONE, MP_PLST_TYPE_MUSIC_SQUARE, } mp_plst_type; -typedef enum _mp_plst_repeat_state -{ +typedef enum _mp_plst_repeat_state { MP_PLST_REPEAT_ALL, MP_PLST_REPEAT_NONE, MP_PLST_REPEAT_ONE, -}mp_plst_repeat_state; +} mp_plst_repeat_state; -typedef struct -{ +typedef struct { FILE *fp; Ecore_Timer *timer; int index_of_first; @@ -47,27 +45,26 @@ typedef struct int add_remained; } mp_plst_lazy_appender_s; -typedef struct _mp_list_item -{ +typedef struct _mp_list_item { mp_track_type track_type; - char *uri; //local track uri.. - char *uid; //unique id (media_id or allshare item id) + char *uri; //local track uri.. + char *uid; //unique id (media_id or allshare item id) char *title; char *artist; char *thumbnail_path; int playlist_memeber_id; Eina_Bool isDiffAP; bool out_of_list; -}mp_plst_item; +} mp_plst_item; -typedef void (*mp_playlist_item_change_callback)(mp_plst_item *item, void *userdata); +typedef void (*mp_playlist_item_change_callback) (mp_plst_item * item, + void *userdata); -typedef struct _mp_plst_mgr -{ +typedef struct _mp_plst_mgr { int current_index; Eina_Bool shuffle_state; //shuffle on/off - mp_plst_repeat_state repeat_state; //off:0/one:1/all:2 - GList *list; //normal list do not free, just refer normal_list or shuffle_list + mp_plst_repeat_state repeat_state; //off:0/one:1/all:2 + GList *list; //normal list do not free, just refer normal_list or shuffle_list GList *normal_list; GList *shuffle_list; void *item_change_userdata; @@ -84,52 +81,83 @@ typedef struct _mp_plst_mgr mp_plst_mgr *mp_playlist_mgr_create(void); -void mp_playlist_mgr_destroy(mp_plst_mgr *playlist_mgr); - -mp_plst_item * mp_playlist_mgr_item_append(mp_plst_mgr *playlist_mgr, const char *uri, const char *uid, const char *title, const char *artist, mp_track_type type); -mp_plst_item * mp_playlist_mgr_item_insert(mp_plst_mgr *playlist_mgr, const char *uri, const char *uid, const char *title, const char *artist, mp_track_type type, int index); -void mp_playlist_mgr_item_set_playlist_memeber_id(mp_plst_item *item, int memeber_id); -void mp_playlist_mgr_item_remove_item(mp_plst_mgr *playlist_mgr, mp_plst_item *item); -void mp_playlist_mgr_item_remove_nth(mp_plst_mgr *playlist_mgr, int index); -void mp_playlist_mgr_clear(mp_plst_mgr *playlist_mgr); - -int mp_playlist_mgr_count(mp_plst_mgr *playlist_mgr); -mp_plst_item *mp_playlist_mgr_get_current(mp_plst_mgr *playlist_mgr); -mp_plst_item *mp_playlist_mgr_get_next(mp_plst_mgr *playlist_mgr, Eina_Bool force, Eina_Bool refresh_shuffle); -mp_plst_item *mp_playlist_mgr_get_prev(mp_plst_mgr *playlist_mgr); -mp_plst_item *mp_playlist_mgr_get_nth(mp_plst_mgr *playlist_mgr, int index); -mp_plst_item *mp_playlist_mgr_normal_list_get_nth(mp_plst_mgr *playlist_mgr, int index); -mp_plst_item *mp_playlist_mgr_get_item_by_uid(mp_plst_mgr *playlist_mgr, const char *uid); -mp_plst_item *mp_playlist_mgr_get_item_by_playlist_memeber_id(mp_plst_mgr *playlist_mgr, int member_id); - -void mp_playlist_mgr_set_shuffle_first_item(mp_plst_mgr *playlist_mgr, mp_plst_item *first); -void mp_playlist_mgr_set_current(mp_plst_mgr *playlist_mgr, mp_plst_item *cur); - -void mp_playlist_mgr_set_shuffle(mp_plst_mgr *playlist_mgr, Eina_Bool shuffle); -bool mp_playlist_mgr_get_shuffle(mp_plst_mgr *playlist_mgr); - -Eina_Bool mp_playlist_mgr_is_shuffle(mp_plst_mgr *playlist_mgr); -void mp_playlist_mgr_set_repeat(mp_plst_mgr *playlist_mgr, mp_plst_repeat_state repeat); -int mp_playlist_mgr_get_repeat(mp_plst_mgr *playlist_mgr); -int mp_playlist_mgr_set_item_change_callback(mp_plst_mgr *playlist_mgr, mp_playlist_item_change_callback cb, void *userdata); - -void mp_playlist_mgr_set_list_type(mp_plst_mgr *playlist_mgr, mp_plst_type type); -mp_plst_type mp_playlist_mgr_get_list_type(mp_plst_mgr *playlist_mgr); - -void mp_playlist_mgr_item_reorder(mp_plst_mgr *playlist_mgr, mp_plst_item *item, int new_index); -void mp_playlist_mgr_check_existance_and_refresh(mp_plst_mgr *playlist_mgr, bool *current_removed); - -void mp_playlist_mgr_set_playlist_id(mp_plst_mgr *playlist_mgr, int playlist_id); -int mp_playlist_mgr_get_playlist_id(mp_plst_mgr *playlist_mgr); - -mp_plst_item *mp_playlist_mgr_lazy_append_with_file(mp_plst_mgr *playlist_mgr, const char *list_file, const char *cur_file_path, int start_index); +void mp_playlist_mgr_destroy(mp_plst_mgr * playlist_mgr); + +mp_plst_item *mp_playlist_mgr_item_append(mp_plst_mgr * playlist_mgr, + const char *uri, const char *uid, + const char *title, + const char *artist, + mp_track_type type); +mp_plst_item *mp_playlist_mgr_item_insert(mp_plst_mgr * playlist_mgr, + const char *uri, const char *uid, + const char *title, + const char *artist, + mp_track_type type, int index); +void mp_playlist_mgr_item_set_playlist_memeber_id(mp_plst_item * item, + int memeber_id); +void mp_playlist_mgr_item_remove_item(mp_plst_mgr * playlist_mgr, + mp_plst_item * item); +void mp_playlist_mgr_item_remove_nth(mp_plst_mgr * playlist_mgr, + int index); +void mp_playlist_mgr_clear(mp_plst_mgr * playlist_mgr); + +int mp_playlist_mgr_count(mp_plst_mgr * playlist_mgr); +mp_plst_item *mp_playlist_mgr_get_current(mp_plst_mgr * playlist_mgr); +mp_plst_item *mp_playlist_mgr_get_next(mp_plst_mgr * playlist_mgr, + Eina_Bool force, + Eina_Bool refresh_shuffle); +mp_plst_item *mp_playlist_mgr_get_prev(mp_plst_mgr * playlist_mgr); +mp_plst_item *mp_playlist_mgr_get_nth(mp_plst_mgr * playlist_mgr, + int index); +mp_plst_item *mp_playlist_mgr_normal_list_get_nth(mp_plst_mgr * + playlist_mgr, int index); +mp_plst_item *mp_playlist_mgr_get_item_by_uid(mp_plst_mgr * playlist_mgr, + const char *uid); +mp_plst_item *mp_playlist_mgr_get_item_by_playlist_memeber_id(mp_plst_mgr * + playlist_mgr, + int + member_id); + +void mp_playlist_mgr_set_shuffle_first_item(mp_plst_mgr * playlist_mgr, + mp_plst_item * first); +void mp_playlist_mgr_set_current(mp_plst_mgr * playlist_mgr, + mp_plst_item * cur); + +void mp_playlist_mgr_set_shuffle(mp_plst_mgr * playlist_mgr, + Eina_Bool shuffle); +bool mp_playlist_mgr_get_shuffle(mp_plst_mgr * playlist_mgr); + +Eina_Bool mp_playlist_mgr_is_shuffle(mp_plst_mgr * playlist_mgr); +void mp_playlist_mgr_set_repeat(mp_plst_mgr * playlist_mgr, + mp_plst_repeat_state repeat); +int mp_playlist_mgr_get_repeat(mp_plst_mgr * playlist_mgr); +int mp_playlist_mgr_set_item_change_callback(mp_plst_mgr * playlist_mgr, + mp_playlist_item_change_callback + cb, void *userdata); + +void mp_playlist_mgr_set_list_type(mp_plst_mgr * playlist_mgr, + mp_plst_type type); +mp_plst_type mp_playlist_mgr_get_list_type(mp_plst_mgr * playlist_mgr); + +void mp_playlist_mgr_item_reorder(mp_plst_mgr * playlist_mgr, + mp_plst_item * item, int new_index); +void mp_playlist_mgr_check_existance_and_refresh(mp_plst_mgr * + playlist_mgr, + bool * current_removed); + +void mp_playlist_mgr_set_playlist_id(mp_plst_mgr * playlist_mgr, + int playlist_id); +int mp_playlist_mgr_get_playlist_id(mp_plst_mgr * playlist_mgr); + +mp_plst_item *mp_playlist_mgr_lazy_append_with_file(mp_plst_mgr * + playlist_mgr, + const char *list_file, + const char + *cur_file_path, + int start_index); mp_plst_item *mp_playlist_mgr_custom_item_new(const char *uri); -void mp_playlist_mgr_custom_item_free(mp_plst_item *item); -int mp_playlist_mgr_get_index(mp_plst_mgr *playlist_mgr); -int mp_playlist_mgr_get_normal_index(mp_plst_mgr *playlist_mgr); +void mp_playlist_mgr_custom_item_free(mp_plst_item * item); +int mp_playlist_mgr_get_index(mp_plst_mgr * playlist_mgr); +int mp_playlist_mgr_get_normal_index(mp_plst_mgr * playlist_mgr); #endif - - - - diff --git a/src/core/include/mp-setting-ctrl.h b/src/core/include/mp-setting-ctrl.h index 7dd30be..30815c7 100644 --- a/src/core/include/mp-setting-ctrl.h +++ b/src/core/include/mp-setting-ctrl.h @@ -19,8 +19,8 @@ typedef void (*MpSettingPlaylist_Cb) (int state, void *data); typedef void (*MpSettingSaChange_Cb) (int state, void *data); -typedef void (*MpSettingAutoOff_Cb)(int min, void *data); -typedef void (*MpSettingPlaySpeed_Cb)(double speed, void *data); +typedef void (*MpSettingAutoOff_Cb) (int min, void *data); +typedef void (*MpSettingPlaySpeed_Cb) (double speed, void *data); int mp_setting_init(struct appdata *ad); int mp_setting_deinit(struct appdata *ad); @@ -31,20 +31,20 @@ int mp_setting_get_repeat_state(int *val); void mp_setting_set_nowplaying_id(int val); int mp_setting_get_nowplaying_id(void); int mp_setting_playlist_get_state(int *state); -int mp_setting_playlist_set_callback(MpSettingPlaylist_Cb func, void *data); +int mp_setting_playlist_set_callback(MpSettingPlaylist_Cb func, + void *data); void mp_setting_set_player_state(int val); void mp_setting_save_now_playing(void *ad); void mp_setting_save_playing_info(void *ad); void mp_setting_get_now_playing_path_from_file(char **path); -void mp_setting_save_shortcut(char *shortcut_title, char *artist, char *shortcut_description, - char *shortcut_image_path); +void mp_setting_save_shortcut(char *shortcut_title, char *artist, + char *shortcut_description, + char *shortcut_image_path); void mp_setting_remove_now_playing_shared_status(void); void mp_setting_remove_now_playing(void); -int -mp_setting_read_playing_status(char *uri, char *status); -void -mp_setting_write_playing_status(char *uri, char *status); +int mp_setting_read_playing_status(char *uri, char *status); +void mp_setting_write_playing_status(char *uri, char *status); #ifdef MP_FEATURE_AUTO_OFF int mp_setting_auto_off_set_callback(MpSettingAutoOff_Cb func, void *data); @@ -53,7 +53,8 @@ int mp_setting_get_auto_off_time(); #endif #ifdef MP_FEATURE_PLAY_SPEED -int mp_setting_set_play_speed_change_callback(MpSettingPlaySpeed_Cb func, void *data); +int mp_setting_set_play_speed_change_callback(MpSettingPlaySpeed_Cb func, + void *data); int mp_setting_reset_play_speed(); double mp_setting_get_play_speed(); #endif @@ -63,7 +64,7 @@ int mp_setting_get_side_sync_status(void); void mp_setting_update_active_device(); #ifdef MP_FEATURE_PERSONAL_PAGE bool mp_setting_set_personal_dont_ask_again(bool bAsked); -bool mp_setting_get_personal_dont_ask_again(bool *bAsked); +bool mp_setting_get_personal_dont_ask_again(bool * bAsked); #endif -#endif // __MP_SETTING_CTRL_H_ +#endif // __MP_SETTING_CTRL_H_ diff --git a/src/core/include/mp-square-mgr.h b/src/core/include/mp-square-mgr.h index 80b1ec0..dcab3f9 100644 --- a/src/core/include/mp-square-mgr.h +++ b/src/core/include/mp-square-mgr.h @@ -35,15 +35,15 @@ #define MP_SQUARE_METADATA_LEN_MAX 193 -#define MP_SQUARE_MUSIC_FILE_PATH_LEN_MAX 1024 +#define MP_SQUARE_MUSIC_FILE_PATH_LEN_MAX 1024 #define MP_SQUARE_DB_ERROR_CONNECT -201 /**< connect DB error */ -#define MP_SQUARE_DB_ERROR_DISCONNECT -202 /**< disconnect DB error */ -#define MP_SQUARE_DB_ERROR_CREATE_TABLE -203 /**< create table error */ -#define MP_SQUARE_DB_ERROR_NO_RECORD -204 /**< No record */ -#define MP_SQUARE_DB_ERROR_OUT_OF_RANGE -205 /**< DB out of table records range*/ -#define MP_SQUARE_DB_ERROR_INTERNAL -206 /**< internal db error */ -#define MP_SQUARE_DB_ERROR_INVALID_PARAMETER -1 +#define MP_SQUARE_DB_ERROR_DISCONNECT -202 /**< disconnect DB error */ +#define MP_SQUARE_DB_ERROR_CREATE_TABLE -203 /**< create table error */ +#define MP_SQUARE_DB_ERROR_NO_RECORD -204 /**< No record */ +#define MP_SQUARE_DB_ERROR_OUT_OF_RANGE -205 /**< DB out of table records range*/ +#define MP_SQUARE_DB_ERROR_INTERNAL -206 /**< internal db error */ +#define MP_SQUARE_DB_ERROR_INVALID_PARAMETER -1 #define MP_SQUARE_NORMAL_ERROR -1 #define MP_SQUARE_DB_ERROR_NONE 0 @@ -69,8 +69,7 @@ *position.y = index/MP_SQUARE_AXIS_X_LEN+1;\ } while (0) -typedef enum -{ +typedef enum { MP_SQUARE_TYPE_MOOD, MP_SQUARE_TYPE_YEAR, MP_SQUARE_TYPE_ADDED, @@ -78,8 +77,7 @@ typedef enum MP_SQUARE_TYPE_MAX, } mp_square_type_t; -enum -{ +enum { MP_SQUARE_CELL_0, MP_SQUARE_CELL_1, MP_SQUARE_CELL_2, @@ -88,21 +86,18 @@ enum MP_SQUARE_CELL_MAX }; -typedef struct -{ +typedef struct { int x:8; int y:8; } mp_square_position_t; -typedef struct -{ - char path[MP_SQUARE_MUSIC_FILE_PATH_LEN_MAX+1]; +typedef struct { + char path[MP_SQUARE_MUSIC_FILE_PATH_LEN_MAX + 1]; mp_square_position_t pos; mp_square_type_t type; } mp_square_item_t; -typedef struct -{ +typedef struct { struct appdata *ad; sqlite3 *sqlite_handle; @@ -110,19 +105,19 @@ typedef struct //void *smp123_lib_handle; Ecore_Timer *create_record_timer; - int record_count; /* current inserted record count */ - int total_count; /* total record counts */ + int record_count; /* current inserted record count */ + int total_count; /* total record counts */ - GList *list[MP_SQUARE_TYPE_MAX][MP_SQUARE_CELLS_COUNT]; /* mp_square_item_t */ + GList *list[MP_SQUARE_TYPE_MAX][MP_SQUARE_CELLS_COUNT]; /* mp_square_item_t */ - GList *selected_list_item; /* mp_square_item_info_t */ + GList *selected_list_item; /* mp_square_item_info_t */ int selected_type; - /*all tracks svc handle*/ + /*all tracks svc handle */ mp_media_list_h svc_handle; int media_count; bool *added_media_array; - bool terminal_status; + bool terminal_status; int current_index; void *record; @@ -131,8 +126,8 @@ typedef struct GList *year_x[MP_SQUARE_CELL_MAX]; } mp_square_mgr_t; -typedef struct{ - char audio_id[SQUARE_MAX_NAM_LEN+1]; /**< Unique ID of item */ +typedef struct { + char audio_id[SQUARE_MAX_NAM_LEN + 1]; /**< Unique ID of item */ char pathname[SQUARE_MAX_NAM_LEN]; /**< Full path and file name of media file */ char title[MP_SQUARE_METADATA_LEN_MAX]; /**< title of track */ char artist[MP_SQUARE_METADATA_LEN_MAX]; /**< artist of track */ @@ -141,8 +136,7 @@ typedef struct{ int rating; /**< track rating*/ } mp_square_list_item_t; -typedef enum -{ +typedef enum { MP_SQUARE_LIST_ITEM_AUDIO_ID, /**< Unique media file index*/ MP_SQUARE_LIST_ITEM_PATHNAME, /**< Full path and file name of media file*/ MP_SQUARE_LIST_ITEM_THUMBNAIL_PATH, /**< Thumbnail path of first item in the group */ @@ -153,32 +147,44 @@ typedef enum MP_SQUARE_LIST_ITEM_ALBUM, /**< Album of media file*/ } mp_square_list_item_type_t; -bool mp_square_mgr_records_get_by_type_and_positions( - mp_square_mgr_t *square_mgr, - mp_square_type_t type, - GList *list_pos, - GList **list_record); -bool mp_square_mgr_get_positon_by_type_and_path( - mp_square_mgr_t *square_mgr, - mp_square_type_t type, - const char *path, - mp_square_position_t *pos); +bool mp_square_mgr_records_get_by_type_and_positions(mp_square_mgr_t * + square_mgr, + mp_square_type_t type, + GList * list_pos, + GList ** list_record); +bool mp_square_mgr_get_positon_by_type_and_path(mp_square_mgr_t * + square_mgr, + mp_square_type_t type, + const char *path, + mp_square_position_t * + pos); int mp_square_mgr_create(struct appdata *ad); bool mp_square_mgr_destory(struct appdata *ad); int mp_square_mgr_update(struct appdata *ad); -int mp_square_mgr_update_diff_only(struct appdata * ad); +int mp_square_mgr_update_diff_only(struct appdata *ad); int mp_square_mgr_reset(struct appdata *ad); -int mp_square_mgr_records_count_get(mp_square_mgr_t *square_mgr, int *count); -void mp_square_mgr_selected_list_items_clear(mp_square_mgr_t *square_mgr); -int mp_square_mgr_selected_list_items_get(mp_square_mgr_t *square_mgr, int *type, GList **item_list); +int mp_square_mgr_records_count_get(mp_square_mgr_t * square_mgr, + int *count); +void mp_square_mgr_selected_list_items_clear(mp_square_mgr_t * square_mgr); +int mp_square_mgr_selected_list_items_get(mp_square_mgr_t * square_mgr, + int *type, GList ** item_list); /* for cell list view */ -int mp_square_mgr_list_items_count_get(mp_square_mgr_t *square_mgr); -int mp_square_mgr_list_item_new(mp_media_list_h *list_handle, int count); +int mp_square_mgr_list_items_count_get(mp_square_mgr_t * square_mgr); +int mp_square_mgr_list_item_new(mp_media_list_h * list_handle, int count); int mp_square_mgr_list_item_free(mp_media_list_h list_handle); -int mp_square_mgr_list_items_get(mp_square_mgr_t *square_mgr, int count, mp_media_list_h list_handle); -int mp_square_mgr_list_item_get(mp_media_list_h list_handle, int index, mp_media_info_h *item); -int mp_square_mgr_list_item_val_get(mp_media_info_h item_handle, int index, mp_square_list_item_type_t first_field_name, ...); -bool mp_square_mgr_square_item_update_position_by_type(mp_square_mgr_t *square_mgr, mp_square_item_t *item, mp_square_type_t type); - -#endif /* __MP_SQUARE_MGR_H_ */ +int mp_square_mgr_list_items_get(mp_square_mgr_t * square_mgr, int count, + mp_media_list_h list_handle); +int mp_square_mgr_list_item_get(mp_media_list_h list_handle, int index, + mp_media_info_h * item); +int mp_square_mgr_list_item_val_get(mp_media_info_h item_handle, int index, + mp_square_list_item_type_t + first_field_name, ...); +bool mp_square_mgr_square_item_update_position_by_type(mp_square_mgr_t * + square_mgr, + mp_square_item_t * + item, + mp_square_type_t + type); + +#endif /* __MP_SQUARE_MGR_H_ */ diff --git a/src/core/include/mp-view-mgr.h b/src/core/include/mp-view-mgr.h index 7554504..d7d1b52 100644 --- a/src/core/include/mp-view-mgr.h +++ b/src/core/include/mp-view-mgr.h @@ -21,32 +21,38 @@ #include #include "mp-view.h" -typedef struct{ +typedef struct { Evas_Object *navi; -}MpViewMgr_t; +} MpViewMgr_t; #define GET_VIEW_MGR mp_view_mgr_get_view_manager() #define GET_PLAYER_VIEW mp_view_mgr_get_view(GET_VIEW_MGR, MP_VIEW_PLAYER) #define GET_ALL_VIEW mp_view_mgr_get_view(GET_VIEW_MGR, MP_VIEW_ALL) #define GET_NAVIFRAME ((mp_view_mgr_get_view_manager()) ? mp_view_mgr_get_view_manager()->navi : NULL) -MpViewMgr_t *mp_view_mgr_create(Evas_Object *parent); -int mp_view_mgr_destory(MpViewMgr_t *view_mgr); +MpViewMgr_t *mp_view_mgr_create(Evas_Object * parent); +int mp_view_mgr_destory(MpViewMgr_t * view_mgr); EXPORT_API MpViewMgr_t *mp_view_mgr_get_view_manager(); -MpView_t * mp_view_mgr_get_top_view(MpViewMgr_t *view_mgr); -EXPORT_API MpView_t * mp_view_mgr_get_view(MpViewMgr_t *view_mgr, MpViewType_e type); -EXPORT_API MpView_t * mp_view_mgr_get_view_prev(MpViewMgr_t *view_mgr, MpViewType_e type); - -EXPORT_API int mp_view_mgr_push_view_with_effect(MpViewMgr_t *view_mgr, MpView_t *view, const char *item_style, bool disable_effect); -EXPORT_API int mp_view_mgr_push_view(MpViewMgr_t *view_mgr, MpView_t *view, const char *item_style); -int mp_view_mgr_pop_view(MpViewMgr_t *view_mgr, bool pop_view); -int mp_view_mgr_pop_to_view(MpViewMgr_t *view_mgr, MpViewType_e type); -int mp_view_mgr_delete_view(MpViewMgr_t *view_mgr, MpViewType_e type); -int mp_view_mgr_count_view(MpViewMgr_t *view_mgr); -int mp_view_mgr_pop_a_view(MpViewMgr_t *view_mgr, MpView_t *view); - -void mp_view_mgr_post_event(MpViewMgr_t *view_mgr, MpViewEvent_e event); +MpView_t *mp_view_mgr_get_top_view(MpViewMgr_t * view_mgr); +EXPORT_API MpView_t *mp_view_mgr_get_view(MpViewMgr_t * view_mgr, + MpViewType_e type); +EXPORT_API MpView_t *mp_view_mgr_get_view_prev(MpViewMgr_t * view_mgr, + MpViewType_e type); + +EXPORT_API int mp_view_mgr_push_view_with_effect(MpViewMgr_t * view_mgr, + MpView_t * view, + const char *item_style, + bool disable_effect); +EXPORT_API int mp_view_mgr_push_view(MpViewMgr_t * view_mgr, + MpView_t * view, + const char *item_style); +int mp_view_mgr_pop_view(MpViewMgr_t * view_mgr, bool pop_view); +int mp_view_mgr_pop_to_view(MpViewMgr_t * view_mgr, MpViewType_e type); +int mp_view_mgr_delete_view(MpViewMgr_t * view_mgr, MpViewType_e type); +int mp_view_mgr_count_view(MpViewMgr_t * view_mgr); +int mp_view_mgr_pop_a_view(MpViewMgr_t * view_mgr, MpView_t * view); + +void mp_view_mgr_post_event(MpViewMgr_t * view_mgr, MpViewEvent_e event); #endif - diff --git a/src/core/include/mp-volume.h b/src/core/include/mp-volume.h index 01d94cb..a42b44b 100644 --- a/src/core/include/mp-volume.h +++ b/src/core/include/mp-volume.h @@ -32,30 +32,31 @@ typedef enum { } mp_volume_key_grab_condition_e; -typedef void (*Mp_Volume_Key_Event_Cb)(void *user_data, mp_volume_key_e key, bool released); -typedef void (*Mp_Volume_Change_Cb)(int volume, void *user_data); +typedef void (*Mp_Volume_Key_Event_Cb) (void *user_data, + mp_volume_key_e key, + bool released); +typedef void (*Mp_Volume_Change_Cb) (int volume, void *user_data); #ifdef __cplusplus extern "C" { #endif -void mp_volume_init(void *win); -void mp_volume_finalize(void); -void mp_volume_key_grab_condition_set(mp_volume_key_grab_condition_e condition, bool enabled); -bool mp_volume_key_grab_start(); -void mp_volume_key_grab_end(); -bool mp_volume_key_is_grabed(); -void mp_volume_key_event_send(mp_volume_key_e type, bool released); -void mp_volume_key_event_callback_add(Mp_Volume_Key_Event_Cb event_cb, void *user_data); -void mp_volume_key_event_callback_del(); -void mp_volume_key_event_timer_del(); -void mp_volume_add_change_cb(Mp_Volume_Change_Cb cb, void *user_data); -void _mp_volume_handle_change(unsigned int volume); + void mp_volume_init(void *win); + void mp_volume_finalize(void); + void mp_volume_key_grab_condition_set(mp_volume_key_grab_condition_e + condition, bool enabled); + bool mp_volume_key_grab_start(); + void mp_volume_key_grab_end(); + bool mp_volume_key_is_grabed(); + void mp_volume_key_event_send(mp_volume_key_e type, bool released); + void mp_volume_key_event_callback_add(Mp_Volume_Key_Event_Cb event_cb, + void *user_data); + void mp_volume_key_event_callback_del(); + void mp_volume_key_event_timer_del(); + void mp_volume_add_change_cb(Mp_Volume_Change_Cb cb, void *user_data); + void _mp_volume_handle_change(unsigned int volume); #ifdef __cplusplus } #endif - - -#endif /* __MP_VOLMUE_H__ */ - +#endif /* __MP_VOLMUE_H__ */ diff --git a/src/core/mp-file-tag-info.c b/src/core/mp-file-tag-info.c index 84105d1..1c97106 100644 --- a/src/core/mp-file-tag-info.c +++ b/src/core/mp-file-tag-info.c @@ -33,7 +33,8 @@ /* tag_info which must be freed with mp_file_tag_free() after use. */ int -mp_file_tag_info_get_all_tag(const char *filename, mp_tag_info_t *tag_info) +mp_file_tag_info_get_all_tag(const char *filename, + mp_tag_info_t * tag_info) { int ret = 0; metadata_extractor_h handle = NULL; @@ -57,51 +58,70 @@ mp_file_tag_info_get_all_tag(const char *filename, mp_tag_info_t *tag_info) } char *value = NULL; - ret = metadata_extractor_get_metadata(handle, METADATA_DURATION, &value); + ret = + metadata_extractor_get_metadata(handle, METADATA_DURATION, &value); if (ret == METADATA_EXTRACTOR_ERROR_NONE && value) { tag_info->duration = atoi(value); } SAFE_FREE(value); - ret = metadata_extractor_get_metadata(handle, METADATA_AUDIO_SAMPLERATE, &value); + ret = + metadata_extractor_get_metadata(handle, METADATA_AUDIO_SAMPLERATE, + &value); if (ret == METADATA_EXTRACTOR_ERROR_NONE && value) { tag_info->audio_samplerate = atoi(value); } SAFE_FREE(value); - ret = metadata_extractor_get_metadata(handle, METADATA_AUDIO_BITRATE, &value); + ret = + metadata_extractor_get_metadata(handle, METADATA_AUDIO_BITRATE, + &value); if (ret == METADATA_EXTRACTOR_ERROR_NONE && value) { tag_info->audio_bitrate = atoi(value); } SAFE_FREE(value); value = NULL; - ret = metadata_extractor_get_metadata(handle, METADATA_AUDIO_CHANNELS, &value); + ret = + metadata_extractor_get_metadata(handle, METADATA_AUDIO_CHANNELS, + &value); if (ret == METADATA_EXTRACTOR_ERROR_NONE && value) { tag_info->audio_channel = atoi(value); } SAFE_FREE(value); - metadata_extractor_get_metadata(handle, METADATA_ARTIST, &tag_info->artist); - metadata_extractor_get_metadata(handle, METADATA_ALBUM, &tag_info->album); - metadata_extractor_get_metadata(handle, METADATA_TITLE, &tag_info->title); - metadata_extractor_get_metadata(handle, METADATA_GENRE, &tag_info->genre); - metadata_extractor_get_metadata(handle, METADATA_AUTHOR, &tag_info->author); - metadata_extractor_get_metadata(handle, METADATA_COPYRIGHT, &tag_info->copyright); - metadata_extractor_get_metadata(handle, METADATA_DATE, &tag_info->date); - metadata_extractor_get_metadata(handle, METADATA_DESCRIPTION, &tag_info->desc); - metadata_extractor_get_metadata(handle, METADATA_TRACK_NUM, &tag_info->track); - metadata_extractor_get_metadata(handle, METADATA_RATING, &tag_info->rating); + metadata_extractor_get_metadata(handle, METADATA_ARTIST, + &tag_info->artist); + metadata_extractor_get_metadata(handle, METADATA_ALBUM, + &tag_info->album); + metadata_extractor_get_metadata(handle, METADATA_TITLE, + &tag_info->title); + metadata_extractor_get_metadata(handle, METADATA_GENRE, + &tag_info->genre); + metadata_extractor_get_metadata(handle, METADATA_AUTHOR, + &tag_info->author); + metadata_extractor_get_metadata(handle, METADATA_COPYRIGHT, + &tag_info->copyright); + metadata_extractor_get_metadata(handle, METADATA_DATE, + &tag_info->date); + metadata_extractor_get_metadata(handle, METADATA_DESCRIPTION, + &tag_info->desc); + metadata_extractor_get_metadata(handle, METADATA_TRACK_NUM, + &tag_info->track); + metadata_extractor_get_metadata(handle, METADATA_RATING, + &tag_info->rating); if (!tag_info->title) { - const char *name = mp_file_file_get((char *)filename); + const char *name = mp_file_file_get((char *) filename); tag_info->title = mp_file_strip_ext(name); } void *albumart = NULL; int albumart_size = 0; char *mime = NULL; - ret = metadata_extractor_get_artwork(handle, &albumart, &albumart_size, &mime); + ret = + metadata_extractor_get_artwork(handle, &albumart, &albumart_size, + &mime); if (ret == METADATA_EXTRACTOR_ERROR_NONE && albumart) { gchar *path = NULL; int fd = g_file_open_tmp(NULL, &path, NULL); @@ -112,7 +132,9 @@ mp_file_tag_info_get_all_tag(const char *filename, mp_tag_info_t *tag_info) ERROR_TRACE("fail to fdopen()"); close(fd); } else { - int n = fwrite((unsigned char *)albumart, 1, albumart_size, fp); + int n = + fwrite((unsigned char *) albumart, 1, albumart_size, + fp); if (n != albumart_size) { ERROR_TRACE("fail to fwrite()"); fclose(fp); @@ -130,9 +152,11 @@ mp_file_tag_info_get_all_tag(const char *filename, mp_tag_info_t *tag_info) SAFE_FREE(albumart); DEBUG_TRACE - ("file : %s\n duration: %d \n album: %s\n artist: %s\n title: %s\n genre: %s\n copyright:%s\n date: %s\n desc : %s\n author: %s\n albumart : %s", - filename, tag_info->duration, tag_info->album, tag_info->artist, tag_info->title, tag_info->genre, - tag_info->copyright, tag_info->date, tag_info->desc, tag_info->author, tag_info->albumart_path); + ("file : %s\n duration: %d \n album: %s\n artist: %s\n title: %s\n genre: %s\n copyright:%s\n date: %s\n desc : %s\n author: %s\n albumart : %s", + filename, tag_info->duration, tag_info->album, tag_info->artist, + tag_info->title, tag_info->genre, tag_info->copyright, + tag_info->date, tag_info->desc, tag_info->author, + tag_info->albumart_path); if (handle) { metadata_extractor_destroy(handle); @@ -140,7 +164,7 @@ mp_file_tag_info_get_all_tag(const char *filename, mp_tag_info_t *tag_info) return 0; -CATCH_ERROR: + CATCH_ERROR: if (handle) { metadata_extractor_destroy(handle); } @@ -148,8 +172,7 @@ CATCH_ERROR: return -1; } -char * -mp_file_tag_info_get_genre(const char *filename) +char *mp_file_tag_info_get_genre(const char *filename) { /* return value shold be freed */ MP_CHECK_NULL(filename); @@ -181,7 +204,7 @@ mp_file_tag_info_get_genre(const char *filename) metadata_extractor_destroy(handle); return genre; -CATCH_ERROR: + CATCH_ERROR: if (handle) { metadata_extractor_destroy(handle); } @@ -190,8 +213,7 @@ CATCH_ERROR: } -void -mp_file_tag_free(mp_tag_info_t *tag_info) +void mp_file_tag_free(mp_tag_info_t * tag_info) { if (tag_info == NULL) { return; @@ -231,7 +253,9 @@ mp_file_tag_info_get_albumart(const char *filename, char **albumart_path) void *albumart = NULL; int albumart_size = 0; char *mime = NULL; - ret = metadata_extractor_get_artwork(handle, &albumart, &albumart_size, &mime); + ret = + metadata_extractor_get_artwork(handle, &albumart, &albumart_size, + &mime); if (ret == METADATA_EXTRACTOR_ERROR_NONE && albumart) { gchar *path = NULL; int fd = g_file_open_tmp(NULL, &path, NULL); @@ -242,7 +266,9 @@ mp_file_tag_info_get_albumart(const char *filename, char **albumart_path) ERROR_TRACE("fail to fdopen()"); close(fd); } else { - int n = fwrite((unsigned char *)albumart, 1, albumart_size, fp); + int n = + fwrite((unsigned char *) albumart, 1, albumart_size, + fp); if (n != albumart_size) { ERROR_TRACE("fail to fwrite()"); fclose(fp); @@ -266,7 +292,7 @@ mp_file_tag_info_get_albumart(const char *filename, char **albumart_path) return 0; -CATCH_ERROR: + CATCH_ERROR: if (handle) { metadata_extractor_destroy(handle); } diff --git a/src/core/mp-http-mgr.c b/src/core/mp-http-mgr.c index 8c0249b..04c4854 100644 --- a/src/core/mp-http-mgr.c +++ b/src/core/mp-http-mgr.c @@ -22,15 +22,19 @@ #include static MpHttpState_t _mp_http_mgr_get_network_status(); -static void _mp_http_mgr_refresh_network_info(mp_http_mgr_t *http_mgr); -static bool _mp_http_mgr_register_runtime_info_change_cb(mp_http_mgr_t *http_mgr); +static void _mp_http_mgr_refresh_network_info(mp_http_mgr_t * http_mgr); +static bool _mp_http_mgr_register_runtime_info_change_cb(mp_http_mgr_t * + http_mgr); static void _mp_http_mgr_ignore_runtime_info_change_cb(); -static void _mp_http_mgr_network_config_changed_cb(runtime_info_key_e key, void *user_data); -static void _mp_wifi_network_config_changed_cb(wifi_connection_state_e state, wifi_ap_h ap, void *user_data); +static void _mp_http_mgr_network_config_changed_cb(runtime_info_key_e key, + void *user_data); +static void _mp_wifi_network_config_changed_cb(wifi_connection_state_e + state, wifi_ap_h ap, + void *user_data); bool mp_http_mgr_create(void *data) { - struct appdata *ad = (struct appdata *)data; + struct appdata *ad = (struct appdata *) data; MP_CHECK_FALSE(ad); MP_CHECK_FALSE((!ad->http_mgr)); @@ -47,14 +51,14 @@ bool mp_http_mgr_create(void *data) return true; -mp_exception: + mp_exception: mp_http_mgr_destory(ad); return false; } bool mp_http_mgr_destory(void *data) { - struct appdata *ad = (struct appdata *)data; + struct appdata *ad = (struct appdata *) data; MP_CHECK_FALSE(ad); @@ -86,12 +90,14 @@ static MpHttpState_t _mp_http_mgr_get_network_status() } if (state_wifi == WIFI_CONNECTION_STATE_FAILURE - || state_wifi == WIFI_CONNECTION_STATE_DISCONNECTED) { + || state_wifi == WIFI_CONNECTION_STATE_DISCONNECTED) { WARN_TRACE("WIFI_CONNECTION_STATE DISABLED"); bwifi_on_off = false; } - err = runtime_info_get_value_bool(RUNTIME_INFO_KEY_PACKET_DATA_ENABLED, &b3g_on_off); + err = + runtime_info_get_value_bool(RUNTIME_INFO_KEY_PACKET_DATA_ENABLED, + &b3g_on_off); if (err != RUNTIME_INFO_ERROR_NONE) { WARN_TRACE("runtime_info_get_value_bool error. err is [%d]", err); b3g_on_off = false; @@ -99,11 +105,10 @@ static MpHttpState_t _mp_http_mgr_get_network_status() DEBUG_TRACE("3g flag is %d", b3g_on_off); DEBUG_TRACE("wifi flag is %d", bwifi_on_off); - /*decide status*/ + /*decide status */ if (bwifi_on_off == true) { state = MP_HTTP_STATE_WIFI; - } - else { + } else { state = MP_HTTP_STATE_OFF; } @@ -111,18 +116,21 @@ static MpHttpState_t _mp_http_mgr_get_network_status() return state; } -static bool _mp_http_mgr_register_runtime_info_change_cb(mp_http_mgr_t *http_mgr) +static bool _mp_http_mgr_register_runtime_info_change_cb(mp_http_mgr_t * + http_mgr) { startfunc; MP_CHECK_FALSE(http_mgr); if (runtime_info_set_changed_cb(RUNTIME_INFO_KEY_PACKET_DATA_ENABLED, - _mp_http_mgr_network_config_changed_cb, http_mgr) != 0) { + _mp_http_mgr_network_config_changed_cb, + http_mgr) != 0) { mp_error("runtime_info_set_changed_cb() fail"); return FALSE; } - if (wifi_set_connection_state_changed_cb(_mp_wifi_network_config_changed_cb, http_mgr)) { + if (wifi_set_connection_state_changed_cb + (_mp_wifi_network_config_changed_cb, http_mgr)) { mp_error("wifi_set_connection_state_changed_cb() fail"); return FALSE; } @@ -134,8 +142,10 @@ static void _mp_http_mgr_ignore_runtime_info_change_cb() { startfunc; - if (runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_PACKET_DATA_ENABLED) != 0) { - mp_error("runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_PACKET_DATA_ENABLED) fail"); + if (runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_PACKET_DATA_ENABLED) + != 0) { + mp_error + ("runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_PACKET_DATA_ENABLED) fail"); } if (wifi_unset_connection_state_changed_cb() != 0) { @@ -143,7 +153,7 @@ static void _mp_http_mgr_ignore_runtime_info_change_cb() } } -static void _mp_http_mgr_refresh_network_info(mp_http_mgr_t *http_mgr) +static void _mp_http_mgr_refresh_network_info(mp_http_mgr_t * http_mgr) { startfunc; MP_CHECK(http_mgr); @@ -151,34 +161,38 @@ static void _mp_http_mgr_refresh_network_info(mp_http_mgr_t *http_mgr) http_mgr->http_state = _mp_http_mgr_get_network_status(); } -static void _mp_http_mgr_network_config_changed_cb(runtime_info_key_e key, void *user_data) +static void _mp_http_mgr_network_config_changed_cb(runtime_info_key_e key, + void *user_data) { startfunc; - mp_http_mgr_t *http_mgr = (mp_http_mgr_t *)user_data; + mp_http_mgr_t *http_mgr = (mp_http_mgr_t *) user_data; MP_CHECK(http_mgr); _mp_http_mgr_refresh_network_info(http_mgr); - /*post network changed event to each view*/ - mp_view_mgr_post_event(mp_view_mgr_get_view_manager(), MP_NETWORK_STATE_CHANGED); + /*post network changed event to each view */ + mp_view_mgr_post_event(mp_view_mgr_get_view_manager(), + MP_NETWORK_STATE_CHANGED); } -static void _mp_wifi_network_config_changed_cb(wifi_connection_state_e state, wifi_ap_h ap, void *user_data) +static void _mp_wifi_network_config_changed_cb(wifi_connection_state_e + state, wifi_ap_h ap, + void *user_data) { startfunc; - mp_http_mgr_t *http_mgr = (mp_http_mgr_t *)user_data; + mp_http_mgr_t *http_mgr = (mp_http_mgr_t *) user_data; MP_CHECK(http_mgr); _mp_http_mgr_refresh_network_info(http_mgr); - /*post network changed event to each view*/ - mp_view_mgr_post_event(mp_view_mgr_get_view_manager(), MP_NETWORK_STATE_CHANGED); + /*post network changed event to each view */ + mp_view_mgr_post_event(mp_view_mgr_get_view_manager(), + MP_NETWORK_STATE_CHANGED); } -MpHttpState_t -mp_http_mgr_get_state(void *data) +MpHttpState_t mp_http_mgr_get_state(void *data) { - struct appdata *ad = (struct appdata *)data; + struct appdata *ad = (struct appdata *) data; MP_CHECK_FALSE(ad); if (!ad->http_mgr) { diff --git a/src/core/mp-language-mgr.c b/src/core/mp-language-mgr.c index aecd088..c0724ed 100644 --- a/src/core/mp-language-mgr.c +++ b/src/core/mp-language-mgr.c @@ -35,7 +35,7 @@ typedef struct { } obj_item_data; typedef struct _lang_mgr *lang_mgr; -struct _lang_mgr { +struct _lang_mgr { GList *objs; GList *obj_items; GList *glist_items; @@ -46,11 +46,11 @@ struct _lang_mgr { static lang_mgr g_lang_mgr; #define G_LIST_FOREACH(list, l, data) \ - for (l = list, \ - data = g_list_nth_data(l, 0); \ - l; \ - l = g_list_next(l), \ - data = g_list_nth_data(l, 0)) + for (l = list, \ + data = g_list_nth_data(l, 0); \ + l; \ + l = g_list_next(l), \ + data = g_list_nth_data(l, 0)) static void __glist_free(void *data) { @@ -122,14 +122,16 @@ static void __update_grid(void *data, void *userdata) elm_gengrid_item_update(item); } -static void __obj_del_cb(void *data, Evas *e, Evas_Object *eo, void *event_info) +static void __obj_del_cb(void *data, Evas * e, Evas_Object * eo, + void *event_info) { obj_data *item = data; MP_CHECK(g_lang_mgr); MP_CHECK(item); g_lang_mgr->objs = - g_list_delete_link(g_lang_mgr->objs, g_list_find(g_lang_mgr->objs, item)); + g_list_delete_link(g_lang_mgr->objs, + g_list_find(g_lang_mgr->objs, item)); free(item); } @@ -166,7 +168,8 @@ int mp_language_mgr_destroy(void) return 0; } -void mp_language_mgr_register_object(Evas_Object *obj, obj_type type, const char *part, const char *text_id) +void mp_language_mgr_register_object(Evas_Object * obj, obj_type type, + const char *part, const char *text_id) { MP_CHECK(g_lang_mgr); obj_data *item = calloc(1, sizeof(obj_data)); @@ -177,12 +180,16 @@ void mp_language_mgr_register_object(Evas_Object *obj, obj_type type, const char item->text_id = text_id; item->obj = obj; - evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, __obj_del_cb, item); + evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, __obj_del_cb, + item); g_lang_mgr->objs = g_list_append(g_lang_mgr->objs, item); } -void mp_language_mgr_register_object_func_set(Evas_Object *obj, const char *part, const char *text_id, Mp_Language_Update_Func func) +void mp_language_mgr_register_object_func_set(Evas_Object * obj, + const char *part, + const char *text_id, + Mp_Language_Update_Func func) { MP_CHECK(g_lang_mgr); obj_data *item = calloc(1, sizeof(obj_data)); @@ -194,12 +201,13 @@ void mp_language_mgr_register_object_func_set(Evas_Object *obj, const char *part item->obj = obj; item->update_func = func; - evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, __obj_del_cb, item); + evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, __obj_del_cb, + item); g_lang_mgr->objs = g_list_append(g_lang_mgr->objs, item); } -void mp_language_mgr_unregister_object_item(Elm_Object_Item *object_item) +void mp_language_mgr_unregister_object_item(Elm_Object_Item * object_item) { MP_CHECK(g_lang_mgr); GList *l; @@ -207,7 +215,8 @@ void mp_language_mgr_unregister_object_item(Elm_Object_Item *object_item) G_LIST_FOREACH(g_lang_mgr->obj_items, l, data) { if (data && data->obj_item == object_item) { - g_lang_mgr->obj_items = g_list_delete_link(g_lang_mgr->obj_items, l); + g_lang_mgr->obj_items = + g_list_delete_link(g_lang_mgr->obj_items, l); if (data) { free(data); } @@ -216,7 +225,8 @@ void mp_language_mgr_unregister_object_item(Elm_Object_Item *object_item) } } -void mp_language_mgr_object_item_text_ID_set(Elm_Object_Item *object_item, const char *text_ID) +void mp_language_mgr_object_item_text_ID_set(Elm_Object_Item * object_item, + const char *text_ID) { MP_CHECK(g_lang_mgr); GList *l; @@ -231,25 +241,26 @@ void mp_language_mgr_object_item_text_ID_set(Elm_Object_Item *object_item, const } -void mp_language_mgr_unregister_genlist_item(Elm_Object_Item *item) +void mp_language_mgr_unregister_genlist_item(Elm_Object_Item * item) { MP_CHECK(g_lang_mgr); g_lang_mgr->glist_items = - g_list_delete_link(g_lang_mgr->glist_items, g_list_find(g_lang_mgr->glist_items, item)); + g_list_delete_link(g_lang_mgr->glist_items, + g_list_find(g_lang_mgr->glist_items, item)); } -void mp_language_mgr_register_gengrid_item(Elm_Object_Item *item) +void mp_language_mgr_register_gengrid_item(Elm_Object_Item * item) { MP_CHECK(g_lang_mgr); - g_lang_mgr->grid_items = - g_list_append(g_lang_mgr->grid_items, item); + g_lang_mgr->grid_items = g_list_append(g_lang_mgr->grid_items, item); } -void mp_language_mgr_unregister_gengrid_item(Elm_Object_Item *item) +void mp_language_mgr_unregister_gengrid_item(Elm_Object_Item * item) { MP_CHECK(g_lang_mgr); g_lang_mgr->grid_items = - g_list_delete_link(g_lang_mgr->grid_items, g_list_find(g_lang_mgr->grid_items, item)); + g_list_delete_link(g_lang_mgr->grid_items, + g_list_find(g_lang_mgr->grid_items, item)); } void mp_language_mgr_update() diff --git a/src/core/mp-lyric-mgr.c b/src/core/mp-lyric-mgr.c index 6af940a..60e16a7 100644 --- a/src/core/mp-lyric-mgr.c +++ b/src/core/mp-lyric-mgr.c @@ -22,10 +22,10 @@ #include "music.h" #include -#define MP_LRC_LINE_COUNT_MAX (int)100 /* The max count of line */ -#define MP_LRC_LINE_COUNT_INC (int)50 /* The size increased when exceed the max count */ -#define MP_LRC_SUBS_COUNT_MAX (int)10 /* The max count of sub string */ -#define MP_LRC_ERROR_BUF_LEN (int)128 /* The max length of error buffer */ +#define MP_LRC_LINE_COUNT_MAX (int)100 /* The max count of line */ +#define MP_LRC_LINE_COUNT_INC (int)50 /* The size increased when exceed the max count */ +#define MP_LRC_SUBS_COUNT_MAX (int)10 /* The max count of sub string */ +#define MP_LRC_ERROR_BUF_LEN (int)128 /* The max length of error buffer */ #define MP_LYRIC_PARSE_TIME_PATTERN "\\[[0-9]{2}:[0-9]{2}((\\.|:)[0-9]{2})?\\]" #define MP_LYRIC_PARSE_ITEM_TITLE "[ti:" @@ -38,8 +38,9 @@ #define MP_LYRIC_PARSE_END_CHAR ']' static long _mp_lyric_mgr_str2time(const char *text); -static void _mp_lyric_mgr_data_free(mp_lyric_mgr_t **data); -static void _mp_lyric_mgr_parse_line(mp_lyric_mgr_t **data, const char *line); +static void _mp_lyric_mgr_data_free(mp_lyric_mgr_t ** data); +static void _mp_lyric_mgr_parse_line(mp_lyric_mgr_t ** data, + const char *line); static char *_mp_lyric_mgr_extract_lyric(const char *line); static mp_lrc_node_t *_mp_lyric_mgr_node_new(); @@ -48,11 +49,11 @@ static int _mp_lyric_mgr_node_sort(const void *data1, const void *data2) MP_CHECK_VAL(data1, 0); MP_CHECK_VAL(data2, 0); - return (((mp_lrc_node_t *)data1)->time > ((mp_lrc_node_t *)data2)->time) ? 1 : -1; + return (((mp_lrc_node_t *) data1)->time > + ((mp_lrc_node_t *) data2)->time) ? 1 : -1; } -static long -_mp_lyric_mgr_str2time(const char *text) +static long _mp_lyric_mgr_str2time(const char *text) { startfunc; @@ -60,7 +61,7 @@ _mp_lyric_mgr_str2time(const char *text) int len = strlen(text); long time = 0; - char buf[10] = {'0'}; + char buf[10] = { '0' }; memcpy(buf, text, 2); buf[2] = '\0'; @@ -91,8 +92,7 @@ _mp_lyric_mgr_str2time(const char *text) return time; } -static void -_mp_lryic_mgr_list_free(Eina_List **list) +static void _mp_lryic_mgr_list_free(Eina_List ** list) { mp_lrc_node_t *node = NULL; Eina_List *next = NULL; @@ -109,8 +109,7 @@ _mp_lryic_mgr_list_free(Eina_List **list) *list = NULL; } -static void -_mp_lyric_mgr_data_free(mp_lyric_mgr_t **data) +static void _mp_lyric_mgr_data_free(mp_lyric_mgr_t ** data) { startfunc; @@ -144,15 +143,14 @@ _mp_lyric_mgr_data_free(mp_lyric_mgr_t **data) endfunc; } -static char* -_mp_lyric_mgr_extract_lyric(const char *line) +static char *_mp_lyric_mgr_extract_lyric(const char *line) { MP_CHECK_NULL(line); - char *lyric = (char *)malloc(sizeof(char) * strlen(line)); + char *lyric = (char *) malloc(sizeof(char) * strlen(line)); MP_CHECK_NULL(line); MP_CHECK_NULL(lyric); - memset(lyric, 0, sizeof(char)*strlen(line)); + memset(lyric, 0, sizeof(char) * strlen(line)); int i = 0; const char *p = line; @@ -177,11 +175,11 @@ _mp_lyric_mgr_extract_lyric(const char *line) } static void -_mp_lyric_mgr_parse_line(mp_lyric_mgr_t **data, const char *line) +_mp_lyric_mgr_parse_line(mp_lyric_mgr_t ** data, const char *line) { MP_CHECK(data); MP_CHECK(line); - /* DEBUG_TRACE("line=%s\n", line); */ + /* DEBUG_TRACE("line=%s\n", line); */ mp_lyric_mgr_t **lrc_data = data; MP_CHECK(*lrc_data); @@ -191,7 +189,7 @@ _mp_lyric_mgr_parse_line(mp_lyric_mgr_t **data, const char *line) const size_t nmatch = MP_LRC_SUBS_COUNT_MAX; char errbuf[MP_LRC_ERROR_BUF_LEN]; const char *start = NULL, *end = NULL, *head = NULL; - char *pattern_lyric = MP_LYRIC_PARSE_TIME_PATTERN; /* [mm:ss.ff],[mm:ss:ff],[mm:ss] */ + char *pattern_lyric = MP_LYRIC_PARSE_TIME_PATTERN; /* [mm:ss.ff],[mm:ss:ff],[mm:ss] */ char *lyric = NULL; /* Get title */ @@ -201,10 +199,12 @@ _mp_lyric_mgr_parse_line(mp_lyric_mgr_t **data, const char *line) if (start != NULL) { end = strstr(start, MP_LYRIC_PARSE_END_INDEX); if (end != NULL) { - (*lrc_data)->title = malloc(sizeof(char) * (end - start - ti_len + 1)); + (*lrc_data)->title = + malloc(sizeof(char) * (end - start - ti_len + 1)); MP_CHECK((*lrc_data)->title); mp_assert((*lrc_data)->title); - strncpy((*lrc_data)->title, start + ti_len, end - start - ti_len); + strncpy((*lrc_data)->title, start + ti_len, + end - start - ti_len); (*lrc_data)->title[end - start - ti_len] = '\0'; /* DEBUG_TRACE("title: %s\n", (*lrc_data)->title); */ } @@ -216,10 +216,12 @@ _mp_lyric_mgr_parse_line(mp_lyric_mgr_t **data, const char *line) if (start != NULL) { end = strstr(start, MP_LYRIC_PARSE_END_INDEX); if (end != NULL) { - (*lrc_data)->artist = malloc(sizeof(char) * (end - start - ar_len + 1)); + (*lrc_data)->artist = + malloc(sizeof(char) * (end - start - ar_len + 1)); MP_CHECK((*lrc_data)->artist); mp_assert((*lrc_data)->artist); - strncpy((*lrc_data)->artist, start + ar_len, end - start - ar_len); + strncpy((*lrc_data)->artist, start + ar_len, + end - start - ar_len); (*lrc_data)->artist[end - start - ar_len] = '\0'; /* DEBUG_TRACE("title: %s\n", (*lrc_data)->artist); */ } @@ -231,10 +233,12 @@ _mp_lyric_mgr_parse_line(mp_lyric_mgr_t **data, const char *line) if (start != NULL) { end = strstr(start, MP_LYRIC_PARSE_END_INDEX); if (end != NULL) { - (*lrc_data)->album = malloc(sizeof(char) * (end - start - al_len + 1)); + (*lrc_data)->album = + malloc(sizeof(char) * (end - start - al_len + 1)); MP_CHECK((*lrc_data)->album); mp_assert((*lrc_data)->album); - strncpy((*lrc_data)->album, start + al_len, end - start - al_len); + strncpy((*lrc_data)->album, start + al_len, + end - start - al_len); (*lrc_data)->album[end - start - al_len] = '\0'; /* DEBUG_TRACE("title: %s\n", (*lrc_data)->album); */ } @@ -246,7 +250,7 @@ _mp_lyric_mgr_parse_line(mp_lyric_mgr_t **data, const char *line) if (start != NULL) { end = strstr(start, MP_LYRIC_PARSE_END_INDEX); if (end != NULL) { - char buf[MP_LRC_LINE_BUF_LEN] = {'0'}; + char buf[MP_LRC_LINE_BUF_LEN] = { '0' }; memcpy(buf, start + offset_len, end - start - offset_len); buf[end - start - offset_len] = '\0'; (*lrc_data)->offset = atoi(buf); @@ -276,7 +280,7 @@ _mp_lyric_mgr_parse_line(mp_lyric_mgr_t **data, const char *line) /* DEBUG_TRACE("begin: %d, len = %d ", subs[0].rm_so, len); */ - char buf[MP_LRC_LINE_BUF_LEN] = {'0'}; + char buf[MP_LRC_LINE_BUF_LEN] = { '0' }; memcpy(buf, head + subs[0].rm_so + 1, len); buf[len] = '\0'; @@ -287,14 +291,20 @@ _mp_lyric_mgr_parse_line(mp_lyric_mgr_t **data, const char *line) if (new_node == NULL) { IF_FREE(lyric); - return ; + return; } new_node->time = time; new_node->lyric = strdup(lyric); - (*lrc_data)->synclrc_list = eina_list_append((*lrc_data)->synclrc_list, (gpointer)new_node); - - DEBUG_TRACE("time%d: %d\n", eina_list_count((*lrc_data)->synclrc_list), new_node->time); - DEBUG_TRACE("lyric%d: %s\n", eina_list_count((*lrc_data)->synclrc_list), new_node->lyric); + (*lrc_data)->synclrc_list = + eina_list_append((*lrc_data)->synclrc_list, + (gpointer) new_node); + + DEBUG_TRACE("time%d: %d\n", + eina_list_count((*lrc_data)->synclrc_list), + new_node->time); + DEBUG_TRACE("lyric%d: %s\n", + eina_list_count((*lrc_data)->synclrc_list), + new_node->lyric); } else { goto FAIL_GET_PARSE_LINE; } @@ -311,15 +321,14 @@ _mp_lyric_mgr_parse_line(mp_lyric_mgr_t **data, const char *line) IF_FREE(lyric); return; -FAIL_GET_PARSE_LINE: + FAIL_GET_PARSE_LINE: regfree(®ex); IF_FREE(lyric); return; } -static int -_mp_lyric_mgr_get_line(const char *buffer, char **line) +static int _mp_lyric_mgr_get_line(const char *buffer, char **line) { MP_CHECK_VAL(buffer, -1); MP_CHECK_VAL(line, -1); @@ -336,29 +345,28 @@ _mp_lyric_mgr_get_line(const char *buffer, char **line) *line = malloc(sizeof(char) * i); MP_CHECK_VAL(line, -1); - memset(*line, 0, sizeof(char)*i); + memset(*line, 0, sizeof(char) * i); strncpy(*line, buffer, i - 1); /* DEBUG_TRACE("line=%s\n",*line); - DEBUG_TRACE("i=%d\n",i); */ + DEBUG_TRACE("i=%d\n",i); */ return i; } -static mp_lrc_node_t* -_mp_lyric_mgr_node_new() +static mp_lrc_node_t *_mp_lyric_mgr_node_new() { mp_lrc_node_t *lrc_node = NULL; - lrc_node = (mp_lrc_node_t *)malloc(sizeof(mp_lrc_node_t)); + lrc_node = (mp_lrc_node_t *) malloc(sizeof(mp_lrc_node_t)); if (lrc_node != NULL) { memset(lrc_node, 0, sizeof(mp_lrc_node_t)); } return lrc_node; } -mp_lyric_mgr_t* -mp_lyric_mgr_parse_buffer(mp_lyric_mgr_t *lyric_mgr, const char *lrcBuffer) +mp_lyric_mgr_t *mp_lyric_mgr_parse_buffer(mp_lyric_mgr_t * lyric_mgr, + const char *lrcBuffer) { startfunc; @@ -386,12 +394,15 @@ mp_lyric_mgr_parse_buffer(mp_lyric_mgr_t *lyric_mgr, const char *lrcBuffer) } new_node->lyric = strdup(line); - lrc_data->unsynclrc_list = eina_list_append(lrc_data->unsynclrc_list, (gpointer)new_node); + lrc_data->unsynclrc_list = + eina_list_append(lrc_data->unsynclrc_list, + (gpointer) new_node); /* Parse and sort the lyric by time tag */ _mp_lyric_mgr_parse_line(&lrc_data, line); } while (pos <= len); - DEBUG_TRACE("unsync count=%d\n", eina_list_count(lrc_data->unsynclrc_list)); + DEBUG_TRACE("unsync count=%d\n", + eina_list_count(lrc_data->unsynclrc_list)); endfunc; IF_FREE(line); @@ -399,7 +410,7 @@ mp_lyric_mgr_parse_buffer(mp_lyric_mgr_t *lyric_mgr, const char *lrcBuffer) } static bool -_mp_parse_lyric(mp_lyric_mgr_t *lyric_mgr, const char *musicPath) +_mp_parse_lyric(mp_lyric_mgr_t * lyric_mgr, const char *musicPath) { Eina_List *synclrc_list = NULL; char *unsynclrc_buffer = NULL; @@ -420,17 +431,23 @@ _mp_parse_lyric(mp_lyric_mgr_t *lyric_mgr, const char *musicPath) int unsync_len = 0; char *value = NULL; - mmf_error = metadata_extractor_get_metadata(handle, METADATA_SYNCLYRICS_NUM, &value); + mmf_error = + metadata_extractor_get_metadata(handle, + METADATA_SYNCLYRICS_NUM, + &value); if (mmf_error == METADATA_EXTRACTOR_ERROR_NONE && value) { sync_len = atoi(value); } SAFE_FREE(value); - mmf_error = metadata_extractor_get_metadata(handle, METADATA_UNSYNCLYRICS, &unsynclyrics); + mmf_error = + metadata_extractor_get_metadata(handle, METADATA_UNSYNCLYRICS, + &unsynclyrics); if (mmf_error == METADATA_EXTRACTOR_ERROR_NONE && unsynclyrics) { unsync_len = strlen(unsynclyrics); } else { - DEBUG_TRACE("fail to metadata_extractor_get_metadata() %x", mmf_error); + DEBUG_TRACE("fail to metadata_extractor_get_metadata() %x", + mmf_error); } /* unsynclyrics must be freed */ @@ -445,11 +462,17 @@ _mp_parse_lyric(mp_lyric_mgr_t *lyric_mgr, const char *musicPath) sync = 1; - for (idx = 0; idx < sync_len ; idx++) { - /*Get one time and lyrics info.*/ - ret = metadata_extractor_get_synclyrics(handle, idx, &time_info, &lyrics_info); - if (ret == METADATA_EXTRACTOR_ERROR_NONE && lyrics_info != NULL && strlen(lyrics_info) > 0) { - mp_lrc_node_t *new_node = malloc(sizeof(mp_lrc_node_t)); + for (idx = 0; idx < sync_len; idx++) { + /*Get one time and lyrics info. */ + ret = + metadata_extractor_get_synclyrics(handle, idx, + &time_info, + &lyrics_info); + if (ret == METADATA_EXTRACTOR_ERROR_NONE + && lyrics_info != NULL + && strlen(lyrics_info) > 0) { + mp_lrc_node_t *new_node = + malloc(sizeof(mp_lrc_node_t)); if (new_node == NULL) { if (handle) { metadata_extractor_destroy(handle); @@ -461,9 +484,12 @@ _mp_parse_lyric(mp_lyric_mgr_t *lyric_mgr, const char *musicPath) new_node->time = time_info; new_node->lyric = g_strdup(lyrics_info); - synclrc_list = eina_list_append(synclrc_list, (gpointer)new_node); + synclrc_list = + eina_list_append(synclrc_list, + (gpointer) new_node); - DEBUG_TRACE("[%2d][%6d][%s]", idx, time_info, lyrics_info); + DEBUG_TRACE("[%2d][%6d][%s]", idx, time_info, + lyrics_info); } else { ERROR_TRACE("Error when get lyrics"); sync = 0; @@ -508,8 +534,7 @@ _mp_parse_lyric(mp_lyric_mgr_t *lyric_mgr, const char *musicPath) return ret; } -mp_lyric_mgr_t * -mp_lyric_mgr_create(const char *path) +mp_lyric_mgr_t *mp_lyric_mgr_create(const char *path) { startfunc; mp_lyric_mgr_t *lyric_mgr = calloc(1, sizeof(mp_lyric_mgr_t)); @@ -535,8 +560,7 @@ mp_lyric_mgr_create(const char *path) } -void -mp_lyric_mgr_destory(mp_lyric_mgr_t *lyric_mgr) +void mp_lyric_mgr_destory(mp_lyric_mgr_t * lyric_mgr) { MP_CHECK(lyric_mgr); _mp_lyric_mgr_data_free(&lyric_mgr); diff --git a/src/core/mp-player-control.c b/src/core/mp-player-control.c index fd68e6f..a012283 100644 --- a/src/core/mp-player-control.c +++ b/src/core/mp-player-control.c @@ -49,23 +49,23 @@ #define LONG_PRESS_INTERVAL 1.0 /* sec */ #define MEDIA_KEY_LONG_PRESS_INTERVAL 1.0 /* sec */ -#define FF_REW_INTERVAL 0.5 /* sec */ +#define FF_REW_INTERVAL 0.5 /* sec */ #define LONG_PRESS_TIME_INCREASE 3.0 /* sec */ #define SEEK_DIFF 10 /* static Eina_Bool _mp_play_mute_popup_cb(void *data); */ -#define HW_ISSUE_TEMP /* temporary for DV */ +#define HW_ISSUE_TEMP /* temporary for DV */ #ifndef MP_SOUND_PLAYER -static void -_mp_play_control_play_next_on_error(void *data) +static void _mp_play_control_play_next_on_error(void *data) { startfunc; struct appdata *ad = data; MP_CHECK(ad); mp_plst_item *current = mp_playlist_mgr_get_current(ad->playlist_mgr); - mp_plst_item *next = mp_playlist_mgr_get_next(ad->playlist_mgr, false, false); + mp_plst_item *next = + mp_playlist_mgr_get_next(ad->playlist_mgr, false, false); if (next == current) { WARN_TRACE("There is no playable track.. "); @@ -98,8 +98,7 @@ _mp_play_control_play_next_on_error(void *data) } #endif -static void -_mp_play_error_handler(struct appdata *ad, const char *msg) +static void _mp_play_error_handler(struct appdata *ad, const char *msg) { startfunc; mp_play_destory(ad); @@ -110,8 +109,7 @@ _mp_play_error_handler(struct appdata *ad, const char *msg) #endif } -static void -_mp_play_control_long_press_seek_done_cb(void *data) +static void _mp_play_control_long_press_seek_done_cb(void *data) { MpView_t *view = mp_view_mgr_get_view(GET_VIEW_MGR, MP_VIEW_PLAYER); if (view) { @@ -119,8 +117,7 @@ _mp_play_control_long_press_seek_done_cb(void *data) } } -static void -_mp_player_control_move_position(int diff) +static void _mp_player_control_move_position(int diff) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); @@ -146,9 +143,11 @@ _mp_player_control_move_position(int diff) req_seek_pos = new_pos * 1000; } - if (mp_player_mgr_set_position(req_seek_pos, _mp_play_control_long_press_seek_done_cb, ad)) { + if (mp_player_mgr_set_position + (req_seek_pos, _mp_play_control_long_press_seek_done_cb, ad)) { double get_pos = mp_player_mgr_get_position() / 1000.0; - MpView_t *view = mp_view_mgr_get_view(GET_VIEW_MGR, MP_VIEW_PLAYER); + MpView_t *view = + mp_view_mgr_get_view(GET_VIEW_MGR, MP_VIEW_PLAYER); if (view) { mp_player_view_progress_timer_freeze(view); @@ -159,7 +158,6 @@ _mp_player_control_move_position(int diff) mp_player_view_update_progressbar(view); } } - #ifndef MP_SOUND_PLAYER mp_view_mgr_post_event(GET_VIEW_MGR, MP_UPDATE_NOW_PLAYING); /* mp_setting_save_now_playing(ad); */ @@ -168,8 +166,7 @@ _mp_player_control_move_position(int diff) } -static Eina_Bool -_mp_play_control_long_press_timer_cb(void *data) +static Eina_Bool _mp_play_control_long_press_timer_cb(void *data) { startfunc; struct appdata *ad = data; @@ -177,7 +174,9 @@ _mp_play_control_long_press_timer_cb(void *data) int error = 0; mp_retvm_if(ad == NULL, ECORE_CALLBACK_CANCEL, "appdata is NULL"); - if (ad->player_state != PLAY_STATE_PAUSED && ad->player_state != PLAY_STATE_PLAYING && ad->player_state != PLAY_STATE_READY) { + if (ad->player_state != PLAY_STATE_PAUSED + && ad->player_state != PLAY_STATE_PLAYING + && ad->player_state != PLAY_STATE_READY) { return ECORE_CALLBACK_RENEW; } @@ -214,11 +213,11 @@ _mp_play_control_add_longpressed_timer(void *data, double interval) MP_CHECK(!ad->longpress_timer); ad->longpress_timer = - ecore_timer_add(interval, _mp_play_control_long_press_timer_cb, ad); + ecore_timer_add(interval, _mp_play_control_long_press_timer_cb, + ad); } -void -_mp_play_control_del_longpressed_timer(void *data) +void _mp_play_control_del_longpressed_timer(void *data) { struct appdata *ad = data; mp_retm_if(ad == NULL, "appdata is NULL"); @@ -227,8 +226,7 @@ _mp_play_control_del_longpressed_timer(void *data) mp_ecore_timer_del(ad->longpress_timer); } -static void -_mp_play_control_completed_cb(void *userdata) +static void _mp_play_control_completed_cb(void *userdata) { eventfunc; struct appdata *ad = userdata; @@ -238,7 +236,8 @@ _mp_play_control_completed_cb(void *userdata) } static void -_mp_play_control_interrupted_cb(player_interrupted_code_e code, void *userdata) +_mp_play_control_interrupted_cb(player_interrupted_code_e code, + void *userdata) { eventfunc; struct appdata *ad = userdata; @@ -266,8 +265,7 @@ _mp_play_control_interrupted_cb(player_interrupted_code_e code, void *userdata) } -static void -_mp_play_control_error_cb(int error_code, void *userdata) +static void _mp_play_control_error_cb(int error_code, void *userdata) { eventfunc; struct appdata *ad = userdata; @@ -280,11 +278,15 @@ _mp_play_control_error_cb(int error_code, void *userdata) switch (error_code) { case PLAYER_ERROR_NOT_SUPPORTED_FILE: /* can receive error msg while playing. */ ERROR_TRACE("receive PLAYER_ERROR_NOT_SUPPORTED_FILE"); - _mp_play_error_handler(ad, GET_STR("IDS_MUSIC_POP_UNABLE_TO_PLAY_UNSUPPORTED_FILETYPE")); + _mp_play_error_handler(ad, + GET_STR + ("IDS_MUSIC_POP_UNABLE_TO_PLAY_UNSUPPORTED_FILETYPE")); break; case PLAYER_ERROR_CONNECTION_FAILED: ERROR_TRACE("MM_ERROR_PLAYER_STREAMING_CONNECTION_FAIL"); - _mp_play_error_handler(ad, GET_SYS_STR("IDS_COM_POP_CONNECTION_FAILED")); + _mp_play_error_handler(ad, + GET_SYS_STR + ("IDS_COM_POP_CONNECTION_FAILED")); break; default: ERROR_TRACE("error_code: 0x%x", error_code); @@ -297,8 +299,7 @@ _mp_play_control_error_cb(int error_code, void *userdata) } -static void -_mp_play_control_buffering_cb(int percent, void *userdata) +static void _mp_play_control_buffering_cb(int percent, void *userdata) { startfunc; struct appdata *ad = userdata; @@ -308,14 +309,14 @@ _mp_play_control_buffering_cb(int percent, void *userdata) mp_player_view_update_buffering_progress(GET_PLAYER_VIEW, percent); } -static void -_mp_play_control_prepare_cb(void *userdata) +static void _mp_play_control_prepare_cb(void *userdata) { eventfunc; struct appdata *ad = userdata; MP_CHECK(ad); - if ((mp_player_mgr_get_player_type() == MP_PLAYER_TYPE_MMFW) && (mp_player_mgr_get_state() != PLAYER_STATE_READY)) { + if ((mp_player_mgr_get_player_type() == MP_PLAYER_TYPE_MMFW) + && (mp_player_mgr_get_state() != PLAYER_STATE_READY)) { WARN_TRACE("player state is not PLAYER_STATE_READY"); return; } @@ -326,7 +327,9 @@ _mp_play_control_prepare_cb(void *userdata) if (!ad->camcoder_start || !ad->auto_next || !ad->paused_by_user) { mp_play_start_in_ready_state(ad); } else { - WARN_TRACE("Stay in ready state because of camcorder.ad->camcoder_start [%d], ad->auto_next [%d], ad->paused_by_user [%d]", ad->camcoder_start , ad->auto_next, ad->paused_by_user); + WARN_TRACE + ("Stay in ready state because of camcorder.ad->camcoder_start [%d], ad->auto_next [%d], ad->paused_by_user [%d]", + ad->camcoder_start, ad->auto_next, ad->paused_by_user); ad->freeze_indicator_icon = false; ad->resume_on_cam_end = true; mp_util_sleep_lock_set(FALSE, FALSE); @@ -336,7 +339,8 @@ _mp_play_control_prepare_cb(void *userdata) #ifdef MP_SOUND_PLAYER static void -_mp_play_text_popup_exit_timeout_cb(void *data, Evas_Object *obj, void *event_info) +_mp_play_text_popup_exit_timeout_cb(void *data, Evas_Object * obj, + void *event_info) { startfunc; mp_evas_object_del(obj); @@ -345,8 +349,7 @@ _mp_play_text_popup_exit_timeout_cb(void *data, Evas_Object *obj, void *event_in #endif /*error handler in case of failure on player create, realize, start, resume */ -void -mp_play_control_on_error(struct appdata *ad, int ret, bool add_watch) +void mp_play_control_on_error(struct appdata *ad, int ret, bool add_watch) { const char *message = NULL; @@ -356,7 +359,8 @@ mp_play_control_on_error(struct appdata *ad, int ret, bool add_watch) if (mp_util_is_call_connected()) { message = STR_MP_UNABLE_TO_PLAY_DURING_CALL; #ifndef MP_SOUND_PLAYER - MpView_t *view = mp_view_mgr_get_view(GET_VIEW_MGR, MP_VIEW_ALL); + MpView_t *view = + mp_view_mgr_get_view(GET_VIEW_MGR, MP_VIEW_ALL); MP_CHECK(view); if (mp_player_mgr_get_state() == PLAYER_STATE_READY) { mp_play_destory(ad); @@ -367,11 +371,15 @@ mp_play_control_on_error(struct appdata *ad, int ret, bool add_watch) } if (add_watch && (ad->auto_next || ad->auto_resume)) { - WARN_TRACE("Enter add watch callback to resume after call or alarm"); - WARN_TRACE("Leave add watch callback to resume after call or alarm"); + WARN_TRACE + ("Enter add watch callback to resume after call or alarm"); + WARN_TRACE + ("Leave add watch callback to resume after call or alarm"); } - } else if (ret == PLAYER_ERROR_INVALID_OPERATION && mp_player_mgr_is_seeking()) { - WARN_TRACE("Trying to resume while seeking. Do not show error msg"); + } else if (ret == PLAYER_ERROR_INVALID_OPERATION + && mp_player_mgr_is_seeking()) { + WARN_TRACE + ("Trying to resume while seeking. Do not show error msg"); } else { message = STR_MP_UNABLE_TO_PLAY_ERROR_OCCURED; } @@ -383,13 +391,13 @@ mp_play_control_on_error(struct appdata *ad, int ret, bool add_watch) #ifndef MP_SOUND_PLAYER mp_widget_text_popup(ad, GET_STR(message)); #else - mp_widget_text_cb_popup(ad, GET_STR(message), _mp_play_text_popup_exit_timeout_cb); + mp_widget_text_cb_popup(ad, GET_STR(message), + _mp_play_text_popup_exit_timeout_cb); #endif } } -static void -_mp_play_control_duration_changed_cb(void *data) +static void _mp_play_control_duration_changed_cb(void *data) { struct appdata *ad = data; MP_CHECK(ad); @@ -403,8 +411,7 @@ _mp_play_control_duration_changed_cb(void *data) } } -int -mp_player_control_ready_new_file(void *data, bool check_drm) +int mp_player_control_ready_new_file(void *data, bool check_drm) { startfunc; struct appdata *ad = data; @@ -420,7 +427,8 @@ mp_player_control_ready_new_file(void *data, bool check_drm) SECURE_DEBUG("current item pathname : [%s]", uri); if (!mp_check_file_exist(uri)) { ERROR_TRACE("There is no such file\n"); - _mp_play_error_handler(ad, GET_SYS_STR("IDS_COM_POP_FILE_NOT_EXIST")); + _mp_play_error_handler(ad, + GET_SYS_STR("IDS_COM_POP_FILE_NOT_EXIST")); return -1; } @@ -440,14 +448,15 @@ mp_player_control_ready_new_file(void *data, bool check_drm) if (ad->b_minicontroller_show) { mp_minicontroller_update(ad, true); } - #ifdef MP_FEATURE_LOCKSCREEN if (ad->b_lockmini_show) { mp_lockscreenmini_update(ad); } #endif if (error) { - _mp_play_error_handler(ad, GET_STR("IDS_MUSIC_POP_UNABLE_TO_PLAY_ERROR_OCCURRED")); + _mp_play_error_handler(ad, + GET_STR + ("IDS_MUSIC_POP_UNABLE_TO_PLAY_ERROR_OCCURRED")); return error; } @@ -458,14 +467,17 @@ mp_player_control_ready_new_file(void *data, bool check_drm) mp_player_mgr_set_buffering_cb(_mp_play_control_buffering_cb, ad); mp_player_mgr_set_prepare_cb(_mp_play_control_prepare_cb, ad); mp_player_mgr_set_paused_cb(mp_play_pause, ad); - mp_player_mgr_set_duration_changed_cb(_mp_play_control_duration_changed_cb, ad); + mp_player_mgr_set_duration_changed_cb + (_mp_play_control_duration_changed_cb, ad); ad->prepare_by_init = false; PROFILE_IN("mp_player_mgr_realize"); error = mp_player_mgr_realize(ad); PROFILE_OUT("mp_player_mgr_realize"); if (error) { - _mp_play_error_handler(ad, GET_STR("IDS_MUSIC_POP_UNABLE_TO_PLAY_ERROR_OCCURRED")); + _mp_play_error_handler(ad, + GET_STR + ("IDS_MUSIC_POP_UNABLE_TO_PLAY_ERROR_OCCURRED")); return error; } @@ -473,12 +485,12 @@ mp_player_control_ready_new_file(void *data, bool check_drm) } -void -mp_play_control_play_pause(struct appdata *ad, bool play) +void mp_play_control_play_pause(struct appdata *ad, bool play) { mp_retm_if(ad == NULL, "appdata is NULL"); - SECURE_DEBUG("play [%d], ad->player_state: %d", play, ad->player_state); + SECURE_DEBUG("play [%d], ad->player_state: %d", play, + ad->player_state); _mp_play_control_del_longpressed_timer(ad); @@ -496,15 +508,17 @@ mp_play_control_play_pause(struct appdata *ad, bool play) ad->player_state = PLAY_STATE_PLAYING; } else { mp_play_control_on_error(ad, error, FALSE); - if (mp_setting_read_playing_status(ad->current_track_info->uri, "paused") != 1) { - mp_setting_write_playing_status(ad->current_track_info->uri, "paused"); + if (mp_setting_read_playing_status + (ad->current_track_info->uri, "paused") != 1) { + mp_setting_write_playing_status(ad-> + current_track_info-> + uri, "paused"); } return; } if (ad->win_minicon) { mp_minicontroller_update_control(ad); } - #ifdef MP_FEATURE_LOCKSCREEN if (ad->win_lockmini) { mp_lockscreenmini_update_control(ad); @@ -513,11 +527,11 @@ mp_play_control_play_pause(struct appdata *ad, bool play) } else if (ad->player_state == PLAY_STATE_READY) { mp_play_start_in_ready_state(ad); } else if (ad->player_state == PLAY_STATE_PLAYING) { - WARN_TRACE("player_state is already playing. Update view state"); + WARN_TRACE + ("player_state is already playing. Update view state"); if (ad->win_minicon) { mp_minicontroller_update(ad, false); } - #ifdef MP_FEATURE_LOCKSCREEN if (ad->win_lockmini) { mp_lockscreenmini_update(ad); @@ -537,18 +551,19 @@ mp_play_control_play_pause(struct appdata *ad, bool play) #endif } else { /* invoke player_pause() to prevent auto resume if user pause playback in pause state */ - if (ad->player_state == PLAY_STATE_PLAYING || ad->player_state == PLAY_STATE_PAUSED) { + if (ad->player_state == PLAY_STATE_PLAYING + || ad->player_state == PLAY_STATE_PAUSED) { if (mp_player_mgr_pause(ad)) { ad->paused_by_user = TRUE; } } else if (ad->player_state == PLAY_STATE_PREPARING) { - WARN_TRACE("player_state is prepareing. set paused_by_user!!!"); + WARN_TRACE + ("player_state is prepareing. set paused_by_user!!!"); ad->paused_by_user = TRUE; ad->freeze_indicator_icon = false; if (ad->win_minicon) { mp_minicontroller_update_control(ad); } - #ifdef MP_FEATURE_LOCKSCREEN if (ad->win_lockmini) { mp_lockscreenmini_update_control(ad); @@ -559,21 +574,24 @@ mp_play_control_play_pause(struct appdata *ad, bool play) } if (play) { if (ad->current_track_info) { - if (mp_setting_read_playing_status(ad->current_track_info->uri, "playing") != 1) { - mp_setting_write_playing_status(ad->current_track_info->uri, "playing"); + if (mp_setting_read_playing_status + (ad->current_track_info->uri, "playing") != 1) { + mp_setting_write_playing_status(ad->current_track_info-> + uri, "playing"); } } } else { if (ad->current_track_info) { - if (mp_setting_read_playing_status(ad->current_track_info->uri, "paused") != 1) { - mp_setting_write_playing_status(ad->current_track_info->uri, "paused"); + if (mp_setting_read_playing_status + (ad->current_track_info->uri, "paused") != 1) { + mp_setting_write_playing_status(ad->current_track_info-> + uri, "paused"); } } } } -void -mp_play_control_resume_via_media_key(struct appdata *ad) +void mp_play_control_resume_via_media_key(struct appdata *ad) { mp_retm_if(ad == NULL, "appdata is NULL"); @@ -589,7 +607,8 @@ mp_play_control_resume_via_media_key(struct appdata *ad) error = mp_player_mgr_resume(ad); if (error) { if (error == PLAYER_ERROR_SOUND_POLICY) { - WARN_TRACE("resume error by sound policy error. retry 1 more only"); + WARN_TRACE + ("resume error by sound policy error. retry 1 more only"); sleep(1); mp_play_control_play_pause(ad, true); return; @@ -605,7 +624,6 @@ mp_play_control_resume_via_media_key(struct appdata *ad) if (ad->win_minicon) { mp_minicontroller_update_control(ad); } - #ifdef MP_FEATURE_LOCKSCREEN if (ad->win_lockmini) { mp_lockscreenmini_update_control(ad); @@ -641,8 +659,7 @@ void mp_player_control_stop(struct appdata *ad) #endif } -void -mp_play_control_next(void) +void mp_play_control_next(void) { eventfunc; struct appdata *ad = mp_util_get_appdata(); @@ -650,8 +667,7 @@ mp_play_control_next(void) mp_play_next_file(ad, TRUE); } -static void -mp_play_control_set_position_cb(void *data) +static void mp_play_control_set_position_cb(void *data) { startfunc; struct appdata *ad = mp_util_get_appdata(); @@ -663,16 +679,16 @@ mp_play_control_set_position_cb(void *data) mp_minicontroller_update(ad, false); } -void -mp_play_control_prev(void) +void mp_play_control_prev(void) { eventfunc; struct appdata *ad = mp_util_get_appdata(); mp_retm_if(ad == NULL, "appdata is NULL"); int pos = mp_player_mgr_get_position(); - if (pos > 3000) { /* mp_playlist_mgr_count(ad->playlist_mgr) == 1 */ - if (mp_player_mgr_set_position(0, mp_play_control_set_position_cb, NULL)) { + if (pos > 3000) { /* mp_playlist_mgr_count(ad->playlist_mgr) == 1 */ + if (mp_player_mgr_set_position + (0, mp_play_control_set_position_cb, NULL)) { double get_pos = mp_player_mgr_get_position() / 1000.0; ad->music_pos = 0; @@ -687,8 +703,7 @@ mp_play_control_prev(void) mp_play_prev_file(ad); } -void -mp_play_control_ff(int press, bool event_by_mediakey, bool clicked) +void mp_play_control_ff(int press, bool event_by_mediakey, bool clicked) { struct appdata *ad = mp_util_get_appdata(); mp_retm_if(ad == NULL, "appdata is NULL"); @@ -724,8 +739,7 @@ mp_play_control_ff(int press, bool event_by_mediakey, bool clicked) } -void -mp_play_control_rew(int press, bool event_by_mediakey, bool clicked) +void mp_play_control_rew(int press, bool event_by_mediakey, bool clicked) { struct appdata *ad = mp_util_get_appdata(); mp_retm_if(ad == NULL, "appdata is NULL"); @@ -771,16 +785,17 @@ void mp_play_control_reset_ff_rew(void) } void -mp_play_control_menu_cb(void *data, Evas_Object * o, const char *emission, const char *source) +mp_play_control_menu_cb(void *data, Evas_Object * o, const char *emission, + const char *source) { eventfunc; struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); EVENT_TRACE("mp_play_control_menu_cb with[%s]\n", emission); - if (!strcmp(emission, SIGNAL_SHUFFLE_ON)) { /* TURN OFF SHUFFLE */ + if (!strcmp(emission, SIGNAL_SHUFFLE_ON)) { /* TURN OFF SHUFFLE */ mp_play_control_shuffle_set(ad, FALSE); - } else if (!strcmp(emission, SIGNAL_SHUFFLE_OFF)) { /* TURN ON SHUFFE */ + } else if (!strcmp(emission, SIGNAL_SHUFFLE_OFF)) { /* TURN ON SHUFFE */ mp_play_control_shuffle_set(ad, TRUE); } else if (!strcmp(emission, SIGNAL_REP_ALL)) { /* off -1 - all - off //off - all - 1 */ /* repeat 1 */ @@ -796,8 +811,7 @@ mp_play_control_menu_cb(void *data, Evas_Object * o, const char *emission, const } -void -mp_play_control_end_of_stream(void *data) +void mp_play_control_end_of_stream(void *data) { eventfunc; struct appdata *ad = data; @@ -820,8 +834,7 @@ mp_play_control_end_of_stream(void *data) #endif } -void -mp_play_control_shuffle_set(void *data, bool shuffle_enable) +void mp_play_control_shuffle_set(void *data, bool shuffle_enable) { struct appdata *ad = mp_util_get_appdata(); mp_retm_if(ad == NULL, "appdata is NULL"); @@ -829,4 +842,3 @@ mp_play_control_shuffle_set(void *data, bool shuffle_enable) mp_player_view_update_state(GET_PLAYER_VIEW); mp_setting_set_shuffle_state(shuffle_enable); } - diff --git a/src/core/mp-player-mgr.c b/src/core/mp-player-mgr.c index b1cd524..2e33b0a 100644 --- a/src/core/mp-player-mgr.c +++ b/src/core/mp-player-mgr.c @@ -98,31 +98,32 @@ typedef struct { } mp_player_cb_extra_data; typedef struct { - int (*create)(player_h *); - int (*destroy)(player_h); - int (*prepare)(player_h); - int (*prepare_async)(player_h, player_prepared_cb, void *); - int (*unprepare)(player_h); - int (*set_uri)(player_h, const char *); - int (*get_state)(player_h, player_state_e *); - int (*set_sound_type)(player_h, sound_stream_info_h); - int (*set_audio_latency_mode)(player_h, audio_latency_mode_e); - int (*get_audio_latency_mode)(player_h, audio_latency_mode_e *); - int (*start)(player_h); - int (*pause)(player_h); - int (*stop)(player_h); - int (*set_started_cb)(player_h, mp_player_started_cb, void *); - int (*set_completed_cb)(player_h, player_completed_cb, void *); - int (*set_interrupted_cb)(player_h, player_interrupted_cb, void *); - int (*set_error_cb)(player_h, player_error_cb, void *); - int (*set_buffering_cb)(player_h, player_buffering_cb, void *); - int (*set_paused_cb)(player_h, mp_player_paused_cb, void *); - int (*set_position)(player_h, int, bool, player_seek_completed_cb, void *); - int (*set_play_rate)(player_h, float); - int (*get_position)(player_h, int *); - int (*get_duration)(player_h, int *); - int (*set_mute)(player_h, bool); - int (*get_content_info)(player_h, player_content_info_e , char * *); + int (*create) (player_h *); + int (*destroy) (player_h); + int (*prepare) (player_h); + int (*prepare_async) (player_h, player_prepared_cb, void *); + int (*unprepare) (player_h); + int (*set_uri) (player_h, const char *); + int (*get_state) (player_h, player_state_e *); + int (*set_sound_type) (player_h, sound_stream_info_h); + int (*set_audio_latency_mode) (player_h, audio_latency_mode_e); + int (*get_audio_latency_mode) (player_h, audio_latency_mode_e *); + int (*start) (player_h); + int (*pause) (player_h); + int (*stop) (player_h); + int (*set_started_cb) (player_h, mp_player_started_cb, void *); + int (*set_completed_cb) (player_h, player_completed_cb, void *); + int (*set_interrupted_cb) (player_h, player_interrupted_cb, void *); + int (*set_error_cb) (player_h, player_error_cb, void *); + int (*set_buffering_cb) (player_h, player_buffering_cb, void *); + int (*set_paused_cb) (player_h, mp_player_paused_cb, void *); + int (*set_position) (player_h, int, bool, player_seek_completed_cb, + void *); + int (*set_play_rate) (player_h, float); + int (*get_position) (player_h, int *); + int (*get_duration) (player_h, int *); + int (*set_mute) (player_h, bool); + int (*get_content_info) (player_h, player_content_info_e, char * *); } mp_player_api_s; static mp_player_api_s g_player_apis; #define CHECK_MMFW_PLAYER() ((_player_type == MP_PLAYER_TYPE_MMFW) ? true : false) @@ -134,13 +135,13 @@ player_h mp_player_mgr_get_player(void) return _player; } -bool -mp_player_mgr_is_active(void) +bool mp_player_mgr_is_active(void) { return _player ? TRUE : FALSE; } -void mp_player_mgr_set_started_db(mp_player_started_cb callback, void *user_data) +void mp_player_mgr_set_started_db(mp_player_started_cb callback, + void *user_data) { if (!mp_player_mgr_is_active()) { return; @@ -152,7 +153,8 @@ void mp_player_mgr_set_started_db(mp_player_started_cb callback, void *user_data g_player_cbs->user_data[MP_PLAYER_CB_TYPE_STARTED] = user_data; } -void mp_player_mgr_set_completed_cb(player_completed_cb callback, void *user_data) +void mp_player_mgr_set_completed_cb(player_completed_cb callback, + void *user_data) { if (!mp_player_mgr_is_active()) { return; @@ -164,7 +166,8 @@ void mp_player_mgr_set_completed_cb(player_completed_cb callback, void *user_da g_player_cbs->user_data[MP_PLAYER_CB_TYPE_COMPLETED] = user_data; } -void mp_player_mgr_set_interrupted_cb(player_interrupted_cb callback, void *user_data) +void mp_player_mgr_set_interrupted_cb(player_interrupted_cb callback, + void *user_data) { if (!mp_player_mgr_is_active()) { return; @@ -176,7 +179,7 @@ void mp_player_mgr_set_interrupted_cb(player_interrupted_cb callback, void *use g_player_cbs->user_data[MP_PLAYER_CB_TYPE_INTURRUPTED] = user_data; } -void mp_player_mgr_set_error_cb(player_error_cb callback, void *user_data) +void mp_player_mgr_set_error_cb(player_error_cb callback, void *user_data) { if (!mp_player_mgr_is_active()) { return; @@ -188,7 +191,8 @@ void mp_player_mgr_set_error_cb(player_error_cb callback, void *user_data) g_player_cbs->user_data[MP_PLAYER_CB_TYPE_ERROR] = user_data; } -void mp_player_mgr_set_buffering_cb(player_buffering_cb callback, void *user_data) +void mp_player_mgr_set_buffering_cb(player_buffering_cb callback, + void *user_data) { if (!mp_player_mgr_is_active()) { return; @@ -200,7 +204,8 @@ void mp_player_mgr_set_buffering_cb(player_buffering_cb callback, void *user_da g_player_cbs->user_data[MP_PLAYER_CB_TYPE_BUFFERING] = user_data; } -void mp_player_mgr_set_prepare_cb(player_prepared_cb callback, void *user_data) +void mp_player_mgr_set_prepare_cb(player_prepared_cb callback, + void *user_data) { if (!mp_player_mgr_is_active()) { return; @@ -260,7 +265,8 @@ void mp_player_mgr_unset_buffering_cb(void) g_player_cbs->user_data[MP_PLAYER_CB_TYPE_BUFFERING] = NULL; } -void mp_player_mgr_set_paused_cb(mp_player_paused_cb callback, void *user_data) +void mp_player_mgr_set_paused_cb(mp_player_paused_cb callback, + void *user_data) { if (!mp_player_mgr_is_active()) { return; @@ -272,20 +278,23 @@ void mp_player_mgr_set_paused_cb(mp_player_paused_cb callback, void *user_data) g_player_cbs->user_data[MP_PLAYER_CB_TYPE_PAUSED] = user_data; } -static Eina_Bool -_mp_player_mgr_duration_timer_cb(void *data) +static Eina_Bool _mp_player_mgr_duration_timer_cb(void *data) { TIMER_TRACE(); mp_player_cbs *cb_info = data; MP_CHECK_VAL(cb_info, ECORE_CALLBACK_CANCEL); if (cb_info->duration_changed_cb) { - cb_info->duration_changed_cb(cb_info->user_data[MP_PLAYER_CB_TYPE_DURATION_CHANGED]); + cb_info->duration_changed_cb(cb_info-> + user_data + [MP_PLAYER_CB_TYPE_DURATION_CHANGED]); } return ECORE_CALLBACK_RENEW; } -void mp_player_mgr_set_duration_changed_cb(mp_player_duration_changed_cb callback, void *user_data) + +void mp_player_mgr_set_duration_changed_cb(mp_player_duration_changed_cb + callback, void *user_data) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); @@ -297,20 +306,23 @@ void mp_player_mgr_set_duration_changed_cb(mp_player_duration_changed_cb callbac MP_CHECK(g_player_cbs); g_player_cbs->duration_changed_cb = callback; - g_player_cbs->user_data[MP_PLAYER_CB_TYPE_DURATION_CHANGED] = user_data; + g_player_cbs->user_data[MP_PLAYER_CB_TYPE_DURATION_CHANGED] = + user_data; mp_ecore_timer_del(ad->duration_change_timer); - ad->duration_change_timer = ecore_timer_add(5.0, _mp_player_mgr_duration_timer_cb, g_player_cbs); + ad->duration_change_timer = + ecore_timer_add(5.0, _mp_player_mgr_duration_timer_cb, + g_player_cbs); - if (mp_player_mgr_get_state() == PLAYER_STATE_PLAYING && !ad->is_lcd_off) { + if (mp_player_mgr_get_state() == PLAYER_STATE_PLAYING + && !ad->is_lcd_off) { MP_TIMER_THAW(ad->duration_change_timer); } else { MP_TIMER_FREEZE(ad->duration_change_timer); } } -player_state_e -mp_player_mgr_get_state(void) +player_state_e mp_player_mgr_get_state(void) { player_state_e state_now = PLAYER_STATE_NONE; @@ -322,15 +334,15 @@ mp_player_mgr_get_state(void) return state_now; } -mp_player_type_e -mp_player_mgr_get_player_type(void) +mp_player_type_e mp_player_mgr_get_player_type(void) { mp_debug("player type = %d", _player_type); return _player_type; } static void -_mp_player_mgr_callback_pipe_handler(void *data, void *buffer, unsigned int nbyte) +_mp_player_mgr_callback_pipe_handler(void *data, void *buffer, + unsigned int nbyte) { mp_player_cb_extra_data *extra_data = buffer; MP_CHECK(extra_data); @@ -339,49 +351,66 @@ _mp_player_mgr_callback_pipe_handler(void *data, void *buffer, unsigned int nbyt switch (extra_data->cb_type) { case MP_PLAYER_CB_TYPE_STARTED: if (g_player_cbs->started_cb) { - g_player_cbs->started_cb(g_player_cbs->user_data[MP_PLAYER_CB_TYPE_STARTED]); + g_player_cbs->started_cb(g_player_cbs-> + user_data[MP_PLAYER_CB_TYPE_STARTED]); } break; case MP_PLAYER_CB_TYPE_COMPLETED: if (g_player_cbs->completed_cb) { - g_player_cbs->completed_cb(g_player_cbs->user_data[MP_PLAYER_CB_TYPE_COMPLETED]); + g_player_cbs->completed_cb(g_player_cbs-> + user_data + [MP_PLAYER_CB_TYPE_COMPLETED]); } break; case MP_PLAYER_CB_TYPE_INTURRUPTED: if (g_player_cbs->interrupted_cb) { - g_player_cbs->interrupted_cb(extra_data->param.interrupted_code, g_player_cbs->user_data[MP_PLAYER_CB_TYPE_INTURRUPTED]); + g_player_cbs->interrupted_cb(extra_data->param. + interrupted_code, + g_player_cbs-> + user_data + [MP_PLAYER_CB_TYPE_INTURRUPTED]); } break; case MP_PLAYER_CB_TYPE_ERROR: if (g_player_cbs->error_cb) { - g_player_cbs->error_cb(extra_data->param.error_code, g_player_cbs->user_data[MP_PLAYER_CB_TYPE_ERROR]); + g_player_cbs->error_cb(extra_data->param.error_code, + g_player_cbs-> + user_data[MP_PLAYER_CB_TYPE_ERROR]); } break; case MP_PLAYER_CB_TYPE_BUFFERING: if (g_player_cbs->buffering_cb) { - g_player_cbs->buffering_cb(extra_data->param.percent, g_player_cbs->user_data[MP_PLAYER_CB_TYPE_BUFFERING]); + g_player_cbs->buffering_cb(extra_data->param.percent, + g_player_cbs-> + user_data + [MP_PLAYER_CB_TYPE_BUFFERING]); } break; case MP_PLAYER_CB_TYPE_PREPARE: if (g_player_cbs->prepare_cb) { - g_player_cbs->prepare_cb(g_player_cbs->user_data[MP_PLAYER_CB_TYPE_PREPARE]); + g_player_cbs->prepare_cb(g_player_cbs-> + user_data[MP_PLAYER_CB_TYPE_PREPARE]); } break; case MP_PLAYER_CB_TYPE_PAUSED: if (g_player_cbs->paused_cb) { - g_player_cbs->paused_cb(g_player_cbs->user_data[MP_PLAYER_CB_TYPE_PAUSED]); + g_player_cbs->paused_cb(g_player_cbs-> + user_data[MP_PLAYER_CB_TYPE_PAUSED]); } break; case MP_PLAYER_CB_TYPE_PROGRESSIVE_DOWNLOAD_MESSAGE: if (g_player_cbs->pd_message_cb) { - g_player_cbs->pd_message_cb(extra_data->param.pd_message_type, g_player_cbs->user_data[MP_PLAYER_CB_TYPE_PROGRESSIVE_DOWNLOAD_MESSAGE]); + g_player_cbs->pd_message_cb(extra_data->param.pd_message_type, + g_player_cbs-> + user_data + [MP_PLAYER_CB_TYPE_PROGRESSIVE_DOWNLOAD_MESSAGE]); } break; @@ -390,8 +419,7 @@ _mp_player_mgr_callback_pipe_handler(void *data, void *buffer, unsigned int nbyt } } -static void -_mp_player_mgr_started_cb(void *userdata) +static void _mp_player_mgr_started_cb(void *userdata) { MP_CHECK(g_player_pipe); @@ -399,11 +427,11 @@ _mp_player_mgr_started_cb(void *userdata) memset(&extra_data, 0, sizeof(mp_player_cb_extra_data)); extra_data.cb_type = MP_PLAYER_CB_TYPE_STARTED; - ecore_pipe_write(g_player_pipe, &extra_data, sizeof(mp_player_cb_extra_data)); + ecore_pipe_write(g_player_pipe, &extra_data, + sizeof(mp_player_cb_extra_data)); } -static void -_mp_player_mgr_completed_cb(void *userdata) +static void _mp_player_mgr_completed_cb(void *userdata) { MP_CHECK(g_player_pipe); @@ -411,11 +439,13 @@ _mp_player_mgr_completed_cb(void *userdata) memset(&extra_data, 0, sizeof(mp_player_cb_extra_data)); extra_data.cb_type = MP_PLAYER_CB_TYPE_COMPLETED; - ecore_pipe_write(g_player_pipe, &extra_data, sizeof(mp_player_cb_extra_data)); + ecore_pipe_write(g_player_pipe, &extra_data, + sizeof(mp_player_cb_extra_data)); } static void -_mp_player_mgr_interrupted_cb(player_interrupted_code_e code, void *userdata) +_mp_player_mgr_interrupted_cb(player_interrupted_code_e code, + void *userdata) { startfunc; MP_CHECK(g_player_pipe); @@ -425,12 +455,12 @@ _mp_player_mgr_interrupted_cb(player_interrupted_code_e code, void *userdata) extra_data.cb_type = MP_PLAYER_CB_TYPE_INTURRUPTED; extra_data.param.interrupted_code = code; - ecore_pipe_write(g_player_pipe, &extra_data, sizeof(mp_player_cb_extra_data)); + ecore_pipe_write(g_player_pipe, &extra_data, + sizeof(mp_player_cb_extra_data)); } -static void -_mp_player_mgr_error_cb(int error_code, void *userdata) +static void _mp_player_mgr_error_cb(int error_code, void *userdata) { MP_CHECK(g_player_pipe); @@ -439,11 +469,11 @@ _mp_player_mgr_error_cb(int error_code, void *userdata) extra_data.cb_type = MP_PLAYER_CB_TYPE_ERROR; extra_data.param.error_code = error_code; - ecore_pipe_write(g_player_pipe, &extra_data, sizeof(mp_player_cb_extra_data)); + ecore_pipe_write(g_player_pipe, &extra_data, + sizeof(mp_player_cb_extra_data)); } -static void -_mp_player_mgr_buffering_cb(int percent, void *userdata) +static void _mp_player_mgr_buffering_cb(int percent, void *userdata) { MP_CHECK(g_player_pipe); @@ -452,14 +482,14 @@ _mp_player_mgr_buffering_cb(int percent, void *userdata) extra_data.cb_type = MP_PLAYER_CB_TYPE_BUFFERING; extra_data.param.percent = percent; - ecore_pipe_write(g_player_pipe, &extra_data, sizeof(mp_player_cb_extra_data)); + ecore_pipe_write(g_player_pipe, &extra_data, + sizeof(mp_player_cb_extra_data)); } -static void -_mp_player_mgr_prepare_cb(void *userdata) +static void _mp_player_mgr_prepare_cb(void *userdata) { MP_CHECK(g_player_pipe); - struct appdata *ad = (struct appdata *)userdata; + struct appdata *ad = (struct appdata *) userdata; MP_CHECK(ad); ad->player_state = PLAY_STATE_READY; @@ -467,11 +497,11 @@ _mp_player_mgr_prepare_cb(void *userdata) memset(&extra_data, 0, sizeof(mp_player_cb_extra_data)); extra_data.cb_type = MP_PLAYER_CB_TYPE_PREPARE; - ecore_pipe_write(g_player_pipe, &extra_data, sizeof(mp_player_cb_extra_data)); + ecore_pipe_write(g_player_pipe, &extra_data, + sizeof(mp_player_cb_extra_data)); } -static void -_mp_player_mgr_paused_cb(void *userdata) +static void _mp_player_mgr_paused_cb(void *userdata) { MP_CHECK(g_player_pipe); @@ -479,11 +509,11 @@ _mp_player_mgr_paused_cb(void *userdata) memset(&extra_data, 0, sizeof(mp_player_cb_extra_data)); extra_data.cb_type = MP_PLAYER_CB_TYPE_PAUSED; - ecore_pipe_write(g_player_pipe, &extra_data, sizeof(mp_player_cb_extra_data)); + ecore_pipe_write(g_player_pipe, &extra_data, + sizeof(mp_player_cb_extra_data)); } -static void -_mp_player_mgr_change_player(mp_player_type_e player_type) +static void _mp_player_mgr_change_player(mp_player_type_e player_type) { _player_type = player_type; @@ -491,7 +521,7 @@ _mp_player_mgr_change_player(mp_player_type_e player_type) memset(&g_player_apis, 0x0, sizeof(mp_player_api_s)); - { /* MP_PLAYER_TYPE_MMFW */ + { /* MP_PLAYER_TYPE_MMFW */ g_player_apis.create = player_create; g_player_apis.destroy = player_destroy; g_player_apis.prepare = player_prepare; @@ -500,8 +530,10 @@ _mp_player_mgr_change_player(mp_player_type_e player_type) g_player_apis.set_uri = player_set_uri; g_player_apis.get_state = player_get_state; g_player_apis.set_sound_type = player_set_audio_policy_info; - g_player_apis.set_audio_latency_mode = player_set_audio_latency_mode; - g_player_apis.get_audio_latency_mode = player_get_audio_latency_mode; + g_player_apis.set_audio_latency_mode = + player_set_audio_latency_mode; + g_player_apis.get_audio_latency_mode = + player_get_audio_latency_mode; g_player_apis.start = player_start; g_player_apis.pause = player_pause; g_player_apis.stop = player_stop; @@ -520,8 +552,7 @@ _mp_player_mgr_change_player(mp_player_type_e player_type) } } -int -_mp_player_mgr_create_common(struct appdata *ad, mp_player_type_e type) +int _mp_player_mgr_create_common(struct appdata *ad, mp_player_type_e type) { MP_CHECK_VAL(ad, -1); int ret = PLAYER_ERROR_NONE; @@ -548,7 +579,8 @@ _mp_player_mgr_create_common(struct appdata *ad, mp_player_type_e type) #ifdef MP_SOUND_PLAYER if (ad->cookie) { - player_set_streaming_cookie(_player, ad->cookie, strlen(ad->cookie)); + player_set_streaming_cookie(_player, ad->cookie, + strlen(ad->cookie)); } #endif } @@ -559,7 +591,8 @@ _mp_player_mgr_create_common(struct appdata *ad, mp_player_type_e type) PLAYER_LEAVE_LOG("set_sound_type"); } if (g_player_apis.set_audio_latency_mode) { - g_player_apis.set_audio_latency_mode(_player, AUDIO_LATENCY_MODE_HIGH); + g_player_apis.set_audio_latency_mode(_player, + AUDIO_LATENCY_MODE_HIGH); } is_seeking = false; @@ -572,26 +605,33 @@ _mp_player_mgr_create_common(struct appdata *ad, mp_player_type_e type) } if (g_player_apis.set_started_cb) { - g_player_apis.set_started_cb(_player, _mp_player_mgr_started_cb, NULL); + g_player_apis.set_started_cb(_player, _mp_player_mgr_started_cb, + NULL); } if (g_player_apis.set_completed_cb) { - g_player_apis.set_completed_cb(_player, _mp_player_mgr_completed_cb, NULL); + g_player_apis.set_completed_cb(_player, + _mp_player_mgr_completed_cb, NULL); } if (g_player_apis.set_interrupted_cb) { - g_player_apis.set_interrupted_cb(_player, _mp_player_mgr_interrupted_cb, NULL); + g_player_apis.set_interrupted_cb(_player, + _mp_player_mgr_interrupted_cb, + NULL); } if (g_player_apis.set_error_cb) { g_player_apis.set_error_cb(_player, _mp_player_mgr_error_cb, NULL); } if (g_player_apis.set_buffering_cb) { - g_player_apis.set_buffering_cb(_player, _mp_player_mgr_buffering_cb, NULL); + g_player_apis.set_buffering_cb(_player, + _mp_player_mgr_buffering_cb, NULL); } if (g_player_apis.set_paused_cb) { - g_player_apis.set_paused_cb(_player, _mp_player_mgr_paused_cb, NULL); + g_player_apis.set_paused_cb(_player, _mp_player_mgr_paused_cb, + NULL); } if (!g_player_pipe) { - g_player_pipe = ecore_pipe_add(_mp_player_mgr_callback_pipe_handler, ad); + g_player_pipe = + ecore_pipe_add(_mp_player_mgr_callback_pipe_handler, ad); } ad->player_state = PLAY_STATE_CREATED; @@ -600,8 +640,7 @@ _mp_player_mgr_create_common(struct appdata *ad, mp_player_type_e type) return ret; } -int -mp_player_mgr_prepare(void *data) +int mp_player_mgr_prepare(void *data) { mp_plst_item *item = NULL; struct appdata *ad = data; @@ -617,9 +656,10 @@ mp_player_mgr_prepare(void *data) } int -mp_player_mgr_create(void *data, const char * path, mp_player_type_e type, void *extra_data) +mp_player_mgr_create(void *data, const char *path, mp_player_type_e type, + void *extra_data) { - struct appdata *ad = (struct appdata *)data; + struct appdata *ad = (struct appdata *) data; MP_CHECK_VAL(ad, -1); MP_CHECK_VAL(path, -1); @@ -642,13 +682,12 @@ mp_player_mgr_create(void *data, const char * path, mp_player_type_e type, void return 0; -exception: + exception: mp_player_mgr_destroy(ad); return ret; } -int -mp_player_mgr_create_with_buffer(void *data, void *buffer, int size) +int mp_player_mgr_create_with_buffer(void *data, void *buffer, int size) { struct appdata *ad = data; MP_CHECK_VAL(ad, -1); @@ -668,15 +707,16 @@ mp_player_mgr_create_with_buffer(void *data, void *buffer, int size) return 0; } -bool -mp_player_mgr_destroy(void *data) +bool mp_player_mgr_destroy(void *data) { struct appdata *ad = data; MP_CHECK_FALSE(ad); int res = true; if (ad->current_track_info) { - if (mp_setting_read_playing_status(ad->current_track_info->uri, "paused") != 1) { - mp_setting_write_playing_status(ad->current_track_info->uri, "paused"); + if (mp_setting_read_playing_status + (ad->current_track_info->uri, "paused") != 1) { + mp_setting_write_playing_status(ad->current_track_info->uri, + "paused"); } } @@ -714,8 +754,7 @@ mp_player_mgr_destroy(void *data) return res; } -int -mp_player_mgr_realize(void *data) +int mp_player_mgr_realize(void *data) { struct appdata *ad = data; int error = PLAYER_ERROR_NONE; @@ -724,7 +763,9 @@ mp_player_mgr_realize(void *data) return -1; } PLAYER_ENTER_LOG("prepare_async"); - error = g_player_apis.prepare_async(_player, _mp_player_mgr_prepare_cb, ad); + error = + g_player_apis.prepare_async(_player, _mp_player_mgr_prepare_cb, + ad); PLAYER_LEAVE_LOG("prepare_async"); if (error != PLAYER_ERROR_NONE) { ERROR_TRACE("Error when mp_player_mgr_realize .. [0x%x]", error); @@ -735,8 +776,7 @@ mp_player_mgr_realize(void *data) return error; } -bool -mp_player_mgr_unrealize(void *data) +bool mp_player_mgr_unrealize(void *data) { if (!mp_player_mgr_is_active()) { return FALSE; @@ -751,8 +791,7 @@ mp_player_mgr_unrealize(void *data) return TRUE; } -int -mp_player_mgr_play(void *data) +int mp_player_mgr_play(void *data) { startfunc; struct appdata *ad = data; @@ -778,7 +817,10 @@ mp_player_mgr_play(void *data) PLAYER_ENTER_LOG("start"); if (ad->stream_info) { - error = sound_manager_acquire_focus(ad->stream_info, SOUND_STREAM_FOCUS_FOR_PLAYBACK, SOUND_BEHAVIOR_NONE, NULL); + error = + sound_manager_acquire_focus(ad->stream_info, + SOUND_STREAM_FOCUS_FOR_PLAYBACK, + SOUND_BEHAVIOR_NONE, NULL); if (error != SOUND_MANAGER_ERROR_NONE) { ERROR_TRACE("failed to acquire focus [%x]", error); } @@ -798,7 +840,8 @@ mp_player_mgr_play(void *data) g_reserved_seek_pos = -1; if (!g_player_apis.set_started_cb && g_player_cbs->started_cb) { /* sync */ - g_player_cbs->started_cb(g_player_cbs->user_data[MP_PLAYER_CB_TYPE_STARTED]); + g_player_cbs->started_cb(g_player_cbs-> + user_data[MP_PLAYER_CB_TYPE_STARTED]); } if (!ad->is_lcd_off) { @@ -809,8 +852,7 @@ mp_player_mgr_play(void *data) } -bool -mp_player_mgr_stop(void *data) +bool mp_player_mgr_stop(void *data) { startfunc; struct appdata *ad = data; @@ -822,7 +864,10 @@ mp_player_mgr_stop(void *data) PLAYER_ENTER_LOG("stop"); int res = g_player_apis.stop(_player); if (ad->stream_info) { - int error = sound_manager_release_focus(ad->stream_info, SOUND_STREAM_FOCUS_FOR_PLAYBACK, SOUND_BEHAVIOR_NONE, NULL); + int error = + sound_manager_release_focus(ad->stream_info, + SOUND_STREAM_FOCUS_FOR_PLAYBACK, + SOUND_BEHAVIOR_NONE, NULL); if (error != SOUND_MANAGER_ERROR_NONE) { ERROR_TRACE("failed to release focus error[%x]", error); } @@ -846,8 +891,7 @@ mp_player_mgr_stop(void *data) return TRUE; } -int -mp_player_mgr_resume(void *data) +int mp_player_mgr_resume(void *data) { startfunc; struct appdata *ad = data; @@ -869,12 +913,18 @@ mp_player_mgr_resume(void *data) } if (ad->stream_info) { - ret = sound_manager_get_focus_state(ad->stream_info, &state_for_playback, &state_for_recording); - if(ret != SOUND_MANAGER_ERROR_NONE) { + ret = + sound_manager_get_focus_state(ad->stream_info, + &state_for_playback, + &state_for_recording); + if (ret != SOUND_MANAGER_ERROR_NONE) { ERROR_TRACE("failed in sound_manager_get_focus_state"); } if (state_for_playback != SOUND_STREAM_FOCUS_STATE_ACQUIRED) { - error = sound_manager_acquire_focus(ad->stream_info, SOUND_STREAM_FOCUS_FOR_PLAYBACK, SOUND_BEHAVIOR_NONE, NULL); + error = + sound_manager_acquire_focus(ad->stream_info, + SOUND_STREAM_FOCUS_FOR_PLAYBACK, + SOUND_BEHAVIOR_NONE, NULL); if (error != SOUND_MANAGER_ERROR_NONE) { ERROR_TRACE("failed to acquire focus [%x]", error); return error; @@ -907,8 +957,7 @@ mp_player_mgr_resume(void *data) return err; } -bool -mp_player_mgr_pause(void *data) +bool mp_player_mgr_pause(void *data) { startfunc; struct appdata *ad = data; @@ -925,7 +974,10 @@ mp_player_mgr_pause(void *data) PLAYER_ENTER_LOG("pause"); err = g_player_apis.pause(_player); if (ad->stream_info) { - error = sound_manager_release_focus(ad->stream_info, SOUND_STREAM_FOCUS_FOR_PLAYBACK, SOUND_BEHAVIOR_NONE, NULL); + error = + sound_manager_release_focus(ad->stream_info, + SOUND_STREAM_FOCUS_FOR_PLAYBACK, + SOUND_BEHAVIOR_NONE, NULL); if (error != SOUND_MANAGER_ERROR_NONE) { ERROR_TRACE("failed to release focus error[%x]", error); } @@ -951,14 +1003,14 @@ mp_player_mgr_pause(void *data) MP_TIMER_FREEZE(ad->duration_change_timer); if (!g_player_apis.set_paused_cb && g_player_cbs->paused_cb) { - g_player_cbs->paused_cb(g_player_cbs->user_data[MP_PLAYER_CB_TYPE_PAUSED]); + g_player_cbs->paused_cb(g_player_cbs-> + user_data[MP_PLAYER_CB_TYPE_PAUSED]); } return TRUE; } -Eina_Bool -mp_player_mgr_seek_done(void *data) +Eina_Bool mp_player_mgr_seek_done(void *data) { if (!is_seeking) { return ECORE_CALLBACK_DONE; @@ -975,7 +1027,8 @@ mp_player_mgr_seek_done(void *data) } if (g_reserved_seek_pos >= 0) { - mp_player_mgr_set_position(g_reserved_seek_pos, g_reserved_cb, g_reserved_cb_data); + mp_player_mgr_set_position(g_reserved_seek_pos, g_reserved_cb, + g_reserved_cb_data); g_reserved_seek_pos = -1; g_reserved_cb = NULL; g_reserved_cb_data = NULL; @@ -992,22 +1045,21 @@ mp_player_mgr_seek_done(void *data) return ECORE_CALLBACK_DONE; } -static void -_mp_player_mgr_seek_done_cb(void *data) +static void _mp_player_mgr_seek_done_cb(void *data) { if (is_seeking) { mp_player_mgr_seek_done(data); } } -bool -mp_player_mgr_is_seeking(void) +bool mp_player_mgr_is_seeking(void) { return is_seeking; } bool -mp_player_mgr_set_position(unsigned int pos, Seek_Done_Cb done_cb, void *data) +mp_player_mgr_set_position(unsigned int pos, Seek_Done_Cb done_cb, + void *data) { if (!mp_player_mgr_is_active()) { return FALSE; @@ -1021,10 +1073,14 @@ mp_player_mgr_set_position(unsigned int pos, Seek_Done_Cb done_cb, void *data) } PLAYER_ENTER_LOG("set_position"); - int err = g_player_apis.set_position(_player, (int)pos, TRUE, _mp_player_mgr_seek_done_cb, (void *)pos); + int err = + g_player_apis.set_position(_player, (int) pos, TRUE, + _mp_player_mgr_seek_done_cb, + (void *) pos); PLAYER_LEAVE_LOG("set_position"); if (err != PLAYER_ERROR_NONE) { - ERROR_TRACE("Error [0x%x] when mp_player_mgr_set_position(%d)", err, pos); + ERROR_TRACE("Error [0x%x] when mp_player_mgr_set_position(%d)", + err, pos); return FALSE; } @@ -1035,8 +1091,7 @@ mp_player_mgr_set_position(unsigned int pos, Seek_Done_Cb done_cb, void *data) return TRUE; } -void -mp_player_mgr_unset_seek_done_cb() +void mp_player_mgr_unset_seek_done_cb() { g_requesting_cb = NULL; g_requesting_cb_data = NULL; @@ -1044,8 +1099,7 @@ mp_player_mgr_unset_seek_done_cb() g_reserved_cb_data = NULL; } -bool -mp_player_mgr_set_play_speed(double rate) +bool mp_player_mgr_set_play_speed(double rate) { int err = PLAYER_ERROR_NONE; if (!mp_player_mgr_is_active()) { @@ -1065,8 +1119,7 @@ mp_player_mgr_set_play_speed(double rate) return TRUE; } -int -mp_player_mgr_get_position(void) +int mp_player_mgr_get_position(void) { int pos = 0; @@ -1082,8 +1135,7 @@ mp_player_mgr_get_position(void) return pos; } -int -mp_player_mgr_get_duration(void) +int mp_player_mgr_get_duration(void) { if (!mp_player_mgr_is_active()) { return 0; @@ -1091,7 +1143,8 @@ mp_player_mgr_get_duration(void) int duration = 0; - if (g_player_apis.get_duration(_player, &duration) != PLAYER_ERROR_NONE) { + if (g_player_apis.get_duration(_player, &duration) != + PLAYER_ERROR_NONE) { ERROR_TRACE("Error when mp_player_mgr_get_position"); return 0; } @@ -1099,20 +1152,17 @@ mp_player_mgr_get_duration(void) return duration; } -int -mp_player_mgr_vol_type_set(void) +int mp_player_mgr_vol_type_set(void) { return sound_manager_set_current_sound_type(SOUND_TYPE_MEDIA); } -int -mp_player_mgr_vol_type_unset(void) +int mp_player_mgr_vol_type_unset(void) { return sound_manager_unset_current_sound_type(); } -int -mp_player_mgr_safety_volume_set(int foreground) +int mp_player_mgr_safety_volume_set(int foreground) { int set = false; player_state_e state = mp_player_mgr_get_state(); @@ -1126,35 +1176,46 @@ mp_player_mgr_safety_volume_set(int foreground) set = false; } } - EVENT_TRACE("Foreground[%d], PlayerState[%d], set[%d]", foreground, state, set); + EVENT_TRACE("Foreground[%d], PlayerState[%d], set[%d]", foreground, + state, set); return 0; } -void mp_player_focus_callback(sound_stream_info_h stream_info, sound_stream_focus_mask_e focus_mask, - sound_stream_focus_state_e focus_state, sound_stream_focus_change_reason_e reason_for_change, - int sound_behaviors, const char *extra_info, void *user_data) +void mp_player_focus_callback(sound_stream_info_h stream_info, + sound_stream_focus_mask_e focus_mask, + sound_stream_focus_state_e focus_state, + sound_stream_focus_change_reason_e + reason_for_change, int sound_behaviors, + const char *extra_info, void *user_data) { startfunc; struct appdata *ad = user_data; - if (focus_mask == SOUND_STREAM_FOCUS_FOR_PLAYBACK && focus_state == SOUND_STREAM_FOCUS_STATE_RELEASED) { + if (focus_mask == SOUND_STREAM_FOCUS_FOR_PLAYBACK + && focus_state == SOUND_STREAM_FOCUS_STATE_RELEASED) { mp_player_mgr_pause(ad); - sound_manager_get_focus_reacquisition(ad->stream_info, &reacquire_state); + sound_manager_get_focus_reacquisition(ad->stream_info, + &reacquire_state); DEBUG_TRACE("reason for change is %d", reason_for_change); if (reason_for_change == SOUND_STREAM_FOCUS_CHANGED_BY_VOIP || - reason_for_change == SOUND_STREAM_FOCUS_CHANGED_BY_CALL || - reason_for_change == SOUND_STREAM_FOCUS_CHANGED_BY_RINGTONE || - reason_for_change == SOUND_STREAM_FOCUS_CHANGED_BY_VOICE_RECOGNITION) { - sound_manager_set_focus_reacquisition(ad->stream_info, EINA_TRUE); - } else if (reason_for_change != SOUND_STREAM_FOCUS_CHANGED_BY_ALARM && - reason_for_change != SOUND_STREAM_FOCUS_CHANGED_BY_NOTIFICATION) { + reason_for_change == SOUND_STREAM_FOCUS_CHANGED_BY_CALL || + reason_for_change == SOUND_STREAM_FOCUS_CHANGED_BY_RINGTONE || + reason_for_change == + SOUND_STREAM_FOCUS_CHANGED_BY_VOICE_RECOGNITION) { + sound_manager_set_focus_reacquisition(ad->stream_info, + EINA_TRUE); + } else if (reason_for_change != SOUND_STREAM_FOCUS_CHANGED_BY_ALARM + && reason_for_change != + SOUND_STREAM_FOCUS_CHANGED_BY_NOTIFICATION) { if (reacquire_state == EINA_TRUE) { - sound_manager_set_focus_reacquisition(ad->stream_info, EINA_FALSE); + sound_manager_set_focus_reacquisition(ad->stream_info, + EINA_FALSE); } } else if (sound_behaviors & SOUND_BEHAVIOR_NO_RESUME) { - sound_manager_set_focus_reacquisition(ad->stream_info, EINA_FALSE); + sound_manager_set_focus_reacquisition(ad->stream_info, + EINA_FALSE); } } else { mp_play_control_play_pause(ad, true); @@ -1162,14 +1223,16 @@ void mp_player_focus_callback(sound_stream_info_h stream_info, sound_stream_focu } -bool -mp_player_mgr_session_init(void) +bool mp_player_mgr_session_init(void) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK_FALSE(ad); int ret = SOUND_MANAGER_ERROR_NONE; if (!ad->stream_info) { - ret = sound_manager_create_stream_information(SOUND_STREAM_TYPE_MEDIA, mp_player_focus_callback, ad, &ad->stream_info); + ret = + sound_manager_create_stream_information + (SOUND_STREAM_TYPE_MEDIA, mp_player_focus_callback, ad, + &ad->stream_info); if (ret != SOUND_MANAGER_ERROR_NONE) { EVENT_TRACE("failed to create_stream_information [%x]", ret); @@ -1179,14 +1242,12 @@ mp_player_mgr_session_init(void) return TRUE; } -bool -mp_player_mgr_session_finish(void) +bool mp_player_mgr_session_finish(void) { return TRUE; } -void -mp_player_mgr_set_mute(bool bMuteEnable) +void mp_player_mgr_set_mute(bool bMuteEnable) { if (!mp_player_mgr_is_active()) { @@ -1198,8 +1259,7 @@ mp_player_mgr_set_mute(bool bMuteEnable) } } -int -mp_player_mgr_volume_get_max() +int mp_player_mgr_volume_get_max() { int max_vol = 0; @@ -1220,8 +1280,7 @@ mp_player_mgr_volume_get_max() return max_vol; } -int -mp_player_mgr_volume_get_current() +int mp_player_mgr_volume_get_current() { int current = 0; int ret = 0; @@ -1238,13 +1297,12 @@ mp_player_mgr_volume_get_current() return current; } -bool -mp_player_mgr_volume_set(int volume) +bool mp_player_mgr_volume_set(int volume) { int ret = 0; PLAYER_ENTER_LOG("sound_manager_set_volume_with_safety"); - ret = sound_manager_set_volume(SOUND_TYPE_MEDIA, volume); + ret = sound_manager_set_volume(SOUND_TYPE_MEDIA, volume); PLAYER_LEAVE_LOG("sound_manager_set_volume_with_safety"); if (ret != SOUND_MANAGER_ERROR_NONE) { mp_error("sound_manager_set_volume_with_safety().. [0x%x]", ret); @@ -1256,8 +1314,7 @@ mp_player_mgr_volume_set(int volume) return true; } -bool -mp_player_mgr_volume_up() +bool mp_player_mgr_volume_up() { int current = mp_player_mgr_volume_get_current(); int max = mp_player_mgr_volume_get_max(); @@ -1278,8 +1335,7 @@ mp_player_mgr_volume_up() return ret; } -bool -mp_player_mgr_volume_down() +bool mp_player_mgr_volume_down() { int current = mp_player_mgr_volume_get_current(); @@ -1300,7 +1356,8 @@ mp_player_mgr_volume_down() } bool -mp_player_mgr_get_content_info(char **title, char **album, char **artist, char **author, char **genre, char **year) +mp_player_mgr_get_content_info(char **title, char **album, char **artist, + char **author, char **genre, char **year) { if (!mp_player_mgr_is_active()) { return false; @@ -1308,29 +1365,48 @@ mp_player_mgr_get_content_info(char **title, char **album, char **artist, char * MP_CHECK_FALSE(g_player_apis.get_content_info); - if (album && g_player_apis.get_content_info(_player, PLAYER_CONTENT_INFO_ALBUM, album) != PLAYER_ERROR_NONE) { + if (album + && g_player_apis.get_content_info(_player, + PLAYER_CONTENT_INFO_ALBUM, + album) != PLAYER_ERROR_NONE) { ERROR_TRACE("[ERR] mm_player_get_content_info"); } - if (artist && g_player_apis.get_content_info(_player, PLAYER_CONTENT_INFO_ARTIST, artist) != PLAYER_ERROR_NONE) { + if (artist + && g_player_apis.get_content_info(_player, + PLAYER_CONTENT_INFO_ARTIST, + artist) != PLAYER_ERROR_NONE) { ERROR_TRACE("[ERR] mm_player_get_content_info"); } - if (author && g_player_apis.get_content_info(_player, PLAYER_CONTENT_INFO_AUTHOR, author) != PLAYER_ERROR_NONE) { + if (author + && g_player_apis.get_content_info(_player, + PLAYER_CONTENT_INFO_AUTHOR, + author) != PLAYER_ERROR_NONE) { ERROR_TRACE("[ERR] mm_player_get_content_info"); } - if (genre && g_player_apis.get_content_info(_player, PLAYER_CONTENT_INFO_GENRE, genre) != PLAYER_ERROR_NONE) { + if (genre + && g_player_apis.get_content_info(_player, + PLAYER_CONTENT_INFO_GENRE, + genre) != PLAYER_ERROR_NONE) { ERROR_TRACE("[ERR] mm_player_get_content_info"); } - if (title && g_player_apis.get_content_info(_player, PLAYER_CONTENT_INFO_TITLE, title) != PLAYER_ERROR_NONE) { + if (title + && g_player_apis.get_content_info(_player, + PLAYER_CONTENT_INFO_TITLE, + title) != PLAYER_ERROR_NONE) { ERROR_TRACE("[ERR] mm_player_get_content_info"); } - if (year && g_player_apis.get_content_info(_player, PLAYER_CONTENT_INFO_YEAR, year) != PLAYER_ERROR_NONE) { + if (year + && g_player_apis.get_content_info(_player, + PLAYER_CONTENT_INFO_YEAR, + year) != PLAYER_ERROR_NONE) { ERROR_TRACE("[ERR] mm_player_get_content_info"); } return true; } static void -_mp_player_mgr_pd_message_cb(player_pd_message_type_e type, void *user_data) +_mp_player_mgr_pd_message_cb(player_pd_message_type_e type, + void *user_data) { MP_CHECK(g_player_pipe); @@ -1339,11 +1415,14 @@ _mp_player_mgr_pd_message_cb(player_pd_message_type_e type, void *user_data) extra_data.cb_type = MP_PLAYER_CB_TYPE_PROGRESSIVE_DOWNLOAD_MESSAGE; extra_data.param.pd_message_type = type; - ecore_pipe_write(g_player_pipe, &extra_data, sizeof(mp_player_cb_extra_data)); + ecore_pipe_write(g_player_pipe, &extra_data, + sizeof(mp_player_cb_extra_data)); } int -mp_player_mgr_set_progressive_download(const char *path, player_pd_message_cb callback, void *user_data) +mp_player_mgr_set_progressive_download(const char *path, + player_pd_message_cb callback, + void *user_data) { startfunc; @@ -1359,13 +1438,19 @@ mp_player_mgr_set_progressive_download(const char *path, player_pd_message_cb ca if (callback) { MP_CHECK_VAL(g_player_cbs, -1); - err = player_set_progressive_download_message_cb(_player, _mp_player_mgr_pd_message_cb, NULL); + err = + player_set_progressive_download_message_cb(_player, + _mp_player_mgr_pd_message_cb, + NULL); if (err != PLAYER_ERROR_NONE) { - mp_error("player_set_progressive_download_path() .. [0x%x]", err); + mp_error("player_set_progressive_download_path() .. [0x%x]", + err); } g_player_cbs->pd_message_cb = callback; - g_player_cbs->user_data[MP_PLAYER_CB_TYPE_PROGRESSIVE_DOWNLOAD_MESSAGE] = user_data; + g_player_cbs-> + user_data[MP_PLAYER_CB_TYPE_PROGRESSIVE_DOWNLOAD_MESSAGE] = + user_data; } return err; diff --git a/src/core/mp-playlist-mgr.c b/src/core/mp-playlist-mgr.c index a382168..7dacc8a 100644 --- a/src/core/mp-playlist-mgr.c +++ b/src/core/mp-playlist-mgr.c @@ -23,7 +23,8 @@ #define MP_PLST_LAZY_APPENDER_TEMP_FILE "/tmp/mp_plst_lazy_appender_temp" #define MP_PLST_LAZY_APPENDER_MAX_COUNT (500) -static void _mp_playlist_mgr_reset_lazy_appender(mp_plst_mgr *playlist_mgr); +static void _mp_playlist_mgr_reset_lazy_appender(mp_plst_mgr * + playlist_mgr); #ifndef MP_SOUND_PLAYER #include "mp-setting-ctrl.h" @@ -32,7 +33,7 @@ static void _mp_playlist_mgr_reset_lazy_appender(mp_plst_mgr *playlist_mgr); void __mp_playlist_mgr_item_free(void *data) { - mp_plst_item *node = (mp_plst_item *)data; + mp_plst_item *node = (mp_plst_item *) data; MP_CHECK(node); IF_FREE(node->uri); IF_FREE(node->uid); @@ -45,16 +46,16 @@ mp_plst_mgr *mp_playlist_mgr_create(void) { startfunc; mp_plst_mgr *playlist_mgr = calloc(1, sizeof(mp_plst_mgr)); - srand((unsigned int)time(NULL)); + srand((unsigned int) time(NULL)); #ifndef MP_SOUND_PLAYER - /* __mp_playlist_mgr_remove_list(); */ + /* __mp_playlist_mgr_remove_list(); */ #endif endfunc; return playlist_mgr; } -void mp_playlist_mgr_destroy(mp_plst_mgr *playlist_mgr) +void mp_playlist_mgr_destroy(mp_plst_mgr * playlist_mgr) { startfunc; MP_CHECK(playlist_mgr); @@ -66,19 +67,19 @@ void mp_playlist_mgr_destroy(mp_plst_mgr *playlist_mgr) static int __mp_playlist_mgr_rand_position(int length, int queue_lenth) { - unsigned int seed = (unsigned int)time(NULL); + unsigned int seed = (unsigned int) time(NULL); unsigned int rand = 0; int pos = 0; if (length > 0) { rand = rand_r(&seed); - pos = rand % (length - queue_lenth + 1); + pos = rand % (length - queue_lenth + 1); } return pos; } -static void __mp_playlist_mgr_select_list(mp_plst_mgr *playlist_mgr) +static void __mp_playlist_mgr_select_list(mp_plst_mgr * playlist_mgr) { if (playlist_mgr->shuffle_state) { playlist_mgr->list = playlist_mgr->shuffle_list; @@ -88,8 +89,7 @@ static void __mp_playlist_mgr_select_list(mp_plst_mgr *playlist_mgr) } #ifndef MP_SOUND_PLAYER -void -__save_playing_list(mp_plst_mgr *playlist_mgr) +void __save_playing_list(mp_plst_mgr * playlist_mgr) { startfunc; @@ -99,13 +99,15 @@ __save_playing_list(mp_plst_mgr *playlist_mgr) int i; char *data_path = app_get_data_path(); - char nowplaying_list_data[1024] = {0}; - snprintf(nowplaying_list_data, 1024, "%s%s", data_path, MP_NOWPLAYING_LIST_DATA); + char nowplaying_list_data[1024] = { 0 }; + snprintf(nowplaying_list_data, 1024, "%s%s", data_path, + MP_NOWPLAYING_LIST_DATA); free(data_path); fp = fopen(nowplaying_list_data, "w"); if (fp == NULL) { - SECURE_ERROR("Failed to open ini files. : %s", nowplaying_list_data); + SECURE_ERROR("Failed to open ini files. : %s", + nowplaying_list_data); return; } @@ -135,8 +137,7 @@ __save_playing_list(mp_plst_mgr *playlist_mgr) endfunc; } -static Eina_Bool -_playlist_save_timer_cb(void *data) +static Eina_Bool _playlist_save_timer_cb(void *data) { mp_plst_mgr *playlist_mgr = data; @@ -152,16 +153,19 @@ _playlist_save_timer_cb(void *data) return EINA_FALSE; } -static void -__mp_playlist_mgr_save_list(mp_plst_mgr *playlist_mgr) +static void __mp_playlist_mgr_save_list(mp_plst_mgr * playlist_mgr) { if (!playlist_mgr->save_timer) { - playlist_mgr->save_timer = ecore_timer_add(0.1, _playlist_save_timer_cb, playlist_mgr); + playlist_mgr->save_timer = + ecore_timer_add(0.1, _playlist_save_timer_cb, playlist_mgr); } } #endif -static inline void _mp_playlist_mgr_item_append_common(mp_plst_mgr *playlist_mgr, mp_plst_item *node, int position) +static inline void _mp_playlist_mgr_item_append_common(mp_plst_mgr * + playlist_mgr, + mp_plst_item * node, + int position) { MP_CHECK(playlist_mgr); MP_CHECK(node); @@ -172,41 +176,50 @@ static inline void _mp_playlist_mgr_item_append_common(mp_plst_mgr *playlist_mgr if (position > g_list_length(playlist_mgr->normal_list)) { position = -1; } - /*insert to normal list*/ + /*insert to normal list */ if (position < 0) { - playlist_mgr->normal_list = g_list_append(playlist_mgr->normal_list, node); + playlist_mgr->normal_list = + g_list_append(playlist_mgr->normal_list, node); } else { - playlist_mgr->normal_list = g_list_insert(playlist_mgr->normal_list, node, position); + playlist_mgr->normal_list = + g_list_insert(playlist_mgr->normal_list, node, position); } - /*insert to shuffle list*/ - pos = __mp_playlist_mgr_rand_position(g_list_length(playlist_mgr->normal_list), 0); + /*insert to shuffle list */ + pos = + __mp_playlist_mgr_rand_position(g_list_length + (playlist_mgr->normal_list), 0); if (playlist_mgr->shuffle_state) { cur = mp_playlist_mgr_get_current(playlist_mgr); } - playlist_mgr->shuffle_list = g_list_insert(playlist_mgr->shuffle_list, node, pos); + playlist_mgr->shuffle_list = + g_list_insert(playlist_mgr->shuffle_list, node, pos); if (cur) { int index = g_list_index(playlist_mgr->list, cur); playlist_mgr->current_index = index; } - /*select list*/ + /*select list */ __mp_playlist_mgr_select_list(playlist_mgr); #ifndef MP_SOUND_PLAYER __mp_playlist_mgr_save_list(playlist_mgr); #endif } -static mp_plst_item *_mp_playlist_mgr_create_node(const char *uri, const char *uid, const char *title, const char *artist, mp_track_type type) +static mp_plst_item *_mp_playlist_mgr_create_node(const char *uri, + const char *uid, + const char *title, + const char *artist, + mp_track_type type) { MP_CHECK_NULL(uri); mp_plst_item *node = NULL; - /*create data*/ + /*create data */ node = calloc(1, sizeof(mp_plst_item)); MP_CHECK_NULL(node); @@ -219,24 +232,34 @@ static mp_plst_item *_mp_playlist_mgr_create_node(const char *uri, const char *u return node; } -mp_plst_item *mp_playlist_mgr_item_append(mp_plst_mgr *playlist_mgr, const char *uri, const char *uid, const char *title, const char *artist, mp_track_type type) +mp_plst_item *mp_playlist_mgr_item_append(mp_plst_mgr * playlist_mgr, + const char *uri, const char *uid, + const char *title, + const char *artist, + mp_track_type type) { MP_CHECK_VAL(playlist_mgr, NULL); MP_CHECK_VAL(uri, NULL); - mp_plst_item *node = _mp_playlist_mgr_create_node(uri, uid, title, artist, type); + mp_plst_item *node = + _mp_playlist_mgr_create_node(uri, uid, title, artist, type); _mp_playlist_mgr_item_append_common(playlist_mgr, node, -1); return node; } -mp_plst_item *mp_playlist_mgr_item_insert(mp_plst_mgr *playlist_mgr, const char *uri, const char *uid, const char *title, const char *artist, mp_track_type type, int index) +mp_plst_item *mp_playlist_mgr_item_insert(mp_plst_mgr * playlist_mgr, + const char *uri, const char *uid, + const char *title, + const char *artist, + mp_track_type type, int index) { MP_CHECK_NULL(playlist_mgr); MP_CHECK_NULL(uri); - mp_plst_item *node = _mp_playlist_mgr_create_node(uri, uid, title, artist, type); + mp_plst_item *node = + _mp_playlist_mgr_create_node(uri, uid, title, artist, type); _mp_playlist_mgr_item_append_common(playlist_mgr, node, index); mp_view_mgr_post_event(GET_VIEW_MGR, MP_PLAYLIST_MGR_ITEM_CHANGED); @@ -244,13 +267,15 @@ mp_plst_item *mp_playlist_mgr_item_insert(mp_plst_mgr *playlist_mgr, const char return node; } -void mp_playlist_mgr_item_set_playlist_memeber_id(mp_plst_item *item, int memeber_id) +void mp_playlist_mgr_item_set_playlist_memeber_id(mp_plst_item * item, + int memeber_id) { MP_CHECK(item); item->playlist_memeber_id = memeber_id; } -void mp_playlist_mgr_item_remove_item(mp_plst_mgr *playlist_mgr, mp_plst_item *item) +void mp_playlist_mgr_item_remove_item(mp_plst_mgr * playlist_mgr, + mp_plst_item * item) { startfunc; GList *remove; @@ -260,34 +285,42 @@ void mp_playlist_mgr_item_remove_item(mp_plst_mgr *playlist_mgr, mp_plst_item *i MP_CHECK(playlist_mgr->shuffle_list); MP_CHECK(playlist_mgr->normal_list); - /*remove from shuffle_list*/ + /*remove from shuffle_list */ remove = g_list_find(playlist_mgr->shuffle_list, item); MP_CHECK(remove); mp_plst_item *cur = mp_playlist_mgr_get_current(playlist_mgr); - playlist_mgr->shuffle_list = g_list_remove_link(playlist_mgr->shuffle_list, remove); + playlist_mgr->shuffle_list = + g_list_remove_link(playlist_mgr->shuffle_list, remove); g_list_free(remove); - /*remove from normal_list*/ + /*remove from normal_list */ remove = g_list_find(playlist_mgr->normal_list, item); MP_CHECK(remove); - playlist_mgr->normal_list = g_list_remove_link(playlist_mgr->normal_list, remove); + playlist_mgr->normal_list = + g_list_remove_link(playlist_mgr->normal_list, remove); g_list_free_full(remove, __mp_playlist_mgr_item_free); - /*select list*/ + /*select list */ __mp_playlist_mgr_select_list(playlist_mgr); if (cur && cur != item) { - playlist_mgr->current_index = g_list_index(playlist_mgr->list, cur); + playlist_mgr->current_index = + g_list_index(playlist_mgr->list, cur); } - if (playlist_mgr->current_index < 0 || playlist_mgr->current_index >= mp_playlist_mgr_count(playlist_mgr)) { + if (playlist_mgr->current_index < 0 + || playlist_mgr->current_index >= + mp_playlist_mgr_count(playlist_mgr)) { playlist_mgr->current_index = 0; } if (cur == item) { - mp_playlist_mgr_set_current(playlist_mgr, mp_playlist_mgr_get_nth(playlist_mgr, playlist_mgr->current_index)); + mp_playlist_mgr_set_current(playlist_mgr, + mp_playlist_mgr_get_nth(playlist_mgr, + playlist_mgr-> + current_index)); } #ifndef MP_SOUND_PLAYER __mp_playlist_mgr_save_list(playlist_mgr); @@ -300,7 +333,7 @@ void mp_playlist_mgr_item_remove_item(mp_plst_mgr *playlist_mgr, mp_plst_item *i endfunc; } -void mp_playlist_mgr_item_remove_deleted_item(mp_plst_mgr *playlist_mgr) +void mp_playlist_mgr_item_remove_deleted_item(mp_plst_mgr * playlist_mgr) { startfunc; MP_CHECK(playlist_mgr); @@ -324,18 +357,20 @@ void mp_playlist_mgr_item_remove_deleted_item(mp_plst_mgr *playlist_mgr) } -void mp_playlist_mgr_item_remove_nth(mp_plst_mgr *playlist_mgr, int index) +void mp_playlist_mgr_item_remove_nth(mp_plst_mgr * playlist_mgr, int index) { startfunc; MP_CHECK(playlist_mgr); MP_CHECK(playlist_mgr->list); - mp_playlist_mgr_item_remove_item(playlist_mgr, mp_playlist_mgr_get_nth(playlist_mgr, index)); + mp_playlist_mgr_item_remove_item(playlist_mgr, + mp_playlist_mgr_get_nth(playlist_mgr, + index)); mp_view_mgr_post_event(GET_VIEW_MGR, MP_PLAYLIST_MGR_ITEM_CHANGED); endfunc; } -void mp_playlist_mgr_clear(mp_plst_mgr *playlist_mgr) +void mp_playlist_mgr_clear(mp_plst_mgr * playlist_mgr) { startfunc; MP_CHECK(playlist_mgr); @@ -343,7 +378,8 @@ void mp_playlist_mgr_clear(mp_plst_mgr *playlist_mgr) mp_playlist_mgr_set_playlist_id(playlist_mgr, 0); if (playlist_mgr->normal_list) { - g_list_free_full(playlist_mgr->normal_list, __mp_playlist_mgr_item_free); + g_list_free_full(playlist_mgr->normal_list, + __mp_playlist_mgr_item_free); } if (playlist_mgr->shuffle_list) { g_list_free(playlist_mgr->shuffle_list); @@ -358,33 +394,35 @@ void mp_playlist_mgr_clear(mp_plst_mgr *playlist_mgr) playlist_mgr->current_index = 0; if (playlist_mgr->item_change_cb) { - playlist_mgr->item_change_cb(NULL, playlist_mgr->item_change_userdata); + playlist_mgr->item_change_cb(NULL, + playlist_mgr->item_change_userdata); } if (playlist_mgr->lazy_appender) { _mp_playlist_mgr_reset_lazy_appender(playlist_mgr); } - #ifndef MP_SOUND_PLAYER /* __mp_playlist_mgr_remove_list(); */ #endif endfunc; } -int mp_playlist_mgr_count(mp_plst_mgr *playlist_mgr) +int mp_playlist_mgr_count(mp_plst_mgr * playlist_mgr) { MP_CHECK_VAL(playlist_mgr, 0); MP_CHECK_VAL(playlist_mgr->list, 0); return g_list_length(playlist_mgr->list); } -mp_plst_item *mp_playlist_mgr_get_current(mp_plst_mgr *playlist_mgr) +mp_plst_item *mp_playlist_mgr_get_current(mp_plst_mgr * playlist_mgr) { MP_CHECK_VAL(playlist_mgr, 0); mp_plst_item *cur = NULL; if (playlist_mgr->list) { - cur = g_list_nth_data(playlist_mgr->list, playlist_mgr->current_index); + cur = + g_list_nth_data(playlist_mgr->list, + playlist_mgr->current_index); } if (!cur) { @@ -396,19 +434,20 @@ mp_plst_item *mp_playlist_mgr_get_current(mp_plst_mgr *playlist_mgr) return cur; } -static void -__mp_playlist_list_foreach(gpointer data, gpointer user_data) +static void __mp_playlist_list_foreach(gpointer data, gpointer user_data) { int pos; mp_plst_mgr *playlist_mgr = user_data; MP_CHECK(playlist_mgr); - pos = __mp_playlist_mgr_rand_position(g_list_length(playlist_mgr->shuffle_list), 0); - playlist_mgr->shuffle_list = g_list_insert(playlist_mgr->shuffle_list, data, pos); + pos = + __mp_playlist_mgr_rand_position(g_list_length + (playlist_mgr->shuffle_list), 0); + playlist_mgr->shuffle_list = + g_list_insert(playlist_mgr->shuffle_list, data, pos); } -static void -__mp_playlist_mgr_refresh_shuffle(mp_plst_mgr *playlist_mgr) +static void __mp_playlist_mgr_refresh_shuffle(mp_plst_mgr * playlist_mgr) { DEBUG_TRACE("Shuffle list refreshed!"); MP_CHECK(playlist_mgr); @@ -416,11 +455,14 @@ __mp_playlist_mgr_refresh_shuffle(mp_plst_mgr *playlist_mgr) g_list_free(playlist_mgr->shuffle_list); playlist_mgr->shuffle_list = NULL; - g_list_foreach(playlist_mgr->normal_list, __mp_playlist_list_foreach, playlist_mgr); + g_list_foreach(playlist_mgr->normal_list, __mp_playlist_list_foreach, + playlist_mgr); playlist_mgr->list = playlist_mgr->shuffle_list; } -mp_plst_item *mp_playlist_mgr_get_next(mp_plst_mgr *playlist_mgr, Eina_Bool force, Eina_Bool refresh_shuffle) +mp_plst_item *mp_playlist_mgr_get_next(mp_plst_mgr * playlist_mgr, + Eina_Bool force, + Eina_Bool refresh_shuffle) { startfunc; MP_CHECK_VAL(playlist_mgr, NULL); @@ -451,10 +493,10 @@ mp_plst_item *mp_playlist_mgr_get_next(mp_plst_mgr *playlist_mgr, Eina_Bool forc DEBUG_TRACE("End of playlist"); index = 0; } - return (mp_plst_item *)g_list_nth_data(playlist_mgr->list, index); + return (mp_plst_item *) g_list_nth_data(playlist_mgr->list, index); } -mp_plst_item *mp_playlist_mgr_get_prev(mp_plst_mgr *playlist_mgr) +mp_plst_item *mp_playlist_mgr_get_prev(mp_plst_mgr * playlist_mgr) { startfunc; MP_CHECK_VAL(playlist_mgr, NULL); @@ -468,24 +510,28 @@ mp_plst_item *mp_playlist_mgr_get_prev(mp_plst_mgr *playlist_mgr) index = mp_playlist_mgr_count(playlist_mgr) - 1; } - return (mp_plst_item *)g_list_nth_data(playlist_mgr->list, index); + return (mp_plst_item *) g_list_nth_data(playlist_mgr->list, index); } -mp_plst_item *mp_playlist_mgr_get_nth(mp_plst_mgr *playlist_mgr, int index) +mp_plst_item *mp_playlist_mgr_get_nth(mp_plst_mgr * playlist_mgr, + int index) { MP_CHECK_VAL(playlist_mgr, NULL); MP_CHECK_VAL(playlist_mgr->list, NULL); - return (mp_plst_item *)g_list_nth_data(playlist_mgr->list, index); + return (mp_plst_item *) g_list_nth_data(playlist_mgr->list, index); } -mp_plst_item *mp_playlist_mgr_normal_list_get_nth(mp_plst_mgr *playlist_mgr, int index) +mp_plst_item *mp_playlist_mgr_normal_list_get_nth(mp_plst_mgr * + playlist_mgr, int index) { MP_CHECK_VAL(playlist_mgr, NULL); MP_CHECK_VAL(playlist_mgr->normal_list, NULL); - return (mp_plst_item *)g_list_nth_data(playlist_mgr->normal_list, index); + return (mp_plst_item *) g_list_nth_data(playlist_mgr->normal_list, + index); } -mp_plst_item *mp_playlist_mgr_get_item_by_uid(mp_plst_mgr *playlist_mgr, const char *uid) +mp_plst_item *mp_playlist_mgr_get_item_by_uid(mp_plst_mgr * playlist_mgr, + const char *uid) { MP_CHECK_VAL(playlist_mgr, NULL); MP_CHECK_VAL(playlist_mgr->list, NULL); @@ -505,7 +551,10 @@ mp_plst_item *mp_playlist_mgr_get_item_by_uid(mp_plst_mgr *playlist_mgr, const c return NULL; } -mp_plst_item *mp_playlist_mgr_get_item_by_playlist_memeber_id(mp_plst_mgr *playlist_mgr, int member_id) +mp_plst_item *mp_playlist_mgr_get_item_by_playlist_memeber_id(mp_plst_mgr * + playlist_mgr, + int + member_id) { MP_CHECK_VAL(playlist_mgr, NULL); MP_CHECK_VAL(playlist_mgr->list, NULL); @@ -525,7 +574,8 @@ mp_plst_item *mp_playlist_mgr_get_item_by_playlist_memeber_id(mp_plst_mgr *playl return NULL; } -void mp_playlist_mgr_set_shuffle_first_item(mp_plst_mgr *playlist_mgr, mp_plst_item *first) +void mp_playlist_mgr_set_shuffle_first_item(mp_plst_mgr * playlist_mgr, + mp_plst_item * first) { MP_CHECK(playlist_mgr); MP_CHECK(playlist_mgr->shuffle_list); @@ -535,13 +585,16 @@ void mp_playlist_mgr_set_shuffle_first_item(mp_plst_mgr *playlist_mgr, mp_plst_i MP_CHECK(node); void *data = node->data; - playlist_mgr->shuffle_list = g_list_delete_link(playlist_mgr->shuffle_list, node); - playlist_mgr->shuffle_list = g_list_prepend(playlist_mgr->shuffle_list, data); + playlist_mgr->shuffle_list = + g_list_delete_link(playlist_mgr->shuffle_list, node); + playlist_mgr->shuffle_list = + g_list_prepend(playlist_mgr->shuffle_list, data); __mp_playlist_mgr_select_list(playlist_mgr); } -void mp_playlist_mgr_set_current(mp_plst_mgr *playlist_mgr, mp_plst_item *cur) +void mp_playlist_mgr_set_current(mp_plst_mgr * playlist_mgr, + mp_plst_item * cur) { MP_CHECK(playlist_mgr); MP_CHECK(playlist_mgr->list); @@ -552,7 +605,7 @@ void mp_playlist_mgr_set_current(mp_plst_mgr *playlist_mgr, mp_plst_item *cur) cur = mp_playlist_mgr_get_nth(playlist_mgr, 0); } MP_CHECK(cur); - /*set current*/ + /*set current */ index = g_list_index(playlist_mgr->list, cur); if (index < 0) { WARN_TRACE("No such item!! cur: %x", cur); @@ -560,17 +613,20 @@ void mp_playlist_mgr_set_current(mp_plst_mgr *playlist_mgr, mp_plst_item *cur) } playlist_mgr->current_index = index; - DEBUG_TRACE("cur: %s, index: %d", cur->uri, playlist_mgr->current_index); + DEBUG_TRACE("cur: %s, index: %d", cur->uri, + playlist_mgr->current_index); -finish: + finish: if (playlist_mgr->item_change_cb) { - playlist_mgr->item_change_cb(cur, playlist_mgr->item_change_userdata); + playlist_mgr->item_change_cb(cur, + playlist_mgr->item_change_userdata); } return; } -void mp_playlist_mgr_set_shuffle(mp_plst_mgr *playlist_mgr, Eina_Bool shuffle) +void mp_playlist_mgr_set_shuffle(mp_plst_mgr * playlist_mgr, + Eina_Bool shuffle) { DEBUG_TRACE("Shuffle: %d", shuffle); MP_CHECK(playlist_mgr); @@ -589,26 +645,27 @@ void mp_playlist_mgr_set_shuffle(mp_plst_mgr *playlist_mgr, Eina_Bool shuffle) endfunc; } -bool mp_playlist_mgr_get_shuffle(mp_plst_mgr *playlist_mgr) +bool mp_playlist_mgr_get_shuffle(mp_plst_mgr * playlist_mgr) { MP_CHECK_FALSE(playlist_mgr); return playlist_mgr->shuffle_state; } -Eina_Bool mp_playlist_mgr_is_shuffle(mp_plst_mgr *playlist_mgr) +Eina_Bool mp_playlist_mgr_is_shuffle(mp_plst_mgr * playlist_mgr) { MP_CHECK_VAL(playlist_mgr, 0); return playlist_mgr->shuffle_state; } -void mp_playlist_mgr_set_repeat(mp_plst_mgr *playlist_mgr, mp_plst_repeat_state repeat) +void mp_playlist_mgr_set_repeat(mp_plst_mgr * playlist_mgr, + mp_plst_repeat_state repeat) { DEBUG_TRACE("repeat: %d", repeat); MP_CHECK(playlist_mgr); playlist_mgr->repeat_state = repeat; } -int mp_playlist_mgr_get_repeat(mp_plst_mgr *playlist_mgr) +int mp_playlist_mgr_get_repeat(mp_plst_mgr * playlist_mgr) { startfunc; MP_CHECK_VAL(playlist_mgr, 0); @@ -617,7 +674,9 @@ int mp_playlist_mgr_get_repeat(mp_plst_mgr *playlist_mgr) endfunc; } -int mp_playlist_mgr_set_item_change_callback(mp_plst_mgr *playlist_mgr, mp_playlist_item_change_callback cb, void *userdata) +int mp_playlist_mgr_set_item_change_callback(mp_plst_mgr * playlist_mgr, + mp_playlist_item_change_callback + cb, void *userdata) { MP_CHECK_VAL(playlist_mgr, 0); @@ -627,20 +686,22 @@ int mp_playlist_mgr_set_item_change_callback(mp_plst_mgr *playlist_mgr, mp_playl return 0; } -void mp_playlist_mgr_set_list_type(mp_plst_mgr *playlist_mgr, mp_plst_type type) +void mp_playlist_mgr_set_list_type(mp_plst_mgr * playlist_mgr, + mp_plst_type type) { MP_CHECK(playlist_mgr); playlist_mgr->list_type = type; } -mp_plst_type mp_playlist_mgr_get_list_type(mp_plst_mgr *playlist_mgr) +mp_plst_type mp_playlist_mgr_get_list_type(mp_plst_mgr * playlist_mgr) { MP_CHECK_VAL(playlist_mgr, MP_PLST_TYPE_NONE); return playlist_mgr->list_type; } -void mp_playlist_mgr_item_reorder(mp_plst_mgr *playlist_mgr, mp_plst_item *item, int new_index) +void mp_playlist_mgr_item_reorder(mp_plst_mgr * playlist_mgr, + mp_plst_item * item, int new_index) { MP_CHECK(playlist_mgr); MP_CHECK(item); @@ -652,10 +713,12 @@ void mp_playlist_mgr_item_reorder(mp_plst_mgr *playlist_mgr, mp_plst_item *item, GList *target = g_list_find(playlist_mgr->list, item); MP_CHECK(target); playlist_mgr->list = g_list_delete_link(playlist_mgr->list, target); - playlist_mgr->list = g_list_insert(playlist_mgr->list, item, new_index); + playlist_mgr->list = + g_list_insert(playlist_mgr->list, item, new_index); if (current) { - playlist_mgr->current_index = g_list_index(playlist_mgr->list, current); + playlist_mgr->current_index = + g_list_index(playlist_mgr->list, current); } if (playlist_mgr->shuffle_state) { @@ -665,7 +728,9 @@ void mp_playlist_mgr_item_reorder(mp_plst_mgr *playlist_mgr, mp_plst_item *item, } } -void mp_playlist_mgr_check_existance_and_refresh(mp_plst_mgr *playlist_mgr, bool *current_removed) +void mp_playlist_mgr_check_existance_and_refresh(mp_plst_mgr * + playlist_mgr, + bool * current_removed) { MP_CHECK(playlist_mgr); MP_CHECK(playlist_mgr->normal_list); @@ -684,7 +749,9 @@ void mp_playlist_mgr_check_existance_and_refresh(mp_plst_mgr *playlist_mgr, bool SECURE_DEBUG("uri = %s", item->uri); char *temp_uri = g_strdup(item->uri); mp_to_lower(temp_uri); - if (!mp_file_exists(item->uri) || (temp_uri && mmc_removed && strstr(temp_uri, "sdcard") == item->uri)) { + if (!mp_file_exists(item->uri) + || (temp_uri && mmc_removed + && strstr(temp_uri, "sdcard") == item->uri)) { SECURE_DEBUG("removed uri = %s", item->uri); mp_playlist_mgr_item_remove_item(playlist_mgr, item); if (current_removed && cur == item) { @@ -706,19 +773,21 @@ void mp_playlist_mgr_check_existance_and_refresh(mp_plst_mgr *playlist_mgr, bool mp_view_mgr_post_event(GET_VIEW_MGR, MP_PLAYLIST_MGR_ITEM_CHANGED); } -void mp_playlist_mgr_set_playlist_id(mp_plst_mgr *playlist_mgr, int playlist_id) +void mp_playlist_mgr_set_playlist_id(mp_plst_mgr * playlist_mgr, + int playlist_id) { MP_CHECK(playlist_mgr); playlist_mgr->playlist_id = playlist_id; } -int mp_playlist_mgr_get_playlist_id(mp_plst_mgr *playlist_mgr) +int mp_playlist_mgr_get_playlist_id(mp_plst_mgr * playlist_mgr) { MP_CHECK_VAL(playlist_mgr, 0); return playlist_mgr->playlist_id; } -static void _mp_playlist_mgr_reset_lazy_appender(mp_plst_mgr *playlist_mgr) +static void _mp_playlist_mgr_reset_lazy_appender(mp_plst_mgr * + playlist_mgr) { MP_CHECK(playlist_mgr); MP_CHECK(playlist_mgr->lazy_appender); @@ -752,7 +821,7 @@ static Eina_Bool _mp_playlist_mgr_lazy_appender_timer_cb(void *data) int added = 0; char line[MAX_NAM_LEN + 1]; -START: + START: while (fgets(line, MAX_NAM_LEN, appender->fp)) { /* artist */ if (!fgets(line, MAX_NAM_LEN, appender->fp)) { @@ -768,7 +837,9 @@ START: } if (mp_check_file_exist(line)) { - mp_plst_item *item = mp_playlist_mgr_item_append(playlist_mgr, line, NULL, NULL, NULL, MP_TRACK_URI); + mp_plst_item *item = + mp_playlist_mgr_item_append(playlist_mgr, line, NULL, NULL, + NULL, MP_TRACK_URI); if (item) { ++added; } @@ -800,13 +871,19 @@ START: return ECORE_CALLBACK_DONE; } -mp_plst_item *mp_playlist_mgr_lazy_append_with_file(mp_plst_mgr *playlist_mgr, const char *list_file, const char *cur_file_path, int start_index) +mp_plst_item *mp_playlist_mgr_lazy_append_with_file(mp_plst_mgr * + playlist_mgr, + const char *list_file, + const char + *cur_file_path, + int start_index) { startfunc; MP_CHECK_NULL(playlist_mgr); MP_CHECK_NULL(list_file); - DEBUG_TRACE("cur_file_path[%s] start_index[%d]", cur_file_path, start_index); + DEBUG_TRACE("cur_file_path[%s] start_index[%d]", cur_file_path, + start_index); mp_plst_item *cur_item = NULL; @@ -828,8 +905,8 @@ mp_plst_item *mp_playlist_mgr_lazy_append_with_file(mp_plst_mgr *playlist_mgr, c int skip_count = 0; int add_remained = 0; -START: - while (fgets(line, MAX_NAM_LEN, fp)) { /*title */ + START: + while (fgets(line, MAX_NAM_LEN, fp)) { /*title */ /*artist */ if (!fgets(line, MAX_NAM_LEN, fp)) { break; @@ -844,21 +921,23 @@ START: } /* find first index */ - if (index_of_first == -1 && /*first track not found */ - (g_strcmp0(cur_file_path, line)) && start_index != index) { + if (index_of_first == -1 && /*first track not found */ + (g_strcmp0(cur_file_path, line)) && start_index != index) { skip_count++; } else if (index_of_first < 0) { DEBUG_TRACE("Find first track: %d", index); - index_of_first = index; /*set first index if first index not found */ + index_of_first = index; /*set first index if first index not found */ } index++; if (index_of_first < 0) { - continue; /* continue to find first */ + continue; /* continue to find first */ } /* append item */ if (mp_check_file_exist(line)) { - mp_plst_item *item = mp_playlist_mgr_item_append(playlist_mgr, line, NULL, NULL, NULL, MP_TRACK_URI); + mp_plst_item *item = + mp_playlist_mgr_item_append(playlist_mgr, line, NULL, + NULL, NULL, MP_TRACK_URI); ++added; if (!cur_item) { cur_item = item; @@ -876,13 +955,18 @@ START: /* create lazy appender */ if (added >= MP_PLST_LAZY_APPENDER_MAX_COUNT) { WARN_TRACE("lazy appender started"); - playlist_mgr->lazy_appender = calloc(1, sizeof(mp_plst_lazy_appender_s)); - playlist_mgr->lazy_appender->index_of_first = index_of_first; + playlist_mgr->lazy_appender = + calloc(1, sizeof(mp_plst_lazy_appender_s)); + playlist_mgr->lazy_appender->index_of_first = + index_of_first; playlist_mgr->lazy_appender->cur_index = index; playlist_mgr->lazy_appender->skip_count = skip_count; playlist_mgr->lazy_appender->fp = fp; playlist_mgr->lazy_appender->add_remained = add_remained; - playlist_mgr->lazy_appender->timer = ecore_timer_add(0.5, _mp_playlist_mgr_lazy_appender_timer_cb, playlist_mgr); + playlist_mgr->lazy_appender->timer = + ecore_timer_add(0.5, + _mp_playlist_mgr_lazy_appender_timer_cb, + playlist_mgr); goto END; } @@ -890,9 +974,9 @@ START: /* append remained items */ if (skip_count > 0) { - index = 0; /* reset index; */ - add_remained = 1; /* append remaining mode */ - index_of_first = 0; /* set first index as 0 */ + index = 0; /* reset index; */ + add_remained = 1; /* append remaining mode */ + index_of_first = 0; /* set first index as 0 */ fseek(fp, SEEK_SET, 0); goto START; } @@ -904,7 +988,7 @@ START: mp_file_remove(MP_PLST_LAZY_APPENDER_TEMP_FILE); endfunc; -END: + END: mp_playlist_mgr_set_current(playlist_mgr, cur_item); return cur_item; } @@ -913,35 +997,35 @@ mp_plst_item *mp_playlist_mgr_custom_item_new(const char *uri) { MP_CHECK_NULL(uri); - mp_plst_item *item = _mp_playlist_mgr_create_node(uri, NULL, NULL, NULL, MP_TRACK_URI); + mp_plst_item *item = + _mp_playlist_mgr_create_node(uri, NULL, NULL, NULL, MP_TRACK_URI); MP_CHECK_NULL(item); item->out_of_list = true; return item; } -void mp_playlist_mgr_custom_item_free(mp_plst_item *item) +void mp_playlist_mgr_custom_item_free(mp_plst_item * item) { MP_CHECK(item); if (!item->out_of_list) { WARN_TRACE("This item is NOT custom item"); mp_assert(1); - return ; + return; } __mp_playlist_mgr_item_free(item); } -int mp_playlist_mgr_get_index(mp_plst_mgr *playlist_mgr) +int mp_playlist_mgr_get_index(mp_plst_mgr * playlist_mgr) { MP_CHECK_VAL(playlist_mgr, 0); return playlist_mgr->current_index; } -int mp_playlist_mgr_get_normal_index(mp_plst_mgr *playlist_mgr) +int mp_playlist_mgr_get_normal_index(mp_plst_mgr * playlist_mgr) { MP_CHECK_VAL(playlist_mgr, 0); mp_plst_item *item = mp_playlist_mgr_get_current(playlist_mgr); return g_list_index(playlist_mgr->normal_list, item); } - diff --git a/src/core/mp-setting-ctrl.c b/src/core/mp-setting-ctrl.c index e86545e..8a50d78 100644 --- a/src/core/mp-setting-ctrl.c +++ b/src/core/mp-setting-ctrl.c @@ -122,16 +122,15 @@ _mp_setting_play_speed_changed_cb(const char *key, void *user_data) } #endif -static void -_mp_setting_lyric_changed_cb(const char *key, void *user_data) +static void _mp_setting_lyric_changed_cb(const char *key, void *user_data) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); - bool show_lyrics = (bool)(ad->b_show_lyric); + bool show_lyrics = (bool) (ad->b_show_lyric); if (preference_get_boolean(KEY_MUSIC_LYRICS, &show_lyrics)) { ERROR_TRACE("Fail to get %s", KEY_MUSIC_LYRICS); } - ad->b_show_lyric = (int)(ad->b_show_lyric); + ad->b_show_lyric = (int) (ad->b_show_lyric); } /*static void @@ -157,8 +156,7 @@ _mp_setting_shuffle_changed_cb(const char *key, void *user_data) mp_player_view_update_state(GET_PLAYER_VIEW); } -static void -_mp_setting_repeat_changed_cb(const char *key, void *user_data) +static void _mp_setting_repeat_changed_cb(const char *key, void *user_data) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); @@ -170,42 +168,55 @@ _mp_setting_repeat_changed_cb(const char *key, void *user_data) mp_player_view_update_state(GET_PLAYER_VIEW); } -static int -mp_setting_key_cb_init(void) +static int mp_setting_key_cb_init(void) { int ret = 0; - mp_retvm_if(g_setting == NULL, -1, "setting data is not initialized, init first!!!!!"); + mp_retvm_if(g_setting == NULL, -1, + "setting data is not initialized, init first!!!!!"); - if (preference_set_changed_cb(MP_PREFKEY_PLAYLIST_VAL_INT, _mp_setting_playlist_changed_cb, g_setting) < 0) { - ERROR_TRACE("Fail to register MP_PREFKEY_PLAYLIST_VAL_INT key callback"); + if (preference_set_changed_cb + (MP_PREFKEY_PLAYLIST_VAL_INT, _mp_setting_playlist_changed_cb, + g_setting) < 0) { + ERROR_TRACE + ("Fail to register MP_PREFKEY_PLAYLIST_VAL_INT key callback"); ret = -1; } - if (preference_set_changed_cb(MP_KEY_MUSIC_SHUFFLE, _mp_setting_shuffle_changed_cb, g_setting) < 0) { + if (preference_set_changed_cb + (MP_KEY_MUSIC_SHUFFLE, _mp_setting_shuffle_changed_cb, + g_setting) < 0) { ERROR_TRACE("Fail to register MP_KEY_MUSIC_SHUFFLE key callback"); ret = -1; } - if (preference_set_changed_cb(MP_KEY_MUSIC_REPEAT, _mp_setting_repeat_changed_cb, g_setting) < 0) { + if (preference_set_changed_cb + (MP_KEY_MUSIC_REPEAT, _mp_setting_repeat_changed_cb, + g_setting) < 0) { ERROR_TRACE("Fail to register MP_KEY_MUSIC_REPEAT key callback"); ret = -1; } - #ifdef MP_FEATURE_AUTO_OFF - if (preference_set_changed_cb(KEY_MUSIC_AUTO_OFF_TIME_VAL, _mp_setting_auto_off_changed_cb, g_setting) < 0) { - ERROR_TRACE("Fail to register KEY_MUSIC_AUTO_OFF_TIME_VAL key callback"); + if (preference_set_changed_cb + (KEY_MUSIC_AUTO_OFF_TIME_VAL, _mp_setting_auto_off_changed_cb, + g_setting) < 0) { + ERROR_TRACE + ("Fail to register KEY_MUSIC_AUTO_OFF_TIME_VAL key callback"); ret = -1; } #endif #ifdef MP_FEATURE_PLAY_SPEED - if (preference_set_changed_cb(PREFKEY_MUSIC_PLAY_SPEED, _mp_setting_play_speed_changed_cb, g_setting) < 0) { - ERROR_TRACE("Fail to register PREFKEY_MUSIC_PLAY_SPEED key callback"); + if (preference_set_changed_cb + (PREFKEY_MUSIC_PLAY_SPEED, _mp_setting_play_speed_changed_cb, + g_setting) < 0) { + ERROR_TRACE + ("Fail to register PREFKEY_MUSIC_PLAY_SPEED key callback"); ret = -1; } #endif - if (preference_set_changed_cb(KEY_MUSIC_LYRICS, _mp_setting_lyric_changed_cb, g_setting) < 0) { + if (preference_set_changed_cb + (KEY_MUSIC_LYRICS, _mp_setting_lyric_changed_cb, g_setting) < 0) { ERROR_TRACE("Fail to register KEY_MUSIC_LYRICS key callback"); ret = -1; } @@ -213,8 +224,7 @@ mp_setting_key_cb_init(void) return ret; } -static void -mp_setting_key_cb_deinit(void) +static void mp_setting_key_cb_deinit(void) { preference_unset_changed_cb(MP_PREFKEY_PLAYLIST_VAL_INT); #ifdef MP_FEATURE_AUTO_OFF @@ -224,7 +234,9 @@ mp_setting_key_cb_deinit(void) #ifdef MP_FEATURE_PLAY_SPEED int retcode = preference_unset_changed_cb(PREFKEY_MUSIC_PLAY_SPEED); if (retcode != PREFERENCE_ERROR_NONE) { - ERROR_TRACE("Unable to unset key assigned for speed play in Music Player [%d]", retcode); + ERROR_TRACE + ("Unable to unset key assigned for speed play in Music Player [%d]", + retcode); } #endif return; @@ -388,19 +400,18 @@ static void _mp_setting_init_preference_key(void) } -static Eina_Bool -_mp_setting_init_idler_cb(void *data) +static Eina_Bool _mp_setting_init_idler_cb(void *data) { startfunc; TIMER_TRACE(); - struct appdata *ad = (struct appdata *)data; + struct appdata *ad = (struct appdata *) data; MP_CHECK_FALSE(ad); - bool show_lyric = (bool)(ad->b_show_lyric); + bool show_lyric = (bool) (ad->b_show_lyric); if (preference_get_boolean(KEY_MUSIC_LYRICS, &show_lyric)) { WARN_TRACE("Fail to get %s", KEY_MUSIC_LYRICS); } - ad->b_show_lyric = (int)show_lyric; + ad->b_show_lyric = (int) show_lyric; _mp_setting_init_preference_key(); mp_setting_key_cb_init(); @@ -419,8 +430,7 @@ _mp_setting_init_idler_cb(void *data) return EINA_FALSE; } -int -mp_setting_init(struct appdata *ad) +int mp_setting_init(struct appdata *ad) { int ret = 0; MP_CHECK_VAL(!g_setting, -1); @@ -432,7 +442,7 @@ mp_setting_init(struct appdata *ad) memset(g_setting, 0x00, sizeof(mp_setting_t)); /*if (!ad->setting_idler) - ad->setting_idler = ecore_idler_add(_mp_setting_init_idler_cb, ad); */ + ad->setting_idler = ecore_idler_add(_mp_setting_init_idler_cb, ad); */ _mp_setting_init_idler_cb(ad); @@ -440,8 +450,7 @@ mp_setting_init(struct appdata *ad) } -int -mp_setting_deinit(struct appdata *ad) +int mp_setting_deinit(struct appdata *ad) { mp_ecore_idler_del(ad->setting_idler); mp_setting_key_cb_deinit(); @@ -454,13 +463,12 @@ mp_setting_deinit(struct appdata *ad) return 0; } -void -mp_setting_set_nowplaying_id(int val) +void mp_setting_set_nowplaying_id(int val) { startfunc; char *path = app_get_data_path(); - char now_playing_id[1024] = {0}; + char now_playing_id[1024] = { 0 }; snprintf(now_playing_id, 1024, "%s%s", path, MP_NOW_PLAYING_ID_INI); free(path); @@ -474,14 +482,13 @@ mp_setting_set_nowplaying_id(int val) fprintf(fp, "#Nowplaying\n"); fprintf(fp, "%d\n", val); - fsync((int)fp); + fsync((int) fp); fclose(fp); return; } -int -mp_setting_get_nowplaying_id(void) +int mp_setting_get_nowplaying_id(void) { startfunc; @@ -489,7 +496,7 @@ mp_setting_get_nowplaying_id(void) char line[MAX_NAM_LEN + 1]; int pid = -1; char *path = app_get_data_path(); - char now_playing_id[1024] = {0}; + char now_playing_id[1024] = { 0 }; snprintf(now_playing_id, 1024, "%s%s", path, MP_NOW_PLAYING_ID_INI); free(path); @@ -497,10 +504,10 @@ mp_setting_get_nowplaying_id(void) DEBUG_TRACE("unable to open %s", now_playing_id); return -1; } - if (fgets(line, MAX_NAM_LEN, fp)) { /* #Nowplaying */ + if (fgets(line, MAX_NAM_LEN, fp)) { /* #Nowplaying */ /* skip */ } - if (fgets(line, MAX_NAM_LEN, fp)) { /* pid */ + if (fgets(line, MAX_NAM_LEN, fp)) { /* pid */ line[MAX_NAM_LEN] = 0; line[strlen(line) - 1] = 0; pid = atoi(line); @@ -510,8 +517,7 @@ mp_setting_get_nowplaying_id(void) return pid; } -void -mp_setting_set_player_state(int val) +void mp_setting_set_player_state(int val) { startfunc; struct appdata *ad = mp_util_get_appdata(); @@ -528,7 +534,7 @@ mp_setting_set_player_state(int val) } char *path = app_get_data_path(); - char play_state[1024] = {0}; + char play_state[1024] = { 0 }; snprintf(play_state, 1024, "%s%s", path, MP_PLAY_STATE); free(path); FILE *fp = fopen(play_state, "w"); /* make new file. */ @@ -551,14 +557,13 @@ mp_setting_set_player_state(int val) } fprintf(fp, "%s\n", state); - fsync((int)fp); + fsync((int) fp); fclose(fp); return; } -int -mp_setting_set_shuffle_state(int b_val) +int mp_setting_set_shuffle_state(int b_val) { if (preference_set_boolean(MP_KEY_MUSIC_SHUFFLE, b_val)) { WARN_TRACE("Fail to set MP_KEY_MUSIC_SHUFFLE"); @@ -568,10 +573,9 @@ mp_setting_set_shuffle_state(int b_val) return 0; } -int -mp_setting_get_shuffle_state(int *b_val) +int mp_setting_get_shuffle_state(int *b_val) { - if (preference_get_boolean(MP_KEY_MUSIC_SHUFFLE, (bool *)b_val)) { + if (preference_get_boolean(MP_KEY_MUSIC_SHUFFLE, (bool *) b_val)) { WARN_TRACE("Fail to get MP_KEY_MUSIC_SHUFFLE"); if (preference_set_boolean(MP_KEY_MUSIC_SHUFFLE, FALSE)) { @@ -583,8 +587,7 @@ mp_setting_get_shuffle_state(int *b_val) return 0; } -int -mp_setting_set_repeat_state(int val) +int mp_setting_set_repeat_state(int val) { if (preference_set_int(MP_KEY_MUSIC_REPEAT, val)) { ERROR_TRACE("Fail to set MP_KEY_MUSIC_REPEAT"); @@ -594,8 +597,7 @@ mp_setting_set_repeat_state(int val) return 0; } -int -mp_setting_get_repeat_state(int *val) +int mp_setting_get_repeat_state(int *val) { if (preference_get_int(MP_KEY_MUSIC_REPEAT, val)) { WARN_TRACE("Fail to get MP_KEY_MUSIC_REPEAT"); @@ -616,8 +618,7 @@ int mp_setting_playlist_get_state(int *state) } /* This fuction save current track data for homescreen. */ -void -mp_setting_save_playing_info(void *data) +void mp_setting_save_playing_info(void *data) { struct appdata *ad = data; FILE *fp = NULL; @@ -631,15 +632,17 @@ mp_setting_save_playing_info(void *data) MP_CHECK(ad->current_track_info); char *data_path = app_get_data_path(); - char playing_ini[1024] = {0}; + char playing_ini[1024] = { 0 }; #ifndef MP_SOUND_PLAYER - snprintf(playing_ini, 1024, "%s%s", data_path, MP_PLAYING_INI_FILE_NAME_MUSIC); + snprintf(playing_ini, 1024, "%s%s", data_path, + MP_PLAYING_INI_FILE_NAME_MUSIC); free(data_path); - fp = fopen(playing_ini, "w"); /* make new file. */ + fp = fopen(playing_ini, "w"); /* make new file. */ #else - snprintf(playing_ini, 1024, "%s%s", data_path, MP_PLAYING_INI_FILE_NAME_SOUND); + snprintf(playing_ini, 1024, "%s%s", data_path, + MP_PLAYING_INI_FILE_NAME_SOUND); free(data_path); - fp = fopen(playing_ini, "w"); /* make new file. */ + fp = fopen(playing_ini, "w"); /* make new file. */ #endif if (fp == NULL) { @@ -653,19 +656,19 @@ mp_setting_save_playing_info(void *data) char total_time[16] = { 0, }; - char position[16] = {0,}; + char position[16] = { 0, }; char *playing = "false"; if (ad->music_length > 3600.) { snprintf(total_time, sizeof(total_time), "%" MUSIC_TIME_FORMAT, - MUSIC_TIME_ARGS(ad->music_length + 0.5)); + MUSIC_TIME_ARGS(ad->music_length + 0.5)); snprintf(position, sizeof(position), "%" MUSIC_TIME_FORMAT, - MUSIC_TIME_ARGS(ad->music_pos + 0.5)); + MUSIC_TIME_ARGS(ad->music_pos + 0.5)); } else { snprintf(total_time, sizeof(total_time), "%" PLAY_TIME_FORMAT, - PLAY_TIME_ARGS(ad->music_length + 0.5)); + PLAY_TIME_ARGS(ad->music_length + 0.5)); snprintf(position, sizeof(position), "%" PLAY_TIME_FORMAT, - PLAY_TIME_ARGS(ad->music_pos + 0.5)); + PLAY_TIME_ARGS(ad->music_pos + 0.5)); } if (mp_player_mgr_get_state() == PLAYER_STATE_PLAYING) { @@ -684,16 +687,16 @@ mp_setting_save_playing_info(void *data) } -void -mp_setting_remove_now_playing_shared_status(void) +void mp_setting_remove_now_playing_shared_status(void) { startfunc; char *path = app_get_data_path(); - char playing_status[1024] = {0}; + char playing_status[1024] = { 0 }; if (path == NULL) { return; } - snprintf(playing_status, 1024, "%s%s", path, MP_SHARED_PLAYING_STATUS_INI); + snprintf(playing_status, 1024, "%s%s", path, + MP_SHARED_PLAYING_STATUS_INI); free(path); FILE *fp = fopen(playing_status, "w"); /* make new file. */ @@ -709,15 +712,15 @@ mp_setting_remove_now_playing_shared_status(void) endfunc; } -void -mp_setting_remove_now_playing(void) +void mp_setting_remove_now_playing(void) { startfunc; FILE *fp = NULL; char *data_path = app_get_data_path(); - char nowplaying_ini[1024] = {0}; - snprintf(nowplaying_ini, 1024, "%s%s", data_path, MP_NOWPLAYING_INI_FILE_NAME); + char nowplaying_ini[1024] = { 0 }; + snprintf(nowplaying_ini, 1024, "%s%s", data_path, + MP_NOWPLAYING_INI_FILE_NAME); free(data_path); fp = fopen(nowplaying_ini, "w"); /* make new file. */ @@ -732,8 +735,7 @@ mp_setting_remove_now_playing(void) endfunc; } -void -mp_setting_get_now_playing_path_from_file(char **path) +void mp_setting_get_now_playing_path_from_file(char **path) { MP_CHECK(path); @@ -741,20 +743,20 @@ mp_setting_get_now_playing_path_from_file(char **path) FILE *fp = NULL; char *data_path = app_get_data_path(); - char nowplaying_ini[1024] = {0}; - snprintf(nowplaying_ini, 1024, "%s%s", data_path, MP_NOWPLAYING_INI_FILE_NAME); + char nowplaying_ini[1024] = { 0 }; + snprintf(nowplaying_ini, 1024, "%s%s", data_path, + MP_NOWPLAYING_INI_FILE_NAME); free(data_path); - if(access(nowplaying_ini, F_OK) != -1) - { + if (access(nowplaying_ini, F_OK) != -1) { fp = fopen(nowplaying_ini, "r"); if (!fp) { SECURE_ERROR("unable to open %s...", nowplaying_ini); return; } - if (fgets(line, MAX_NAM_LEN, fp)) { /* audio id */ + if (fgets(line, MAX_NAM_LEN, fp)) { /* audio id */ /* skip */ } - if (fgets(line, MAX_NAM_LEN, fp)) { /* uri */ + if (fgets(line, MAX_NAM_LEN, fp)) { /* uri */ line[MAX_NAM_LEN] = 0; line[strlen(line) - 1] = 0; *path = g_strdup(line); @@ -764,8 +766,7 @@ mp_setting_get_now_playing_path_from_file(char **path) } #ifndef MP_SOUND_PLAYER -void -mp_setting_save_now_playing(void *data) +void mp_setting_save_now_playing(void *data) { startfunc; struct appdata *ad = data; @@ -780,8 +781,9 @@ mp_setting_save_now_playing(void *data) MP_CHECK(ad->current_track_info); char *data_path = app_get_data_path(); - char nowplaying_ini[1024] = {0}; - snprintf(nowplaying_ini, 1024, "%s%s", data_path, MP_NOWPLAYING_INI_FILE_NAME); + char nowplaying_ini[1024] = { 0 }; + snprintf(nowplaying_ini, 1024, "%s%s", data_path, + MP_NOWPLAYING_INI_FILE_NAME); free(data_path); fp = fopen(nowplaying_ini, "w"); /* make new file. */ @@ -794,10 +796,10 @@ mp_setting_save_now_playing(void *data) char music_length[16] = { 0, }; if (ad->music_length > 3600.) { snprintf(total_time, sizeof(total_time), "%" MUSIC_TIME_FORMAT, - MUSIC_TIME_ARGS(ad->music_length)); + MUSIC_TIME_ARGS(ad->music_length)); } else { snprintf(total_time, sizeof(total_time), "%" PLAY_TIME_FORMAT, - PLAY_TIME_ARGS(ad->music_length)); + PLAY_TIME_ARGS(ad->music_length)); } snprintf(music_length, sizeof(music_length), "%f", ad->music_length); @@ -819,25 +821,31 @@ mp_setting_save_now_playing(void *data) #define MP_SHORTCUT_COUNT 4 void -mp_setting_save_shortcut(char *shortcut_title, char *artist, char *shortcut_description, char *shortcut_image_path) +mp_setting_save_shortcut(char *shortcut_title, char *artist, + char *shortcut_description, + char *shortcut_image_path) { startfunc; FILE *fp = NULL; int ret = 0; char *path = app_get_data_path(); - char shortcut_path_0[1024] = {0}; - char shortcut_path_1[1024] = {0}; - char shortcut_path_2[1024] = {0}; - char shortcut_path_3[1024] = {0}; + char shortcut_path_0[1024] = { 0 }; + char shortcut_path_1[1024] = { 0 }; + char shortcut_path_2[1024] = { 0 }; + char shortcut_path_3[1024] = { 0 }; if (path == NULL) { return; } - snprintf(shortcut_path_0, 1024, "%s%s", path, MP_SHORTCUT_INI_FILE_NAME_0); - snprintf(shortcut_path_1, 1024, "%s%s", path, MP_SHORTCUT_INI_FILE_NAME_1); - snprintf(shortcut_path_2, 1024, "%s%s", path, MP_SHORTCUT_INI_FILE_NAME_2); - snprintf(shortcut_path_3, 1024, "%s%s", path, MP_SHORTCUT_INI_FILE_NAME_3); + snprintf(shortcut_path_0, 1024, "%s%s", path, + MP_SHORTCUT_INI_FILE_NAME_0); + snprintf(shortcut_path_1, 1024, "%s%s", path, + MP_SHORTCUT_INI_FILE_NAME_1); + snprintf(shortcut_path_2, 1024, "%s%s", path, + MP_SHORTCUT_INI_FILE_NAME_2); + snprintf(shortcut_path_3, 1024, "%s%s", path, + MP_SHORTCUT_INI_FILE_NAME_3); free(path); if (mp_file_exists(shortcut_path_2)) { @@ -884,11 +892,10 @@ mp_setting_save_shortcut(char *shortcut_title, char *artist, char *shortcut_desc } #endif -int -mp_setting_read_playing_status(char *uri, char *status) +int mp_setting_read_playing_status(char *uri, char *status) { startfunc; - char str[1000] = {0,}; + char str[1000] = { 0, }; int valid_uri = 0; int valid_status = 0; char *path = app_get_data_path(); @@ -896,8 +903,9 @@ mp_setting_read_playing_status(char *uri, char *status) return -1; } DEBUG_TRACE("Data Path is: %s", path); - char playing_status[1024] = {0}; - snprintf(playing_status, 1024, "%s%s", path, MP_SHARED_PLAYING_STATUS_INI); + char playing_status[1024] = { 0 }; + snprintf(playing_status, 1024, "%s%s", path, + MP_SHARED_PLAYING_STATUS_INI); free(path); FILE *fp = fopen(playing_status, "r"); /* read MP_SHARED_PLAYING_STATUS_INI file. */ @@ -952,8 +960,7 @@ mp_setting_read_playing_status(char *uri, char *status) return 0; } -void -mp_setting_write_playing_status(char *uri, char *status) +void mp_setting_write_playing_status(char *uri, char *status) { startfunc; int count = 0; @@ -967,11 +974,12 @@ mp_setting_write_playing_status(char *uri, char *status) DEBUG_TRACE("Data Path is: %s", path); DEBUG_TRACE("Shared Resource Path is: %s", shared_path); - char playing_status[1024] = {0}; + char playing_status[1024] = { 0 }; if (path == NULL) { return; } - snprintf(playing_status, 1024, "%s%s", path, MP_SHARED_PLAYING_STATUS_INI); + snprintf(playing_status, 1024, "%s%s", path, + MP_SHARED_PLAYING_STATUS_INI); free(path); FILE *fp = fopen(playing_status, "w"); /* make new file. */ @@ -991,15 +999,18 @@ mp_setting_write_playing_status(char *uri, char *status) fprintf(fp, "artist=%s\n", ad->current_track_info->artist); fprintf(fp, "album=%s\n", ad->current_track_info->album); if (ad->current_track_info->thumbnail_path) { - fprintf(fp, "thumbnail=%s\n", ad->current_track_info->thumbnail_path); + fprintf(fp, "thumbnail=%s\n", + ad->current_track_info->thumbnail_path); } else { - fprintf(fp, "thumbnail=%sshared_images/default_albumart.png\n", shared_path); + fprintf(fp, + "thumbnail=%sshared_images/default_albumart.png\n", + shared_path); } } #endif fprintf(fp, "changePlayer=%s\n", "false"); - fsync((int)fp); + fsync((int) fp); fclose(fp); } @@ -1007,10 +1018,10 @@ mp_setting_write_playing_status(char *uri, char *status) } #ifdef MP_FEATURE_AUTO_OFF -int -mp_setting_auto_off_set_callback(MpSettingAutoOff_Cb func, void *data) +int mp_setting_auto_off_set_callback(MpSettingAutoOff_Cb func, void *data) { - mp_retvm_if(g_setting == NULL, -1, "setting data is not initialized, init first!!!!!"); + mp_retvm_if(g_setting == NULL, -1, + "setting data is not initialized, init first!!!!!"); g_setting->auto_off_cb = func; g_setting->auto_off_udata = data; @@ -1018,8 +1029,7 @@ mp_setting_auto_off_set_callback(MpSettingAutoOff_Cb func, void *data) return 0; } -void -mp_setting_reset_auto_off_time() +void mp_setting_reset_auto_off_time() { int ret = preference_set_int(KEY_MUSIC_AUTO_OFF_TIME_VAL, 0); if (ret) { @@ -1031,8 +1041,7 @@ mp_setting_reset_auto_off_time() } } -int -mp_setting_get_auto_off_time() +int mp_setting_get_auto_off_time() { int min = 0; @@ -1046,15 +1055,18 @@ mp_setting_get_auto_off_time() #endif #ifdef MP_FEATURE_PLAY_SPEED -int mp_setting_set_play_speed_change_callback(MpSettingPlaySpeed_Cb func, void *data) +int mp_setting_set_play_speed_change_callback(MpSettingPlaySpeed_Cb func, + void *data) { - mp_retvm_if(g_setting == NULL, -1, "setting data is not initialized, init first!!!!!"); + mp_retvm_if(g_setting == NULL, -1, + "setting data is not initialized, init first!!!!!"); g_setting->play_speed_cb = func; g_setting->play_speed_udata = data; return 0; } + int mp_setting_reset_play_speed(void) { int ret = preference_set_double(PREFKEY_MUSIC_PLAY_SPEED, 1.0); @@ -1071,10 +1083,10 @@ double mp_setting_get_play_speed(void) mp_error("preference_get_int()"); } - if (speed > (double)2.0) { + if (speed > (double) 2.0) { ERROR_TRACE("inavlid speed: %f", speed); speed = 2.0; - } else if (speed < (double)0.5) { + } else if (speed < (double) 0.5) { ERROR_TRACE("inavlid speed: %f", speed); speed = 0.5; } @@ -1084,8 +1096,7 @@ double mp_setting_get_play_speed(void) #endif -void -mp_setting_update_active_device() +void mp_setting_update_active_device() { } @@ -1118,7 +1129,7 @@ bool mp_setting_set_personal_dont_ask_again(bool bAsked) return TRUE; } -bool mp_setting_get_personal_dont_ask_again(bool *bAsked) +bool mp_setting_get_personal_dont_ask_again(bool * bAsked) { int err = 0; bool val = FALSE; diff --git a/src/core/mp-view-mgr.c b/src/core/mp-view-mgr.c index 55df19b..98e4f45 100644 --- a/src/core/mp-view-mgr.c +++ b/src/core/mp-view-mgr.c @@ -44,7 +44,8 @@ static void _print_view_stack() if (!view) { continue; } - WARN_TRACE("view[0x%x], depth[%d], type[%d]", view, i, view->view_type); + WARN_TRACE("view[0x%x], depth[%d], type[%d]", view, i, + view->view_type); i++; } @@ -58,8 +59,7 @@ static void _print_view_stack() static Evas_Object *g_rect; static Ecore_Timer *g_blocker_timer; -static Eina_Bool -_bloker_hide_timer(void *data) +static Eina_Bool _bloker_hide_timer(void *data) { TIMER_TRACE(); mp_evas_object_del(g_rect); @@ -67,15 +67,13 @@ _bloker_hide_timer(void *data) return EINA_FALSE; } -static void -_mp_view_mgr_hide_event_blocker(void) +static void _mp_view_mgr_hide_event_blocker(void) { mp_evas_object_del(g_rect); mp_ecore_timer_del(g_blocker_timer); } -static void -_mp_view_mgr_show_event_blocker(void) +static void _mp_view_mgr_show_event_blocker(void) { int x, y, w, h; struct appdata *ad = mp_util_get_appdata(); @@ -85,7 +83,8 @@ _mp_view_mgr_show_event_blocker(void) evas_object_geometry_get(ad->conformant, &x, &y, &w, &h); if (!g_rect) { - g_rect = evas_object_rectangle_add(evas_object_evas_get(ad->win_main)); + g_rect = + evas_object_rectangle_add(evas_object_evas_get(ad->win_main)); } evas_object_repeat_events_set(g_rect, 0); @@ -98,7 +97,8 @@ _mp_view_mgr_show_event_blocker(void) } #endif void -_mp_view_mg_transition_finish_cb(void *data, Evas_Object * obj, void *event_info) +_mp_view_mg_transition_finish_cb(void *data, Evas_Object * obj, + void *event_info) { #ifdef MP_EVENT_BLOCKER _mp_view_mgr_hide_event_blocker(); @@ -107,7 +107,8 @@ _mp_view_mg_transition_finish_cb(void *data, Evas_Object * obj, void *event_info } static void -_mp_view_mgr_win_resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +_mp_view_mgr_win_resize_cb(void *data, Evas * e, Evas_Object * obj, + void *event_info) { Evas_Object *navi = data; Evas_Coord w, h, win_w, win_h; @@ -124,14 +125,15 @@ _mp_view_mgr_win_resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_in } static void -_layout_del_cb(void *data , Evas *e, Evas_Object *obj, void *event_info) +_layout_del_cb(void *data, Evas * e, Evas_Object * obj, void *event_info) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); - evas_object_event_callback_del(ad->win_main, EVAS_CALLBACK_RESIZE, _mp_view_mgr_win_resize_cb); + evas_object_event_callback_del(ad->win_main, EVAS_CALLBACK_RESIZE, + _mp_view_mgr_win_resize_cb); } -MpViewMgr_t *mp_view_mgr_create(Evas_Object *parent) +MpViewMgr_t *mp_view_mgr_create(Evas_Object * parent) { startfunc; MP_CHECK_NULL(parent); @@ -142,21 +144,28 @@ MpViewMgr_t *mp_view_mgr_create(Evas_Object *parent) struct appdata *ad = mp_util_get_appdata(); MP_CHECK_NULL(ad); - evas_object_event_callback_add(ad->win_main, EVAS_CALLBACK_RESIZE, _mp_view_mgr_win_resize_cb, view_mgr->navi); + evas_object_event_callback_add(ad->win_main, EVAS_CALLBACK_RESIZE, + _mp_view_mgr_win_resize_cb, + view_mgr->navi); - eext_object_event_callback_add(view_mgr->navi, EEXT_CALLBACK_BACK, eext_naviframe_back_cb, NULL); - eext_object_event_callback_add(view_mgr->navi, EEXT_CALLBACK_MORE, eext_naviframe_more_cb, NULL); + eext_object_event_callback_add(view_mgr->navi, EEXT_CALLBACK_BACK, + eext_naviframe_back_cb, NULL); + eext_object_event_callback_add(view_mgr->navi, EEXT_CALLBACK_MORE, + eext_naviframe_more_cb, NULL); - evas_object_event_callback_add(view_mgr->navi, EVAS_CALLBACK_DEL, _layout_del_cb, NULL); + evas_object_event_callback_add(view_mgr->navi, EVAS_CALLBACK_DEL, + _layout_del_cb, NULL); - evas_object_smart_callback_add(view_mgr->navi , "transition,finished", _mp_view_mg_transition_finish_cb, view_mgr); + evas_object_smart_callback_add(view_mgr->navi, "transition,finished", + _mp_view_mg_transition_finish_cb, + view_mgr); /* evas_object_smart_callback_add(view_mgr->navi, "title,clicked", _title_clicked_cb, view_mgr); */ g_view_mgr = view_mgr; return view_mgr; } -int mp_view_mgr_destory(MpViewMgr_t *view_mgr) +int mp_view_mgr_destory(MpViewMgr_t * view_mgr) { startfunc; MP_CHECK_VAL(view_mgr, -1); @@ -170,7 +179,7 @@ EXPORT_API MpViewMgr_t *mp_view_mgr_get_view_manager() return g_view_mgr; } -MpView_t *mp_view_mgr_get_top_view(MpViewMgr_t *view_mgr) +MpView_t *mp_view_mgr_get_top_view(MpViewMgr_t * view_mgr) { MP_CHECK_NULL(view_mgr); Elm_Object_Item *navi_it = elm_naviframe_top_item_get(view_mgr->navi); @@ -178,7 +187,8 @@ MpView_t *mp_view_mgr_get_top_view(MpViewMgr_t *view_mgr) return elm_object_item_data_get(navi_it); } -EXPORT_API MpView_t *mp_view_mgr_get_view(MpViewMgr_t *view_mgr, MpViewType_e type) +EXPORT_API MpView_t *mp_view_mgr_get_view(MpViewMgr_t * view_mgr, + MpViewType_e type) { MpView_t *view = NULL; MP_CHECK_NULL(view_mgr); @@ -201,7 +211,8 @@ EXPORT_API MpView_t *mp_view_mgr_get_view(MpViewMgr_t *view_mgr, MpViewType_e ty return view; } -EXPORT_API MpView_t *mp_view_mgr_get_view_prev(MpViewMgr_t *view_mgr, MpViewType_e type) +EXPORT_API MpView_t *mp_view_mgr_get_view_prev(MpViewMgr_t * view_mgr, + MpViewType_e type) { MpView_t *view = NULL; MP_CHECK_NULL(view_mgr); @@ -226,7 +237,10 @@ EXPORT_API MpView_t *mp_view_mgr_get_view_prev(MpViewMgr_t *view_mgr, MpViewType return prev_view; } -EXPORT_API int mp_view_mgr_push_view_with_effect(MpViewMgr_t *view_mgr, MpView_t *view, const char *item_style, bool disable_effect) +EXPORT_API int mp_view_mgr_push_view_with_effect(MpViewMgr_t * view_mgr, + MpView_t * view, + const char *item_style, + bool disable_effect) { startfunc; MP_CHECK_VAL(view_mgr, -1); @@ -245,14 +259,21 @@ EXPORT_API int mp_view_mgr_push_view_with_effect(MpViewMgr_t *view_mgr, MpView_t elm_naviframe_prev_btn_auto_pushed_set(view_mgr->navi, EINA_FALSE); /* if (item_style == NULL) - item_style = MP_NAVI_ITEM_STYLE_TOPLINE; */ + item_style = MP_NAVI_ITEM_STYLE_TOPLINE; */ bool request_transition_effect = false; Elm_Object_Item *after = elm_naviframe_top_item_get(view_mgr->navi); if (disable_effect && after) { - navi_it = elm_naviframe_item_insert_after(view_mgr->navi, after, NULL, NULL, NULL, mp_view_get_base_obj(view), item_style); + navi_it = + elm_naviframe_item_insert_after(view_mgr->navi, after, NULL, + NULL, NULL, + mp_view_get_base_obj(view), + item_style); } else { - navi_it = elm_naviframe_item_push(view_mgr->navi, NULL, NULL, NULL, mp_view_get_base_obj(view), item_style); + navi_it = + elm_naviframe_item_push(view_mgr->navi, NULL, NULL, NULL, + mp_view_get_base_obj(view), + item_style); if (navi_it != elm_naviframe_bottom_item_get(view_mgr->navi)) { request_transition_effect = true; } @@ -284,9 +305,12 @@ EXPORT_API int mp_view_mgr_push_view_with_effect(MpViewMgr_t *view_mgr, MpView_t return 0; } -EXPORT_API int mp_view_mgr_push_view(MpViewMgr_t *view_mgr, MpView_t *view, const char *item_style) +EXPORT_API int mp_view_mgr_push_view(MpViewMgr_t * view_mgr, + MpView_t * view, + const char *item_style) { - return mp_view_mgr_push_view_with_effect(view_mgr, view, item_style, false); + return mp_view_mgr_push_view_with_effect(view_mgr, view, item_style, + false); } static Eina_Bool _create_main_view_cb(void *data) @@ -298,7 +322,7 @@ static Eina_Bool _create_main_view_cb(void *data) /*this function is called in backkey callback. it should not be called in other case. use elm_naviframe_item_pop() instead.. */ -int mp_view_mgr_pop_view(MpViewMgr_t *view_mgr, bool pop_view) +int mp_view_mgr_pop_view(MpViewMgr_t * view_mgr, bool pop_view) { startfunc; MP_CHECK_VAL(view_mgr, -1); @@ -322,12 +346,12 @@ int mp_view_mgr_pop_view(MpViewMgr_t *view_mgr, bool pop_view) } mp_view_view_resume(elm_object_item_data_get(list->data)); -END: + END: eina_list_free(list); return 0; } -int mp_view_mgr_pop_a_view(MpViewMgr_t *view_mgr, MpView_t *view) +int mp_view_mgr_pop_a_view(MpViewMgr_t * view_mgr, MpView_t * view) { startfunc; MP_CHECK_VAL(view_mgr, -1); @@ -342,7 +366,7 @@ int mp_view_mgr_pop_a_view(MpViewMgr_t *view_mgr, MpView_t *view) return 0; } -int mp_view_mgr_pop_to_view(MpViewMgr_t *view_mgr, MpViewType_e type) +int mp_view_mgr_pop_to_view(MpViewMgr_t * view_mgr, MpViewType_e type) { MpView_t *view = NULL; MP_CHECK_VAL(view_mgr, -1); @@ -378,7 +402,7 @@ int mp_view_mgr_pop_to_view(MpViewMgr_t *view_mgr, MpViewType_e type) return 0; } -int mp_view_mgr_delete_view(MpViewMgr_t *view_mgr, MpViewType_e type) +int mp_view_mgr_delete_view(MpViewMgr_t * view_mgr, MpViewType_e type) { MP_CHECK_VAL(view_mgr, -1); @@ -403,7 +427,7 @@ int mp_view_mgr_delete_view(MpViewMgr_t *view_mgr, MpViewType_e type) return 0; } -int mp_view_mgr_count_view(MpViewMgr_t *view_mgr) +int mp_view_mgr_count_view(MpViewMgr_t * view_mgr) { MP_CHECK_VAL(view_mgr, 0); Eina_List *list = elm_naviframe_items_get(view_mgr->navi); @@ -420,7 +444,7 @@ static void _view_foreach_cb(void *data, void *user_data) struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); - MpViewEvent_e event = (int)user_data; + MpViewEvent_e event = (int) user_data; if (ad->is_lcd_off) { switch (event) { @@ -447,7 +471,7 @@ static void _view_foreach_cb(void *data, void *user_data) mp_view_update_nowplaying(view, true); break; case MP_UNSET_NOW_PLAYING: - if ((view->view_type == MP_VIEW_DETAIL) || (view->view_type == MP_VIEW_PLAYER)) { /*if detail view, it need to do view pop*/ + if ((view->view_type == MP_VIEW_DETAIL) || (view->view_type == MP_VIEW_PLAYER)) { /*if detail view, it need to do view pop */ mp_view_on_event(view, event); } else { mp_view_unset_nowplaying(view); @@ -475,7 +499,7 @@ static void _view_foreach_cb(void *data, void *user_data) break; case MP_DOUBLE_TAP: #ifndef MP_SOUND_PLAYER - mp_list_view_double_tap((MpListView_t *)view); + mp_list_view_double_tap((MpListView_t *) view); #endif break; case MP_LCD_OFF: @@ -488,7 +512,8 @@ static void _view_foreach_cb(void *data, void *user_data) mp_view_update(view); break; case MP_DB_UPDATED: - if ((view->view_type == MP_VIEW_ADD_TRACK) || (view->view_type == MP_VIEW_SET_AS)) { + if ((view->view_type == MP_VIEW_ADD_TRACK) + || (view->view_type == MP_VIEW_SET_AS)) { mp_view_on_event(view, event); } else { mp_view_update(view); @@ -514,37 +539,38 @@ static void _view_foreach_cb(void *data, void *user_data) } mp_view_on_event(view, event); break; - case MP_POPUP_DELETE_DONE: { - /*check if to unset now-playing*/ - int count = 0; - mp_media_info_list_count(MP_TRACK_ALL, NULL, NULL, NULL, 0, &count); + case MP_POPUP_DELETE_DONE:{ + /*check if to unset now-playing */ + int count = 0; + mp_media_info_list_count(MP_TRACK_ALL, NULL, NULL, NULL, 0, + &count); - if (count == 0) { - mp_view_unset_nowplaying(view); - if (ad && ad->current_track_info) { - mp_util_free_track_info(ad->current_track_info); - ad->current_track_info = NULL; - } - if (ad->b_minicontroller_show) { - mp_minicontroller_hide(ad); - } + if (count == 0) { + mp_view_unset_nowplaying(view); + if (ad && ad->current_track_info) { + mp_util_free_track_info(ad->current_track_info); + ad->current_track_info = NULL; + } + if (ad->b_minicontroller_show) { + mp_minicontroller_hide(ad); + } #ifdef MP_FEATURE_LOCKSCREEN - if (ad->b_lockmini_show) { - mp_lockscreenmini_hide(ad); - } + if (ad->b_lockmini_show) { + mp_lockscreenmini_hide(ad); + } #endif + } + mp_view_on_event(view, event); + break; } - mp_view_on_event(view, event); - break; - } #ifndef MP_SOUND_PLAYER - case MP_WIN_RESIZED: { - if (view->nowplaying_bar) { - mp_now_playing_set_layout(view->nowplaying_bar); + case MP_WIN_RESIZED:{ + if (view->nowplaying_bar) { + mp_now_playing_set_layout(view->nowplaying_bar); + } + mp_view_on_event(view, event); + break; } - mp_view_on_event(view, event); - break; - } #endif default: mp_view_on_event(view, event); @@ -553,7 +579,7 @@ static void _view_foreach_cb(void *data, void *user_data) } -void mp_view_mgr_post_event(MpViewMgr_t *view_mgr, MpViewEvent_e event) +void mp_view_mgr_post_event(MpViewMgr_t * view_mgr, MpViewEvent_e event) { MP_CHECK(view_mgr); @@ -566,13 +592,14 @@ void mp_view_mgr_post_event(MpViewMgr_t *view_mgr, MpViewEvent_e event) if (event == MP_SIP_STATE_CHANGED) { /* top view only */ - _view_foreach_cb(elm_object_item_data_get(l->data), (void *)event); + _view_foreach_cb(elm_object_item_data_get(l->data), + (void *) event); } else if (event == MP_VIEW_TRANSITION_REQUESTED) { /* top view only */ MpView_t *view = elm_object_item_data_get(l->data); if (view) { view->push_transition = true; - _view_foreach_cb(view, (void *)event); + _view_foreach_cb(view, (void *) event); } } else if (event == MP_VIEW_TRANSITION_FINISHED) { /* top view only */ @@ -581,7 +608,7 @@ void mp_view_mgr_post_event(MpViewMgr_t *view_mgr, MpViewEvent_e event) if (view) { pushed = view->push_transition; view->push_transition = false; - _view_foreach_cb(view, (void *)event); + _view_foreach_cb(view, (void *) event); } l = l->prev; @@ -592,12 +619,11 @@ void mp_view_mgr_post_event(MpViewMgr_t *view_mgr, MpViewEvent_e event) } else { EINA_LIST_FOREACH(list, l, data) { if (data) { - _view_foreach_cb(elm_object_item_data_get(data), (void *)event); + _view_foreach_cb(elm_object_item_data_get(data), + (void *) event); } } } eina_list_free(list); } - - diff --git a/src/core/mp-volume.c b/src/core/mp-volume.c index a98f583..87a88c0 100644 --- a/src/core/mp-volume.c +++ b/src/core/mp-volume.c @@ -40,13 +40,13 @@ typedef struct { static MpVolumeKeyMgr_t g_volume_key_mgr; -#define MP_VOLUME_KEY_LONG_PRESS_TRIGGER_TIME (0.2) /* sec */ +#define MP_VOLUME_KEY_LONG_PRESS_TRIGGER_TIME (0.2) /* sec */ #define MP_VOLUME_KEY_LONG_PRESS_INTEVAL_TIME (0.07) -void _mp_volume_changed_cb(sound_type_e type, unsigned int volume, void *user_data); +void _mp_volume_changed_cb(sound_type_e type, unsigned int volume, + void *user_data); -void -mp_volume_init(void *win) +void mp_volume_init(void *win) { startfunc; g_volume_key_mgr.xwin = win; @@ -62,12 +62,11 @@ void mp_volume_finalize(void) return; } - /* sound_manager_unset_volume_changed_cb(); */ + /* sound_manager_unset_volume_changed_cb(); */ endfunc; } -static void -_mp_volume_key_grab_check_condition() +static void _mp_volume_key_grab_check_condition() { bool start = true; int condition = 0; @@ -89,42 +88,48 @@ _mp_volume_key_grab_check_condition() } void -mp_volume_key_grab_condition_set(mp_volume_key_grab_condition_e condition, bool enabled) +mp_volume_key_grab_condition_set(mp_volume_key_grab_condition_e condition, + bool enabled) { MP_CHECK(condition < MP_VOLUME_KEY_GRAB_COND_MAX); /* set condition */ g_volume_key_mgr.condition[condition] = enabled; - WARN_TRACE("VOL key grab condition(%d) changed => [%d]", condition, enabled); + WARN_TRACE("VOL key grab condition(%d) changed => [%d]", condition, + enabled); _mp_volume_key_grab_check_condition(); } -bool -mp_volume_key_grab_start() +bool mp_volume_key_grab_start() { MP_CHECK_FALSE(g_volume_key_mgr.xwin); Eina_Bool error = EINA_FALSE; - error = eext_win_keygrab_set(g_volume_key_mgr.win, "XF86AudioRaiseVolume"); + error = + eext_win_keygrab_set(g_volume_key_mgr.win, "XF86AudioRaiseVolume"); if (error != EINA_TRUE) { mp_error("(KEY_VOLUMEUP)... [%d]", error); return false; } - error = eext_win_keygrab_set(g_volume_key_mgr.win, "XF86AudioLowerVolume"); + error = + eext_win_keygrab_set(g_volume_key_mgr.win, "XF86AudioLowerVolume"); if (error != EINA_TRUE) { mp_error("(KEY_VOLUMEDOWN)... [%d]", error); - eext_win_keygrab_unset(g_volume_key_mgr.win, "XF86AudioRaiseVolume"); + eext_win_keygrab_unset(g_volume_key_mgr.win, + "XF86AudioRaiseVolume"); return false; } error = eext_win_keygrab_set(g_volume_key_mgr.win, "XF86AudioMute"); if (error != EINA_TRUE) { mp_error("(KEY_MUTE)... [0x%d]", error); - eext_win_keygrab_unset(g_volume_key_mgr.win, "XF86AudioRaiseVolume"); - eext_win_keygrab_unset(g_volume_key_mgr.win, "XF86AudioLowerVolume"); + eext_win_keygrab_unset(g_volume_key_mgr.win, + "XF86AudioRaiseVolume"); + eext_win_keygrab_unset(g_volume_key_mgr.win, + "XF86AudioLowerVolume"); return false; } @@ -133,15 +138,15 @@ mp_volume_key_grab_start() return true; } -void -mp_volume_key_grab_end() +void mp_volume_key_grab_end() { eext_win_keygrab_unset(g_volume_key_mgr.win, "XF86AudioRaiseVolume"); eext_win_keygrab_unset(g_volume_key_mgr.win, "XF86AudioLowerVolume"); eext_win_keygrab_unset(g_volume_key_mgr.win, "XF86AudioMute"); if (g_volume_key_mgr.pressed_timer && g_volume_key_mgr.key_event_cb) { - g_volume_key_mgr.key_event_cb(g_volume_key_mgr.key_event_user_data, MP_VOLUME_KEY_DOWN, true); + g_volume_key_mgr.key_event_cb(g_volume_key_mgr.key_event_user_data, + MP_VOLUME_KEY_DOWN, true); } mp_ecore_timer_del(g_volume_key_mgr.pressed_timer); @@ -149,24 +154,24 @@ mp_volume_key_grab_end() g_volume_key_mgr.grabbed = false; } -bool -mp_volume_key_is_grabed() +bool mp_volume_key_is_grabed() { return g_volume_key_mgr.grabbed; } -static Eina_Bool -_mp_volume_key_pressed_timer(void *data) +static Eina_Bool _mp_volume_key_pressed_timer(void *data) { TIMER_TRACE(); - mp_volume_key_e type = (int)data; + mp_volume_key_e type = (int) data; if (g_volume_key_mgr.key_event_cb) { - g_volume_key_mgr.key_event_cb(g_volume_key_mgr.key_event_user_data, type, false); + g_volume_key_mgr.key_event_cb(g_volume_key_mgr.key_event_user_data, + type, false); } MP_CHECK_VAL(g_volume_key_mgr.pressed_timer, ECORE_CALLBACK_CANCEL); - ecore_timer_interval_set(g_volume_key_mgr.pressed_timer, MP_VOLUME_KEY_LONG_PRESS_INTEVAL_TIME); + ecore_timer_interval_set(g_volume_key_mgr.pressed_timer, + MP_VOLUME_KEY_LONG_PRESS_INTEVAL_TIME); return ECORE_CALLBACK_RENEW; } @@ -174,13 +179,13 @@ _mp_volume_key_pressed_timer(void *data) void _mp_volume_handle_change(unsigned int volume) { if (g_volume_key_mgr.volume_change_cb) { - g_volume_key_mgr.volume_change_cb(volume, g_volume_key_mgr.user_data); + g_volume_key_mgr.volume_change_cb(volume, + g_volume_key_mgr.user_data); } } -void -mp_volume_key_event_send(mp_volume_key_e type, bool released) +void mp_volume_key_event_send(mp_volume_key_e type, bool released) { WARN_TRACE("volume key[%d], released[%d]", type, released); @@ -190,7 +195,7 @@ mp_volume_key_event_send(mp_volume_key_e type, bool released) } if (!released && g_volume_key_mgr.pressed_timer) { - /* long press timer is working*/ + /* long press timer is working */ return; } @@ -198,38 +203,39 @@ mp_volume_key_event_send(mp_volume_key_e type, bool released) if (g_volume_key_mgr.key_event_cb) { /* send callback */ - g_volume_key_mgr.key_event_cb(g_volume_key_mgr.key_event_user_data, type, released); + g_volume_key_mgr.key_event_cb(g_volume_key_mgr.key_event_user_data, + type, released); } if (!released) { - g_volume_key_mgr.pressed_timer = ecore_timer_add(MP_VOLUME_KEY_LONG_PRESS_TRIGGER_TIME, _mp_volume_key_pressed_timer, (void *)type); + g_volume_key_mgr.pressed_timer = + ecore_timer_add(MP_VOLUME_KEY_LONG_PRESS_TRIGGER_TIME, + _mp_volume_key_pressed_timer, (void *) type); } } void -mp_volume_key_event_callback_add(Mp_Volume_Key_Event_Cb event_cb, void *user_data) +mp_volume_key_event_callback_add(Mp_Volume_Key_Event_Cb event_cb, + void *user_data) { g_volume_key_mgr.key_event_cb = event_cb; g_volume_key_mgr.key_event_user_data = user_data; } -void -mp_volume_key_event_callback_del() +void mp_volume_key_event_callback_del() { g_volume_key_mgr.key_event_cb = NULL; g_volume_key_mgr.key_event_user_data = NULL; mp_ecore_timer_del(g_volume_key_mgr.pressed_timer); } -void -mp_volume_key_event_timer_del() +void mp_volume_key_event_timer_del() { mp_ecore_timer_del(g_volume_key_mgr.pressed_timer); g_volume_key_mgr.pressed_timer = NULL; } -void -mp_volume_add_change_cb(Mp_Volume_Change_Cb cb, void *user_data) +void mp_volume_add_change_cb(Mp_Volume_Change_Cb cb, void *user_data) { /* if (g_volume_key_mgr.volume_change_cb) return; */ @@ -242,5 +248,3 @@ mp_volume_add_change_cb(Mp_Volume_Change_Cb cb, void *user_data) g_volume_key_mgr.volume_change_cb = cb; g_volume_key_mgr.user_data = user_data; } - - diff --git a/src/include/mp-define.h b/src/include/mp-define.h index 8ffcfd8..979308d 100644 --- a/src/include/mp-define.h +++ b/src/include/mp-define.h @@ -110,28 +110,28 @@ #define SIGNAL_MAIN_MUTE_SHOW "signal.main.mute.show" #define SIGNAL_MAIN_MUTE_HIDE "signal.main.mute.hide" -#define CHECK(x) if(!x) ERROR_TRACE("RETURN NULL!!\n", x); -#define SAFE_FREE(x) if(x) {free(x); x = NULL;} -#define SAFE_STRDUP(destptr,sourceptr)\ - do{\ - if( destptr != NULL ){\ - free( destptr );\ +#define CHECK(x) if (!x) ERROR_TRACE("RETURN NULL!!\n", x); +#define SAFE_FREE(x) if (x) {free(x); x = NULL; } +#define SAFE_STRDUP(destptr, sourceptr)\ + do {\ + if (destptr != NULL) {\ + free(destptr);\ destptr = NULL;\ - }\ - if(sourceptr == NULL)\ + } \ + if (sourceptr == NULL)\ destptr = NULL; \ else \ destptr = strdup(sourceptr); \ - }while(0); + } while (0); #define MAX_STR_LEN MAX_NAM_LEN #define MAX_URL_LEN MAX_NAM_LEN #define DEF_STR_LEN 512 -#define PLAY_VIEW_EDJ_NAME "music.edj" +#define PLAY_VIEW_EDJ_NAME "music.edj" //2 EVAS_OBJECT_TYPE define -#define MP_FAST_SCROLLER_TYPE "mp_data_fast_scroller_type" +#define MP_FAST_SCROLLER_TYPE "mp_data_fast_scroller_type" /* options */ #define SIGNAL_NOW_PLAYING_CLICKED "now_playing_clicked" @@ -200,27 +200,27 @@ typedef void (*MpGetShazamSigCb) (char *signature, int size, void *data); #define FREE(ptr) free(ptr); ptr = NULL; #undef IF_FREE -#define IF_FREE(ptr) if (ptr) {free(ptr); ptr = NULL;} +#define IF_FREE(ptr) if (ptr) {free(ptr); ptr = NULL; } #undef IF_G_FREE -#define IF_G_FREE(p) ({g_free(p);p=NULL;}) +#define IF_G_FREE(p) ({g_free(p); p = NULL; }) #define mp_evas_object_del(object) do { \ - if(object) { \ + if (object) { \ evas_object_del(object); \ object = NULL; \ } \ } while (0) #define mp_elm_object_item_del(object) do { \ - if(object) { \ + if (object) { \ elm_object_item_del(object); \ object = NULL; \ } \ } while (0) #define mp_elm_genlist_del(list) do { \ - if(list) { \ + if (list) { \ elm_genlist_clear(list);\ evas_object_del(list); \ list = NULL; \ @@ -228,43 +228,43 @@ typedef void (*MpGetShazamSigCb) (char *signature, int size, void *data); } while (0) #define mp_ecore_timer_del(timer) do { \ - if(timer) { \ + if (timer) { \ ecore_timer_del(timer);\ timer = NULL; \ } \ } while (0) #define mp_ecore_animator_del(animator) do { \ - if(animator) { \ + if (animator) { \ ecore_animator_del(animator);\ animator = NULL; \ } \ } while (0) #define mp_ecore_idler_del(idler) do { \ - if(idler) { \ + if (idler) { \ ecore_idler_del(idler);\ idler = NULL; \ } \ } while (0) #define MP_TIMER_FREEZE(timer) do { \ - if(timer) { \ + if (timer) { \ ecore_timer_freeze(timer);\ } \ } while (0) #define MP_TIMER_THAW(timer) do { \ - if(timer) { \ + if (timer) { \ ecore_timer_thaw(timer);\ } \ } while (0) #define SAFE_STRCPY(dest, src) \ - do{if(!dest||!src)break;\ - strncpy (dest , src, sizeof(dest)-1);\ - dest[sizeof(dest)-1] = 0; }while(0) + do {if (!dest || !src)break;\ + strncpy(dest , src, sizeof(dest)-1);\ + dest[sizeof(dest)-1] = 0; } while (0) #define mp_evas_object_response_set(obj, response) do { \ if (obj) { \ @@ -276,33 +276,29 @@ typedef void (*MpGetShazamSigCb) (char *signature, int size, void *data); #define SCALED_SIZE(x) ((x) * elm_config_scale_get()) -typedef enum -{ +typedef enum { MP_SCREEN_MODE_PORTRAIT = 0, MP_SCREEN_MODE_LANDSCAPE, } mp_screen_mode; -typedef enum -{ +typedef enum { MP_SND_PATH_SPEAKER = 0x01, - MP_SND_PATH_EARPHONE= 0x02, - MP_SND_PATH_BT= 0x04, - MP_SND_PATH_HDMI= 0x10, - MP_SND_PATH_MIRRORING= 0x20, //WIFI display - MP_SND_PATH_USB_AUDIO= 0x40, + MP_SND_PATH_EARPHONE = 0x02, + MP_SND_PATH_BT = 0x04, + MP_SND_PATH_HDMI = 0x10, + MP_SND_PATH_MIRRORING = 0x20, //WIFI display + MP_SND_PATH_USB_AUDIO = 0x40, MP_SND_PATH_MAX, } mp_snd_path; -typedef enum -{ +typedef enum { MP_VIEW_MODE_DEFAULT, MP_VIEW_MODE_EDIT, MP_VIEW_MODE_SEARCH, } mp_view_mode_t; -typedef enum -{ +typedef enum { MP_VIEW_TYPE_SONGS, MP_VIEW_TYPE_PLAYLIST, MP_VIEW_TYPE_ALBUM, @@ -317,8 +313,7 @@ typedef enum MP_VIEW_TYPE_MAX, } mp_view_type_t; -typedef enum -{ +typedef enum { MP_DONE_DELETE_TYPE = 0x01, MP_DONE_REMOVED_TYPE, MP_DONE_ADD_TO_TYPE, @@ -328,8 +323,7 @@ typedef enum MP_DONE_MAX, } mp_done_operator_type_t; -typedef enum -{ +typedef enum { MP_PLAY_STATE_NONE, MP_PLAY_STATE_PLAYING, MP_PLAY_STATE_PAUSED, @@ -337,8 +331,7 @@ typedef enum MP_PLAY_STATE_MAX, } mp_play_state; -typedef enum -{ +typedef enum { MP_TAB_PLAYLISTS, MP_TAB_SONGS, MP_TAB_ALBUMS, @@ -356,19 +349,19 @@ typedef enum next = elm_genlist_item_next_get(current), \ data = elm_object_item_data_get(current)) -#define MP_PLAYLIST_MAX_ITEM_COUNT 1000 -#define MP_NOW_PLAYING_ICON_SIZE 74 * elm_config_scale_get() -#define MP_LIST_ICON_SIZE 90 * elm_config_scale_get() -#define MP_LIST_ALBUM_ICON_SIZE 120 * elm_config_scale_get() -#define MP_ALBUM_LIST_ICON_SIZE 48 * elm_config_scale_get() -#define MP_ARTIST_ALBUM_LIST_ICON_SIZE (64 * elm_config_scale_get()) -#define MP_PLAY_VIEW_ARTWORK_SIZE 480 * elm_config_scale_get() -#define MP_LIST_SHUFFLE_ICON_SIZE (36* elm_config_scale_get()) +#define MP_PLAYLIST_MAX_ITEM_COUNT 1000 +#define MP_NOW_PLAYING_ICON_SIZE 74 * elm_config_scale_get() +#define MP_LIST_ICON_SIZE 90 * elm_config_scale_get() +#define MP_LIST_ALBUM_ICON_SIZE 120 * elm_config_scale_get() +#define MP_ALBUM_LIST_ICON_SIZE 48 * elm_config_scale_get() +#define MP_ARTIST_ALBUM_LIST_ICON_SIZE (64 * elm_config_scale_get()) +#define MP_PLAY_VIEW_ARTWORK_SIZE 480 * elm_config_scale_get() +#define MP_LIST_SHUFFLE_ICON_SIZE (36 * elm_config_scale_get()) -#define MP_ARTIST_THUMB_ICON_SIZE 162 -#define MP_LANDSCAPE_ARTIST_THUMB_ICON_SIZE 166 -#define MP_ALBUM_THUMB_ICON_SIZE 312 -#define MP_LANDSCAPE_ALBUM_THUMB_ICON_SIZE 230 +#define MP_ARTIST_THUMB_ICON_SIZE 162 +#define MP_LANDSCAPE_ARTIST_THUMB_ICON_SIZE 166 +#define MP_ALBUM_THUMB_ICON_SIZE 312 +#define MP_LANDSCAPE_ALBUM_THUMB_ICON_SIZE 230 #define MP_FILE_PREFIX "file://" @@ -376,7 +369,7 @@ typedef enum #ifdef MP_SOUND_PLAYER #define MP_SHARED_PLAYING_STATUS_INI "nowplaying.ini" //share track info of sound-player #else -#define MP_SHARED_PLAYING_STATUS_INI "NowPlayingStatus" //share track info of music-player +#define MP_SHARED_PLAYING_STATUS_INI "NowPlayingStatus" //share track info of music-player #endif //@@ MP_PLAYING_INI_FILE_NAME //this hard corded value is used for music player & sound player. @@ -402,15 +395,14 @@ typedef enum #define SINGLE_BYTE_MAX 0x7F -typedef enum -{ +typedef enum { MP_UG_MESSAGE_BACK, MP_UG_MESSAGE_DEL, MP_UG_MESSAGE_LOAD, #ifdef MP_FEATURE_INNER_SETTINGS MP_UG_MESSAGE_SETTINGS_BACK, #endif -}mp_ug_message_t; +} mp_ug_message_t; #define MP_POPUP_TITLE_H 72 #define MP_POPUP_MAX_H 752 @@ -449,4 +441,4 @@ typedef enum #define USER_AGENT_KEY "db/browser/UserAgent" #define MP_FEATURE_ALWAYS_ON -#endif /* __MP_DEFINE_H_ */ +#endif /* __MP_DEFINE_H_ */ diff --git a/src/include/mp-player-debug.h b/src/include/mp-player-debug.h index 07e1ea0..9a710e0 100644 --- a/src/include/mp-player-debug.h +++ b/src/include/mp-player-debug.h @@ -51,9 +51,9 @@ #define VER_TRACE(fmt, arg...) dlog_print(DLOG_INFO, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg) #define DEBUG_TRACE(fmt, arg...) dlog_print(DLOG_DEBUG, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg) -#define INFO_TRACE(fmt, arg...) dlog_print(DLOG_INFO, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg) -#define WARN_TRACE(fmt, arg...) dlog_print(DLOG_WARN, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg) -#define EVENT_TRACE(fmt, arg...) dlog_print(DLOG_INFO, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg) +#define INFO_TRACE(fmt, arg...) dlog_print(DLOG_INFO, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg) +#define WARN_TRACE(fmt, arg...) dlog_print(DLOG_WARN, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg) +#define EVENT_TRACE(fmt, arg...) dlog_print(DLOG_INFO, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg) #define ERROR_TRACE(fmt, arg...) dlog_print(DLOG_ERROR, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg) #define mp_debug_temp(fmt, arg...) #define TIMER_TRACE(fmt, arg...) do { if (mp_file_exists("/tmp/mp_show_timer_log")) dlog_print(DLOG_DEBUG, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg); } while (0) @@ -62,11 +62,11 @@ #undef PARAM_CHECK #endif -#define PARAM_CHECK(fmt, arg...) dlog_print(DLOG_DEBUG, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg) +#define PARAM_CHECK(fmt, arg...) dlog_print(DLOG_DEBUG, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg) -//#define PROFILE_IN(func) LOG(LOG_DEBUG, "LAUNCH","[music-player:Application:"func":IN]"); TA(1, func); -//#define PROFILE_OUT(func) LOG(LOG_DEBUG, "LAUNCH","[music-player:Application:"func":OUT]"); TA(0, func); -#define PROFILE_IN(func) TA(1, func); +//#define PROFILE_IN(func) LOG(LOG_DEBUG, "LAUNCH","[music-player:Application:"func":IN]"); TA(1, func); +//#define PROFILE_OUT(func) LOG(LOG_DEBUG, "LAUNCH","[music-player:Application:"func":OUT]"); TA(0, func); +#define PROFILE_IN(func) TA(1, func); #define PROFILE_OUT(func) TA(0, func); #define SECURE_DEBUG(fmt, args...) dlog_print(DLOG_DEBUG, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##args) @@ -74,48 +74,48 @@ #define SECURE_ERROR(fmt, args...) dlog_print(DLOG_ERROR, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##args) #define SM_ERROR_CHECK(err)\ -do{\ - if(err != SM_ERROR_NONE)\ +do {\ + if (err != SM_ERROR_NONE)\ ERROR_TRACE("Error!! [%d]", err);\ -}while(0);\ - -#else // use USE_DLOG_SYSTEM - -#define mp_debug(fmt, arg...) do{fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ - fprintf (stderr, __VA_ARGS__);}while(0) -#define mp_error(fmt, arg...) do{fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ - fprintf (stderr, __VA_ARGS__);}while(0) -#define VER_TRACE(fmt, arg...) do{fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ - fprintf (stderr, __VA_ARGS__);}while(0) -#define DEBUG_TRACE(fmt, arg...) do{fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ - fprintf (stderr, __VA_ARGS__);}while(0) -#define INFO_TRACE(fmt, arg...) do{fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ - fprintf (stderr, __VA_ARGS__);}while(0) -#define WARN_TRACE(fmt, arg...) do{fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ - fprintf (stderr, __VA_ARGS__);}while(0) -#define EVENT_TRACE(fmt, arg...) do{fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ - fprintf (stderr, __VA_ARGS__);}while(0) -#define ERROR_TRACE(fmt, arg...) do{fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ - fprintf (stderr, __VA_ARGS__);}while(0) -#define mp_debug_temp(fmt, arg...) do{fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ - fprintf (stderr, __VA_ARGS__);}while(0) -#define TIMER_TRACE(fmt, arg...) do{fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ - fprintf (stderr, __VA_ARGS__);}while(0) -#define PARAM_CHECK(fmt, arg...) do{fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ - fprintf (stderr, __VA_ARGS__);}while(0) +} while (0);\ + +#else // use USE_DLOG_SYSTEM + +#define mp_debug(fmt, arg...) do {fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ + fprintf(stderr, __VA_ARGS__); } while (0) +#define mp_error(fmt, arg...) do {fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ + fprintf(stderr, __VA_ARGS__); } while (0) +#define VER_TRACE(fmt, arg...) do {fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ + fprintf(stderr, __VA_ARGS__); } while (0) +#define DEBUG_TRACE(fmt, arg...) do {fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ + fprintf(stderr, __VA_ARGS__); } while (0) +#define INFO_TRACE(fmt, arg...) do {fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ + fprintf(stderr, __VA_ARGS__); } while (0) +#define WARN_TRACE(fmt, arg...) do {fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ + fprintf(stderr, __VA_ARGS__); } while (0) +#define EVENT_TRACE(fmt, arg...) do {fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ + fprintf(stderr, __VA_ARGS__); } while (0) +#define ERROR_TRACE(fmt, arg...) do {fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ + fprintf(stderr, __VA_ARGS__); } while (0) +#define mp_debug_temp(fmt, arg...) do {fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ + fprintf(stderr, __VA_ARGS__); } while (0) +#define TIMER_TRACE(fmt, arg...) do {fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ + fprintf(stderr, __VA_ARGS__); } while (0) +#define PARAM_CHECK(fmt, arg...) do {fprintf(stderr, "[%s : %s-%d]\t - \n", __FILE__, __func__, __LINE__);\ + fprintf(stderr, __VA_ARGS__); } while (0) #define PROFILE_IN(func) #define PROFILE_OUT(func) #define SM_ERROR_CHECK(err) -#endif //USE_DLOG_SYSTEM +#endif //USE_DLOG_SYSTEM #define DEBUG_TRACE_FUNC() DEBUG_TRACE("") -#else //ENABLE_LOG_SYSTEM +#else //ENABLE_LOG_SYSTEM #define mp_debug(fmt, arg...) ; -#define mp_error(fmt, arg...) ; +#define mp_error(fmt, arg...) ; #define VER_TRACE(fmt, arg...) ; #define DEBUG_TRACE(fmt, arg...) ; #define INFO_TRACE(fmt, arg...) ; @@ -126,65 +126,64 @@ do{\ #define PROFILE_IN(func) ; #define PROFILE_OUT(func) ; #define SM_ERROR_CHECK(err) ; -#endif //ENABLE_LOG_SYSTEM +#endif //ENABLE_LOG_SYSTEM #define eventfunc EVENT_TRACE(""); #ifndef startfunc -#define startfunc VER_TRACE("+- START -"); +#define startfunc VER_TRACE("+- START -"); #endif #ifndef endfunc -#define endfunc VER_TRACE("+- END -"); +#define endfunc VER_TRACE("+- END -"); #endif #define mp_ret_if(expr) do { \ - if(expr) { \ + if (expr) { \ PARAM_CHECK("");\ return; \ } \ } while (0) #define mp_retv_if(expr, val) do { \ - if(expr) { \ + if (expr) { \ PARAM_CHECK("");\ return (val); \ } \ } while (0) #define mp_retm_if(expr, fmt, arg...) do { \ - if(expr) { \ + if (expr) { \ PARAM_CHECK(fmt, ##arg); \ return; \ } \ } while (0) #define mp_retvm_if(expr, val, fmt, arg...) do { \ - if(expr) { \ + if (expr) { \ PARAM_CHECK(fmt, ##arg); \ return (val); \ } \ } while (0) #define MP_CHECK_EXCEP(expr) do { \ - if(!(expr)) { \ + if (!(expr)) { \ ERROR_TRACE("CRITICAL ERROR ## CHECK BELOW ITEM");\ goto mp_exception;\ } \ } while (0) -#define MP_CHECK_VAL(expr, val) mp_retvm_if(!(expr),val,"INVALID PARM RETURN VAL: 0x%x", val) -#define MP_CHECK_NULL(expr) mp_retvm_if(!(expr),NULL,"INVALID PARM RETURN NULL") -#define MP_CHECK_FALSE(expr) mp_retvm_if(!(expr),FALSE,"INVALID PARM RETURN FALSE") -#define MP_CHECK_CANCEL(expr) mp_retvm_if(!(expr), ECORE_CALLBACK_CANCEL, "INVALID PARAM RETURN") -#define MP_CHECK(expr) mp_retm_if(!(expr),"INVALID PARAM RETURN") +#define MP_CHECK_VAL(expr, val) mp_retvm_if(!(expr), val, "INVALID PARM RETURN VAL: 0x%x", val) +#define MP_CHECK_NULL(expr) mp_retvm_if(!(expr), NULL, "INVALID PARM RETURN NULL") +#define MP_CHECK_FALSE(expr) mp_retvm_if(!(expr), FALSE, "INVALID PARM RETURN FALSE") +#define MP_CHECK_CANCEL(expr) mp_retvm_if(!(expr), ECORE_CALLBACK_CANCEL, "INVALID PARAM RETURN") +#define MP_CHECK(expr) mp_retm_if(!(expr), "INVALID PARAM RETURN") #define mp_assert(expr) do { \ - if(!(expr)) { \ + if (!(expr)) { \ ERROR_TRACE("CRITICAL ERROR ## CHECK BELOW ITEM");\ assert(FALSE); \ } \ } while (0) -#endif // __MP_PLAYER_DEBUG_H_ - +#endif // __MP_PLAYER_DEBUG_H_ diff --git a/src/include/music.h b/src/include/music.h index a182891..87dfee5 100644 --- a/src/include/music.h +++ b/src/include/music.h @@ -52,8 +52,7 @@ #include "mp-view-mgr.h" #include "mp-popup.h" -typedef struct -{ +typedef struct { /* controlbar tab item */ Elm_Object_Item *ctltab_songs; @@ -76,12 +75,11 @@ typedef struct do { \ if (((view_data_t *)view_data)->magic != MP_VIEW_DATA_MAGIC) { \ ERROR_TRACE("\n########### ERROR CHECK #############\nPARAM is not view_data\n########### ERROR CHECK #############\n"); \ - mp_assert(FALSE);} \ + mp_assert(FALSE); } \ } while (0) -typedef struct -{ +typedef struct { Evas_Object *layout; void *EvasPlugin; Evas_Object *box; @@ -94,13 +92,13 @@ typedef struct Evas_Object *track_genlist; bool show_track_list; - int track_count; + int track_count; Evas_Object *now_playing; Evas_Object *now_playing_icon; Evas_Object *all_tracks; bool all_tracks_click; - Evas_Object* ctxpopup; + Evas_Object *ctxpopup; int all_tracks_type; Evas_Object *back_button; @@ -115,8 +113,7 @@ typedef struct struct appdata *ad; } mp_coverflow_view; -typedef struct -{ +typedef struct { char *uri; char *title; char *artist; @@ -141,10 +138,9 @@ typedef struct bool isDiffAP; mp_track_type track_type; -}mp_track_info_t; +} mp_track_info_t; -enum -{ +enum { MP_CREATE_PLAYLIST_MODE_NONE, MP_CREATE_PLAYLIST_MODE_NEW, MP_CREATE_PLAYLIST_MODE_WITHMUSICS, @@ -152,38 +148,34 @@ enum MP_CREATE_PLAYLIST_MODE_SWEEP }; -typedef enum -{ - MP_LAUNCH_DEFAULT = 0, //normal case - MP_LAUNCH_BY_PATH, //ug case - MP_LAUNCH_ADD_TO_HOME, //add to home +typedef enum { + MP_LAUNCH_DEFAULT = 0, //normal case + MP_LAUNCH_BY_PATH, //ug case + MP_LAUNCH_ADD_TO_HOME, //add to home MP_LAUNCH_PLAY_RECENT, MP_LAUNCH_LIVE_BOX, - MP_LAUNCH_PLAY_FILES, //play recent + MP_LAUNCH_PLAY_FILES, //play recent MP_LAUNCH_PLAY_PLAYLIST, } mp_launch_type; -typedef enum -{ +typedef enum { LOAD_DEFAULT, - LOAD_TRACK, //load by path - LOAD_GROUP, //load by shortcut - LOAD_PLAYLIST, //load by shortcut + LOAD_TRACK, //load by path + LOAD_GROUP, //load by shortcut + LOAD_PLAYLIST, //load by shortcut LOAD_REQUSET_TYPE, LOAD_MM_KEY, } mp_load_type; -typedef enum -{ +typedef enum { MP_SPLIT_VIEW_TYPE_NORMAL = 0, MP_SPLIT_VIEW_TYPE_FULL, } mp_split_view_type; -typedef struct mp_split_view -{ +typedef struct mp_split_view { Evas_Object *layout; Evas_Object *left_layout; Evas_Object *right_layout; @@ -194,8 +186,7 @@ typedef struct mp_split_view Ecore_Idler *idle_idler; } mp_split_view; -typedef enum -{ +typedef enum { PLAY_STATE_NONE, PLAY_STATE_CREATED, PLAY_STATE_PREPARING, @@ -229,8 +220,7 @@ typedef enum { MP_DEVICE_TYPE_TV, } mp_device_type_e; -struct appdata -{ +struct appdata { Evas *evas; Evas_Object *win_main; @@ -284,7 +274,7 @@ struct appdata MpViewMgr_t *view_manager; - sound_stream_info_h stream_info;//support sound_manager + sound_stream_info_h stream_info; //support sound_manager bool create_view_on_play; Evas_Object *preload_player_view; @@ -299,8 +289,8 @@ struct appdata char *new_playlist_name; struct { - bool downed; - bool moving; + bool downed; + bool moving; Evas_Coord sx; Evas_Coord sy; } mouse; @@ -320,7 +310,7 @@ struct appdata unsigned int press_time; #ifdef MP_FEATURE_LOCKSCREEN - Evas_Object *win_lockmini; //lockscreen mini + Evas_Object *win_lockmini; //lockscreen mini Evas_Object *lockmini_layout; Evas_Object *lockmini_progress_box; Evas_Object *lockmini_progress_layout; @@ -351,19 +341,19 @@ struct appdata int current_appcore_rm; mp_screen_mode screen_mode; - int screen_height; //current screen height - int screen_width; //current screen width + int screen_height; //current screen height + int screen_width; //current screen width bool paused_by_user; mp_http_mgr_t *http_mgr; - bool app_is_foreground; // relaunch only available when music is in pause state + bool app_is_foreground; // relaunch only available when music is in pause state bool is_lcd_off; - bool is_focus_out; // update minicontroller in bgm mode. + bool is_focus_out; // update minicontroller in bgm mode. - mp_snd_path snd_path; // indicate sound path; + mp_snd_path snd_path; // indicate sound path; Ecore_Event_Handler *key_down; Ecore_Event_Handler *key_up; @@ -380,22 +370,22 @@ struct appdata int motion_handle; Evas_Object *info_ug_base; //if thist is not null, info ug is visible. use this to determine info view is exist or not. - Evas_Object *info_ug_layout; //do not del this object. if it is deleted, info ug layout will not be displayed properly. - bool info_click_flag; //flag for click info button in play view - bool info_back_play_view_flag; //flag for info view back play view + Evas_Object *info_ug_layout; //do not del this object. if it is deleted, info ug layout will not be displayed properly. + bool info_click_flag; //flag for click info button in play view + bool info_back_play_view_flag; //flag for info view back play view - bool edit_in_progress; // don't update view in inotify callback while delete operation. + bool edit_in_progress; // don't update view in inotify callback while delete operation. Ecore_Timer *volume_down_timer; Ecore_Timer *mute_popup_show_timer; //timer for showing mute popup bool volume_long_pressed; - bool mute_flag; //flag for mute + bool mute_flag; //flag for mute double ff_rew_distance; // for ff and rew when there is no play view bool music_setting_change_flag; //true for change music setting data, false for not - bool load_play_view; /*set it true if play view must be displayed directly when app is launching*/ + bool load_play_view; /*set it true if play view must be displayed directly when app is launching */ bool is_Longpress; bool is_ff; @@ -455,14 +445,14 @@ struct appdata Ecore_Job *exit_job; bool store_enable; - bool mirror_to_local; + bool mirror_to_local; int samsung_link; int disable_change_player; Ecore_Timer *app_control_check_timer; - bool prepare_by_init; //to indicate if player created and prepared to ready state in init idler + bool prepare_by_init; //to indicate if player created and prepared to ready state in init idler int mmc_id; app_event_low_battery_status_e low_battery_status; }; @@ -470,14 +460,12 @@ struct appdata typedef void (*mpOptCallBack) (void *, Evas_Object *, void *); -typedef struct -{ +typedef struct { const char *name; mpOptCallBack cb; } MpOptItemType; -typedef struct -{ +typedef struct { MpOptItemType *l_opt; MpOptItemType *m_opt; MpOptItemType *r_opt; @@ -485,4 +473,4 @@ typedef struct #include "mp-util.h" -#endif /* __DEF_music_H__ */ +#endif /* __DEF_music_H__ */ diff --git a/src/lib/include/MusicView.h b/src/lib/include/MusicView.h index 4981731..3fee64b 100644 --- a/src/lib/include/MusicView.h +++ b/src/lib/include/MusicView.h @@ -20,5 +20,5 @@ int MusicViewInit(void); int MusicViewRelease(void); -char* MusicViewEXE (const char* filename, int *length); +char *MusicViewEXE(const char *filename, int *length); #endif diff --git a/src/lib/include/SmartVolume.h b/src/lib/include/SmartVolume.h index f2035d7..61837ee 100644 --- a/src/lib/include/SmartVolume.h +++ b/src/lib/include/SmartVolume.h @@ -20,5 +20,5 @@ int SmartVolumeInit(void); int SmartVolumeRelease(void); -int SmartVolumeEXE (char* filename); +int SmartVolumeEXE(char *filename); #endif diff --git a/src/mp-main.c b/src/mp-main.c index ec2603e..b86ea53 100644 --- a/src/mp-main.c +++ b/src/mp-main.c @@ -85,12 +85,19 @@ static bool g_normal_launched = false; static bool _mp_main_init(struct appdata *ad); int app_control_to_bundle(app_control_h, bundle **); -static void _mp_main_win_visibility_withdrawn_cb(void *data, Evas_Object *obj, void *event); -static void _mp_main_win_visibility_normal_cb(void *data, Evas_Object *obj, void *event); -static void _mp_main_win_focus_in_cb(void *data, Evas_Object *obj, void *event); -static void _mp_main_win_focus_out_cb(void *data, Evas_Object *obj, void *event); +static void _mp_main_win_visibility_withdrawn_cb(void *data, + Evas_Object * obj, + void *event); +static void _mp_main_win_visibility_normal_cb(void *data, + Evas_Object * obj, + void *event); +static void _mp_main_win_focus_in_cb(void *data, Evas_Object * obj, + void *event); +static void _mp_main_win_focus_out_cb(void *data, Evas_Object * obj, + void *event); static Eina_Bool _mp_main_app_init_idler_cb(void *data); -void mp_device_orientation_cb(app_device_orientation_e orientation, void *user_data); +void mp_device_orientation_cb(app_device_orientation_e orientation, + void *user_data); static void _mp_main_exit_cb(void *data, Evas_Object * obj, void *event_info) @@ -100,15 +107,15 @@ _mp_main_exit_cb(void *data, Evas_Object * obj, void *event_info) mp_app_exit(data); } -void mp_recorder_state_cb(recorder_type_e type, recorder_device_state_e state, void *user_data) +void mp_recorder_state_cb(recorder_type_e type, + recorder_device_state_e state, void *user_data) { - struct appdata *ad = (struct appdata *)user_data; + struct appdata *ad = (struct appdata *) user_data; ad->recorder_state = state; ad->recorder_type = type; } -static bool -_mp_main_init(struct appdata *ad) +static bool _mp_main_init(struct appdata *ad) { ad->music_setting_change_flag = false; ad->paused_by_user = true; @@ -123,28 +130,35 @@ _mp_main_init(struct appdata *ad) recorder_device_state_e state = RECORDER_DEVICE_STATE_IDLE; recorder_get_device_state(RECORDER_TYPE_VIDEO, &state); - int ret = recorder_add_device_state_changed_cb(mp_recorder_state_cb, ad, &ad->recorder_id); + int ret = + recorder_add_device_state_changed_cb(mp_recorder_state_cb, ad, + &ad->recorder_id); if (ret != RECORDER_ERROR_NONE) { ERROR_TRACE("Unable to register callback for recorder state"); } /* window focus in/out event */ - evas_object_smart_callback_add(ad->win_main, "focused", _mp_main_win_focus_in_cb, ad); - evas_object_smart_callback_add(ad->win_main, "unfocused", _mp_main_win_focus_out_cb, ad); + evas_object_smart_callback_add(ad->win_main, "focused", + _mp_main_win_focus_in_cb, ad); + evas_object_smart_callback_add(ad->win_main, "unfocused", + _mp_main_win_focus_out_cb, ad); return TRUE; } -static bool -_mp_main_is_launching_available(struct appdata *ad) +static bool _mp_main_is_launching_available(struct appdata *ad) { if (!ad) { return false; } if (ad->low_battery_status == APP_EVENT_LOW_BATTERY_POWER_OFF) { - Evas_Object *popup = mp_popup_create(ad->win_main, MP_POPUP_NORMAL, NULL, ad, _mp_main_exit_cb, ad); - elm_object_text_set(popup, GET_SYS_STR("IDS_COM_BODY_LOW_BATTERY")); - mp_popup_button_set(popup, MP_POPUP_BTN_1, "IDS_COM_SK_OK", MP_POPUP_YES); + Evas_Object *popup = + mp_popup_create(ad->win_main, MP_POPUP_NORMAL, NULL, ad, + _mp_main_exit_cb, ad); + elm_object_text_set(popup, + GET_SYS_STR("IDS_COM_BODY_LOW_BATTERY")); + mp_popup_button_set(popup, MP_POPUP_BTN_1, "IDS_COM_SK_OK", + MP_POPUP_YES); mp_popup_timeout_set(popup, MP_POPUP_TIMEOUT); evas_object_show(ad->win_main); evas_object_show(popup); @@ -152,9 +166,14 @@ _mp_main_is_launching_available(struct appdata *ad) } if (mp_check_mass_storage_mode()) { - Evas_Object *popup = mp_popup_create(ad->win_main, MP_POPUP_NORMAL, NULL, ad, _mp_main_exit_cb, ad); - elm_object_text_set(popup, GET_SYS_STR("IDS_COM_POP_UNABLE_TO_USE_DURING_MASS_STORAGE_MODE")); - mp_popup_button_set(popup, MP_POPUP_BTN_1, "IDS_COM_SK_OK", MP_POPUP_YES); + Evas_Object *popup = + mp_popup_create(ad->win_main, MP_POPUP_NORMAL, NULL, ad, + _mp_main_exit_cb, ad); + elm_object_text_set(popup, + GET_SYS_STR + ("IDS_COM_POP_UNABLE_TO_USE_DURING_MASS_STORAGE_MODE")); + mp_popup_button_set(popup, MP_POPUP_BTN_1, "IDS_COM_SK_OK", + MP_POPUP_YES); mp_popup_timeout_set(popup, MP_POPUP_TIMEOUT); evas_object_show(ad->win_main); evas_object_show(popup); @@ -163,9 +182,11 @@ _mp_main_is_launching_available(struct appdata *ad) return true; } -static void _mp_main_win_visibility_withdrawn_cb(void *data, Evas_Object *obj, void *event) +static void _mp_main_win_visibility_withdrawn_cb(void *data, + Evas_Object * obj, + void *event) { - struct appdata *ad = (struct appdata *)data; + struct appdata *ad = (struct appdata *) data; mp_retm_if(ad == NULL, "ad is null"); ad->app_is_foreground = false; mp_player_mgr_vol_type_unset(); @@ -174,9 +195,11 @@ static void _mp_main_win_visibility_withdrawn_cb(void *data, Evas_Object *obj, v DEBUG_TRACE("ad->app_is_foreground: %d", ad->app_is_foreground); } -static void _mp_main_win_visibility_normal_cb(void *data, Evas_Object *obj, void *event) +static void _mp_main_win_visibility_normal_cb(void *data, + Evas_Object * obj, + void *event) { - struct appdata *ad = (struct appdata *)data; + struct appdata *ad = (struct appdata *) data; mp_retm_if(ad == NULL, "ad is null"); ad->app_is_foreground = true; @@ -186,21 +209,23 @@ static void _mp_main_win_visibility_normal_cb(void *data, Evas_Object *obj, void DEBUG_TRACE("ad->app_is_foreground: %d", ad->app_is_foreground); } -static void _mp_main_win_focus_in_cb(void *data, Evas_Object *obj, void *event) +static void _mp_main_win_focus_in_cb(void *data, Evas_Object * obj, + void *event) { - struct appdata *ad = (struct appdata *)data; + struct appdata *ad = (struct appdata *) data; mp_retm_if(ad == NULL, "ad is null"); ad->is_focus_out = false; DEBUG_TRACE("ad->is_focus_out: %d", ad->is_focus_out); - MpPlayerView_t *player_view = (MpPlayerView_t *)GET_PLAYER_VIEW; + MpPlayerView_t *player_view = (MpPlayerView_t *) GET_PLAYER_VIEW; if (player_view) { mp_player_view_refresh(player_view); } - mp_volume_key_grab_condition_set(MP_VOLUME_KEY_GRAB_COND_WINDOW_FOCUS, true); + mp_volume_key_grab_condition_set(MP_VOLUME_KEY_GRAB_COND_WINDOW_FOCUS, + true); } static void _show_minicontroller(struct appdata *ad) @@ -219,7 +244,8 @@ static void _show_minicontroller(struct appdata *ad) } } - if (ad->player_state == PLAY_STATE_PAUSED || ad->player_state == PLAY_STATE_PLAYING) { + if (ad->player_state == PLAY_STATE_PAUSED + || ad->player_state == PLAY_STATE_PLAYING) { if (!ad->win_minicon) { mp_minicontroller_create(ad); } else { @@ -236,10 +262,11 @@ static void _show_minicontroller(struct appdata *ad) } } -static void _mp_main_win_focus_out_cb(void *data, Evas_Object *obj, void *event) +static void _mp_main_win_focus_out_cb(void *data, Evas_Object * obj, + void *event) { startfunc; - struct appdata *ad = (struct appdata *)data; + struct appdata *ad = (struct appdata *) data; mp_retm_if(ad == NULL, "ad is null"); ad->is_focus_out = true; @@ -251,14 +278,17 @@ static void _mp_main_win_focus_out_cb(void *data, Evas_Object *obj, void *event) The Main Screen of the Music Application will be displayed. */ _show_minicontroller(ad); - mp_volume_key_grab_condition_set(MP_VOLUME_KEY_GRAB_COND_WINDOW_FOCUS, false); + mp_volume_key_grab_condition_set(MP_VOLUME_KEY_GRAB_COND_WINDOW_FOCUS, + false); } -static void __mp_main_lcd_state_changed_cb(device_callback_e type, void *state_data, void *user_data) +static void __mp_main_lcd_state_changed_cb(device_callback_e type, + void *state_data, + void *user_data) { struct appdata *ad = user_data; MP_CHECK(ad); - display_state_e state = (display_state_e)state_data; + display_state_e state = (display_state_e) state_data; DEBUG_TRACE("power_state: %d", state); if (state == DISPLAY_STATE_SCREEN_OFF) { @@ -269,13 +299,12 @@ static void __mp_main_lcd_state_changed_cb(device_callback_e type, void *state_d if (ad->duration_change_timer) { ecore_timer_freeze(ad->duration_change_timer); } - #ifdef MP_FEATURE_LOCKSCREEN mp_lockscreenmini_on_lcd_event(ad, false); #endif } else { - /*POWER_STATE_SCREEN_DIM or POWER_STATE_NORMAL*/ + /*POWER_STATE_SCREEN_DIM or POWER_STATE_NORMAL */ if (ad->is_lcd_off) { ad->is_lcd_off = false; /* for refresh progressbar */ @@ -291,10 +320,10 @@ static void __mp_main_lcd_state_changed_cb(device_callback_e type, void *state_d mp_lockscreenmini_update(ad); #endif - if (ad->duration_change_timer && mp_player_mgr_get_state() == PLAYER_STATE_PLAYING) { + if (ad->duration_change_timer + && mp_player_mgr_get_state() == PLAYER_STATE_PLAYING) { MP_TIMER_THAW(ad->duration_change_timer); } - #ifdef MP_FEATURE_LOCKSCREEN mp_lockscreenmini_on_lcd_event(ad, true); #endif @@ -303,7 +332,7 @@ static void __mp_main_lcd_state_changed_cb(device_callback_e type, void *state_d } } -static bool _parse_widget_event(bundle *b, bool *activate_window) +static bool _parse_widget_event(bundle * b, bool * activate_window) { startfunc; MP_CHECK_FALSE(b); @@ -368,10 +397,13 @@ static bool _parse_widget_event(bundle *b, bool *activate_window) mp_playlist_mgr_clear(ad->playlist_mgr); char *data_path = app_get_data_path(); - char group_list_data[1024] = {0}; - snprintf(group_list_data, 1024, "%s%s", data_path, MP_GROUP_LIST_DATA); + char group_list_data[1024] = { 0 }; + snprintf(group_list_data, 1024, "%s%s", data_path, + MP_GROUP_LIST_DATA); free(data_path); - mp_playlist_mgr_lazy_append_with_file(ad->playlist_mgr, group_list_data, NULL, index); + mp_playlist_mgr_lazy_append_with_file(ad->playlist_mgr, + group_list_data, NULL, + index); return true; } @@ -379,7 +411,9 @@ static bool _parse_widget_event(bundle *b, bool *activate_window) } static void -_mp_main_message_port_cb(int local_port_id, const char *remote_app_id, const char *remote_port, bool trusted_remote_port, bundle *message, void *user_data) +_mp_main_message_port_cb(int local_port_id, const char *remote_app_id, + const char *remote_port, bool trusted_remote_port, + bundle * message, void *user_data) { eventfunc; MP_CHECK(message); @@ -391,7 +425,7 @@ _mp_main_message_port_cb(int local_port_id, const char *remote_app_id, const cha if (ret) { DEBUG_TRACE("message port done"); if (active_window) { - struct appdata * ad = mp_util_get_appdata(); + struct appdata *ad = mp_util_get_appdata(); if (ad && ad->win_main) { elm_win_inwin_activate(ad->win_main); } @@ -399,7 +433,8 @@ _mp_main_message_port_cb(int local_port_id, const char *remote_app_id, const cha } } -static void _mp_main_conformant_sip_on_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_main_conformant_sip_on_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; struct appdata *ad = data; @@ -410,7 +445,8 @@ static void _mp_main_conformant_sip_on_cb(void *data, Evas_Object *obj, void *ev mp_view_mgr_post_event(ad->view_manager, MP_SIP_STATE_CHANGED); } -static void _mp_main_conformant_sip_off_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_main_conformant_sip_off_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; struct appdata *ad = data; @@ -421,8 +457,7 @@ static void _mp_main_conformant_sip_off_cb(void *data, Evas_Object *obj, void *e mp_view_mgr_post_event(ad->view_manager, MP_SIP_STATE_CHANGED); } -static Eina_Bool -_mp_main_app_init_idler_cb(void *data) +static Eina_Bool _mp_main_app_init_idler_cb(void *data) { startfunc; @@ -434,12 +469,20 @@ _mp_main_app_init_idler_cb(void *data) if (!mp_app_noti_init(ad)) { ERROR_TRACE("Error when noti init"); } - ad->key_down = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, mp_app_key_down_cb, ad); - ad->key_up = ecore_event_handler_add(ECORE_EVENT_KEY_UP, mp_app_key_up_cb, ad); - evas_object_smart_callback_add(ad->win_main, "withdrawn", _mp_main_win_visibility_withdrawn_cb, ad); - evas_object_smart_callback_add(ad->win_main, "normal", _mp_main_win_visibility_normal_cb, ad); - - int port_id = message_port_register_local_port(MP_MESSAGE_PORT_LIVEBOX, _mp_main_message_port_cb, NULL); + ad->key_down = + ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, mp_app_key_down_cb, + ad); + ad->key_up = + ecore_event_handler_add(ECORE_EVENT_KEY_UP, mp_app_key_up_cb, ad); + evas_object_smart_callback_add(ad->win_main, "withdrawn", + _mp_main_win_visibility_withdrawn_cb, + ad); + evas_object_smart_callback_add(ad->win_main, "normal", + _mp_main_win_visibility_normal_cb, ad); + + int port_id = + message_port_register_local_port(MP_MESSAGE_PORT_LIVEBOX, + _mp_main_message_port_cb, NULL); DEBUG_TRACE("message port id = %d", port_id); #ifdef MP_FEATURE_AUTO_OFF @@ -447,10 +490,12 @@ _mp_main_app_init_idler_cb(void *data) #endif #ifdef MP_FEATURE_PLAY_SPEED - mp_setting_set_play_speed_change_callback(mp_app_play_speed_changed_cb, ad); + mp_setting_set_play_speed_change_callback(mp_app_play_speed_changed_cb, + ad); #endif - device_add_callback(DEVICE_CALLBACK_DISPLAY_STATE, __mp_main_lcd_state_changed_cb, ad); + device_add_callback(DEVICE_CALLBACK_DISPLAY_STATE, + __mp_main_lcd_state_changed_cb, ad); if (!ad->playlist_mgr) { mp_common_create_playlist_mgr(); @@ -458,26 +503,37 @@ _mp_main_app_init_idler_cb(void *data) if (ad->playlist_mgr && ad->current_track_info) { if (ad->current_track_info->uri) { char *data_path = app_get_data_path(); - char nowplaying_list_data[1024] = {0}; - snprintf(nowplaying_list_data, 1024, "%s%s", data_path, MP_NOWPLAYING_LIST_DATA); + char nowplaying_list_data[1024] = { 0 }; + snprintf(nowplaying_list_data, 1024, "%s%s", data_path, + MP_NOWPLAYING_LIST_DATA); free(data_path); - mp_playlist_mgr_lazy_append_with_file(ad->playlist_mgr, nowplaying_list_data, ad->current_track_info->uri, -1); + mp_playlist_mgr_lazy_append_with_file(ad->playlist_mgr, + nowplaying_list_data, + ad-> + current_track_info-> + uri, -1); } } } if (ad->conformant) { - evas_object_smart_callback_add(ad->conformant, "virtualkeypad,state,on", _mp_main_conformant_sip_on_cb, ad); - evas_object_smart_callback_add(ad->conformant, "virtualkeypad,state,off", _mp_main_conformant_sip_off_cb, ad); + evas_object_smart_callback_add(ad->conformant, + "virtualkeypad,state,on", + _mp_main_conformant_sip_on_cb, ad); + evas_object_smart_callback_add(ad->conformant, + "virtualkeypad,state,off", + _mp_main_conformant_sip_off_cb, ad); } mp_volume_init(ad->win_main); #ifdef MP_SOUND_PLAYER - mp_volume_key_grab_condition_set(MP_VOLUME_KEY_GRAB_COND_VIEW_VISIBLE, true); + mp_volume_key_grab_condition_set(MP_VOLUME_KEY_GRAB_COND_VIEW_VISIBLE, + true); #endif mp_http_mgr_create(ad); - if (mp_view_get_nowplaying_show_flag(GET_ALL_VIEW) && ad->player_state == PLAY_STATE_NONE) { + if (mp_view_get_nowplaying_show_flag(GET_ALL_VIEW) + && ad->player_state == PLAY_STATE_NONE) { ad->paused_by_user = true; mp_play_new_file(ad, true); ad->prepare_by_init = true; @@ -489,7 +545,9 @@ _mp_main_app_init_idler_cb(void *data) return ECORE_CALLBACK_CANCEL; } -static bool __mp_main_app_control_extra_data_cb(app_control_h app_control, const char *key, void *user_data) +static bool __mp_main_app_control_extra_data_cb(app_control_h app_control, + const char *key, + void *user_data) { MP_CHECK_FALSE(app_control); char *value = NULL; @@ -516,15 +574,18 @@ static void _mp_main_parse_get_playlist(struct appdata *ad) count = 100; } - mp_media_info_list_create(&media, track_type, NULL, NULL, NULL, 0, 0, count); + mp_media_info_list_create(&media, track_type, NULL, NULL, NULL, 0, 0, + count); mp_common_create_playlist_mgr(); mp_playlist_mgr_clear(ad->playlist_mgr); - mp_util_append_media_list_item_to_playlist(ad->playlist_mgr, media, count, 0, NULL); + mp_util_append_media_list_item_to_playlist(ad->playlist_mgr, media, + count, 0, NULL); mp_media_info_list_destroy(media); } static int -_mp_main_parse_request_type(struct appdata *ad, app_control_h app_control, const char *request, bool *start_playback) +_mp_main_parse_request_type(struct appdata *ad, app_control_h app_control, + const char *request, bool * start_playback) { int ret = 0; @@ -540,7 +601,8 @@ _mp_main_parse_request_type(struct appdata *ad, app_control_h app_control, const mp_common_create_playlist_mgr(); - if (!app_control_get_extra_data_array(app_control, MP_EXTRA_KEY_PLAY_FILES, &path_array, &count)) { + if (!app_control_get_extra_data_array + (app_control, MP_EXTRA_KEY_PLAY_FILES, &path_array, &count)) { if (path_array == NULL) { return -1; } @@ -552,45 +614,62 @@ _mp_main_parse_request_type(struct appdata *ad, app_control_h app_control, const mp_playlist_mgr_clear(ad->playlist_mgr); for (i = 0; i < count; i++) { token = path_array[i]; - mp_playlist_mgr_item_append(ad->playlist_mgr, token, NULL, NULL, NULL, MP_TRACK_URI); + mp_playlist_mgr_item_append(ad->playlist_mgr, token, NULL, + NULL, NULL, MP_TRACK_URI); } - mp_playlist_mgr_set_current(ad->playlist_mgr, mp_playlist_mgr_get_nth(ad->playlist_mgr, 0)); + mp_playlist_mgr_set_current(ad->playlist_mgr, + mp_playlist_mgr_get_nth(ad-> + playlist_mgr, + 0)); *start_playback = true; free(path_array); - } else if (!app_control_get_extra_data(app_control, MP_EXTRA_KEY_PLAY_FILES, &val)) { + } else + if (!app_control_get_extra_data + (app_control, MP_EXTRA_KEY_PLAY_FILES, &val)) { str = val; char *title = NULL; - if (!app_control_get_extra_data(app_control, MP_EXTRA_KEY_PLAY_FILE_COUNT, &val)) { + if (!app_control_get_extra_data + (app_control, MP_EXTRA_KEY_PLAY_FILE_COUNT, &val)) { if (val) { count = atoi(val); } } IF_FREE(val); - if (!app_control_get_extra_data(app_control, APP_CONTROL_DATA_TITLE, &title)) { + if (!app_control_get_extra_data + (app_control, APP_CONTROL_DATA_TITLE, &title)) { DEBUG_TRACE("Get title error"); } mp_playlist_mgr_clear(ad->playlist_mgr); for (i = 0; i < count; i++, str = NULL) { - token = strtok_r(str, MP_EXTRA_KEY_PLAY_FILE_DELIM, &save_ptr); + token = + strtok_r(str, MP_EXTRA_KEY_PLAY_FILE_DELIM, &save_ptr); if (token == NULL) { break; } if (count == 1) { - mp_playlist_mgr_item_append(ad->playlist_mgr, token, NULL, title, NULL, MP_TRACK_URI); + mp_playlist_mgr_item_append(ad->playlist_mgr, token, + NULL, title, NULL, + MP_TRACK_URI); } else { - mp_playlist_mgr_item_append(ad->playlist_mgr, token, NULL, NULL, NULL, MP_TRACK_URI); + mp_playlist_mgr_item_append(ad->playlist_mgr, token, + NULL, NULL, NULL, + MP_TRACK_URI); } } - mp_playlist_mgr_set_current(ad->playlist_mgr, mp_playlist_mgr_get_nth(ad->playlist_mgr, 0)); + mp_playlist_mgr_set_current(ad->playlist_mgr, + mp_playlist_mgr_get_nth(ad-> + playlist_mgr, + 0)); *start_playback = true; } IF_FREE(val); } else if (!g_strcmp0(request, MP_REQ_TYPE_AUTO_PLAYLIST)) { - if (!app_control_get_extra_data(app_control, MP_EXTRA_KEY_PLAY_PLAYLIST, &val)) { + if (!app_control_get_extra_data + (app_control, MP_EXTRA_KEY_PLAY_PLAYLIST, &val)) { mp_media_list_h media = NULL; int count = 0; mp_track_type_e type = 0; @@ -611,29 +690,37 @@ _mp_main_parse_request_type(struct appdata *ad, app_control_h app_control, const if (count > 100) { count = 100; } - mp_media_info_list_create(&media, type, NULL, NULL, NULL, 0, 0, count); + mp_media_info_list_create(&media, type, NULL, NULL, NULL, 0, 0, + count); mp_common_create_playlist_mgr(); mp_playlist_mgr_clear(ad->playlist_mgr); - mp_util_append_media_list_item_to_playlist(ad->playlist_mgr, media, count, 0, NULL); + mp_util_append_media_list_item_to_playlist(ad->playlist_mgr, + media, count, 0, + NULL); mp_media_info_list_destroy(media); *start_playback = true; } IF_FREE(val); } else if (!g_strcmp0(request, MP_REQ_TYPE_USER_PLAYLIST)) { - if (!app_control_get_extra_data(app_control, MP_EXTRA_KEY_PLAY_PLAYLIST, &val)) { + if (!app_control_get_extra_data + (app_control, MP_EXTRA_KEY_PLAY_PLAYLIST, &val)) { mp_media_list_h media = NULL; int count = 0; int id = 0; mp_media_info_playlist_get_id_by_name(val, &id); - mp_media_info_list_count(MP_TRACK_BY_PLAYLIST, NULL, NULL, NULL, id, &count); + mp_media_info_list_count(MP_TRACK_BY_PLAYLIST, NULL, NULL, + NULL, id, &count); if (count > 100) { count = 100; } - mp_media_info_list_create(&media, MP_TRACK_BY_PLAYLIST, NULL, NULL, NULL, id, 0, count); + mp_media_info_list_create(&media, MP_TRACK_BY_PLAYLIST, NULL, + NULL, NULL, id, 0, count); mp_common_create_playlist_mgr(); mp_playlist_mgr_clear(ad->playlist_mgr); - mp_util_append_media_list_item_to_playlist(ad->playlist_mgr, media, count, 0, NULL); + mp_util_append_media_list_item_to_playlist(ad->playlist_mgr, + media, count, 0, + NULL); mp_media_info_list_destroy(media); *start_playback = true; } @@ -688,7 +775,8 @@ _mp_main_set_transient(struct appdata *ad, app_control_h app_control) #ifndef MP_SOUND_PLAYER static void -_mp_main_parse_playback_control(struct appdata *ad, app_control_h app_control) +_mp_main_parse_playback_control(struct appdata *ad, + app_control_h app_control) { MP_CHECK(ad); MP_CHECK(app_control); @@ -702,7 +790,8 @@ _mp_main_parse_playback_control(struct appdata *ad, app_control_h app_control) if (!g_strcmp0(control, "PREV")) { current = mp_playlist_mgr_get_prev(ad->playlist_mgr); } else if (!g_strcmp0(control, "NEXT")) { - current = mp_playlist_mgr_get_next(ad->playlist_mgr, true, false); + current = + mp_playlist_mgr_get_next(ad->playlist_mgr, true, false); } if (current) { @@ -729,15 +818,21 @@ _mp_main_create_default_playing_list(struct appdata *ad, int index) mp_playlist_mgr_clear(ad->playlist_mgr); char *data_path = app_get_data_path(); - char nowplaying_list_data[1024] = {0}; - snprintf(nowplaying_list_data, 1024, "%s%s", data_path, MP_NOWPLAYING_LIST_DATA); + char nowplaying_list_data[1024] = { 0 }; + snprintf(nowplaying_list_data, 1024, "%s%s", data_path, + MP_NOWPLAYING_LIST_DATA); free(data_path); - mp_playlist_mgr_lazy_append_with_file(ad->playlist_mgr, nowplaying_list_data, last_played_path, -1); + mp_playlist_mgr_lazy_append_with_file(ad->playlist_mgr, + nowplaying_list_data, + last_played_path, -1); if (mp_playlist_mgr_count(ad->playlist_mgr) == 0) { - mp_media_info_list_count(MP_TRACK_ALL, NULL, NULL, NULL, 0, &count); - mp_media_info_list_create(&all, MP_TRACK_ALL, NULL, NULL, NULL, 0, 0, count); - mp_util_append_media_list_item_to_playlist(ad->playlist_mgr, all, count, index, path); + mp_media_info_list_count(MP_TRACK_ALL, NULL, NULL, NULL, 0, + &count); + mp_media_info_list_create(&all, MP_TRACK_ALL, NULL, NULL, NULL, 0, + 0, count); + mp_util_append_media_list_item_to_playlist(ad->playlist_mgr, all, + count, index, path); mp_media_info_list_destroy(all); } IF_FREE(last_played_path); @@ -745,7 +840,8 @@ _mp_main_create_default_playing_list(struct appdata *ad, int index) #endif static int -_mp_main_parse_livebox_event(app_control_h app_control, bool *activate_window, bool *start_playback) +_mp_main_parse_livebox_event(app_control_h app_control, + bool * activate_window, bool * start_playback) { #ifndef MP_SOUND_PLAYER startfunc; @@ -779,13 +875,16 @@ _mp_main_parse_livebox_event(app_control_h app_control, bool *activate_window, b mp_play_control_shuffle_set(ad, TRUE); } else if (!g_strcmp0(value, MP_LB_EVENT_REPEAT_ALL_CLICKED)) { mp_setting_set_repeat_state(MP_SETTING_REP_1); - mp_playlist_mgr_set_repeat(ad->playlist_mgr, MP_PLST_REPEAT_ONE); + mp_playlist_mgr_set_repeat(ad->playlist_mgr, + MP_PLST_REPEAT_ONE); } else if (!g_strcmp0(value, MP_LB_EVENT_REPEAT_1_CLICKED)) { mp_setting_set_repeat_state(MP_SETTING_REP_NON); - mp_playlist_mgr_set_repeat(ad->playlist_mgr, MP_PLST_REPEAT_NONE); + mp_playlist_mgr_set_repeat(ad->playlist_mgr, + MP_PLST_REPEAT_NONE); } else if (!g_strcmp0(value, MP_LB_EVENT_REPEAT_A_CLICKED)) { mp_setting_set_repeat_state(MP_SETTING_REP_ALL); - mp_playlist_mgr_set_repeat(ad->playlist_mgr, MP_PLST_REPEAT_ALL); + mp_playlist_mgr_set_repeat(ad->playlist_mgr, + MP_PLST_REPEAT_ALL); } IF_FREE(value); @@ -793,11 +892,11 @@ _mp_main_parse_livebox_event(app_control_h app_control, bool *activate_window, b } else { _mp_main_create_default_playing_list(ad, 0); if (g_strcmp0(value, MP_LB_EVENT_NEXT_PRESSED) && - g_strcmp0(value, MP_LB_EVENT_NEXT_RELEASED) && - g_strcmp0(value, MP_LB_EVENT_PREV_PRESSED) && - g_strcmp0(value, MP_LB_EVENT_PREV_RELEASED) && - g_strcmp0(value, MP_LB_EVENT_PLAY_CLICKED) && - g_strcmp0(value, MP_LB_EVENT_PAUSE_CLICKED)) { + g_strcmp0(value, MP_LB_EVENT_NEXT_RELEASED) && + g_strcmp0(value, MP_LB_EVENT_PREV_PRESSED) && + g_strcmp0(value, MP_LB_EVENT_PREV_RELEASED) && + g_strcmp0(value, MP_LB_EVENT_PLAY_CLICKED) && + g_strcmp0(value, MP_LB_EVENT_PAUSE_CLICKED)) { *start_playback = false; } else { *start_playback = true; @@ -813,7 +912,9 @@ _mp_main_parse_livebox_event(app_control_h app_control, bool *activate_window, b } } - } else if (!app_control_get_extra_data(app_control, MP_NOWPLAYING_LIST_INDEX, &value)) { + } else + if (!app_control_get_extra_data + (app_control, MP_NOWPLAYING_LIST_INDEX, &value)) { *activate_window = false; int index = 0; if (value) { @@ -821,7 +922,8 @@ _mp_main_parse_livebox_event(app_control_h app_control, bool *activate_window, b } IF_FREE(value); - app_control_get_extra_data(app_control, MP_REFRESH_PLAYLIST, &value); + app_control_get_extra_data(app_control, MP_REFRESH_PLAYLIST, + &value); mp_play_destory(ad); @@ -829,10 +931,13 @@ _mp_main_parse_livebox_event(app_control_h app_control, bool *activate_window, b mp_playlist_mgr_clear(ad->playlist_mgr); char *data_path = app_get_data_path(); - char group_list_data[1024] = {0}; - snprintf(group_list_data, 1024, "%s%s", data_path, MP_GROUP_LIST_DATA); + char group_list_data[1024] = { 0 }; + snprintf(group_list_data, 1024, "%s%s", data_path, + MP_GROUP_LIST_DATA); free(data_path); - mp_playlist_mgr_lazy_append_with_file(ad->playlist_mgr, group_list_data, NULL, index); + mp_playlist_mgr_lazy_append_with_file(ad->playlist_mgr, + group_list_data, NULL, + index); *start_playback = true; return true; } @@ -856,7 +961,8 @@ _mp_main_parse_livebox_event(app_control_h app_control, bool *activate_window, b return 0; } -static bool _mp_main_check_servic_type(struct appdata *ad, app_control_h app_control) +static bool _mp_main_check_servic_type(struct appdata *ad, + app_control_h app_control) { startfunc; MP_CHECK_FALSE(app_control); @@ -872,7 +978,8 @@ static bool _mp_main_check_servic_type(struct appdata *ad, app_control_h app_con app_control_create(&reply); app_control_add_extra_data(reply, "resultCode", "RESULT_OK"); app_control_add_extra_data(reply, "serviceType", type); - app_control_reply_to_launch_request(reply, app_control, APP_CONTROL_RESULT_SUCCEEDED); + app_control_reply_to_launch_request(reply, app_control, + APP_CONTROL_RESULT_SUCCEEDED); app_control_destroy(reply); ret = true; @@ -883,13 +990,16 @@ static bool _mp_main_check_servic_type(struct appdata *ad, app_control_h app_con } static int -_mp_main_parse_service(struct appdata *ad, app_control_h app_control, bool *activate_window, bool *start_playback) +_mp_main_parse_service(struct appdata *ad, app_control_h app_control, + bool * activate_window, bool * start_playback) { startfunc; int ret = 0; MP_CHECK_VAL(app_control, -1); - app_control_foreach_extra_data(app_control, __mp_main_app_control_extra_data_cb, NULL); + app_control_foreach_extra_data(app_control, + __mp_main_app_control_extra_data_cb, + NULL); char *value = NULL; #ifdef MP_SOUND_PLAYER @@ -898,15 +1008,16 @@ _mp_main_parse_service(struct appdata *ad, app_control_h app_control, bool *acti /* create playlist mgr before parse service */ mp_common_create_playlist_mgr(); - if(!app_control_get_extra_data(app_control, IS_TEMP_FILE, &value)) { - DEBUG_TRACE("This is a temporary file.... Do not display detail view"); + if (!app_control_get_extra_data(app_control, IS_TEMP_FILE, &value)) { + DEBUG_TRACE + ("This is a temporary file.... Do not display detail view"); ad->disable_detail_view = true; } else { ERROR_TRACE("Menu State cannot be determined"); ad->disable_detail_view = false; } - if(!app_control_get_extra_data(app_control, APP_EXIT_STATUS, &value)) { + if (!app_control_get_extra_data(app_control, APP_EXIT_STATUS, &value)) { DEBUG_TRACE("Application Exit Status is %s", value); ad->exit_status = false; } else { @@ -916,7 +1027,8 @@ _mp_main_parse_service(struct appdata *ad, app_control_h app_control, bool *acti if (!app_control_get_extra_data(app_control, MP_REQ_TYPE, &value)) { DEBUG_TRACE("request_type: %s", value); - if (_mp_main_parse_request_type(ad, app_control, value, start_playback)) { + if (_mp_main_parse_request_type + (ad, app_control, value, start_playback)) { WARN_TRACE("Error: _mp_main_parse_request_type"); ret = -1; } @@ -942,7 +1054,7 @@ _mp_main_parse_service(struct appdata *ad, app_control_h app_control, bool *acti } _mp_main_set_transient(ad, app_control); -#else /* MP_SOUND_PLAYER */ +#else /* MP_SOUND_PLAYER */ if (!app_control_get_extra_data(app_control, "Launch By", &value)) { if (!g_strcmp0(value, "By Sfinder")) { DEBUG_TRACE("Launch by Sfinder"); @@ -952,9 +1064,13 @@ _mp_main_parse_service(struct appdata *ad, app_control_h app_control, bool *acti app_control_get_uri(app_control, &uri); mp_common_create_playlist_mgr(); - mp_media_info_list_count(MP_TRACK_ALL, NULL, NULL, NULL, 0, &count); - mp_media_info_list_create(&media, MP_TRACK_ALL, NULL, NULL, NULL, 0, 0, count); - mp_util_append_media_list_item_to_playlist(ad->playlist_mgr, media, count, 0, uri); + mp_media_info_list_count(MP_TRACK_ALL, NULL, NULL, NULL, 0, + &count); + mp_media_info_list_create(&media, MP_TRACK_ALL, NULL, NULL, + NULL, 0, 0, count); + mp_util_append_media_list_item_to_playlist(ad->playlist_mgr, + media, count, 0, + uri); mp_media_info_list_destroy(media); IF_FREE(uri); @@ -968,7 +1084,8 @@ _mp_main_parse_service(struct appdata *ad, app_control_h app_control, bool *acti if (!app_control_get_extra_data(app_control, MP_REQ_TYPE, &value)) { DEBUG_TRACE("request_type: %s", value); - if (_mp_main_parse_request_type(ad, app_control, value, start_playback)) { + if (_mp_main_parse_request_type + (ad, app_control, value, start_playback)) { WARN_TRACE("Error: _mp_main_parse_request_type"); ret = -1; } else if (!g_strcmp0(value, MP_LIVEBOX)) { @@ -981,9 +1098,13 @@ _mp_main_parse_service(struct appdata *ad, app_control_h app_control, bool *acti mp_common_create_playlist_mgr(); app_control_get_extra_data(app_control, MP_LIVEBOX_URI, &uri); - mp_media_info_list_count(MP_TRACK_ALL, NULL, NULL, NULL, 0, &count); - mp_media_info_list_create(&media, MP_TRACK_ALL, NULL, NULL, NULL, 0, 0, count); - mp_util_append_media_list_item_to_playlist(ad->playlist_mgr, media, count, 0, uri); + mp_media_info_list_count(MP_TRACK_ALL, NULL, NULL, NULL, 0, + &count); + mp_media_info_list_create(&media, MP_TRACK_ALL, NULL, NULL, + NULL, 0, 0, count); + mp_util_append_media_list_item_to_playlist(ad->playlist_mgr, + media, count, 0, + uri); mp_media_info_list_destroy(media); *start_playback = true; @@ -995,7 +1116,8 @@ _mp_main_parse_service(struct appdata *ad, app_control_h app_control, bool *acti IF_FREE(value); } else { if (!app_control_get_extra_data(app_control, MP_MM_KEY, &value)) { - DEBUG_TRACE("mm key event, ad->player_state : %d", ad->player_state); + DEBUG_TRACE("mm key event, ad->player_state : %d", + ad->player_state); *activate_window = false; /* Do not start playback on pause cd. */ @@ -1014,33 +1136,30 @@ _mp_main_parse_service(struct appdata *ad, app_control_h app_control, bool *acti _mp_main_parse_playback_control(ad, app_control); } -END: + END: #endif IF_FREE(value); return ret; } -static void -_mp_atexit_cb(void) +static void _mp_atexit_cb(void) { ERROR_TRACE("#exit() invoked. music-player is exiting"); } -static void -_mp_csc_feature_init(struct appdata *ad) +static void _mp_csc_feature_init(struct appdata *ad) { MP_CHECK(ad); } /**< Called before main loop */ -static bool -mp_create(void *data) +static bool mp_create(void *data) { eventfunc; PROFILE_IN("mp_create"); struct appdata *ad = data; - g_ad = (struct appdata *)data; + g_ad = (struct appdata *) data; atexit(_mp_atexit_cb); PROFILE_IN("_mp_csc_feature_get"); @@ -1050,8 +1169,8 @@ mp_create(void *data) MP_CHECK_VAL(ad, EINA_FALSE); PROFILE_IN("elm_theme_extension_add"); - /* do extension add before add elm object.*/ - char edje_path[1024] ={0}; + /* do extension add before add elm object. */ + char edje_path[1024] = { 0 }; char *path = app_get_resource_path(); if (path == NULL) { return false; @@ -1062,7 +1181,7 @@ mp_create(void *data) elm_theme_extension_add(NULL, edje_path); PROFILE_OUT("elm_theme_extension_add"); - char locale_path[1024] = {0}; + char locale_path[1024] = { 0 }; snprintf(locale_path, 1024, "%s%s", path, LOCALE_DIR); free(path); PROFILE_IN("bindtextdomain"); @@ -1071,12 +1190,17 @@ mp_create(void *data) #ifdef MP_SOUND_PLAYER if (_mp_is_current_focus_available(ad) != 0) { - ERROR_TRACE("Some other application has the focus currently... Returning..."); + ERROR_TRACE + ("Some other application has the focus currently... Returning..."); char *message = STR_MP_UNABLE_TO_PLAY_DURING_CALL; if (message) { - int ret = notification_status_message_post(dgettext("music-player", message)); + int ret = + notification_status_message_post(dgettext + ("music-player", + message)); if (ret != 0) { - ERROR_TRACE("notification_status_message_post()... [0x%x]", ret); + ERROR_TRACE("notification_status_message_post()... [0x%x]", + ret); } else { DEBUG_TRACE("message: [%s]", message); } @@ -1111,9 +1235,10 @@ mp_create(void *data) MP_CHECK_FALSE(conformant); elm_object_signal_emit(conformant, "elm,state,indicator,overlap", ""); - evas_object_data_set(conformant, "overlap", (void *)EINA_TRUE); + evas_object_data_set(conformant, "overlap", (void *) EINA_TRUE); - evas_object_size_hint_weight_set(conformant, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(conformant, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); evas_object_show(conformant); elm_win_resize_object_add(ad->win_main, conformant); @@ -1133,8 +1258,7 @@ mp_create(void *data) } /**< Called after main loop */ -static void -mp_terminate(void *data) +static void mp_terminate(void *data) { eventfunc; struct appdata *ad = data; @@ -1155,13 +1279,14 @@ mp_terminate(void *data) ERROR_TRACE("Unable to remove callback for recorder state"); } - if(ad->stream_info) { - int error = sound_manager_destroy_stream_information(ad->stream_info); + if (ad->stream_info) { + int error = + sound_manager_destroy_stream_information(ad->stream_info); if (error != SOUND_MANAGER_ERROR_NONE) { - ERROR_TRACE("unable to destroy stream. error code [%x]", error); + ERROR_TRACE("unable to destroy stream. error code [%x]", + error); } } - #ifdef MP_SOUND_PLAYER mp_setting_set_nowplaying_id(0); #endif @@ -1267,8 +1392,10 @@ mp_terminate(void *data) if (music_state == PREF_PLAYER_OFF && sound_state == PREF_PLAYER_OFF) { DEBUG_TRACE("Removing indicator icon from notification panel"); if (ad->noti) { - notification_delete_all_by_type("org.tizen.music-player", NOTIFICATION_TYPE_NOTI); - notification_delete_all_by_type("org.tizen.sound-player", NOTIFICATION_TYPE_NOTI); + notification_delete_all_by_type("org.tizen.music-player", + NOTIFICATION_TYPE_NOTI); + notification_delete_all_by_type("org.tizen.sound-player", + NOTIFICATION_TYPE_NOTI); notification_free(ad->noti); } } @@ -1279,8 +1406,7 @@ mp_terminate(void *data) } /**< Called when every window goes back */ -static void -mp_pause(void *data) +static void mp_pause(void *data) { eventfunc; int ret = 0; @@ -1290,8 +1416,7 @@ mp_pause(void *data) } /**< Called when any window comes on top */ -static void -mp_resume(void *data) +static void mp_resume(void *data) { eventfunc; @@ -1306,15 +1431,15 @@ static Eina_Bool _check_app_control_timer_cb(void *data) ad->app_control_check_timer = NULL; if (g_normal_launched == false) { - DEBUG_TRACE("It's launched to check store available. terminate App"); + DEBUG_TRACE + ("It's launched to check store available. terminate App"); elm_exit(); } return false; } /**< Called at the first idler and relaunched by AUL*/ -static void -app_control(app_control_h app_control, void *data) +static void app_control(app_control_h app_control, void *data) { eventfunc; PROFILE_IN("mp_service"); @@ -1348,22 +1473,27 @@ app_control(app_control_h app_control, void *data) evas_object_show(ad->win_main); elm_win_iconified_set(ad->win_main, EINA_TRUE); elm_win_lower(ad->win_main); - ad->app_control_check_timer = ecore_timer_add(0.1, _check_app_control_timer_cb, ad); + ad->app_control_check_timer = + ecore_timer_add(0.1, _check_app_control_timer_cb, ad); WARN_TRACE("Samsung hub checked service type before launched"); } return; } PROFILE_IN("_mp_main_parse_service"); - if (_mp_main_parse_service(ad, app_control, &activate_window, &start_playback)) { + if (_mp_main_parse_service + (ad, app_control, &activate_window, &start_playback)) { ERROR_TRACE("Error: _mp_main_parse_service"); elm_exit(); return; } PROFILE_OUT("_mp_main_parse_service"); - if (_mp_main_parse_livebox_event(app_control, &activate_window, &start_playback)) { - DEBUG_TRACE("Livebox event: activate_window[%d], start_playback[%d]", activate_window, start_playback); + if (_mp_main_parse_livebox_event + (app_control, &activate_window, &start_playback)) { + DEBUG_TRACE + ("Livebox event: activate_window[%d], start_playback[%d]", + activate_window, start_playback); } if (test_uri) { @@ -1371,7 +1501,8 @@ app_control(app_control_h app_control, void *data) start_playback = true; activate_window = true; mp_common_create_playlist_mgr(); - mp_playlist_mgr_item_append(ad->playlist_mgr, test_uri, NULL, NULL, NULL, MP_TRACK_URI); + mp_playlist_mgr_item_append(ad->playlist_mgr, test_uri, NULL, NULL, + NULL, MP_TRACK_URI); } int launch_by_shortcut = false; @@ -1385,7 +1516,8 @@ app_control(app_control_h app_control, void *data) if (activate_window) { MpTab_e tab = MP_TAB_SONGS; char *shortcut_main_info = NULL; - _mp_common_parse_open_shortcut(app_control, &tab, &shortcut_main_info); + _mp_common_parse_open_shortcut(app_control, &tab, + &shortcut_main_info); if (shortcut_main_info) { launch_by_shortcut = true; } @@ -1399,7 +1531,7 @@ app_control(app_control_h app_control, void *data) mp_play_destory(ad); ad->paused_by_user = FALSE; #ifdef MP_SOUND_PLAYER - ad->app_is_foreground = true; /* for error popup */ + ad->app_is_foreground = true; /* for error popup */ #endif int ret = mp_play_new_file(ad, TRUE); if (ret) { @@ -1411,7 +1543,6 @@ app_control(app_control_h app_control, void *data) _show_minicontroller(ad); #endif } - #ifndef MP_SOUND_PLAYER if (start_playback) { DEBUG_TRACE("Start playback"); @@ -1420,7 +1551,7 @@ app_control(app_control_h app_control, void *data) mp_common_show_player_view(0, true, false, true); } else { DEBUG_TRACE("View will be created on player_start"); - goto END; /* view should be created after player started... */ + goto END; /* view should be created after player started... */ } } #else @@ -1432,7 +1563,8 @@ app_control(app_control_h app_control, void *data) #endif if (activate_window) { - mp_common_create_initial_view(ad, app_control, &launch_by_shortcut); + mp_common_create_initial_view(ad, app_control, + &launch_by_shortcut); } else { DEBUG_TRACE("unactivate window"); goto END; @@ -1468,17 +1600,19 @@ app_control(app_control_h app_control, void *data) DEBUG_TRACE("send reply to caller"); app_control_h reply = NULL; app_control_create(&reply); - app_control_reply_to_launch_request(reply, app_control, APP_CONTROL_RESULT_SUCCEEDED); + app_control_reply_to_launch_request(reply, app_control, + APP_CONTROL_RESULT_SUCCEEDED); app_control_destroy(reply); } PROFILE_OUT("mp_service"); -END: + END: if (!g_normal_launched) { if (!_mp_main_is_launching_available(ad)) { return; } - ad->app_init_idler = ecore_idler_add(_mp_main_app_init_idler_cb, ad); + ad->app_init_idler = + ecore_idler_add(_mp_main_app_init_idler_cb, ad); g_normal_launched = true; } @@ -1486,11 +1620,10 @@ END: return; } -static void -mp_low_battery(app_event_info_h event_info, void *data) +static void mp_low_battery(app_event_info_h event_info, void *data) { eventfunc; - struct appdata *ad = (struct appdata *)data; + struct appdata *ad = (struct appdata *) data; MP_CHECK(ad); app_event_low_battery_status_e status = -1; @@ -1514,11 +1647,10 @@ mp_low_battery(app_event_info_h event_info, void *data) ** also see MP_VIEW_ROTATE event which indicates rotation done */ -static void -mp_device_orientation(app_event_info_h event_info, void *data) +static void mp_device_orientation(app_event_info_h event_info, void *data) { eventfunc; - struct appdata *ad = (struct appdata *)data; + struct appdata *ad = (struct appdata *) data; MP_CHECK(ad); app_device_orientation_e orientation; app_event_get_device_orientation(event_info, &orientation); @@ -1527,7 +1659,8 @@ mp_device_orientation(app_event_info_h event_info, void *data) } void -mp_device_orientation_cb(app_device_orientation_e orientation, void *user_data) +mp_device_orientation_cb(app_device_orientation_e orientation, + void *user_data) { eventfunc; struct appdata *ad = user_data; @@ -1545,9 +1678,13 @@ __mp_language_changed_cb(app_event_info_h event_info, void *user_data) mp_popup_destroy(ad); char *locale = NULL; - int retcode = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale); + int retcode = + system_settings_get_value_string + (SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale); if (retcode != SYSTEM_SETTINGS_ERROR_NONE) { - ERROR_TRACE("Unable to fetch the current language setting with return value %d", retcode); + ERROR_TRACE + ("Unable to fetch the current language setting with return value %d", + retcode); } if (locale) { mp_error("locale is [%s]", locale); @@ -1563,8 +1700,7 @@ __mp_language_changed_cb(app_event_info_h event_info, void *user_data) #endif } -EXPORT_API int -main(int argc, char *argv[]) +EXPORT_API int main(int argc, char *argv[]) { startfunc; struct appdata ad; @@ -1572,11 +1708,11 @@ main(int argc, char *argv[]) ui_app_lifecycle_callback_s event_callbacks; int nRet = APP_ERROR_NONE; - app_event_handler_h hLowMemoryHandle; - app_event_handler_h hLowBatteryHandle; - app_event_handler_h hLanguageChangedHandle; - app_event_handler_h hDeviceOrientationChangedHandle; - app_event_handler_h hRegionFormatChangedHandle; + app_event_handler_h hLowMemoryHandle; + app_event_handler_h hLowBatteryHandle; + app_event_handler_h hLanguageChangedHandle; + app_event_handler_h hDeviceOrientationChangedHandle; + app_event_handler_h hRegionFormatChangedHandle; ad.low_battery_status = 0; @@ -1586,32 +1722,55 @@ main(int argc, char *argv[]) event_callbacks.resume = mp_resume; event_callbacks.app_control = app_control; - nRet = ui_app_add_event_handler(&hLowMemoryHandle, APP_EVENT_LOW_MEMORY, NULL, (void *)&ad); + nRet = + ui_app_add_event_handler(&hLowMemoryHandle, APP_EVENT_LOW_MEMORY, + NULL, (void *) &ad); if (nRet != APP_ERROR_NONE) { - WARN_TRACE("APP_EVENT_LOW_MEMORY ui_app_add_event_handler failed : [%d]!!!", nRet); + WARN_TRACE + ("APP_EVENT_LOW_MEMORY ui_app_add_event_handler failed : [%d]!!!", + nRet); } - nRet = ui_app_add_event_handler(&hLowBatteryHandle, APP_EVENT_LOW_BATTERY, mp_low_battery, (void *)&ad); + nRet = + ui_app_add_event_handler(&hLowBatteryHandle, APP_EVENT_LOW_BATTERY, + mp_low_battery, (void *) &ad); if (nRet != APP_ERROR_NONE) { - ERROR_TRACE("APP_EVENT_LOW_BATTERY ui_app_add_event_handler failed : [%d]!!!", nRet); + ERROR_TRACE + ("APP_EVENT_LOW_BATTERY ui_app_add_event_handler failed : [%d]!!!", + nRet); return -1; } - nRet = ui_app_add_event_handler(&hLanguageChangedHandle, APP_EVENT_LANGUAGE_CHANGED, __mp_language_changed_cb, (void *)&ad); + nRet = + ui_app_add_event_handler(&hLanguageChangedHandle, + APP_EVENT_LANGUAGE_CHANGED, + __mp_language_changed_cb, (void *) &ad); if (nRet != APP_ERROR_NONE) { - ERROR_TRACE("APP_EVENT_LANGUAGE_CHANGED ui_app_add_event_handler failed : [%d]!!!", nRet); + ERROR_TRACE + ("APP_EVENT_LANGUAGE_CHANGED ui_app_add_event_handler failed : [%d]!!!", + nRet); return -1; } - nRet = ui_app_add_event_handler(&hDeviceOrientationChangedHandle, APP_EVENT_DEVICE_ORIENTATION_CHANGED, mp_device_orientation, (void *)&ad); + nRet = + ui_app_add_event_handler(&hDeviceOrientationChangedHandle, + APP_EVENT_DEVICE_ORIENTATION_CHANGED, + mp_device_orientation, (void *) &ad); if (nRet != APP_ERROR_NONE) { - ERROR_TRACE("APP_EVENT_LANGUAGE_CHANGED ui_app_add_event_handler failed : [%d]!!!", nRet); + ERROR_TRACE + ("APP_EVENT_LANGUAGE_CHANGED ui_app_add_event_handler failed : [%d]!!!", + nRet); return -1; } - nRet = ui_app_add_event_handler(&hRegionFormatChangedHandle, APP_EVENT_REGION_FORMAT_CHANGED, NULL, (void *)&ad); + nRet = + ui_app_add_event_handler(&hRegionFormatChangedHandle, + APP_EVENT_REGION_FORMAT_CHANGED, NULL, + (void *) &ad); if (nRet != APP_ERROR_NONE) { - WARN_TRACE("APP_EVENT_REGION_FORMAT_CHANGED ui_app_add_event_handler failed : [%d]!!!", nRet); + WARN_TRACE + ("APP_EVENT_REGION_FORMAT_CHANGED ui_app_add_event_handler failed : [%d]!!!", + nRet); } MP_TA_INIT(); @@ -1624,11 +1783,11 @@ main(int argc, char *argv[]) if (argc == 1) { DEBUG_TRACE("%s", argv[0]); - if (g_file_test(argv[0], G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) { + if (g_file_test + (argv[0], G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) { test_uri = g_strdup(argv[0]); } } return ui_app_main(argc, argv, &event_callbacks, &ad); } - diff --git a/src/setting/src/include/ms-auto-off.h b/src/setting/src/include/ms-auto-off.h index 6789220..056bb72 100644 --- a/src/setting/src/include/ms-auto-off.h +++ b/src/setting/src/include/ms-auto-off.h @@ -20,7 +20,6 @@ #include #include "ms-util.h" -EXPORT_API void ms_auto_off_list_create(Elm_Object_Item *parent_item); - -#endif //__ms_effect_view_H__ +EXPORT_API void ms_auto_off_list_create(Elm_Object_Item * parent_item); +#endif //__ms_effect_view_H__ diff --git a/src/setting/src/include/ms-effect-view.h b/src/setting/src/include/ms-effect-view.h index e0e01c4..0e2c0d8 100644 --- a/src/setting/src/include/ms-effect-view.h +++ b/src/setting/src/include/ms-effect-view.h @@ -20,18 +20,22 @@ #include "ms-util.h" #include "mp-setting-view.h" -typedef struct -{ +typedef struct { - Elm_Object_Item *selected_item; - Evas_Object *layout; + Elm_Object_Item *selected_item; + Evas_Object *layout; -}MsEffectView_t; +} MsEffectView_t; -EXPORT_API Evas_Object * ms_effect_view_create(Evas_Object *parent, MpSettingView_t *view, Elm_Object_Item *parent_item); -EXPORT_API void ms_effect_view_update_option(MpSettingView_t *view); -EXPORT_API void ms_effect_view_cancel_btn_cb(void *data, Evas_Object *obj, void *event_info); -EXPORT_API void ms_effect_view_save_btn_cb(void *data, Evas_Object *obj, void *event_info); -EXPORT_API void ms_auto_check_refresh(MpSettingView_t *view); -EXPORT_API void ms_effect_view_refresh(MpSettingView_t *data); -#endif //__ms_effect_view_H__ +EXPORT_API Evas_Object *ms_effect_view_create(Evas_Object * parent, + MpSettingView_t * view, + Elm_Object_Item * + parent_item); +EXPORT_API void ms_effect_view_update_option(MpSettingView_t * view); +EXPORT_API void ms_effect_view_cancel_btn_cb(void *data, Evas_Object * obj, + void *event_info); +EXPORT_API void ms_effect_view_save_btn_cb(void *data, Evas_Object * obj, + void *event_info); +EXPORT_API void ms_auto_check_refresh(MpSettingView_t * view); +EXPORT_API void ms_effect_view_refresh(MpSettingView_t * data); +#endif //__ms_effect_view_H__ diff --git a/src/setting/src/include/ms-eq-view.h b/src/setting/src/include/ms-eq-view.h index 6a3f16e..8ad6798 100644 --- a/src/setting/src/include/ms-eq-view.h +++ b/src/setting/src/include/ms-eq-view.h @@ -22,8 +22,9 @@ #include "mp-widget.h" EXPORT_API void ms_eq_view_extended_layout_check_earjack(void *data); -EXPORT_API void _mp_eq_view_reset_btn_cb(void *data, Evas_Object *obj, void *event_info); +EXPORT_API void _mp_eq_view_reset_btn_cb(void *data, Evas_Object * obj, + void *event_info); EXPORT_API Ecore_Idler *ms_eq_view_get_idler(void); -#endif //__ms_eq_view_H__ +#endif //__ms_eq_view_H__ diff --git a/src/setting/src/include/ms-key-ctrl.h b/src/setting/src/include/ms-key-ctrl.h index 72115df..de44c25 100644 --- a/src/setting/src/include/ms-key-ctrl.h +++ b/src/setting/src/include/ms-key-ctrl.h @@ -21,8 +21,7 @@ #include "mp-vconf-private-keys.h" #include "ms-util.h" -enum -{ +enum { MS_MENU_ALBUMS = 0, MS_MENU_ARTISTS, MS_MENU_GENRES, @@ -33,8 +32,7 @@ enum MS_MENU_NUMS, }; -typedef struct _ms_eq_custom_t -{ +typedef struct _ms_eq_custom_t { double band_1; double band_2; double band_3; @@ -62,7 +60,7 @@ int ms_key_get_playlist_val(int *b_val); int ms_key_set_menu_changed(void); int ms_key_set_eq_custom(ms_eq_custom_t custom_val); -int ms_key_set_extended_effect(ms_extended_effect_t *extended_val); +int ms_key_set_extended_effect(ms_extended_effect_t * extended_val); void ms_key_set_user_effect(int value); @@ -73,14 +71,14 @@ int ms_key_get_auto_off_custom_time(void); int ms_key_get_auto_off_val(void); int ms_key_set_auto_off_val(int type); -char* ms_key_get_auto_off_time_text(int index); +char *ms_key_get_auto_off_time_text(int index); double ms_key_get_play_speed(void); void ms_key_set_play_speed(double speed); EXPORT_API int ms_key_get_playlist_str(char **b_str); EXPORT_API int ms_key_get_tabs_str(char **b_str); -EXPORT_API int ms_key_set_tabs_str(char* b_str); -EXPORT_API int ms_key_set_playlist_str(char* b_str); +EXPORT_API int ms_key_set_tabs_str(char *b_str); +EXPORT_API int ms_key_set_playlist_str(char *b_str); -#endif //__ms_key_ctrl_H__ +#endif //__ms_key_ctrl_H__ diff --git a/src/setting/src/include/ms-play-speed.h b/src/setting/src/include/ms-play-speed.h index 3e0c791..55056ae 100644 --- a/src/setting/src/include/ms-play-speed.h +++ b/src/setting/src/include/ms-play-speed.h @@ -20,10 +20,9 @@ #include #include "ms-util.h" -typedef enum{ +typedef enum { MS_PLAY_SPEED_PLUS, MS_PLAY_SPEED_MINUS, -}MsSpeedOption_e; +} MsSpeedOption_e; #endif - diff --git a/src/setting/src/include/ms-playlist.h b/src/setting/src/include/ms-playlist.h index 7c0f5de..330652f 100644 --- a/src/setting/src/include/ms-playlist.h +++ b/src/setting/src/include/ms-playlist.h @@ -22,12 +22,15 @@ #include "mp-setting-view.h" -EXPORT_API Evas_Object* ms_playlist_list_create(MpSettingView_t *view, Evas_Object *parent); -EXPORT_API Evas_Object *_ms_playlist_append_pop_genlist(Evas_Object *genlist, Evas_Object *parent); +EXPORT_API Evas_Object *ms_playlist_list_create(MpSettingView_t * view, + Evas_Object * parent); +EXPORT_API Evas_Object *_ms_playlist_append_pop_genlist(Evas_Object * + genlist, + Evas_Object * + parent); EXPORT_API int ms_playlist_check_state_get_val(int *b_val); EXPORT_API int ms_playlist_check_state_set_val(int b_val); #endif - diff --git a/src/setting/src/include/ms-util.h b/src/setting/src/include/ms-util.h index c05deea..2d64912 100644 --- a/src/setting/src/include/ms-util.h +++ b/src/setting/src/include/ms-util.h @@ -37,13 +37,24 @@ Eina_Bool ms_util_is_earjack_connected(void); bool ms_util_is_sound_device_connected(void); -void ms_util_domain_translatable_part_text_set(Evas_Object *obj, const char* part, const char* text); -void ms_util_object_item_translate_set(Elm_Object_Item *item, const char *ID); -void ms_util_domain_translatable_text_set(Evas_Object *obj, const char* text); -Evas_Object *ms_screen_reader_set_sub_obj_info_full(Evas_Object *parent, Evas_Object *obj, - const char *part, const char *info, - const char *type, const char *context, - Elm_Access_Activate_Cb activate_callback, void *activate_data, - Elm_Access_Info_Cb info_callback, void *info_data); - -#endif //__ms_utils_H__ +void ms_util_domain_translatable_part_text_set(Evas_Object * obj, + const char *part, + const char *text); +void ms_util_object_item_translate_set(Elm_Object_Item * item, + const char *ID); +void ms_util_domain_translatable_text_set(Evas_Object * obj, + const char *text); +Evas_Object *ms_screen_reader_set_sub_obj_info_full(Evas_Object * parent, + Evas_Object * obj, + const char *part, + const char *info, + const char *type, + const char *context, + Elm_Access_Activate_Cb + activate_callback, + void *activate_data, + Elm_Access_Info_Cb + info_callback, + void *info_data); + +#endif //__ms_utils_H__ diff --git a/src/setting/src/ms-auto-off.c b/src/setting/src/ms-auto-off.c index e352b28..642f5d5 100644 --- a/src/setting/src/ms-auto-off.c +++ b/src/setting/src/ms-auto-off.c @@ -37,7 +37,8 @@ static Elm_Object_Item *g_auto_off_gl_it; static int g_hour, g_min; static void -_ms_auto_off_radio_del_cb(void *data, Evas * evas, Evas_Object * obj, void *event_info) +_ms_auto_off_radio_del_cb(void *data, Evas * evas, Evas_Object * obj, + void *event_info) { DEBUG_TRACE("radio group delected"); g_radio_grp = NULL; @@ -45,13 +46,15 @@ _ms_auto_off_radio_del_cb(void *data, Evas * evas, Evas_Object * obj, void *even } static void -_ms_auto_off_radio_change_cb(void *data, Evas_Object * obj, void *event_info) +_ms_auto_off_radio_change_cb(void *data, Evas_Object * obj, + void *event_info) { DEBUG_TRACE(""); mp_retm_if(!g_radio_grp, "radio group is null"); int type = elm_radio_value_get(g_radio_grp); - DEBUG_TRACE("selected radio val : %d type, %d min", type, _g_auto_off_time[type]); + DEBUG_TRACE("selected radio val : %d type, %d min", type, + _g_auto_off_time[type]); ms_key_set_auto_off_val(type); @@ -72,33 +75,42 @@ _ms_auto_off_radio_change_cb(void *data, Evas_Object * obj, void *event_info) elm_genlist_realized_items_update(obj); } -static char * -_ms_auto_off_gl_label_get(void *data, Evas_Object * obj, const char *part) +static char *_ms_auto_off_gl_label_get(void *data, Evas_Object * obj, + const char *part) { - int param = (int)data; + int param = (int) data; char *txt = ms_key_get_auto_off_time_text(param); return (txt) ? strdup(txt) : NULL; } -static inline void _picker_back_cb(void *data, Evas_Object *obj, const char *emission, const char *source) + +static inline void _picker_back_cb(void *data, Evas_Object * obj, + const char *emission, + const char *source) { elm_object_signal_emit(data, "picker,hide", ""); } -static void _ms_auto_off_customize_edit_start_cb(void *data, Evas_Object *obj, void *event_info) +static void _ms_auto_off_customize_edit_start_cb(void *data, + Evas_Object * obj, + void *event_info) { - Evas_Object *genlist = (Evas_Object *)data; + Evas_Object *genlist = (Evas_Object *) data; MP_CHECK(genlist); - eext_object_event_callback_add(genlist, EEXT_CALLBACK_BACK, (Eext_Event_Cb)_picker_back_cb, obj); - evas_object_data_set(genlist, "customized_on", (void *)1); + eext_object_event_callback_add(genlist, EEXT_CALLBACK_BACK, + (Eext_Event_Cb) _picker_back_cb, obj); + evas_object_data_set(genlist, "customized_on", (void *) 1); } -static void _ms_auto_off_customize_edit_end_cb(void *data, Evas_Object *obj, void *event_info) +static void _ms_auto_off_customize_edit_end_cb(void *data, + Evas_Object * obj, + void *event_info) { - Evas_Object *genlist = (Evas_Object *)data; + Evas_Object *genlist = (Evas_Object *) data; MP_CHECK(genlist); - eext_object_event_callback_del(genlist, EEXT_CALLBACK_BACK, (Eext_Event_Cb)_picker_back_cb); - evas_object_data_set(genlist, "customized_on", (void *)0); + eext_object_event_callback_del(genlist, EEXT_CALLBACK_BACK, + (Eext_Event_Cb) _picker_back_cb); + evas_object_data_set(genlist, "customized_on", (void *) 0); elm_genlist_item_selected_set(g_auto_off_gl_it, EINA_FALSE); bool status = !elm_genlist_item_expanded_get(g_auto_off_gl_it); @@ -108,10 +120,11 @@ static void _ms_auto_off_customize_edit_end_cb(void *data, Evas_Object *obj, voi endfunc; } -static void _set_clicked_cb(void *data, Evas_Object *obj, void *event_info) +static void _set_clicked_cb(void *data, Evas_Object * obj, + void *event_info) { DEBUG_TRACE("Set clicked"); - Evas_Object *genlist = (Evas_Object *)data; + Evas_Object *genlist = (Evas_Object *) data; struct tm time1; elm_datetime_value_get(obj, &time1); @@ -140,12 +153,14 @@ static void _set_clicked_cb(void *data, Evas_Object *obj, void *event_info) elm_genlist_realized_items_update(genlist); } -static Evas_Object * -_ms_auto_off_gl_content_get(void *data, Evas_Object * obj, const char *part) +static Evas_Object *_ms_auto_off_gl_content_get(void *data, + Evas_Object * obj, + const char *part) { - int param = (int)data; + int param = (int) data; - mp_retvm_if(param >= KEY_MUSIC_AUTO_OFF_TIME_MAX, NULL, "invalid param: %d", param); + mp_retvm_if(param >= KEY_MUSIC_AUTO_OFF_TIME_MAX, NULL, + "invalid param: %d", param); if (!g_strcmp0(part, "elm.icon") || !g_strcmp0(part, "elm.icon.1")) { Evas_Object *radio_btn = elm_radio_add(obj); @@ -160,7 +175,8 @@ _ms_auto_off_gl_content_get(void *data, Evas_Object * obj, const char *part) elm_radio_value_set(g_radio_grp, type); } - evas_object_smart_callback_add(radio_btn, "changed", _ms_auto_off_radio_change_cb, NULL); + evas_object_smart_callback_add(radio_btn, "changed", + _ms_auto_off_radio_change_cb, NULL); evas_object_show(radio_btn); return radio_btn; } @@ -168,12 +184,12 @@ _ms_auto_off_gl_content_get(void *data, Evas_Object * obj, const char *part) } static void -_ms_auto_off_gl_sel_cb(void *data, Evas_Object *obj, void *event_info) +_ms_auto_off_gl_sel_cb(void *data, Evas_Object * obj, void *event_info) { - int param = (int)data; + int param = (int) data; DEBUG_TRACE("data: %d", param); - Elm_Object_Item *item = (Elm_Object_Item *)event_info; + Elm_Object_Item *item = (Elm_Object_Item *) event_info; elm_genlist_item_selected_set(item, EINA_FALSE); @@ -199,17 +215,21 @@ _ms_auto_off_gl_sel_cb(void *data, Evas_Object *obj, void *event_info) elm_datetime_value_set(datetime, &time1); //evas_object_smart_callback_add(datetime, "changed", _ms_auto_off_time_changed_cb, NULL); - evas_object_smart_callback_add(datetime, "picker,value,set", _set_clicked_cb, obj); - evas_object_smart_callback_add(datetime, "edit,start", _ms_auto_off_customize_edit_start_cb, obj); - evas_object_smart_callback_add(datetime, "edit,end", _ms_auto_off_customize_edit_end_cb, obj); + evas_object_smart_callback_add(datetime, "picker,value,set", + _set_clicked_cb, obj); + evas_object_smart_callback_add(datetime, "edit,start", + _ms_auto_off_customize_edit_start_cb, + obj); + evas_object_smart_callback_add(datetime, "edit,end", + _ms_auto_off_customize_edit_end_cb, + obj); elm_object_signal_emit(datetime, "timepicker,show", ""); } } } -EXPORT_API void -ms_auto_off_list_create(Elm_Object_Item *parent_item) +EXPORT_API void ms_auto_off_list_create(Elm_Object_Item * parent_item) { mp_retm_if(parent_item == NULL, "parent_item is null"); @@ -221,8 +241,10 @@ ms_auto_off_list_create(Elm_Object_Item *parent_item) g_radio_grp = elm_radio_add(genlist); elm_radio_state_value_set(g_radio_grp, -1); - evas_object_smart_callback_add(g_radio_grp, "changed", _ms_auto_off_radio_change_cb, NULL); - evas_object_event_callback_add(g_radio_grp, EVAS_CALLBACK_DEL, _ms_auto_off_radio_del_cb, NULL); + evas_object_smart_callback_add(g_radio_grp, "changed", + _ms_auto_off_radio_change_cb, NULL); + evas_object_event_callback_add(g_radio_grp, EVAS_CALLBACK_DEL, + _ms_auto_off_radio_del_cb, NULL); evas_object_hide(g_radio_grp); static Elm_Genlist_Item_Class itc, custom_itc; @@ -243,15 +265,17 @@ ms_auto_off_list_create(Elm_Object_Item *parent_item) int type = KEY_MUSIC_AUTO_OFF_TIME_OFF; while (type < KEY_MUSIC_AUTO_OFF_TIME_CUSTOM) { - elm_genlist_item_append(genlist, &itc, (void *)type, parent_item, - ELM_GENLIST_ITEM_NONE, _ms_auto_off_gl_sel_cb, (void *)type); - type ++; + elm_genlist_item_append(genlist, &itc, (void *) type, parent_item, + ELM_GENLIST_ITEM_NONE, + _ms_auto_off_gl_sel_cb, (void *) type); + type++; } //custom - Elm_Object_Item *item = elm_genlist_item_append(genlist, &custom_itc, (void *)type, parent_item, - ELM_GENLIST_ITEM_NONE, _ms_auto_off_gl_sel_cb, (void *)type); - evas_object_data_set(genlist, "customized_item", (void *)item); + Elm_Object_Item *item = + elm_genlist_item_append(genlist, &custom_itc, (void *) type, + parent_item, + ELM_GENLIST_ITEM_NONE, + _ms_auto_off_gl_sel_cb, (void *) type); + evas_object_data_set(genlist, "customized_item", (void *) item); } - - diff --git a/src/setting/src/ms-key-ctrl.c b/src/setting/src/ms-key-ctrl.c index ab44f47..7965bf2 100644 --- a/src/setting/src/ms-key-ctrl.c +++ b/src/setting/src/ms-key-ctrl.c @@ -28,9 +28,9 @@ #define dgettext_noop(s) (s) #define N_(s) dgettext_noop(s) -#define MP_SETTING_INIT "db/setting/music-player/initialization" //boolean +#define MP_SETTING_INIT "db/setting/music-player/initialization" //boolean -#define DEFAULT_ALBUMS true +#define DEFAULT_ALBUMS true #define DEFAULT_ARTISTS true #define DEFAULT_GENRES true #define DEFAULT_COMPOSERS false @@ -52,8 +52,7 @@ static char *auto_off_time_text[KEY_MUSIC_AUTO_OFF_TIME_MAX] = { N_("IDS_MUSIC_BODY_CUSTOM"), }; -EXPORT_API int -ms_key_set_menu_changed(void) +EXPORT_API int ms_key_set_menu_changed(void) { if (preference_set_boolean(KEY_MUSIC_MENU_CHANGE, true)) { ERROR_TRACE("Fail to set KEY_MUSIC_MENU_CHANGE"); @@ -63,11 +62,11 @@ ms_key_set_menu_changed(void) return 0; } -EXPORT_API int -ms_key_set_playlist_val(int b_val) +EXPORT_API int ms_key_set_playlist_val(int b_val) { if (preference_set_int(MP_PREFKEY_PLAYLIST_VAL_INT, b_val)) { - ERROR_TRACE("Fail to set %s : %d", MP_PREFKEY_PLAYLIST_VAL_INT, b_val); + ERROR_TRACE("Fail to set %s : %d", MP_PREFKEY_PLAYLIST_VAL_INT, + b_val); return -1; } @@ -75,8 +74,7 @@ ms_key_set_playlist_val(int b_val) return 0; } -EXPORT_API int -ms_key_get_playlist_val(int *b_val) +EXPORT_API int ms_key_get_playlist_val(int *b_val) { if (preference_get_int(MP_PREFKEY_PLAYLIST_VAL_INT, b_val)) { ERROR_TRACE("Fail to get %s ", MP_PREFKEY_PLAYLIST_VAL_INT); @@ -85,11 +83,11 @@ ms_key_get_playlist_val(int *b_val) return 0; } -EXPORT_API int -ms_key_set_playlist_str(char* b_str) +EXPORT_API int ms_key_set_playlist_str(char *b_str) { if (preference_set_string(MP_PREFKEY_PLAYLIST_VAL_STR, b_str)) { - ERROR_TRACE("Fail to set %s : %s", MP_PREFKEY_PLAYLIST_VAL_STR, b_str); + ERROR_TRACE("Fail to set %s : %s", MP_PREFKEY_PLAYLIST_VAL_STR, + b_str); return -1; } @@ -97,8 +95,7 @@ ms_key_set_playlist_str(char* b_str) return 0; } -EXPORT_API int -ms_key_get_playlist_str(char **b_str) +EXPORT_API int ms_key_get_playlist_str(char **b_str) { MP_CHECK_VAL(b_str, -1); int ret = 0; @@ -115,7 +112,7 @@ ms_key_get_playlist_str(char **b_str) } -EXPORT_API int ms_key_set_tabs_str(char* b_str) +EXPORT_API int ms_key_set_tabs_str(char *b_str) { if (preference_set_string(MP_PREFKEY_TABS_VAL_STR, b_str)) { ERROR_TRACE("Fail to set %s : %s", MP_PREFKEY_TABS_VAL_STR, b_str); @@ -138,8 +135,7 @@ EXPORT_API int ms_key_get_tabs_str(char **b_str) return 0; } -EXPORT_API int -ms_key_set_tabs_val(int b_val) +EXPORT_API int ms_key_set_tabs_val(int b_val) { if (preference_set_int(MP_PREFKEY_TABS_VAL_INT, b_val)) { ERROR_TRACE("Fail to set %s : %d", MP_PREFKEY_TABS_VAL_INT, b_val); @@ -150,8 +146,7 @@ ms_key_set_tabs_val(int b_val) return 0; } -EXPORT_API int -ms_key_get_tabs_val(int *b_val) +EXPORT_API int ms_key_get_tabs_val(int *b_val) { if (preference_get_int(MP_PREFKEY_TABS_VAL_INT, b_val)) { ERROR_TRACE("Fail to get %s ", MP_PREFKEY_TABS_VAL_INT); @@ -160,47 +155,54 @@ ms_key_get_tabs_val(int *b_val) return 0; } -EXPORT_API int -ms_key_set_eq_custom(ms_eq_custom_t custom_val) +EXPORT_API int ms_key_set_eq_custom(ms_eq_custom_t custom_val) { int ret = 0; - if (preference_set_double(KEY_MUSIC_EQUALISER_CUSTOM_1, custom_val.band_1)) { + if (preference_set_double + (KEY_MUSIC_EQUALISER_CUSTOM_1, custom_val.band_1)) { ERROR_TRACE("fail to set KEY_MUSIC_EQUALISER_CUSTOM_1"); ret = -1; } - if (preference_set_double(KEY_MUSIC_EQUALISER_CUSTOM_2, custom_val.band_2)) { + if (preference_set_double + (KEY_MUSIC_EQUALISER_CUSTOM_2, custom_val.band_2)) { ERROR_TRACE("fail to set KEY_MUSIC_EQUALISER_CUSTOM_2"); ret = -1; } - if (preference_set_double(KEY_MUSIC_EQUALISER_CUSTOM_3, custom_val.band_3)) { + if (preference_set_double + (KEY_MUSIC_EQUALISER_CUSTOM_3, custom_val.band_3)) { ERROR_TRACE("fail to set KEY_MUSIC_EQUALISER_CUSTOM_3"); ret = -1; } - if (preference_set_double(KEY_MUSIC_EQUALISER_CUSTOM_4, custom_val.band_4)) { + if (preference_set_double + (KEY_MUSIC_EQUALISER_CUSTOM_4, custom_val.band_4)) { ERROR_TRACE("fail to set KEY_MUSIC_EQUALISER_CUSTOM_4"); ret = -1; } - if (preference_set_double(KEY_MUSIC_EQUALISER_CUSTOM_5, custom_val.band_5)) { + if (preference_set_double + (KEY_MUSIC_EQUALISER_CUSTOM_5, custom_val.band_5)) { ERROR_TRACE("fail to set KEY_MUSIC_EQUALISER_CUSTOM_5"); ret = -1; } - if (preference_set_double(KEY_MUSIC_EQUALISER_CUSTOM_6, custom_val.band_6)) { + if (preference_set_double + (KEY_MUSIC_EQUALISER_CUSTOM_6, custom_val.band_6)) { ERROR_TRACE("fail to set KEY_MUSIC_EQUALISER_CUSTOM_6"); ret = -1; } - if (preference_set_double(KEY_MUSIC_EQUALISER_CUSTOM_7, custom_val.band_7)) { + if (preference_set_double + (KEY_MUSIC_EQUALISER_CUSTOM_7, custom_val.band_7)) { ERROR_TRACE("fail to set KEY_MUSIC_EQUALISER_CUSTOM_7"); ret = -1; } - if (preference_set_double(KEY_MUSIC_EQUALISER_CUSTOM_8, custom_val.band_8)) { + if (preference_set_double + (KEY_MUSIC_EQUALISER_CUSTOM_8, custom_val.band_8)) { ERROR_TRACE("fail to set KEY_MUSIC_EQUALISER_CUSTOM_8"); ret = -1; } @@ -209,23 +211,26 @@ ms_key_set_eq_custom(ms_eq_custom_t custom_val) } EXPORT_API int -ms_key_set_extended_effect(ms_extended_effect_t *extended_val) +ms_key_set_extended_effect(ms_extended_effect_t * extended_val) { mp_retv_if(!extended_val, -1); int ret = 0; - if (preference_set_double(KEY_MUSIC_USER_AUDIO_EFFECT_3D, extended_val->three_d)) { + if (preference_set_double + (KEY_MUSIC_USER_AUDIO_EFFECT_3D, extended_val->three_d)) { ERROR_TRACE("fail to set KEY_MUSIC_USER_AUDIO_EFFECT_3D"); ret = -1; } - if (preference_set_double(KEY_MUSIC_USER_AUDIO_EFFECT_BASS, extended_val->bass)) { + if (preference_set_double + (KEY_MUSIC_USER_AUDIO_EFFECT_BASS, extended_val->bass)) { ERROR_TRACE("fail to set KEY_MUSIC_USER_AUDIO_EFFECT_BASS"); ret = -1; } - if (preference_set_double(KEY_MUSIC_USER_AUDIO_EFFECT_CLARITY, extended_val->clarity)) { + if (preference_set_double + (KEY_MUSIC_USER_AUDIO_EFFECT_CLARITY, extended_val->clarity)) { ERROR_TRACE("fail to set KEY_MUSIC_USER_AUDIO_EFFECT_CLARITY"); ret = -1; } @@ -233,8 +238,7 @@ ms_key_set_extended_effect(ms_extended_effect_t *extended_val) return ret; } -EXPORT_API void -ms_key_set_user_effect(int value) +EXPORT_API void ms_key_set_user_effect(int value) { DEBUG_TRACE("value = [0x%x]", value); if (preference_set_int(KEY_MUSIC_SA_USER_CHANGE, value) != 0) { @@ -242,8 +246,7 @@ ms_key_set_user_effect(int value) } } -EXPORT_API int -ms_key_set_auto_off_time(int min) +EXPORT_API int ms_key_set_auto_off_time(int min) { int ret = preference_set_int(KEY_MUSIC_AUTO_OFF_TIME_VAL, min); if (ret != 0) { @@ -253,8 +256,7 @@ ms_key_set_auto_off_time(int min) return ret; } -EXPORT_API int -ms_key_get_auto_off_time(void) +EXPORT_API int ms_key_get_auto_off_time(void) { int min = 0; int ret = preference_get_int(KEY_MUSIC_AUTO_OFF_TIME_VAL, &min); @@ -265,8 +267,7 @@ ms_key_get_auto_off_time(void) return min; } -EXPORT_API int -ms_key_set_auto_off_custom_time(int min) +EXPORT_API int ms_key_set_auto_off_custom_time(int min) { int ret = preference_set_int(KEY_MUSIC_AUTO_OFF_CUSTOM_TIME, min); if (ret != 0) { @@ -276,8 +277,7 @@ ms_key_set_auto_off_custom_time(int min) return ret; } -EXPORT_API int -ms_key_get_auto_off_custom_time(void) +EXPORT_API int ms_key_get_auto_off_custom_time(void) { int min = 0; int ret = preference_get_int(KEY_MUSIC_AUTO_OFF_CUSTOM_TIME, &min); @@ -288,8 +288,7 @@ ms_key_get_auto_off_custom_time(void) return min; } -EXPORT_API int -ms_key_set_auto_off_val(int type) +EXPORT_API int ms_key_set_auto_off_val(int type) { int ret = preference_set_int(KEY_MUSIC_AUTO_OFF_TYPE_VAL, type); if (ret != 0) { @@ -299,8 +298,7 @@ ms_key_set_auto_off_val(int type) return ret; } -EXPORT_API int -ms_key_get_auto_off_val(void) +EXPORT_API int ms_key_get_auto_off_val(void) { int type = 0; if (preference_get_int(KEY_MUSIC_AUTO_OFF_TYPE_VAL, &type) != 0) { @@ -311,8 +309,7 @@ ms_key_get_auto_off_val(void) return type; } -EXPORT_API char* -ms_key_get_auto_off_time_text(int index) +EXPORT_API char *ms_key_get_auto_off_time_text(int index) { if (index < 0 || index >= KEY_MUSIC_AUTO_OFF_TIME_MAX) { ERROR_TRACE("invalid index : %d", index); @@ -329,8 +326,7 @@ ms_key_get_auto_off_time_text(int index) return text; } -EXPORT_API double -ms_key_get_play_speed(void) +EXPORT_API double ms_key_get_play_speed(void) { double speed = 0.0; if (preference_get_double(PREFKEY_MUSIC_PLAY_SPEED, &speed) != 0) { @@ -340,12 +336,9 @@ ms_key_get_play_speed(void) return speed; } -EXPORT_API void -ms_key_set_play_speed(double speed) +EXPORT_API void ms_key_set_play_speed(double speed) { if (preference_set_double(PREFKEY_MUSIC_PLAY_SPEED, speed) != 0) { ERROR_TRACE("preference_set_dbl() failed"); } } - - diff --git a/src/setting/src/ms-play-speed.c b/src/setting/src/ms-play-speed.c index 8b60bd9..031d65a 100644 --- a/src/setting/src/ms-play-speed.c +++ b/src/setting/src/ms-play-speed.c @@ -21,4 +21,3 @@ Elm_Object_Item *g_parent_it; Evas_Object *g_layout; - diff --git a/src/setting/src/ms-playlist.c b/src/setting/src/ms-playlist.c index 18ce513..1acab35 100644 --- a/src/setting/src/ms-playlist.c +++ b/src/setting/src/ms-playlist.c @@ -46,16 +46,14 @@ _ms_playlist_set_cb(void *data, Evas_Object * obj, void *event_info) return; }*/ -EXPORT_API int -ms_playlist_check_state_get_val(int *b_val) +EXPORT_API int ms_playlist_check_state_get_val(int *b_val) { *b_val = playlist_state; return 0; } -EXPORT_API int -ms_playlist_check_state_set_val(int b_val) +EXPORT_API int ms_playlist_check_state_set_val(int b_val) { playlist_state = b_val; @@ -63,9 +61,10 @@ ms_playlist_check_state_set_val(int b_val) } static void -_ms_playlist_view_check_changed_cb(void *data, Evas_Object * obj, void *event_info) +_ms_playlist_view_check_changed_cb(void *data, Evas_Object * obj, + void *event_info) { - int index = (int)evas_object_data_get(obj, "index"); + int index = (int) evas_object_data_get(obj, "index"); DEBUG_TRACE("index:%d", index); if (playlist_state & (1 << index)) { @@ -80,10 +79,10 @@ _ms_playlist_view_check_changed_cb(void *data, Evas_Object * obj, void *event_in return; } -static char * -_ms_playlist_view_gl_label_get(void *data, Evas_Object * obj, const char *part) +static char *_ms_playlist_view_gl_label_get(void *data, Evas_Object * obj, + const char *part) { - mp_setting_genlist_item_data_t* item_data = data; + mp_setting_genlist_item_data_t *item_data = data; char *txt = NULL; @@ -96,10 +95,11 @@ _ms_playlist_view_gl_label_get(void *data, Evas_Object * obj, const char *part) return NULL; } -static Evas_Object * -_ms_playlist_view_gl_icon_get(void *data, Evas_Object * obj, const char *part) +static Evas_Object *_ms_playlist_view_gl_icon_get(void *data, + Evas_Object * obj, + const char *part) { - mp_setting_genlist_item_data_t* item_data = data; + mp_setting_genlist_item_data_t *item_data = data; int param = item_data->index - 1; @@ -110,18 +110,21 @@ _ms_playlist_view_gl_icon_get(void *data, Evas_Object * obj, const char *part) Evas_Object *check_box = elm_check_add(obj); elm_object_style_set(check_box, "default"); - evas_object_data_set(check_box, "index", (void *)param); + evas_object_data_set(check_box, "index", (void *) param); evas_object_repeat_events_set(check_box, EINA_TRUE); evas_object_propagate_events_set(check_box, FALSE); elm_check_state_set(check_box, playlist_state & (1 << param)); - evas_object_smart_callback_add(check_box, "changed", _ms_playlist_view_check_changed_cb, NULL); + evas_object_smart_callback_add(check_box, "changed", + _ms_playlist_view_check_changed_cb, + NULL); evas_object_show(check_box); check_boxs[param] = check_box; - elm_layout_theme_set(content, "layout", "list/C/type.2", "default"); + elm_layout_theme_set(content, "layout", "list/C/type.2", + "default"); elm_layout_content_set(content, "elm.swallow.content", check_box); return content; } @@ -132,9 +135,10 @@ _ms_playlist_view_gl_icon_get(void *data, Evas_Object * obj, const char *part) } static void -_ms_playlist_view_gl_sel_cb(void *data, Evas_Object * obj, void *event_info) +_ms_playlist_view_gl_sel_cb(void *data, Evas_Object * obj, + void *event_info) { - mp_setting_genlist_item_data_t* item_data = data; + mp_setting_genlist_item_data_t *item_data = data; int param = item_data->index - 1; DEBUG_TRACE("data: %d", param); @@ -154,17 +158,17 @@ _ms_playlist_view_gl_sel_cb(void *data, Evas_Object * obj, void *event_info) static void -_ms_playlist_view_gl_sel_item_cb(void *data, Evas_Object * obj, void *event_info) +_ms_playlist_view_gl_sel_item_cb(void *data, Evas_Object * obj, + void *event_info) { - int param = (int)data; + int param = (int) data; DEBUG_TRACE("data: %d", param); Elm_Object_Item *item = (Elm_Object_Item *) event_info; elm_genlist_item_selected_set(item, EINA_FALSE); } -static void -_mp_playlist_item_del_cb(void *data, Evas_Object *obj) +static void _mp_playlist_item_del_cb(void *data, Evas_Object * obj) { mp_setting_genlist_item_data_t *item_data = data; MP_CHECK(item_data); @@ -172,8 +176,8 @@ _mp_playlist_item_del_cb(void *data, Evas_Object *obj) IF_FREE(item_data); } -static Evas_Object * -_ms_playlist_create_genlist(MpSettingView_t *view, Evas_Object *parent) +static Evas_Object *_ms_playlist_create_genlist(MpSettingView_t * view, + Evas_Object * parent) { MP_CHECK_VAL(view, NULL); @@ -185,20 +189,21 @@ _ms_playlist_create_genlist(MpSettingView_t *view, Evas_Object *parent) itc.item_style = "dialogue/1text.1icon/expandable2"; } else if (view->setting_type == MP_SETTING_VIEW_REORDERS) { itc.item_style = "dialogue/1text"; - evas_object_smart_callback_add(genlist, "moved", mp_setting_items_reorder_cb, view); + evas_object_smart_callback_add(genlist, "moved", + mp_setting_items_reorder_cb, view); } - char* str = NULL; + char *str = NULL; ms_key_get_playlist_str(&str); DEBUG_TRACE("str is %s", str); int value = atoi(str); - int playlist[MS_PLAYLIST_MAX] = {0}; + int playlist[MS_PLAYLIST_MAX] = { 0 }; DEBUG_TRACE("value %d", value); int j = 0; - for (j = MS_PLAYLIST_MAX - 1; j >= 0 ; j--) { + for (j = MS_PLAYLIST_MAX - 1; j >= 0; j--) { playlist[j] = value % 10; value = value / 10; DEBUG_TRACE("index %d %d", j, playlist[j]); @@ -214,17 +219,26 @@ _ms_playlist_create_genlist(MpSettingView_t *view, Evas_Object *parent) for (index = 0; index < MS_PLAYLIST_MAX; index++) { int m = playlist[index]; - mp_setting_genlist_item_data_t* item_data = calloc(1, sizeof(mp_setting_genlist_item_data_t)); + mp_setting_genlist_item_data_t *item_data = + calloc(1, sizeof(mp_setting_genlist_item_data_t)); if (item_data) { item_data->index = m; item_data->seq = index; if (view->setting_type == MP_SETTING_VIEW_PLAYLISTS) { - item_data->it = elm_genlist_item_append(genlist, &itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, - _ms_playlist_view_gl_sel_cb, (void *)item_data); + item_data->it = + elm_genlist_item_append(genlist, &itc, + (void *) item_data, NULL, + ELM_GENLIST_ITEM_NONE, + _ms_playlist_view_gl_sel_cb, + (void *) item_data); } else if (view->setting_type == MP_SETTING_VIEW_REORDERS) { - item_data->it = elm_genlist_item_append(genlist, &itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, - _ms_playlist_view_gl_sel_item_cb, (void *)item_data); + item_data->it = + elm_genlist_item_append(genlist, &itc, + (void *) item_data, NULL, + ELM_GENLIST_ITEM_NONE, + _ms_playlist_view_gl_sel_item_cb, + (void *) item_data); } elm_object_item_data_set(item_data->it, item_data); } @@ -232,8 +246,10 @@ _ms_playlist_create_genlist(MpSettingView_t *view, Evas_Object *parent) return genlist; } -EXPORT_API Evas_Object * -_ms_playlist_append_pop_genlist(Evas_Object *genlist, Evas_Object *parent) +EXPORT_API Evas_Object *_ms_playlist_append_pop_genlist(Evas_Object * + genlist, + Evas_Object * + parent) { MP_CHECK_VAL(genlist, NULL); @@ -246,19 +262,20 @@ _ms_playlist_append_pop_genlist(Evas_Object *genlist, Evas_Object *parent) itc.item_style = "1line"; - char* str = NULL; + char *str = NULL; ms_key_get_playlist_str(&str); int value = atoi(str); - int playlist[MS_PLAYLIST_MAX] = {0}; + int playlist[MS_PLAYLIST_MAX] = { 0 }; DEBUG_TRACE("playlist display order value %d", value); int j = 0; - for (j = MS_PLAYLIST_MAX - 1; j >= 0 ; j--) { + for (j = MS_PLAYLIST_MAX - 1; j >= 0; j--) { playlist[j] = value % 10; value = value / 10; - DEBUG_TRACE("playlist display order index %d %d", j, playlist[j]); + DEBUG_TRACE("playlist display order index %d %d", j, + playlist[j]); } itc.func.text_get = _ms_playlist_view_gl_label_get; @@ -271,12 +288,16 @@ _ms_playlist_append_pop_genlist(Evas_Object *genlist, Evas_Object *parent) for (index = 0; index < MS_PLAYLIST_MAX; index++) { int m = playlist[index]; - mp_setting_genlist_item_data_t* item_data = calloc(1, sizeof(mp_setting_genlist_item_data_t)); + mp_setting_genlist_item_data_t *item_data = + calloc(1, sizeof(mp_setting_genlist_item_data_t)); if (item_data) { item_data->index = m; item_data->seq = index; - item_data->it = elm_genlist_item_append(genlist, &itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, - _ms_playlist_view_gl_sel_cb, (void *)item_data); + item_data->it = + elm_genlist_item_append(genlist, &itc, (void *) item_data, + NULL, ELM_GENLIST_ITEM_NONE, + _ms_playlist_view_gl_sel_cb, + (void *) item_data); elm_object_item_data_set(item_data->it, item_data); } } @@ -284,8 +305,8 @@ _ms_playlist_append_pop_genlist(Evas_Object *genlist, Evas_Object *parent) } -EXPORT_API Evas_Object* -ms_playlist_list_create(MpSettingView_t *view, Evas_Object *parent) +EXPORT_API Evas_Object *ms_playlist_list_create(MpSettingView_t * view, + Evas_Object * parent) { mp_retvm_if(parent == NULL, NULL, "parent is NULL"); ms_key_get_playlist_val(&playlist_state); diff --git a/src/setting/src/ms-util.c b/src/setting/src/ms-util.c index 29bbfad..47a8e8b 100644 --- a/src/setting/src/ms-util.c +++ b/src/setting/src/ms-util.c @@ -21,11 +21,11 @@ #include "mp-widget.h" #include -Eina_Bool -ms_util_is_earjack_connected(void) +Eina_Bool ms_util_is_earjack_connected(void) { int ear_jack; - if (runtime_info_get_value_int(RUNTIME_INFO_KEY_AUDIO_JACK_STATUS, &ear_jack)) { + if (runtime_info_get_value_int + (RUNTIME_INFO_KEY_AUDIO_JACK_STATUS, &ear_jack)) { DEBUG_TRACE("Failed to get ear jack status"); return FALSE; } @@ -37,15 +37,17 @@ ms_util_is_earjack_connected(void) } } -bool -ms_util_is_sound_device_connected(void) +bool ms_util_is_sound_device_connected(void) { //Replaced for _prod dependency sound_device_list_h g_device_list = NULL; sound_device_mask_e g_device_mask = SOUND_DEVICE_IO_DIRECTION_OUT_MASK; WARN_TRACE("Enter sound_manager_get_active_device"); int ret; - if (!(ret = sound_manager_get_current_device_list(g_device_mask, &g_device_list))) { + if (! + (ret = + sound_manager_get_current_device_list(g_device_mask, + &g_device_list))) { return true; } else { return false; @@ -60,19 +62,23 @@ static inline const char *_ms_util_get_text_domain(const char *string_id) return domain; } -void ms_util_domain_translatable_part_text_set(Evas_Object *obj, const char* part, const char* text) +void ms_util_domain_translatable_part_text_set(Evas_Object * obj, + const char *part, + const char *text) { const char *domain = _ms_util_get_text_domain(text); elm_object_domain_translatable_part_text_set(obj, part, domain, text); } -void ms_util_domain_translatable_text_set(Evas_Object *obj, const char* text) +void ms_util_domain_translatable_text_set(Evas_Object * obj, + const char *text) { const char *domain = _ms_util_get_text_domain(text); elm_object_domain_translatable_text_set(obj, domain, text); } -void ms_util_object_item_translate_set(Elm_Object_Item *item, const char *ID) +void ms_util_object_item_translate_set(Elm_Object_Item * item, + const char *ID) { MP_CHECK(ID); MP_CHECK(item); diff --git a/src/view/include/mp-add-track-view.h b/src/view/include/mp-add-track-view.h index 3e4b2c9..c03d9ee 100644 --- a/src/view/include/mp-add-track-view.h +++ b/src/view/include/mp-add-track-view.h @@ -26,17 +26,15 @@ #include "music.h" -typedef enum -{ +typedef enum { MP_ADD_TRACK_VIEW_TAB_ALL, MP_ADD_TRACK_VIEW_TAB_PLAYLIST, MP_ADD_TRACK_VIEW_TAB_SONGS, MP_ADD_TRACK_VIEW_TAB_ALBUMS, MP_ADD_TRACK_VIEW_TAB_ARTIST, -}MpAddTrackViewTab_e; +} MpAddTrackViewTab_e; -typedef struct -{ +typedef struct { INHERIT_MP_LIST_VIEW; /* extention variables */ Evas_Object *add_track_view_layout; @@ -55,11 +53,14 @@ typedef struct //char *playlist_name; /* extention functions */ -}MpAddTrackView_t; +} MpAddTrackView_t; -MpAddTrackView_t *mp_add_track_view_create(Evas_Object *parent, int playlist_id); -int mp_add_track_view_destory(MpAddTrackView_t *view); -int mp_add_track_view_select_tab(MpAddTrackView_t *view, MpAddTrackViewTab_e tab); -void mp_add_track_view_add_to_playlist_cb(void *data, Evas_Object * obj, void *event_info); +MpAddTrackView_t *mp_add_track_view_create(Evas_Object * parent, + int playlist_id); +int mp_add_track_view_destory(MpAddTrackView_t * view); +int mp_add_track_view_select_tab(MpAddTrackView_t * view, + MpAddTrackViewTab_e tab); +void mp_add_track_view_add_to_playlist_cb(void *data, Evas_Object * obj, + void *event_info); #endif diff --git a/src/view/include/mp-album-detail-view.h b/src/view/include/mp-album-detail-view.h index b041604..e631d62 100644 --- a/src/view/include/mp-album-detail-view.h +++ b/src/view/include/mp-album-detail-view.h @@ -22,14 +22,13 @@ #include "mp-edit-callback.h" #include "music.h" -typedef struct -{ +typedef struct { INHERIT_MP_LIST_VIEW; Evas_Object *album_detail_view_layout; Evas_Object *album_index; - /* external objects*/ + /* external objects */ /* album name */ char *name; @@ -39,10 +38,12 @@ typedef struct char *thumbnail; /* extention functions */ - void (*content_set)(void *view); -}MpAlbumDetailView_t; + void (*content_set) (void *view); +} MpAlbumDetailView_t; -MpAlbumDetailView_t *mp_album_detail_view_create(Evas_Object *parent, char *album, char *artist, char *thumbnail); -int mp_album_detail_view_destory(MpAlbumDetailView_t *view); +MpAlbumDetailView_t *mp_album_detail_view_create(Evas_Object * parent, + char *album, char *artist, + char *thumbnail); +int mp_album_detail_view_destory(MpAlbumDetailView_t * view); #endif diff --git a/src/view/include/mp-all-view.h b/src/view/include/mp-all-view.h index 1fef06b..782dedc 100644 --- a/src/view/include/mp-all-view.h +++ b/src/view/include/mp-all-view.h @@ -28,8 +28,7 @@ #include "music.h" -typedef struct -{ +typedef struct { INHERIT_MP_LIST_VIEW; /* extention variables */ Evas_Object *all_view_layout; @@ -40,7 +39,7 @@ typedef struct int history; bool reorder_flag; - /* external objects*/ + /* external objects */ Evas_Object *radio_main; /* useful flags */ @@ -53,10 +52,10 @@ typedef struct Ecore_Timer *bringin_timer; /* extention functions */ -}MpAllView_t; +} MpAllView_t; -MpAllView_t *mp_all_view_create(Evas_Object *parent, MpTab_e init_tab); -int mp_all_view_destory(MpAllView_t *view); -int mp_all_view_select_tab(MpAllView_t *view, MpTab_e tab); +MpAllView_t *mp_all_view_create(Evas_Object * parent, MpTab_e init_tab); +int mp_all_view_destory(MpAllView_t * view); +int mp_all_view_select_tab(MpAllView_t * view, MpTab_e tab); #endif diff --git a/src/view/include/mp-artist-detail-view.h b/src/view/include/mp-artist-detail-view.h index 0dd7aea..80776b7 100644 --- a/src/view/include/mp-artist-detail-view.h +++ b/src/view/include/mp-artist-detail-view.h @@ -22,21 +22,22 @@ #include "mp-edit-callback.h" #include "music.h" -typedef struct -{ +typedef struct { INHERIT_MP_LIST_VIEW; Evas_Object *artist_detail_view_layout; Evas_Object *artist_index; - /* external objects*/ + /* external objects */ char *name; /* thumbnail */ char *thumbnail; /* extention functions */ -}MpArtistDetailView_t; +} MpArtistDetailView_t; -MpArtistDetailView_t *mp_artist_detail_view_create(Evas_Object *parent, char *name, char *thumbnail); -int mp_artist_detail_view_destory(MpArtistDetailView_t *view); +MpArtistDetailView_t *mp_artist_detail_view_create(Evas_Object * parent, + char *name, + char *thumbnail); +int mp_artist_detail_view_destory(MpArtistDetailView_t * view); #endif diff --git a/src/view/include/mp-create-playlist-view.h b/src/view/include/mp-create-playlist-view.h index 57fc911..532ecca 100644 --- a/src/view/include/mp-create-playlist-view.h +++ b/src/view/include/mp-create-playlist-view.h @@ -25,15 +25,14 @@ typedef enum { } mp_plst_creation_type_e; typedef enum { - MP_PLST_PARENT_NORMAL, + MP_PLST_PARENT_NORMAL, MP_PLST_PARENT_ALL_VIEW, MP_PLST_PARENT_DETAIL_VIEW, MP_PLST_PARENT_SQUARE_VIEW } mp_plst_parent_type_e; -typedef struct -{ +typedef struct { INHERIT_MP_VIEW; /* extention variables */ Evas_Object *create_plst_layout; @@ -42,17 +41,20 @@ typedef struct Evas_Object *editfiled_new_playlist; Evas_Object *editfiled_entry; char *new_playlist_name; - mp_plst_parent_type_e parent_view; - mp_media_info_h playlist_handle; + mp_plst_parent_type_e parent_view; + mp_media_info_h playlist_handle; char *name; MpList_t *adding_list; char *adding_media_id; mp_plst_creation_type_e creation_type; -}MpCreatePlstView_t; - -MpCreatePlstView_t *mp_create_plst_view_create(Evas_Object *parent); -int mp_create_plst_view_set_edit_list(MpCreatePlstView_t *view, MpList_t *adding_list); -int mp_create_plst_view_set_media_id(MpCreatePlstView_t *view, const char *adding_media_id); -int mp_create_plst_view_set_creation_type(MpCreatePlstView_t *view, mp_plst_creation_type_e type); -int mp_create_plst_view_destory(MpCreatePlstView_t *view); +} MpCreatePlstView_t; + +MpCreatePlstView_t *mp_create_plst_view_create(Evas_Object * parent); +int mp_create_plst_view_set_edit_list(MpCreatePlstView_t * view, + MpList_t * adding_list); +int mp_create_plst_view_set_media_id(MpCreatePlstView_t * view, + const char *adding_media_id); +int mp_create_plst_view_set_creation_type(MpCreatePlstView_t * view, + mp_plst_creation_type_e type); +int mp_create_plst_view_destory(MpCreatePlstView_t * view); #endif diff --git a/src/view/include/mp-detail-view.h b/src/view/include/mp-detail-view.h index 5f7924b..56ac95e 100644 --- a/src/view/include/mp-detail-view.h +++ b/src/view/include/mp-detail-view.h @@ -23,30 +23,26 @@ //#include //#include "mp-info-popup.h" -enum -{ +enum { DETAIL_VIEW_MOVE_NONE, DETAIL_VIEW_MOVE_LEFT, DETAIL_VIEW_MOVE_RIGHT, }; -enum -{ +enum { DETAIL_VIEW_PAGE_VIDEO = 1, DETAIL_VIEW_PAGE_CREDIT, DETAIL_VIEW_PAGE_META, }; -typedef enum -{ +typedef enum { DETAIL_VIEW_ITC_NO_META, DETAIL_VIEW_ITC_VIDEO, DETAIL_VIEW_ITC_CREDIT, DETAIL_VIEW_ITC_META_INFO, -}mp_detail_view_itc; +} mp_detail_view_itc; -typedef struct -{ +typedef struct { INHERIT_MP_VIEW; Elm_Object_Item *inner_navi_it; //add pagecontrol begin @@ -64,26 +60,26 @@ typedef struct Evas_Object *waiting_popup; //add waiting popup Evas_Object *info_list_popup; //add waiting popup - Evas_Object *popup; //add popup + Evas_Object *popup; //add popup - /*data part related*/ + /*data part related */ char *xml_path; - int mp_info_file_count; //the sequence of file which is used as the identification of the file + int mp_info_file_count; //the sequence of file which is used as the identification of the file //used when xml exists bool transition_state; unsigned int page_total; int page_num; Elm_Genlist_Item_Class *video_itc; Evas_Object *video_genlist; - bool page1_enabled; //flag of page1 exists or not - bool fail_to_get_related_vided; // prohibit infinite loop + bool page1_enabled; //flag of page1 exists or not + bool fail_to_get_related_vided; // prohibit infinite loop Elm_Genlist_Item_Class *credit_itc; Evas_Object *credit_genlist; - bool page2_enabled; //flag of page2 exists or not + bool page2_enabled; //flag of page2 exists or not Elm_Genlist_Item_Class *meta_itc; Evas_Object *meta_genlist; - bool page3_enabled; //flag of page3 exists or not + bool page3_enabled; //flag of page3 exists or not //used when xml does not exist //Elm_Genlist_Item_Class *minfo_itc; Evas_Object *minfo_genlist; @@ -95,13 +91,11 @@ typedef struct char *album; char *id; char *thumb; -}MpDetailView_t; +} MpDetailView_t; -MpDetailView_t *mp_detail_view_create(Evas_Object *parent); -int mp_detail_view_destory(MpDetailView_t *view); +MpDetailView_t *mp_detail_view_create(Evas_Object * parent); +int mp_detail_view_destory(MpDetailView_t * view); bool mp_player_mgr_is_active(void); player_h mp_player_mgr_get_player(void); #endif - - diff --git a/src/view/include/mp-edit-view.h b/src/view/include/mp-edit-view.h index 63c8de7..53e01d0 100644 --- a/src/view/include/mp-edit-view.h +++ b/src/view/include/mp-edit-view.h @@ -18,50 +18,54 @@ #define __MP_EDIT_VIEW_H__ #include "mp-list-view.h" -#ifdef MP_FEATURE_PERSONAL_PAGE -enum -{ +#ifdef MP_FEATURE_PERSONAL_PAGE +enum { MP_EDIT_VIEW_PERSONAL_PAGE, }; -typedef enum -{ +typedef enum { MP_EDIT_VIEW_PERSONAL_PAGE_NONE = 0, MP_EDIT_VIEW_PERSONAL_PAGE_ADD, MP_EDIT_VIEW_PERSONAL_PAGE_REMOVE, -}MpEditViewPersonalPageType; +} MpEditViewPersonalPageType; #endif -typedef enum -{ +typedef enum { MP_EDIT_VIEW_NORMAL = 0, MP_EDIT_VIEW_EDIT, MP_EDIT_VIEW_REORDER, -}MpEditViewList_Mode; +} MpEditViewList_Mode; -typedef struct -{ +typedef struct { INHERIT_MP_LIST_VIEW; MpList_t *ref_list; bool share; - bool create_playlist; - Ecore_Timer *back_timer; - MpEditViewList_Mode list_mode; + bool create_playlist; + Ecore_Timer *back_timer; + MpEditViewList_Mode list_mode; bool reorder; -#ifdef MP_FEATURE_PERSONAL_PAGE +#ifdef MP_FEATURE_PERSONAL_PAGE MpEditViewPersonalPageType person_page_sel; #endif -}MpEditView_t; +} MpEditView_t; #ifdef MP_FEATURE_PERSONAL_PAGE -MpEditView_t *mp_edit_view_create(Evas_Object *parent, MpList_t *list, bool share, MpEditViewPersonalPageType person_page_sel); +MpEditView_t *mp_edit_view_create(Evas_Object * parent, MpList_t * list, + bool share, + MpEditViewPersonalPageType + person_page_sel); void mp_edit_view_notify_popup(void *data); #else -MpEditView_t *mp_edit_view_create(Evas_Object *parent, MpList_t *list, bool share); +MpEditView_t *mp_edit_view_create(Evas_Object * parent, MpList_t * list, + bool share); #endif -void mp_edit_view_delete_cb(void *data, Evas_Object * obj, void *event_info); -void mp_edit_view_remove_cb(void *data, Evas_Object * obj, void *event_info); -void mp_edit_view_list_item_reorder_update_cb(void *data, Evas_Object * obj, void *event_info); -void mp_edit_view_add_to_playlist_cb(void *data, Evas_Object * obj, void *event_info); +void mp_edit_view_delete_cb(void *data, Evas_Object * obj, + void *event_info); +void mp_edit_view_remove_cb(void *data, Evas_Object * obj, + void *event_info); +void mp_edit_view_list_item_reorder_update_cb(void *data, + Evas_Object * obj, + void *event_info); +void mp_edit_view_add_to_playlist_cb(void *data, Evas_Object * obj, + void *event_info); #endif - diff --git a/src/view/include/mp-genre-detail-view.h b/src/view/include/mp-genre-detail-view.h index 43fc96b..56348f9 100644 --- a/src/view/include/mp-genre-detail-view.h +++ b/src/view/include/mp-genre-detail-view.h @@ -22,14 +22,13 @@ #include "mp-edit-callback.h" #include "music.h" -typedef struct -{ +typedef struct { INHERIT_MP_LIST_VIEW; Evas_Object *genre_detail_view_layout; Evas_Object *genre_index; - /* external objects*/ + /* external objects */ /* genre name */ char *name; @@ -39,11 +38,12 @@ typedef struct char *thumbnail; /* extention functions */ - void (*content_set)(void *view); -}MpGenreDetailView_t; + void (*content_set) (void *view); +} MpGenreDetailView_t; -MpGenreDetailView_t *mp_genre_detail_view_create(Evas_Object *parent, char *genre, char *artist, char *thumbnail); -int mp_genre_detail_view_destory(MpGenreDetailView_t *view); +MpGenreDetailView_t *mp_genre_detail_view_create(Evas_Object * parent, + char *genre, char *artist, + char *thumbnail); +int mp_genre_detail_view_destory(MpGenreDetailView_t * view); #endif - diff --git a/src/view/include/mp-list-view.h b/src/view/include/mp-list-view.h index bf19dbb..7be9517 100644 --- a/src/view/include/mp-list-view.h +++ b/src/view/include/mp-list-view.h @@ -35,8 +35,7 @@ Evas_Object* (*set_done_button)(void *view, bool flag);\ Evas_Object* (*set_cancel_button)(void *view, bool flag);\ -typedef struct -{ +typedef struct { INHERIT_MP_VIEW; int list_view_magic; @@ -49,21 +48,23 @@ typedef struct Evas_Object *index; Evas_Object *select_all_layout; - int (*double_tap)(void *view); - int (*set_edit_mode)(void *view, bool edit); - Evas_Object* (*set_select_all)(void *view, bool flag); - Evas_Object* (*set_done_button)(void *view, bool flag,mp_done_operator_type_t type); - Evas_Object* (*set_cancel_button)(void *view, bool flag); + int (*double_tap) (void *view); + int (*set_edit_mode) (void *view, bool edit); + Evas_Object *(*set_select_all) (void *view, bool flag); + Evas_Object *(*set_done_button) (void *view, bool flag, + mp_done_operator_type_t type); + Evas_Object *(*set_cancel_button) (void *view, bool flag); -}MpListView_t; +} MpListView_t; -int mp_list_view_init(Evas_Object *parent, MpListView_t *view, MpViewType_e view_type, ...); -int mp_list_view_fini(MpListView_t *view); -int mp_list_view_is_list_view(MpListView_t *view, bool *val); -int mp_list_view_set_edit_mode(MpListView_t *view, bool edit); -Evas_Object *mp_list_view_set_select_all(MpListView_t *view, bool flag); -int mp_list_view_double_tap(MpListView_t *view); -Evas_Object *mp_list_view_set_cancel_btn(MpListView_t *view, bool flag); -Evas_Object *mp_list_view_set_done_btn(MpListView_t *view, bool flag,mp_done_operator_type_t type); +int mp_list_view_init(Evas_Object * parent, MpListView_t * view, + MpViewType_e view_type, ...); +int mp_list_view_fini(MpListView_t * view); +int mp_list_view_is_list_view(MpListView_t * view, bool * val); +int mp_list_view_set_edit_mode(MpListView_t * view, bool edit); +Evas_Object *mp_list_view_set_select_all(MpListView_t * view, bool flag); +int mp_list_view_double_tap(MpListView_t * view); +Evas_Object *mp_list_view_set_cancel_btn(MpListView_t * view, bool flag); +Evas_Object *mp_list_view_set_done_btn(MpListView_t * view, bool flag, + mp_done_operator_type_t type); #endif - diff --git a/src/view/include/mp-lyric-view.h b/src/view/include/mp-lyric-view.h index 2ea6c3f..352dc34 100644 --- a/src/view/include/mp-lyric-view.h +++ b/src/view/include/mp-lyric-view.h @@ -19,8 +19,7 @@ #include "mp-define.h" -typedef struct -{ +typedef struct { struct appdata *ad; int win_w; int win_h; @@ -44,7 +43,7 @@ typedef struct char *music_path; bool b_drag; bool b_show; -}mp_lyric_view_t; +} mp_lyric_view_t; void mp_lyric_view_create(void *data); void mp_lyric_view_destroy(void *data); @@ -52,4 +51,4 @@ void mp_lyric_view_show(void *data); void mp_lyric_view_hide(void *data); void mp_lyric_view_refresh(void *data); -#endif /* __MP_LYRIC_VIEW_H__ */ +#endif /* __MP_LYRIC_VIEW_H__ */ diff --git a/src/view/include/mp-now-playing-list-view.h b/src/view/include/mp-now-playing-list-view.h index 5c90dfa..cf746fd 100644 --- a/src/view/include/mp-now-playing-list-view.h +++ b/src/view/include/mp-now-playing-list-view.h @@ -20,18 +20,17 @@ #include "mp-list-view.h" #include "music.h" -typedef struct -{ +typedef struct { INHERIT_MP_LIST_VIEW; Evas_Object *now_playing_list_layout; - /* external objects*/ + /* external objects */ -}MpNowPlayingListiew_t; +} MpNowPlayingListiew_t; -MpNowPlayingListiew_t *mp_now_playing_list_view_create(Evas_Object *parent); -int mp_now_playihng_list_view_destory(MpNowPlayingListiew_t *view); +MpNowPlayingListiew_t *mp_now_playing_list_view_create(Evas_Object * + parent); +int mp_now_playihng_list_view_destory(MpNowPlayingListiew_t * view); #endif - diff --git a/src/view/include/mp-player-view.h b/src/view/include/mp-player-view.h index c7f04d6..be0693a 100644 --- a/src/view/include/mp-player-view.h +++ b/src/view/include/mp-player-view.h @@ -19,8 +19,7 @@ #include "music.h" -enum -{ +enum { PLAYER_VIEW_MOVE_NONE, PLAYER_VIEW_MOVE_LEFT, PLAYER_VIEW_MOVE_RIGHT, @@ -28,8 +27,7 @@ enum /*OPTION_VOLUME,*/ /*OPTION_INFO,*/ -enum -{ +enum { OPTION_VOLUME, OPTION_VOLUME_MUTE, OPTION_FAVO_ON, @@ -39,11 +37,10 @@ enum OPTION_MAX }; -enum -{ +enum { - CONTROL_SHUFFLE_ON, - CONTROL_SHUFFLE_OFF, + CONTROL_SHUFFLE_ON, + CONTROL_SHUFFLE_OFF, CONTROL_PREVIOUS, CONTROL_PLAY, CONTROL_PAUSE, @@ -55,22 +52,19 @@ enum CONTROL_MAX }; -enum -{ +enum { MP_PLAYER_NORMAL, MP_PLAYER_RADIO_PLAY, MP_PLAYER_ARTIST_PLAY }; -enum -{ +enum { MP_PLAYER_VIEW_LAUNCH_TYPE }; #define PLAYER_VIEW_MAGIC 0x7877 -typedef struct -{ +typedef struct { INHERIT_MP_VIEW; int player_view_magic; bool start_on_transition_finish; @@ -86,8 +80,8 @@ typedef struct Evas_Object *progress_bar; Evas_Object *buffering_progress; Ecore_Timer *progressbar_timer; - bool update_flag; //to indicate if we are in rotation open state. when rotation starts, we will block update_pos for long press case - double update_pos; //the position before rotation. used to update rotated view for long pressed case. rotation will do same action as progress up + bool update_flag; //to indicate if we are in rotation open state. when rotation starts, we will block update_pos for long press case + double update_pos; //the position before rotation. used to update rotated view for long pressed case. rotation will do same action as progress up /* option */ Evas_Object *player_view_option_layout; Evas_Object *option_button[OPTION_MAX]; @@ -108,18 +102,18 @@ typedef struct Evas_Object *current_focus_btn; Evas_Object *pre_focus_btn; /* lyric */ - Evas_Object * lyric; + Evas_Object *lyric; /* queue list */ void *queue_list; bool queue_status; /* screen mode */ mp_screen_mode play_view_screen_mode; - /*move direction*/ + /*move direction */ int move_direction; bool transition_state; bool loaded; - /* launch type: music file / radio / artist*/ + /* launch type: music file / radio / artist */ int launch_type; int available_route; int available_route_count; @@ -129,17 +123,19 @@ typedef struct Ecore_Timer *stop_update_timer; Ecore_Timer *transit_done_timer; - int unmute_vol; + int unmute_vol; Elm_Transit *trans_queue_list; Ecore_Idler *queue_title_idler; Ecore_Idler *queue_list_update_idler; - Ecore_Idler * del_old_detail_handle; + Ecore_Idler *del_old_detail_handle; bool show_lyric; -}MpPlayerView_t; +} MpPlayerView_t; -MpPlayerView_t *mp_player_view_create(Evas_Object *parent, int launch_type, bool start_new_file); +MpPlayerView_t *mp_player_view_create(Evas_Object * parent, + int launch_type, + bool start_new_file); void mp_player_view_update_progressbar(void *data); bool mp_player_view_refresh(void *data); void mp_player_view_progress_timer_freeze(void *data); @@ -151,7 +147,6 @@ void mp_player_view_set_play_image(void *data, bool playing); void mp_player_view_set_title(void *thiz); void mp_player_view_volume_popup_control(void *data, bool force_show); void mp_player_view_update_buffering_progress(void *data, int percent); -void mp_player_view_set_data(MpPlayerView_t *view, ...); -void mp_player_view_update_dmr_icon(MpPlayerView_t *view); +void mp_player_view_set_data(MpPlayerView_t * view, ...); +void mp_player_view_update_dmr_icon(MpPlayerView_t * view); #endif - diff --git a/src/view/include/mp-playlist-detail-view.h b/src/view/include/mp-playlist-detail-view.h index 4124aac..8b5764d 100644 --- a/src/view/include/mp-playlist-detail-view.h +++ b/src/view/include/mp-playlist-detail-view.h @@ -23,13 +23,12 @@ #include "music.h" -typedef struct -{ +typedef struct { INHERIT_MP_LIST_VIEW; Evas_Object *playlist_detail_view_layout; - /* external objects*/ + /* external objects */ /* selected content */ mp_track_type_e list_type; @@ -37,10 +36,17 @@ typedef struct int p_id; /* extention functions */ - void (*content_set)(void *view); -}MpPlaylistDetailView_t; - -MpPlaylistDetailView_t *mp_playlist_detail_view_create(Evas_Object *parent, mp_track_type_e list_type, char *name, int p_id); -int mp_playlist_detail_view_destory(MpPlaylistDetailView_t *view); -void mp_playlist_detail_view_tracklist_edit_cb(void *data, Evas_Object * obj, void *event_info); + void (*content_set) (void *view); +} MpPlaylistDetailView_t; + +MpPlaylistDetailView_t *mp_playlist_detail_view_create(Evas_Object * + parent, + mp_track_type_e + list_type, + char *name, + int p_id); +int mp_playlist_detail_view_destory(MpPlaylistDetailView_t * view); +void mp_playlist_detail_view_tracklist_edit_cb(void *data, + Evas_Object * obj, + void *event_info); #endif diff --git a/src/view/include/mp-search-view.h b/src/view/include/mp-search-view.h index 866af9c..f6df090 100644 --- a/src/view/include/mp-search-view.h +++ b/src/view/include/mp-search-view.h @@ -22,10 +22,9 @@ #include "mp-search-list.h" #include "music.h" -#define MP_SEARCH_VIEW_STYLE_EMPTY NULL//"empty/music" +#define MP_SEARCH_VIEW_STYLE_EMPTY NULL //"empty/music" -typedef struct -{ +typedef struct { INHERIT_MP_LIST_VIEW; Evas_Object *search_view_layout; @@ -35,14 +34,16 @@ typedef struct char *needle; bool needle_change; bool first_called; - bool transition; + bool transition; Ecore_Timer *search_timer; /* extention functions */ - void (*content_set)(void *view); -}MpSearchView_t; - -MpSearchView_t *mp_search_view_create(Evas_Object *parent, const char *keyword); -void mp_search_view_set_keyword(MpSearchView_t *view, const char *keyword); -int mp_search_view_destory(MpSearchView_t *view); + void (*content_set) (void *view); +} MpSearchView_t; + +MpSearchView_t *mp_search_view_create(Evas_Object * parent, + const char *keyword); +void mp_search_view_set_keyword(MpSearchView_t * view, + const char *keyword); +int mp_search_view_destory(MpSearchView_t * view); #endif diff --git a/src/view/include/mp-select-track-view.h b/src/view/include/mp-select-track-view.h index 7ad1928..00f50e1 100644 --- a/src/view/include/mp-select-track-view.h +++ b/src/view/include/mp-select-track-view.h @@ -23,15 +23,15 @@ #include "music.h" -typedef struct -{ +typedef struct { INHERIT_MP_LIST_VIEW; /* extention functions */ - void (*content_set)(void *view); -}MpSelectTrackView_t; + void (*content_set) (void *view); +} MpSelectTrackView_t; -MpSelectTrackView_t *mp_select_track_view_create(Evas_Object *parent); -int mp_select_track_view_destory(MpSelectTrackView_t *view); -void mp_select_track_view_add_to_playlist_cb(void *data, Evas_Object * obj, void *event_info); +MpSelectTrackView_t *mp_select_track_view_create(Evas_Object * parent); +int mp_select_track_view_destory(MpSelectTrackView_t * view); +void mp_select_track_view_add_to_playlist_cb(void *data, Evas_Object * obj, + void *event_info); #endif diff --git a/src/view/include/mp-set-as-view.h b/src/view/include/mp-set-as-view.h index 7c31c00..aada36b 100644 --- a/src/view/include/mp-set-as-view.h +++ b/src/view/include/mp-set-as-view.h @@ -21,8 +21,7 @@ #include "mp-media-info.h" #include -typedef enum -{ +typedef enum { MP_SET_AS_FROM_START = 0, MP_SET_AS_RECOMMEND, MP_SET_AS_RECOMMEND_PRE_LISTEN, @@ -34,8 +33,7 @@ typedef enum } set_as_item_type; -typedef struct -{ +typedef struct { INHERIT_MP_VIEW; Evas_Object *content; Evas_Object *progress_popup; @@ -43,7 +41,7 @@ typedef struct Elm_Genlist_Item_Class *title_itc; Elm_Genlist_Item_Class *recommend_itc_full; Elm_Genlist_Item_Class *recommend_itc_text; - char* path; + char *path; bool button_enable; int recommended; @@ -56,15 +54,9 @@ typedef struct Ecore_Pipe *smat_pipe; Ecore_Idler *move_idler; -}MpSetAsView_t; +} MpSetAsView_t; -EXPORT_API MpSetAsView_t *mp_set_as_view_create(Evas_Object *parent,char* path); -int mp_set_as_view_destory(MpSetAsView_t *view); +EXPORT_API MpSetAsView_t *mp_set_as_view_create(Evas_Object * parent, + char *path); +int mp_set_as_view_destory(MpSetAsView_t * view); #endif - - - - - - - diff --git a/src/view/include/mp-setting-view.h b/src/view/include/mp-setting-view.h index 76532e6..be7c44f 100644 --- a/src/view/include/mp-setting-view.h +++ b/src/view/include/mp-setting-view.h @@ -20,8 +20,7 @@ #include "mp-view.h" #include "ms-key-ctrl.h" -typedef enum -{ +typedef enum { MP_SETTING_VIEW_DEFAULT, //MP_SETTING_VIEW_SA, //MP_SETTING_VIEW_CUSTOM_EQ, @@ -31,9 +30,8 @@ typedef enum } MpSettingViewType_e; -typedef enum -{ - MP_SETTING_TABS_TRACKS , +typedef enum { + MP_SETTING_TABS_TRACKS, MP_SETTING_TABS_PLAYLISTS, MP_SETTING_TABS_ALBUMS, MP_SETTING_TABS_ARTISTS, @@ -43,14 +41,12 @@ typedef enum MP_SETTING_TABS_ITEM_MAX, } MpSettingViewTabs_e; -typedef enum -{ - MP_SETTING_REORDER_TABS , +typedef enum { + MP_SETTING_REORDER_TABS, MP_SETTING_REORDER_PLAYLISTS, } MpSettingReorderType_e; -typedef enum -{ +typedef enum { MS_MAIN_MENU_PLAYLIST, MS_MAIN_MENU_LYRICS, MS_MAIN_MENU_ITEM_MAX, @@ -67,25 +63,24 @@ typedef enum { } ms_itc_type; typedef enum { - MS_EFFECT_THREE_D, - MS_EFFECT_BASS, - MS_EFFECT_CLARITY, - MS_EFFECT_MAX, + MS_EFFECT_THREE_D, + MS_EFFECT_BASS, + MS_EFFECT_CLARITY, + MS_EFFECT_MAX, } ms_effect_tab_type; enum { - MS_EF_NONE, - MS_EF_TUBE, - MS_EF_VIRTUAL, - MS_EF_SMALL_ROOM, - MS_EF_LARGE_ROOM, - MS_EF_CONCER_HALL, - - MS_EF_MAX, + MS_EF_NONE, + MS_EF_TUBE, + MS_EF_VIRTUAL, + MS_EF_SMALL_ROOM, + MS_EF_LARGE_ROOM, + MS_EF_CONCER_HALL, + + MS_EF_MAX, }; -enum -{ +enum { MS_TAB_BASIC, MS_TAB_ADVANCED, @@ -93,8 +88,7 @@ enum }; -typedef struct -{ +typedef struct { INHERIT_MP_VIEW; MpSettingViewType_e setting_type; Evas_Object *content; @@ -106,22 +100,22 @@ typedef struct Evas_Object *effect_layout; Evas_Object *tabbar; - Evas_Object *basic_layout; - Evas_Object *gengrid; - Evas_Object *effect_gengrid; - ms_effect_tab_type effcet_tab_status; + Evas_Object *basic_layout; + Evas_Object *gengrid; + Evas_Object *effect_gengrid; + ms_effect_tab_type effcet_tab_status; Evas_Object *parent; - MpSettingReorderType_e reorder_type; - bool landscape_mode; + MpSettingReorderType_e reorder_type; + bool landscape_mode; - Evas_Object *advanced_layout; - Evas_Object *progress_layout; - Evas_Object *effect_toolbar; - Evas_Object *effect_check[MS_EFFECT_MAX]; + Evas_Object *advanced_layout; + Evas_Object *progress_layout; + Evas_Object *effect_toolbar; + Evas_Object *effect_check[MS_EFFECT_MAX]; - Ecore_Idler *set_effect_idler; - int current_effect_val; - int tabbar_status; + Ecore_Idler *set_effect_idler; + int current_effect_val; + int tabbar_status; Evas_Object *user_layout; Evas_Object *eq_layout; @@ -139,22 +133,21 @@ typedef struct Evas_Object *auto_off_radio_grp; bool b_mouse_down; - Evas_Object *auto_check; - int init_square; - int init_effect; - ms_extended_effect_t init_extended_value; - ms_eq_custom_t init_custom_values; -}MpSettingView_t; - -typedef struct -{ + Evas_Object *auto_check; + int init_square; + int init_effect; + ms_extended_effect_t init_extended_value; + ms_eq_custom_t init_custom_values; +} MpSettingView_t; + +typedef struct { int x:8; int y:8; } ms_effect_position_t; typedef struct { Elm_Object_Item *it; - int index; + int index; MpSettingView_t *view; ms_effect_position_t position; bool b_seleted; @@ -162,27 +155,29 @@ typedef struct { typedef struct { Elm_Object_Item *it; - int index; + int index; bool b_seleted; } ms_effect_ef_gengrid_item_data_t; typedef struct { Elm_Object_Item *it; - int index; - char* str; + int index; + char *str; int seq; } mp_setting_genlist_item_data_t; typedef struct { - Evas_Object * popup; + Evas_Object *popup; Evas_Object *group_radio; int show_lyrics; int hide_lyrics; } mp_setting_lyric_popup; -EXPORT_API MpSettingView_t *mp_setting_view_create(Evas_Object *parent, MpSettingViewType_e type, void *data); +EXPORT_API MpSettingView_t *mp_setting_view_create(Evas_Object * parent, + MpSettingViewType_e + type, void *data); void mp_music_viewas_pop_cb(); -int mp_setting_view_destory(MpSettingView_t *view); -EXPORT_API void mp_setting_items_reorder_cb(void *data, Evas_Object *obj, void *event_info); +int mp_setting_view_destory(MpSettingView_t * view); +EXPORT_API void mp_setting_items_reorder_cb(void *data, Evas_Object * obj, + void *event_info); #endif - diff --git a/src/view/include/mp-view.h b/src/view/include/mp-view.h index 73e9b2f..5a2fab5 100644 --- a/src/view/include/mp-view.h +++ b/src/view/include/mp-view.h @@ -22,14 +22,13 @@ #include "mp-define.h" #include "mp-menu.h" -enum -{ +enum { MP_VIEW_MOVE_NONE, MP_VIEW_MOVE_LEFT, MP_VIEW_MOVE_RIGHT, }; -typedef enum{ +typedef enum { MP_VIEW_ALL, MP_VIEW_ALBUM_DETAIL, MP_VIEW_ARTIST_DETAIL, @@ -54,10 +53,10 @@ typedef enum{ MP_VIEW_MAKE_OFFLINE, MP_VIEW_EDIT, MP_VIEW_MAX, -}MpViewType_e; +} MpViewType_e; -typedef enum{ - MP_UPDATE_NOW_PLAYING = 0, //0 +typedef enum { + MP_UPDATE_NOW_PLAYING = 0, //0 MP_UNSET_NOW_PLAYING, MP_START_PLAYBACK, MP_RESUME_PLAYBACK, @@ -71,7 +70,7 @@ typedef enum{ MP_LCD_OFF, MP_LCD_ON, - MP_UPDATE= 50, + MP_UPDATE = 50, MP_ADD_TO_PLAYLIST_DONE, MP_DELETE_DONE, MP_POPUP_DELETE_DONE, @@ -86,7 +85,7 @@ typedef enum{ MP_WIN_RESIZED, - MP_SIP_STATE_CHANGED =100, + MP_SIP_STATE_CHANGED = 100, MP_VIEW_TRANSITION_REQUESTED, MP_VIEW_TRANSITION_FINISHED, MP_PLAYLIST_RENAMED, @@ -111,21 +110,21 @@ typedef enum{ MP_QUICKPANNEL_SHOW, MP_QUICKPANNEL_HIDE, -}MpViewEvent_e; +} MpViewEvent_e; -typedef enum{ +typedef enum { MP_OPTION_LEFT, MP_OPTION_MIDDLE, MP_OPTION_RIGHT, MP_OPTION_MORE, MP_OPTION_BACK, MP_OPTION_MAX, -}MpOptionType_e; +} MpOptionType_e; -typedef enum{ +typedef enum { MP_TITLE_OPTION_SAVE, MP_TITLE_OPTION_MAX, -}MpTitleOption_e; +} MpTitleOption_e; #define VIEW_MAGIC 0x37373700 #define LIST_VIEW_MAGIC 0x37373701 @@ -175,35 +174,33 @@ typedef enum{ void (*rotate)(void *view, int randscape);\ MP_STORE_MEMBER -typedef struct _mp_view -{ - INHERIT_MP_VIEW -}MpView_t; - -int mp_view_init(Evas_Object *parent, MpView_t *view, MpViewType_e view_type, ...); -int mp_view_fini(MpView_t *view); -EXPORT_API int mp_view_update(MpView_t *view); -int mp_view_update_options(MpView_t *view); -int mp_view_update_options_edit(MpView_t *view); -EXPORT_API int mp_view_set_title(MpView_t *view, char *title); -int mp_view_set_sub_title(MpView_t *view, char *title); -int mp_view_set_title_visible(MpView_t *view, int visible); -int mp_view_title_slide_go(MpView_t *view); -int mp_view_set_nowplaying(MpView_t *view); -int mp_view_unset_nowplaying(MpView_t *view); -int mp_view_update_nowplaying(MpView_t *view, bool with_title); -int mp_view_freeze_nowplaying(MpView_t *view, int freeze); -int mp_view_get_nowplaying_show_flag(MpView_t *view); -int mp_view_start_playback(MpView_t *view); -int mp_view_pause_playback(MpView_t *view); -int mp_view_stop_playback(MpView_t *view); -int mp_view_view_lcd_off(MpView_t *view); -int mp_view_view_lcd_on(MpView_t *view); -int mp_view_view_pause(MpView_t *view); -int mp_view_view_resume(MpView_t *view); -int mp_view_clear_options(MpView_t *view); -Evas_Object *mp_view_get_base_obj(MpView_t *view); -EXPORT_API int mp_view_on_event(MpView_t *view, MpViewEvent_e event); -int mp_view_is_now_push_transit(MpView_t *view, bool *now_transit); +typedef struct _mp_view { +INHERIT_MP_VIEW} MpView_t; + +int mp_view_init(Evas_Object * parent, MpView_t * view, + MpViewType_e view_type, ...); +int mp_view_fini(MpView_t * view); +EXPORT_API int mp_view_update(MpView_t * view); +int mp_view_update_options(MpView_t * view); +int mp_view_update_options_edit(MpView_t * view); +EXPORT_API int mp_view_set_title(MpView_t * view, char *title); +int mp_view_set_sub_title(MpView_t * view, char *title); +int mp_view_set_title_visible(MpView_t * view, int visible); +int mp_view_title_slide_go(MpView_t * view); +int mp_view_set_nowplaying(MpView_t * view); +int mp_view_unset_nowplaying(MpView_t * view); +int mp_view_update_nowplaying(MpView_t * view, bool with_title); +int mp_view_freeze_nowplaying(MpView_t * view, int freeze); +int mp_view_get_nowplaying_show_flag(MpView_t * view); +int mp_view_start_playback(MpView_t * view); +int mp_view_pause_playback(MpView_t * view); +int mp_view_stop_playback(MpView_t * view); +int mp_view_view_lcd_off(MpView_t * view); +int mp_view_view_lcd_on(MpView_t * view); +int mp_view_view_pause(MpView_t * view); +int mp_view_view_resume(MpView_t * view); +int mp_view_clear_options(MpView_t * view); +Evas_Object *mp_view_get_base_obj(MpView_t * view); +EXPORT_API int mp_view_on_event(MpView_t * view, MpViewEvent_e event); +int mp_view_is_now_push_transit(MpView_t * view, bool * now_transit); #endif - diff --git a/src/view/mp-add-track-view.c b/src/view/mp-add-track-view.c index 73ad860..23960cd 100644 --- a/src/view/mp-add-track-view.c +++ b/src/view/mp-add-track-view.c @@ -21,10 +21,11 @@ #include "mp-common.h" #include "mp-util.h" -static void _mp_add_track_view_change_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_add_track_view_change_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; - MpAddTrackView_t *view = (MpAddTrackView_t *)data; + MpAddTrackView_t *view = (MpAddTrackView_t *) data; Elm_Object_Item *it; MpAddTrackViewTab_e tab = MP_ADD_TRACK_VIEW_TAB_ALL; @@ -36,8 +37,7 @@ static void _mp_add_track_view_change_cb(void *data, Evas_Object *obj, void *eve tab = MP_ADD_TRACK_VIEW_TAB_ALBUMS; } else if (it == view->ctltab_artist) { tab = MP_ADD_TRACK_VIEW_TAB_ARTIST; - } - else if (it == view->ctltab_songs) { + } else if (it == view->ctltab_songs) { tab = MP_ADD_TRACK_VIEW_TAB_SONGS; } else { DEBUG_TRACE("selected item out of control"); @@ -53,8 +53,7 @@ static void _mp_add_track_view_change_cb(void *data, Evas_Object *obj, void *eve mp_add_track_view_select_tab(view, tab); } -static void -_mp_add_track_view_destory_cb(void *thiz) +static void _mp_add_track_view_destory_cb(void *thiz) { eventfunc; MpAddTrackView_t *view = thiz; @@ -64,14 +63,15 @@ _mp_add_track_view_destory_cb(void *thiz) mp_language_mgr_unregister_object_item(view->ctltab_album); mp_language_mgr_unregister_object_item(view->ctltab_artist); - mp_list_view_fini((MpListView_t *)view); + mp_list_view_fini((MpListView_t *) view); - /* TODO: release resource..*/ + /* TODO: release resource.. */ free(view); } -Eina_Bool _mp_add_track_view_tracklist_back_cb(void *data, Elm_Object_Item *it) +Eina_Bool _mp_add_track_view_tracklist_back_cb(void *data, + Elm_Object_Item * it) { eventfunc; @@ -91,18 +91,19 @@ Eina_Bool _mp_add_track_view_tracklist_back_cb(void *data, Elm_Object_Item *it) return EINA_TRUE; } -void mp_add_track_view_add_to_playlist_cb(void *data, Evas_Object * obj, void *event_info) +void mp_add_track_view_add_to_playlist_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); - MpAddTrackView_t *view = (MpAddTrackView_t *)data; + MpAddTrackView_t *view = (MpAddTrackView_t *) data; MP_CHECK(view); mp_evas_object_del(view->more_btn_ctxpopup); - MpTrackList_t *list = (MpTrackList_t *)view->content_to_show; + MpTrackList_t *list = (MpTrackList_t *) view->content_to_show; MP_CHECK(list); mp_edit_cb_excute_add_to_playlist(list, view->playlist_id, NULL, true); @@ -111,27 +112,36 @@ void mp_add_track_view_add_to_playlist_cb(void *data, Evas_Object * obj, void *e static int _mp_add_track_view_update_option(void *thiz) { startfunc; - MpAddTrackView_t *view = (MpAddTrackView_t *)thiz; + MpAddTrackView_t *view = (MpAddTrackView_t *) thiz; MP_CHECK_VAL(view, -1); - /*mp_view_clear_options((MpView_t *)view);*/ + /*mp_view_clear_options((MpView_t *)view); */ if (view->content_tab == MP_ADD_TRACK_VIEW_TAB_SONGS) { - mp_util_create_selectioninfo_with_count((MpView_t *)view, mp_list_get_checked_count((MpList_t *)view->content_to_show)); - - if (mp_list_get_checked_count((MpList_t *)view->content_to_show) == mp_list_get_editable_count((MpList_t *)view->content_to_show, mp_list_get_edit_type(view->content_to_show))) { + mp_util_create_selectioninfo_with_count((MpView_t *) view, + mp_list_get_checked_count((MpList_t *) view->content_to_show)); + + if (mp_list_get_checked_count((MpList_t *) view->content_to_show) + == + mp_list_get_editable_count((MpList_t *) view->content_to_show, + mp_list_get_edit_type(view-> + content_to_show))) { elm_check_state_set(view->select_all_btn, EINA_TRUE); } else { elm_check_state_set(view->select_all_btn, EINA_FALSE); } - unsigned int count = mp_list_get_editable_count((MpList_t *)view->content_to_show, MP_LIST_EDIT_TYPE_NORMAL); + unsigned int count = + mp_list_get_editable_count((MpList_t *) view->content_to_show, + MP_LIST_EDIT_TYPE_NORMAL); if (count <= 0) { - mp_view_mgr_pop_a_view((MpViewMgr_t *)GET_VIEW_MGR, (MpView_t *)view); + mp_view_mgr_pop_a_view((MpViewMgr_t *) GET_VIEW_MGR, + (MpView_t *) view); } if (view->done_btn) { - if (mp_list_get_checked_count((MpList_t *)view->content_to_show)) { + if (mp_list_get_checked_count + ((MpList_t *) view->content_to_show)) { elm_object_disabled_set(view->done_btn, EINA_FALSE); } else { elm_object_disabled_set(view->done_btn, EINA_TRUE); @@ -139,38 +149,46 @@ static int _mp_add_track_view_update_option(void *thiz) } } else { Evas_Object *more_btn = NULL; - more_btn = elm_object_item_part_content_get(view->navi_it, "toolbar"); + more_btn = + elm_object_item_part_content_get(view->navi_it, "toolbar"); if (more_btn) { elm_object_item_part_content_unset(view->navi_it, "toolbar"); mp_evas_object_del(more_btn); } } - elm_naviframe_item_pop_cb_set(view->navi_it, _mp_add_track_view_tracklist_back_cb, view); + elm_naviframe_item_pop_cb_set(view->navi_it, + _mp_add_track_view_tracklist_back_cb, + view); endfunc; return 0; } -static int -_mp_add_track_view_content_load(void *view) +static int _mp_add_track_view_content_load(void *view) { DEBUG_TRACE_FUNC(); MP_CHECK_VAL(view, -1); - MpAddTrackView_t *add_track_view = (MpAddTrackView_t *)view; + MpAddTrackView_t *add_track_view = (MpAddTrackView_t *) view; Evas_Object *obj; obj = add_track_view->add_track_view_tabbar; add_track_view->ctltab_songs = - mp_util_toolbar_item_append(obj, NULL, (STR_MP_TRACKS), _mp_add_track_view_change_cb, add_track_view); + mp_util_toolbar_item_append(obj, NULL, (STR_MP_TRACKS), + _mp_add_track_view_change_cb, + add_track_view); add_track_view->ctltab_album = - mp_util_toolbar_item_append(obj, NULL, (STR_MP_ALBUMS), _mp_add_track_view_change_cb, add_track_view); + mp_util_toolbar_item_append(obj, NULL, (STR_MP_ALBUMS), + _mp_add_track_view_change_cb, + add_track_view); add_track_view->ctltab_artist = - mp_util_toolbar_item_append(obj, NULL, (STR_MP_ARTISTS), _mp_add_track_view_change_cb, add_track_view); + mp_util_toolbar_item_append(obj, NULL, (STR_MP_ARTISTS), + _mp_add_track_view_change_cb, + add_track_view); elm_toolbar_item_selected_set(add_track_view->ctltab_songs, EINA_TRUE); @@ -179,10 +197,9 @@ _mp_add_track_view_content_load(void *view) return 0; } -static void -_mp_add_track_view_on_event(void *thiz, MpViewEvent_e event) +static void _mp_add_track_view_on_event(void *thiz, MpViewEvent_e event) { - MpAddTrackView_t * view = (MpAddTrackView_t *)thiz; + MpAddTrackView_t *view = (MpAddTrackView_t *) thiz; switch (event) { case MP_ADD_TO_PLAYLIST_DONE: mp_add_track_view_destory(thiz); @@ -196,15 +213,23 @@ _mp_add_track_view_on_event(void *thiz, MpViewEvent_e event) } } -int _mp_add_track_view_update(void *thiz) { - MpAddTrackView_t* view = thiz; +int _mp_add_track_view_update(void *thiz) +{ + MpAddTrackView_t *view = thiz; mp_list_update(view->content_to_show); - if (view->content_tab == MP_ADD_TRACK_VIEW_TAB_SONGS && mp_list_get_editable_count((MpList_t *)view->content_to_show, mp_list_get_edit_type(view->content_to_show))) { + if (view->content_tab == MP_ADD_TRACK_VIEW_TAB_SONGS + && mp_list_get_editable_count((MpList_t *) view->content_to_show, + mp_list_get_edit_type(view-> + content_to_show))) { mp_list_show_fast_scroll(view->content_to_show); } - if (view->content_tab == MP_ADD_TRACK_VIEW_TAB_SONGS && mp_list_get_editable_count((MpList_t *)view->content_to_show, mp_list_get_edit_type(view->content_to_show)) == 0) { + if (view->content_tab == MP_ADD_TRACK_VIEW_TAB_SONGS + && mp_list_get_editable_count((MpList_t *) view->content_to_show, + mp_list_get_edit_type(view-> + content_to_show)) + == 0) { mp_list_hide_fast_scroll(view->content_to_show); } @@ -212,11 +237,13 @@ int _mp_add_track_view_update(void *thiz) { } static int -_mp_add_track_view_init(Evas_Object *parent, MpAddTrackView_t *view) +_mp_add_track_view_init(Evas_Object * parent, MpAddTrackView_t * view) { startfunc; int ret = 0; - ret = mp_list_view_init(parent, (MpListView_t *)view, MP_VIEW_ADD_TRACK); + ret = + mp_list_view_init(parent, (MpListView_t *) view, + MP_VIEW_ADD_TRACK); MP_CHECK_VAL(ret == 0, -1); view->update = _mp_add_track_view_update; @@ -228,18 +255,22 @@ _mp_add_track_view_init(Evas_Object *parent, MpAddTrackView_t *view) view->unset_nowplaying = NULL; view->update_nowplaying = NULL; - view->add_track_view_layout = view->layout;/*mp_common_load_edj(view->layout, MP_EDJ_NAME, "common_view_layout");*/ + view->add_track_view_layout = view->layout; /*mp_common_load_edj(view->layout, MP_EDJ_NAME, "common_view_layout"); */ MP_CHECK_VAL(view->add_track_view_layout, -1); - view->add_track_view_tabbar = mp_widget_create_tabbar(view->add_track_view_layout); + view->add_track_view_tabbar = + mp_widget_create_tabbar(view->add_track_view_layout); MP_CHECK_VAL(view->add_track_view_tabbar, -1); - elm_object_part_content_set(view->add_track_view_layout, "tabbar", view->add_track_view_tabbar); - edje_object_signal_emit(_EDJ(view->add_track_view_layout), "SHOW_TABBAR", "*"); + elm_object_part_content_set(view->add_track_view_layout, "tabbar", + view->add_track_view_tabbar); + edje_object_signal_emit(_EDJ(view->add_track_view_layout), + "SHOW_TABBAR", "*"); return ret; } -MpAddTrackView_t *mp_add_track_view_create(Evas_Object *parent, int playlist_id) +MpAddTrackView_t *mp_add_track_view_create(Evas_Object * parent, + int playlist_id) { eventfunc; int ret; @@ -258,24 +289,25 @@ MpAddTrackView_t *mp_add_track_view_create(Evas_Object *parent, int playlist_id) _mp_add_track_view_content_load(view); return view; -Error: + Error: ERROR_TRACE("Error: mp_add_track_view_create()"); IF_FREE(view); return NULL; } -int mp_add_track_view_destory(MpAddTrackView_t *view) +int mp_add_track_view_destory(MpAddTrackView_t * view) { startfunc; MP_CHECK_VAL(view, -1); - mp_view_mgr_pop_a_view(GET_VIEW_MGR, (MpView_t *)view); + mp_view_mgr_pop_a_view(GET_VIEW_MGR, (MpView_t *) view); return 0; } -int mp_add_track_view_select_tab(MpAddTrackView_t *view, MpAddTrackViewTab_e tab) +int mp_add_track_view_select_tab(MpAddTrackView_t * view, + MpAddTrackViewTab_e tab) { startfunc; MP_CHECK_VAL(view, -1); @@ -287,41 +319,63 @@ int mp_add_track_view_select_tab(MpAddTrackView_t *view, MpAddTrackViewTab_e tab DEBUG_TRACE("selected view: %d", tab); if (tab == MP_ADD_TRACK_VIEW_TAB_SONGS) { - checked_list = mp_list_get_checked_path_list(view->content_to_show); + checked_list = + mp_list_get_checked_path_list(view->content_to_show); } - content = elm_object_part_content_unset(view->add_track_view_layout, "list_content"); + content = + elm_object_part_content_unset(view->add_track_view_layout, + "list_content"); evas_object_del(content); mp_evas_object_del(view->selection_info); if (tab == MP_ADD_TRACK_VIEW_TAB_ALBUMS) { - view->content_to_show = (MpList_t *)mp_album_list_create(view->add_track_view_layout); + view->content_to_show = + (MpList_t *) mp_album_list_create(view->add_track_view_layout); MP_CHECK_VAL(view->content_to_show, -1); - mp_album_list_set_data((MpAlbumList_t *)view->content_to_show, MP_ALBUM_LIST_FUNC, MP_LIST_FUNC_ADD_TRACK, -1); + mp_album_list_set_data((MpAlbumList_t *) view->content_to_show, + MP_ALBUM_LIST_FUNC, MP_LIST_FUNC_ADD_TRACK, + -1); mp_list_update(view->content_to_show); - content = ((MpAlbumList_t *)view->content_to_show)->layout; - mp_list_view_set_select_all((MpListView_t *)view, FALSE); - save_btn = elm_object_item_part_content_get(view->navi_it, "title_right_btn"); + content = ((MpAlbumList_t *) view->content_to_show)->layout; + mp_list_view_set_select_all((MpListView_t *) view, FALSE); + save_btn = + elm_object_item_part_content_get(view->navi_it, + "title_right_btn"); elm_object_disabled_set(save_btn, EINA_TRUE); } else if (tab == MP_ADD_TRACK_VIEW_TAB_ARTIST) { - view->content_to_show = (MpList_t *)mp_artist_list_create(view->add_track_view_layout); + view->content_to_show = + (MpList_t *) mp_artist_list_create(view-> + add_track_view_layout); MP_CHECK_VAL(view->content_to_show, -1); - mp_artist_list_set_data((MpArtistList_t *)view->content_to_show, MP_ARTIST_LIST_TYPE, MP_GROUP_BY_ARTIST, MP_ARTIST_LIST_FUNC, MP_LIST_FUNC_ADD_TRACK, -1); + mp_artist_list_set_data((MpArtistList_t *) view->content_to_show, + MP_ARTIST_LIST_TYPE, MP_GROUP_BY_ARTIST, + MP_ARTIST_LIST_FUNC, + MP_LIST_FUNC_ADD_TRACK, -1); mp_list_update(view->content_to_show); - content = ((MpArtistList_t *)view->content_to_show)->layout; - mp_list_view_set_select_all((MpListView_t *)view, FALSE); - save_btn = elm_object_item_part_content_get(view->navi_it, "title_right_btn"); + content = ((MpArtistList_t *) view->content_to_show)->layout; + mp_list_view_set_select_all((MpListView_t *) view, FALSE); + save_btn = + elm_object_item_part_content_get(view->navi_it, + "title_right_btn"); elm_object_disabled_set(save_btn, EINA_TRUE); - } - else if (tab == MP_ADD_TRACK_VIEW_TAB_SONGS) { - view->content_to_show = (MpList_t *)mp_track_list_create(view->add_track_view_layout); + } else if (tab == MP_ADD_TRACK_VIEW_TAB_SONGS) { + view->content_to_show = + (MpList_t *) mp_track_list_create(view->add_track_view_layout); MP_CHECK_VAL(view->content_to_show, -1); - mp_track_list_set_data((MpTrackList_t *)view->content_to_show, MP_TRACK_LIST_TYPE, MP_TRACK_ALL, MP_TRACK_LIST_PLAYLIT_ID, view->playlist_id, MP_TRACK_LIST_CHECKED_LIST, checked_list, -1); + mp_track_list_set_data((MpTrackList_t *) view->content_to_show, + MP_TRACK_LIST_TYPE, MP_TRACK_ALL, + MP_TRACK_LIST_PLAYLIT_ID, view->playlist_id, + MP_TRACK_LIST_CHECKED_LIST, checked_list, + -1); mp_list_update(view->content_to_show); mp_list_set_edit(view->content_to_show, TRUE); - mp_list_view_set_select_all((MpListView_t *)view, TRUE); - edje_object_signal_emit(_EDJ(view->add_track_view_layout), "SHOW_SELECT_ALL_PADDING", "*"); - content = ((MpTrackList_t *)view->content_to_show)->layout; - save_btn = elm_object_item_part_content_get(view->navi_it, "title_right_btn"); + mp_list_view_set_select_all((MpListView_t *) view, TRUE); + edje_object_signal_emit(_EDJ(view->add_track_view_layout), + "SHOW_SELECT_ALL_PADDING", "*"); + content = ((MpTrackList_t *) view->content_to_show)->layout; + save_btn = + elm_object_item_part_content_get(view->navi_it, + "title_right_btn"); if (save_btn) { elm_object_disabled_set(save_btn, EINA_TRUE); } @@ -333,21 +387,20 @@ int mp_add_track_view_select_tab(MpAddTrackView_t *view, MpAddTrackViewTab_e tab mp_list_show_fast_scroll(view->content_to_show); view->content_tab = tab; - elm_object_part_content_set(view->add_track_view_layout, "list_content", content); + elm_object_part_content_set(view->add_track_view_layout, + "list_content", content); evas_object_show(content); - mp_view_update_options((MpView_t *)view); - /*update title*/ + mp_view_update_options((MpView_t *) view); + /*update title */ int count = mp_list_get_checked_count(view->content_to_show); if (count > 0) { - char *text = g_strdup_printf(GET_STR(STR_MP_SELECT_ITEMS), count); - mp_view_set_title((MpView_t *)view, text); + char *text = g_strdup_printf(GET_STR(STR_MP_SELECT_ITEMS), count); + mp_view_set_title((MpView_t *) view, text); IF_FREE(text); } else { - mp_view_set_title((MpView_t *)view, STR_MP_TILTE_SELECT_ITEM); + mp_view_set_title((MpView_t *) view, STR_MP_TILTE_SELECT_ITEM); } return 0; } - - diff --git a/src/view/mp-album-detail-view.c b/src/view/mp-album-detail-view.c index e016af8..977685d 100644 --- a/src/view/mp-album-detail-view.c +++ b/src/view/mp-album-detail-view.c @@ -32,22 +32,24 @@ b='+ font=tizen style=Bold'" #define MP_ALBUM_TITLE_TEXT_WIDTH_LD 1006 #define MP_ALBUM_TITLE_TEXT_HEIGHT 54 -static void _mp_album_detail_view_tracklist_edit_cb(void *data, Evas_Object * obj, void *event_info); +static void _mp_album_detail_view_tracklist_edit_cb(void *data, + Evas_Object * obj, + void *event_info); -static void _mp_album_detail_view_cb(void *data, Evas_Object * obj, void *event_info) +static void _mp_album_detail_view_cb(void *data, Evas_Object * obj, + void *event_info) { elm_naviframe_item_pop(GET_NAVIFRAME); } -static void -_mp_album_detail_view_destory_cb(void *thiz) +static void _mp_album_detail_view_destory_cb(void *thiz) { startfunc; MpAlbumDetailView_t *view = thiz; MP_CHECK(view); - mp_list_view_fini((MpListView_t *)view); + mp_list_view_fini((MpListView_t *) view); - /* TODO: release resource..*/ + /* TODO: release resource.. */ mp_album_detail_view_destory(view); free(view); @@ -62,31 +64,35 @@ int _mp_album_detail_view_update(void *thiz) view->content_set(view); if (edit_flag) { mp_list_set_edit(view->content_to_show, true); - mp_view_update_options_edit((MpView_t *)view); - mp_list_view_set_select_all((MpListView_t *)view, true); + mp_view_update_options_edit((MpView_t *) view); + mp_list_view_set_select_all((MpListView_t *) view, true); } else { - mp_view_update_options((MpView_t *)view); - mp_list_view_set_select_all((MpListView_t *)view, false); + mp_view_update_options((MpView_t *) view); + mp_list_view_set_select_all((MpListView_t *) view, false); } return 0; } -static void _mp_album_detail_view_add_to_playlist_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_album_detail_view_add_to_playlist_cb(void *data, + Evas_Object * obj, + void *event_info) { eventfunc; MpAlbumDetailView_t *view = (MpAlbumDetailView_t *) data; MP_CHECK(view); mp_evas_object_del(view->more_btn_ctxpopup); - mp_common_add_to_playlsit_view((MpListView_t *)view); + mp_common_add_to_playlsit_view((MpListView_t *) view); } -static void _mp_album_detail_view_normal_more_btn_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_album_detail_view_normal_more_btn_cb(void *data, + Evas_Object * obj, + void *event_info) { eventfunc; - MpAlbumDetailView_t *view = (MpAlbumDetailView_t *)data; + MpAlbumDetailView_t *view = (MpAlbumDetailView_t *) data; MP_CHECK(view); mp_evas_object_del(view->more_btn_ctxpopup); @@ -94,69 +100,86 @@ static void _mp_album_detail_view_normal_more_btn_cb(void *data, Evas_Object *ob view->more_btn_ctxpopup = mp_common_create_more_ctxpopup(view); MP_CHECK(view->more_btn_ctxpopup); - if (mp_list_get_editable_count(view->content_to_show, MP_LIST_EDIT_TYPE_NORMAL)) { + if (mp_list_get_editable_count + (view->content_to_show, MP_LIST_EDIT_TYPE_NORMAL)) { mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_ADD_TO_PLAYLIST, MP_PLAYER_MORE_BTN_ADD_TO_PLAYLSIT_IMAGE, _mp_album_detail_view_add_to_playlist_cb, view); + STR_MP_ADD_TO_PLAYLIST, + MP_PLAYER_MORE_BTN_ADD_TO_PLAYLSIT_IMAGE, + _mp_album_detail_view_add_to_playlist_cb, + view); mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_DELETE, - MP_PLAYER_MORE_BTN_DELETE_IMAGE, - _mp_album_detail_view_tracklist_edit_cb, - view); + STR_MP_DELETE, + MP_PLAYER_MORE_BTN_DELETE_IMAGE, + _mp_album_detail_view_tracklist_edit_cb, + view); } - #ifdef MP_FEATURE_PERSONAL_PAGE if (mp_util_is_personal_page_on()) { - all_in_personal_e status = mp_common_is_all_in_personal_page(((MpList_t *)view->content_to_show)->genlist); - /*add*/ + all_in_personal_e status = + mp_common_is_all_in_personal_page(((MpList_t *) view-> + content_to_show)->genlist); + /*add */ if (status != MP_COMMON_ALL_IN && status != MP_COMMON_ALL_ERROR) mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_ADD_TO_PERSONAL_PAGE, MP_PLAYER_MORE_BTN_ADD_TO_PERSONAL_PAGE, mp_common_add_to_personal_page_cb, view); + STR_MP_ADD_TO_PERSONAL_PAGE, + MP_PLAYER_MORE_BTN_ADD_TO_PERSONAL_PAGE, + mp_common_add_to_personal_page_cb, + view); - /*remove*/ + /*remove */ if (status != MP_COMMON_ALL_OUT && status != MP_COMMON_ALL_ERROR) mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_REMOVE_FROM_PERSONAL_PAGE, MP_PLAYER_MORE_BTN_REMOVE_FROM_PERSONAL_PAGE, mp_common_remove_from_personal_page_cb, view); + STR_MP_REMOVE_FROM_PERSONAL_PAGE, + MP_PLAYER_MORE_BTN_REMOVE_FROM_PERSONAL_PAGE, + mp_common_remove_from_personal_page_cb, + view); } #endif - /*search*/ + /*search */ mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_SEARCH, NULL, mp_common_create_search_view_cb, view); + STR_MP_SEARCH, NULL, + mp_common_create_search_view_cb, view); /*mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_SETTINGS, MP_PLAYER_MORE_BTN_SETTING, mp_common_ctxpopup_setting_cb, view);*/ + STR_MP_SETTINGS, MP_PLAYER_MORE_BTN_SETTING, mp_common_ctxpopup_setting_cb, view); */ #ifndef MP_FEATURE_NO_END mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_END, MP_PLAYER_MORE_BTN_VIEW_END, mp_common_ctxpopup_end_cb, view); + STR_MP_END, MP_PLAYER_MORE_BTN_VIEW_END, + mp_common_ctxpopup_end_cb, view); #endif mp_util_more_btn_move_ctxpopup(view->more_btn_ctxpopup, obj); evas_object_show(view->more_btn_ctxpopup); } -/*************** functions for track list update *******************/ -static void _mp_album_detail_view_tracklist_edit_cb(void *data, Evas_Object * obj, void *event_info) +/*************** functions for track list update *******************/ +static void _mp_album_detail_view_tracklist_edit_cb(void *data, + Evas_Object * obj, + void *event_info) { eventfunc; MpAlbumDetailView_t *view = (MpAlbumDetailView_t *) data; MP_CHECK(view); mp_evas_object_del(view->more_btn_ctxpopup); - mp_common_show_edit_view((MpListView_t *)view, MP_DONE_DELETE_TYPE); + mp_common_show_edit_view((MpListView_t *) view, MP_DONE_DELETE_TYPE); } -Eina_Bool _mp_album_detail_view_tracklist_back_cb(void *data, Elm_Object_Item *it) +Eina_Bool _mp_album_detail_view_tracklist_back_cb(void *data, + Elm_Object_Item * it) { eventfunc; MpAlbumDetailView_t *view = (MpAlbumDetailView_t *) data; MP_CHECK_VAL(view, EINA_TRUE); - MpAlbumDetailList_t *track_list = (MpAlbumDetailList_t *)view->content_to_show; + MpAlbumDetailList_t *track_list = + (MpAlbumDetailList_t *) view->content_to_show; MP_CHECK_VAL(track_list, EINA_TRUE); if (track_list->edit_mode == 1) { - mp_list_set_edit((MpList_t *)track_list, FALSE); - mp_list_view_set_select_all((MpListView_t *)view, FALSE); - mp_view_update_options((MpView_t *)view); + mp_list_set_edit((MpList_t *) track_list, FALSE); + mp_list_view_set_select_all((MpListView_t *) view, FALSE); + mp_view_update_options((MpView_t *) view); mp_evas_object_del(view->selection_info); return EINA_FALSE; } else { @@ -170,24 +193,32 @@ Eina_Bool _mp_album_detail_view_tracklist_back_cb(void *data, Elm_Object_Item *i static int _mp_album_detail_view_update_options(void *thiz) { startfunc; - MpAlbumDetailView_t *view = (MpAlbumDetailView_t *)thiz; + MpAlbumDetailView_t *view = (MpAlbumDetailView_t *) thiz; MP_CHECK_VAL(view, -1); - mp_view_clear_options((MpView_t *)view); + mp_view_clear_options((MpView_t *) view); Evas_Object *btn = NULL; - btn = mp_widget_create_toolbar_btn(view->album_detail_view_layout, MP_TOOLBAR_BTN_MORE, NULL, _mp_album_detail_view_normal_more_btn_cb, view); - elm_object_item_part_content_set(view->navi_it, "toolbar_more_btn", btn); + btn = + mp_widget_create_toolbar_btn(view->album_detail_view_layout, + MP_TOOLBAR_BTN_MORE, NULL, + _mp_album_detail_view_normal_more_btn_cb, + view); + elm_object_item_part_content_set(view->navi_it, "toolbar_more_btn", + btn); - Evas_Object *back_button = elm_button_add(view->album_detail_view_layout); + Evas_Object *back_button = + elm_button_add(view->album_detail_view_layout); elm_object_style_set(back_button, "naviframe/end_btn/default"); - elm_object_item_part_content_set(view->navi_it, "prev_btn", back_button); - evas_object_smart_callback_add(back_button, "clicked", _mp_album_detail_view_cb, view); - /* view->toolbar_options[MP_OPTION_MORE] = btn;*/ + elm_object_item_part_content_set(view->navi_it, "prev_btn", + back_button); + evas_object_smart_callback_add(back_button, "clicked", + _mp_album_detail_view_cb, view); + /* view->toolbar_options[MP_OPTION_MORE] = btn; */ /* update the first controlba item */ - /*mp_view_manager_update_first_controlbar_item(layout_data);*/ + /*mp_view_manager_update_first_controlbar_item(layout_data); */ endfunc; return 0; } @@ -248,16 +279,26 @@ _mp_album_detail_view_album_list_label_get(void *data, Evas_Object * obj, const static void _mp_album_detail_view_content_load(void *thiz) { startfunc; - MpAlbumDetailView_t *view = (MpAlbumDetailView_t *)thiz; + MpAlbumDetailView_t *view = (MpAlbumDetailView_t *) thiz; MP_CHECK(view); MP_CHECK(view->layout); MP_CHECK(view->album_detail_view_layout); - view->content_to_show = (MpList_t *)mp_album_detail_list_create(view->layout); + view->content_to_show = + (MpList_t *) mp_album_detail_list_create(view->layout); MP_CHECK(view->content_to_show); - mp_album_detail_list_set_data((MpAlbumDetailList_t *)view->content_to_show, MP_ALBUM_DETAIL_LIST_TYPE, MP_TRACK_BY_ALBUM, MP_ALBUM_DETAIL_TYPE_STR, view->name, MP_ALBUM_DETAIL_ARTIST, view->artist, MP_ALBUM_DETAIL_THUMBNAIL, view->thumbnail, -1); + mp_album_detail_list_set_data((MpAlbumDetailList_t *) view-> + content_to_show, + MP_ALBUM_DETAIL_LIST_TYPE, + MP_TRACK_BY_ALBUM, + MP_ALBUM_DETAIL_TYPE_STR, view->name, + MP_ALBUM_DETAIL_ARTIST, view->artist, + MP_ALBUM_DETAIL_THUMBNAIL, + view->thumbnail, -1); mp_list_update(view->content_to_show); - elm_object_part_content_set(view->album_detail_view_layout, "list_content", view->content_to_show->layout); + elm_object_part_content_set(view->album_detail_view_layout, + "list_content", + view->content_to_show->layout); } @@ -269,64 +310,79 @@ _mp_album_detaill_view_on_event(void *thiz, MpViewEvent_e event) switch (event) { case MP_DELETE_DONE: mp_list_update(view->content_to_show); - if (!mp_list_get_editable_count(view->content_to_show, mp_list_get_edit_type(view->content_to_show))) { - /* mp_view_mgr_pop_to_view(GET_VIEW_MGR, MP_VIEW_ALL); */ + if (!mp_list_get_editable_count + (view->content_to_show, + mp_list_get_edit_type(view->content_to_show))) { + /* mp_view_mgr_pop_to_view(GET_VIEW_MGR, MP_VIEW_ALL); */ elm_object_item_del(view->navi_it); } break; case MP_POPUP_DELETE_DONE: - mp_album_detail_list_popup_delete_genlist_item(view->content_to_show); + mp_album_detail_list_popup_delete_genlist_item(view-> + content_to_show); mp_album_detail_list_update_genlist(view->content_to_show); break; #ifndef MP_SOUND_PLAYER case MP_UPDATE_PLAYING_LIST: - mp_list_realized_item_part_update(view->content_to_show, "elm.text.main.left", ELM_GENLIST_ITEM_FIELD_TEXT); - mp_list_realized_item_part_update(view->content_to_show, "elm.text.sub.right", ELM_GENLIST_ITEM_FIELD_TEXT); + mp_list_realized_item_part_update(view->content_to_show, + "elm.text.main.left", + ELM_GENLIST_ITEM_FIELD_TEXT); + mp_list_realized_item_part_update(view->content_to_show, + "elm.text.sub.right", + ELM_GENLIST_ITEM_FIELD_TEXT); break; #endif - case MP_VIEW_EVENT_ALBUMART_CHANGED: { - mp_media_list_h media_list = NULL; - mp_media_info_h media = NULL; - mp_media_info_list_create(&media_list, MP_TRACK_BY_ALBUM, view->name, NULL, NULL, 0, 0, 1); - media = mp_media_info_list_nth_item(media_list, 0); - - char *path = NULL; - mp_media_info_get_thumbnail_path(media, &path); - - IF_FREE(view->thumbnail); - view->thumbnail = g_strdup(path); - - MpAlbumDetailList_t *list = (MpAlbumDetailList_t *)view->content_to_show; - MP_CHECK(list); - mp_album_detail_list_set_data(list, MP_ALBUM_DETAIL_THUMBNAIL, view->thumbnail, -1); - if (list->shuffle_it) { - elm_genlist_item_fields_update(list->shuffle_it, "elm.icon.1", ELM_GENLIST_ITEM_FIELD_CONTENT); + case MP_VIEW_EVENT_ALBUMART_CHANGED:{ + mp_media_list_h media_list = NULL; + mp_media_info_h media = NULL; + mp_media_info_list_create(&media_list, MP_TRACK_BY_ALBUM, + view->name, NULL, NULL, 0, 0, 1); + media = mp_media_info_list_nth_item(media_list, 0); + + char *path = NULL; + mp_media_info_get_thumbnail_path(media, &path); + + IF_FREE(view->thumbnail); + view->thumbnail = g_strdup(path); + + MpAlbumDetailList_t *list = + (MpAlbumDetailList_t *) view->content_to_show; + MP_CHECK(list); + mp_album_detail_list_set_data(list, MP_ALBUM_DETAIL_THUMBNAIL, + view->thumbnail, -1); + if (list->shuffle_it) { + elm_genlist_item_fields_update(list->shuffle_it, + "elm.icon.1", + ELM_GENLIST_ITEM_FIELD_CONTENT); + } + + mp_media_info_list_destroy(media_list); } - - mp_media_info_list_destroy(media_list); - } - break; - - case MP_UPDATE_FAVORITE_LIST: { - mp_list_update(view->content_to_show); break; - } + + case MP_UPDATE_FAVORITE_LIST:{ + mp_list_update(view->content_to_show); + break; + } default: break; } } static int -_mp_album_detail_view_init(Evas_Object *parent, MpAlbumDetailView_t *view) +_mp_album_detail_view_init(Evas_Object * parent, + MpAlbumDetailView_t * view) { startfunc; int ret = 0; - ret = mp_list_view_init(parent, (MpListView_t *)view, MP_VIEW_ALBUM_DETAIL); + ret = + mp_list_view_init(parent, (MpListView_t *) view, + MP_VIEW_ALBUM_DETAIL); MP_CHECK_VAL(ret == 0, -1); view->update = _mp_album_detail_view_update; view->update_options = _mp_album_detail_view_update_options; - /*view->update_options_edit = _mp_album_detail_view_update_options_edit;*/ + /*view->update_options_edit = _mp_album_detail_view_update_options_edit; */ view->view_destroy_cb = _mp_album_detail_view_destory_cb; view->content_set = _mp_album_detail_view_content_load; view->on_event = _mp_album_detaill_view_on_event; @@ -336,7 +392,9 @@ _mp_album_detail_view_init(Evas_Object *parent, MpAlbumDetailView_t *view) return ret; } -MpAlbumDetailView_t *mp_album_detail_view_create(Evas_Object *parent, char *album, char *artist, char *thumbnail) +MpAlbumDetailView_t *mp_album_detail_view_create(Evas_Object * parent, + char *album, char *artist, + char *thumbnail) { startfunc; int ret; @@ -359,13 +417,13 @@ MpAlbumDetailView_t *mp_album_detail_view_create(Evas_Object *parent, char *albu _mp_album_detail_view_content_load(view); return view; -Error: + Error: ERROR_TRACE("Error: mp_album_detail_view_create()"); IF_FREE(view); return NULL; } -int mp_album_detail_view_destory(MpAlbumDetailView_t *view) +int mp_album_detail_view_destory(MpAlbumDetailView_t * view) { startfunc; MP_CHECK_VAL(view, -1); @@ -374,6 +432,3 @@ int mp_album_detail_view_destory(MpAlbumDetailView_t *view) IF_G_FREE(view->thumbnail); return 0; } - - - diff --git a/src/view/mp-all-view.c b/src/view/mp-all-view.c index ba6dfe9..e11188e 100644 --- a/src/view/mp-all-view.c +++ b/src/view/mp-all-view.c @@ -28,19 +28,24 @@ #include "mp-edit-playlist.h" #include "ms-key-ctrl.h" -static void _mp_all_view_playlist_list_create_playlist_cb(void *data, Evas_Object *obj, void *event_info); -static void _mp_all_view_edit_cb(void *data, Evas_Object *obj, void *event_info); +static void _mp_all_view_playlist_list_create_playlist_cb(void *data, + Evas_Object * + obj, + void + *event_info); +static void _mp_all_view_edit_cb(void *data, Evas_Object * obj, + void *event_info); static void _mp_all_view_content_load(void *thiz, MpTab_e tab); #define TAB_COUNT 4 #define MP_INIT_VALUE -2 -static char *tab_str[TAB_COUNT] = {STR_MP_PLAYLISTS, STR_MP_TRACKS, STR_MP_ALBUMS, STR_MP_ARTISTS}; -static int tab_index[TAB_COUNT] = {0}; -static int tab_index_exist[TAB_COUNT] = {0}; +static char *tab_str[TAB_COUNT] = { STR_MP_PLAYLISTS, STR_MP_TRACKS, STR_MP_ALBUMS, STR_MP_ARTISTS }; +static int tab_index[TAB_COUNT] = { 0 }; +static int tab_index_exist[TAB_COUNT] = { 0 }; static void _mp_all_view_tabs_sequence_get(); -static int _mp_all_view_tab_index_get(MpAllView_t *view) +static int _mp_all_view_tab_index_get(MpAllView_t * view) { MP_CHECK_VAL(view, 0); int index = 0; @@ -53,15 +58,14 @@ static int _mp_all_view_tab_index_get(MpAllView_t *view) } -static void -_mp_all_view_destory_cb(void *thiz) +static void _mp_all_view_destory_cb(void *thiz) { eventfunc; MpAllView_t *view = thiz; MP_CHECK(view); - mp_list_view_fini((MpListView_t *)view); + mp_list_view_fini((MpListView_t *) view); - /* TODO: release resource..*/ + /* TODO: release resource.. */ mp_ecore_timer_del(view->bringin_timer); mp_ecore_idler_del(view->show_last_idler); @@ -75,31 +79,40 @@ int _mp_all_view_update(void *thiz) MpAllView_t *view = thiz; mp_list_update(view->content_to_show); - if (_mp_all_view_tab_index_get(view) == MP_TAB_SONGS && mp_list_get_editable_count(view->content_to_show, mp_list_get_edit_type(view->content_to_show))) { + if (_mp_all_view_tab_index_get(view) == MP_TAB_SONGS + && mp_list_get_editable_count(view->content_to_show, + mp_list_get_edit_type(view-> + content_to_show))) { mp_list_show_fast_scroll(view->content_to_show); } - if (_mp_all_view_tab_index_get(view) == MP_TAB_SONGS && mp_list_get_editable_count(view->content_to_show, mp_list_get_edit_type(view->content_to_show)) == 0) { + if (_mp_all_view_tab_index_get(view) == MP_TAB_SONGS + && mp_list_get_editable_count(view->content_to_show, + mp_list_get_edit_type(view-> + content_to_show)) + == 0) { mp_list_hide_fast_scroll(view->content_to_show); } return 0; } -static void _mp_all_view_add_to_playlist_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_all_view_add_to_playlist_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; MpAllView_t *view = (MpAllView_t *) data; MP_CHECK(view); mp_evas_object_del(view->more_btn_ctxpopup); - mp_common_add_to_playlsit_view((MpListView_t *)view); + mp_common_add_to_playlsit_view((MpListView_t *) view); } -static void _mp_all_view_normal_more_btn_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_all_view_normal_more_btn_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; - MpAllView_t *view = (MpAllView_t *)data; + MpAllView_t *view = (MpAllView_t *) data; MP_CHECK(view); mp_evas_object_del(view->more_btn_ctxpopup); @@ -107,7 +120,7 @@ static void _mp_all_view_normal_more_btn_cb(void *data, Evas_Object *obj, void * view->more_btn_ctxpopup = mp_common_create_more_ctxpopup(view); MP_CHECK(view->more_btn_ctxpopup); - int index = _mp_all_view_tab_index_get(view); + int index = _mp_all_view_tab_index_get(view); int count = 0; int playlistcount = mp_media_playlist_get_playlist_count_from_db(); mp_media_info_list_count(MP_TRACK_ALL, NULL, NULL, NULL, 0, &count); @@ -116,49 +129,71 @@ static void _mp_all_view_normal_more_btn_cb(void *data, Evas_Object *obj, void * if (index == MP_TAB_PLAYLISTS) { if (playlistcount < 100) { mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_CREATE_PLAYLIST, MP_PLAYER_MORE_BTN_CREATE_PLAYLIST_IMAGE, - _mp_all_view_playlist_list_create_playlist_cb, view); + STR_MP_CREATE_PLAYLIST, + MP_PLAYER_MORE_BTN_CREATE_PLAYLIST_IMAGE, + _mp_all_view_playlist_list_create_playlist_cb, + view); mp_util_more_btn_move_ctxpopup(view->more_btn_ctxpopup, obj); evas_object_show(view->more_btn_ctxpopup); } } - /*edit button*/ - if (mp_list_get_editable_count(view->content_to_show, MP_LIST_EDIT_TYPE_NORMAL)) { + /*edit button */ + if (mp_list_get_editable_count + (view->content_to_show, MP_LIST_EDIT_TYPE_NORMAL)) { if (index != MP_TAB_PLAYLISTS) { mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_ADD_TO_PLAYLIST, MP_PLAYER_MORE_BTN_ADD_TO_PLAYLSIT_IMAGE, _mp_all_view_add_to_playlist_cb, view); + STR_MP_ADD_TO_PLAYLIST, + MP_PLAYER_MORE_BTN_ADD_TO_PLAYLSIT_IMAGE, + _mp_all_view_add_to_playlist_cb, + view); } mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_DELETE, MP_PLAYER_MORE_BTN_DELETE_IMAGE, _mp_all_view_edit_cb, view); - /*search*/ + STR_MP_DELETE, + MP_PLAYER_MORE_BTN_DELETE_IMAGE, + _mp_all_view_edit_cb, view); + /*search */ if (count > 0) { mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_SEARCH, NULL, mp_common_create_search_view_cb, view); + STR_MP_SEARCH, NULL, + mp_common_create_search_view_cb, + view); } - #ifdef MP_FEATURE_PERSONAL_PAGE if (index == MP_TAB_SONGS) { if (mp_util_is_personal_page_on()) { - all_in_personal_e status = mp_common_is_all_in_personal_page(((MpList_t *)view->content_to_show)->genlist); - /*add*/ - if (status != MP_COMMON_ALL_IN && status != MP_COMMON_ALL_ERROR) + all_in_personal_e status = + mp_common_is_all_in_personal_page(((MpList_t *) view-> + content_to_show)-> + genlist); + /*add */ + if (status != MP_COMMON_ALL_IN + && status != MP_COMMON_ALL_ERROR) mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_ADD_TO_PERSONAL_PAGE, MP_PLAYER_MORE_BTN_ADD_TO_PERSONAL_PAGE, mp_common_add_to_personal_page_cb, view); - - /*remove*/ - if (status != MP_COMMON_ALL_OUT && status != MP_COMMON_ALL_ERROR) + STR_MP_ADD_TO_PERSONAL_PAGE, + MP_PLAYER_MORE_BTN_ADD_TO_PERSONAL_PAGE, + mp_common_add_to_personal_page_cb, + view); + + /*remove */ + if (status != MP_COMMON_ALL_OUT + && status != MP_COMMON_ALL_ERROR) mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_REMOVE_FROM_PERSONAL_PAGE, MP_PLAYER_MORE_BTN_REMOVE_FROM_PERSONAL_PAGE, mp_common_remove_from_personal_page_cb, view); + STR_MP_REMOVE_FROM_PERSONAL_PAGE, + MP_PLAYER_MORE_BTN_REMOVE_FROM_PERSONAL_PAGE, + mp_common_remove_from_personal_page_cb, + view); } } #endif #ifndef MP_FEATURE_NO_END - /*End*/ + /*End */ mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_END, MP_PLAYER_MORE_BTN_VIEW_END, mp_common_ctxpopup_end_cb, view); + STR_MP_END, + MP_PLAYER_MORE_BTN_VIEW_END, + mp_common_ctxpopup_end_cb, view); #endif mp_util_more_btn_move_ctxpopup(view->more_btn_ctxpopup, obj); evas_object_show(view->more_btn_ctxpopup); @@ -166,18 +201,19 @@ static void _mp_all_view_normal_more_btn_cb(void *data, Evas_Object *obj, void * } -/*************** functions for track list update *******************/ -static void _mp_all_view_edit_cb(void *data, Evas_Object *obj, void *event_info) +/*************** functions for track list update *******************/ +static void _mp_all_view_edit_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; MpAllView_t *view = (MpAllView_t *) data; MP_CHECK(view); mp_evas_object_del(view->more_btn_ctxpopup); - mp_common_show_edit_view((MpListView_t *)view, MP_DONE_DELETE_TYPE); + mp_common_show_edit_view((MpListView_t *) view, MP_DONE_DELETE_TYPE); } -Eina_Bool _mp_all_view_pop_cb(void *data, Elm_Object_Item *it) +Eina_Bool _mp_all_view_pop_cb(void *data, Elm_Object_Item * it) { startfunc; struct appdata *ad = mp_util_get_appdata(); @@ -189,20 +225,29 @@ Eina_Bool _mp_all_view_pop_cb(void *data, Elm_Object_Item *it) static void _mp_all_view_update_toolbar_option(void *thiz) { startfunc; - MpAllView_t *view = (MpAllView_t *)thiz; + MpAllView_t *view = (MpAllView_t *) thiz; MP_CHECK(view); Evas_Object *btn = NULL; - btn = mp_widget_create_toolbar_btn(view->all_view_layout, MP_TOOLBAR_BTN_MORE, NULL, _mp_all_view_normal_more_btn_cb, view); - elm_object_item_part_content_set(view->navi_it, "toolbar_more_btn", btn); - elm_naviframe_item_pop_cb_set(view->navi_it, _mp_all_view_pop_cb, view); + btn = + mp_widget_create_toolbar_btn(view->all_view_layout, + MP_TOOLBAR_BTN_MORE, NULL, + _mp_all_view_normal_more_btn_cb, + view); + elm_object_item_part_content_set(view->navi_it, "toolbar_more_btn", + btn); + elm_naviframe_item_pop_cb_set(view->navi_it, _mp_all_view_pop_cb, + view); endfunc; return; } -/*************** functions for playlist list update *******************/ -static void _mp_all_view_playlist_list_create_playlist_cb(void *data, Evas_Object * obj, void *event_info) +/*************** functions for playlist list update *******************/ +static void _mp_all_view_playlist_list_create_playlist_cb(void *data, + Evas_Object * + obj, + void *event_info) { eventfunc; MpAllView_t *view = (MpAllView_t *) data; @@ -210,48 +255,49 @@ static void _mp_all_view_playlist_list_create_playlist_cb(void *data, Evas_Objec mp_evas_object_del(view->more_btn_ctxpopup); - Mp_Playlist_Data *mp_playlist_data = mp_edit_playlist_create(MP_PLST_CREATE_TO_ADD_TRACK); + Mp_Playlist_Data *mp_playlist_data = + mp_edit_playlist_create(MP_PLST_CREATE_TO_ADD_TRACK); mp_edit_playlist_content_create(mp_playlist_data); } int _mp_all_view_update_options(void *thiz) { startfunc; - MpAllView_t *view = (MpAllView_t *)thiz; + MpAllView_t *view = (MpAllView_t *) thiz; MP_CHECK_VAL(view->navi_it, -1); PROFILE_IN("mp_view_clear_options"); - mp_view_clear_options((MpView_t *)view); + mp_view_clear_options((MpView_t *) view); PROFILE_OUT("mp_view_clear_options"); - /*add search btn*/ + /*add search btn */ - mp_view_set_title_visible((MpView_t *)view, true); + mp_view_set_title_visible((MpView_t *) view, true); /*PROFILE_IN("elm_naviframe_item_title_enabled_set"); - elm_naviframe_item_title_enabled_set(view->navi_it, EINA_TRUE, EINA_FALSE); - PROFILE_OUT("elm_naviframe_item_title_enabled_set");*/ + elm_naviframe_item_title_enabled_set(view->navi_it, EINA_TRUE, EINA_FALSE); + PROFILE_OUT("elm_naviframe_item_title_enabled_set"); */ PROFILE_IN("_mp_all_view_update_toolbar_option"); _mp_all_view_update_toolbar_option(thiz); PROFILE_OUT("_mp_all_view_update_toolbar_option"); - /*edje_object_signal_emit(_EDJ(view->all_view_layout), "show,tabbar", "*");*/ + /*edje_object_signal_emit(_EDJ(view->all_view_layout), "show,tabbar", "*"); */ return 0; } -static int -_mp_all_view_playlist_update(void *thiz) +static int _mp_all_view_playlist_update(void *thiz) { - MpAllView_t *view = (MpAllView_t *)thiz; + MpAllView_t *view = (MpAllView_t *) thiz; MP_CHECK_VAL(view, -1); if (_mp_all_view_tab_index_get(view) == MP_TAB_PLAYLISTS) { - mp_view_update((MpView_t *)view); - mp_view_update_options((MpView_t *)view); + mp_view_update((MpView_t *) view); + mp_view_update_options((MpView_t *) view); } return 0; } -static void _all_view_tab_change_cb(void *data, Evas_Object * obj, void *event_info) +static void _all_view_tab_change_cb(void *data, Evas_Object * obj, + void *event_info) { MpAllView_t *view = data; Evas_Object *content = NULL; @@ -259,7 +305,7 @@ static void _all_view_tab_change_cb(void *data, Evas_Object * obj, void *event_i struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); - /*the normal case*/ + /*the normal case */ if (!view->reorder_flag) { Elm_Object_Item *it = NULL; Elm_Object_Item *it2 = NULL; @@ -290,7 +336,7 @@ static void _all_view_tab_change_cb(void *data, Evas_Object * obj, void *event_i MpList_t *list = NULL; DEBUG_TRACE("view->tab_status %d", view->tab_status); - /*record the tab status for reorder*/ + /*record the tab status for reorder */ int index = _mp_all_view_tab_index_get(view); view->history = _mp_all_view_tab_index_get(view); @@ -299,32 +345,41 @@ static void _all_view_tab_change_cb(void *data, Evas_Object * obj, void *event_i switch (index) { case MP_TAB_PLAYLISTS: - list = (void *)mp_playlist_list_create(view->all_view_layout); + list = (void *) mp_playlist_list_create(view->all_view_layout); if (view->tab_status < MP_TAB_MAX) { - mp_playlist_list_set_data((MpPlaylistList_t *)list, MP_PLAYLIST_LIST_DISPLAY_MODE, view->display_mode[view->tab_status], -1); + mp_playlist_list_set_data((MpPlaylistList_t *) list, + MP_PLAYLIST_LIST_DISPLAY_MODE, + view->display_mode[view->tab_status], + -1); } mp_list_update(list); break; case MP_TAB_ALBUMS: - list = (void *)mp_album_list_create(view->all_view_layout); - mp_album_list_set_data((MpAlbumList_t *)list, MP_ALBUM_LIST_DISPLAY_MODE, view->display_mode[view->tab_status], -1); + list = (void *) mp_album_list_create(view->all_view_layout); + mp_album_list_set_data((MpAlbumList_t *) list, + MP_ALBUM_LIST_DISPLAY_MODE, + view->display_mode[view->tab_status], -1); mp_list_update(list); - if (view->display_mode[view->tab_status] == MP_LIST_DISPLAY_MODE_NORMAL) { + if (view->display_mode[view->tab_status] == + MP_LIST_DISPLAY_MODE_NORMAL) { mp_list_show_fast_scroll(list); } break; case MP_TAB_ARTISTS: - list = (void *)mp_artist_list_create(view->all_view_layout); - mp_artist_list_set_data((MpArtistList_t *)list, MP_ARTIST_LIST_DISPLAY_MODE, view->display_mode[view->tab_status], -1); + list = (void *) mp_artist_list_create(view->all_view_layout); + mp_artist_list_set_data((MpArtistList_t *) list, + MP_ARTIST_LIST_DISPLAY_MODE, + view->display_mode[view->tab_status], -1); mp_list_update(list); - if (view->display_mode[view->tab_status] == MP_LIST_DISPLAY_MODE_NORMAL) { + if (view->display_mode[view->tab_status] == + MP_LIST_DISPLAY_MODE_NORMAL) { mp_list_show_fast_scroll(list); } break; case MP_TAB_SONGS: default: PROFILE_IN("mp_track_list_create"); - list = (void *)mp_track_list_create(view->all_view_layout); + list = (void *) mp_track_list_create(view->all_view_layout); PROFILE_OUT("mp_track_list_create"); PROFILE_IN("mp_list_update"); mp_list_update(list); @@ -338,10 +393,11 @@ static void _all_view_tab_change_cb(void *data, Evas_Object * obj, void *event_i view->content_to_show = list; content = mp_list_get_layout(list); if (content != NULL) { - elm_object_part_content_set(view->all_view_layout, "list-content", content); + elm_object_part_content_set(view->all_view_layout, "list-content", + content); } - /*reset the flag*/ + /*reset the flag */ view->reorder_flag = FALSE; } @@ -380,14 +436,15 @@ static void _mp_all_view_tabs_sequence_get() ms_key_get_tabs_str(&get_str); int value = atoi(get_str); int j = 0; - for (j = TAB_COUNT - 1; j >= 0 ; j--) { + for (j = TAB_COUNT - 1; j >= 0; j--) { tab_index[j] = value % 10; value = value / 10; } } -static Evas_Object *_all_view_create_tabbar(Evas_Object *parent, MpAllView_t *view) +static Evas_Object *_all_view_create_tabbar(Evas_Object * parent, + MpAllView_t * view) { MP_CHECK_NULL(parent); MP_CHECK_NULL(view); @@ -398,13 +455,15 @@ static Evas_Object *_all_view_create_tabbar(Evas_Object *parent, MpAllView_t *vi memset(tab_index_exist, 0, sizeof(tab_index_exist)); - /*append the exists tab*/ + /*append the exists tab */ for (i = 0; i < TAB_COUNT; i++) { - mp_util_toolbar_item_append(obj, NULL, tab_str[i], _all_view_tab_change_cb, view); + mp_util_toolbar_item_append(obj, NULL, tab_str[i], + _all_view_tab_change_cb, view); tab_index_exist[i] = i; } - elm_toolbar_item_selected_set(mp_util_toolbar_nth_item(obj, view->tab_status), EINA_TRUE); + elm_toolbar_item_selected_set(mp_util_toolbar_nth_item + (obj, view->tab_status), EINA_TRUE); DEBUG_TRACE("select tab is %d", view->tab_status); view->show_last_idler = ecore_idler_add(_item_show_last, view); @@ -414,27 +473,27 @@ static Evas_Object *_all_view_create_tabbar(Evas_Object *parent, MpAllView_t *vi } -static void -_mp_all_view_content_load(void *thiz, MpTab_e tab) +static void _mp_all_view_content_load(void *thiz, MpTab_e tab) { startfunc; MP_CHECK(thiz); struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); - MpAllView_t *view = (MpAllView_t *)thiz; + MpAllView_t *view = (MpAllView_t *) thiz; view->reorder_flag = TRUE; view->tab_status = 0; - /*we set the removed tab -1,so should set other value*/ + /*we set the removed tab -1,so should set other value */ view->history = MP_INIT_VALUE; PROFILE_IN("_all_view_create_tabbar"); - Evas_Object *tabbar = _all_view_create_tabbar(view->all_view_layout, view); + Evas_Object *tabbar = + _all_view_create_tabbar(view->all_view_layout, view); PROFILE_OUT("_all_view_create_tabbar"); elm_object_part_content_set(view->all_view_layout, "tabbar", tabbar); /*elm_naviframe_item_style_set(view->navi_it, "tabbar/notitle"); - elm_object_item_part_content_set(view->navi_it, "tabbar", tabbar);*/ + elm_object_item_part_content_set(view->navi_it, "tabbar", tabbar); */ view->all_view_tabbar = tabbar; endfunc; } @@ -452,7 +511,7 @@ static void _mp_all_view_popup_delete_update_genlist(void *thiz) if (count <= 0) { mp_list_update(thiz); - mp_list_hide_fast_scroll((MpList_t *)list); + mp_list_hide_fast_scroll((MpList_t *) list); } else { elm_genlist_realized_items_update(list->genlist); } @@ -462,9 +521,10 @@ static void _mp_all_view_tabs_refresh(void *thiz) { startfunc; MP_CHECK(thiz); - MpAllView_t *view = (MpAllView_t *)thiz; + MpAllView_t *view = (MpAllView_t *) thiz; - Evas_Object *content = elm_object_part_content_get(view->all_view_layout, "tabbar"); + Evas_Object *content = + elm_object_part_content_get(view->all_view_layout, "tabbar"); if (content) { mp_evas_object_del(content); view->all_view_tabbar = NULL; @@ -472,7 +532,8 @@ static void _mp_all_view_tabs_refresh(void *thiz) _mp_all_view_tabs_sequence_get(); view->reorder_flag = TRUE; - Evas_Object *tabbar = _all_view_create_tabbar(view->all_view_layout, view); + Evas_Object *tabbar = + _all_view_create_tabbar(view->all_view_layout, view); PROFILE_OUT("_all_view_create_tabbar"); elm_object_part_content_set(view->all_view_layout, "tabbar", tabbar); @@ -480,8 +541,7 @@ static void _mp_all_view_tabs_refresh(void *thiz) endfunc; } -static void -_mp_all_view_on_event(void *thiz, MpViewEvent_e event) +static void _mp_all_view_on_event(void *thiz, MpViewEvent_e event) { DEBUG_TRACE("event; %d", event); MpAllView_t *view = thiz; @@ -498,19 +558,21 @@ _mp_all_view_on_event(void *thiz, MpViewEvent_e event) mp_view_update(thiz); } break; - /*case MP_PLAY_TIME_COUNT_UPDATED:*/ + /*case MP_PLAY_TIME_COUNT_UPDATED: */ case MP_ADD_TO_PLAYLIST_DONE: if (index == MP_TAB_PLAYLISTS) { mp_view_update(thiz); } break; - case MP_LANG_CHANGED: { - MpListDisplayMode_e current = mp_list_get_display_mode(list); - if (index == MP_TAB_ARTISTS && MP_LIST_DISPLAY_MODE_NORMAL == current) { - mp_list_realized_item_part_update(list, "elm.icon", ELM_GENLIST_ITEM_FIELD_CONTENT); + case MP_LANG_CHANGED:{ + MpListDisplayMode_e current = mp_list_get_display_mode(list); + if (index == MP_TAB_ARTISTS + && MP_LIST_DISPLAY_MODE_NORMAL == current) { + mp_list_realized_item_part_update(list, "elm.icon", + ELM_GENLIST_ITEM_FIELD_CONTENT); + } } - } - break; + break; case MP_POPUP_DELETE_DONE: if (index == MP_TAB_PLAYLISTS) { mp_view_update(thiz); @@ -525,10 +587,10 @@ _mp_all_view_on_event(void *thiz, MpViewEvent_e event) int count = 0; count = elm_genlist_items_count(list->genlist); if (count <= 0) { - mp_list_hide_fast_scroll((MpList_t *)list); + mp_list_hide_fast_scroll((MpList_t *) list); } } else { - mp_list_hide_fast_scroll((MpList_t *)list); + mp_list_hide_fast_scroll((MpList_t *) list); } } break; @@ -536,9 +598,10 @@ _mp_all_view_on_event(void *thiz, MpViewEvent_e event) mp_list_update(list); break; case MP_PLAYLIST_MGR_ITEM_CHANGED: - mp_view_update_nowplaying((MpView_t *)view, true); + mp_view_update_nowplaying((MpView_t *) view, true); if (ad->popup_data) { - Mp_Playlist_Data *mp_playlist_data = (Mp_Playlist_Data *)ad->popup_data; + Mp_Playlist_Data *mp_playlist_data = + (Mp_Playlist_Data *) ad->popup_data; mp_evas_object_del(mp_playlist_data->popup); free(ad->popup_data); ad->popup_data = NULL; @@ -549,19 +612,21 @@ _mp_all_view_on_event(void *thiz, MpViewEvent_e event) break; case MP_SIP_STATE_CHANGED: /* - if (view->navi_it) { - const char *signal = mp_util_get_sip_state() ? "elm,state,toolbar,instant_close" : "elm,state,toolbar,instant_open"; - elm_object_item_signal_emit(view->navi_it, signal, ""); - - bool title_visible = (mp_util_get_sip_state() && mp_util_is_landscape()) ? false : true; - mp_view_set_title_visible(thiz, title_visible); - } - */ + if (view->navi_it) { + const char *signal = mp_util_get_sip_state() ? "elm,state,toolbar,instant_close" : "elm,state,toolbar,instant_open"; + elm_object_item_signal_emit(view->navi_it, signal, ""); + + bool title_visible = (mp_util_get_sip_state() && mp_util_is_landscape()) ? false : true; + mp_view_set_title_visible(thiz, title_visible); + } + */ break; #ifndef MP_SOUND_PLAYER case MP_UPDATE_PLAYING_LIST: - mp_list_realized_item_part_update(list, "elm.text.main.left.top", ELM_GENLIST_ITEM_FIELD_TEXT); - mp_list_realized_item_part_update(list, "elm.text.sub.left.bottom", ELM_GENLIST_ITEM_FIELD_TEXT); + mp_list_realized_item_part_update(list, "elm.text.main.left.top", + ELM_GENLIST_ITEM_FIELD_TEXT); + mp_list_realized_item_part_update(list, "elm.text.sub.left.bottom", + ELM_GENLIST_ITEM_FIELD_TEXT); break; #endif case MP_PLAYLIST_IMAGE_UPDATED: @@ -579,50 +644,51 @@ _mp_all_view_on_event(void *thiz, MpViewEvent_e event) #endif case MP_VIEW_EVENT_ALBUMART_CHANGED: if (index == MP_TAB_SONGS) { - mp_list_realized_item_part_update(list, "elm.icon", ELM_GENLIST_ITEM_FIELD_CONTENT); + mp_list_realized_item_part_update(list, "elm.icon", + ELM_GENLIST_ITEM_FIELD_CONTENT); } else { mp_list_update(list); } break; - case MP_UPDATE_FAVORITE_LIST: { - if (index == MP_TAB_PLAYLISTS) { - mp_list_update(list); + case MP_UPDATE_FAVORITE_LIST:{ + if (index == MP_TAB_PLAYLISTS) { + mp_list_update(list); + } + break; } - break; - } case MP_TABS_ITEM_CHANGED: - case MP_TABS_REORDER_DONE: { - _mp_all_view_tabs_refresh(view); - break; - } - case MP_PLAYLISTS_REORDER_DONE: { - _mp_all_view_tabs_sequence_get(); - if (tab_index[view->tab_status] - 1 == MP_TAB_PLAYLISTS) { - mp_view_update(thiz); + case MP_TABS_REORDER_DONE:{ + _mp_all_view_tabs_refresh(view); + break; + } + case MP_PLAYLISTS_REORDER_DONE:{ + _mp_all_view_tabs_sequence_get(); + if (tab_index[view->tab_status] - 1 == MP_TAB_PLAYLISTS) { + mp_view_update(thiz); + } + break; } - break; - } case MP_START_PLAYBACK: case MP_RESUME_PLAYBACK: case MP_PAUSE_PLAYBACK: case MP_PLAYING_TRACK_CHANGED: - case MP_STOP_PLAYBACK: { - if (index == MP_TAB_SONGS) { - mp_list_realized_item_part_update(list, "elm.icon.left", ELM_GENLIST_ITEM_FIELD_CONTENT); + case MP_STOP_PLAYBACK:{ + if (index == MP_TAB_SONGS) { + mp_list_realized_item_part_update(list, "elm.icon.left", + ELM_GENLIST_ITEM_FIELD_CONTENT); + } + break; } - break; - } default: break; } } -static int -_mp_all_view_init(Evas_Object *parent, MpAllView_t *view) +static int _mp_all_view_init(Evas_Object * parent, MpAllView_t * view) { startfunc; int ret = 0; - ret = mp_list_view_init(parent, (MpListView_t *)view, MP_VIEW_ALL); + ret = mp_list_view_init(parent, (MpListView_t *) view, MP_VIEW_ALL); MP_CHECK_VAL(ret == 0, -1); view->update = _mp_all_view_update; @@ -630,15 +696,18 @@ _mp_all_view_init(Evas_Object *parent, MpAllView_t *view) view->view_destroy_cb = _mp_all_view_destory_cb; view->on_event = _mp_all_view_on_event; - view->all_view_layout = mp_common_load_edj(view->layout, MP_EDJ_NAME, "common_view_layout"); + view->all_view_layout = + mp_common_load_edj(view->layout, MP_EDJ_NAME, + "common_view_layout"); MP_CHECK_VAL(view->all_view_layout, -1); - elm_object_part_content_set(view->layout, "list_content", view->all_view_layout); + elm_object_part_content_set(view->layout, "list_content", + view->all_view_layout); return ret; } -MpAllView_t *mp_all_view_create(Evas_Object *parent, MpTab_e init_tab) +MpAllView_t *mp_all_view_create(Evas_Object * parent, MpTab_e init_tab) { eventfunc; int ret; @@ -653,7 +722,6 @@ MpAllView_t *mp_all_view_create(Evas_Object *parent, MpTab_e init_tab) if (ret) { goto Error; } - #ifdef MP_FEATURE_PERSONAL_PAGE view->personal_page_status = mp_util_is_personal_page_on(); #endif @@ -662,27 +730,26 @@ MpAllView_t *mp_all_view_create(Evas_Object *parent, MpTab_e init_tab) PROFILE_OUT("_mp_all_view_content_load"); return view; -Error: + Error: ERROR_TRACE("Error: mp_all_view_create()"); IF_FREE(view); return NULL; } -int mp_all_view_destory(MpAllView_t *view) +int mp_all_view_destory(MpAllView_t * view) { startfunc; MP_CHECK_VAL(view, -1); return 0; } -int mp_all_view_select_tab(MpAllView_t *view, MpTab_e tab) +int mp_all_view_select_tab(MpAllView_t * view, MpTab_e tab) { startfunc; MP_CHECK_VAL(view, -1); - elm_toolbar_item_selected_set(mp_util_toolbar_nth_item(view->all_view_tabbar, tab), EINA_TRUE); - mp_view_update_options((MpView_t *)view); + elm_toolbar_item_selected_set(mp_util_toolbar_nth_item + (view->all_view_tabbar, tab), EINA_TRUE); + mp_view_update_options((MpView_t *) view); return 0; } - - diff --git a/src/view/mp-artist-detail-view.c b/src/view/mp-artist-detail-view.c index 3f136c2..e513ea5 100644 --- a/src/view/mp-artist-detail-view.c +++ b/src/view/mp-artist-detail-view.c @@ -22,23 +22,25 @@ #define MP_ARTIST_INDEX_ICON_SIZE (202 * elm_config_scale_get()) -static void _mp_artist_detail_view_tracklist_edit_cb(void *data, Evas_Object *obj, void *event_info); +static void _mp_artist_detail_view_tracklist_edit_cb(void *data, + Evas_Object * obj, + void *event_info); static void _mp_artist_detail_view_content_load(void *thiz); -static void _mp_artist_detail_view_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_artist_detail_view_cb(void *data, Evas_Object * obj, + void *event_info) { elm_naviframe_item_pop(GET_NAVIFRAME); } -static void -_mp_artist_detail_view_destory_cb(void *thiz) +static void _mp_artist_detail_view_destory_cb(void *thiz) { eventfunc; MpArtistDetailView_t *view = thiz; MP_CHECK(view); - mp_list_view_fini((MpListView_t *)view); + mp_list_view_fini((MpListView_t *) view); - /* TODO: release resource..*/ + /* TODO: release resource.. */ mp_artist_detail_view_destory(view); free(view); @@ -54,30 +56,34 @@ int _mp_artist_detail_view_update(void *thiz) _mp_artist_detail_view_content_load(view); if (edit_flag) { mp_list_set_edit(view->content_to_show, true); - mp_view_update_options_edit((MpView_t *)view); - mp_list_view_set_select_all((MpListView_t *)view, true); + mp_view_update_options_edit((MpView_t *) view); + mp_list_view_set_select_all((MpListView_t *) view, true); } else { - mp_view_update_options((MpView_t *)view); - mp_list_view_set_select_all((MpListView_t *)view, false); + mp_view_update_options((MpView_t *) view); + mp_list_view_set_select_all((MpListView_t *) view, false); } return 0; } -static void _mp_artist_detail_view_add_to_playlist_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_artist_detail_view_add_to_playlist_cb(void *data, + Evas_Object * obj, + void *event_info) { eventfunc; MpArtistDetailView_t *view = (MpArtistDetailView_t *) data; MP_CHECK(view); mp_evas_object_del(view->more_btn_ctxpopup); - mp_common_add_to_playlsit_view((MpListView_t *)view); + mp_common_add_to_playlsit_view((MpListView_t *) view); } -static void _mp_artist_detail_view_normal_more_btn_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_artist_detail_view_normal_more_btn_cb(void *data, + Evas_Object * obj, + void *event_info) { eventfunc; - MpArtistDetailView_t *view = (MpArtistDetailView_t *)data; + MpArtistDetailView_t *view = (MpArtistDetailView_t *) data; MP_CHECK(view); mp_evas_object_del(view->more_btn_ctxpopup); @@ -85,45 +91,63 @@ static void _mp_artist_detail_view_normal_more_btn_cb(void *data, Evas_Object *o view->more_btn_ctxpopup = mp_common_create_more_ctxpopup(view); MP_CHECK(view->more_btn_ctxpopup); - if (mp_list_get_editable_count(view->content_to_show, MP_LIST_EDIT_TYPE_NORMAL)) { + if (mp_list_get_editable_count + (view->content_to_show, MP_LIST_EDIT_TYPE_NORMAL)) { mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_ADD_TO_PLAYLIST, MP_PLAYER_MORE_BTN_ADD_TO_PLAYLSIT_IMAGE, _mp_artist_detail_view_add_to_playlist_cb, view); + STR_MP_ADD_TO_PLAYLIST, + MP_PLAYER_MORE_BTN_ADD_TO_PLAYLSIT_IMAGE, + _mp_artist_detail_view_add_to_playlist_cb, + view); mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_DELETE, MP_PLAYER_MORE_BTN_DELETE_IMAGE, _mp_artist_detail_view_tracklist_edit_cb, view); + STR_MP_DELETE, + MP_PLAYER_MORE_BTN_DELETE_IMAGE, + _mp_artist_detail_view_tracklist_edit_cb, + view); } - #ifdef MP_FEATURE_PERSONAL_PAGE if (mp_util_is_personal_page_on()) { - all_in_personal_e status = mp_common_is_all_in_personal_page(((MpList_t *)view->content_to_show)->genlist); - /*add*/ + all_in_personal_e status = + mp_common_is_all_in_personal_page(((MpList_t *) view-> + content_to_show)->genlist); + /*add */ if (status != MP_COMMON_ALL_IN && status != MP_COMMON_ALL_ERROR) mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_ADD_TO_PERSONAL_PAGE, MP_PLAYER_MORE_BTN_ADD_TO_PERSONAL_PAGE, mp_common_add_to_personal_page_cb, view); + STR_MP_ADD_TO_PERSONAL_PAGE, + MP_PLAYER_MORE_BTN_ADD_TO_PERSONAL_PAGE, + mp_common_add_to_personal_page_cb, + view); - /*remove*/ + /*remove */ if (status != MP_COMMON_ALL_OUT && status != MP_COMMON_ALL_ERROR) mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_REMOVE_FROM_PERSONAL_PAGE, MP_PLAYER_MORE_BTN_REMOVE_FROM_PERSONAL_PAGE, mp_common_remove_from_personal_page_cb, view); + STR_MP_REMOVE_FROM_PERSONAL_PAGE, + MP_PLAYER_MORE_BTN_REMOVE_FROM_PERSONAL_PAGE, + mp_common_remove_from_personal_page_cb, + view); } #endif - /*search*/ + /*search */ mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_SEARCH, NULL, mp_common_create_search_view_cb, view); + STR_MP_SEARCH, NULL, + mp_common_create_search_view_cb, view); /*mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_SETTINGS, MP_PLAYER_MORE_BTN_SETTING, mp_common_ctxpopup_setting_cb, view);*/ + STR_MP_SETTINGS, MP_PLAYER_MORE_BTN_SETTING, mp_common_ctxpopup_setting_cb, view); */ #ifndef MP_FEATURE_NO_END mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_END, MP_PLAYER_MORE_BTN_VIEW_END, mp_common_ctxpopup_end_cb, view); + STR_MP_END, MP_PLAYER_MORE_BTN_VIEW_END, + mp_common_ctxpopup_end_cb, view); #endif mp_util_more_btn_move_ctxpopup(view->more_btn_ctxpopup, obj); evas_object_show(view->more_btn_ctxpopup); } -/*************** functions for track list update *******************/ -static void _mp_artist_detail_view_tracklist_edit_cb(void *data, Evas_Object * obj, void *event_info) +/*************** functions for track list update *******************/ +static void _mp_artist_detail_view_tracklist_edit_cb(void *data, + Evas_Object * obj, + void *event_info) { eventfunc; MpArtistDetailView_t *view = (MpArtistDetailView_t *) data; @@ -131,7 +155,7 @@ static void _mp_artist_detail_view_tracklist_edit_cb(void *data, Evas_Object * o mp_evas_object_del(view->more_btn_ctxpopup); - mp_common_show_edit_view((MpListView_t *)view, MP_DONE_DELETE_TYPE); + mp_common_show_edit_view((MpListView_t *) view, MP_DONE_DELETE_TYPE); } /*static Eina_Bool _mp_artist_detail_view_tracklist_back_cb(void *data, Elm_Object_Item *it) @@ -162,23 +186,31 @@ static void _mp_artist_detail_view_tracklist_edit_cb(void *data, Evas_Object * o static int _mp_artist_detail_view_update_options(void *thiz) { startfunc; - MpArtistDetailView_t *view = (MpArtistDetailView_t *)thiz; + MpArtistDetailView_t *view = (MpArtistDetailView_t *) thiz; MP_CHECK_VAL(view, -1); - mp_view_clear_options((MpView_t *)view); + mp_view_clear_options((MpView_t *) view); Evas_Object *btn = NULL; - btn = mp_widget_create_toolbar_btn(view->artist_detail_view_layout, MP_TOOLBAR_BTN_MORE, NULL, _mp_artist_detail_view_normal_more_btn_cb, view); + btn = + mp_widget_create_toolbar_btn(view->artist_detail_view_layout, + MP_TOOLBAR_BTN_MORE, NULL, + _mp_artist_detail_view_normal_more_btn_cb, + view); - elm_object_item_part_content_set(view->navi_it, "toolbar_more_btn", btn); + elm_object_item_part_content_set(view->navi_it, "toolbar_more_btn", + btn); - Evas_Object *back_button = elm_button_add(view->artist_detail_view_layout); + Evas_Object *back_button = + elm_button_add(view->artist_detail_view_layout); elm_object_style_set(back_button, "naviframe/end_btn/default"); - elm_object_item_part_content_set(view->navi_it, "prev_btn", back_button); - evas_object_smart_callback_add(back_button, "clicked", _mp_artist_detail_view_cb, view); + elm_object_item_part_content_set(view->navi_it, "prev_btn", + back_button); + evas_object_smart_callback_add(back_button, "clicked", + _mp_artist_detail_view_cb, view); /* update the first controlba item */ - /* mp_view_manager_update_first_controlbar_item(layout_data);*/ + /* mp_view_manager_update_first_controlbar_item(layout_data); */ endfunc; return 0; } @@ -186,25 +218,33 @@ static int _mp_artist_detail_view_update_options(void *thiz) static void _mp_artist_detail_view_content_load(void *thiz) { startfunc; - MpArtistDetailView_t *view = (MpArtistDetailView_t *)thiz; + MpArtistDetailView_t *view = (MpArtistDetailView_t *) thiz; MP_CHECK(view); MP_CHECK(view->artist_detail_view_layout); - /*elm_object_part_content_set(view->layout, "list_content", view->artist_detail_view_layout);*/ + /*elm_object_part_content_set(view->layout, "list_content", view->artist_detail_view_layout); */ - view->content_to_show = (MpList_t *)mp_artist_detail_list_create(view->layout); + view->content_to_show = + (MpList_t *) mp_artist_detail_list_create(view->layout); MP_CHECK(view->content_to_show); - mp_artist_detail_list_set_data((MpArtistDetailList_t *)view->content_to_show, MP_ARTIST_DETAIL_LIST_TYPE, MP_TRACK_BY_ARTIST_ALBUM, MP_ARTIST_DETAIL_LIST_TYPE_STR, view->name, -1); + mp_artist_detail_list_set_data((MpArtistDetailList_t *) view-> + content_to_show, + MP_ARTIST_DETAIL_LIST_TYPE, + MP_TRACK_BY_ARTIST_ALBUM, + MP_ARTIST_DETAIL_LIST_TYPE_STR, + view->name, -1); mp_list_update(view->content_to_show); - elm_object_part_content_set(view->artist_detail_view_layout, "list_content", view->content_to_show->layout); + elm_object_part_content_set(view->artist_detail_view_layout, + "list_content", + view->content_to_show->layout); /* artist index */ - /*remove index part in artist detail view according to UI 3.6*/ - /* mp_evas_object_del(view->artist_index); + /*remove index part in artist detail view according to UI 3.6 */ + /* mp_evas_object_del(view->artist_index); - if (mp_list_get_editable_count(view->content_to_show, mp_list_get_edit_type(view->content_to_show))) { - view->artist_index = _mp_artist_detail_view_append_artist_index(view); - elm_object_part_content_set(view->artist_detail_view_layout, "tabbar", view->artist_index); - }*/ + if (mp_list_get_editable_count(view->content_to_show, mp_list_get_edit_type(view->content_to_show))) { + view->artist_index = _mp_artist_detail_view_append_artist_index(view); + elm_object_part_content_set(view->artist_detail_view_layout, "tabbar", view->artist_index); + } */ } static void @@ -215,33 +255,41 @@ _mp_artist_detaill_view_on_event(void *thiz, MpViewEvent_e event) switch (event) { case MP_DELETE_DONE: mp_list_update(view->content_to_show); - if (!mp_list_get_editable_count(view->content_to_show, mp_list_get_edit_type(view->content_to_show))) { - /* mp_view_mgr_pop_to_view(GET_VIEW_MGR, MP_VIEW_ALL);*/ + if (!mp_list_get_editable_count + (view->content_to_show, + mp_list_get_edit_type(view->content_to_show))) { + /* mp_view_mgr_pop_to_view(GET_VIEW_MGR, MP_VIEW_ALL); */ elm_object_item_del(view->navi_it); } /*mp_evas_object_del(view->artist_index); - if (mp_list_get_editable_count(view->content_to_show, mp_list_get_edit_type(view->content_to_show))) { - view->artist_index = _mp_artist_detail_view_append_artist_index(view); - elm_object_part_content_set(view->artist_detail_view_layout, "tabbar", view->artist_index); - }*/ + if (mp_list_get_editable_count(view->content_to_show, mp_list_get_edit_type(view->content_to_show))) { + view->artist_index = _mp_artist_detail_view_append_artist_index(view); + elm_object_part_content_set(view->artist_detail_view_layout, "tabbar", view->artist_index); + } */ break; case MP_POPUP_DELETE_DONE: mp_artist_detail_list_update_genlist(view->content_to_show); break; case MP_VIEW_EVENT_ALBUMART_CHANGED: - mp_list_realized_item_part_update(view->content_to_show, "elm.icon", ELM_GENLIST_ITEM_FIELD_CONTENT); + mp_list_realized_item_part_update(view->content_to_show, + "elm.icon", + ELM_GENLIST_ITEM_FIELD_CONTENT); break; #ifndef MP_SOUND_PLAYER case MP_UPDATE_PLAYING_LIST: - mp_list_realized_item_part_update(view->content_to_show, "elm.text.main.left", ELM_GENLIST_ITEM_FIELD_TEXT); - mp_list_realized_item_part_update(view->content_to_show, "elm.text.sub.right", ELM_GENLIST_ITEM_FIELD_TEXT); + mp_list_realized_item_part_update(view->content_to_show, + "elm.text.main.left", + ELM_GENLIST_ITEM_FIELD_TEXT); + mp_list_realized_item_part_update(view->content_to_show, + "elm.text.sub.right", + ELM_GENLIST_ITEM_FIELD_TEXT); break; #endif - case MP_UPDATE_FAVORITE_LIST: { - mp_list_update(view->content_to_show); - break; - } + case MP_UPDATE_FAVORITE_LIST:{ + mp_list_update(view->content_to_show); + break; + } default: break; @@ -249,25 +297,30 @@ _mp_artist_detaill_view_on_event(void *thiz, MpViewEvent_e event) } static int -_mp_artist_detail_view_init(Evas_Object *parent, MpArtistDetailView_t *view) +_mp_artist_detail_view_init(Evas_Object * parent, + MpArtistDetailView_t * view) { startfunc; int ret = 0; - ret = mp_list_view_init(parent, (MpListView_t *)view, MP_VIEW_ARTIST_DETAIL); + ret = + mp_list_view_init(parent, (MpListView_t *) view, + MP_VIEW_ARTIST_DETAIL); MP_CHECK_VAL(ret == 0, -1); view->update = _mp_artist_detail_view_update; view->update_options = _mp_artist_detail_view_update_options; - /*view->update_options_edit = _mp_artist_detail_view_update_options_edit;*/ + /*view->update_options_edit = _mp_artist_detail_view_update_options_edit; */ view->view_destroy_cb = _mp_artist_detail_view_destory_cb; view->on_event = _mp_artist_detaill_view_on_event; - view->artist_detail_view_layout = view->layout; /*mp_common_load_edj(parent, MP_EDJ_NAME, "common_view_layout");*/ + view->artist_detail_view_layout = view->layout; /*mp_common_load_edj(parent, MP_EDJ_NAME, "common_view_layout"); */ MP_CHECK_VAL(view->artist_detail_view_layout, -1); return ret; } -MpArtistDetailView_t *mp_artist_detail_view_create(Evas_Object *parent, char *name, char *thumbnail) +MpArtistDetailView_t *mp_artist_detail_view_create(Evas_Object * parent, + char *name, + char *thumbnail) { startfunc; int ret; @@ -288,13 +341,13 @@ MpArtistDetailView_t *mp_artist_detail_view_create(Evas_Object *parent, char *na _mp_artist_detail_view_content_load(view); return view; -Error: + Error: ERROR_TRACE("Error: mp_artist_detail_view_create()"); IF_FREE(view); return NULL; } -int mp_artist_detail_view_destory(MpArtistDetailView_t *view) +int mp_artist_detail_view_destory(MpArtistDetailView_t * view) { startfunc; MP_CHECK_VAL(view, -1); @@ -302,7 +355,3 @@ int mp_artist_detail_view_destory(MpArtistDetailView_t *view) IF_G_FREE(view->thumbnail); return 0; } - - - - diff --git a/src/view/mp-create-playlist-view.c b/src/view/mp-create-playlist-view.c index 2e242a1..001af23 100644 --- a/src/view/mp-create-playlist-view.c +++ b/src/view/mp-create-playlist-view.c @@ -30,24 +30,25 @@ typedef struct _Item_Data { } Item_Data; static void -mp_create_plst_view_rename_done_cb(void *data, Evas_Object * obj, void *event_info); +mp_create_plst_view_rename_done_cb(void *data, Evas_Object * obj, + void *event_info); -static void -_mp_create_plst_view_destory_cb(void *thiz) +static void _mp_create_plst_view_destory_cb(void *thiz) { eventfunc; MpCreatePlstView_t *view = thiz; MP_CHECK(view); - mp_view_fini((MpView_t *)view); + mp_view_fini((MpView_t *) view); - /*TODO: release resource..*/ + /*TODO: release resource.. */ IF_FREE(view->adding_media_id); free(view); } static Eina_Bool -_mp_create_playlist_view_create_new_cancel_cb(void *data, Elm_Object_Item *it) +_mp_create_playlist_view_create_new_cancel_cb(void *data, + Elm_Object_Item * it) { eventfunc; MpCreatePlstView_t *view = (MpCreatePlstView_t *) data; @@ -62,7 +63,8 @@ _mp_create_playlist_view_create_new_cancel_cb(void *data, Elm_Object_Item *it) } static void -_mp_create_playlist_view_create_new_done_cb(void *data, Evas_Object *obj, void *event_info) +_mp_create_playlist_view_create_new_done_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; MpCreatePlstView_t *view = (MpCreatePlstView_t *) data; @@ -71,13 +73,14 @@ _mp_create_playlist_view_create_new_done_cb(void *data, Evas_Object *obj, void * char *converted_name = NULL; /*Evas_Object *entry = mp_widget_editfield_entry_get(view->editfiled_new_playlist); - const char *name = elm_entry_entry_get(entry);*/ + const char *name = elm_entry_entry_get(entry); */ const char *name = elm_entry_entry_get(view->editfiled_entry); if (name == NULL || strlen(name) == 0) { - /*name = elm_object_part_text_get(view->editfiled_new_playlist, "elm.guidetext");*/ - name = elm_object_part_text_get(view->editfiled_entry, "elm.guide"); + /*name = elm_object_part_text_get(view->editfiled_new_playlist, "elm.guidetext"); */ + name = + elm_object_part_text_get(view->editfiled_entry, "elm.guide"); } converted_name = elm_entry_markup_to_utf8(name); @@ -92,7 +95,8 @@ _mp_create_playlist_view_create_new_done_cb(void *data, Evas_Object *obj, void * if (view->adding_list) { WARN_TRACE("adding list = %p", view->adding_list); - mp_edit_cb_excute_add_to_playlist(view->adding_list, plst_uid, converted_name, true); + mp_edit_cb_excute_add_to_playlist(view->adding_list, plst_uid, + converted_name, true); } IF_FREE(converted_name); @@ -102,7 +106,8 @@ _mp_create_playlist_view_create_new_done_cb(void *data, Evas_Object *obj, void * char *path = NULL; mp_media_info_create(&media_info, view->adding_media_id); mp_media_info_get_thumbnail_path(media_info, &path); - if (mp_media_info_playlist_add_item(playlist, view->adding_media_id, path) == 0) { + if (mp_media_info_playlist_add_item + (playlist, view->adding_media_id, path) == 0) { mp_media_info_playlist_db_update(playlist); } @@ -118,28 +123,35 @@ _mp_create_playlist_view_create_new_done_cb(void *data, Evas_Object *obj, void * if (view->parent_view == MP_PLST_PARENT_ALL_VIEW) { MpViewMgr_t *view_manager = mp_view_mgr_get_view_manager(); - MpAddTrackView_t *view_addtrack = mp_add_track_view_create(view_manager->navi, plst_uid); + MpAddTrackView_t *view_addtrack = + mp_add_track_view_create(view_manager->navi, plst_uid); MP_CHECK(view_addtrack); - mp_view_mgr_push_view(view_manager, (MpView_t *)view_addtrack, NULL); - - mp_view_update_options((MpView_t *)view_addtrack); - mp_list_set_edit((MpList_t *)view_addtrack->content_to_show, TRUE); - mp_list_view_set_select_all((MpListView_t *)view_addtrack, TRUE); - mp_view_set_title((MpView_t *)view_addtrack, STR_MP_TILTE_SELECT_ITEM); - - mp_add_track_view_select_tab(view_addtrack, MP_ADD_TRACK_VIEW_TAB_SONGS); + mp_view_mgr_push_view(view_manager, (MpView_t *) view_addtrack, + NULL); + + mp_view_update_options((MpView_t *) view_addtrack); + mp_list_set_edit((MpList_t *) view_addtrack->content_to_show, + TRUE); + mp_list_view_set_select_all((MpListView_t *) view_addtrack, TRUE); + mp_view_set_title((MpView_t *) view_addtrack, + STR_MP_TILTE_SELECT_ITEM); + + mp_add_track_view_select_tab(view_addtrack, + MP_ADD_TRACK_VIEW_TAB_SONGS); } } -static void _mp_create_playlist_view_realized_cb(void *data, Evas_Object *obj, void *ei) +static void _mp_create_playlist_view_realized_cb(void *data, + Evas_Object * obj, + void *ei) { eventfunc; Item_Data *id = elm_object_item_data_get(ei); if (!id) { return; } else { - /* if dialogue styles*/ + /* if dialogue styles */ if (id->dial == 1) { elm_object_item_signal_emit(ei, "elm,state,top", ""); } else if (id->dial == 2) { @@ -152,65 +164,74 @@ static void _mp_create_playlist_view_realized_cb(void *data, Evas_Object *obj, v static void -_mp_create_playlist_view_entry_eraser_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source) /* When X marked button is clicked, empty entry's contents.*/ -{ +_mp_create_playlist_view_entry_eraser_clicked_cb(void *data, + Evas_Object * obj, + const char *emission, + const char *source) +{ /* When X marked button is clicked, empty entry's contents. */ eventfunc; - Evas_Object *entry = (Evas_Object *)data; + Evas_Object *entry = (Evas_Object *) data; MP_CHECK(entry); elm_entry_entry_set(entry, ""); } static void -_mp_create_playlist_view_entry_changed_cb(void *data, Evas_Object *obj, void *event_info) +_mp_create_playlist_view_entry_changed_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; /*MpCreatePlstView_t *view = (MpCreatePlstView_t *)data; - Evas_Object *editfield = view->editfiled_new_playlist; - MP_CHECK(editfield); - - Evas_Object *entry = obj; - MP_CHECK(entry); - - Eina_Bool entry_empty = elm_entry_is_empty(entry); - const char *eraser_signal = NULL; - const char *guidetext_signal = NULL; - if (entry_empty) { - DEBUG_TRACE("NULL"); - eraser_signal = "elm,state,eraser,hide"; - guidetext_signal = "elm,state,guidetext,show"; - } else { - DEBUG_TRACE("NULL"); - eraser_signal = "elm,state,eraser,show"; - guidetext_signal = "elm,state,guidetext,hide"; - } - elm_object_signal_emit(editfield, eraser_signal, "elm"); - //elm_object_signal_emit(editfield, guidetext_signal, "elm"); - */ + Evas_Object *editfield = view->editfiled_new_playlist; + MP_CHECK(editfield); + + Evas_Object *entry = obj; + MP_CHECK(entry); + + Eina_Bool entry_empty = elm_entry_is_empty(entry); + const char *eraser_signal = NULL; + const char *guidetext_signal = NULL; + if (entry_empty) { + DEBUG_TRACE("NULL"); + eraser_signal = "elm,state,eraser,hide"; + guidetext_signal = "elm,state,guidetext,show"; + } else { + DEBUG_TRACE("NULL"); + eraser_signal = "elm,state,eraser,show"; + guidetext_signal = "elm,state,guidetext,hide"; + } + elm_object_signal_emit(editfield, eraser_signal, "elm"); + //elm_object_signal_emit(editfield, guidetext_signal, "elm"); + */ Item_Data *id = data; MP_CHECK(id); MP_CHECK(id->item); - Evas_Object *editfield = elm_object_item_part_content_get(id->item, "elm.icon.entry"); + Evas_Object *editfield = + elm_object_item_part_content_get(id->item, "elm.icon.entry"); MP_CHECK(editfield); if (elm_object_focus_get(obj)) { if (elm_entry_is_empty(obj)) { - elm_object_signal_emit(editfield, "elm,state,eraser,hide", "elm"); + elm_object_signal_emit(editfield, "elm,state,eraser,hide", + "elm"); } else { - elm_object_signal_emit(editfield, "elm,state,eraser,show", "elm"); + elm_object_signal_emit(editfield, "elm,state,eraser,show", + "elm"); } } } -static char * -_mp_create_plst_view_get_new_playlist_name(void) +static char *_mp_create_plst_view_get_new_playlist_name(void) { char unique_name[MP_PLAYLIST_NAME_SIZE] = "\0"; int ret = 0; - ret = mp_media_info_playlist_unique_name(GET_STR(STR_MP_MY_PLAYLIST), unique_name, MP_PLAYLIST_NAME_SIZE); + ret = + mp_media_info_playlist_unique_name(GET_STR(STR_MP_MY_PLAYLIST), + unique_name, + MP_PLAYLIST_NAME_SIZE); if (ret == 0) { if (strlen(unique_name) <= 0) { ERROR_TRACE("playlist name is NULL"); @@ -219,7 +240,9 @@ _mp_create_plst_view_get_new_playlist_name(void) return g_strdup(unique_name); } } else { - ERROR_TRACE("fail to mp_media_info_playlist_unique_name() : error code [%x] ", ret); + ERROR_TRACE + ("fail to mp_media_info_playlist_unique_name() : error code [%x] ", + ret); return NULL; } @@ -228,27 +251,30 @@ _mp_create_plst_view_get_new_playlist_name(void) -static void _mp_create_playlist_view_entry_focused_cb(void *data, Evas_Object *obj, void *event_info) /* Focused callback will show X marked button and hide rename icon.*/ -{ +static void _mp_create_playlist_view_entry_focused_cb(void *data, + Evas_Object * obj, + void *event_info) +{ /* Focused callback will show X marked button and hide rename icon. */ eventfunc; /*MpCreatePlstView_t *view = (MpCreatePlstView_t *)data; - Evas_Object *editfield = view->editfiled_new_playlist; - MP_CHECK(editfield); + Evas_Object *editfield = view->editfiled_new_playlist; + MP_CHECK(editfield); - Evas_Object *entry = obj; - MP_CHECK(entry); + Evas_Object *entry = obj; + MP_CHECK(entry); - Eina_Bool entry_empty = elm_entry_is_empty(entry); + Eina_Bool entry_empty = elm_entry_is_empty(entry); - if (!entry_empty) - elm_object_signal_emit(editfield, "elm,state,eraser,show", "elm"); - elm_object_signal_emit(editfield, "elm,state,rename,hide", "elm"); - */ + if (!entry_empty) + elm_object_signal_emit(editfield, "elm,state,eraser,show", "elm"); + elm_object_signal_emit(editfield, "elm,state,rename,hide", "elm"); + */ Item_Data *id = data; MP_CHECK(id); MP_CHECK(id->item); - Evas_Object *editfield = elm_object_item_part_content_get(id->item, "elm.icon.entry"); + Evas_Object *editfield = + elm_object_item_part_content_get(id->item, "elm.icon.entry"); MP_CHECK(editfield); if (!elm_entry_is_empty(obj)) { @@ -259,32 +285,36 @@ static void _mp_create_playlist_view_entry_focused_cb(void *data, Evas_Object *o if (id->view->parent_view == MP_PLST_PARENT_DETAIL_VIEW) { elm_object_signal_emit(editfield, "elm,state,eraser,hide", "elm"); - elm_entry_entry_set(id->view->editfiled_entry, id->view->name); + elm_entry_entry_set(id->view->editfiled_entry, id->view->name); elm_entry_cursor_end_set(id->view->editfiled_entry); } else if (id->view->new_playlist_name) { - elm_entry_entry_set(id->view->editfiled_entry, id->view->new_playlist_name); + elm_entry_entry_set(id->view->editfiled_entry, + id->view->new_playlist_name); elm_entry_cursor_end_set(id->view->editfiled_entry); } } -static void _mp_create_playlist_view_entry_unfocused_cb(void *data, Evas_Object *obj, void *event_info) /* Unfocused callback will show rename icon and hide X marked button.*/ -{ +static void _mp_create_playlist_view_entry_unfocused_cb(void *data, + Evas_Object * obj, + void *event_info) +{ /* Unfocused callback will show rename icon and hide X marked button. */ eventfunc; /*MpCreatePlstView_t *view = (MpCreatePlstView_t *)data; - Evas_Object *editfield = view->editfiled_new_playlist; - MP_CHECK(editfield); + Evas_Object *editfield = view->editfiled_new_playlist; + MP_CHECK(editfield); - Evas_Object *entry = obj; - MP_CHECK(entry); + Evas_Object *entry = obj; + MP_CHECK(entry); - elm_object_signal_emit(editfield, "elm,state,eraser,hide", "elm"); - elm_object_signal_emit(editfield, "elm,state,rename,show", "elm"); - */ + elm_object_signal_emit(editfield, "elm,state,eraser,hide", "elm"); + elm_object_signal_emit(editfield, "elm,state,rename,show", "elm"); + */ Item_Data *id = data; MP_CHECK(id); MP_CHECK(id->item); - Evas_Object *editfield = elm_object_item_part_content_get(id->item, "elm.icon.entry"); + Evas_Object *editfield = + elm_object_item_part_content_get(id->item, "elm.icon.entry"); MP_CHECK(editfield); elm_object_signal_emit(editfield, "elm,state,eraser,hide", "elm"); @@ -292,10 +322,11 @@ static void _mp_create_playlist_view_entry_unfocused_cb(void *data, Evas_Object } static void -_mp_create_plst_entry_maxlength_reached_cb(void *data, Evas_Object * obj, void *event_info) +_mp_create_plst_entry_maxlength_reached_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; - MpCreatePlstView_t *view = (MpCreatePlstView_t *)data; + MpCreatePlstView_t *view = (MpCreatePlstView_t *) data; MP_CHECK(view); Evas_Object *editfiled_entry = view->editfiled_entry; @@ -311,66 +342,86 @@ _mp_create_plst_entry_maxlength_reached_cb(void *data, Evas_Object * obj, void * } -static Evas_Object * -_mp_create_plst_gl_icon_get(void *data, Evas_Object * obj, const char *part) +static Evas_Object *_mp_create_plst_gl_icon_get(void *data, + Evas_Object * obj, + const char *part) { - Item_Data *id = (Item_Data *)data; - MpCreatePlstView_t *view = (MpCreatePlstView_t *)id->view; + Item_Data *id = (Item_Data *) data; + MpCreatePlstView_t *view = (MpCreatePlstView_t *) id->view; MP_CHECK_NULL(view); MP_CHECK_NULL(obj); - if (!strcmp(part, "elm.icon.entry")) {/* Add elm_entry to current editfield genlist item.*/ + if (!strcmp(part, "elm.icon.entry")) { /* Add elm_entry to current editfield genlist item. */ Evas_Object *entry = elm_entry_add(obj); elm_entry_scrollable_set(entry, EINA_TRUE); - elm_scroller_policy_set(entry, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); + elm_scroller_policy_set(entry, ELM_SCROLLER_POLICY_OFF, + ELM_SCROLLER_POLICY_AUTO); elm_entry_single_line_set(entry, EINA_TRUE); - evas_object_smart_callback_add(entry, "changed", _mp_create_playlist_view_entry_changed_cb, id); - evas_object_smart_callback_add(entry, "preedit,changed", _mp_create_playlist_view_entry_changed_cb, id); - evas_object_smart_callback_add(entry, "focused", _mp_create_playlist_view_entry_focused_cb, id); - evas_object_smart_callback_add(entry, "unfocused", _mp_create_playlist_view_entry_unfocused_cb, id); + evas_object_smart_callback_add(entry, "changed", + _mp_create_playlist_view_entry_changed_cb, + id); + evas_object_smart_callback_add(entry, "preedit,changed", + _mp_create_playlist_view_entry_changed_cb, + id); + evas_object_smart_callback_add(entry, "focused", + _mp_create_playlist_view_entry_focused_cb, + id); + evas_object_smart_callback_add(entry, "unfocused", + _mp_create_playlist_view_entry_unfocused_cb, + id); static Elm_Entry_Filter_Limit_Size limit_filter_data; limit_filter_data.max_char_count = 0; limit_filter_data.max_byte_count = MP_PLAYLIST_NAME_SIZE; - elm_entry_markup_filter_append(entry, elm_entry_filter_limit_size, &limit_filter_data); - evas_object_smart_callback_add(entry, "maxlength,reached", _mp_create_plst_entry_maxlength_reached_cb, view); - - elm_entry_input_panel_return_key_type_set(entry, ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE); - - if (view->new_playlist_name && (view->parent_view != MP_PLST_PARENT_DETAIL_VIEW)) { - /*elm_object_part_text_set(entry, "elm.guide", view->new_playlist_name);*/ + elm_entry_markup_filter_append(entry, elm_entry_filter_limit_size, + &limit_filter_data); + evas_object_smart_callback_add(entry, "maxlength,reached", + _mp_create_plst_entry_maxlength_reached_cb, + view); + + elm_entry_input_panel_return_key_type_set(entry, + ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE); + + if (view->new_playlist_name + && (view->parent_view != MP_PLST_PARENT_DETAIL_VIEW)) { + /*elm_object_part_text_set(entry, "elm.guide", view->new_playlist_name); */ elm_entry_entry_set(entry, view->new_playlist_name); elm_entry_cursor_end_set(entry); } view->editfiled_entry = entry; if (view->parent_view == MP_PLST_PARENT_DETAIL_VIEW) { - evas_object_smart_callback_add(entry, "activated", mp_create_plst_view_rename_done_cb, view); + evas_object_smart_callback_add(entry, "activated", + mp_create_plst_view_rename_done_cb, + view); if (view->name) { elm_entry_entry_set(view->editfiled_entry, view->name); elm_entry_cursor_end_set(view->editfiled_entry); } } else { - evas_object_smart_callback_add(entry, "activated", _mp_create_playlist_view_create_new_done_cb, view); + evas_object_smart_callback_add(entry, "activated", + _mp_create_playlist_view_create_new_done_cb, + view); } - elm_object_signal_callback_add(entry, "elm,eraser,clicked", "elm", _mp_create_playlist_view_entry_eraser_clicked_cb, entry); + elm_object_signal_callback_add(entry, "elm,eraser,clicked", "elm", + _mp_create_playlist_view_entry_eraser_clicked_cb, + entry); return entry; } return NULL; } -static void _mp_create_plst_item_del(void *data, Evas_Object *obj) +static void _mp_create_plst_item_del(void *data, Evas_Object * obj) { Item_Data *item_data = (Item_Data *) data; MP_CHECK(item_data); IF_FREE(item_data); } -Evas_Object * -_mp_create_plst_view_create_editfield_layout(void *thiz) +Evas_Object *_mp_create_plst_view_create_editfield_layout(void *thiz) { startfunc; Evas_Object *genlist = NULL; @@ -378,23 +429,26 @@ _mp_create_plst_view_create_editfield_layout(void *thiz) static Elm_Genlist_Item_Class itc; Item_Data *id = NULL; - MpCreatePlstView_t *view = (MpCreatePlstView_t *)thiz; + MpCreatePlstView_t *view = (MpCreatePlstView_t *) thiz; MP_CHECK_NULL(view); view->create_plst_layout = elm_layout_add(view->layout); MP_CHECK_NULL(view->create_plst_layout); - char edje_path[1024] ={0}; - char * path = app_get_resource_path(); + char edje_path[1024] = { 0 }; + char *path = app_get_resource_path(); MP_CHECK_NULL(path); snprintf(edje_path, 1024, "%s%s/%s", path, "edje", EDJ_NAME); - elm_layout_file_set(view->create_plst_layout, edje_path, "create_playlist"); + elm_layout_file_set(view->create_plst_layout, edje_path, + "create_playlist"); free(path); genlist = mp_widget_genlist_create(view->create_plst_layout); elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS); - evas_object_smart_callback_add(genlist, "realized", _mp_create_playlist_view_realized_cb, NULL); + evas_object_smart_callback_add(genlist, "realized", + _mp_create_playlist_view_realized_cb, + NULL); itc.version = ELM_GENGRID_ITEM_CLASS_VERSION; itc.refcount = 0; @@ -408,43 +462,45 @@ _mp_create_plst_view_create_editfield_layout(void *thiz) id = calloc(sizeof(Item_Data), 1); MP_CHECK_NULL(id); id->view = view; - item = elm_genlist_item_append(genlist, &itc, id, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);/*id replace view*/ + item = elm_genlist_item_append(genlist, &itc, id, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); /*id replace view */ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_NONE); elm_object_scroll_freeze_push(genlist); id->item = item; - elm_object_part_content_set(view->create_plst_layout, "elm.swallow.content", genlist); + elm_object_part_content_set(view->create_plst_layout, + "elm.swallow.content", genlist); evas_object_show(view->create_plst_layout); return view->create_plst_layout; } -static Evas_Object * -_mp_create_plst_view_content_create(void *thiz) +static Evas_Object *_mp_create_plst_view_content_create(void *thiz) { startfunc; char *new_playlist_name = NULL; - MpCreatePlstView_t *view = (MpCreatePlstView_t *)thiz; + MpCreatePlstView_t *view = (MpCreatePlstView_t *) thiz; MP_CHECK_NULL(view); Evas_Object *create_plst_layout = NULL; view->new_playlist_name = _mp_create_plst_view_get_new_playlist_name(); - create_plst_layout = _mp_create_plst_view_create_editfield_layout(view); + create_plst_layout = + _mp_create_plst_view_create_editfield_layout(view); IF_FREE(new_playlist_name); MP_CHECK_NULL(create_plst_layout); /*elm_object_item_text_set(it, GET_STR("IDS_MUSIC_BODY_CREATE_PLAYLIST")); - mp_language_mgr_register_object_item(it, "IDS_MUSIC_BODY_CREATE_PLAYLIST");*/ + mp_language_mgr_register_object_item(it, "IDS_MUSIC_BODY_CREATE_PLAYLIST"); */ evas_object_show(create_plst_layout); return create_plst_layout; } static void -mp_create_plst_view_rename_done_cb(void *data, Evas_Object * obj, void *event_info) +mp_create_plst_view_rename_done_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; - MpCreatePlstView_t *view = (MpCreatePlstView_t *)data; + MpCreatePlstView_t *view = (MpCreatePlstView_t *) data; MP_CHECK(view); Evas_Object *editfiled_entry = view->editfiled_entry; @@ -458,14 +514,18 @@ mp_create_plst_view_rename_done_cb(void *data, Evas_Object * obj, void *event_in struct appdata *ad = mp_util_get_appdata(); text = mp_util_isf_get_edited_str(editfiled_entry, TRUE); - if (!mp_util_is_playlist_name_valid((char *)text)) { - mp_widget_text_popup(ad, GET_STR("IDS_MUSIC_POP_UNABLE_RENAME_PLAYLIST")); + if (!mp_util_is_playlist_name_valid((char *) text)) { + mp_widget_text_popup(ad, + GET_STR + ("IDS_MUSIC_POP_UNABLE_RENAME_PLAYLIST")); } else { bool exist = false; ret = mp_media_info_playlist_is_exist(text, &exist); if (ret != 0) { ERROR_TRACE("Fail to get playlist count by name: %d", ret); - mp_widget_text_popup(ad, GET_STR("IDS_MUSIC_POP_UNABLE_RENAME_PLAYLIST")); + mp_widget_text_popup(ad, + GET_STR + ("IDS_MUSIC_POP_UNABLE_RENAME_PLAYLIST")); } else if (exist) { mp_widget_text_popup(ad, GET_STR(STR_MP_POP_EXISTS)); return; @@ -473,7 +533,9 @@ mp_create_plst_view_rename_done_cb(void *data, Evas_Object * obj, void *event_in ret = mp_media_info_playlist_rename(playlist, text); if (ret == 0) { mp_debug("mp_media_info_playlist_rename().. OK"); - MpView_t *create_playlist_detail_view = mp_view_mgr_get_view(GET_VIEW_MGR, MP_VIEW_PLAYLIST_DETAIL); + MpView_t *create_playlist_detail_view = + mp_view_mgr_get_view(GET_VIEW_MGR, + MP_VIEW_PLAYLIST_DETAIL); mp_view_set_title(create_playlist_detail_view, text); mp_view_mgr_post_event(GET_VIEW_MGR, MP_PLAYLIST_RENAMED); @@ -489,23 +551,34 @@ mp_create_plst_view_rename_done_cb(void *data, Evas_Object * obj, void *event_in static int _mp_create_plst_view_create_title_buttons(void *thiz) { startfunc; - MpCreatePlstView_t *view = (MpCreatePlstView_t *)thiz; + MpCreatePlstView_t *view = (MpCreatePlstView_t *) thiz; - Evas_Object *cancel_btn = mp_create_title_text_btn(view->create_plst_layout, STR_MP_CANCEL, mp_common_view_cancel_cb, view); - Evas_Object *save_btn = mp_create_title_text_btn(view->create_plst_layout, "IDS_COM_SK_SAVE", NULL, view); + Evas_Object *cancel_btn = + mp_create_title_text_btn(view->create_plst_layout, STR_MP_CANCEL, + mp_common_view_cancel_cb, view); + Evas_Object *save_btn = + mp_create_title_text_btn(view->create_plst_layout, + "IDS_COM_SK_SAVE", NULL, view); - elm_object_item_part_content_set(view->navi_it, "title_left_btn", cancel_btn); - elm_object_item_part_content_set(view->navi_it, "title_right_btn", save_btn); + elm_object_item_part_content_set(view->navi_it, "title_left_btn", + cancel_btn); + elm_object_item_part_content_set(view->navi_it, "title_right_btn", + save_btn); if (view->parent_view == MP_PLST_PARENT_DETAIL_VIEW) { - mp_media_info_group_get_main_info(view->playlist_handle, &view->name); + mp_media_info_group_get_main_info(view->playlist_handle, + &view->name); if (view->name) { - elm_entry_entry_set(view->editfiled_entry, view->name); + elm_entry_entry_set(view->editfiled_entry, view->name); elm_entry_cursor_end_set(view->editfiled_entry); } - evas_object_smart_callback_add(save_btn, "clicked", mp_create_plst_view_rename_done_cb, view); + evas_object_smart_callback_add(save_btn, "clicked", + mp_create_plst_view_rename_done_cb, + view); } else { - evas_object_smart_callback_add(save_btn, "clicked", _mp_create_playlist_view_create_new_done_cb, view); + evas_object_smart_callback_add(save_btn, "clicked", + _mp_create_playlist_view_create_new_done_cb, + view); } return 0; @@ -514,21 +587,23 @@ static int _mp_create_plst_view_create_title_buttons(void *thiz) static int _mp_create_plst_view_update_options(void *thiz) { startfunc; - MpCreatePlstView_t *view = (MpCreatePlstView_t *)thiz; + MpCreatePlstView_t *view = (MpCreatePlstView_t *) thiz; /*_mp_create_plst_view_update_option_clear(view);*/ /* add buttons */ /* - Evas_Object *toolbar = mp_widget_create_naviframe_toolbar(view->navi_it); - Elm_Object_Item *toolbar_item = NULL; + Evas_Object *toolbar = mp_widget_create_naviframe_toolbar(view->navi_it); + Elm_Object_Item *toolbar_item = NULL; - toolbar_item = mp_widget_create_toolbar_item_btn(toolbar, MP_TOOLBAR_BTN_DEFAULT, GET_SYS_STR("IDS_COM_SK_SAVE"), _mp_create_playlist_view_create_new_done_cb, view); - view->toolbar_options[MP_OPTION_LEFT] = toolbar_item; - */ + toolbar_item = mp_widget_create_toolbar_item_btn(toolbar, MP_TOOLBAR_BTN_DEFAULT, GET_SYS_STR("IDS_COM_SK_SAVE"), _mp_create_playlist_view_create_new_done_cb, view); + view->toolbar_options[MP_OPTION_LEFT] = toolbar_item; + */ _mp_create_plst_view_create_title_buttons(thiz); - elm_naviframe_item_pop_cb_set(view->navi_it, _mp_create_playlist_view_create_new_cancel_cb, view); + elm_naviframe_item_pop_cb_set(view->navi_it, + _mp_create_playlist_view_create_new_cancel_cb, + view); evas_object_show(view->editfiled_entry); elm_object_focus_set(view->editfiled_entry, EINA_TRUE); @@ -536,8 +611,7 @@ static int _mp_create_plst_view_update_options(void *thiz) return 0; } -static void -_mp_create_plst_view_on_event(void *thiz, MpViewEvent_e event) +static void _mp_create_plst_view_on_event(void *thiz, MpViewEvent_e event) { DEBUG_TRACE("event; %d", event); MpCreatePlstView_t *view = thiz; @@ -546,10 +620,10 @@ _mp_create_plst_view_on_event(void *thiz, MpViewEvent_e event) switch (event) { case MP_SIP_STATE_CHANGED: /* - if (view->navi_it) { - bool title_visible = (mp_util_get_sip_state() && mp_util_is_landscape()) ? false : true; - mp_view_set_title_visible(view, title_visible); - }*/ + if (view->navi_it) { + bool title_visible = (mp_util_get_sip_state() && mp_util_is_landscape()) ? false : true; + mp_view_set_title_visible(view, title_visible); + } */ break; case MP_VIEW_TRANSITION_FINISHED: elm_object_focus_set(view->editfiled_entry, EINA_TRUE); @@ -561,11 +635,11 @@ _mp_create_plst_view_on_event(void *thiz, MpViewEvent_e event) } static int -_mp_create_plst_view_init(Evas_Object *parent, MpCreatePlstView_t *view) +_mp_create_plst_view_init(Evas_Object * parent, MpCreatePlstView_t * view) { startfunc; int ret = 0; - ret = mp_view_init(parent, (MpView_t *)view, MP_VIEW_CREATE_PLAYLIT); + ret = mp_view_init(parent, (MpView_t *) view, MP_VIEW_CREATE_PLAYLIT); MP_CHECK_VAL(ret == 0, -1); view->update = NULL; @@ -583,12 +657,13 @@ _mp_create_plst_view_init(Evas_Object *parent, MpCreatePlstView_t *view) view->create_plst_layout = _mp_create_plst_view_content_create(view); MP_CHECK_VAL(view->create_plst_layout, -1); - elm_object_part_content_set(view->layout, "list_content", view->create_plst_layout); + elm_object_part_content_set(view->layout, "list_content", + view->create_plst_layout); return ret; } -MpCreatePlstView_t *mp_create_plst_view_create(Evas_Object *parent) +MpCreatePlstView_t *mp_create_plst_view_create(Evas_Object * parent) { eventfunc; int ret; @@ -605,13 +680,14 @@ MpCreatePlstView_t *mp_create_plst_view_create(Evas_Object *parent) return view; -Error: + Error: ERROR_TRACE("Error: mp_create_plst_view_create()"); IF_FREE(view); return NULL; } -int mp_create_plst_view_set_edit_list(MpCreatePlstView_t *view, MpList_t *adding_list) +int mp_create_plst_view_set_edit_list(MpCreatePlstView_t * view, + MpList_t * adding_list) { startfunc; MP_CHECK_VAL(view, -1); @@ -619,7 +695,8 @@ int mp_create_plst_view_set_edit_list(MpCreatePlstView_t *view, MpList_t *adding return 0; } -int mp_create_plst_view_set_media_id(MpCreatePlstView_t *view, const char *adding_media_id) +int mp_create_plst_view_set_media_id(MpCreatePlstView_t * view, + const char *adding_media_id) { startfunc; MP_CHECK_VAL(view, -1); @@ -627,14 +704,15 @@ int mp_create_plst_view_set_media_id(MpCreatePlstView_t *view, const char *addin return 0; } -int mp_create_plst_view_set_creation_type(MpCreatePlstView_t *view, mp_plst_creation_type_e type) +int mp_create_plst_view_set_creation_type(MpCreatePlstView_t * view, + mp_plst_creation_type_e type) { MP_CHECK_VAL(view, -1); view->creation_type = type; return 0; } -int mp_create_plst_view_destory(MpCreatePlstView_t *view) +int mp_create_plst_view_destory(MpCreatePlstView_t * view) { startfunc; MP_CHECK_VAL(view, -1); diff --git a/src/view/mp-detail-view.c b/src/view/mp-detail-view.c index 470ec57..7aeffa4 100644 --- a/src/view/mp-detail-view.c +++ b/src/view/mp-detail-view.c @@ -36,15 +36,17 @@ typedef struct { char *detail; } mp_media_info_t; -#define NAVIFRAME_DETAIL_STYLE NULL /*"music/player_view"*/ +#define NAVIFRAME_DETAIL_STYLE NULL /*"music/player_view" */ #define MP_ALBUM_INDEX_ICON_SIZE (360 * elm_config_scale_get()) #define MP_ALBUM_INDEX_ICON_SIZE_W_LD (280 * elm_config_scale_get()) #define MP_ALBUM_INDEX_ICON_SIZE_H_LD (272 * elm_config_scale_get()) -static void _mp_detail_view_pop_on_back_button(void *data, Evas_Object *obj, void *event_info); +static void _mp_detail_view_pop_on_back_button(void *data, + Evas_Object * obj, + void *event_info); -static char * -_mp_detail_view_get_location_info_from_file_path(char *file_path) +static char *_mp_detail_view_get_location_info_from_file_path(char + *file_path) { mp_retvm_if(!file_path, NULL, "File path is null..."); @@ -77,14 +79,15 @@ _mp_detail_view_get_location_info_from_file_path(char *file_path) } static void -_mp_detail_view_append_media_info_item(Evas_Object *genlist, char *header, char *detail) +_mp_detail_view_append_media_info_item(Evas_Object * genlist, char *header, + char *detail) { MpDetailView_t *view = NULL; mp_media_info_t *info = NULL; MP_CHECK(genlist); - view = (MpDetailView_t *)evas_object_data_get(genlist, "view"); + view = (MpDetailView_t *) evas_object_data_get(genlist, "view"); MP_CHECK(view); MP_CHECK(view->meta_itc); @@ -93,18 +96,19 @@ _mp_detail_view_append_media_info_item(Evas_Object *genlist, char *header, char info->header = g_strdup(header); info->detail = g_strdup(detail); - Elm_Object_Item *item = elm_genlist_item_append(genlist, view->meta_itc, - info, - NULL, - ELM_GENLIST_ITEM_NONE, - NULL, NULL); + Elm_Object_Item *item = + elm_genlist_item_append(genlist, view->meta_itc, + info, + NULL, + ELM_GENLIST_ITEM_NONE, + NULL, NULL); if (item) { - elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + elm_genlist_item_select_mode_set(item, + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); } } -static void -_mp_detail_info_gl_item_del(void *data, Evas_Object * obj) +static void _mp_detail_info_gl_item_del(void *data, Evas_Object * obj) { mp_media_info_t *info = data; MP_CHECK(info); @@ -114,8 +118,9 @@ _mp_detail_info_gl_item_del(void *data, Evas_Object * obj) } -static char * -_mp_detail_view_info_gl_text_get(void *data, Evas_Object * obj, const char *part) +static char *_mp_detail_view_info_gl_text_get(void *data, + Evas_Object * obj, + const char *part) { mp_media_info_t *info = data; MP_CHECK_NULL(info); @@ -135,8 +140,7 @@ _mp_detail_view_info_gl_text_get(void *data, Evas_Object * obj, const char *part return NULL; } -static void -_mp_detail_view_set_itc(void *thiz, mp_detail_view_itc type) +static void _mp_detail_view_set_itc(void *thiz, mp_detail_view_itc type) { startfunc; MpDetailView_t *view = thiz; @@ -158,14 +162,15 @@ _mp_detail_view_set_itc(void *thiz, mp_detail_view_itc type) } } -static Evas_Object * -_mp_detail_view_create_genlist(Evas_Object *parent) +static Evas_Object *_mp_detail_view_create_genlist(Evas_Object * parent) { startfunc; Evas_Object *genlist = NULL; genlist = mp_widget_genlist_create(parent); - evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, + EVAS_HINT_FILL); elm_genlist_homogeneous_set(genlist, EINA_FALSE); endfunc; @@ -174,7 +179,7 @@ _mp_detail_view_create_genlist(Evas_Object *parent) #define MP_ROUND_D(x, dig) (floor((x) * pow(10, dig+1) + 0.5) / pow(10, dig+1)) -int _mp_detail_view_get_file_size(const char *filename, off_t *size) +int _mp_detail_view_get_file_size(const char *filename, off_t * size) { MP_CHECK_VAL(filename, -1); struct stat statbuf; @@ -194,8 +199,8 @@ void _mp_detail_view_get_file_size_info(char **file_size, off_t src_size) int index = 0; int len = 0; - original_size = (unsigned long long)src_size; - size = (double)original_size; + original_size = (unsigned long long) src_size; + size = (double) original_size; while (size >= 1024) { size /= 1024; @@ -214,7 +219,7 @@ void _mp_detail_view_get_file_size_info(char **file_size, off_t src_size) return; } len += 1; - *file_size = (char *)calloc(len, sizeof(char)); + *file_size = (char *) calloc(len, sizeof(char)); if (*file_size == NULL) { return; @@ -237,8 +242,8 @@ void _mp_detail_view_get_file_size_info(char **file_size, off_t src_size) return; } -static Evas_Object * -_mp_detail_view_create_local_without_metadata(void *thiz) +static Evas_Object *_mp_detail_view_create_local_without_metadata(void + *thiz) { startfunc; MpDetailView_t *view = thiz; @@ -252,8 +257,10 @@ _mp_detail_view_create_local_without_metadata(void *thiz) bool get_item = false; - char *pathname = NULL, *title = NULL, *album = NULL, *artist = NULL, *thumbname = NULL, *date = NULL; - char *author = NULL, *copyright = NULL, *track = NULL, *sample = NULL, *mime_type = NULL; + char *pathname = NULL, *title = NULL, *album = NULL, *artist = + NULL, *thumbname = NULL, *date = NULL; + char *author = NULL, *copyright = NULL, *track = NULL, *sample = + NULL, *mime_type = NULL; int duration = 0; char *location = NULL; @@ -284,7 +291,9 @@ _mp_detail_view_create_local_without_metadata(void *thiz) mp_media_info_get_duration(svc_item, &duration); mp_media_info_get_track_num(svc_item, &track); mp_media_info_get_sample_rate(svc_item, &sample_rate); - location = _mp_detail_view_get_location_info_from_file_path(view->uri); + location = + _mp_detail_view_get_location_info_from_file_path(view-> + uri); mime_type = mp_util_file_mime_type_get(view->uri); mp_media_info_get_bitpersample(svc_item, &bitpersample); off_t size = 0; @@ -295,14 +304,19 @@ _mp_detail_view_create_local_without_metadata(void *thiz) } if (get_item) { - _mp_detail_view_append_media_info_item(genlist, MP_DETAIL_TITLE_STR, title); + _mp_detail_view_append_media_info_item(genlist, + MP_DETAIL_TITLE_STR, title); if (artist && strlen(artist)) { - _mp_detail_view_append_media_info_item(genlist, MP_DETAIL_ARTIST_STR, artist); + _mp_detail_view_append_media_info_item(genlist, + MP_DETAIL_ARTIST_STR, + artist); } if (album && strlen(album)) { - _mp_detail_view_append_media_info_item(genlist, MP_DETAIL_ALBUM_STR, album); + _mp_detail_view_append_media_info_item(genlist, + MP_DETAIL_ALBUM_STR, + album); } @@ -310,45 +324,64 @@ _mp_detail_view_create_local_without_metadata(void *thiz) int dur_sec = duration / 1000; int sec = dur_sec % 60; int min = dur_sec / 60; - snprintf(duration_format, sizeof(duration_format), "%02u:%02u", min, sec); + snprintf(duration_format, sizeof(duration_format), "%02u:%02u", + min, sec); - _mp_detail_view_append_media_info_item(genlist, MP_DETAIL_LENGTH_STR, - duration_format); + _mp_detail_view_append_media_info_item(genlist, + MP_DETAIL_LENGTH_STR, + duration_format); if (date && strlen(date)) { - _mp_detail_view_append_media_info_item(genlist, MP_DETAIL_RECORDED_DATE_STR, date); + _mp_detail_view_append_media_info_item(genlist, + MP_DETAIL_RECORDED_DATE_STR, + date); } if (author && strlen(author)) { - _mp_detail_view_append_media_info_item(genlist, MP_DETAIL_AUTHOR_STR, author); + _mp_detail_view_append_media_info_item(genlist, + MP_DETAIL_AUTHOR_STR, + author); } if (copyright && strlen(copyright)) { - _mp_detail_view_append_media_info_item(genlist, MP_DETAIL_COPYRIGHT_STR, copyright); + _mp_detail_view_append_media_info_item(genlist, + MP_DETAIL_COPYRIGHT_STR, + copyright); } if (track && strlen(track)) { - _mp_detail_view_append_media_info_item(genlist, MP_DETAIL_NUMBER_STR, track); + _mp_detail_view_append_media_info_item(genlist, + MP_DETAIL_NUMBER_STR, + track); } - _mp_detail_view_append_media_info_item(genlist, MP_DETAIL_FORMAT_STR, mime_type); + _mp_detail_view_append_media_info_item(genlist, + MP_DETAIL_FORMAT_STR, + mime_type); bitdepth = g_strdup_printf("%d bit", bitpersample); - _mp_detail_view_append_media_info_item(genlist, MP_DETAIL_BITDEPTH_STR, bitdepth); + _mp_detail_view_append_media_info_item(genlist, + MP_DETAIL_BITDEPTH_STR, + bitdepth); SAFE_FREE(bitdepth); - sample = g_strdup_printf("%dKHz", sample_rate / 1000); - _mp_detail_view_append_media_info_item(genlist, MP_DETAIL_SAMPLING_STR, sample); + sample = g_strdup_printf("%dKHz", sample_rate / 1000); + _mp_detail_view_append_media_info_item(genlist, + MP_DETAIL_SAMPLING_STR, + sample); SAFE_FREE(sample); - _mp_detail_view_append_media_info_item(genlist, MP_DETAIL_SIZE_STR, size_string); + _mp_detail_view_append_media_info_item(genlist, MP_DETAIL_SIZE_STR, + size_string); SAFE_FREE(size_string); - _mp_detail_view_append_media_info_item(genlist, MP_DETAIL_LOCATION_STR, location); + _mp_detail_view_append_media_info_item(genlist, + MP_DETAIL_LOCATION_STR, + location); SAFE_FREE(location); if (svc_item) { @@ -356,36 +389,39 @@ _mp_detail_view_create_local_without_metadata(void *thiz) } } else { /* - ** There are 2 kinds of URI to play streaming and local - ** detail view is created from player view, it is to say player already exists. - ** in the precondition, we can use player to get info. - ** use metadata_extractor to get detail information of local files case - ** use player to get information of streaming case - */ + ** There are 2 kinds of URI to play streaming and local + ** detail view is created from player view, it is to say player already exists. + ** in the precondition, we can use player to get info. + ** use metadata_extractor to get detail information of local files case + ** use player to get information of streaming case + */ mp_dir_e located = mp_util_get_file_location(view->uri); - if (located == MP_DIR_PHONE || located == MP_DIR_MMC) { /*local file case*/ + if (located == MP_DIR_PHONE || located == MP_DIR_MMC) { /*local file case */ mp_tag_info_t tag_info; mp_file_tag_info_get_all_tag(view->uri, &tag_info); if (tag_info.artist && strlen(tag_info.artist)) { - _mp_detail_view_append_media_info_item(genlist, "IDS_MUSIC_BODY_ARTIST", - tag_info.artist); + _mp_detail_view_append_media_info_item(genlist, + "IDS_MUSIC_BODY_ARTIST", + tag_info.artist); } if (tag_info.title && strlen(tag_info.title)) { - _mp_detail_view_append_media_info_item(genlist, "IDS_COM_BODY_DETAILS_TITLE", - tag_info.title); + _mp_detail_view_append_media_info_item(genlist, + "IDS_COM_BODY_DETAILS_TITLE", + tag_info.title); } if (tag_info.album && strlen(tag_info.album)) { - _mp_detail_view_append_media_info_item(genlist, "IDS_MUSIC_BODY_ALBUM", - tag_info.album); + _mp_detail_view_append_media_info_item(genlist, + "IDS_MUSIC_BODY_ALBUM", + tag_info.album); } @@ -393,69 +429,85 @@ _mp_detail_view_create_local_without_metadata(void *thiz) int dur_sec = tag_info.duration / 1000; int sec = dur_sec % 60; int min = dur_sec / 60; - snprintf(duration_format, sizeof(duration_format), "%02u:%02u", min, sec); + snprintf(duration_format, sizeof(duration_format), "%02u:%02u", + min, sec); - _mp_detail_view_append_media_info_item(genlist, "IDS_MUSIC_BODY_TRACK_LENGTH", - duration_format); + _mp_detail_view_append_media_info_item(genlist, + "IDS_MUSIC_BODY_TRACK_LENGTH", + duration_format); if (tag_info.date && strlen(tag_info.date)) { - _mp_detail_view_append_media_info_item(genlist, "IDS_MUSIC_BODY_RECORDED_DATE", - tag_info.date); + _mp_detail_view_append_media_info_item(genlist, + "IDS_MUSIC_BODY_RECORDED_DATE", + tag_info.date); } if (tag_info.author && strlen(tag_info.author)) { - _mp_detail_view_append_media_info_item(genlist, "IDS_MUSIC_BODY_AUTHOR", - tag_info.author); + _mp_detail_view_append_media_info_item(genlist, + "IDS_MUSIC_BODY_AUTHOR", + tag_info.author); } if (tag_info.copyright && strlen(tag_info.copyright)) { - _mp_detail_view_append_media_info_item(genlist, "IDS_MUSIC_BODY_COPYRIGHT", tag_info.copyright); + _mp_detail_view_append_media_info_item(genlist, + "IDS_MUSIC_BODY_COPYRIGHT", + tag_info.copyright); } if (tag_info.track && strlen(tag_info.track)) { - if (!strstr(tag_info.track, "-") && strcmp(tag_info.track, "0")) { - _mp_detail_view_append_media_info_item(genlist, "IDS_MUSIC_BODY_TRACK_NUMBER", - tag_info.track); + if (!strstr(tag_info.track, "-") + && strcmp(tag_info.track, "0")) { + _mp_detail_view_append_media_info_item(genlist, + "IDS_MUSIC_BODY_TRACK_NUMBER", + tag_info.track); } } if (tag_info.rating && strlen(tag_info.rating)) { - _mp_detail_view_append_media_info_item(genlist, "IDS_MF_BODY_PARENT_RATING", - tag_info.rating); + _mp_detail_view_append_media_info_item(genlist, + "IDS_MF_BODY_PARENT_RATING", + tag_info.rating); } GString *format = g_string_new(""); if (tag_info.audio_bitrate > 0) { - g_string_append_printf(format, "%dbps ", tag_info.audio_bitrate); + g_string_append_printf(format, "%dbps ", + tag_info.audio_bitrate); } if (tag_info.audio_samplerate > 0) { - g_string_append_printf(format, "%.1fHz ", (double)tag_info.audio_samplerate); + g_string_append_printf(format, "%.1fHz ", + (double) tag_info.audio_samplerate); } if (tag_info.audio_channel > 0) { - g_string_append_printf(format, "%dch", tag_info.audio_channel); + g_string_append_printf(format, "%dch", + tag_info.audio_channel); } if (format) { - _mp_detail_view_append_media_info_item(genlist, "IDS_MUSIC_BODY_FORMAT", - format->str); + _mp_detail_view_append_media_info_item(genlist, + "IDS_MUSIC_BODY_FORMAT", + format->str); g_string_free(format, TRUE); } location = - _mp_detail_view_get_location_info_from_file_path(view->uri); + _mp_detail_view_get_location_info_from_file_path(view-> + uri); - _mp_detail_view_append_media_info_item(genlist, "IDS_MUSIC_BODY_MUSIC_LOCATION", location); + _mp_detail_view_append_media_info_item(genlist, + "IDS_MUSIC_BODY_MUSIC_LOCATION", + location); SAFE_FREE(location); mp_file_tag_free(&tag_info); - } else if (located != MP_DIR_NONE) { /*streaming case*/ + } else if (located != MP_DIR_NONE) { /*streaming case */ player_h current_player = mp_player_mgr_get_player(); int error_code = PLAYER_ERROR_NONE; char *temp_string = NULL; @@ -464,43 +516,61 @@ _mp_detail_view_create_local_without_metadata(void *thiz) } player_state_e player_state = mp_player_mgr_get_state(); - if (player_state != PLAYER_STATE_PLAYING && player_state != PLAYER_STATE_PAUSED) { - ERROR_TRACE("Player is not in playing/pause status, unable to get infor from player"); + if (player_state != PLAYER_STATE_PLAYING + && player_state != PLAYER_STATE_PAUSED) { + ERROR_TRACE + ("Player is not in playing/pause status, unable to get infor from player"); } - /*get title*/ - error_code = player_get_content_info(current_player, PLAYER_CONTENT_INFO_TITLE, &title); - if (!title || strlen(title) == 0 || error_code != PLAYER_ERROR_NONE) { + /*get title */ + error_code = + player_get_content_info(current_player, + PLAYER_CONTENT_INFO_TITLE, &title); + if (!title || strlen(title) == 0 + || error_code != PLAYER_ERROR_NONE) { IF_FREE(title); title = g_strdup(GET_SYS_STR("IDS_COM_BODY_UNKNOWN")); } - _mp_detail_view_append_media_info_item(genlist, MP_DETAIL_TITLE_STR, title); + _mp_detail_view_append_media_info_item(genlist, + MP_DETAIL_TITLE_STR, + title); IF_FREE(title); - /*get artist*/ - error_code = player_get_content_info(current_player, PLAYER_CONTENT_INFO_ARTIST, &artist); - if (!artist || strlen(artist) == 0 || error_code != PLAYER_ERROR_NONE) { + /*get artist */ + error_code = + player_get_content_info(current_player, + PLAYER_CONTENT_INFO_ARTIST, + &artist); + if (!artist || strlen(artist) == 0 + || error_code != PLAYER_ERROR_NONE) { IF_FREE(artist); artist = g_strdup(GET_SYS_STR("IDS_COM_BODY_UNKNOWN")); } - _mp_detail_view_append_media_info_item(genlist, MP_DETAIL_ARTIST_STR, artist); + _mp_detail_view_append_media_info_item(genlist, + MP_DETAIL_ARTIST_STR, + artist); IF_FREE(artist); - /*get album*/ - error_code = player_get_content_info(current_player, PLAYER_CONTENT_INFO_ALBUM, &album); - if (!album || strlen(album) == 0 || error_code != PLAYER_ERROR_NONE) { + /*get album */ + error_code = + player_get_content_info(current_player, + PLAYER_CONTENT_INFO_ALBUM, &album); + if (!album || strlen(album) == 0 + || error_code != PLAYER_ERROR_NONE) { IF_FREE(album); album = g_strdup(GET_SYS_STR("IDS_COM_BODY_UNKNOWN")); } - _mp_detail_view_append_media_info_item(genlist, MP_DETAIL_ALBUM_STR, album); + _mp_detail_view_append_media_info_item(genlist, + MP_DETAIL_ALBUM_STR, + album); IF_FREE(album); - /*get length(duration)*/ + /*get length(duration) */ error_code = player_get_duration(current_player, &duration); if (error_code != PLAYER_ERROR_NONE) { IF_FREE(temp_string); -// temp_string = g_strdup(GET_SYS_STR("IDS_COM_BODY_UNKNOWN")); +// temp_string = g_strdup(GET_SYS_STR("IDS_COM_BODY_UNKNOWN")); } int dur_sec = duration / 1000; @@ -508,39 +578,55 @@ _mp_detail_view_create_local_without_metadata(void *thiz) int min = dur_sec / 60; temp_string = g_strdup_printf("%02u:%02u", min, sec); - _mp_detail_view_append_media_info_item(genlist, MP_DETAIL_LENGTH_STR, temp_string); + _mp_detail_view_append_media_info_item(genlist, + MP_DETAIL_LENGTH_STR, + temp_string); - /*get track number*/ + /*get track number */ IF_FREE(temp_string); temp_string = g_strdup(GET_SYS_STR("IDS_COM_BODY_UNKNOWN")); - _mp_detail_view_append_media_info_item(genlist, MP_DETAIL_NUMBER_STR, temp_string); + _mp_detail_view_append_media_info_item(genlist, + MP_DETAIL_NUMBER_STR, + temp_string); - /*get format ------->need capi to get format*/ + /*get format ------->need capi to get format */ IF_FREE(temp_string); temp_string = g_strdup(GET_SYS_STR("IDS_COM_BODY_UNKNOWN")); - _mp_detail_view_append_media_info_item(genlist, MP_DETAIL_FORMAT_STR, temp_string); + _mp_detail_view_append_media_info_item(genlist, + MP_DETAIL_FORMAT_STR, + temp_string); - /*get bit rate*/ - /*get sample rate*/ - error_code = player_get_audio_stream_info(current_player, &sample_rate, &channel, &bitpersample); + /*get bit rate */ + /*get sample rate */ + error_code = + player_get_audio_stream_info(current_player, &sample_rate, + &channel, &bitpersample); bitdepth = g_strdup_printf("%d bit", bitpersample); - _mp_detail_view_append_media_info_item(genlist, MP_DETAIL_BITDEPTH_STR, bitdepth); + _mp_detail_view_append_media_info_item(genlist, + MP_DETAIL_BITDEPTH_STR, + bitdepth); SAFE_FREE(bitdepth); - sample = g_strdup_printf("%dKHz", sample_rate / 1000); - _mp_detail_view_append_media_info_item(genlist, MP_DETAIL_SAMPLING_STR, sample); + sample = g_strdup_printf("%dKHz", sample_rate / 1000); + _mp_detail_view_append_media_info_item(genlist, + MP_DETAIL_SAMPLING_STR, + sample); SAFE_FREE(sample); - /*get size ------->need capi to get sizet*/ + /*get size ------->need capi to get sizet */ IF_FREE(temp_string); temp_string = g_strdup(GET_SYS_STR("IDS_COM_BODY_UNKNOWN")); - _mp_detail_view_append_media_info_item(genlist, MP_DETAIL_SIZE_STR, temp_string); + _mp_detail_view_append_media_info_item(genlist, + MP_DETAIL_SIZE_STR, + temp_string); - /*get location ------->need capi to get location*/ + /*get location ------->need capi to get location */ IF_FREE(temp_string); temp_string = g_strdup(view->uri); - _mp_detail_view_append_media_info_item(genlist, MP_DETAIL_LOCATION_STR, temp_string); + _mp_detail_view_append_media_info_item(genlist, + MP_DETAIL_LOCATION_STR, + temp_string); IF_FREE(temp_string); } @@ -556,29 +642,31 @@ _mp_detail_view_create_local_without_metadata(void *thiz) return genlist; } -static void -_mp_detail_view_create_default_layout(MpDetailView_t *view) +static void _mp_detail_view_create_default_layout(MpDetailView_t * view) { MP_CHECK(view); - view->content = mp_common_load_edj(view->layout, MP_EDJ_NAME, "local_media_info_layout"); + view->content = + mp_common_load_edj(view->layout, MP_EDJ_NAME, + "local_media_info_layout"); MP_CHECK(view->content); - view->minfo_genlist = _mp_detail_view_create_local_without_metadata(view); - elm_object_part_content_set(view->content, "list-content", view->minfo_genlist); - elm_object_part_content_set(view->layout, "list_content", view->content); + view->minfo_genlist = + _mp_detail_view_create_local_without_metadata(view); + elm_object_part_content_set(view->content, "list-content", + view->minfo_genlist); + elm_object_part_content_set(view->layout, "list_content", + view->content); } -static void -_mp_detail_view_create_content(void *thiz) +static void _mp_detail_view_create_content(void *thiz) { startfunc; - MpDetailView_t *view = (MpDetailView_t *)thiz; + MpDetailView_t *view = (MpDetailView_t *) thiz; MP_CHECK(view); _mp_detail_view_create_default_layout(view); } -static void -_mp_detail_view_destory_cb(void *thiz) +static void _mp_detail_view_destory_cb(void *thiz) { eventfunc; MpDetailView_t *view = thiz; @@ -602,12 +690,12 @@ _mp_detail_view_destory_cb(void *thiz) elm_genlist_item_class_free(view->video_itc); } - mp_view_fini((MpView_t *)view); + mp_view_fini((MpView_t *) view); free(view); } -static void _mp_detail_view_get_playing_track_data(MpDetailView_t *view) +static void _mp_detail_view_get_playing_track_data(MpDetailView_t * view) { MP_CHECK(view); struct appdata *ad = mp_util_get_appdata(); @@ -646,10 +734,10 @@ static int _mp_detail_view_update(void *thiz) return 0; } -static Eina_Bool _mp_detail_view_pop_cb(void *data, Elm_Object_Item *it) +static Eina_Bool _mp_detail_view_pop_cb(void *data, Elm_Object_Item * it) { startfunc; - MpDetailView_t *view = (MpDetailView_t *)data; + MpDetailView_t *view = (MpDetailView_t *) data; MP_CHECK_VAL(view, EINA_TRUE); mp_view_mgr_pop_view(GET_VIEW_MGR, true); @@ -657,7 +745,9 @@ static Eina_Bool _mp_detail_view_pop_cb(void *data, Elm_Object_Item *it) return EINA_TRUE; } -static void _mp_detail_view_pop_on_back_button(void *data, Evas_Object * obj, void *event_info) +static void _mp_detail_view_pop_on_back_button(void *data, + Evas_Object * obj, + void *event_info) { elm_naviframe_item_pop(GET_NAVIFRAME); } @@ -666,29 +756,31 @@ int _mp_detail_view_update_options(void *thiz) { startfunc; - MpDetailView_t *view = (MpDetailView_t *)thiz; + MpDetailView_t *view = (MpDetailView_t *) thiz; MP_CHECK_VAL(view, -1); Evas_Object *btn1 = elm_button_add(view->layout); elm_object_style_set(btn1, "naviframe/end_btn/default"); elm_object_item_part_content_set(view->navi_it, "prev_btn", btn1); - evas_object_smart_callback_add(btn1, "clicked", _mp_detail_view_pop_on_back_button, view); - mp_view_set_title((MpView_t *)view, STR_MP_DETAILS); - elm_naviframe_item_pop_cb_set(view->navi_it, _mp_detail_view_pop_cb, view); + evas_object_smart_callback_add(btn1, "clicked", + _mp_detail_view_pop_on_back_button, + view); + mp_view_set_title((MpView_t *) view, STR_MP_DETAILS); + elm_naviframe_item_pop_cb_set(view->navi_it, _mp_detail_view_pop_cb, + view); endfunc; return 0; } -static void -_mp_detail_view_on_event(void *thiz, MpViewEvent_e event) +static void _mp_detail_view_on_event(void *thiz, MpViewEvent_e event) { DEBUG_TRACE("event; %d", event); switch (event) { case MP_NETWORK_STATE_CHANGED: _mp_detail_view_update_options(thiz); break; - case MP_UNSET_NOW_PLAYING: /*unset now playing means there is no track in playlist*/ - mp_view_mgr_pop_a_view(GET_VIEW_MGR, (MpView_t *)thiz); + case MP_UNSET_NOW_PLAYING: /*unset now playing means there is no track in playlist */ + mp_view_mgr_pop_a_view(GET_VIEW_MGR, (MpView_t *) thiz); break; default: break; @@ -696,12 +788,13 @@ _mp_detail_view_on_event(void *thiz, MpViewEvent_e event) } static int -_mp_detail_view_init(Evas_Object *parent, MpDetailView_t *view, const char *uri) +_mp_detail_view_init(Evas_Object * parent, MpDetailView_t * view, + const char *uri) { startfunc; int ret = 0; - ret = mp_view_init(parent, (MpView_t *)view, MP_VIEW_DETAIL); + ret = mp_view_init(parent, (MpView_t *) view, MP_VIEW_DETAIL); MP_CHECK_VAL(ret == 0, -1); view->disable_title_icon = true; @@ -715,7 +808,7 @@ _mp_detail_view_init(Evas_Object *parent, MpDetailView_t *view, const char *uri) return ret; } -MpDetailView_t *mp_detail_view_create(Evas_Object *parent) +MpDetailView_t *mp_detail_view_create(Evas_Object * parent) { eventfunc; int ret; @@ -732,12 +825,8 @@ MpDetailView_t *mp_detail_view_create(Evas_Object *parent) return view; -Error: + Error: ERROR_TRACE("Error: mp_detail_view_create()"); IF_FREE(view); return NULL; } - - - - diff --git a/src/view/mp-edit-view.c b/src/view/mp-edit-view.c index 3de25ea..000b17d 100644 --- a/src/view/mp-edit-view.c +++ b/src/view/mp-edit-view.c @@ -34,17 +34,16 @@ #include "mp-setting-ctrl.h" #include "mp-edit-playlist.h" -static void -_mp_edit_view_destory_cb(void *thiz) +static void _mp_edit_view_destory_cb(void *thiz) { eventfunc; MpEditView_t *view = thiz; MP_CHECK(view); mp_ecore_timer_del(view->back_timer); - mp_list_view_fini((MpListView_t *)view); + mp_list_view_fini((MpListView_t *) view); - /* TODO: release resource..*/ + /* TODO: release resource.. */ free(view); } @@ -65,17 +64,19 @@ int _mp_edit_view_update(void *thiz) mp_list_set_edit(view->content_to_show, EINA_TRUE); } - unsigned int count = mp_list_get_editable_count((MpList_t *)view->content_to_show, MP_LIST_EDIT_TYPE_NORMAL); + unsigned int count = + mp_list_get_editable_count((MpList_t *) view->content_to_show, + MP_LIST_EDIT_TYPE_NORMAL); if (count <= 0) { - mp_list_view_set_select_all((MpListView_t *)view, FALSE); + mp_list_view_set_select_all((MpListView_t *) view, FALSE); } return 0; } -/*************** functions for track list update *******************/ +/*************** functions for track list update *******************/ -static Eina_Bool _mp_edit_view_back_cb(void *data, Elm_Object_Item *it) +static Eina_Bool _mp_edit_view_back_cb(void *data, Elm_Object_Item * it) { eventfunc; @@ -87,17 +88,17 @@ static Eina_Bool _mp_edit_view_back_cb(void *data, Elm_Object_Item *it) ad->del_cb_invoked = 0; /* - if (view->content_to_show->reorderable) { - DEBUG_TRACE("view->ref_list->reorderable = %d",view->ref_list->reorderable); - int ret = 0; - void *playlist_handle = mp_list_get_playlist_handle(view->content_to_show); - DEBUG_TRACE("playlist_handle = %p", playlist_handle); - ret = mp_media_info_playlist_update_db(playlist_handle); - MP_CHECK_VAL(ret == 0, -1); - mp_view_mgr_post_event(GET_VIEW_MGR, MP_PLAYLIST_REORDER_DONE); - mp_list_set_reorder((MpList_t *)view->content_to_show, FALSE); - } - */ + if (view->content_to_show->reorderable) { + DEBUG_TRACE("view->ref_list->reorderable = %d",view->ref_list->reorderable); + int ret = 0; + void *playlist_handle = mp_list_get_playlist_handle(view->content_to_show); + DEBUG_TRACE("playlist_handle = %p", playlist_handle); + ret = mp_media_info_playlist_update_db(playlist_handle); + MP_CHECK_VAL(ret == 0, -1); + mp_view_mgr_post_event(GET_VIEW_MGR, MP_PLAYLIST_REORDER_DONE); + mp_list_set_reorder((MpList_t *)view->content_to_show, FALSE); + } + */ MpViewMgr_t *view_mgr = mp_view_mgr_get_view_manager(); mp_view_mgr_pop_view(view_mgr, false); @@ -109,7 +110,8 @@ static Eina_Bool _mp_edit_view_back_cb(void *data, Elm_Object_Item *it) } void -mp_edit_view_add_to_playlist_cb(void *data, Evas_Object *obj, void *event_info) +mp_edit_view_add_to_playlist_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; MpEditView_t *view = data; @@ -118,7 +120,7 @@ mp_edit_view_add_to_playlist_cb(void *data, Evas_Object *obj, void *event_info) } void -mp_edit_view_delete_cb(void *data, Evas_Object *obj, void *event_info) +mp_edit_view_delete_cb(void *data, Evas_Object * obj, void *event_info) { eventfunc; MpEditView_t *view = data; @@ -126,7 +128,8 @@ mp_edit_view_delete_cb(void *data, Evas_Object *obj, void *event_info) mp_edit_create_delete_popup(view->content_to_show); } -void mp_edit_view_remove_cb(void *data, Evas_Object *obj, void *event_info) +void mp_edit_view_remove_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; MP_CHECK(data); @@ -135,7 +138,9 @@ void mp_edit_view_remove_cb(void *data, Evas_Object *obj, void *event_info) MP_CHECK(view->content_to_show); struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); - int list_count = _mp_list_get_count(view->content_to_show, MP_LIST_EDIT_TYPE_NORMAL); + int list_count = + _mp_list_get_count(view->content_to_show, + MP_LIST_EDIT_TYPE_NORMAL); if (list_count == mp_list_get_checked_count(view->content_to_show)) { ad->is_sdcard_removed = true; @@ -143,7 +148,8 @@ void mp_edit_view_remove_cb(void *data, Evas_Object *obj, void *event_info) mp_minicontroller_destroy(ad); } if (mp_list_get_checked_count(view->content_to_show) <= 0) { - mp_widget_text_popup(ad, GET_STR("IDS_MUSIC_POP_NOTHING_SELECTED")); + mp_widget_text_popup(ad, + GET_STR("IDS_MUSIC_POP_NOTHING_SELECTED")); return; } mp_edit_cb_excute_delete(view->content_to_show); @@ -153,7 +159,8 @@ void mp_edit_view_remove_cb(void *data, Evas_Object *obj, void *event_info) #ifdef MP_FEATURE_PERSONAL_PAGE static void -_mp_edit_view_move_execute_cb(void *data, Evas_Object *obj, void *event_info) +_mp_edit_view_move_execute_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; struct appdata *ad = mp_util_get_appdata(); @@ -163,9 +170,11 @@ _mp_edit_view_move_execute_cb(void *data, Evas_Object *obj, void *event_info) MP_CHECK(list); bool flag_dont_ask = false; - Evas_Object *layout = elm_object_content_get(ad->popup[MP_POPUP_CHECK_INFO_PERSONAL]); + Evas_Object *layout = + elm_object_content_get(ad->popup[MP_POPUP_CHECK_INFO_PERSONAL]); if (layout != NULL) { - Evas_Object *checkbox = elm_object_part_content_get(layout, "elm.swallow.end"); + Evas_Object *checkbox = + elm_object_part_content_get(layout, "elm.swallow.end"); flag_dont_ask = elm_check_state_get(checkbox); } mp_evas_object_del(ad->popup[MP_POPUP_CHECK_INFO_PERSONAL]); @@ -177,7 +186,8 @@ _mp_edit_view_move_execute_cb(void *data, Evas_Object *obj, void *event_info) mp_edit_cb_excute_move(list); } -static void _mp_edit_view_notify_cancel_cb(void *data, Evas_Object * obj, void *event_info) +static void _mp_edit_view_notify_cancel_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; struct appdata *ad = mp_util_get_appdata(); @@ -187,8 +197,7 @@ static void _mp_edit_view_notify_cancel_cb(void *data, Evas_Object * obj, void * mp_evas_object_del(ad->popup[MP_POPUP_CHECK_INFO_PERSONAL]); } -void -mp_edit_view_notify_popup(void *data) +void mp_edit_view_notify_popup(void *data) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); @@ -197,26 +206,36 @@ mp_edit_view_notify_popup(void *data) MP_CHECK(list); Evas_Object *popup = NULL; - popup = mp_popup_create(ad->win_main, MP_POPUP_CHECK_INFO_PERSONAL, NULL, NULL, NULL, ad); + popup = + mp_popup_create(ad->win_main, MP_POPUP_CHECK_INFO_PERSONAL, NULL, + NULL, NULL, ad); evas_object_show(popup); - Evas_Object *btn1 = mp_widget_create_button(popup, "popup", STR_MP_CANCEL, NULL, - _mp_edit_view_notify_cancel_cb, NULL); - Evas_Object *btn2 = mp_widget_create_button(popup, "popup", STR_MP_OK, NULL, _mp_edit_view_move_execute_cb, list); + Evas_Object *btn1 = + mp_widget_create_button(popup, "popup", STR_MP_CANCEL, NULL, + _mp_edit_view_notify_cancel_cb, NULL); + Evas_Object *btn2 = + mp_widget_create_button(popup, "popup", STR_MP_OK, NULL, + _mp_edit_view_move_execute_cb, list); elm_object_part_content_set(popup, "button1", btn1); elm_object_part_content_set(popup, "button2", btn2); Evas_Object *layout = elm_object_content_get(popup); if (layout != NULL) { - /*set lable*/ - Evas_Object *lable = elm_object_part_content_get(layout, "elm.swallow.content"); + /*set lable */ + Evas_Object *lable = + elm_object_part_content_get(layout, "elm.swallow.content"); if (lable != NULL) { int count = mp_list_get_checked_count(list); char *lable_text = NULL; if (count > 1) { - lable_text = g_strdup_printf(GET_STR(MP_PERSONAL_ITEMS_MOVE_TO), MP_MUSIC_DIR); + lable_text = + g_strdup_printf(GET_STR(MP_PERSONAL_ITEMS_MOVE_TO), + MP_MUSIC_DIR); } else { - lable_text = g_strdup_printf(GET_STR(MP_PERSONAL_ITEM_MOVE_TO), MP_MUSIC_DIR); + lable_text = + g_strdup_printf(GET_STR(MP_PERSONAL_ITEM_MOVE_TO), + MP_MUSIC_DIR); } mp_util_domain_translatable_text_set(lable, lable_text); @@ -248,8 +267,7 @@ _mp_edit_view_move_cb(void *data, Evas_Object * obj, void *event_info) #endif -static Eina_Bool -_mp_edit_view_reorder_back_cb(void *thiz) +static Eina_Bool _mp_edit_view_reorder_back_cb(void *thiz) { startfunc; MpEditView_t *view = thiz; @@ -264,33 +282,38 @@ _mp_edit_view_reorder_back_cb(void *thiz) void -mp_edit_view_list_item_reorder_update_cb(void *data, Evas_Object * obj, void *event_info) +mp_edit_view_list_item_reorder_update_cb(void *data, Evas_Object * obj, + void *event_info) { startfunc; - MpEditView_t *view = (MpEditView_t *)data; + MpEditView_t *view = (MpEditView_t *) data; MP_CHECK(view); - MpTrackList_t *list = (MpTrackList_t *)view->content_to_show; + MpTrackList_t *list = (MpTrackList_t *) view->content_to_show; MP_CHECK(list); int index = -1; int ret = 0; int member_id = 0; - void *playlist_handle = mp_list_get_playlist_handle((MpList_t *)list); + void *playlist_handle = mp_list_get_playlist_handle((MpList_t *) list); Elm_Object_Item *temp = elm_genlist_first_item_get(list->genlist); while (temp) { index = elm_genlist_item_index_get(temp); mp_list_item_data_t *item_data = elm_object_item_data_get(temp); MP_CHECK(item_data); - ret = mp_media_info_get_playlist_member_id(item_data->handle, &member_id); + ret = + mp_media_info_get_playlist_member_id(item_data->handle, + &member_id); MP_CHECK(ret == MEDIA_CONTENT_ERROR_NONE); - ret = mp_media_info_playlist_set_play_order(playlist_handle, member_id, index); + ret = + mp_media_info_playlist_set_play_order(playlist_handle, + member_id, index); MP_CHECK(ret == MEDIA_CONTENT_ERROR_NONE); temp = elm_genlist_item_next_get(temp); - /*DEBUG_TRACE("member_id: %d, index: %d", member_id, index);*/ + /*DEBUG_TRACE("member_id: %d, index: %d", member_id, index); */ } ret = mp_media_info_playlist_update_db(playlist_handle); @@ -298,13 +321,14 @@ mp_edit_view_list_item_reorder_update_cb(void *data, Evas_Object * obj, void *ev mp_view_mgr_post_event(GET_VIEW_MGR, MP_PLAYLIST_REORDER_DONE); - view->back_timer = ecore_timer_add(0.1, _mp_edit_view_reorder_back_cb, view); + view->back_timer = + ecore_timer_add(0.1, _mp_edit_view_reorder_back_cb, view); } static int _mp_edit_view_update_options(void *thiz) { startfunc; - MpEditView_t *view = (MpEditView_t *)thiz; + MpEditView_t *view = (MpEditView_t *) thiz; MP_CHECK_VAL(view, -1); MpList_t *list = view->content_to_show; @@ -315,9 +339,11 @@ static int _mp_edit_view_update_options(void *thiz) mp_track_type_e track_type = mp_list_get_track_type(list); - if (mp_list_get_checked_count((MpList_t *)view->content_to_show) == 0 && view->list_mode != MP_EDIT_VIEW_REORDER) { - if (list->list_type == MP_LIST_TYPE_TRACK && MP_TRACK_BY_SQUARE != track_type) { - MpTrackList_t *track_list = (MpTrackList_t *)list; + if (mp_list_get_checked_count((MpList_t *) view->content_to_show) == 0 + && view->list_mode != MP_EDIT_VIEW_REORDER) { + if (list->list_type == MP_LIST_TYPE_TRACK + && MP_TRACK_BY_SQUARE != track_type) { + MpTrackList_t *track_list = (MpTrackList_t *) list; if (track_list->load_timer == NULL) { mp_evas_object_del(ad->popup_delete); } @@ -325,32 +351,37 @@ static int _mp_edit_view_update_options(void *thiz) mp_evas_object_del(ad->popup_delete); } } - mp_util_create_selectioninfo_with_count((MpView_t *)view, mp_list_get_checked_count((MpList_t *)view->content_to_show)); - if (mp_list_get_checked_count((MpList_t *)view->content_to_show) == mp_list_get_editable_count((MpList_t *)view->content_to_show, MP_LIST_EDIT_TYPE_NORMAL)) { + mp_util_create_selectioninfo_with_count((MpView_t *) view, + mp_list_get_checked_count((MpList_t *) view->content_to_show)); + if (mp_list_get_checked_count((MpList_t *) view->content_to_show) == + mp_list_get_editable_count((MpList_t *) view->content_to_show, + MP_LIST_EDIT_TYPE_NORMAL)) { elm_check_state_set(view->select_all_btn, EINA_TRUE); } else { elm_check_state_set(view->select_all_btn, EINA_FALSE); } if (view->list_mode == MP_EDIT_VIEW_REORDER) { - mp_view_set_title((MpView_t *)view, STR_MP_REORDER); + mp_view_set_title((MpView_t *) view, STR_MP_REORDER); } if (view->done_btn) { - if (mp_list_get_checked_count((MpList_t *)view->content_to_show)) { + if (mp_list_get_checked_count((MpList_t *) view->content_to_show)) { elm_object_disabled_set(view->done_btn, EINA_FALSE); } else { elm_object_disabled_set(view->done_btn, EINA_TRUE); } } - elm_naviframe_item_pop_cb_set(view->navi_it, _mp_edit_view_back_cb, view); + elm_naviframe_item_pop_cb_set(view->navi_it, _mp_edit_view_back_cb, + view); - unsigned int count = mp_list_get_editable_count(list, MP_LIST_EDIT_TYPE_NORMAL); + unsigned int count = + mp_list_get_editable_count(list, MP_LIST_EDIT_TYPE_NORMAL); if (count == 0) { mp_popup_destroy(ad); - /*playlist detail view should not back to all view*/ + /*playlist detail view should not back to all view */ if (mp_view_mgr_get_view(GET_VIEW_MGR, MP_VIEW_PLAYLIST_DETAIL)) { mp_view_mgr_pop_a_view(GET_VIEW_MGR, thiz); } else { @@ -362,8 +393,7 @@ static int _mp_edit_view_update_options(void *thiz) return 0; } -static MpList_t * -_create_group_list(MpEditView_t *view) +static MpList_t *_create_group_list(MpEditView_t * view) { startfunc; mp_group_type_e group_type = mp_list_get_group_type(view->ref_list); @@ -374,23 +404,25 @@ _create_group_list(MpEditView_t *view) case MP_GROUP_BY_ARTIST_ALBUM: list = mp_album_list_create(view->layout); MP_CHECK_NULL(list); - mp_album_list_copy_data((MpAlbumList_t *)view->ref_list, list); + mp_album_list_copy_data((MpAlbumList_t *) view->ref_list, list); break; case MP_GROUP_BY_ARTIST: list = mp_artist_list_create(view->layout); MP_CHECK_NULL(list); - mp_artist_list_copy_data((MpArtistList_t *)view->ref_list, list); - mp_artist_list_set_data(list, MP_ARTIST_LIST_TYPE, MP_GROUP_BY_ARTIST, -1); + mp_artist_list_copy_data((MpArtistList_t *) view->ref_list, list); + mp_artist_list_set_data(list, MP_ARTIST_LIST_TYPE, + MP_GROUP_BY_ARTIST, -1); break; case MP_GROUP_BY_PLAYLIST: list = mp_playlist_list_create(view->layout); MP_CHECK_NULL(list); - mp_playlist_list_copy_data((MpPlaylistList_t *)view->ref_list, list); + mp_playlist_list_copy_data((MpPlaylistList_t *) view->ref_list, + list); break; case MP_GROUP_BY_GENRE: list = mp_genre_list_create(view->layout); MP_CHECK_NULL(list); - mp_genre_list_copy_data((MpGenreList_t *)view->ref_list, list); + mp_genre_list_copy_data((MpGenreList_t *) view->ref_list, list); break; default: ERROR_TRACE("Inavlid type: %d", group_type); @@ -404,125 +436,142 @@ _create_group_list(MpEditView_t *view) static int _mp_edit_view_content_load(void *thiz) { startfunc; - MpEditView_t *view = (MpEditView_t *)thiz; + MpEditView_t *view = (MpEditView_t *) thiz; MP_CHECK_VAL(view, -1); MpList_t *ref_list = view->ref_list; - DEBUG_TRACE("------------------------>list type is %d", ref_list->list_type); + DEBUG_TRACE("------------------------>list type is %d", + ref_list->list_type); switch (ref_list->list_type) { - case MP_LIST_TYPE_TRACK: { - view->content_to_show = (MpList_t *)mp_track_list_create(view->layout); + case MP_LIST_TYPE_TRACK:{ + view->content_to_show = + (MpList_t *) mp_track_list_create(view->layout); - if (view->content_to_show == NULL) { - ERROR_TRACE("Unable to create track list"); - break; - } + if (view->content_to_show == NULL) { + ERROR_TRACE("Unable to create track list"); + break; + } #ifdef MP_FEATURE_PERSONAL_PAGE - MpTrackList_t *list = (MpTrackList_t *)view->content_to_show; - list->personal_page_type = view->person_page_sel; + MpTrackList_t *list = (MpTrackList_t *) view->content_to_show; + list->personal_page_type = view->person_page_sel; #endif - if (view->ref_list->reorderable) { - mp_list_set_reorder((MpList_t *)view->content_to_show, TRUE); + if (view->ref_list->reorderable) { + mp_list_set_reorder((MpList_t *) view->content_to_show, + TRUE); + } + mp_track_list_copy_data((MpTrackList_t *) ref_list, + (MpTrackList_t *) view-> + content_to_show); + edje_object_signal_emit(_EDJ(view->layout), + "SHOW_SELECT_ALL_PADDING", "*"); + break; } - mp_track_list_copy_data((MpTrackList_t *)ref_list, (MpTrackList_t *)view->content_to_show); - edje_object_signal_emit(_EDJ(view->layout), "SHOW_SELECT_ALL_PADDING", "*"); - break; - } case MP_LIST_TYPE_GROUP: view->content_to_show = _create_group_list(view); MP_CHECK_VAL(view->content_to_show, -1); - edje_object_signal_emit(_EDJ(view->layout), "SHOW_SELECT_ALL_PADDING", "*"); + edje_object_signal_emit(_EDJ(view->layout), + "SHOW_SELECT_ALL_PADDING", "*"); #ifdef MP_FEATURE_PERSONAL_PAGE view->content_to_show->personal_page_type = view->person_page_sel; #endif break; case MP_LIST_TYPE_PLAYLIST: - view->content_to_show = (MpList_t *)mp_playlist_list_create(view->layout); + view->content_to_show = + (MpList_t *) mp_playlist_list_create(view->layout); if (view->content_to_show == NULL) { ERROR_TRACE("Unable to create music playlist"); break; } - mp_playlist_list_copy_data((MpPlaylistList_t *)ref_list, (MpPlaylistList_t *)view->content_to_show); + mp_playlist_list_copy_data((MpPlaylistList_t *) ref_list, + (MpPlaylistList_t *) view-> + content_to_show); break; case MP_LIST_TYPE_ALBUM_DETAIL: - view->content_to_show = (MpList_t *)mp_album_detail_list_create(view->layout); + view->content_to_show = + (MpList_t *) mp_album_detail_list_create(view->layout); if (view->content_to_show == NULL) { ERROR_TRACE("Unable to create album deatil list"); break; } - mp_album_detail_list_copy_data((MpAlbumDetailList_t *)ref_list, (MpAlbumDetailList_t *)view->content_to_show); + mp_album_detail_list_copy_data((MpAlbumDetailList_t *) ref_list, + (MpAlbumDetailList_t *) view-> + content_to_show); #ifdef MP_FEATURE_PERSONAL_PAGE view->content_to_show->personal_page_type = view->person_page_sel; #endif break; case MP_LIST_TYPE_ARTIST_DETAIL: - view->content_to_show = (MpList_t *)mp_artist_detail_list_create(view->layout); + view->content_to_show = + (MpList_t *) mp_artist_detail_list_create(view->layout); if (view->content_to_show == NULL) { ERROR_TRACE("Unable to create artist deatil list"); break; } - mp_artist_detail_list_copy_data((MpArtistDetailList_t *)ref_list, (MpArtistDetailList_t *)view->content_to_show); + mp_artist_detail_list_copy_data((MpArtistDetailList_t *) ref_list, + (MpArtistDetailList_t *) view-> + content_to_show); #ifdef MP_FEATURE_PERSONAL_PAGE view->content_to_show->personal_page_type = view->person_page_sel; #endif break; - case MP_LIST_TYPE_ALL: { - MpView_t *all_view = mp_common_get_all_view(); + case MP_LIST_TYPE_ALL:{ + MpView_t *all_view = mp_common_get_all_view(); - if (all_view == NULL) { - ERROR_TRACE("all view is NULL"); - break; - } + if (all_view == NULL) { + ERROR_TRACE("all view is NULL"); + break; + } - MpTab_e tab = ((MpAllView_t *)all_view)->tab_status; + MpTab_e tab = ((MpAllView_t *) all_view)->tab_status; - if (tab == MP_TAB_SONGS) { - MpTrackList_t *list = mp_track_list_create(view->layout); + if (tab == MP_TAB_SONGS) { + MpTrackList_t *list = mp_track_list_create(view->layout); - if (list == NULL) { - ERROR_TRACE("Cannot create track list"); - break; - } + if (list == NULL) { + ERROR_TRACE("Cannot create track list"); + break; + } - list->cloud_view_type = ref_list->cloud_view_type; + list->cloud_view_type = ref_list->cloud_view_type; #ifdef MP_FEATURE_PERSONAL_PAGE - list->personal_page_type = view->person_page_sel; + list->personal_page_type = view->person_page_sel; #endif - view->content_to_show = (MpList_t *)list; - } else if (tab == MP_TAB_PLAYLISTS) { - MpPlaylistList_t *list = mp_playlist_list_create(view->layout); - if (list == NULL) { - ERROR_TRACE("Cannot create Playlist list"); - break; - } - list->group_type = MP_GROUP_BY_PLAYLIST; - view->content_to_show = (MpList_t *)list; - } else if (tab == MP_TAB_ALBUMS) { - MpAlbumList_t *list = mp_album_list_create(view->layout); - if (list == NULL) { - ERROR_TRACE("Cannot create Album list"); - break; - } - list->group_type = MP_GROUP_BY_ALBUM; - list->display_mode = ref_list->display_mode; - view->content_to_show = (MpList_t *)list; - } else if (tab == MP_TAB_ARTISTS) { - MpArtistList_t *list = mp_artist_list_create(view->layout); - if (list == NULL) { - ERROR_TRACE("Cannot create Artist list"); - break; + view->content_to_show = (MpList_t *) list; + } else if (tab == MP_TAB_PLAYLISTS) { + MpPlaylistList_t *list = + mp_playlist_list_create(view->layout); + if (list == NULL) { + ERROR_TRACE("Cannot create Playlist list"); + break; + } + list->group_type = MP_GROUP_BY_PLAYLIST; + view->content_to_show = (MpList_t *) list; + } else if (tab == MP_TAB_ALBUMS) { + MpAlbumList_t *list = mp_album_list_create(view->layout); + if (list == NULL) { + ERROR_TRACE("Cannot create Album list"); + break; + } + list->group_type = MP_GROUP_BY_ALBUM; + list->display_mode = ref_list->display_mode; + view->content_to_show = (MpList_t *) list; + } else if (tab == MP_TAB_ARTISTS) { + MpArtistList_t *list = mp_artist_list_create(view->layout); + if (list == NULL) { + ERROR_TRACE("Cannot create Artist list"); + break; + } + list->group_type = MP_GROUP_BY_ARTIST; + list->display_mode = ref_list->display_mode; + view->content_to_show = (MpList_t *) list; + } else { + ERROR_TRACE("Never should be here"); } - list->group_type = MP_GROUP_BY_ARTIST; - list->display_mode = ref_list->display_mode; - view->content_to_show = (MpList_t *)list; - } else { - ERROR_TRACE("Never should be here"); - } - break; - } + break; + } default: ERROR_TRACE("Inavlid type: %d", ref_list->list_type); break; @@ -530,16 +579,17 @@ static int _mp_edit_view_content_load(void *thiz) MP_CHECK_VAL(view->content_to_show, -1); if (view->share) { - mp_list_set_edit_type(view->content_to_show, MP_LIST_EDIT_TYPE_SHARE); + mp_list_set_edit_type(view->content_to_show, + MP_LIST_EDIT_TYPE_SHARE); } - elm_object_part_content_set(view->layout, "list_content", view->content_to_show->layout); + elm_object_part_content_set(view->layout, "list_content", + view->content_to_show->layout); return 0; } -static void -_mp_edit_view_on_event(void *thiz, MpViewEvent_e event) +static void _mp_edit_view_on_event(void *thiz, MpViewEvent_e event) { DEBUG_TRACE("event; %d", event); MpEditView_t *view = thiz; @@ -551,16 +601,19 @@ _mp_edit_view_on_event(void *thiz, MpViewEvent_e event) mp_view_mgr_pop_a_view(GET_VIEW_MGR, thiz); break; case MP_POPUP_CANCEL: - mp_view_update_options((MpView_t *)view); + mp_view_update_options((MpView_t *) view); break; - case MP_LANG_CHANGED: { - int count = 0; - if (view->content_to_show) { - count = mp_list_get_checked_count((MpList_t *)view->content_to_show); + case MP_LANG_CHANGED:{ + int count = 0; + if (view->content_to_show) { + count = + mp_list_get_checked_count((MpList_t *) view-> + content_to_show); + } + mp_util_create_selectioninfo_with_count((MpView_t *) view, + count); + break; } - mp_util_create_selectioninfo_with_count((MpView_t *)view, count); - break; - } case MP_PERSONAL_PAGE_OFF: if (view->person_page_sel != MP_EDIT_VIEW_PERSONAL_PAGE_NONE) { mp_view_mgr_pop_a_view(GET_VIEW_MGR, thiz); @@ -576,9 +629,18 @@ _mp_edit_view_on_event(void *thiz, MpViewEvent_e event) #ifndef MP_SOUND_PLAYER case MP_UPDATE_PLAYING_LIST: if (view->list_mode == MP_EDIT_VIEW_REORDER) { - mp_list_realized_item_part_update((MpList_t *)view->content_to_show, "elm.text.main.left.top", ELM_GENLIST_ITEM_FIELD_TEXT); - mp_list_realized_item_part_update((MpList_t *)view->content_to_show, "elm.text.sub.left.bottom", ELM_GENLIST_ITEM_FIELD_TEXT); - mp_list_realized_item_part_update((MpList_t *)view->content_to_show, "elm.icon.left", ELM_GENLIST_ITEM_FIELD_CONTENT); + mp_list_realized_item_part_update((MpList_t *) view-> + content_to_show, + "elm.text.main.left.top", + ELM_GENLIST_ITEM_FIELD_TEXT); + mp_list_realized_item_part_update((MpList_t *) view-> + content_to_show, + "elm.text.sub.left.bottom", + ELM_GENLIST_ITEM_FIELD_TEXT); + mp_list_realized_item_part_update((MpList_t *) view-> + content_to_show, + "elm.icon.left", + ELM_GENLIST_ITEM_FIELD_CONTENT); } break; #endif @@ -593,12 +655,11 @@ _mp_edit_view_on_event(void *thiz, MpViewEvent_e event) } } -static int -_mp_edit_view_init(Evas_Object *parent, MpEditView_t *view) +static int _mp_edit_view_init(Evas_Object * parent, MpEditView_t * view) { startfunc; int ret = 0; - ret = mp_list_view_init(parent, (MpListView_t *)view, MP_VIEW_EDIT); + ret = mp_list_view_init(parent, (MpListView_t *) view, MP_VIEW_EDIT); MP_CHECK_VAL(ret == 0, -1); view->update = _mp_edit_view_update; @@ -614,9 +675,13 @@ _mp_edit_view_init(Evas_Object *parent, MpEditView_t *view) } #ifdef MP_FEATURE_PERSONAL_PAGE -MpEditView_t *mp_edit_view_create(Evas_Object *parent, MpList_t *list, bool share, MpEditViewPersonalPageType person_page_sel) +MpEditView_t *mp_edit_view_create(Evas_Object * parent, MpList_t * list, + bool share, + MpEditViewPersonalPageType + person_page_sel) #else -MpEditView_t *mp_edit_view_create(Evas_Object *parent, MpList_t *list, bool share) +MpEditView_t *mp_edit_view_create(Evas_Object * parent, MpList_t * list, + bool share) #endif { eventfunc; @@ -641,17 +706,16 @@ MpEditView_t *mp_edit_view_create(Evas_Object *parent, MpList_t *list, bool shar _mp_edit_view_content_load(view); return view; -Error: + Error: ERROR_TRACE("Error: mp_edit_view_create()"); IF_FREE(view); return NULL; } -int mp_edit_view_destory(MpEditView_t *view) +int mp_edit_view_destory(MpEditView_t * view) { startfunc; MP_CHECK_VAL(view, -1); return 0; } - diff --git a/src/view/mp-genre-detail-view.c b/src/view/mp-genre-detail-view.c index 271c535..cf7c81e 100644 --- a/src/view/mp-genre-detail-view.c +++ b/src/view/mp-genre-detail-view.c @@ -24,15 +24,16 @@ #define MP_LABEL_SLIDE_DURATION 5 #define MP_GENRE_INDEX_ICON_SIZE (202 * elm_config_scale_get()) -static void _mp_genre_detail_view_tracklist_edit_cb(void *data, Evas_Object *obj, void *event_info); +static void _mp_genre_detail_view_tracklist_edit_cb(void *data, + Evas_Object * obj, + void *event_info); -static void -_mp_genre_detail_view_destory_cb(void *thiz) +static void _mp_genre_detail_view_destory_cb(void *thiz) { startfunc; MpGenreDetailView_t *view = thiz; MP_CHECK(view); - mp_list_view_fini((MpListView_t *)view); + mp_list_view_fini((MpListView_t *) view); /* TODO: release resource.. */ mp_genre_detail_view_destory(view); @@ -49,31 +50,35 @@ int _mp_genre_detail_view_update(void *thiz) view->content_set(view); if (edit_flag) { mp_list_set_edit(view->content_to_show, true); - mp_view_update_options_edit((MpView_t *)view); - mp_list_view_set_select_all((MpListView_t *)view, true); + mp_view_update_options_edit((MpView_t *) view); + mp_list_view_set_select_all((MpListView_t *) view, true); } else { - mp_view_update_options((MpView_t *)view); - mp_list_view_set_select_all((MpListView_t *)view, false); + mp_view_update_options((MpView_t *) view); + mp_list_view_set_select_all((MpListView_t *) view, false); } return 0; } -static void _mp_genre_detail_view_add_to_playlist_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_genre_detail_view_add_to_playlist_cb(void *data, + Evas_Object * obj, + void *event_info) { eventfunc; MpGenreDetailView_t *view = (MpGenreDetailView_t *) data; MP_CHECK(view); mp_evas_object_del(view->more_btn_ctxpopup); - mp_common_add_to_playlsit_view((MpListView_t *)view); + mp_common_add_to_playlsit_view((MpListView_t *) view); } -static void _mp_genre_detail_view_normal_more_btn_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_genre_detail_view_normal_more_btn_cb(void *data, + Evas_Object * obj, + void *event_info) { eventfunc; - MpGenreDetailView_t *view = (MpGenreDetailView_t *)data; + MpGenreDetailView_t *view = (MpGenreDetailView_t *) data; MP_CHECK(view); mp_evas_object_del(view->more_btn_ctxpopup); @@ -81,44 +86,55 @@ static void _mp_genre_detail_view_normal_more_btn_cb(void *data, Evas_Object *ob view->more_btn_ctxpopup = mp_common_create_more_ctxpopup(view); MP_CHECK(view->more_btn_ctxpopup); - if (mp_list_get_editable_count(view->content_to_show, MP_LIST_EDIT_TYPE_NORMAL)) { + if (mp_list_get_editable_count + (view->content_to_show, MP_LIST_EDIT_TYPE_NORMAL)) { mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_ADD_TO_PLAYLIST, MP_PLAYER_MORE_BTN_ADD_TO_PLAYLSIT_IMAGE, _mp_genre_detail_view_add_to_playlist_cb, view); + STR_MP_ADD_TO_PLAYLIST, + MP_PLAYER_MORE_BTN_ADD_TO_PLAYLSIT_IMAGE, + _mp_genre_detail_view_add_to_playlist_cb, + view); mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_DELETE, - MP_PLAYER_MORE_BTN_DELETE_IMAGE, - _mp_genre_detail_view_tracklist_edit_cb, - view); + STR_MP_DELETE, + MP_PLAYER_MORE_BTN_DELETE_IMAGE, + _mp_genre_detail_view_tracklist_edit_cb, + view); } - /*search*/ + /*search */ mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_SEARCH, NULL, mp_common_create_search_view_cb, view); + STR_MP_SEARCH, NULL, + mp_common_create_search_view_cb, view); mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_SETTINGS, MP_PLAYER_MORE_BTN_SETTING, mp_common_ctxpopup_setting_cb, view); + STR_MP_SETTINGS, + MP_PLAYER_MORE_BTN_SETTING, + mp_common_ctxpopup_setting_cb, view); #ifndef MP_FEATURE_NO_END mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_END, MP_PLAYER_MORE_BTN_VIEW_END, mp_common_ctxpopup_end_cb, view); + STR_MP_END, MP_PLAYER_MORE_BTN_VIEW_END, + mp_common_ctxpopup_end_cb, view); #endif mp_util_more_btn_move_ctxpopup(view->more_btn_ctxpopup, obj); evas_object_show(view->more_btn_ctxpopup); } -/*************** functions for track list update *******************/ -static void _mp_genre_detail_view_tracklist_edit_cb(void *data, Evas_Object * obj, void *event_info) +/*************** functions for track list update *******************/ +static void _mp_genre_detail_view_tracklist_edit_cb(void *data, + Evas_Object * obj, + void *event_info) { eventfunc; MpGenreDetailView_t *view = (MpGenreDetailView_t *) data; MP_CHECK(view); mp_evas_object_del(view->more_btn_ctxpopup); - mp_common_show_edit_view((MpListView_t *)view, MP_DONE_DELETE_TYPE); + mp_common_show_edit_view((MpListView_t *) view, MP_DONE_DELETE_TYPE); } -Eina_Bool _mp_genre_detail_view_tracklist_back_cb(void *data, Elm_Object_Item *it) +Eina_Bool _mp_genre_detail_view_tracklist_back_cb(void *data, + Elm_Object_Item * it) { eventfunc; MpGenreDetailView_t *view = (MpGenreDetailView_t *) data; @@ -127,9 +143,9 @@ Eina_Bool _mp_genre_detail_view_tracklist_back_cb(void *data, Elm_Object_Item *i MpList_t *track_list = view->content_to_show; MP_CHECK_VAL(track_list, EINA_TRUE); if (track_list->edit_mode == 1) { - mp_list_set_edit((MpList_t *)track_list, FALSE); - mp_list_view_set_select_all((MpListView_t *)view, FALSE); - mp_view_update_options((MpView_t *)view); + mp_list_set_edit((MpList_t *) track_list, FALSE); + mp_list_view_set_select_all((MpListView_t *) view, FALSE); + mp_view_update_options((MpView_t *) view); mp_evas_object_del(view->selection_info); return EINA_FALSE; } else { @@ -143,21 +159,28 @@ Eina_Bool _mp_genre_detail_view_tracklist_back_cb(void *data, Elm_Object_Item *i static int _mp_genre_detail_view_update_options(void *thiz) { startfunc; - MpGenreDetailView_t *view = (MpGenreDetailView_t *)thiz; + MpGenreDetailView_t *view = (MpGenreDetailView_t *) thiz; MP_CHECK_VAL(view, -1); - mp_view_clear_options((MpView_t *)view); + mp_view_clear_options((MpView_t *) view); Evas_Object *btn = NULL; - btn = mp_widget_create_toolbar_btn(view->genre_detail_view_layout, MP_TOOLBAR_BTN_MORE, NULL, _mp_genre_detail_view_normal_more_btn_cb, view); - elm_object_item_part_content_set(view->navi_it, "toolbar_more_btn", btn); + btn = + mp_widget_create_toolbar_btn(view->genre_detail_view_layout, + MP_TOOLBAR_BTN_MORE, NULL, + _mp_genre_detail_view_normal_more_btn_cb, + view); + elm_object_item_part_content_set(view->navi_it, "toolbar_more_btn", + btn); - elm_naviframe_item_pop_cb_set(view->navi_it, _mp_genre_detail_view_tracklist_back_cb, view); - /*view->toolbar_options[MP_OPTION_MORE] = btn;*/ + elm_naviframe_item_pop_cb_set(view->navi_it, + _mp_genre_detail_view_tracklist_back_cb, + view); + /*view->toolbar_options[MP_OPTION_MORE] = btn; */ /* update the first controlba item */ - /*mp_view_manager_update_first_controlbar_item(layout_data);*/ + /*mp_view_manager_update_first_controlbar_item(layout_data); */ endfunc; return 0; } @@ -166,18 +189,24 @@ static void _mp_genre_detail_view_content_load(void *thiz) { startfunc; MP_CHECK(thiz); - MpGenreDetailView_t *view = (MpGenreDetailView_t *)thiz; + MpGenreDetailView_t *view = (MpGenreDetailView_t *) thiz; MP_CHECK(view); MP_CHECK(view->layout); MP_CHECK(view->genre_detail_view_layout); - elm_object_part_content_set(view->layout, "list_content", view->genre_detail_view_layout); + elm_object_part_content_set(view->layout, "list_content", + view->genre_detail_view_layout); /* genre index */ - view->content_to_show = (MpList_t *)mp_track_list_create(view->layout); + view->content_to_show = + (MpList_t *) mp_track_list_create(view->layout); MP_CHECK(view->content_to_show); - mp_track_list_set_data((MpTrackList_t *)view->content_to_show, MP_TRACK_LIST_TYPE, MP_TRACK_BY_GENRE, MP_TRACK_LIST_TYPE_STR, view->name, -1); + mp_track_list_set_data((MpTrackList_t *) view->content_to_show, + MP_TRACK_LIST_TYPE, MP_TRACK_BY_GENRE, + MP_TRACK_LIST_TYPE_STR, view->name, -1); mp_list_update(view->content_to_show); - elm_object_part_content_set(view->genre_detail_view_layout, "list-content", view->content_to_show->layout); + elm_object_part_content_set(view->genre_detail_view_layout, + "list-content", + view->content_to_show->layout); } static void @@ -188,66 +217,84 @@ _mp_genre_detaill_view_on_event(void *thiz, MpViewEvent_e event) switch (event) { case MP_DELETE_DONE: mp_list_update(view->content_to_show); - if (!mp_list_get_editable_count(view->content_to_show, mp_list_get_edit_type(view->content_to_show))) { + if (!mp_list_get_editable_count + (view->content_to_show, + mp_list_get_edit_type(view->content_to_show))) { mp_view_mgr_pop_to_view(GET_VIEW_MGR, MP_VIEW_ALL); } break; #ifndef MP_SOUND_PLAYER case MP_UPDATE_PLAYING_LIST: - mp_list_realized_item_part_update(view->content_to_show, "elm.text.main.left.top", ELM_GENLIST_ITEM_FIELD_TEXT); - mp_list_realized_item_part_update(view->content_to_show, "elm.text.sub.left.bottom", ELM_GENLIST_ITEM_FIELD_TEXT); + mp_list_realized_item_part_update(view->content_to_show, + "elm.text.main.left.top", + ELM_GENLIST_ITEM_FIELD_TEXT); + mp_list_realized_item_part_update(view->content_to_show, + "elm.text.sub.left.bottom", + ELM_GENLIST_ITEM_FIELD_TEXT); break; #endif - case MP_VIEW_EVENT_ALBUMART_CHANGED: { - mp_media_list_h media_list = NULL; - mp_media_info_h media = NULL; - mp_media_info_list_create(&media_list, MP_TRACK_BY_GENRE, view->name, NULL, NULL, 0, 0, 1); - media = mp_media_info_list_nth_item(media_list, 0); - - char *path = NULL; - mp_media_info_get_thumbnail_path(media, &path); - - IF_FREE(view->thumbnail); - view->thumbnail = g_strdup(path); - Evas_Object *icon = mp_util_create_thumb_icon(view->genre_index, view->thumbnail, MP_GENRE_INDEX_ICON_SIZE, MP_GENRE_INDEX_ICON_SIZE); - elm_object_part_content_set(view->genre_index, "elm.icon", icon); - - mp_media_info_list_destroy(media_list); - - } - break; + case MP_VIEW_EVENT_ALBUMART_CHANGED:{ + mp_media_list_h media_list = NULL; + mp_media_info_h media = NULL; + mp_media_info_list_create(&media_list, MP_TRACK_BY_GENRE, + view->name, NULL, NULL, 0, 0, 1); + media = mp_media_info_list_nth_item(media_list, 0); + + char *path = NULL; + mp_media_info_get_thumbnail_path(media, &path); + + IF_FREE(view->thumbnail); + view->thumbnail = g_strdup(path); + Evas_Object *icon = + mp_util_create_thumb_icon(view->genre_index, + view->thumbnail, + MP_GENRE_INDEX_ICON_SIZE, + MP_GENRE_INDEX_ICON_SIZE); + elm_object_part_content_set(view->genre_index, "elm.icon", + icon); + + mp_media_info_list_destroy(media_list); - case MP_UPDATE_FAVORITE_LIST: { - mp_list_update(view->content_to_show); + } break; - } + + case MP_UPDATE_FAVORITE_LIST:{ + mp_list_update(view->content_to_show); + break; + } default: break; } } static int -_mp_genre_detail_view_init(Evas_Object *parent, MpGenreDetailView_t *view) +_mp_genre_detail_view_init(Evas_Object * parent, + MpGenreDetailView_t * view) { startfunc; int ret = 0; - ret = mp_list_view_init(parent, (MpListView_t *)view, MP_VIEW_GENRE_DETAIL); + ret = + mp_list_view_init(parent, (MpListView_t *) view, + MP_VIEW_GENRE_DETAIL); MP_CHECK_VAL(ret == 0, -1); view->update = _mp_genre_detail_view_update; view->update_options = _mp_genre_detail_view_update_options; - /*view->update_options_edit = _mp_genre_detail_view_update_options_edit;*/ + /*view->update_options_edit = _mp_genre_detail_view_update_options_edit; */ view->view_destroy_cb = _mp_genre_detail_view_destory_cb; view->content_set = _mp_genre_detail_view_content_load; view->on_event = _mp_genre_detaill_view_on_event; - view->genre_detail_view_layout = mp_common_load_edj(parent, MP_EDJ_NAME, "genre_view_layout"); + view->genre_detail_view_layout = + mp_common_load_edj(parent, MP_EDJ_NAME, "genre_view_layout"); MP_CHECK_VAL(view->genre_detail_view_layout, -1); return ret; } -MpGenreDetailView_t *mp_genre_detail_view_create(Evas_Object *parent, char *genre, char *artist, char *thumbnail) +MpGenreDetailView_t *mp_genre_detail_view_create(Evas_Object * parent, + char *genre, char *artist, + char *thumbnail) { startfunc; int ret; @@ -270,13 +317,13 @@ MpGenreDetailView_t *mp_genre_detail_view_create(Evas_Object *parent, char *genr _mp_genre_detail_view_content_load(view); return view; -Error: + Error: ERROR_TRACE("Error: mp_genre_detail_view_create()"); IF_FREE(view); return NULL; } -int mp_genre_detail_view_destory(MpGenreDetailView_t *view) +int mp_genre_detail_view_destory(MpGenreDetailView_t * view) { startfunc; MP_CHECK_VAL(view, -1); @@ -285,5 +332,3 @@ int mp_genre_detail_view_destory(MpGenreDetailView_t *view) IF_G_FREE(view->thumbnail); return 0; } - - diff --git a/src/view/mp-list-view.c b/src/view/mp-list-view.c index fb9e102..c9d5dcc 100644 --- a/src/view/mp-list-view.c +++ b/src/view/mp-list-view.c @@ -27,17 +27,16 @@ #define CHECK_LIST_VIEW(view, val) \ do {\ MP_CHECK_VAL(view, val);\ - mp_retvm_if (view->list_view_magic != LIST_VIEW_MAGIC, val,\ - "Error: param is not view object!!!", view->list_view_magic);\ + mp_retvm_if(view->list_view_magic != LIST_VIEW_MAGIC, val,\ + "Error: param is not view object!!!", view->list_view_magic);\ } while (0); -static int -_mp_list_view_set_edit_mode(void *thiz, bool edit) +static int _mp_list_view_set_edit_mode(void *thiz, bool edit) { startfunc; - MpListView_t *view = (MpListView_t *)thiz; + MpListView_t *view = (MpListView_t *) thiz; MP_CHECK_VAL(view, -1); mp_evas_object_del(view->selection_info); @@ -49,10 +48,11 @@ _mp_list_view_set_edit_mode(void *thiz, bool edit) return 0; } -static void _mp_list_select_all_cb(void *data, Evas_Object * obj, void *event_info) +static void _mp_list_select_all_cb(void *data, Evas_Object * obj, + void *event_info) { startfunc; - MpListView_t *view = (MpListView_t *)data; + MpListView_t *view = (MpListView_t *) data; mp_retm_if(view == NULL, "view is NULL"); mp_list_item_data_t *it_data; @@ -66,7 +66,9 @@ static void _mp_list_select_all_cb(void *data, Evas_Object * obj, void *event_in /* check if all the item selected */ bool all_selected_flag = TRUE; while (it) { - if (mp_list_item_select_mode_get(it) == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY || elm_object_item_disabled_get(it) == TRUE) { + if (mp_list_item_select_mode_get(it) == + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY + || elm_object_item_disabled_get(it) == TRUE) { it = mp_list_item_next_get(it); continue; } @@ -84,11 +86,14 @@ static void _mp_list_select_all_cb(void *data, Evas_Object * obj, void *event_in Eina_Bool value = EINA_FALSE; value = all_selected_flag ? EINA_FALSE : EINA_TRUE; - DEBUG_TRACE("all_selected_flag is %d\tvalue is %d", all_selected_flag, value); + DEBUG_TRACE("all_selected_flag is %d\tvalue is %d", all_selected_flag, + value); it = mp_list_first_item_get(genlist); MpList_t *list = view->content_to_show; while (it) { - if (mp_list_item_select_mode_get(it) == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY || elm_object_item_disabled_get(it) == TRUE) { + if (mp_list_item_select_mode_get(it) == + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY + || elm_object_item_disabled_get(it) == TRUE) { it = mp_list_item_next_get(it); continue; } @@ -97,13 +102,17 @@ static void _mp_list_select_all_cb(void *data, Evas_Object * obj, void *event_in } /* view->selection_info = mp_util_create_selectioninfo_with_count(view, mp_list_get_checked_count(list)); */ - mp_util_create_selectioninfo_with_count(view, mp_list_get_checked_count(list)); - mp_view_update_options_edit((MpView_t *)view); + mp_util_create_selectioninfo_with_count(view, + mp_list_get_checked_count + (list)); + mp_view_update_options_edit((MpView_t *) view); endfunc; } -static void _mp_list_select_all_layout_down_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) +static void _mp_list_select_all_layout_down_cb(void *data, Evas * evas, + Evas_Object * obj, + void *event_info) { MP_CHECK(obj); Evas_Object *check = elm_object_part_content_get(obj, "elm.icon"); @@ -112,10 +121,10 @@ static void _mp_list_select_all_layout_down_cb(void *data, Evas *evas, Evas_Obje _mp_list_select_all_cb(data, check, NULL); } -static Evas_Object *_mp_list_view_set_select_all(void *thiz, bool edit) +static Evas_Object *_mp_list_view_set_select_all(void *thiz, bool edit) { - MpListView_t *view = (MpListView_t *)thiz; + MpListView_t *view = (MpListView_t *) thiz; if (view->select_all_btn) { evas_object_del(view->select_all_btn); @@ -123,8 +132,13 @@ static Evas_Object *_mp_list_view_set_select_all(void *thiz, bool edit) } if (edit == TRUE) { - mp_widget_create_select_all_layout(view->layout, _mp_list_select_all_cb, _mp_list_select_all_layout_down_cb, view, &view->select_all_btn, &view->select_all_layout); - elm_object_part_content_set(view->layout, "select_all_bg", view->select_all_layout); + mp_widget_create_select_all_layout(view->layout, + _mp_list_select_all_cb, + _mp_list_select_all_layout_down_cb, + view, &view->select_all_btn, + &view->select_all_layout); + elm_object_part_content_set(view->layout, "select_all_bg", + view->select_all_layout); elm_object_signal_emit(view->layout, "SHOW_INFO_TEXT_BAR", ""); } else { elm_object_signal_emit(view->layout, "HIDE_INFO_TEXT_BAR", ""); @@ -133,19 +147,20 @@ static Evas_Object *_mp_list_view_set_select_all(void *thiz, bool edit) return view->select_all_btn; } -static int -_mp_list_view_double_tap(void *thiz) +static int _mp_list_view_double_tap(void *thiz) { startfunc; - MpListView_t *view = (MpListView_t *)thiz; + MpListView_t *view = (MpListView_t *) thiz; mp_list_double_tap(view->content_to_show); return 0; } -static Evas_Object *_mp_list_view_set_done_button(void *thiz, bool edit, mp_done_operator_type_t type) +static Evas_Object *_mp_list_view_set_done_button(void *thiz, bool edit, + mp_done_operator_type_t + type) { - MpListView_t *view = (MpListView_t *)thiz; + MpListView_t *view = (MpListView_t *) thiz; Evas_Object *done_button = NULL; if (view->done_btn) { @@ -155,17 +170,41 @@ static Evas_Object *_mp_list_view_set_done_button(void *thiz, bool edit, mp_don if (edit == TRUE) { if (type == MP_DONE_DELETE_TYPE) { - done_button = mp_widget_create_navi_right_btn(view->layout, view->navi_it, mp_edit_view_delete_cb, view); + done_button = + mp_widget_create_navi_right_btn(view->layout, + view->navi_it, + mp_edit_view_delete_cb, + view); } else if (type == MP_DONE_ADD_TO_TYPE) { - done_button = mp_widget_create_navi_right_btn(view->layout, view->navi_it, mp_edit_view_add_to_playlist_cb, view); + done_button = + mp_widget_create_navi_right_btn(view->layout, + view->navi_it, + mp_edit_view_add_to_playlist_cb, + view); } else if (type == MP_DONE_ADD_TRACK_TYPE) { - done_button = mp_widget_create_navi_right_btn(view->layout, view->navi_it, mp_add_track_view_add_to_playlist_cb, view); + done_button = + mp_widget_create_navi_right_btn(view->layout, + view->navi_it, + mp_add_track_view_add_to_playlist_cb, + view); } else if (type == MP_DONE_REMOVED_TYPE) { - done_button = mp_widget_create_navi_right_btn(view->layout, view->navi_it, mp_edit_view_remove_cb, view); + done_button = + mp_widget_create_navi_right_btn(view->layout, + view->navi_it, + mp_edit_view_remove_cb, + view); } else if (type == MP_DONE_REORDER_TYPE) { - done_button = mp_widget_create_navi_right_btn(view->layout, view->navi_it, mp_edit_view_list_item_reorder_update_cb, view); + done_button = + mp_widget_create_navi_right_btn(view->layout, + view->navi_it, + mp_edit_view_list_item_reorder_update_cb, + view); } else if (type == MP_DONE_SELECT_ADD_TRACK_TYPE) { - done_button = mp_widget_create_navi_right_btn(view->layout, view->navi_it, mp_select_track_view_add_to_playlist_cb, view->content_to_show); + done_button = + mp_widget_create_navi_right_btn(view->layout, + view->navi_it, + mp_select_track_view_add_to_playlist_cb, + view->content_to_show); } MP_CHECK_NULL(done_button); view->done_btn = done_button; @@ -175,10 +214,10 @@ static Evas_Object *_mp_list_view_set_done_button(void *thiz, bool edit, mp_don return done_button; } -static Evas_Object *_mp_list_view_set_cancel_button(void *thiz, bool edit) +static Evas_Object *_mp_list_view_set_cancel_button(void *thiz, bool edit) { - MpListView_t *view = (MpListView_t *)thiz; + MpListView_t *view = (MpListView_t *) thiz; Evas_Object *cancel_button = NULL; if (view->cancel_btn) { @@ -187,7 +226,9 @@ static Evas_Object *_mp_list_view_set_cancel_button(void *thiz, bool edit) } if (edit == TRUE) { - cancel_button = mp_widget_create_navi_left_btn(view->layout, view->navi_it, mp_common_view_cancel_cb, view); + cancel_button = + mp_widget_create_navi_left_btn(view->layout, view->navi_it, + mp_common_view_cancel_cb, view); MP_CHECK_NULL(cancel_button); view->cancel_btn = cancel_button; } @@ -196,23 +237,24 @@ static Evas_Object *_mp_list_view_set_cancel_button(void *thiz, bool edit) } -int mp_list_view_init(Evas_Object *parent, MpListView_t *view, MpViewType_e view_type, ...) +int mp_list_view_init(Evas_Object * parent, MpListView_t * view, + MpViewType_e view_type, ...) { startfunc; int ret = 0; MP_CHECK_VAL(view, -1); /*initalize parent class */ - ret = mp_view_init(parent, (MpView_t *)view, view_type); + ret = mp_view_init(parent, (MpView_t *) view, view_type); MP_CHECK_VAL(ret == 0, -1); - /*initialize data*/ + /*initialize data */ view->list_view_magic = LIST_VIEW_MAGIC; /*parent's function overriding. - view->update = _mp_list_view_update; + view->update = _mp_list_view_update; - initialize functions*/ + initialize functions */ view->set_edit_mode = _mp_list_view_set_edit_mode; view->set_select_all = _mp_list_view_set_select_all; view->double_tap = _mp_list_view_double_tap; @@ -222,7 +264,7 @@ int mp_list_view_init(Evas_Object *parent, MpListView_t *view, MpViewType_e view return 0; } -int mp_list_view_fini(MpListView_t *view) +int mp_list_view_fini(MpListView_t * view) { startfunc; int ret = 0; @@ -230,13 +272,13 @@ int mp_list_view_fini(MpListView_t *view) view->list_view_magic = 0; - ret = mp_view_fini((MpView_t *)view); + ret = mp_view_fini((MpView_t *) view); MP_CHECK_VAL(ret == 0, -1); return 0; } -int mp_list_view_is_list_view(MpListView_t *view, bool *val) +int mp_list_view_is_list_view(MpListView_t * view, bool * val) { MP_CHECK_VAL(val, -1); *val = false; @@ -245,7 +287,7 @@ int mp_list_view_is_list_view(MpListView_t *view, bool *val) return 0; } -int mp_list_view_set_edit_mode(MpListView_t *view, bool edit) +int mp_list_view_set_edit_mode(MpListView_t * view, bool edit) { CHECK_LIST_VIEW(view, -1); MP_CHECK_VAL(view->set_edit_mode, -1); @@ -254,28 +296,30 @@ int mp_list_view_set_edit_mode(MpListView_t *view, bool edit) return 0; } -Evas_Object *mp_list_view_set_select_all(MpListView_t *view, bool flag) +Evas_Object *mp_list_view_set_select_all(MpListView_t * view, bool flag) { CHECK_LIST_VIEW(view, NULL); MP_CHECK_VAL(view->set_select_all, NULL); return view->set_select_all(view, flag); } -int mp_list_view_double_tap(MpListView_t *view) +int mp_list_view_double_tap(MpListView_t * view) { CHECK_LIST_VIEW(view, -1); MP_CHECK_VAL(view->double_tap, -1); view->double_tap(view); return 0; } -Evas_Object *mp_list_view_set_done_btn(MpListView_t *view, bool flag, mp_done_operator_type_t type) + +Evas_Object *mp_list_view_set_done_btn(MpListView_t * view, bool flag, + mp_done_operator_type_t type) { CHECK_LIST_VIEW(view, NULL); MP_CHECK_VAL(view->set_done_button, NULL); return view->set_done_button(view, flag, type); } -Evas_Object *mp_list_view_set_cancel_btn(MpListView_t *view, bool flag) +Evas_Object *mp_list_view_set_cancel_btn(MpListView_t * view, bool flag) { CHECK_LIST_VIEW(view, NULL); MP_CHECK_VAL(view->set_cancel_button, NULL); diff --git a/src/view/mp-now-playing-list-view.c b/src/view/mp-now-playing-list-view.c index bc53677..316cf4c 100644 --- a/src/view/mp-now-playing-list-view.c +++ b/src/view/mp-now-playing-list-view.c @@ -21,24 +21,29 @@ #include "mp-common.h" #include "mp-popup.h" -static void _mp_now_playing_view_open_playlist_btn_edit_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_now_playing_view_open_playlist_btn_edit_cb(void *data, + Evas_Object * + obj, + void + *event_info) { eventfunc; MpNowPlayingListiew_t *view = (MpNowPlayingListiew_t *) data; MP_CHECK(view); mp_evas_object_del(view->more_btn_ctxpopup); - /*mp_common_show_edit_view((MpNowPlayingListiew_t *)view);*/ + /*mp_common_show_edit_view((MpNowPlayingListiew_t *)view); */ mp_list_set_edit(view->content_to_show, true); - mp_view_update_options_edit((MpView_t *)view); + mp_view_update_options_edit((MpView_t *) view); } static void -_mp_now_playing_list_view_normal_more_btn_cb(void *data, Evas_Object *obj, void *event_info) +_mp_now_playing_list_view_normal_more_btn_cb(void *data, Evas_Object * obj, + void *event_info) { DEBUG_TRACE(""); - MpNowPlayingListiew_t *view = (MpNowPlayingListiew_t *)data; + MpNowPlayingListiew_t *view = (MpNowPlayingListiew_t *) data; MP_CHECK(view); mp_evas_object_del(view->more_btn_ctxpopup); @@ -47,13 +52,18 @@ _mp_now_playing_list_view_normal_more_btn_cb(void *data, Evas_Object *obj, void MP_CHECK(view->more_btn_ctxpopup); mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_EDIT, MP_PLAYER_MORE_BTN_EDIT, _mp_now_playing_view_open_playlist_btn_edit_cb, view); + STR_MP_EDIT, MP_PLAYER_MORE_BTN_EDIT, + _mp_now_playing_view_open_playlist_btn_edit_cb, + view); mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_SETTINGS, MP_PLAYER_MORE_BTN_SETTING, mp_common_ctxpopup_setting_cb, view); + STR_MP_SETTINGS, + MP_PLAYER_MORE_BTN_SETTING, + mp_common_ctxpopup_setting_cb, view); #ifndef MP_FEATURE_NO_END mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_END, MP_PLAYER_MORE_BTN_VIEW_END, mp_common_ctxpopup_end_cb, view); + STR_MP_END, MP_PLAYER_MORE_BTN_VIEW_END, + mp_common_ctxpopup_end_cb, view); #endif mp_util_more_btn_move_ctxpopup(view->more_btn_ctxpopup, obj); @@ -61,7 +71,9 @@ _mp_now_playing_list_view_normal_more_btn_cb(void *data, Evas_Object *obj, void } static void -_mp_now_playing_list_view_remove_popup_response_cb(void *data, Evas_Object *obj, void *event_info) +_mp_now_playing_list_view_remove_popup_response_cb(void *data, + Evas_Object * obj, + void *event_info) { startfunc; DEBUG_TRACE(""); @@ -71,7 +83,7 @@ _mp_now_playing_list_view_remove_popup_response_cb(void *data, Evas_Object *obj, ad->popup_delete = NULL; mp_evas_object_del(obj); - int response = (int)event_info; + int response = (int) event_info; if (response == MP_POPUP_NO) { return; } @@ -79,20 +91,25 @@ _mp_now_playing_list_view_remove_popup_response_cb(void *data, Evas_Object *obj, MpNowPlayingListiew_t *view = data; MP_CHECK(view); - mp_now_playing_list_remove_selected_item((MpNowPlayingList_t *)view->content_to_show); + mp_now_playing_list_remove_selected_item((MpNowPlayingList_t *) view-> + content_to_show); mp_view_mgr_post_event(GET_VIEW_MGR, MP_PLAYLIST_MODIFIED); - mp_util_create_selectioninfo_with_count(view, mp_list_get_checked_count(view->content_to_show)); - mp_view_update_options_edit((MpView_t *)view); - if (mp_list_get_editable_count(view->content_to_show, mp_list_get_edit_type(view->content_to_show)) == 0) { - mp_list_update((MpList_t *)view->content_to_show); + mp_util_create_selectioninfo_with_count(view, + mp_list_get_checked_count + (view->content_to_show)); + mp_view_update_options_edit((MpView_t *) view); + if (mp_list_get_editable_count + (view->content_to_show, + mp_list_get_edit_type(view->content_to_show)) == 0) { + mp_list_update((MpList_t *) view->content_to_show); mp_view_mgr_pop_a_view(GET_VIEW_MGR, GET_PLAYER_VIEW); mp_view_mgr_post_event(GET_VIEW_MGR, MP_UNSET_NOW_PLAYING); } } static void -_mp_now_playing_list_view_remove_popup_show(MpNowPlayingListiew_t *view) +_mp_now_playing_list_view_remove_popup_show(MpNowPlayingListiew_t * view) { DEBUG_TRACE(""); struct appdata *ad = mp_util_get_appdata(); @@ -102,47 +119,54 @@ _mp_now_playing_list_view_remove_popup_show(MpNowPlayingListiew_t *view) MP_CHECK(list); if (mp_list_get_checked_count(list) <= 0) { - mp_widget_text_popup(ad, GET_STR("IDS_MUSIC_POP_NOTHING_SELECTED")); + mp_widget_text_popup(ad, + GET_STR("IDS_MUSIC_POP_NOTHING_SELECTED")); return; } - Evas_Object *popup = mp_popup_create(ad->win_main, MP_POPUP_NORMAL, NULL, view, _mp_now_playing_list_view_remove_popup_response_cb, ad); + Evas_Object *popup = + mp_popup_create(ad->win_main, MP_POPUP_NORMAL, NULL, view, + _mp_now_playing_list_view_remove_popup_response_cb, + ad); ad->popup_delete = popup; - evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); elm_object_text_set(popup, GET_STR("IDS_MUSIC_POP_REMOVE_Q")); - mp_popup_button_set(popup, MP_POPUP_BTN_1, STR_MP_REMOVE, MP_POPUP_YES); + mp_popup_button_set(popup, MP_POPUP_BTN_1, STR_MP_REMOVE, + MP_POPUP_YES); evas_object_show(popup); } static void -_mp_now_playing_list_view_remove_btn_cb(void *data, Evas_Object *obj, void *event_info) +_mp_now_playing_list_view_remove_btn_cb(void *data, Evas_Object * obj, + void *event_info) { DEBUG_TRACE(""); - MpNowPlayingListiew_t *view = (MpNowPlayingListiew_t *)data; + MpNowPlayingListiew_t *view = (MpNowPlayingListiew_t *) data; MP_CHECK(view); _mp_now_playing_list_view_remove_popup_show(view); } static Eina_Bool -_mp_now_playing_list_view_back_cb(void *data, Elm_Object_Item *it) +_mp_now_playing_list_view_back_cb(void *data, Elm_Object_Item * it) { DEBUG_TRACE(""); MpNowPlayingListiew_t *view = (MpNowPlayingListiew_t *) data; MP_CHECK_VAL(view, EINA_TRUE); /*MpNowPlayingListiew_t *now_playing_list = (MpNowPlayingListiew_t *)view->content_to_show; - MP_CHECK(now_playing_list); - if (now_playing_list->edit_mode == 1)*/ + MP_CHECK(now_playing_list); + if (now_playing_list->edit_mode == 1) */ { - /* mp_list_set_edit((MpList_t *)now_playing_list, FALSE); - view->update_options(view);*/ + /* mp_list_set_edit((MpList_t *)now_playing_list, FALSE); + view->update_options(view); */ } - /* else*/ + /* else */ { MpViewMgr_t *view_manager = mp_view_mgr_get_view_manager(); mp_view_mgr_pop_view(view_manager, false); @@ -154,85 +178,112 @@ _mp_now_playing_list_view_back_cb(void *data, Elm_Object_Item *it) static int _mp_now_playing_list_view_update_options(void *thiz) { startfunc; - MpNowPlayingListiew_t *view = (MpNowPlayingListiew_t *)thiz; + MpNowPlayingListiew_t *view = (MpNowPlayingListiew_t *) thiz; MP_CHECK_VAL(view, -1); - mp_view_clear_options((MpView_t *)view); + mp_view_clear_options((MpView_t *) view); Evas_Object *btn = NULL; - btn = mp_widget_create_toolbar_btn(view->now_playing_list_layout, MP_TOOLBAR_BTN_MORE, NULL, _mp_now_playing_list_view_normal_more_btn_cb, view); - elm_object_item_part_content_set(view->navi_it, "toolbar_more_btn", btn); - /*view->toolbar_options[MP_OPTION_MORE] = btn;*/ + btn = + mp_widget_create_toolbar_btn(view->now_playing_list_layout, + MP_TOOLBAR_BTN_MORE, NULL, + _mp_now_playing_list_view_normal_more_btn_cb, + view); + elm_object_item_part_content_set(view->navi_it, "toolbar_more_btn", + btn); + /*view->toolbar_options[MP_OPTION_MORE] = btn; */ - elm_naviframe_item_pop_cb_set(view->navi_it, _mp_now_playing_list_view_back_cb, view); + elm_naviframe_item_pop_cb_set(view->navi_it, + _mp_now_playing_list_view_back_cb, view); endfunc; return 0; } -static int -_mp_now_playing_list_view_update_options_edit(void *thiz) +static int _mp_now_playing_list_view_update_options_edit(void *thiz) { startfunc; - MpNowPlayingListiew_t *view = (MpNowPlayingListiew_t *)thiz; + MpNowPlayingListiew_t *view = (MpNowPlayingListiew_t *) thiz; MP_CHECK_VAL(view, -1); - mp_view_clear_options((MpView_t *)view); - mp_view_unset_nowplaying((MpView_t *)view); + mp_view_clear_options((MpView_t *) view); + mp_view_unset_nowplaying((MpView_t *) view); - Evas_Object *toolbar = mp_widget_create_naviframe_toolbar(view->navi_it); + Evas_Object *toolbar = + mp_widget_create_naviframe_toolbar(view->navi_it); Elm_Object_Item *toolbar_item = NULL; toolbar_item = mp_widget_create_toolbar_item_btn(toolbar, - MP_TOOLBAR_BTN_LEFT, STR_MP_ADD_TO, mp_common_button_add_to_playlist_cb, view->content_to_show); + MP_TOOLBAR_BTN_LEFT, + STR_MP_ADD_TO, + mp_common_button_add_to_playlist_cb, + view-> + content_to_show); view->toolbar_options[MP_OPTION_LEFT] = toolbar_item; toolbar_item = mp_widget_create_toolbar_item_btn(toolbar, - MP_TOOLBAR_BTN_RIGHT, STR_MP_REMOVE, _mp_now_playing_list_view_remove_btn_cb, view); + MP_TOOLBAR_BTN_RIGHT, + STR_MP_REMOVE, + _mp_now_playing_list_view_remove_btn_cb, + view); view->toolbar_options[MP_OPTION_RIGHT] = toolbar_item; - Eina_Bool disabled = (mp_list_get_checked_count(view->content_to_show) == 0) ? EINA_TRUE : EINA_FALSE; - elm_object_item_disabled_set(view->toolbar_options[MP_OPTION_LEFT], disabled); - elm_object_item_disabled_set(view->toolbar_options[MP_OPTION_RIGHT], disabled); + Eina_Bool disabled = + (mp_list_get_checked_count(view->content_to_show) == + 0) ? EINA_TRUE : EINA_FALSE; + elm_object_item_disabled_set(view->toolbar_options[MP_OPTION_LEFT], + disabled); + elm_object_item_disabled_set(view->toolbar_options[MP_OPTION_RIGHT], + disabled); if (disabled) { mp_evas_object_del(view->selection_info); } if (view->select_all_btn) { - elm_object_disabled_set(view->select_all_btn, !((Eina_Bool)mp_list_get_editable_count(view->content_to_show, mp_list_get_edit_type(view->content_to_show)))); + elm_object_disabled_set(view->select_all_btn, + !((Eina_Bool) + mp_list_get_editable_count(view-> + content_to_show, + mp_list_get_edit_type + (view-> + content_to_show)))); } - elm_naviframe_item_pop_cb_set(view->navi_it, _mp_now_playing_list_view_back_cb, view); + elm_naviframe_item_pop_cb_set(view->navi_it, + _mp_now_playing_list_view_back_cb, view); endfunc; return 0; } -static void -_mp_now_playing_list_view_content_set(void *thiz) +static void _mp_now_playing_list_view_content_set(void *thiz) { startfunc; - MpNowPlayingListiew_t *view = (MpNowPlayingListiew_t *)thiz; + MpNowPlayingListiew_t *view = (MpNowPlayingListiew_t *) thiz; MP_CHECK(view); - elm_object_part_content_set(view->layout, "list_content", view->now_playing_list_layout); + elm_object_part_content_set(view->layout, "list_content", + view->now_playing_list_layout); - view->content_to_show = (MpList_t *)mp_now_playing_list_create(view->now_playing_list_layout); + view->content_to_show = + (MpList_t *) mp_now_playing_list_create(view-> + now_playing_list_layout); MP_CHECK(view->content_to_show); - elm_object_part_content_set(view->now_playing_list_layout, "list_content", view->content_to_show->layout); + elm_object_part_content_set(view->now_playing_list_layout, + "list_content", + view->content_to_show->layout); mp_list_update(view->content_to_show); } -static int -_mp_now_playing_list_view_update(void *thiz) +static int _mp_now_playing_list_view_update(void *thiz) { startfunc; MpNowPlayingListiew_t *view = thiz; if (view->content_to_show) { - mp_list_update((MpList_t *)view->content_to_show); + mp_list_update((MpList_t *) view->content_to_show); } if (mp_list_get_edit(view->content_to_show)) { @@ -244,31 +295,34 @@ _mp_now_playing_list_view_update(void *thiz) } -static void -_mp_now_playing_list_view_destory_cb(void *thiz) +static void _mp_now_playing_list_view_destory_cb(void *thiz) { startfunc; MpNowPlayingListiew_t *view = thiz; MP_CHECK(view); - mp_list_view_fini((MpListView_t *)view); + mp_list_view_fini((MpListView_t *) view); - /* TODO: release resource..*/ + /* TODO: release resource.. */ free(view); } static int -_mp_now_playing_list_view_init(Evas_Object *parent, MpNowPlayingListiew_t *view) +_mp_now_playing_list_view_init(Evas_Object * parent, + MpNowPlayingListiew_t * view) { startfunc; int ret = 0; - ret = mp_list_view_init(parent, (MpListView_t *)view, MP_VIEW_NOW_PLAYING_LIST); + ret = + mp_list_view_init(parent, (MpListView_t *) view, + MP_VIEW_NOW_PLAYING_LIST); MP_CHECK_VAL(ret == 0, -1); view->update = _mp_now_playing_list_view_update; view->update_options = _mp_now_playing_list_view_update_options; - view->update_options_edit = _mp_now_playing_list_view_update_options_edit; + view->update_options_edit = + _mp_now_playing_list_view_update_options_edit; view->view_destroy_cb = _mp_now_playing_list_view_destory_cb; view->now_playing_list_layout = view->layout; @@ -278,8 +332,8 @@ _mp_now_playing_list_view_init(Evas_Object *parent, MpNowPlayingListiew_t *view) } -MpNowPlayingListiew_t * -mp_now_playing_list_view_create(Evas_Object *parent) +MpNowPlayingListiew_t *mp_now_playing_list_view_create(Evas_Object * + parent) { startfunc; int ret; @@ -297,17 +351,15 @@ mp_now_playing_list_view_create(Evas_Object *parent) return view; -Error: + Error: ERROR_TRACE("Error: mp_now_playing_list_view_create()"); IF_FREE(view); return NULL; } -int -mp_now_playihng_list_view_destory(MpNowPlayingListiew_t *view) +int mp_now_playihng_list_view_destory(MpNowPlayingListiew_t * view) { MP_CHECK_VAL(view, -1); return 0; } - diff --git a/src/view/mp-player-view.c b/src/view/mp-player-view.c index fe8dede..81ec292 100644 --- a/src/view/mp-player-view.c +++ b/src/view/mp-player-view.c @@ -56,7 +56,7 @@ mp_assert(0); } \ } while (0); -#define NAVIFRAME_PLAYER_VIEW NULL /*"music/player_view"*/ +#define NAVIFRAME_PLAYER_VIEW NULL /*"music/player_view" */ #define PLAYER_VIEW_REW_SOURCE "control_previous" #define PLAYER_VIEW_FF_SOURCE "control_next" #define PLAYER_VIEW_DETAULT_ALBUM_IMAGE DEFAULT_PLAYER_THUMBNAIL @@ -69,7 +69,7 @@ #define PLAYER_VIEW_ZOOM_FROM 0.6 #define PLAYER_VIEW_ZOOM_TO 1.0 -#define PLAYER_VIEW_LONG_PRESS_TIME_INCREASE 1.0 /*sec*/ +#define PLAYER_VIEW_LONG_PRESS_TIME_INCREASE 1.0 /*sec */ #define ROTATE_TIMEOUT 0.2 #define MP_PORTRAIT_H 635 @@ -87,7 +87,7 @@ static bool _mp_player_view_init_progress_bar(void *data); static void _mp_player_view_volume_popup_hide(void *data); static bool _mp_player_view_show_lyric(void *data); static Eina_Bool _mp_player_view_update_progressbar_cb(void *data); -static void _mp_player_view_show_detail_view(MpPlayerView_t *view); +static void _mp_player_view_show_detail_view(MpPlayerView_t * view); void _mp_player_view_set_focused_UI(void *this); @@ -95,29 +95,37 @@ void _mp_player_view_set_focused_UI(void *this); static void _mp_player_view_set_queue_list_btn_icon(void *data); #endif -static Evas_Object *_mp_player_view_create_album_image(Evas_Object *obj, const char *path, int w, int h); -static void _mp_player_view_transit_by_item(void *data, int move_direction); +static Evas_Object *_mp_player_view_create_album_image(Evas_Object * obj, + const char *path, + int w, int h); +static void _mp_player_view_transit_by_item(void *data, + int move_direction); #ifndef MP_SOUND_PLAYER /* static void _mp_player_view_create_queue_list_btn(void *data);*/ static void _mp_player_view_update_control_queue_list_btn(void *data); -static void _mp_player_view_destroy_queue_list_transit_del_cb(void *data, Elm_Transit *transit) +static void _mp_player_view_destroy_queue_list_transit_del_cb(void *data, + Elm_Transit * + transit) { startfunc; - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); CHECK_VIEW(view); MP_CHECK(view->queue_list); view->queue_status = false; - Evas_Object *queue_title_list = elm_object_part_content_get(view->player_view_layout, "queue_list_area"); + Evas_Object *queue_title_list = + elm_object_part_content_get(view->player_view_layout, + "queue_list_area"); MP_CHECK(queue_title_list); - Evas_Object *layout = ((MpList_t *)view->queue_list)->layout; + Evas_Object *layout = ((MpList_t *) view->queue_list)->layout; MP_CHECK(layout); elm_object_part_content_unset(queue_title_list, "queue_list_content"); - elm_object_part_content_unset(view->player_view_layout, "queue_list_area"); + elm_object_part_content_unset(view->player_view_layout, + "queue_list_area"); evas_object_del(layout); evas_object_del(queue_title_list); @@ -127,22 +135,28 @@ static void _mp_player_view_destroy_queue_list_transit_del_cb(void *data, Elm_Tr _mp_player_view_update_control_queue_list_btn(view); } + static void _mp_player_view_destroy_queue_list(void *data) { startfunc; - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); CHECK_VIEW(view); MP_CHECK(view->queue_list); - Evas_Object *queue_title_list = elm_object_part_content_get(view->player_view_layout, "queue_list_area"); + Evas_Object *queue_title_list = + elm_object_part_content_get(view->player_view_layout, + "queue_list_area"); MP_CHECK(queue_title_list); int p_y, y, w, h; - evas_object_geometry_get(view->player_view_layout, NULL, &p_y, NULL, NULL); - edje_object_part_geometry_get(_EDJ(view->player_view_layout), "queue_list_area", NULL, &y, &w, &h); + evas_object_geometry_get(view->player_view_layout, NULL, &p_y, NULL, + NULL); + edje_object_part_geometry_get(_EDJ(view->player_view_layout), + "queue_list_area", NULL, &y, &w, &h); y += p_y; - edje_object_signal_emit(_EDJ(view->player_view_layout), "HIDE_QUEUE_LIST", "music_app"); + edje_object_signal_emit(_EDJ(view->player_view_layout), + "HIDE_QUEUE_LIST", "music_app"); Elm_Transit *trans; trans = elm_transit_add(); elm_transit_object_add(trans, queue_title_list); @@ -152,29 +166,33 @@ static void _mp_player_view_destroy_queue_list(void *data) elm_transit_duration_set(trans, PLAYER_VIEW_TRANSIT_INTERVAL); elm_transit_smooth_set(trans, EINA_FALSE); elm_transit_go(trans); - elm_transit_del_cb_set(trans, _mp_player_view_destroy_queue_list_transit_del_cb, data); + elm_transit_del_cb_set(trans, + _mp_player_view_destroy_queue_list_transit_del_cb, + data); view->trans_queue_list = trans; } -static Eina_Bool -_mp_player_view_queue_list_update_idler_cb(void *data) +static Eina_Bool _mp_player_view_queue_list_update_idler_cb(void *data) { - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK_FALSE(view); view->queue_list_update_idler = NULL; MP_CHECK_FALSE(view->queue_list); - mp_list_update((MpList_t *)view->queue_list); - mp_now_playing_list_current_item_show((MpNowPlayingList_t *)view->queue_list); + mp_list_update((MpList_t *) view->queue_list); + mp_now_playing_list_current_item_show((MpNowPlayingList_t *) view-> + queue_list); return ECORE_CALLBACK_DONE; } -static void _mp_player_view_create_queue_list_transit_del_cb(void *data, Elm_Transit *transit) +static void _mp_player_view_create_queue_list_transit_del_cb(void *data, + Elm_Transit * + transit) { startfunc; - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); CHECK_VIEW(view); @@ -182,19 +200,23 @@ static void _mp_player_view_create_queue_list_transit_del_cb(void *data, Elm_Tra mp_ecore_idler_del(view->queue_list_update_idler); - view->queue_list_update_idler = ecore_idler_add(_mp_player_view_queue_list_update_idler_cb, view); + view->queue_list_update_idler = + ecore_idler_add(_mp_player_view_queue_list_update_idler_cb, view); } static Eina_Bool _mp_player_view_queue_list_show_title_idler(void *data) { startfunc; - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK_FALSE(view); MP_CHECK_FALSE(view->player_view_layout); - Evas_Object *queue_title_list = elm_object_part_content_get(view->player_view_layout, "queue_list_area"); + Evas_Object *queue_title_list = + elm_object_part_content_get(view->player_view_layout, + "queue_list_area"); MP_CHECK_FALSE(queue_title_list); - edje_object_signal_emit(_EDJ(queue_title_list), "SHOW_QUEUE_TITLE", "music_app"); + edje_object_signal_emit(_EDJ(queue_title_list), "SHOW_QUEUE_TITLE", + "music_app"); view->queue_title_idler = NULL; return ECORE_CALLBACK_DONE; @@ -203,20 +225,25 @@ static Eina_Bool _mp_player_view_queue_list_show_title_idler(void *data) static void _mp_player_view_create_queue_list_transit(void *data) { startfunc; - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); CHECK_VIEW(view); mp_ecore_idler_del(view->queue_list_update_idler); - Evas_Object *queue_title_list = elm_object_part_content_get(view->player_view_layout, "queue_list_area"); + Evas_Object *queue_title_list = + elm_object_part_content_get(view->player_view_layout, + "queue_list_area"); MP_CHECK(queue_title_list); - /*hide temporarily to avoid title blink when zooming, show title in idler*/ - edje_object_signal_emit(_EDJ(queue_title_list), "HIDE_QUEUE_TITLE", "music_app"); + /*hide temporarily to avoid title blink when zooming, show title in idler */ + edje_object_signal_emit(_EDJ(queue_title_list), "HIDE_QUEUE_TITLE", + "music_app"); int p_y, y, w, h; - evas_object_geometry_get(view->player_view_layout, NULL, &p_y, NULL, NULL); - edje_object_part_geometry_get(_EDJ(view->player_view_layout), "queue_list_area", NULL, &y, &w, &h); + evas_object_geometry_get(view->player_view_layout, NULL, &p_y, NULL, + NULL); + edje_object_part_geometry_get(_EDJ(view->player_view_layout), + "queue_list_area", NULL, &y, &w, &h); y += p_y; Elm_Transit *trans; @@ -228,13 +255,17 @@ static void _mp_player_view_create_queue_list_transit(void *data) elm_transit_duration_set(trans, PLAYER_VIEW_TRANSIT_INTERVAL); elm_transit_smooth_set(trans, EINA_TRUE); elm_transit_go(trans); - elm_transit_del_cb_set(trans, _mp_player_view_create_queue_list_transit_del_cb, data); + elm_transit_del_cb_set(trans, + _mp_player_view_create_queue_list_transit_del_cb, + data); view->trans_queue_list = trans; - view->queue_title_idler = ecore_idler_add(_mp_player_view_queue_list_show_title_idler, view); + view->queue_title_idler = + ecore_idler_add(_mp_player_view_queue_list_show_title_idler, view); } -static void _mp_player_view_refresh_current_count_info(Evas_Object *layout) +static void _mp_player_view_refresh_current_count_info(Evas_Object * + layout) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); @@ -252,72 +283,93 @@ static void _mp_player_view_refresh_current_count_info(Evas_Object *layout) str_count = g_strdup_printf(GET_STR(STR_MP_PD_SONGS), track_count); } - str_current = g_strdup_printf("%d / %d", (current_index + 1), track_count); + str_current = + g_strdup_printf("%d / %d", (current_index + 1), track_count); elm_object_part_text_set(layout, "track_count", str_current); elm_object_part_text_set(layout, "track_current", str_count); IF_FREE(str_count); IF_FREE(str_current); - return ; + return; } static void _mp_player_view_refresh_queue_list(void *data) { startfunc; - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); CHECK_VIEW(view); MP_CHECK(view->player_view_layout); Evas_Object *queue_title_list = NULL; if (!view->queue_list) { - queue_title_list = mp_common_load_edj(view->player_view_layout, PLAY_VIEW_EDJ_NAME, "queue_title_list"); + queue_title_list = + mp_common_load_edj(view->player_view_layout, + PLAY_VIEW_EDJ_NAME, "queue_title_list"); MP_CHECK(queue_title_list); - MpNowPlayingList_t *list = mp_now_playing_list_create(view->player_view_layout); + MpNowPlayingList_t *list = + mp_now_playing_list_create(view->player_view_layout); MP_CHECK(list); - mp_now_playing_list_set_data(list, MP_NOW_PLAYING_LIST_ATTR_HIGHLIGHT_CURRENT, true, -1); - view->queue_list = (void *)list; - elm_object_part_content_set(queue_title_list, "queue_list_content", ((MpList_t *)view->queue_list)->layout); - elm_object_part_content_set(view->player_view_layout, "queue_list_area", queue_title_list); - evas_object_show(((MpList_t *)view->queue_list)->layout); - mp_list_update((MpList_t *)view->queue_list); - mp_now_playing_list_current_item_show((MpNowPlayingList_t *)view->queue_list); + mp_now_playing_list_set_data(list, + MP_NOW_PLAYING_LIST_ATTR_HIGHLIGHT_CURRENT, + true, -1); + view->queue_list = (void *) list; + elm_object_part_content_set(queue_title_list, "queue_list_content", + ((MpList_t *) view->queue_list)-> + layout); + elm_object_part_content_set(view->player_view_layout, + "queue_list_area", queue_title_list); + evas_object_show(((MpList_t *) view->queue_list)->layout); + mp_list_update((MpList_t *) view->queue_list); + mp_now_playing_list_current_item_show((MpNowPlayingList_t *) view-> + queue_list); } else { - queue_title_list = elm_object_part_content_get(view->player_view_layout, "queue_list_area"); + queue_title_list = + elm_object_part_content_get(view->player_view_layout, + "queue_list_area"); MP_CHECK(queue_title_list); } view->queue_status = true; _mp_player_view_set_queue_list_btn_icon(view); _mp_player_view_refresh_current_count_info(queue_title_list); - edje_object_signal_emit(_EDJ(view->player_view_layout), "SHOW_QUEUE_LIST", "music_app"); + edje_object_signal_emit(_EDJ(view->player_view_layout), + "SHOW_QUEUE_LIST", "music_app"); endfunc; } static void _mp_player_view_create_queue_list(void *data) { startfunc; - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); CHECK_VIEW(view); MP_CHECK(view->player_view_layout); - Evas_Object *queue_title_list = mp_common_load_edj(view->player_view_layout, PLAY_VIEW_EDJ_NAME, "queue_title_list"); + Evas_Object *queue_title_list = + mp_common_load_edj(view->player_view_layout, PLAY_VIEW_EDJ_NAME, + "queue_title_list"); MP_CHECK(queue_title_list); if (!view->queue_list) { - MpNowPlayingList_t *list = mp_now_playing_list_create(view->player_view_layout); + MpNowPlayingList_t *list = + mp_now_playing_list_create(view->player_view_layout); MP_CHECK(list); - mp_now_playing_list_set_data(list, MP_NOW_PLAYING_LIST_ATTR_HIGHLIGHT_CURRENT, true, -1); - view->queue_list = (void *)list; + mp_now_playing_list_set_data(list, + MP_NOW_PLAYING_LIST_ATTR_HIGHLIGHT_CURRENT, + true, -1); + view->queue_list = (void *) list; } view->queue_status = true; - elm_object_part_content_set(queue_title_list, "queue_list_content", ((MpList_t *)view->queue_list)->layout); - elm_object_part_content_set(view->player_view_layout, "queue_list_area", queue_title_list); + elm_object_part_content_set(queue_title_list, "queue_list_content", + ((MpList_t *) view->queue_list)->layout); + elm_object_part_content_set(view->player_view_layout, + "queue_list_area", queue_title_list); _mp_player_view_refresh_current_count_info(queue_title_list); - evas_object_show(((MpList_t *)view->queue_list)->layout); - /*mp_list_update((MpList_t *)view->queue_list);*/ - edje_object_signal_emit(_EDJ(view->player_view_layout), "SHOW_QUEUE_LIST", "music_app"); - /*mp_now_playing_list_current_item_show((MpNowPlayingList_t *)view->queue_list);*/ + evas_object_show(((MpList_t *) view->queue_list)->layout); + /*mp_list_update((MpList_t *)view->queue_list); */ + edje_object_signal_emit(_EDJ(view->player_view_layout), + "SHOW_QUEUE_LIST", "music_app"); + /*mp_now_playing_list_current_item_show((MpNowPlayingList_t *)view->queue_list); */ _mp_player_view_create_queue_list_transit(view); @@ -327,36 +379,42 @@ static void _mp_player_view_create_queue_list(void *data) static void _mp_player_view_set_queue_list_btn_icon(void *data) { startfunc; - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; const char *path = NULL; const char *group = NULL; MP_CHECK(view); CHECK_VIEW(view); - MP_CHECK(view->option_button[OPTION_QUEUE]);/*view->queue_button*/ + MP_CHECK(view->option_button[OPTION_QUEUE]); /*view->queue_button */ MP_CHECK(view->queue_list); struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); - Evas_Object *image = elm_object_part_content_get(view->option_button[OPTION_QUEUE], "icon");/*view->queue_button*/ - elm_object_style_set(view->option_button[OPTION_QUEUE], "music/control_queue_thumbnail"); + Evas_Object *image = elm_object_part_content_get(view->option_button[OPTION_QUEUE], "icon"); /*view->queue_button */ + elm_object_style_set(view->option_button[OPTION_QUEUE], + "music/control_queue_thumbnail"); MP_CHECK(image); elm_image_fill_outside_set(image, EINA_TRUE); elm_image_file_get(image, &path, &group); - char default_thumbnail[1024] = {0}; + char default_thumbnail[1024] = { 0 }; char *shared_path = app_get_shared_resource_path(); - snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, "shared_images", PLAYER_VIEW_DETAULT_ALBUM_IMAGE); + snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, + "shared_images", PLAYER_VIEW_DETAULT_ALBUM_IMAGE); free(shared_path); if (ad->current_track_info && mp_util_is_image_valid(ad->evas, - ad->current_track_info->thumbnail_path) && strcmp(ad->current_track_info->thumbnail_path, - BROKEN_ALBUMART_IMAGE_PATH)) { + ad-> + current_track_info-> + thumbnail_path) + && strcmp(ad->current_track_info->thumbnail_path, + BROKEN_ALBUMART_IMAGE_PATH)) { if (!g_strcmp0(path, ad->current_track_info->thumbnail_path)) { return; } - elm_image_file_set(image, ad->current_track_info->thumbnail_path, NULL); + elm_image_file_set(image, ad->current_track_info->thumbnail_path, + NULL); } else { if (!g_strcmp0(path, default_thumbnail)) { return; @@ -366,19 +424,21 @@ static void _mp_player_view_set_queue_list_btn_icon(void *data) endfunc; } + static void _mp_player_view_update_control_queue_list_btn(void *data) { startfunc; - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); CHECK_VIEW(view); MP_CHECK(view->navi_it); struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); - Evas_Object *image = elm_object_content_get(view->option_button[OPTION_QUEUE]); + Evas_Object *image = + elm_object_content_get(view->option_button[OPTION_QUEUE]); - char mp_image_path[1024] = {0}; + char mp_image_path[1024] = { 0 }; char *path = app_get_resource_path(); if (path == NULL) { return; @@ -389,31 +449,43 @@ static void _mp_player_view_update_control_queue_list_btn(void *data) if (view->queue_list) { DEBUG_TRACE("queue list create"); - elm_object_style_set(view->option_button[OPTION_QUEUE], "music/control_queue_thumbnail"); - if (ad->current_track_info && mp_util_is_image_valid(ad->evas, - ad->current_track_info->thumbnail_path) && strcmp(ad->current_track_info->thumbnail_path, - BROKEN_ALBUMART_IMAGE_PATH)) { - elm_image_file_set(image, ad->current_track_info->thumbnail_path, NULL); + elm_object_style_set(view->option_button[OPTION_QUEUE], + "music/control_queue_thumbnail"); + if (ad->current_track_info + && mp_util_is_image_valid(ad->evas, + ad->current_track_info-> + thumbnail_path) + && strcmp(ad->current_track_info->thumbnail_path, + BROKEN_ALBUMART_IMAGE_PATH)) { + elm_image_file_set(image, + ad->current_track_info->thumbnail_path, + NULL); } else { - char default_thumbnail[1024] = {0}; + char default_thumbnail[1024] = { 0 }; char *shared_path = app_get_shared_resource_path(); - snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, "shared_images", PLAYER_VIEW_DETAULT_ALBUM_IMAGE); + snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, + "shared_images", PLAYER_VIEW_DETAULT_ALBUM_IMAGE); free(shared_path); elm_image_file_set(image, default_thumbnail, NULL); } elm_image_fill_outside_set(image, EINA_TRUE); } else { DEBUG_TRACE("no queue list"); - elm_object_style_set(view->option_button[OPTION_QUEUE], "music/control_queue"); + elm_object_style_set(view->option_button[OPTION_QUEUE], + "music/control_queue"); elm_image_file_set(image, mp_image_path, MP_ICON_PLAY_LIST_PATH); } endfunc; } -static void _mp_player_view_control_queue_list_btn_clicked(void *data, Evas_Object *obj, void *event_info) +static void _mp_player_view_control_queue_list_btn_clicked(void *data, + Evas_Object * + obj, + void + *event_info) { startfunc; - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); CHECK_VIEW(view); MP_CHECK(!view->trans_queue_list); @@ -428,7 +500,15 @@ static void _mp_player_view_control_queue_list_btn_clicked(void *data, Evas_Obje endfunc; } -Evas_Object *_mp_player_view_create_control_queue_icon_btn(Evas_Object *parent, const char *file, const char *group, Evas_Smart_Cb func, void *data) +Evas_Object *_mp_player_view_create_control_queue_icon_btn(Evas_Object * + parent, + const char + *file, + const char + *group, + Evas_Smart_Cb + func, + void *data) { Evas_Object *ic; Evas_Object *btn = elm_button_add(parent); @@ -438,7 +518,7 @@ Evas_Object *_mp_player_view_create_control_queue_icon_btn(Evas_Object *parent, elm_object_style_set(btn, "music/control_queue"); ic = elm_icon_add(parent); - char mp_image_path[1024] = {0}; + char mp_image_path[1024] = { 0 }; char *path = app_get_resource_path(); if (path == NULL) { return NULL; @@ -448,7 +528,8 @@ Evas_Object *_mp_player_view_create_control_queue_icon_btn(Evas_Object *parent, free(path); elm_image_file_set(ic, mp_image_path, group); - evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, + 1); elm_image_resizable_set(ic, EINA_TRUE, EINA_TRUE); elm_object_content_set(btn, ic); @@ -461,20 +542,27 @@ Evas_Object *_mp_player_view_create_control_queue_icon_btn(Evas_Object *parent, static void _mp_player_view_create_control_queue_btn(void *data) { startfunc; - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); MP_CHECK(view->layout); - view->option_button[OPTION_QUEUE] = _mp_player_view_create_control_queue_icon_btn(view->player_view_option_layout, - IMAGE_EDJ_NAME, - MP_ICON_PLAY_LIST_PATH, - _mp_player_view_control_queue_list_btn_clicked, - view); + view->option_button[OPTION_QUEUE] = + _mp_player_view_create_control_queue_icon_btn(view-> + player_view_option_layout, + IMAGE_EDJ_NAME, + MP_ICON_PLAY_LIST_PATH, + _mp_player_view_control_queue_list_btn_clicked, + view); MP_CHECK(view->option_button[OPTION_QUEUE]); evas_object_show(view->option_button[OPTION_QUEUE]); - elm_object_part_content_set(view->player_view_option_layout, "options_queue", view->option_button[OPTION_QUEUE]); - - mp_util_domain_translatable_part_text_set(view->player_view_option_layout, "queue_text", STR_PLAYER_VIEW_QUEUE); + elm_object_part_content_set(view->player_view_option_layout, + "options_queue", + view->option_button[OPTION_QUEUE]); + + mp_util_domain_translatable_part_text_set(view-> + player_view_option_layout, + "queue_text", + STR_PLAYER_VIEW_QUEUE); endfunc; } #endif @@ -503,12 +591,13 @@ void mp_player_view_set_snd_path_sensitivity(void *data) CHECK_VIEW(view); if (view->snd_button) { - elm_object_item_part_content_unset(view->inner_navi_it, "title_right_btn"); + elm_object_item_part_content_unset(view->inner_navi_it, + "title_right_btn"); mp_evas_object_del(view->snd_button); } view->available_route = 0; - view->available_route_count = 1; /*speaker or headphone */ + view->available_route_count = 1; /*speaker or headphone */ WARN_TRACE("Enter sound_manager_foreach_available_route"); sound_device_h device; @@ -517,7 +606,9 @@ void mp_player_view_set_snd_path_sensitivity(void *data) sound_device_mask_e g_device_mask = SOUND_DEVICE_IO_DIRECTION_OUT_MASK; WARN_TRACE("Enter sound_manager_get_active_device"); int ret; - if ((ret = sound_manager_get_current_device_list(g_device_mask, &g_device_list))) { + if ((ret = + sound_manager_get_current_device_list(g_device_mask, + &g_device_list))) { ERROR_TRACE("sound_manager_get_active_device()... [0x%x]", ret); } @@ -570,14 +661,15 @@ void mp_player_view_set_snd_path_sensitivity(void *data) DEBUG_TRACE("snd_path=%d", snd_path); MP_CHECK(view->snd_button); evas_object_show(view->snd_button); - elm_object_item_part_content_set(view->inner_navi_it, "title_right_btn", view->snd_button); + elm_object_item_part_content_set(view->inner_navi_it, + "title_right_btn", view->snd_button); _mp_player_view_update_snd_button_state(view); } + /*Replaced for _prod dependency end*/ #ifndef MP_SOUND_PLAYER -static char * -_mp_player_view_get_fid_by_handle(mp_media_info_h record) +static char *_mp_player_view_get_fid_by_handle(mp_media_info_h record) { MP_CHECK_NULL(record); @@ -589,29 +681,35 @@ _mp_player_view_get_fid_by_handle(mp_media_info_h record) } static void -_mp_player_view_add_playlist_create_select_cb(void *data, Evas_Object * obj, void *event_info) +_mp_player_view_add_playlist_create_select_cb(void *data, + Evas_Object * obj, + void *event_info) { startfunc; - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); CHECK_VIEW(view); mp_evas_object_del(obj); - int response = (int)event_info; + int response = (int) event_info; MP_CHECK(response); - Mp_Playlist_Data *mp_playlist_data = mp_edit_playlist_create(MP_PLST_CREATE); + Mp_Playlist_Data *mp_playlist_data = + mp_edit_playlist_create(MP_PLST_CREATE); MP_CHECK(mp_playlist_data); - mp_edit_playlist_set_media_id(mp_playlist_data, _mp_player_view_get_fid_by_handle(view->add_to_plst_handle)); + mp_edit_playlist_set_media_id(mp_playlist_data, + _mp_player_view_get_fid_by_handle(view-> + add_to_plst_handle)); mp_edit_playlist_content_create(mp_playlist_data); endfunc; } static void -_mp_player_view_add_playlist_select_cb(void *data, Evas_Object * obj, void *event_info) +_mp_player_view_add_playlist_select_cb(void *data, Evas_Object * obj, + void *event_info) { EVENT_TRACE(); struct appdata *ad = mp_util_get_appdata(); @@ -634,12 +732,15 @@ _mp_player_view_add_playlist_select_cb(void *data, Evas_Object * obj, void *even ret = mp_media_info_group_get_main_info(plst, &playlist_name); ret = mp_media_info_group_get_playlist_id(plst, &playlist_id); - mp_media_info_list_count(MP_TRACK_BY_PLAYLIST, NULL, NULL, NULL, playlist_id, &item_count); + mp_media_info_list_count(MP_TRACK_BY_PLAYLIST, NULL, NULL, NULL, + playlist_id, &item_count); #ifdef MP_PLAYLIST_MAX_ITEM_COUNT if (item_count > MP_PLAYLIST_MAX_ITEM_COUNT) { - char *fmt_str = GET_STR("IDS_MUSIC_POP_UNABLE_TO_ADD_MORE_THAN_PD_MUSIC_FILE"); - char *noti_str = g_strdup_printf(fmt_str, MP_PLAYLIST_MAX_ITEM_COUNT); + char *fmt_str = + GET_STR("IDS_MUSIC_POP_UNABLE_TO_ADD_MORE_THAN_PD_MUSIC_FILE"); + char *noti_str = + g_strdup_printf(fmt_str, MP_PLAYLIST_MAX_ITEM_COUNT); mp_util_post_status_message(ad, noti_str); IF_FREE(noti_str); goto END; @@ -657,8 +758,10 @@ _mp_player_view_add_playlist_select_cb(void *data, Evas_Object * obj, void *even mp_debug("sucess add to play list"); MpView_t *view = NULL; - view = (MpView_t *)mp_playlist_detail_view_create(GET_NAVIFRAME, - MP_TRACK_BY_PLAYLIST, playlist_name, playlist_id); + view = (MpView_t *) mp_playlist_detail_view_create(GET_NAVIFRAME, + MP_TRACK_BY_PLAYLIST, + playlist_name, + playlist_id); mp_view_mgr_push_view(GET_VIEW_MGR, view, NULL); mp_view_update_options(view); mp_view_set_title(view, playlist_name); @@ -667,34 +770,41 @@ _mp_player_view_add_playlist_select_cb(void *data, Evas_Object * obj, void *even } else { mp_debug("fail add to play list"); #ifdef MP_PLAYLIST_MAX_ITEM_COUNT - char *fmt_str = GET_STR("IDS_MUSIC_POP_UNABLE_TO_ADD_MORE_THAN_PD_MUSIC_FILE"); - char *noti_str = g_strdup_printf(fmt_str, MP_PLAYLIST_MAX_ITEM_COUNT); + char *fmt_str = + GET_STR("IDS_MUSIC_POP_UNABLE_TO_ADD_MORE_THAN_PD_MUSIC_FILE"); + char *noti_str = + g_strdup_printf(fmt_str, MP_PLAYLIST_MAX_ITEM_COUNT); mp_util_post_status_message(ad, noti_str); IF_FREE(noti_str); #else - mp_util_post_status_message(ad, GET_STR("IDS_MUSIC_POP_UNABLE_TO_ADD")); + mp_util_post_status_message(ad, + GET_STR + ("IDS_MUSIC_POP_UNABLE_TO_ADD")); #endif } #ifdef MP_PLAYLIST_MAX_ITEM_COUNT -END: + END: #endif mp_popup_destroy(ad); return; } -static void _mp_player_view_popup_del_cb(void *data, Evas * e, Evas_Object * eo, void *event_info) +static void _mp_player_view_popup_del_cb(void *data, Evas * e, + Evas_Object * eo, + void *event_info) { mp_media_list_h list = data; mp_media_info_group_list_destroy(list); } -static void _ctxpopup_add_to_playlist_cb(void *data, Evas_Object *obj, void *event_info) +static void _ctxpopup_add_to_playlist_cb(void *data, Evas_Object * obj, + void *event_info) { EVENT_TRACE(); - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); CHECK_VIEW(view); mp_evas_object_del(view->more_btn_ctxpopup); @@ -722,10 +832,14 @@ static void _ctxpopup_add_to_playlist_cb(void *data, Evas_Object *obj, void *eve int ret = 0; int i = 0, count = -1, err = -1; - /*mp_genlist_popup_item_append(popup, GET_STR("IDS_MUSIC_OPT_CREATE_PLAYLIST"), NULL, NULL, NULL, _mp_player_view_add_playlist_create_select_cb, handle);*/ - mp_popup_response_callback_set(popup, _mp_player_view_add_playlist_create_select_cb, view); + /*mp_genlist_popup_item_append(popup, GET_STR("IDS_MUSIC_OPT_CREATE_PLAYLIST"), NULL, NULL, NULL, _mp_player_view_add_playlist_create_select_cb, handle); */ + mp_popup_response_callback_set(popup, + _mp_player_view_add_playlist_create_select_cb, + view); - err = mp_media_info_group_list_count(MP_GROUP_BY_PLAYLIST, NULL, NULL, &count); + err = + mp_media_info_group_list_count(MP_GROUP_BY_PLAYLIST, NULL, NULL, + &count); if ((err != 0) || (count < 0)) { ERROR_TRACE("Error in mp_media_info_group_list_count (%d)\n", err); @@ -733,11 +847,16 @@ static void _ctxpopup_add_to_playlist_cb(void *data, Evas_Object *obj, void *eve } if (count) { - mp_media_list_h playlists = NULL; /*must be free*/ + mp_media_list_h playlists = NULL; /*must be free */ - ret = mp_media_info_group_list_create(&playlists, MP_GROUP_BY_PLAYLIST, NULL, NULL, 0, count); + ret = + mp_media_info_group_list_create(&playlists, + MP_GROUP_BY_PLAYLIST, NULL, + NULL, 0, count); mp_retm_if(ret != 0, "Fail to get playlist"); - evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, _mp_player_view_popup_del_cb, playlists); + evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, + _mp_player_view_popup_del_cb, + playlists); for (i = 0; i < count; i++) { /* it should be released in a proper place */ @@ -750,13 +869,17 @@ static void _ctxpopup_add_to_playlist_cb(void *data, Evas_Object *obj, void *eve mp_retm_if(ret != 0, "Fail to get value"); mp_genlist_popup_item_append(popup, name, NULL, NULL, plst, - _mp_player_view_add_playlist_select_cb, - handle); + _mp_player_view_add_playlist_select_cb, + handle); } } else { - Elm_Object_Item *it = mp_genlist_popup_item_append(popup, GET_STR(STR_MP_NO_PLAYLISTS), NULL, NULL, NULL, NULL, ad); - elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + Elm_Object_Item *it = + mp_genlist_popup_item_append(popup, + GET_STR(STR_MP_NO_PLAYLISTS), + NULL, NULL, NULL, NULL, ad); + elm_genlist_item_select_mode_set(it, + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); } evas_object_show(popup); @@ -765,10 +888,11 @@ static void _ctxpopup_add_to_playlist_cb(void *data, Evas_Object *obj, void *eve } #endif -static void _ctxpopup_detail_cb(void *data, Evas_Object *obj, void *event_info) +static void _ctxpopup_detail_cb(void *data, Evas_Object * obj, + void *event_info) { EVENT_TRACE(); - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); CHECK_VIEW(view); mp_evas_object_del(view->more_btn_ctxpopup); @@ -779,10 +903,11 @@ static void _ctxpopup_detail_cb(void *data, Evas_Object *obj, void *event_info) #ifndef MP_SOUND_PLAYER -static void _ctxpopup_setting_cb(void *data, Evas_Object *obj, void *event_info) +static void _ctxpopup_setting_cb(void *data, Evas_Object * obj, + void *event_info) { EVENT_TRACE(); - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); CHECK_VIEW(view); mp_evas_object_del(view->more_btn_ctxpopup); @@ -791,7 +916,9 @@ static void _ctxpopup_setting_cb(void *data, Evas_Object *obj, void *event_info) mp_music_viewas_pop_cb(); } -static void _mp_player_view_queue_add_to_playlist_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_player_view_queue_add_to_playlist_cb(void *data, + Evas_Object * obj, + void *event_info) { eventfunc; @@ -801,25 +928,30 @@ static void _mp_player_view_queue_add_to_playlist_cb(void *data, Evas_Object *ob mp_evas_object_del(view->more_btn_ctxpopup); #ifdef MP_FEATURE_PERSONAL_PAGE - MpEditView_t *edit_view = mp_edit_view_create(GET_NAVIFRAME, (MpList_t *)(view->queue_list), false, - MP_EDIT_VIEW_PERSONAL_PAGE_NONE); + MpEditView_t *edit_view = + mp_edit_view_create(GET_NAVIFRAME, (MpList_t *) (view->queue_list), + false, + MP_EDIT_VIEW_PERSONAL_PAGE_NONE); if (edit_view == NULL) { return; } #else - MpEditView_t *edit_view = mp_edit_view_create(GET_NAVIFRAME, (MpList_t *)(view->queue_list), false); + MpEditView_t *edit_view = + mp_edit_view_create(GET_NAVIFRAME, (MpList_t *) (view->queue_list), + false); #endif MP_CHECK(edit_view); edit_view->list_mode = MP_EDIT_VIEW_EDIT; edit_view->content_to_show->reorderable = 0; edit_view->create_playlist = true; - mp_view_mgr_push_view(GET_VIEW_MGR, (MpView_t *)edit_view, NULL); - mp_view_update((MpView_t *)edit_view); - mp_view_update_options((MpView_t *)edit_view); - mp_view_set_title((MpView_t *)edit_view, STR_MP_TILTE_SELECT_ITEM); - mp_list_view_set_select_all((MpListView_t *)edit_view, true); - mp_list_view_set_done_btn((MpListView_t *)edit_view, true, MP_DONE_ADD_TO_TYPE); - mp_list_view_set_cancel_btn((MpListView_t *)edit_view, true); + mp_view_mgr_push_view(GET_VIEW_MGR, (MpView_t *) edit_view, NULL); + mp_view_update((MpView_t *) edit_view); + mp_view_update_options((MpView_t *) edit_view); + mp_view_set_title((MpView_t *) edit_view, STR_MP_TILTE_SELECT_ITEM); + mp_list_view_set_select_all((MpListView_t *) edit_view, true); + mp_list_view_set_done_btn((MpListView_t *) edit_view, true, + MP_DONE_ADD_TO_TYPE); + mp_list_view_set_cancel_btn((MpListView_t *) edit_view, true); } /*static void _mp_player_view_queue_save_as_to_playlist_cb(void *data, Evas_Object *obj, void *event_info) @@ -855,81 +987,103 @@ _append_group_play_option(MpPlayerView_t *view, mp_track_info_t *track_info, boo }*/ static void -_mp_player_view_add_cover_view_options(MpPlayerView_t *view, mp_track_info_t *track_info, bool playable) +_mp_player_view_add_cover_view_options(MpPlayerView_t * view, + mp_track_info_t * track_info, + bool playable) { - /*enable set as only it's local file*/ + /*enable set as only it's local file */ /*_append_set_as_option(view, track_info, playable); _append_group_play_option(view, track_info, playable);*/ mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_ADD_TO_PLAYLIST, MP_PLAYER_MORE_BTN_ADD_TO_PLAYLSIT_IMAGE, _ctxpopup_add_to_playlist_cb, view); + STR_MP_ADD_TO_PLAYLIST, + MP_PLAYER_MORE_BTN_ADD_TO_PLAYLSIT_IMAGE, + _ctxpopup_add_to_playlist_cb, view); mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_DELETE, MP_PLAYER_MORE_BTN_DELETE_IMAGE, mp_common_track_delete_cb, view); + STR_MP_DELETE, + MP_PLAYER_MORE_BTN_DELETE_IMAGE, + mp_common_track_delete_cb, view); mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_DETAILS, MP_PLAYER_MORE_BTN_DETAIL_IMAGE, _ctxpopup_detail_cb, view); + STR_MP_DETAILS, + MP_PLAYER_MORE_BTN_DETAIL_IMAGE, + _ctxpopup_detail_cb, view); mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_SHOW_LYRICS, MP_PLAYER_MORE_BTN_SETTING, _ctxpopup_setting_cb, view); + STR_MP_SHOW_LYRICS, + MP_PLAYER_MORE_BTN_SETTING, + _ctxpopup_setting_cb, view); #ifndef MP_FEATURE_NO_END - /*End*/ + /*End */ mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_END, MP_PLAYER_MORE_BTN_VIEW_END, mp_common_ctxpopup_end_cb, view); + STR_MP_END, MP_PLAYER_MORE_BTN_VIEW_END, + mp_common_ctxpopup_end_cb, view); #endif } -static void -_mp_player_view_add_radio_view_options(MpPlayerView_t *view) +static void _mp_player_view_add_radio_view_options(MpPlayerView_t * view) { mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_DETAILS, MP_PLAYER_MORE_BTN_CONN_INFO, _ctxpopup_detail_cb, view); + STR_MP_DETAILS, + MP_PLAYER_MORE_BTN_CONN_INFO, + _ctxpopup_detail_cb, view); /*mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_SETTINGS, MP_PLAYER_MORE_BTN_SETTING, _ctxpopup_setting_cb, view);*/ + STR_MP_SETTINGS, MP_PLAYER_MORE_BTN_SETTING, _ctxpopup_setting_cb, view); */ } -static void -_mp_player_view_add_artist_view_options(MpPlayerView_t *view) +static void _mp_player_view_add_artist_view_options(MpPlayerView_t * view) { /*mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_SETTINGS, MP_PLAYER_MORE_BTN_SETTING, _ctxpopup_setting_cb, view);*/ + STR_MP_SETTINGS, MP_PLAYER_MORE_BTN_SETTING, _ctxpopup_setting_cb, view); */ } static void -_mp_player_view_add_queue_list_options(MpPlayerView_t *view, bool playable) +_mp_player_view_add_queue_list_options(MpPlayerView_t * view, + bool playable) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); mp_track_info_t *track_info = ad->current_track_info; MP_CHECK(track_info); - if (mp_list_get_editable_count((MpList_t *)view->queue_list, MP_LIST_EDIT_TYPE_NORMAL)) { + if (mp_list_get_editable_count + ((MpList_t *) view->queue_list, MP_LIST_EDIT_TYPE_NORMAL)) { mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_ADD_TO_PLAYLIST, MP_PLAYER_MORE_BTN_ADD_TO_PLAYLSIT_IMAGE, _mp_player_view_queue_add_to_playlist_cb, view); + STR_MP_ADD_TO_PLAYLIST, + MP_PLAYER_MORE_BTN_ADD_TO_PLAYLSIT_IMAGE, + _mp_player_view_queue_add_to_playlist_cb, + view); } /*_append_group_play_option(view, track_info, playable);*/ mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_DELETE, MP_PLAYER_MORE_BTN_DELETE_IMAGE, mp_common_track_delete_cb, view); + STR_MP_DELETE, + MP_PLAYER_MORE_BTN_DELETE_IMAGE, + mp_common_track_delete_cb, view); mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_DETAILS, MP_PLAYER_MORE_BTN_CONN_INFO, _ctxpopup_detail_cb, view); + STR_MP_DETAILS, + MP_PLAYER_MORE_BTN_CONN_INFO, + _ctxpopup_detail_cb, view); /*mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_SETTINGS, MP_PLAYER_MORE_BTN_SETTING, _ctxpopup_setting_cb, view);*/ + STR_MP_SETTINGS, MP_PLAYER_MORE_BTN_SETTING, _ctxpopup_setting_cb, view); */ #ifndef MP_FEATURE_NO_END mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_END, MP_PLAYER_MORE_BTN_VIEW_END, mp_common_ctxpopup_end_cb, view); + STR_MP_END, MP_PLAYER_MORE_BTN_VIEW_END, + mp_common_ctxpopup_end_cb, view); #endif } #endif -void _mp_player_view_ctxpopup_end_cb(void *data, Evas_Object *obj, void *event_info) +void _mp_player_view_ctxpopup_end_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; MP_CHECK(data); @@ -939,10 +1093,12 @@ void _mp_player_view_ctxpopup_end_cb(void *data, Evas_Object *obj, void *event_i elm_exit(); } -static void _mp_player_view_more_button_clicked_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_player_view_more_button_clicked_cb(void *data, + Evas_Object * obj, + void *event_info) { startfunc; - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); CHECK_VIEW(view); @@ -960,16 +1116,17 @@ static void _mp_player_view_more_button_clicked_cb(void *data, Evas_Object *obj, #ifndef MP_SOUND_PLAYER - /*music player more option*/ + /*music player more option */ bool playable = mp_util_file_playable(track_info->uri); if (view->queue_list) { _mp_player_view_add_queue_list_options(view, playable); } else { if (view->launch_type == MP_PLAYER_NORMAL) { - _mp_player_view_add_cover_view_options(view, track_info, playable); - } else if (view->launch_type == MP_PLAYER_RADIO_PLAY) { + _mp_player_view_add_cover_view_options(view, track_info, + playable); + } else if (view->launch_type == MP_PLAYER_RADIO_PLAY) { _mp_player_view_add_radio_view_options(view); - } else if (view->launch_type == MP_PLAYER_ARTIST_PLAY) { + } else if (view->launch_type == MP_PLAYER_ARTIST_PLAY) { _mp_player_view_add_artist_view_options(view); } } @@ -978,12 +1135,15 @@ static void _mp_player_view_more_button_clicked_cb(void *data, Evas_Object *obj, if (!ad->samsung_link) { mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_DETAILS, MP_PLAYER_MORE_BTN_CONN_INFO, _ctxpopup_detail_cb, view); + STR_MP_DETAILS, + MP_PLAYER_MORE_BTN_CONN_INFO, + _ctxpopup_detail_cb, view); count++; } #ifndef MP_FEATURE_NO_END mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_END, MP_PLAYER_MORE_BTN_VIEW_END, _mp_player_view_ctxpopup_end_cb, view); + STR_MP_END, MP_PLAYER_MORE_BTN_VIEW_END, + _mp_player_view_ctxpopup_end_cb, view); count++; #endif @@ -998,7 +1158,11 @@ static void _mp_player_view_more_button_clicked_cb(void *data, Evas_Object *obj, } -static Evas_Object *_mp_player_view_create_toolbar_more_btn(Evas_Object *parent, Evas_Smart_Cb func, void *data) +static Evas_Object *_mp_player_view_create_toolbar_more_btn(Evas_Object * + parent, + Evas_Smart_Cb + func, + void *data) { Evas_Object *btn = elm_button_add(parent); if (!btn) { @@ -1008,10 +1172,12 @@ static Evas_Object *_mp_player_view_create_toolbar_more_btn(Evas_Object *parent, return btn; } -static Eina_Bool _mp_player_view_back_button_clicked_cb(void *data, Elm_Object_Item *it) +static Eina_Bool _mp_player_view_back_button_clicked_cb(void *data, + Elm_Object_Item * + it) { startfunc; - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; struct appdata *ad = mp_util_get_appdata(); MP_CHECK_FALSE(ad); @@ -1022,7 +1188,7 @@ static Eina_Bool _mp_player_view_back_button_clicked_cb(void *data, Elm_Object_I #ifdef MP_SOUND_PLAYER MP_CHECK_FALSE(view); - if(ad->exit_status == true) { + if (ad->exit_status == true) { elm_exit(); } @@ -1046,7 +1212,7 @@ static Eina_Bool _mp_player_view_back_button_clicked_cb(void *data, Elm_Object_I void mp_player_view_set_title(void *thiz) { startfunc; - MpPlayerView_t *view = (MpPlayerView_t *)thiz; + MpPlayerView_t *view = (MpPlayerView_t *) thiz; MP_CHECK(view); CHECK_VIEW(view); MP_CHECK(view->navi_it); @@ -1059,22 +1225,34 @@ void mp_player_view_set_title(void *thiz) char *title = NULL; char *artist = NULL; - elm_naviframe_item_title_enabled_set(view->navi_it, EINA_FALSE, EINA_FALSE); + elm_naviframe_item_title_enabled_set(view->navi_it, EINA_FALSE, + EINA_FALSE); if (ad->is_lcd_off) { title = g_strdup(""); artist = g_strdup(""); } else { - title = g_strdup_printf("%s", (ad->current_track_info && ad->current_track_info->title ? ad->current_track_info->title : "")); - artist = g_strdup_printf("%s", (ad->current_track_info && ad->current_track_info->artist ? ad->current_track_info->artist : GET_STR("IDS_COM_BODY_UNKNOWN"))); + title = + g_strdup_printf("%s", + (ad->current_track_info + && ad->current_track_info->title ? ad-> + current_track_info->title : "")); + artist = + g_strdup_printf("%s", + (ad->current_track_info + && ad->current_track_info->artist ? ad-> + current_track_info-> + artist : GET_STR("IDS_COM_BODY_UNKNOWN"))); } - char *newtitle = elm_entry_utf8_to_markup(title); - char *newartist = elm_entry_utf8_to_markup(artist); + char *newtitle = elm_entry_utf8_to_markup(title); + char *newartist = elm_entry_utf8_to_markup(artist); - elm_object_part_text_set(view->player_view_layout, "player_view_title_main", newtitle); - elm_object_part_text_set(view->player_view_layout, "player_view_title_subtitle", newartist); + elm_object_part_text_set(view->player_view_layout, + "player_view_title_main", newtitle); + elm_object_part_text_set(view->player_view_layout, + "player_view_title_subtitle", newartist); IF_G_FREE(newtitle); IF_G_FREE(newartist); @@ -1085,7 +1263,7 @@ void mp_player_view_set_title(void *thiz) static void mp_player_view_set_title_and_buttons(void *thiz) { startfunc; - MpPlayerView_t *view = (MpPlayerView_t *)thiz; + MpPlayerView_t *view = (MpPlayerView_t *) thiz; MP_CHECK(view); CHECK_VIEW(view); @@ -1105,12 +1283,16 @@ static void mp_player_view_set_title_and_buttons(void *thiz) #endif /*int i = 0; - for (i = 0; i < MP_OPTION_MORE; i++) - mp_evas_object_del(view->toolbar_options[i]);*/ + for (i = 0; i < MP_OPTION_MORE; i++) + mp_evas_object_del(view->toolbar_options[i]); */ Evas_Object *btn = NULL; - btn = elm_object_item_part_content_unset(view->navi_it, "toolbar_button1"); + btn = + elm_object_item_part_content_unset(view->navi_it, + "toolbar_button1"); mp_evas_object_del(btn); - btn = elm_object_item_part_content_unset(view->navi_it, "toolbar_button2"); + btn = + elm_object_item_part_content_unset(view->navi_it, + "toolbar_button2"); mp_evas_object_del(btn); } @@ -1122,19 +1304,24 @@ static void mp_player_view_set_title_and_buttons(void *thiz) } if (playable) { - Evas_Object *btn = _mp_player_view_create_toolbar_more_btn(view->layout, _mp_player_view_more_button_clicked_cb, view); - elm_object_item_part_content_set(view->navi_it, "toolbar_more_btn", btn); + Evas_Object *btn = + _mp_player_view_create_toolbar_more_btn(view->layout, + _mp_player_view_more_button_clicked_cb, + view); + elm_object_item_part_content_set(view->navi_it, "toolbar_more_btn", + btn); } /* Add back button */ - elm_naviframe_item_pop_cb_set(view->navi_it, _mp_player_view_back_button_clicked_cb, view); + elm_naviframe_item_pop_cb_set(view->navi_it, + _mp_player_view_back_button_clicked_cb, + view); endfunc; } -static void -_mp_player_view_destory_cb(void *thiz) +static void _mp_player_view_destory_cb(void *thiz) { eventfunc; MpPlayerView_t *view = thiz; @@ -1146,7 +1333,8 @@ _mp_player_view_destory_cb(void *thiz) struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); - elm_object_signal_emit(ad->conformant, "elm,state,virtualkeypad,enable", ""); + elm_object_signal_emit(ad->conformant, + "elm,state,virtualkeypad,enable", ""); MP_CHECK(ad->win_main); if (view->start_on_transition_finish) { @@ -1156,11 +1344,11 @@ _mp_player_view_destory_cb(void *thiz) } mp_popup_destroy(ad); - mp_view_fini((MpView_t *)view); + mp_view_fini((MpView_t *) view); mp_ecore_timer_del(view->progressbar_timer); mp_ecore_timer_del(view->volume_popup_timer); - /*mp_ecore_timer_del(view->asf_volume_popup_timer);*/ + /*mp_ecore_timer_del(view->asf_volume_popup_timer); */ mp_ecore_timer_del(view->stop_update_timer); mp_ecore_idler_del(view->queue_title_idler); mp_ecore_idler_del(view->queue_list_update_idler); @@ -1186,14 +1374,15 @@ _mp_player_view_destory_cb(void *thiz) free(view); mp_volume_key_event_callback_del(); - mp_volume_key_grab_condition_set(MP_VOLUME_KEY_GRAB_COND_VIEW_VISIBLE, false); + mp_volume_key_grab_condition_set(MP_VOLUME_KEY_GRAB_COND_VIEW_VISIBLE, + false); } static int _mp_player_view_update_options(void *thiz) { startfunc; - MpPlayerView_t *playing_view = (MpPlayerView_t *)thiz; + MpPlayerView_t *playing_view = (MpPlayerView_t *) thiz; MP_CHECK_FALSE(playing_view); struct appdata *ad = mp_util_get_appdata(); @@ -1220,16 +1409,22 @@ static int _mp_player_view_update_options(void *thiz) } #ifdef MP_IMAGE_ROTATE_FEATURE -static void _mp_player_view_animation_set(MpPlayerView_t *playing_view, bool playing) +static void _mp_player_view_animation_set(MpPlayerView_t * playing_view, + bool playing) { MP_CHECK(playing_view); - DEBUG_TRACE("view paused: %d, state: %d", playing_view->paused, playing); + DEBUG_TRACE("view paused: %d, state: %d", playing_view->paused, + playing); playing_view->imgId = 0; if (NULL == playing_view->rotation_image) { - playing_view->rotation_image = elm_image_add(playing_view->player_view_layout); - elm_image_file_set(playing_view->rotation_image, IMAGE_EDJ_NAME, rotateimg[0]); - elm_object_part_content_set(playing_view->player_view_layout, "album_turn_table", playing_view->rotation_image); + playing_view->rotation_image = + elm_image_add(playing_view->player_view_layout); + elm_image_file_set(playing_view->rotation_image, IMAGE_EDJ_NAME, + rotateimg[0]); + elm_object_part_content_set(playing_view->player_view_layout, + "album_turn_table", + playing_view->rotation_image); } } #endif @@ -1237,7 +1432,7 @@ static void _mp_player_view_animation_set(MpPlayerView_t *playing_view, bool pla void mp_player_view_set_album_playing(void *thiz, bool playing) { startfunc; - MpPlayerView_t *playing_view = (MpPlayerView_t *)thiz; + MpPlayerView_t *playing_view = (MpPlayerView_t *) thiz; MP_CHECK(playing_view); CHECK_VIEW(playing_view); MP_CHECK(playing_view->player_view_layout); @@ -1247,51 +1442,62 @@ void mp_player_view_set_album_playing(void *thiz, bool playing) } DEBUG_TRACE("playing=%d", playing); if (playing) { - /*edje_object_signal_emit(_EDJ(playing_view->player_view_layout), "ALBUM_PLAING", "music_app");*/ - edje_object_signal_emit(_EDJ(playing_view->player_view_layout), "ALBUM_STOP", "music_app"); + /*edje_object_signal_emit(_EDJ(playing_view->player_view_layout), "ALBUM_PLAING", "music_app"); */ + edje_object_signal_emit(_EDJ(playing_view->player_view_layout), + "ALBUM_STOP", "music_app"); } else { - edje_object_signal_emit(_EDJ(playing_view->player_view_layout), "ALBUM_STOP", "music_app"); + edje_object_signal_emit(_EDJ(playing_view->player_view_layout), + "ALBUM_STOP", "music_app"); } - /*p_player_view_animation_set(playing_view, playing);*/ + /*p_player_view_animation_set(playing_view, playing); */ endfunc; } static void _mp_player_view_set_album_image(void *thiz) { startfunc; - MpPlayerView_t *playing_view = (MpPlayerView_t *)thiz; + MpPlayerView_t *playing_view = (MpPlayerView_t *) thiz; MP_CHECK(playing_view); CHECK_VIEW(playing_view); MP_CHECK(playing_view->player_view_layout); int h = PLAYER_VIEW_ALBUM_SIZE, w = PLAYER_VIEW_ALBUM_SIZE; - Evas_Object *album_image = elm_object_part_content_unset(playing_view->player_view_layout, "album_image_temp"); + Evas_Object *album_image = + elm_object_part_content_unset(playing_view->player_view_layout, + "album_image_temp"); if (!album_image) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); MP_CHECK(ad->current_track_info); album_image = - _mp_player_view_create_album_image(playing_view->player_view_layout, - ad->current_track_info->thumbnail_path, h, w); + _mp_player_view_create_album_image(playing_view-> + player_view_layout, + ad->current_track_info-> + thumbnail_path, h, w); } - elm_object_part_content_set(playing_view->player_view_layout, "album_image", album_image); + elm_object_part_content_set(playing_view->player_view_layout, + "album_image", album_image); /* hide temp album area */ - edje_object_signal_emit(elm_layout_edje_get(playing_view->player_view_layout), "set_temp_invsible", "album_area_temp"); + edje_object_signal_emit(elm_layout_edje_get + (playing_view->player_view_layout), + "set_temp_invsible", "album_area_temp"); endfunc; } static void _mp_player_view_set_content_info_icon(void *thiz) { startfunc; - MpPlayerView_t *playing_view = (MpPlayerView_t *)thiz; + MpPlayerView_t *playing_view = (MpPlayerView_t *) thiz; MP_CHECK(playing_view); CHECK_VIEW(playing_view); MP_CHECK(playing_view->player_view_layout); - Evas_Object *uha_icon = elm_object_part_content_unset(playing_view->player_view_layout, "uhq_icon_area"); + Evas_Object *uha_icon = + elm_object_part_content_unset(playing_view->player_view_layout, + "uhq_icon_area"); mp_evas_object_del(uha_icon); struct appdata *ad = mp_util_get_appdata(); @@ -1303,15 +1509,15 @@ static void _mp_player_view_set_content_info_icon(void *thiz) uha_icon = elm_icon_add(playing_view->player_view_layout); elm_image_file_set(uha_icon, IMAGE_EDJ_NAME, MP_PLAY_UHA_ICON); elm_image_resizable_set(uha_icon, EINA_TRUE, EINA_TRUE); - elm_object_part_content_set(playing_view->player_view_layout, "uhq_icon_area", uha_icon); + elm_object_part_content_set(playing_view->player_view_layout, + "uhq_icon_area", uha_icon); } } /* volume popup */ -static void -_mp_player_view_volume_popup_hide(void *data) +static void _mp_player_view_volume_popup_hide(void *data) { - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); CHECK_VIEW(view); @@ -1319,8 +1525,7 @@ _mp_player_view_volume_popup_hide(void *data) mp_evas_object_del(view->volume_popup); } -static Eina_Bool -_mp_player_view_volume_widget_timer_cb(void *data) +static Eina_Bool _mp_player_view_volume_widget_timer_cb(void *data) { TIMER_TRACE(); @@ -1335,17 +1540,20 @@ _mp_player_view_volume_widget_timer_cb(void *data) } static inline void -_mp_player_view_volume_widget_hide_timer_start(MpPlayerView_t *view) +_mp_player_view_volume_widget_hide_timer_start(MpPlayerView_t * view) { startfunc; MP_CHECK(view); CHECK_VIEW(view); mp_ecore_timer_del(view->volume_popup_timer); - view->volume_popup_timer = ecore_timer_add(PLAYER_VIEW_VOLUME_WIDGET_HIDE_TIME, _mp_player_view_volume_widget_timer_cb, view); + view->volume_popup_timer = + ecore_timer_add(PLAYER_VIEW_VOLUME_WIDGET_HIDE_TIME, + _mp_player_view_volume_widget_timer_cb, view); } static void -__mp_player_view_volume_popup_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +__mp_player_view_volume_popup_del_cb(void *data, Evas * e, + Evas_Object * obj, void *event_info) { MpPlayerView_t *view = data; MP_CHECK(view); @@ -1359,24 +1567,36 @@ __mp_player_view_volume_popup_del_cb(void *data, Evas *e, Evas_Object *obj, void static void _mp_player_view_volume_update(void *data) { - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); CHECK_VIEW(view); int volume = mp_player_mgr_volume_get_current(); DEBUG_TRACE("volume:%d", volume); if (volume > 0) { - edje_object_signal_emit(_EDJ(view->player_view_option_layout), "options_volume_visible", "options_volume"); - edje_object_signal_emit(_EDJ(view->player_view_option_layout), "options_volume_mute_invisible", "options_volume_mute"); + edje_object_signal_emit(_EDJ(view->player_view_option_layout), + "options_volume_visible", + "options_volume"); + edje_object_signal_emit(_EDJ(view->player_view_option_layout), + "options_volume_mute_invisible", + "options_volume_mute"); } else { - edje_object_signal_emit(_EDJ(view->player_view_option_layout), "options_volume_invisible", "options_volume"); - edje_object_signal_emit(_EDJ(view->player_view_option_layout), "options_volume_mute_visible", "options_volume_mute"); + edje_object_signal_emit(_EDJ(view->player_view_option_layout), + "options_volume_invisible", + "options_volume"); + edje_object_signal_emit(_EDJ(view->player_view_option_layout), + "options_volume_mute_visible", + "options_volume_mute"); } - mp_util_domain_translatable_part_text_set(view->player_view_option_layout, "volume_text", STR_PLAYER_VIEW_VOLUME); + mp_util_domain_translatable_part_text_set(view-> + player_view_option_layout, + "volume_text", + STR_PLAYER_VIEW_VOLUME); } static void -__mp_player_view_volume_widget_event_cb(void *data, Evas_Object *obj, volume_widget_event_e event) +__mp_player_view_volume_widget_event_cb(void *data, Evas_Object * obj, + volume_widget_event_e event) { startfunc; MpPlayerView_t *view = data; @@ -1394,8 +1614,7 @@ __mp_player_view_volume_widget_event_cb(void *data, Evas_Object *obj, volume_wid _mp_player_view_volume_update(view); } -static void -_mp_player_view_volume_change_cb(int volume, void *user_data) +static void _mp_player_view_volume_change_cb(int volume, void *user_data) { MpPlayerView_t *view = user_data; MP_CHECK(view); @@ -1420,8 +1639,7 @@ _mp_player_view_volume_change_cb(int volume, void *user_data) } } -static void -_mp_player_view_volume_route_change(void *user_data) +static void _mp_player_view_volume_route_change(void *user_data) { MpPlayerView_t *view = user_data; MP_CHECK(view); @@ -1433,8 +1651,7 @@ _mp_player_view_volume_route_change(void *user_data) } -static void -_mp_player_view_volume_popup_show(MpPlayerView_t *view) +static void _mp_player_view_volume_popup_show(MpPlayerView_t * view) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); @@ -1445,26 +1662,31 @@ _mp_player_view_volume_popup_show(MpPlayerView_t *view) view->volume_popup_now_dragging = false; - view->volume_popup = mp_player_volume_widget_add(view->player_view_layout); - elm_object_part_content_set(view->player_view_layout, "volume_popup", view->volume_popup); - evas_object_event_callback_add(view->volume_popup, EVAS_CALLBACK_DEL, __mp_player_view_volume_popup_del_cb, view); - mp_player_volume_widget_event_callback_add(view->volume_popup, __mp_player_view_volume_widget_event_cb, view); + view->volume_popup = + mp_player_volume_widget_add(view->player_view_layout); + elm_object_part_content_set(view->player_view_layout, "volume_popup", + view->volume_popup); + evas_object_event_callback_add(view->volume_popup, EVAS_CALLBACK_DEL, + __mp_player_view_volume_popup_del_cb, + view); + mp_player_volume_widget_event_callback_add(view->volume_popup, + __mp_player_view_volume_widget_event_cb, + view); mp_volume_add_change_cb(_mp_player_view_volume_change_cb, view); endfunc; } -void -mp_player_view_volume_popup_control(void *data, bool force_show) +void mp_player_view_volume_popup_control(void *data, bool force_show) { - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); CHECK_VIEW(view); if (view->volume_popup) { if (force_show) { - _mp_player_view_volume_widget_hide_timer_start(view); /* restart timer */ + _mp_player_view_volume_widget_hide_timer_start(view); /* restart timer */ } else { _mp_player_view_volume_popup_hide(view); } @@ -1475,9 +1697,10 @@ mp_player_view_volume_popup_control(void *data, bool force_show) } static void -_mp_player_view_volume_hw_key_cb(void *user_data, mp_volume_key_e key, bool released) +_mp_player_view_volume_hw_key_cb(void *user_data, mp_volume_key_e key, + bool released) { - MpPlayerView_t *view = (MpPlayerView_t *)user_data; + MpPlayerView_t *view = (MpPlayerView_t *) user_data; MP_CHECK(view); CHECK_VIEW(view); @@ -1500,11 +1723,11 @@ _mp_player_view_volume_hw_key_cb(void *user_data, mp_volume_key_e key, bool rele mp_player_mgr_volume_up(); } else if (key == MP_VOLUME_KEY_MUTE) { if (view->unmute_vol == 0) { - /*mute*/ + /*mute */ view->unmute_vol = mp_player_mgr_volume_get_current(); mp_player_mgr_volume_set(0); } else { - /*unmute*/ + /*unmute */ mp_player_mgr_volume_set(view->unmute_vol); view->unmute_vol = 0; } @@ -1513,50 +1736,72 @@ _mp_player_view_volume_hw_key_cb(void *user_data, mp_volume_key_e key, bool rele } #ifndef MP_SOUND_PLAYER -static void _mp_player_view_set_shuffle_image(void *data, int shuffle_state) +static void _mp_player_view_set_shuffle_image(void *data, + int shuffle_state) { - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); CHECK_VIEW(view); - /*MP_CHECK(view->player_view_option_layout);*/ + /*MP_CHECK(view->player_view_option_layout); */ MP_CHECK(view->player_view_control_layout); if (shuffle_state) { - edje_object_signal_emit(_EDJ(view->player_view_control_layout), "control_shuffle_on_visible", "control_shuffle_on"); - edje_object_signal_emit(_EDJ(view->player_view_control_layout), "control_shuffle_off_invisible", "control_shuffle_off"); + edje_object_signal_emit(_EDJ(view->player_view_control_layout), + "control_shuffle_on_visible", + "control_shuffle_on"); + edje_object_signal_emit(_EDJ(view->player_view_control_layout), + "control_shuffle_off_invisible", + "control_shuffle_off"); } else { - edje_object_signal_emit(_EDJ(view->player_view_control_layout), "control_shuffle_on_invisible", "control_shuffle_on"); - edje_object_signal_emit(_EDJ(view->player_view_control_layout), "control_shuffle_off_visible", "control_shuffle_off"); - } - mp_util_domain_translatable_part_text_set(view->player_view_control_layout, "shuffle_text", STR_PLAYER_VIEW_SHUFFLE); + edje_object_signal_emit(_EDJ(view->player_view_control_layout), + "control_shuffle_on_invisible", + "control_shuffle_on"); + edje_object_signal_emit(_EDJ(view->player_view_control_layout), + "control_shuffle_off_visible", + "control_shuffle_off"); + } + mp_util_domain_translatable_part_text_set(view-> + player_view_control_layout, + "shuffle_text", + STR_PLAYER_VIEW_SHUFFLE); } #endif /*add favourite begin*/ -static void _mp_player_view_set_favourite_image(void *data, int favourite_state) +static void _mp_player_view_set_favourite_image(void *data, + int favourite_state) { DEBUG_TRACE("favourite_state=%d", favourite_state); - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); CHECK_VIEW(view); - /*favourite button not exist in sound player*/ + /*favourite button not exist in sound player */ Evas_Object *layout = view->player_view_layout; MP_CHECK(layout); if (favourite_state) { - edje_object_signal_emit(_EDJ(layout), "options_favourite_on_visible", "options_favourite_on"); - edje_object_signal_emit(_EDJ(layout), "options_favourite_off_invisible", "options_favourite_off"); + edje_object_signal_emit(_EDJ(layout), + "options_favourite_on_visible", + "options_favourite_on"); + edje_object_signal_emit(_EDJ(layout), + "options_favourite_off_invisible", + "options_favourite_off"); } else { - edje_object_signal_emit(_EDJ(layout), "options_favourite_on_invisible", "options_favourite_on"); - edje_object_signal_emit(_EDJ(layout), "options_favourite_off_visible", "options_favourite_off"); + edje_object_signal_emit(_EDJ(layout), + "options_favourite_on_invisible", + "options_favourite_on"); + edje_object_signal_emit(_EDJ(layout), + "options_favourite_off_visible", + "options_favourite_off"); } } + /*add favourite end*/ #ifndef MP_SOUND_PLAYER static void _mp_player_view_set_rep_image(void *data, int repeat_state) { - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); CHECK_VIEW(view); MP_CHECK(view->player_view_control_layout); @@ -1566,75 +1811,101 @@ static void _mp_player_view_set_rep_image(void *data, int repeat_state) evas_object_hide(view->control_button[CONTROL_REP_1]); evas_object_hide(view->control_button[CONTROL_REP_ALL]); - edje_object_signal_emit(_EDJ(view->player_view_control_layout), "control_rep_A_visible", "control_rep_A"); - edje_object_signal_emit(_EDJ(view->player_view_control_layout), "control_rep_1_invisible", "control_rep_1"); - edje_object_signal_emit(_EDJ(view->player_view_control_layout), "control_rep_all_invisible", "control_rep_all"); + edje_object_signal_emit(_EDJ(view->player_view_control_layout), + "control_rep_A_visible", "control_rep_A"); + edje_object_signal_emit(_EDJ(view->player_view_control_layout), + "control_rep_1_invisible", + "control_rep_1"); + edje_object_signal_emit(_EDJ(view->player_view_control_layout), + "control_rep_all_invisible", + "control_rep_all"); } else if (repeat_state == MP_PLST_REPEAT_ONE) { evas_object_hide(view->control_button[CONTROL_REP_A]); evas_object_show(view->control_button[CONTROL_REP_1]); evas_object_hide(view->control_button[CONTROL_REP_ALL]); - edje_object_signal_emit(_EDJ(view->player_view_control_layout), "control_rep_A_invisible", "control_rep_A"); - edje_object_signal_emit(_EDJ(view->player_view_control_layout), "control_rep_1_visible", "control_rep_1"); - edje_object_signal_emit(_EDJ(view->player_view_control_layout), "control_rep_all_invisible", "control_rep_all"); + edje_object_signal_emit(_EDJ(view->player_view_control_layout), + "control_rep_A_invisible", + "control_rep_A"); + edje_object_signal_emit(_EDJ(view->player_view_control_layout), + "control_rep_1_visible", "control_rep_1"); + edje_object_signal_emit(_EDJ(view->player_view_control_layout), + "control_rep_all_invisible", + "control_rep_all"); } else if (repeat_state == MP_PLST_REPEAT_ALL) { evas_object_hide(view->control_button[CONTROL_REP_A]); evas_object_hide(view->control_button[CONTROL_REP_1]); evas_object_show(view->control_button[CONTROL_REP_ALL]); - edje_object_signal_emit(_EDJ(view->player_view_control_layout), "control_rep_A_invisible", "control_rep_A"); - edje_object_signal_emit(_EDJ(view->player_view_control_layout), "control_rep_1_invisible", "control_rep_1"); - edje_object_signal_emit(_EDJ(view->player_view_control_layout), "control_rep_all_visible", "control_rep_all"); + edje_object_signal_emit(_EDJ(view->player_view_control_layout), + "control_rep_A_invisible", + "control_rep_A"); + edje_object_signal_emit(_EDJ(view->player_view_control_layout), + "control_rep_1_invisible", + "control_rep_1"); + edje_object_signal_emit(_EDJ(view->player_view_control_layout), + "control_rep_all_visible", + "control_rep_all"); } else { ERROR_TRACE("Error when set repeat\n"); } - mp_util_domain_translatable_part_text_set(view->player_view_control_layout, "repeat_text", STR_PLAYER_VIEW_REPEAT); + mp_util_domain_translatable_part_text_set(view-> + player_view_control_layout, + "repeat_text", + STR_PLAYER_VIEW_REPEAT); } #endif void mp_player_view_set_play_image(void *data, bool playing) { - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); CHECK_VIEW(view); MP_CHECK(view->player_view_control_layout); if (playing || view->start_on_transition_finish) { - edje_object_signal_emit(_EDJ(view->player_view_control_layout), "control_play_visible", "control_play"); - edje_object_signal_emit(_EDJ(view->player_view_control_layout), "control_pause_invisible", "control_pause"); + edje_object_signal_emit(_EDJ(view->player_view_control_layout), + "control_play_visible", "control_play"); + edje_object_signal_emit(_EDJ(view->player_view_control_layout), + "control_pause_invisible", + "control_pause"); } else { - edje_object_signal_emit(_EDJ(view->player_view_control_layout), "control_play_invisible", "control_play"); - edje_object_signal_emit(_EDJ(view->player_view_control_layout), "control_pause_visible", "control_pause"); + edje_object_signal_emit(_EDJ(view->player_view_control_layout), + "control_play_invisible", "control_play"); + edje_object_signal_emit(_EDJ(view->player_view_control_layout), + "control_pause_visible", "control_pause"); } } -static void -_mp_player_view_show_detail_view(MpPlayerView_t *view) +static void _mp_player_view_show_detail_view(MpPlayerView_t * view) { MpViewMgr_t *view_mgr = GET_VIEW_MGR; MP_CHECK(view_mgr); - MpView_t *detail_view = (MpView_t *)mp_detail_view_create(view_mgr->navi); + MpView_t *detail_view = + (MpView_t *) mp_detail_view_create(view_mgr->navi); mp_view_mgr_push_view_with_effect(view_mgr, detail_view, NULL, true); mp_view_update(detail_view); } static void -_mp_player_view_option_btn_click_cb(void *data, Evas_Object * obj, const char *emission, const char *source) +_mp_player_view_option_btn_click_cb(void *data, Evas_Object * obj, + const char *emission, + const char *source) { startfunc; mp_setting_set_nowplaying_id(getpid()); return; } -static void -_mp_player_view_progress_val_set(void *data, double position) +static void _mp_player_view_progress_val_set(void *data, double position) { - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); CHECK_VIEW(view); MP_CHECK(view->progress_box); MP_CHECK(view->progress_bar); - edje_object_part_drag_value_set(_EDJ(view->progress_bar), "progressbar_playing", position, 0.0); + edje_object_part_drag_value_set(_EDJ(view->progress_bar), + "progressbar_playing", position, 0.0); return; } @@ -1650,7 +1921,7 @@ void mp_player_view_update_progressbar(void *data) MP_CHECK(playing_view->progress_box); MP_CHECK(playing_view->progress_bar); - /*INFO_TRACE("\npos = %f / length = %f\n", ad->music_pos, ad->music_length);*/ + /*INFO_TRACE("\npos = %f / length = %f\n", ad->music_pos, ad->music_length); */ char play_time[16] = { 0, }; char total_time[16] = { 0, }; @@ -1660,18 +1931,22 @@ void mp_player_view_update_progressbar(void *data) if (duration > 0.) { if (duration > 3600.) { snprintf(total_time, sizeof(total_time), "%" MUSIC_TIME_FORMAT, - MUSIC_TIME_ARGS(duration)); - snprintf(play_time, sizeof(play_time), "%" MUSIC_TIME_FORMAT, MUSIC_TIME_ARGS(ad->music_pos)); + MUSIC_TIME_ARGS(duration)); + snprintf(play_time, sizeof(play_time), "%" MUSIC_TIME_FORMAT, + MUSIC_TIME_ARGS(ad->music_pos)); } else { snprintf(total_time, sizeof(total_time), "%" PLAY_TIME_FORMAT, - PLAY_TIME_ARGS(duration)); - snprintf(play_time, sizeof(play_time), "%" PLAY_TIME_FORMAT, PLAY_TIME_ARGS(ad->music_pos)); + PLAY_TIME_ARGS(duration)); + snprintf(play_time, sizeof(play_time), "%" PLAY_TIME_FORMAT, + PLAY_TIME_ARGS(ad->music_pos)); } } else { if (ad->current_track_info) snprintf(total_time, sizeof(total_time), "%" PLAY_TIME_FORMAT, - PLAY_TIME_ARGS(ad->current_track_info->duration / 1000.)); - snprintf(play_time, sizeof(play_time), "%" PLAY_TIME_FORMAT, PLAY_TIME_ARGS(ad->music_pos)); + PLAY_TIME_ARGS(ad->current_track_info->duration / + 1000.)); + snprintf(play_time, sizeof(play_time), "%" PLAY_TIME_FORMAT, + PLAY_TIME_ARGS(ad->music_pos)); } double played_ratio = 0.; @@ -1679,22 +1954,24 @@ void mp_player_view_update_progressbar(void *data) played_ratio = ad->music_pos / duration; } if (played_ratio == 0) { - DEBUG_TRACE("ad->music_pos=%f, duration=%f", ad->music_pos, duration); + DEBUG_TRACE("ad->music_pos=%f, duration=%f", ad->music_pos, + duration); } _mp_player_view_progress_val_set(playing_view, played_ratio); - edje_object_part_text_set(_EDJ(playing_view->progress_box), "progress_text_total", total_time); - edje_object_part_text_set(_EDJ(playing_view->progress_box), "progress_text_playing", play_time); + edje_object_part_text_set(_EDJ(playing_view->progress_box), + "progress_text_total", total_time); + edje_object_part_text_set(_EDJ(playing_view->progress_box), + "progress_text_playing", play_time); } -void -mp_player_view_progress_timer_thaw(void *data) +void mp_player_view_progress_timer_thaw(void *data) { startfunc; struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); - MpPlayerView_t *playing_view = (MpPlayerView_t *)data; + MpPlayerView_t *playing_view = (MpPlayerView_t *) data; MP_CHECK(playing_view); CHECK_VIEW(playing_view); @@ -1702,7 +1979,9 @@ mp_player_view_progress_timer_thaw(void *data) if (playing_view->progressbar_timer) { MP_TIMER_THAW(playing_view->progressbar_timer); } else { - playing_view->progressbar_timer = ecore_timer_add(0.1, _mp_player_view_update_progressbar_cb, playing_view); + playing_view->progressbar_timer = + ecore_timer_add(0.1, _mp_player_view_update_progressbar_cb, + playing_view); } } else if (ad->player_state == PLAY_STATE_PAUSED) { @@ -1710,11 +1989,10 @@ mp_player_view_progress_timer_thaw(void *data) } } -void -mp_player_view_progress_timer_freeze(void *data) +void mp_player_view_progress_timer_freeze(void *data) { startfunc; - MpPlayerView_t *playing_view = (MpPlayerView_t *)data; + MpPlayerView_t *playing_view = (MpPlayerView_t *) data; MP_CHECK(playing_view); CHECK_VIEW(playing_view); @@ -1722,20 +2000,21 @@ mp_player_view_progress_timer_freeze(void *data) } static void -_mp_player_view_progressbar_down_cb(void *data, Evas * e, Evas_Object * obj, void *event_info) +_mp_player_view_progressbar_down_cb(void *data, Evas * e, + Evas_Object * obj, void *event_info) { startfunc; if (data == NULL && obj == NULL && event_info == NULL) { return; } - evas_object_data_set(obj, "pressed", (void *)1); + evas_object_data_set(obj, "pressed", (void *) 1); struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); DEBUG_TRACE("ad->player_state=%d", ad->player_state); - MpPlayerView_t *playing_view = (MpPlayerView_t *)data; + MpPlayerView_t *playing_view = (MpPlayerView_t *) data; MP_CHECK(playing_view); CHECK_VIEW(playing_view); @@ -1756,7 +2035,7 @@ _mp_player_view_progressbar_down_cb(void *data, Evas * e, Evas_Object * obj, voi current = w; } - ratio = (double)current / w; + ratio = (double) current / w; duration = mp_player_mgr_get_duration(); @@ -1771,7 +2050,7 @@ _mp_player_view_progressbar_down_cb(void *data, Evas * e, Evas_Object * obj, voi ad->music_pos = ratio * ad->music_length; - if (playing_view->update_flag == true) { /* only collect position data when rotation does not start*/ + if (playing_view->update_flag == true) { /* only collect position data when rotation does not start */ playing_view->update_pos = ad->music_pos; } @@ -1779,21 +2058,21 @@ _mp_player_view_progressbar_down_cb(void *data, Evas * e, Evas_Object * obj, voi endfunc; } -static Eina_Bool -_mp_player_view_update_progressbar_cb(void *data) +static Eina_Bool _mp_player_view_update_progressbar_cb(void *data) { TIMER_TRACE(); struct appdata *ad = mp_util_get_appdata(); MP_CHECK_FALSE(ad); - MpPlayerView_t *playing_view = (MpPlayerView_t *)data; + MpPlayerView_t *playing_view = (MpPlayerView_t *) data; MP_CHECK_FALSE(playing_view); if (playing_view->progressbar_dragging) { return ECORE_CALLBACK_RENEW; } - if (ad->is_lcd_off || mp_player_mgr_get_state() != PLAYER_STATE_PLAYING) { + if (ad->is_lcd_off + || mp_player_mgr_get_state() != PLAYER_STATE_PLAYING) { playing_view->progressbar_timer = NULL; return ECORE_CALLBACK_CANCEL; } @@ -1801,14 +2080,15 @@ _mp_player_view_update_progressbar_cb(void *data) static double prev_length = 0.; double get_pos = 0.; - if (ad->player_state == PLAY_STATE_PLAYING || ad->player_state == PLAY_STATE_PAUSED) { + if (ad->player_state == PLAY_STATE_PLAYING + || ad->player_state == PLAY_STATE_PAUSED) { if (ad->music_length <= 0) { mp_track_info_t *track_info = ad->current_track_info; ad->music_length = track_info->duration / 1000.0; } /*even if duration is 0, we need to update position for some streaming case - if ((ad->music_length) > 0)*/ + if ((ad->music_length) > 0) */ { get_pos = mp_player_mgr_get_position() / 1000.0; } @@ -1834,24 +2114,25 @@ _mp_player_view_update_progressbar_cb(void *data) void _mp_player_view_add_progress_timer(void *data) { - MpPlayerView_t *playing_view = (MpPlayerView_t *)data; + MpPlayerView_t *playing_view = (MpPlayerView_t *) data; MP_CHECK(playing_view); CHECK_VIEW(playing_view); mp_ecore_timer_del(playing_view->progressbar_timer); - playing_view->progressbar_timer = ecore_timer_add(0.1, _mp_player_view_update_progressbar_cb, playing_view); + playing_view->progressbar_timer = + ecore_timer_add(0.1, _mp_player_view_update_progressbar_cb, + playing_view); return; } -static bool -_mp_player_view_init_progress_bar(void *data) +static bool _mp_player_view_init_progress_bar(void *data) { startfunc; struct appdata *ad = mp_util_get_appdata(); MP_CHECK_FALSE(ad); - MpPlayerView_t *playing_view = (MpPlayerView_t *)data; + MpPlayerView_t *playing_view = (MpPlayerView_t *) data; MP_CHECK_FALSE(playing_view); int pos = 0, duration = 0; @@ -1876,18 +2157,19 @@ _mp_player_view_init_progress_bar(void *data) return true; } -static void -_mp_player_view_progressbar_seek_done_cb(void *data) +static void _mp_player_view_progressbar_seek_done_cb(void *data) { startfunc; - MpPlayerView_t *playing_view = (MpPlayerView_t *)data; + MpPlayerView_t *playing_view = (MpPlayerView_t *) data; MP_CHECK(playing_view); CHECK_VIEW(playing_view); - MP_CHECK((int)playing_view == (int)GET_PLAYER_VIEW); + MP_CHECK((int) playing_view == (int) GET_PLAYER_VIEW); int pressed = 0; if (playing_view->progress_bar) { - pressed = (int)evas_object_data_get(playing_view->progress_bar, "pressed"); + pressed = + (int) evas_object_data_get(playing_view->progress_bar, + "pressed"); } if (!pressed) { mp_player_view_progress_timer_thaw(playing_view); @@ -1898,21 +2180,22 @@ _mp_player_view_progressbar_seek_done_cb(void *data) static void -_mp_player_view_progressbar_up_cb(void *data, Evas * e, Evas_Object * obj, void *event_info) +_mp_player_view_progressbar_up_cb(void *data, Evas * e, Evas_Object * obj, + void *event_info) { startfunc; if (data == NULL && obj == NULL && event_info == NULL) { return; } - evas_object_data_set(obj, "pressed", (void *)0); + evas_object_data_set(obj, "pressed", (void *) 0); struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); DEBUG_TRACE("ad->player_state=%d", ad->player_state); - MpPlayerView_t *playing_view = (MpPlayerView_t *)data; + MpPlayerView_t *playing_view = (MpPlayerView_t *) data; MP_CHECK(playing_view); CHECK_VIEW(playing_view); @@ -1924,8 +2207,10 @@ _mp_player_view_progressbar_up_cb(void *data, Evas * e, Evas_Object * obj, void playing_view->progressbar_dragging = false; playing_view->update_pos = -1; - if (!(ad->player_state == PLAY_STATE_PLAYING || ad->player_state == PLAY_STATE_PAUSED - || ad->player_state == PLAY_STATE_READY)) { + if (! + (ad->player_state == PLAY_STATE_PLAYING + || ad->player_state == PLAY_STATE_PAUSED + || ad->player_state == PLAY_STATE_READY)) { ERROR_TRACE("Invaild player_state : %d", ad->player_state); return; } @@ -1940,11 +2225,13 @@ _mp_player_view_progressbar_up_cb(void *data, Evas * e, Evas_Object * obj, void current = w; } - ratio = (double)current / w; + ratio = (double) current / w; ad->music_pos = ratio * ad->music_length; DEBUG_TRACE("ad->music_pos=%lf", ad->music_pos); - if (mp_player_mgr_set_position(ad->music_pos * 1000, _mp_player_view_progressbar_seek_done_cb, playing_view)) { + if (mp_player_mgr_set_position + (ad->music_pos * 1000, _mp_player_view_progressbar_seek_done_cb, + playing_view)) { mp_player_view_update_progressbar(playing_view); } else { mp_player_view_progress_timer_thaw(playing_view); @@ -1954,13 +2241,14 @@ _mp_player_view_progressbar_up_cb(void *data, Evas * e, Evas_Object * obj, void } static void -_mp_player_view_progressbar_move_cb(void *data, Evas * e, Evas_Object * obj, void *event_info) +_mp_player_view_progressbar_move_cb(void *data, Evas * e, + Evas_Object * obj, void *event_info) { if (data == NULL && obj == NULL && event_info == NULL) { return; } - int pressed = (int)evas_object_data_get(obj, "pressed"); + int pressed = (int) evas_object_data_get(obj, "pressed"); if (!pressed) { mp_debug("-_- progressbar is not pressed yet!"); return; @@ -1969,7 +2257,7 @@ _mp_player_view_progressbar_move_cb(void *data, Evas * e, Evas_Object * obj, voi struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); - MpPlayerView_t *playing_view = (MpPlayerView_t *)data; + MpPlayerView_t *playing_view = (MpPlayerView_t *) data; MP_CHECK(playing_view); CHECK_VIEW(playing_view); @@ -1990,22 +2278,23 @@ _mp_player_view_progressbar_move_cb(void *data, Evas * e, Evas_Object * obj, voi current = w; } - ratio = (double)current / w; + ratio = (double) current / w; new_pos = ratio * ad->music_length; ad->music_pos = new_pos; - if (playing_view->update_flag == true) { /* only collect position data when rotation does not start*/ + if (playing_view->update_flag == true) { /* only collect position data when rotation does not start */ playing_view->update_pos = new_pos; } mp_player_view_update_progressbar(playing_view); } static void -_mp_player_view_progess_box_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +_mp_player_view_progess_box_del_cb(void *data, Evas * e, Evas_Object * obj, + void *event_info) { startfunc; - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); CHECK_VIEW(view); @@ -2015,50 +2304,68 @@ _mp_player_view_progess_box_del_cb(void *data, Evas *e, Evas_Object *obj, void * static void _mp_player_view_create_progress_layout(void *thiz) { startfunc; - MpPlayerView_t *view = (MpPlayerView_t *)thiz; + MpPlayerView_t *view = (MpPlayerView_t *) thiz; MP_CHECK(view); CHECK_VIEW(view); MP_CHECK(view->player_view_layout); - view->progress_box = mp_common_load_edj(view->player_view_layout, PLAY_VIEW_EDJ_NAME, "player_view_progress_box"); + view->progress_box = + mp_common_load_edj(view->player_view_layout, PLAY_VIEW_EDJ_NAME, + "player_view_progress_box"); MP_CHECK(view->progress_box); if (mp_util_is_landscape()) { - elm_object_signal_emit(view->progress_box, "elm,state,landscape", ""); - } - evas_object_event_callback_add(view->progress_box, EVAS_CALLBACK_DEL, _mp_player_view_progess_box_del_cb, view); - elm_object_part_content_set(view->player_view_layout, "progress_box", view->progress_box); - - view->progress_bar = mp_common_load_edj(view->progress_box, PLAY_VIEW_EDJ_NAME, "player_progressbar"); + elm_object_signal_emit(view->progress_box, "elm,state,landscape", + ""); + } + evas_object_event_callback_add(view->progress_box, EVAS_CALLBACK_DEL, + _mp_player_view_progess_box_del_cb, + view); + elm_object_part_content_set(view->player_view_layout, "progress_box", + view->progress_box); + + view->progress_bar = + mp_common_load_edj(view->progress_box, PLAY_VIEW_EDJ_NAME, + "player_progressbar"); MP_CHECK(view->progress_bar); - elm_object_part_content_set(view->progress_box, "progress_bar", view->progress_bar); + elm_object_part_content_set(view->progress_box, "progress_bar", + view->progress_bar); _mp_player_view_progress_val_set(view, 0.0); - evas_object_event_callback_add(view->progress_bar, EVAS_CALLBACK_MOUSE_DOWN, - _mp_player_view_progressbar_down_cb, view); - evas_object_event_callback_add(view->progress_bar, EVAS_CALLBACK_MOUSE_UP, - _mp_player_view_progressbar_up_cb, view); - evas_object_event_callback_add(view->progress_bar, EVAS_CALLBACK_MOUSE_MOVE, - _mp_player_view_progressbar_move_cb, view); + evas_object_event_callback_add(view->progress_bar, + EVAS_CALLBACK_MOUSE_DOWN, + _mp_player_view_progressbar_down_cb, + view); + evas_object_event_callback_add(view->progress_bar, + EVAS_CALLBACK_MOUSE_UP, + _mp_player_view_progressbar_up_cb, + view); + evas_object_event_callback_add(view->progress_bar, + EVAS_CALLBACK_MOUSE_MOVE, + _mp_player_view_progressbar_move_cb, + view); endfunc; } static void -_mp_player_view_play_btn_down_cb(void *data, Evas_Object *obj, const char *emission, const char *source) +_mp_player_view_play_btn_down_cb(void *data, Evas_Object * obj, + const char *emission, const char *source) { startfunc; return; } static void -_mp_player_view_play_btn_up_cb(void *data, Evas_Object *obj, const char *emission, const char *source) +_mp_player_view_play_btn_up_cb(void *data, Evas_Object * obj, + const char *emission, const char *source) { startfunc; return; } static void -_mp_player_view_lyric_del_cb(void *data, Evas * e, Evas_Object * obj, void *event_info) +_mp_player_view_lyric_del_cb(void *data, Evas * e, Evas_Object * obj, + void *event_info) { startfunc; MpPlayerView_t *view = data; @@ -2068,7 +2375,7 @@ _mp_player_view_lyric_del_cb(void *data, Evas * e, Evas_Object * obj, void *even static bool _mp_player_view_show_lyric(void *data) { - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK_FALSE(view); CHECK_VIEW(view); @@ -2077,48 +2384,58 @@ static bool _mp_player_view_show_lyric(void *data) return false; } - /*lyric not exist in side cast*/ + /*lyric not exist in side cast */ struct appdata *ad = mp_util_get_appdata(); MP_CHECK_FALSE(ad); MP_CHECK_FALSE(ad->current_track_info); if (!ad->b_show_lyric || !view->show_lyric) { mp_debug("set hide state"); - edje_object_signal_emit(_EDJ(view->player_view_layout), "lrc_invisible", "lrc"); + edje_object_signal_emit(_EDJ(view->player_view_layout), + "lrc_invisible", "lrc"); } else { mp_debug("set show state"); - if (g_strcmp0(mp_lyric_get_path(view->lyric), ad->current_track_info->uri)) { + if (g_strcmp0 + (mp_lyric_get_path(view->lyric), + ad->current_track_info->uri)) { evas_object_del(view->lyric); } if (!view->lyric) { - view->lyric = mp_lyric_create(view->layout, ad->current_track_info->uri); + view->lyric = + mp_lyric_create(view->layout, ad->current_track_info->uri); if (view->lyric) { - elm_object_part_content_set(view->player_view_layout, "lrc", view->lyric); - evas_object_event_callback_add(view->lyric, EVAS_CALLBACK_FREE, _mp_player_view_lyric_del_cb, - view); - edje_object_signal_emit(_EDJ(view->player_view_layout), "lrc_visible", "lrc"); + elm_object_part_content_set(view->player_view_layout, + "lrc", view->lyric); + evas_object_event_callback_add(view->lyric, + EVAS_CALLBACK_FREE, + _mp_player_view_lyric_del_cb, + view); + edje_object_signal_emit(_EDJ(view->player_view_layout), + "lrc_visible", "lrc"); } else { - edje_object_signal_emit(_EDJ(view->player_view_layout), "lrc_invisible", "lrc"); + edje_object_signal_emit(_EDJ(view->player_view_layout), + "lrc_invisible", "lrc"); } } else { - edje_object_signal_emit(_EDJ(view->player_view_layout), "lrc_visible", "lrc"); + edje_object_signal_emit(_EDJ(view->player_view_layout), + "lrc_visible", "lrc"); } } return true; } -void -mp_player_view_update_dmr_icon(MpPlayerView_t *view) +void mp_player_view_update_dmr_icon(MpPlayerView_t * view) { startfunc; MP_CHECK(view); CHECK_VIEW(view); MP_CHECK(view->inner_navi_it); MP_CHECK(view->dmr_button); - Evas_Object *ic = elm_object_part_content_get(view->dmr_button, "icon"); + Evas_Object *ic = + elm_object_part_content_get(view->dmr_button, "icon"); MP_CHECK(ic); struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); @@ -2136,33 +2453,43 @@ mp_player_view_update_dmr_icon(MpPlayerView_t *view) } static void -_mp_player_view_ff_rew_btn_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +_mp_player_view_ff_rew_btn_del_cb(void *data, Evas * e, Evas_Object * obj, + void *event_info) { startfunc; mp_play_control_reset_ff_rew(); } -static void _mp_player_view_volume_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_player_view_volume_btn_clicked_cb(void *data, + Evas_Object * obj, + void *event_info) { DEBUG_TRACE("volume button clicked"); - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); mp_player_view_volume_popup_control(view, false); } -static void _mp_player_view_play_pause_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_player_view_play_pause_btn_clicked_cb(void *data, + Evas_Object * obj, + void *event_info) { DEBUG_TRACE("play_pause button clicked"); struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); if (_mp_is_current_focus_available(ad) != 0) { - ERROR_TRACE("Some other application has the focus currently... Returning..."); + ERROR_TRACE + ("Some other application has the focus currently... Returning..."); char *message = STR_MP_UNABLE_TO_PLAY_DURING_CALL; if (message) { - int ret = notification_status_message_post(dgettext("music-player", message)); + int ret = + notification_status_message_post(dgettext + ("music-player", + message)); if (ret != 0) { - ERROR_TRACE("notification_status_message_post()... [0x%x]", ret); + ERROR_TRACE("notification_status_message_post()... [0x%x]", + ret); } else { DEBUG_TRACE("message: [%s]", message); } @@ -2170,7 +2497,7 @@ static void _mp_player_view_play_pause_btn_clicked_cb(void *data, Evas_Object *o return; } - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); if (ad->player_state == PLAY_STATE_NONE && ad->music_pos > 0) { @@ -2183,7 +2510,7 @@ static void _mp_player_view_play_pause_btn_clicked_cb(void *data, Evas_Object *o mp_player_view_set_play_image(view, false); } else { mp_play_control_play_pause(ad, true); - /*when player mgr resume failed*/ + /*when player mgr resume failed */ if (ad->player_state != PLAY_STATE_PLAYING) { mp_player_view_set_play_image(view, false); } else { @@ -2193,10 +2520,12 @@ static void _mp_player_view_play_pause_btn_clicked_cb(void *data, Evas_Object *o } #ifndef MP_SOUND_PLAYER -static void _mp_player_view_shuffle_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_player_view_shuffle_btn_clicked_cb(void *data, + Evas_Object * obj, + void *event_info) { DEBUG_TRACE("shuffle button clicked"); - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); struct appdata *ad = mp_util_get_appdata(); @@ -2210,10 +2539,12 @@ static void _mp_player_view_shuffle_btn_clicked_cb(void *data, Evas_Object *obj, mp_view_mgr_post_event(GET_VIEW_MGR, MP_UPDATE_NOW_PLAYING); } -static void _mp_player_view_favor_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_player_view_favor_btn_clicked_cb(void *data, + Evas_Object * obj, + void *event_info) { DEBUG_TRACE("favor button clicked"); - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); struct appdata *ad = mp_util_get_appdata(); @@ -2230,13 +2561,15 @@ static void _mp_player_view_favor_btn_clicked_cb(void *data, Evas_Object *obj, v mp_media_info_destroy(favourite_handle); } -static void _mp_player_view_repeat_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_player_view_repeat_btn_clicked_cb(void *data, + Evas_Object * obj, + void *event_info) { DEBUG_TRACE("repeat button clicked"); struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); int repeat_state = 0; @@ -2249,7 +2582,9 @@ static void _mp_player_view_repeat_btn_clicked_cb(void *data, Evas_Object *obj, mp_view_mgr_post_event(GET_VIEW_MGR, MP_UPDATE_NOW_PLAYING); } -static void _mp_player_view_prev_btn_pressed_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_player_view_prev_btn_pressed_cb(void *data, + Evas_Object * obj, + void *event_info) { DEBUG_TRACE("prev button pressed"); @@ -2257,20 +2592,25 @@ static void _mp_player_view_prev_btn_pressed_cb(void *data, Evas_Object *obj, vo MP_CHECK(ad); if (_mp_is_current_focus_available(ad) != 0) { - ERROR_TRACE("Some other application has the focus currently... Changing state in paused state..."); + ERROR_TRACE + ("Some other application has the focus currently... Changing state in paused state..."); ad->paused_by_user = TRUE; } mp_play_control_rew(true, false, true); } -static void _mp_player_view_prev_btn_unpressed_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_player_view_prev_btn_unpressed_cb(void *data, + Evas_Object * obj, + void *event_info) { DEBUG_TRACE("prev button unpressed"); mp_play_control_rew(false, false, true); } -static void _mp_player_view_prev_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_player_view_prev_btn_clicked_cb(void *data, + Evas_Object * obj, + void *event_info) { DEBUG_TRACE("prev button clicked"); if (elm_config_access_get()) { @@ -2278,7 +2618,9 @@ static void _mp_player_view_prev_btn_clicked_cb(void *data, Evas_Object *obj, vo } } -static void _mp_player_view_next_btn_pressed_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_player_view_next_btn_pressed_cb(void *data, + Evas_Object * obj, + void *event_info) { DEBUG_TRACE("next button pressed"); @@ -2286,7 +2628,8 @@ static void _mp_player_view_next_btn_pressed_cb(void *data, Evas_Object *obj, vo MP_CHECK(ad); if (_mp_is_current_focus_available(ad) != 0) { - ERROR_TRACE("Some other application has the focus currently... Changing state in paused state..."); + ERROR_TRACE + ("Some other application has the focus currently... Changing state in paused state..."); ad->paused_by_user = TRUE; } @@ -2294,13 +2637,17 @@ static void _mp_player_view_next_btn_pressed_cb(void *data, Evas_Object *obj, vo } -static void _mp_player_view_next_btn_unpressed_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_player_view_next_btn_unpressed_cb(void *data, + Evas_Object * obj, + void *event_info) { DEBUG_TRACE("next button unpressed"); mp_play_control_ff(false, false, true); } -static void _mp_player_view_next_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_player_view_next_btn_clicked_cb(void *data, + Evas_Object * obj, + void *event_info) { DEBUG_TRACE("next button clicked"); if (elm_config_access_get()) { @@ -2308,10 +2655,12 @@ static void _mp_player_view_next_btn_clicked_cb(void *data, Evas_Object *obj, vo } } -static void _mp_player_view_queue_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_player_view_queue_btn_clicked_cb(void *data, + Evas_Object * obj, + void *event_info) { DEBUG_TRACE("queue button clicked"); - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); MP_CHECK(!view->trans_queue_list); @@ -2326,9 +2675,12 @@ static void _mp_player_view_queue_btn_clicked_cb(void *data, Evas_Object *obj, v } #endif -static Evas_Object *_mp_player_add_btn(void *data, Evas_Object *parent, Evas_Object *btn, char *button_style, char *part, Edje_Signal_Cb func) +static Evas_Object *_mp_player_add_btn(void *data, Evas_Object * parent, + Evas_Object * btn, + char *button_style, char *part, + Edje_Signal_Cb func) { - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK_NULL(view); MP_CHECK_NULL(parent); @@ -2338,12 +2690,20 @@ static Evas_Object *_mp_player_add_btn(void *data, Evas_Object *parent, Evas_Obj elm_object_style_set(btn, button_style); evas_object_show(btn); - if (!g_strcmp0(part, "control_previous") || !g_strcmp0(part, "control_next")) { - elm_object_signal_callback_add(btn, SIGNAL_MOUSE_DOWN, "*", _mp_player_view_play_btn_down_cb, view); - elm_object_signal_callback_add(btn, SIGNAL_MOUSE_UP, "*", _mp_player_view_play_btn_up_cb, view); - evas_object_event_callback_add(btn, EVAS_CALLBACK_DEL, _mp_player_view_ff_rew_btn_del_cb, view); + if (!g_strcmp0(part, "control_previous") + || !g_strcmp0(part, "control_next")) { + elm_object_signal_callback_add(btn, SIGNAL_MOUSE_DOWN, "*", + _mp_player_view_play_btn_down_cb, + view); + elm_object_signal_callback_add(btn, SIGNAL_MOUSE_UP, "*", + _mp_player_view_play_btn_up_cb, + view); + evas_object_event_callback_add(btn, EVAS_CALLBACK_DEL, + _mp_player_view_ff_rew_btn_del_cb, + view); } else { - elm_object_signal_callback_add(btn, SIGNAL_MOUSE_CLICK, "*", func, data); + elm_object_signal_callback_add(btn, SIGNAL_MOUSE_CLICK, "*", func, + data); } elm_object_part_content_set(parent, part, btn); return btn; @@ -2352,83 +2712,151 @@ static Evas_Object *_mp_player_add_btn(void *data, Evas_Object *parent, Evas_Obj static void _mp_player_view_add_callbacks(void *data) { startfunc; - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); CHECK_VIEW(view); struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); - view->player_view_option_layout = mp_common_load_edj(view->player_view_layout, PLAY_VIEW_EDJ_NAME, "player_view_option_area"); - evas_object_size_hint_align_set(view->player_view_option_layout, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(view->player_view_option_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_object_part_content_set(view->player_view_layout, "options_area", view->player_view_option_layout); + view->player_view_option_layout = + mp_common_load_edj(view->player_view_layout, PLAY_VIEW_EDJ_NAME, + "player_view_option_area"); + evas_object_size_hint_align_set(view->player_view_option_layout, + EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(view->player_view_option_layout, + EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(view->player_view_layout, "options_area", + view->player_view_option_layout); evas_object_show(view->player_view_option_layout); MP_CHECK(view->player_view_option_layout); - view->player_view_control_layout = mp_common_load_edj(view->player_view_layout, PLAY_VIEW_EDJ_NAME, "player_view_control_area"); - evas_object_size_hint_align_set(view->player_view_control_layout, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(view->player_view_control_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_object_part_content_set(view->player_view_layout, "control_area", view->player_view_control_layout); + view->player_view_control_layout = + mp_common_load_edj(view->player_view_layout, PLAY_VIEW_EDJ_NAME, + "player_view_control_area"); + evas_object_size_hint_align_set(view->player_view_control_layout, + EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(view->player_view_control_layout, + EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(view->player_view_layout, "control_area", + view->player_view_control_layout); evas_object_show(view->player_view_control_layout); - mp_util_domain_translatable_part_text_set(view->player_view_option_layout, "volume_text", STR_PLAYER_VIEW_VOLUME); + mp_util_domain_translatable_part_text_set(view-> + player_view_option_layout, + "volume_text", + STR_PLAYER_VIEW_VOLUME); MP_CHECK(view->player_view_control_layout); #ifndef MP_SOUND_PLAYER if (view->launch_type == MP_PLAYER_NORMAL) { - view->control_button[CONTROL_SHUFFLE_ON] = _mp_player_add_btn(data, view->player_view_control_layout, view->control_button[CONTROL_SHUFFLE_ON], "music/shuffle_on", - "control_shuffle_on", _mp_player_view_option_btn_click_cb); - view->control_button[CONTROL_SHUFFLE_OFF] = _mp_player_add_btn(data, view->player_view_control_layout, view->control_button[CONTROL_SHUFFLE_OFF], "music/shuffle_off", - "control_shuffle_off", _mp_player_view_option_btn_click_cb); - - view->control_button[CONTROL_REP_A] = _mp_player_add_btn(data, view->player_view_control_layout, view->control_button[CONTROL_REP_A], "music/rep_A", - "control_rep_A", _mp_player_view_option_btn_click_cb); - view->control_button[CONTROL_REP_1] = _mp_player_add_btn(data, view->player_view_control_layout, view->control_button[CONTROL_REP_1], "music/rep_1", - "control_rep_1", _mp_player_view_option_btn_click_cb); - view->control_button[CONTROL_REP_ALL] = _mp_player_add_btn(data, view->player_view_control_layout, view->control_button[CONTROL_REP_ALL], "music/rep_all", - "control_rep_all", _mp_player_view_option_btn_click_cb); - } - - view->option_button[OPTION_FAVO_ON] = _mp_player_add_btn(data, view->player_view_layout, view->option_button[OPTION_FAVO_ON], "music/favourite_on", - "options_favourite_on", _mp_player_view_option_btn_click_cb); - view->option_button[OPTION_FAVO_OFF] = _mp_player_add_btn(data, view->player_view_layout, view->option_button[OPTION_FAVO_OFF], "music/favourite_off", - "options_favourite_off", _mp_player_view_option_btn_click_cb); + view->control_button[CONTROL_SHUFFLE_ON] = + _mp_player_add_btn(data, view->player_view_control_layout, + view->control_button[CONTROL_SHUFFLE_ON], + "music/shuffle_on", "control_shuffle_on", + _mp_player_view_option_btn_click_cb); + view->control_button[CONTROL_SHUFFLE_OFF] = + _mp_player_add_btn(data, view->player_view_control_layout, + view->control_button[CONTROL_SHUFFLE_OFF], + "music/shuffle_off", "control_shuffle_off", + _mp_player_view_option_btn_click_cb); + + view->control_button[CONTROL_REP_A] = + _mp_player_add_btn(data, view->player_view_control_layout, + view->control_button[CONTROL_REP_A], + "music/rep_A", "control_rep_A", + _mp_player_view_option_btn_click_cb); + view->control_button[CONTROL_REP_1] = + _mp_player_add_btn(data, view->player_view_control_layout, + view->control_button[CONTROL_REP_1], + "music/rep_1", "control_rep_1", + _mp_player_view_option_btn_click_cb); + view->control_button[CONTROL_REP_ALL] = + _mp_player_add_btn(data, view->player_view_control_layout, + view->control_button[CONTROL_REP_ALL], + "music/rep_all", "control_rep_all", + _mp_player_view_option_btn_click_cb); + } + + view->option_button[OPTION_FAVO_ON] = + _mp_player_add_btn(data, view->player_view_layout, + view->option_button[OPTION_FAVO_ON], + "music/favourite_on", "options_favourite_on", + _mp_player_view_option_btn_click_cb); + view->option_button[OPTION_FAVO_OFF] = + _mp_player_add_btn(data, view->player_view_layout, + view->option_button[OPTION_FAVO_OFF], + "music/favourite_off", "options_favourite_off", + _mp_player_view_option_btn_click_cb); #else if (ad->samsung_link) { - view->control_button[CONTROL_SHUFFLE_ON] = _mp_player_add_btn(data, view->player_view_control_layout, view->control_button[CONTROL_SHUFFLE_ON], "music/shuffle_on", - "control_shuffle_on", _mp_player_view_option_btn_click_cb); - view->control_button[CONTROL_SHUFFLE_OFF] = _mp_player_add_btn(data, view->player_view_control_layout, view->control_button[CONTROL_SHUFFLE_OFF], "music/shuffle_off", - "control_shuffle_off", _mp_player_view_option_btn_click_cb); - view->control_button[CONTROL_REP_A] = _mp_player_add_btn(data, view->player_view_control_layout, view->control_button[CONTROL_REP_A], "music/rep_A", - "control_rep_A", _mp_player_view_option_btn_click_cb); - view->control_button[CONTROL_REP_1] = _mp_player_add_btn(data, view->player_view_control_layout, view->control_button[CONTROL_REP_1], "music/rep_1", - "control_rep_1", _mp_player_view_option_btn_click_cb); - view->control_button[CONTROL_REP_ALL] = _mp_player_add_btn(data, view->player_view_control_layout, view->control_button[CONTROL_REP_ALL], "music/rep_all", - "control_rep_all", _mp_player_view_option_btn_click_cb); + view->control_button[CONTROL_SHUFFLE_ON] = + _mp_player_add_btn(data, view->player_view_control_layout, + view->control_button[CONTROL_SHUFFLE_ON], + "music/shuffle_on", "control_shuffle_on", + _mp_player_view_option_btn_click_cb); + view->control_button[CONTROL_SHUFFLE_OFF] = + _mp_player_add_btn(data, view->player_view_control_layout, + view->control_button[CONTROL_SHUFFLE_OFF], + "music/shuffle_off", "control_shuffle_off", + _mp_player_view_option_btn_click_cb); + view->control_button[CONTROL_REP_A] = + _mp_player_add_btn(data, view->player_view_control_layout, + view->control_button[CONTROL_REP_A], + "music/rep_A", "control_rep_A", + _mp_player_view_option_btn_click_cb); + view->control_button[CONTROL_REP_1] = + _mp_player_add_btn(data, view->player_view_control_layout, + view->control_button[CONTROL_REP_1], + "music/rep_1", "control_rep_1", + _mp_player_view_option_btn_click_cb); + view->control_button[CONTROL_REP_ALL] = + _mp_player_add_btn(data, view->player_view_control_layout, + view->control_button[CONTROL_REP_ALL], + "music/rep_all", "control_rep_all", + _mp_player_view_option_btn_click_cb); } #endif - view->option_button[OPTION_VOLUME] = _mp_player_add_btn(data, view->player_view_option_layout, view->option_button[OPTION_VOLUME], "music/control_volume", - "options_volume", _mp_player_view_option_btn_click_cb); - view->option_button[OPTION_VOLUME_MUTE] = _mp_player_add_btn(data, view->player_view_option_layout, view->option_button[OPTION_VOLUME], "music/control_volume_mute", - "options_volume_mute", _mp_player_view_option_btn_click_cb); + view->option_button[OPTION_VOLUME] = + _mp_player_add_btn(data, view->player_view_option_layout, + view->option_button[OPTION_VOLUME], + "music/control_volume", "options_volume", + _mp_player_view_option_btn_click_cb); + view->option_button[OPTION_VOLUME_MUTE] = + _mp_player_add_btn(data, view->player_view_option_layout, + view->option_button[OPTION_VOLUME], + "music/control_volume_mute", + "options_volume_mute", + _mp_player_view_option_btn_click_cb); #ifndef MP_SOUND_PLAYER if (view->launch_type == MP_PLAYER_NORMAL) { - view->control_button[CONTROL_PREVIOUS] = _mp_player_add_btn(data, view->player_view_control_layout, view->control_button[CONTROL_PREVIOUS], "music/control_previous", - "control_previous", NULL); + view->control_button[CONTROL_PREVIOUS] = + _mp_player_add_btn(data, view->player_view_control_layout, + view->control_button[CONTROL_PREVIOUS], + "music/control_previous", + "control_previous", NULL); } #endif - view->control_button[CONTROL_PLAY] = _mp_player_add_btn(data, view->player_view_control_layout, view->control_button[CONTROL_PLAY], "music/control_play", - "control_play", _mp_player_view_option_btn_click_cb); - view->control_button[CONTROL_PAUSE] = _mp_player_add_btn(data, view->player_view_control_layout, view->control_button[CONTROL_PAUSE], "music/control_pause", - "control_pause", _mp_player_view_option_btn_click_cb); + view->control_button[CONTROL_PLAY] = + _mp_player_add_btn(data, view->player_view_control_layout, + view->control_button[CONTROL_PLAY], + "music/control_play", "control_play", + _mp_player_view_option_btn_click_cb); + view->control_button[CONTROL_PAUSE] = + _mp_player_add_btn(data, view->player_view_control_layout, + view->control_button[CONTROL_PAUSE], + "music/control_pause", "control_pause", + _mp_player_view_option_btn_click_cb); #ifndef MP_SOUND_PLAYER - if (view->launch_type == MP_PLAYER_NORMAL || view->launch_type == MP_PLAYER_ARTIST_PLAY) { - view->control_button[CONTROL_NEXT] = _mp_player_add_btn(data, view->player_view_control_layout, view->control_button[CONTROL_NEXT], "music/control_next", - "control_next", NULL); + if (view->launch_type == MP_PLAYER_NORMAL + || view->launch_type == MP_PLAYER_ARTIST_PLAY) { + view->control_button[CONTROL_NEXT] = + _mp_player_add_btn(data, view->player_view_control_layout, + view->control_button[CONTROL_NEXT], + "music/control_next", "control_next", NULL); } #endif @@ -2438,8 +2866,12 @@ static void _mp_player_view_add_callbacks(void *data) #ifndef MP_SOUND_PLAYER if (view->launch_type == MP_PLAYER_NORMAL) { - _mp_player_view_set_rep_image(view, mp_playlist_mgr_get_repeat(ad->playlist_mgr)); - _mp_player_view_set_shuffle_image(view, mp_playlist_mgr_get_shuffle(ad->playlist_mgr)); + _mp_player_view_set_rep_image(view, + mp_playlist_mgr_get_repeat(ad-> + playlist_mgr)); + _mp_player_view_set_shuffle_image(view, + mp_playlist_mgr_get_shuffle(ad-> + playlist_mgr)); } #endif @@ -2453,15 +2885,15 @@ static void _mp_player_view_add_callbacks(void *data) endfunc; } -static void -_mp_player_view_resume_view_status(void *data) +static void _mp_player_view_resume_view_status(void *data) { startfunc; - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); mp_player_view_update_progressbar(view); - mp_volume_key_grab_condition_set(MP_VOLUME_KEY_GRAB_COND_VIEW_VISIBLE, true); + mp_volume_key_grab_condition_set(MP_VOLUME_KEY_GRAB_COND_VIEW_VISIBLE, + true); mp_player_view_update_state(view); int volume = mp_player_mgr_volume_get_current(); @@ -2470,11 +2902,10 @@ _mp_player_view_resume_view_status(void *data) } } -static void -_mp_player_view_start_request(void *data) +static void _mp_player_view_start_request(void *data) { startfunc; - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); CHECK_VIEW(view); @@ -2485,14 +2916,14 @@ _mp_player_view_start_request(void *data) ad->paused_by_user = FALSE; /*_mp_player_view_init_progress_bar(data);*/ if (view->start_new_file) { - /*start to play from start of the file*/ + /*start to play from start of the file */ ad->start_after_effect = TRUE; int ret = mp_play_new_file(ad, TRUE); if (ret) { ERROR_TRACE("Error: mp_play_new_file.."); } } else { - /*resume play here*/ + /*resume play here */ _mp_player_view_resume_view_status(view); mp_play_control_play_pause(ad, true); } @@ -2504,11 +2935,10 @@ _mp_player_view_start_request(void *data) return; } -static void -_mp_player_view_eventbox_clicked_cb(void *data) +static void _mp_player_view_eventbox_clicked_cb(void *data) { startfunc; - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); CHECK_VIEW(view); @@ -2524,22 +2954,20 @@ _mp_player_view_eventbox_clicked_cb(void *data) _mp_player_view_show_lyric(view); } -static void -_mp_player_view_eventbox_flick_left_cb(void *data) +static void _mp_player_view_eventbox_flick_left_cb(void *data) { startfunc; - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); CHECK_VIEW(view); _mp_player_view_transit_by_item(view, PLAYER_VIEW_MOVE_LEFT); } -static void -_mp_player_view_eventbox_flick_right_cb(void *data) +static void _mp_player_view_eventbox_flick_right_cb(void *data) { startfunc; - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); CHECK_VIEW(view); @@ -2549,7 +2977,7 @@ _mp_player_view_eventbox_flick_right_cb(void *data) static void _mp_player_view_add_event_box(void *data) { startfunc; - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); CHECK_VIEW(view); MP_CHECK(view->player_view_layout); @@ -2557,24 +2985,35 @@ static void _mp_player_view_add_event_box(void *data) struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); - Evas_Object *event_box = mp_smart_event_box_add(view->player_view_layout); + Evas_Object *event_box = + mp_smart_event_box_add(view->player_view_layout); MP_CHECK(event_box); - evas_object_size_hint_weight_set(event_box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(event_box, EVAS_HINT_FILL, EVAS_HINT_FILL); - - mp_smart_event_box_callback_add(event_box, MP_EVENT_CLICK, _mp_player_view_eventbox_clicked_cb, view); - mp_smart_event_box_callback_add(event_box, MP_EVENT_LEFT, _mp_player_view_eventbox_flick_left_cb, view); - mp_smart_event_box_callback_add(event_box, MP_EVENT_RIGHT, _mp_player_view_eventbox_flick_right_cb, view); + evas_object_size_hint_weight_set(event_box, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(event_box, EVAS_HINT_FILL, + EVAS_HINT_FILL); + + mp_smart_event_box_callback_add(event_box, MP_EVENT_CLICK, + _mp_player_view_eventbox_clicked_cb, + view); + mp_smart_event_box_callback_add(event_box, MP_EVENT_LEFT, + _mp_player_view_eventbox_flick_left_cb, + view); + mp_smart_event_box_callback_add(event_box, MP_EVENT_RIGHT, + _mp_player_view_eventbox_flick_right_cb, + view); evas_object_show(event_box); - elm_object_part_content_set(view->player_view_layout, "event_box", event_box); + elm_object_part_content_set(view->player_view_layout, "event_box", + event_box); endfunc; } #define PLAYER_LD_RIGHT_W 560 -static void _ld_layout_resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +static void _ld_layout_resize_cb(void *data, Evas * e, Evas_Object * obj, + void *event_info) { MP_CHECK(obj); int w, h; @@ -2592,7 +3031,7 @@ static void _ld_layout_resize_cb(void *data, Evas *e, Evas_Object *obj, void *ev static void _mp_player_view_content_layout_load(void *thiz) { startfunc; - MpPlayerView_t *view = (MpPlayerView_t *)thiz; + MpPlayerView_t *view = (MpPlayerView_t *) thiz; MP_CHECK(view); CHECK_VIEW(view); @@ -2602,78 +3041,106 @@ static void _mp_player_view_content_layout_load(void *thiz) bool landscape = mp_util_is_landscape(); Evas_Object *lyric = NULL; - /*To reuse lyric*/ + /*To reuse lyric */ if (view->player_view_layout) { - lyric = elm_object_part_content_unset(view->player_view_layout, "lrc"); + lyric = + elm_object_part_content_unset(view->player_view_layout, "lrc"); } if (landscape) { DEBUG_TRACE("mode orientation 270 or 90"); /* - -naviframe - - layout - - player_view_ld - - albumart - - inner naviframe - - options - - controls - */ - - view->player_view_layout = mp_common_load_edj(view->layout, PLAY_VIEW_EDJ_NAME, "player_view_ld"); - evas_object_event_callback_add(view->player_view_layout, EVAS_CALLBACK_RESIZE, _ld_layout_resize_cb, view); - elm_object_part_content_set(view->layout, "list_content", view->player_view_layout); - view->inner_naviframe = mp_widget_navigation_new(view->player_view_layout); + -naviframe + - layout + - player_view_ld + - albumart + - inner naviframe + - options + - controls + */ + + view->player_view_layout = + mp_common_load_edj(view->layout, PLAY_VIEW_EDJ_NAME, + "player_view_ld"); + evas_object_event_callback_add(view->player_view_layout, + EVAS_CALLBACK_RESIZE, + _ld_layout_resize_cb, view); + elm_object_part_content_set(view->layout, "list_content", + view->player_view_layout); + view->inner_naviframe = + mp_widget_navigation_new(view->player_view_layout); MP_CHECK(view->inner_naviframe); - evas_object_size_hint_min_set(view->inner_naviframe, SCALED_SIZE(PLAYER_LD_RIGHT_W), 0); + evas_object_size_hint_min_set(view->inner_naviframe, + SCALED_SIZE(PLAYER_LD_RIGHT_W), 0); elm_object_focus_set(view->inner_naviframe, FALSE); elm_object_focus_allow_set(view->inner_naviframe, FALSE); - view->inner_navi_it = elm_naviframe_item_push(view->inner_naviframe, NULL, NULL, NULL, NULL, NAVIFRAME_PLAYER_VIEW); + view->inner_navi_it = + elm_naviframe_item_push(view->inner_naviframe, NULL, NULL, + NULL, NULL, NAVIFRAME_PLAYER_VIEW); MP_CHECK(view->player_view_layout); - elm_object_part_content_set(view->layout, "list_content", view->player_view_layout); + elm_object_part_content_set(view->layout, "list_content", + view->player_view_layout); - /*cast side has not right title*/ - elm_object_part_content_set(view->player_view_layout, "right_title", view->inner_naviframe); + /*cast side has not right title */ + elm_object_part_content_set(view->player_view_layout, + "right_title", view->inner_naviframe); - view->progress_box = mp_common_load_edj(view->player_view_layout, PLAY_VIEW_EDJ_NAME, "player_view_progress_box_ld"); + view->progress_box = + mp_common_load_edj(view->player_view_layout, + PLAY_VIEW_EDJ_NAME, + "player_view_progress_box_ld"); MP_CHECK(view->progress_box); - elm_object_part_content_set(view->player_view_layout, "progress_box", view->progress_box); - view->progress_bar = mp_common_load_edj(view->progress_box, PLAY_VIEW_EDJ_NAME, "player_progressbar"); + elm_object_part_content_set(view->player_view_layout, + "progress_box", view->progress_box); + view->progress_bar = + mp_common_load_edj(view->progress_box, PLAY_VIEW_EDJ_NAME, + "player_progressbar"); MP_CHECK(view->progress_bar); - elm_object_part_content_set(view->progress_box, "progress_bar", view->progress_bar); + elm_object_part_content_set(view->progress_box, "progress_bar", + view->progress_bar); } else { DEBUG_TRACE("mode orientation 0"); /* - -naviframe - - inner_naviframe - - player_view_portrait_base - - albumart - - options - - controls - */ + -naviframe + - inner_naviframe + - player_view_portrait_base + - albumart + - options + - controls + */ view->inner_naviframe = mp_widget_navigation_new(view->layout); MP_CHECK(view->inner_naviframe); elm_object_focus_set(view->inner_naviframe, FALSE); elm_object_focus_allow_set(view->inner_naviframe, FALSE); - view->player_view_layout = mp_common_load_edj(view->inner_naviframe, PLAY_VIEW_EDJ_NAME, "player_view_portrait_base"); + view->player_view_layout = + mp_common_load_edj(view->inner_naviframe, PLAY_VIEW_EDJ_NAME, + "player_view_portrait_base"); MP_CHECK(view->player_view_layout); - view->inner_navi_it = elm_naviframe_item_push(view->inner_naviframe, NULL, NULL, NULL, view->player_view_layout, NAVIFRAME_PLAYER_VIEW); - elm_naviframe_item_title_enabled_set(view->inner_navi_it, FALSE, FALSE); - - Evas_Object *content = elm_object_part_content_unset(view->layout, "list_content"); + view->inner_navi_it = + elm_naviframe_item_push(view->inner_naviframe, NULL, NULL, + NULL, view->player_view_layout, + NAVIFRAME_PLAYER_VIEW); + elm_naviframe_item_title_enabled_set(view->inner_navi_it, FALSE, + FALSE); + + Evas_Object *content = + elm_object_part_content_unset(view->layout, "list_content"); mp_evas_object_del(content); - elm_object_part_content_set(view->layout, "list_content", view->inner_naviframe); + elm_object_part_content_set(view->layout, "list_content", + view->inner_naviframe); } elm_object_focus_allow_set(view->inner_naviframe, TRUE); - /* reuse lyric*/ + /* reuse lyric */ if (lyric) { - elm_object_part_content_set(view->player_view_layout, "lrc", lyric); + elm_object_part_content_set(view->player_view_layout, "lrc", + lyric); } /* album image */ @@ -2693,8 +3160,12 @@ static void _mp_player_view_content_layout_load(void *thiz) _mp_player_view_add_callbacks(view); /* set TTS fous frame order */ - elm_object_focus_custom_chain_append(view->player_view_layout, view->player_view_option_layout, NULL); - elm_object_focus_custom_chain_append(view->player_view_layout, view->player_view_control_layout, NULL); + elm_object_focus_custom_chain_append(view->player_view_layout, + view->player_view_option_layout, + NULL); + elm_object_focus_custom_chain_append(view->player_view_layout, + view->player_view_control_layout, + NULL); _mp_player_view_set_focused_UI(view); endfunc; @@ -2733,7 +3204,8 @@ static int _mp_player_view_stop_playback(void *thiz) MpPlayerView_t *view = thiz; mp_ecore_timer_del(view->stop_update_timer); - view->stop_update_timer = ecore_timer_add(1.0, _mp_player_view_stop_timer_cb, view); + view->stop_update_timer = + ecore_timer_add(1.0, _mp_player_view_stop_timer_cb, view); return 0; } @@ -2741,7 +3213,8 @@ static int _mp_player_view_stop_playback(void *thiz) static void _mp_player_view_resume(void *thiz) { startfunc; - mp_volume_key_grab_condition_set(MP_VOLUME_KEY_GRAB_COND_VIEW_VISIBLE, true); + mp_volume_key_grab_condition_set(MP_VOLUME_KEY_GRAB_COND_VIEW_VISIBLE, + true); mp_player_view_progress_timer_thaw(thiz); _mp_player_view_show_lyric(thiz); @@ -2767,18 +3240,18 @@ static void _mp_player_view_pause(void *thiz) mp_player_view_set_title(thiz); } - mp_volume_key_grab_condition_set(MP_VOLUME_KEY_GRAB_COND_VIEW_VISIBLE, false); + mp_volume_key_grab_condition_set(MP_VOLUME_KEY_GRAB_COND_VIEW_VISIBLE, + false); mp_player_view_progress_timer_freeze(thiz); endfunc; } -static Eina_Bool -_transit_complete_timer(void *data) +static Eina_Bool _transit_complete_timer(void *data) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK_FALSE(ad); - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK_FALSE(view); MP_CHECK_FALSE(view->player_view_layout); @@ -2789,46 +3262,58 @@ _transit_complete_timer(void *data) } static void -_mp_player_view_transit_by_item_complete_cb(void *data, Elm_Transit *transit) +_mp_player_view_transit_by_item_complete_cb(void *data, + Elm_Transit * transit) { startfunc; - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); view->transition_state = false; - /* TODO: create image and set as default*/ + /* TODO: create image and set as default */ Evas_Object *image = NULL; if (view->move_direction == PLAYER_VIEW_MOVE_LEFT) { - image = elm_object_part_content_unset(view->player_view_layout, "album_image_right"); + image = + elm_object_part_content_unset(view->player_view_layout, + "album_image_right"); } else { - image = elm_object_part_content_unset(view->player_view_layout, "album_image_left"); + image = + elm_object_part_content_unset(view->player_view_layout, + "album_image_left"); } - elm_object_part_content_set(view->player_view_layout, "album_image", image); + elm_object_part_content_set(view->player_view_layout, "album_image", + image); mp_ecore_timer_del(view->transit_done_timer); mp_player_view_refresh(view); - view->transit_done_timer = ecore_timer_add(0.5, _transit_complete_timer, view); + view->transit_done_timer = + ecore_timer_add(0.5, _transit_complete_timer, view); } -static Evas_Object * -_mp_player_view_create_album_image(Evas_Object *obj, const char *path, int w, int h) +static Evas_Object *_mp_player_view_create_album_image(Evas_Object * obj, + const char *path, + int w, int h) { int width, height; - Evas_Object *thumbnail = evas_object_image_add(evas_object_evas_get(obj)); + Evas_Object *thumbnail = + evas_object_image_add(evas_object_evas_get(obj)); MP_CHECK_FALSE(thumbnail); - evas_object_size_hint_align_set(thumbnail, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(thumbnail, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(thumbnail, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_size_hint_weight_set(thumbnail, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); evas_object_image_load_size_set(thumbnail, w, h); if (path && strcmp(BROKEN_ALBUMART_IMAGE_PATH, path)) { evas_object_image_file_set(thumbnail, path, NULL); } else { - char default_thumbnail[1024] = {0}; + char default_thumbnail[1024] = { 0 }; char *shared_path = app_get_shared_resource_path(); - snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, "shared_images", DEFAULT_PLAYER_THUMBNAIL); + snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, + "shared_images", DEFAULT_PLAYER_THUMBNAIL); free(shared_path); evas_object_image_file_set(thumbnail, default_thumbnail, NULL); } @@ -2837,20 +3322,22 @@ _mp_player_view_create_album_image(Evas_Object *obj, const char *path, int w, in evas_object_image_filled_set(thumbnail, true); if (width <= 0 || height <= 0) { - char default_thumbnail[1024] = {0}; + char default_thumbnail[1024] = { 0 }; char *shared_path = app_get_shared_resource_path(); - snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, "shared_images", DEFAULT_PLAYER_THUMBNAIL); + snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, + "shared_images", DEFAULT_PLAYER_THUMBNAIL); free(shared_path); evas_object_image_file_set(thumbnail, default_thumbnail, NULL); } evas_object_image_preload(thumbnail, EINA_TRUE); evas_object_show(thumbnail); - /*endfunc;*/ + /*endfunc; */ return thumbnail; } -static Evas_Object *_get_image_by_playlist_item(Evas_Object *parent, mp_plst_item *item) +static Evas_Object *_get_image_by_playlist_item(Evas_Object * parent, + mp_plst_item * item) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK_NULL(ad); @@ -2867,17 +3354,20 @@ static Evas_Object *_get_image_by_playlist_item(Evas_Object *parent, mp_plst_ite } Evas_Object *image = _mp_player_view_create_album_image(parent, - path, PLAYER_VIEW_ALBUM_SIZE, PLAYER_VIEW_ALBUM_SIZE); + path, + PLAYER_VIEW_ALBUM_SIZE, + PLAYER_VIEW_ALBUM_SIZE); mp_util_free_track_info(track_info); return image; } -static void _mp_player_view_create_next_album_image(void *thiz, int move_direction) +static void _mp_player_view_create_next_album_image(void *thiz, + int move_direction) { startfunc; - MpPlayerView_t *playing_view = (MpPlayerView_t *)thiz; + MpPlayerView_t *playing_view = (MpPlayerView_t *) thiz; MP_CHECK(playing_view); CHECK_VIEW(playing_view); MP_CHECK(playing_view->player_view_layout); @@ -2885,25 +3375,30 @@ static void _mp_player_view_create_next_album_image(void *thiz, int move_directi struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); - Evas_Object *image = _get_image_by_playlist_item(playing_view->player_view_layout, - mp_playlist_mgr_get_next(ad->playlist_mgr, true, false)); - elm_object_part_content_set(playing_view->player_view_layout, "album_image_right", image); + Evas_Object *image = + _get_image_by_playlist_item(playing_view->player_view_layout, + mp_playlist_mgr_get_next(ad-> + playlist_mgr, + true, false)); + elm_object_part_content_set(playing_view->player_view_layout, + "album_image_right", image); image = _get_image_by_playlist_item(playing_view->player_view_layout, - mp_playlist_mgr_get_prev(ad->playlist_mgr)); - elm_object_part_content_set(playing_view->player_view_layout, "album_image_left", image); + mp_playlist_mgr_get_prev(ad-> + playlist_mgr)); + elm_object_part_content_set(playing_view->player_view_layout, + "album_image_left", image); endfunc; } -static void -_mp_player_view_transit_by_item(void *data, int move_direction) +static void _mp_player_view_transit_by_item(void *data, int move_direction) { startfunc; struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); - MpPlayerView_t *view = (MpPlayerView_t *)data; + MpPlayerView_t *view = (MpPlayerView_t *) data; MP_CHECK(view); CHECK_VIEW(view); MP_CHECK(view->player_view_layout); @@ -2916,10 +3411,10 @@ _mp_player_view_transit_by_item(void *data, int move_direction) mp_ecore_timer_del(view->transit_done_timer); - /*mp_player_mgr_pause(ad);*/ + /*mp_player_mgr_pause(ad); */ view->move_direction = move_direction; - /*mp_player_mgr_destroy(mp_util_get_appdata());*/ + /*mp_player_mgr_destroy(mp_util_get_appdata()); */ mp_plst_item *it = NULL; if (view->move_direction == PLAYER_VIEW_MOVE_LEFT) { @@ -2935,19 +3430,29 @@ _mp_player_view_transit_by_item(void *data, int move_direction) return; } - Evas_Object *cur = elm_object_part_content_get(view->player_view_layout, "album_image"); - Evas_Object *fav_off = elm_object_part_content_get(view->player_view_layout, "options_favourite_off"); - Evas_Object *fav_on = elm_object_part_content_get(view->player_view_layout, "options_favourite_on"); + Evas_Object *cur = + elm_object_part_content_get(view->player_view_layout, + "album_image"); + Evas_Object *fav_off = + elm_object_part_content_get(view->player_view_layout, + "options_favourite_off"); + Evas_Object *fav_on = + elm_object_part_content_get(view->player_view_layout, + "options_favourite_on"); Evas_Object *next = NULL; Evas_Coord w, width, h; evas_object_geometry_get(cur, NULL, NULL, &width, &h); if (view->move_direction == PLAYER_VIEW_MOVE_RIGHT) { - next = elm_object_part_content_get(view->player_view_layout, "album_image_left"); + next = + elm_object_part_content_get(view->player_view_layout, + "album_image_left"); w = width; } else { - next = elm_object_part_content_get(view->player_view_layout, "album_image_right"); + next = + elm_object_part_content_get(view->player_view_layout, + "album_image_right"); w = -width; } @@ -2957,23 +3462,29 @@ _mp_player_view_transit_by_item(void *data, int move_direction) elm_transit_duration_set(transit, PLAYER_VIEW_TRANSIT_INTERVAL); elm_transit_tween_mode_set(transit, ELM_TRANSIT_TWEEN_MODE_DECELERATE); elm_transit_objects_final_state_keep_get(transit); - elm_transit_del_cb_set(transit, _mp_player_view_transit_by_item_complete_cb, view); + elm_transit_del_cb_set(transit, + _mp_player_view_transit_by_item_complete_cb, + view); elm_transit_go(transit); Elm_Transit *transit1 = elm_transit_add(); elm_transit_object_add(transit1, fav_off); elm_transit_effect_translation_add(transit1, 0, 0, w, 80); elm_transit_duration_set(transit1, PLAYER_VIEW_TRANSIT_INTERVAL); - elm_transit_tween_mode_set(transit1, ELM_TRANSIT_TWEEN_MODE_DECELERATE); + elm_transit_tween_mode_set(transit1, + ELM_TRANSIT_TWEEN_MODE_DECELERATE); elm_transit_objects_final_state_keep_get(transit1); - elm_transit_del_cb_set(transit1, _mp_player_view_transit_by_item_complete_cb, view); + elm_transit_del_cb_set(transit1, + _mp_player_view_transit_by_item_complete_cb, + view); elm_transit_go(transit1); Elm_Transit *transit2 = elm_transit_add(); elm_transit_object_add(transit2, cur); elm_transit_effect_translation_add(transit2, 0, 0, w, 80); elm_transit_duration_set(transit2, PLAYER_VIEW_TRANSIT_INTERVAL); - elm_transit_tween_mode_set(transit2, ELM_TRANSIT_TWEEN_MODE_DECELERATE); + elm_transit_tween_mode_set(transit2, + ELM_TRANSIT_TWEEN_MODE_DECELERATE); elm_transit_objects_final_state_keep_get(transit2); elm_transit_go(transit2); @@ -2981,9 +3492,12 @@ _mp_player_view_transit_by_item(void *data, int move_direction) elm_transit_object_add(transit3, fav_on); elm_transit_effect_translation_add(transit3, 0, 0, w, 80); elm_transit_duration_set(transit3, PLAYER_VIEW_TRANSIT_INTERVAL); - elm_transit_tween_mode_set(transit3, ELM_TRANSIT_TWEEN_MODE_DECELERATE); + elm_transit_tween_mode_set(transit3, + ELM_TRANSIT_TWEEN_MODE_DECELERATE); elm_transit_objects_final_state_keep_get(transit3); - elm_transit_del_cb_set(transit3, _mp_player_view_transit_by_item_complete_cb, view); + elm_transit_del_cb_set(transit3, + _mp_player_view_transit_by_item_complete_cb, + view); elm_transit_go(transit3); endfunc; @@ -3004,7 +3518,7 @@ static void _mp_player_view_lcd_on(void *thiz) static void _mp_player_view_on_event(void *thiz, MpViewEvent_e event) { - MpPlayerView_t *view = (MpPlayerView_t *)thiz; + MpPlayerView_t *view = (MpPlayerView_t *) thiz; MP_CHECK(view); CHECK_VIEW(view); DEBUG_TRACE("event [%d]", event); @@ -3016,122 +3530,130 @@ static void _mp_player_view_on_event(void *thiz, MpViewEvent_e event) case MP_PLAYLIST_MODIFIED: #ifndef MP_SOUND_PLAYER if (view->queue_list) { - mp_list_update((MpList_t *)view->queue_list); + mp_list_update((MpList_t *) view->queue_list); } #endif mp_player_view_refresh(view); break; case MP_VIEW_TRANSITION_FINISHED: - elm_object_signal_emit(ad->conformant, "elm,state,virtualkeypad,enable", ""); + elm_object_signal_emit(ad->conformant, + "elm,state,virtualkeypad,enable", ""); mp_player_view_refresh(view); /*_mp_player_view_start_request(view);*/ _mp_player_view_show_lyric(view); break; - case MP_ROUTE_CHANGED: { - ERROR_TRACE("MP_ROUTE_CHANGED"); + case MP_ROUTE_CHANGED:{ + ERROR_TRACE("MP_ROUTE_CHANGED"); #ifndef MP_SOUND_PLAYER - /*ms_effect_view_radio_val_set();*/ + /*ms_effect_view_radio_val_set(); */ #endif - _mp_player_view_volume_route_change(view); + _mp_player_view_volume_route_change(view); - mp_player_view_set_snd_path_sensitivity(view); - break; - } - case MP_PLAYLIST_MGR_ITEM_CHANGED: { -#ifndef MP_SOUND_PLAYER - if (view->queue_list) { - mp_list_update((MpList_t *)view->queue_list); + mp_player_view_set_snd_path_sensitivity(view); + break; } + case MP_PLAYLIST_MGR_ITEM_CHANGED:{ +#ifndef MP_SOUND_PLAYER + if (view->queue_list) { + mp_list_update((MpList_t *) view->queue_list); + } #endif - break; - } - case MP_QUICKPANNEL_SHOW: { - if (view == (MpPlayerView_t *)mp_view_mgr_get_top_view(GET_VIEW_MGR)) { - DEBUG_TRACE("MP_QUICKPANNEL_SHOW"); - mp_volume_key_grab_condition_set(MP_VOLUME_KEY_GRAB_COND_VIEW_VISIBLE, false); + break; } - break; - } - case MP_QUICKPANNEL_HIDE: { - if (view == (MpPlayerView_t *)mp_view_mgr_get_top_view(GET_VIEW_MGR)) { - DEBUG_TRACE("MP_QUICKPANNEL_HIDE"); - mp_volume_key_grab_condition_set(MP_VOLUME_KEY_GRAB_COND_VIEW_VISIBLE, true); + case MP_QUICKPANNEL_SHOW:{ + if (view == (MpPlayerView_t *) mp_view_mgr_get_top_view(GET_VIEW_MGR)) { + DEBUG_TRACE("MP_QUICKPANNEL_SHOW"); + mp_volume_key_grab_condition_set + (MP_VOLUME_KEY_GRAB_COND_VIEW_VISIBLE, false); + } + break; } - break; - } - case MP_SIDE_SYNC_STATUS_CHANGED: { - mp_player_view_set_snd_path_sensitivity(view); - break; - } - case MP_PLAYING_TRACK_CHANGED: { - if (!view->transition_state) { - mp_player_view_refresh(view); + case MP_QUICKPANNEL_HIDE:{ + if (view == (MpPlayerView_t *) mp_view_mgr_get_top_view(GET_VIEW_MGR)) { + DEBUG_TRACE("MP_QUICKPANNEL_HIDE"); + mp_volume_key_grab_condition_set + (MP_VOLUME_KEY_GRAB_COND_VIEW_VISIBLE, true); + } + break; + } + case MP_SIDE_SYNC_STATUS_CHANGED:{ + mp_player_view_set_snd_path_sensitivity(view); + break; } + case MP_PLAYING_TRACK_CHANGED:{ + if (!view->transition_state) { + mp_player_view_refresh(view); + } - /* update dmr icon - if (ad->samsung_link) - _mp_player_view_update_dmr_icon_state(view);*/ - break; - } - case MP_VIEW_EVENT_ALBUMART_CHANGED: { - mp_player_view_refresh(view); - break; - } - case MP_UPDATE_PLAYING_LIST: { + /* update dmr icon + if (ad->samsung_link) + _mp_player_view_update_dmr_icon_state(view); */ + break; + } + case MP_VIEW_EVENT_ALBUMART_CHANGED:{ + mp_player_view_refresh(view); + break; + } + case MP_UPDATE_PLAYING_LIST:{ - //Enable Lyrics settings - _mp_player_view_show_lyric(view); - break; - } + //Enable Lyrics settings + _mp_player_view_show_lyric(view); + break; + } - case MP_LYRIC_UPDATE: { - _mp_player_view_show_lyric(view); - break; - } - case MP_UNSET_NOW_PLAYING: { - MpViewMgr_t *view_mgr = GET_VIEW_MGR; - MP_CHECK(view_mgr); - mp_view_mgr_pop_a_view(view_mgr, (MpView_t *)view); - break; - } - case MP_START_PLAYBACK: { + case MP_LYRIC_UPDATE:{ + _mp_player_view_show_lyric(view); + break; + } + case MP_UNSET_NOW_PLAYING:{ + MpViewMgr_t *view_mgr = GET_VIEW_MGR; + MP_CHECK(view_mgr); + mp_view_mgr_pop_a_view(view_mgr, (MpView_t *) view); + break; + } + case MP_START_PLAYBACK:{ #ifndef MP_SOUND_PLAYER - mp_player_view_refresh(view); - if (view->queue_list) { - mp_list_realized_item_part_update((MpList_t *)view->queue_list, "elm.icon.left", ELM_GENLIST_ITEM_FIELD_CONTENT); + mp_player_view_refresh(view); + if (view->queue_list) { + mp_list_realized_item_part_update((MpList_t *) view-> + queue_list, + "elm.icon.left", + ELM_GENLIST_ITEM_FIELD_CONTENT); - } + } #endif - break; - } + break; + } case MP_RESUME_PLAYBACK: case MP_PAUSE_PLAYBACK: - case MP_STOP_PLAYBACK: { + case MP_STOP_PLAYBACK:{ #ifndef MP_SOUND_PLAYER - if (view->queue_list) { - mp_list_realized_item_part_update((MpList_t *)view->queue_list, "elm.icon.left", ELM_GENLIST_ITEM_FIELD_CONTENT); + if (view->queue_list) { + mp_list_realized_item_part_update((MpList_t *) view-> + queue_list, + "elm.icon.left", + ELM_GENLIST_ITEM_FIELD_CONTENT); - } + } #endif - break; - } + break; + } default: - /* Not defined*/ + /* Not defined */ break; } } -static int -_mp_player_view_update_layout(void *data) +static int _mp_player_view_update_layout(void *data) { startfunc; MpPlayerView_t *view = data; MP_CHECK_VAL(view, -1); - /*elm_naviframe_item_title_enabled_set(view->navi_it, FALSE, FALSE);*/ + /*elm_naviframe_item_title_enabled_set(view->navi_it, FALSE, FALSE); */ mp_player_view_set_title_and_buttons(view); mp_player_view_refresh(view); @@ -3144,7 +3666,7 @@ _mp_player_view_update_layout(void *data) } static int -_mp_player_view_init(Evas_Object *parent, MpPlayerView_t *view) +_mp_player_view_init(Evas_Object * parent, MpPlayerView_t * view) { startfunc; int ret = 0; @@ -3153,7 +3675,7 @@ _mp_player_view_init(Evas_Object *parent, MpPlayerView_t *view) view->update_pos = -1; view->show_lyric = true; - ret = mp_view_init(parent, (MpView_t *)view, MP_VIEW_PLAYER); + ret = mp_view_init(parent, (MpView_t *) view, MP_VIEW_PLAYER); MP_CHECK_VAL(ret == 0, -1); view->player_view_magic = PLAYER_VIEW_MAGIC; @@ -3183,85 +3705,139 @@ _mp_player_view_init(Evas_Object *parent, MpPlayerView_t *view) void _mp_player_view_set_focused_UI(void *this) { - MpPlayerView_t *view = (MpPlayerView_t *)this; + MpPlayerView_t *view = (MpPlayerView_t *) this; Evas_Object *favor_layout = NULL; if (!mp_util_is_landscape()) { - favor_layout = view->player_view_layout; /*favor_layout = view->player_view_option_layout;*/ + favor_layout = view->player_view_layout; /*favor_layout = view->player_view_option_layout; */ } else { favor_layout = view->player_view_option_layout; } MP_CHECK(favor_layout); - /*add focused UI*/ - Evas_Object *volume_focus_btn = elm_button_add(view->player_view_option_layout); + /*add focused UI */ + Evas_Object *volume_focus_btn = + elm_button_add(view->player_view_option_layout); elm_object_style_set(volume_focus_btn, "focus"); - elm_object_part_content_set(view->player_view_option_layout, "volume_focus", volume_focus_btn); - elm_object_focus_custom_chain_append(view->player_view_option_layout, volume_focus_btn, NULL); - evas_object_smart_callback_add(volume_focus_btn, "clicked", _mp_player_view_volume_btn_clicked_cb, view); + elm_object_part_content_set(view->player_view_option_layout, + "volume_focus", volume_focus_btn); + elm_object_focus_custom_chain_append(view->player_view_option_layout, + volume_focus_btn, NULL); + evas_object_smart_callback_add(volume_focus_btn, "clicked", + _mp_player_view_volume_btn_clicked_cb, + view); elm_object_focus_set(volume_focus_btn, true); #ifndef MP_SOUND_PLAYER Evas_Object *favor_focus_btn = elm_button_add(favor_layout); evas_object_repeat_events_set(favor_focus_btn, EINA_FALSE); elm_object_style_set(favor_focus_btn, "focus"); - elm_object_part_content_set(favor_layout, "favourite_focus", favor_focus_btn); - elm_object_focus_custom_chain_append(favor_layout, favor_focus_btn, NULL); - evas_object_smart_callback_add(favor_focus_btn, "clicked", _mp_player_view_favor_btn_clicked_cb, view); - - Evas_Object *repeat_focus_btn = elm_button_add(view->player_view_control_layout); + elm_object_part_content_set(favor_layout, "favourite_focus", + favor_focus_btn); + elm_object_focus_custom_chain_append(favor_layout, favor_focus_btn, + NULL); + evas_object_smart_callback_add(favor_focus_btn, "clicked", + _mp_player_view_favor_btn_clicked_cb, + view); + + Evas_Object *repeat_focus_btn = + elm_button_add(view->player_view_control_layout); elm_object_style_set(repeat_focus_btn, "focus"); - elm_object_part_content_set(view->player_view_control_layout, "repeat_focus", repeat_focus_btn); - elm_object_focus_custom_chain_append(view->player_view_control_layout, repeat_focus_btn, NULL); - evas_object_smart_callback_add(repeat_focus_btn, "clicked", _mp_player_view_repeat_btn_clicked_cb, view); - - Evas_Object *shuffle_focus_btn = elm_button_add(view->player_view_control_layout); + elm_object_part_content_set(view->player_view_control_layout, + "repeat_focus", repeat_focus_btn); + elm_object_focus_custom_chain_append(view->player_view_control_layout, + repeat_focus_btn, NULL); + evas_object_smart_callback_add(repeat_focus_btn, "clicked", + _mp_player_view_repeat_btn_clicked_cb, + view); + + Evas_Object *shuffle_focus_btn = + elm_button_add(view->player_view_control_layout); elm_object_style_set(shuffle_focus_btn, "focus"); - elm_object_part_content_set(view->player_view_control_layout, "shuffle_focus", shuffle_focus_btn); - elm_object_focus_custom_chain_append(view->player_view_control_layout, shuffle_focus_btn, NULL); - evas_object_smart_callback_add(shuffle_focus_btn, "clicked", _mp_player_view_shuffle_btn_clicked_cb, view); - - Evas_Object *prev_focus_btn = elm_button_add(view->player_view_control_layout); + elm_object_part_content_set(view->player_view_control_layout, + "shuffle_focus", shuffle_focus_btn); + elm_object_focus_custom_chain_append(view->player_view_control_layout, + shuffle_focus_btn, NULL); + evas_object_smart_callback_add(shuffle_focus_btn, "clicked", + _mp_player_view_shuffle_btn_clicked_cb, + view); + + Evas_Object *prev_focus_btn = + elm_button_add(view->player_view_control_layout); elm_object_style_set(prev_focus_btn, "focus"); - elm_object_part_content_set(view->player_view_control_layout, "previous_focus", prev_focus_btn); - elm_object_focus_custom_chain_append(view->player_view_control_layout, prev_focus_btn, NULL); - evas_object_smart_callback_add(prev_focus_btn, "pressed", _mp_player_view_prev_btn_pressed_cb, view); - evas_object_smart_callback_add(prev_focus_btn, "unpressed", _mp_player_view_prev_btn_unpressed_cb, view); - evas_object_smart_callback_add(prev_focus_btn, "clicked", _mp_player_view_prev_btn_clicked_cb, view); + elm_object_part_content_set(view->player_view_control_layout, + "previous_focus", prev_focus_btn); + elm_object_focus_custom_chain_append(view->player_view_control_layout, + prev_focus_btn, NULL); + evas_object_smart_callback_add(prev_focus_btn, "pressed", + _mp_player_view_prev_btn_pressed_cb, + view); + evas_object_smart_callback_add(prev_focus_btn, "unpressed", + _mp_player_view_prev_btn_unpressed_cb, + view); + evas_object_smart_callback_add(prev_focus_btn, "clicked", + _mp_player_view_prev_btn_clicked_cb, + view); #endif - Evas_Object *play_pause_focus_btn = elm_button_add(view->player_view_control_layout); + Evas_Object *play_pause_focus_btn = + elm_button_add(view->player_view_control_layout); elm_object_style_set(play_pause_focus_btn, "focus"); - elm_object_part_content_set(view->player_view_control_layout, "play_pause_focus", play_pause_focus_btn); - /*elm_object_focus_custom_chain_append(view->player_view_control_layout, play_pause_focus_btn, NULL);*/ - evas_object_smart_callback_add(play_pause_focus_btn, "clicked", _mp_player_view_play_pause_btn_clicked_cb, view); + elm_object_part_content_set(view->player_view_control_layout, + "play_pause_focus", play_pause_focus_btn); + /*elm_object_focus_custom_chain_append(view->player_view_control_layout, play_pause_focus_btn, NULL); */ + evas_object_smart_callback_add(play_pause_focus_btn, "clicked", + _mp_player_view_play_pause_btn_clicked_cb, + view); #ifndef MP_SOUND_PLAYER - Evas_Object *next_focus_btn = elm_button_add(view->player_view_control_layout); + Evas_Object *next_focus_btn = + elm_button_add(view->player_view_control_layout); elm_object_style_set(next_focus_btn, "focus"); - elm_object_part_content_set(view->player_view_control_layout, "next_focus", next_focus_btn); - elm_object_focus_custom_chain_append(view->player_view_control_layout, next_focus_btn, NULL); - evas_object_smart_callback_add(next_focus_btn, "pressed", _mp_player_view_next_btn_pressed_cb, view); - evas_object_smart_callback_add(next_focus_btn, "unpressed", _mp_player_view_next_btn_unpressed_cb, view); - evas_object_smart_callback_add(next_focus_btn, "clicked", _mp_player_view_next_btn_clicked_cb, view); - - Evas_Object *queue_focus_btn = elm_button_add(view->player_view_option_layout); + elm_object_part_content_set(view->player_view_control_layout, + "next_focus", next_focus_btn); + elm_object_focus_custom_chain_append(view->player_view_control_layout, + next_focus_btn, NULL); + evas_object_smart_callback_add(next_focus_btn, "pressed", + _mp_player_view_next_btn_pressed_cb, + view); + evas_object_smart_callback_add(next_focus_btn, "unpressed", + _mp_player_view_next_btn_unpressed_cb, + view); + evas_object_smart_callback_add(next_focus_btn, "clicked", + _mp_player_view_next_btn_clicked_cb, + view); + + Evas_Object *queue_focus_btn = + elm_button_add(view->player_view_option_layout); elm_object_style_set(queue_focus_btn, "focus"); - elm_object_part_content_set(view->player_view_option_layout, "queue_focus", queue_focus_btn); - elm_object_focus_custom_chain_append(view->player_view_option_layout, queue_focus_btn, NULL); - evas_object_smart_callback_add(queue_focus_btn, "clicked", _mp_player_view_queue_btn_clicked_cb, view); - - /*set sequence*/ - elm_object_focus_next_object_set(shuffle_focus_btn, favor_focus_btn, ELM_FOCUS_RIGHT); - elm_object_focus_next_object_set(favor_focus_btn, repeat_focus_btn, ELM_FOCUS_RIGHT); - - elm_object_focus_next_object_set(repeat_focus_btn, favor_focus_btn, ELM_FOCUS_LEFT); - elm_object_focus_next_object_set(favor_focus_btn, shuffle_focus_btn, ELM_FOCUS_LEFT); - - elm_object_focus_next_object_set(shuffle_focus_btn, volume_focus_btn, ELM_FOCUS_DOWN); - - elm_object_focus_next_object_set(repeat_focus_btn, queue_focus_btn, ELM_FOCUS_DOWN); + elm_object_part_content_set(view->player_view_option_layout, + "queue_focus", queue_focus_btn); + elm_object_focus_custom_chain_append(view->player_view_option_layout, + queue_focus_btn, NULL); + evas_object_smart_callback_add(queue_focus_btn, "clicked", + _mp_player_view_queue_btn_clicked_cb, + view); + + /*set sequence */ + elm_object_focus_next_object_set(shuffle_focus_btn, favor_focus_btn, + ELM_FOCUS_RIGHT); + elm_object_focus_next_object_set(favor_focus_btn, repeat_focus_btn, + ELM_FOCUS_RIGHT); + + elm_object_focus_next_object_set(repeat_focus_btn, favor_focus_btn, + ELM_FOCUS_LEFT); + elm_object_focus_next_object_set(favor_focus_btn, shuffle_focus_btn, + ELM_FOCUS_LEFT); + + elm_object_focus_next_object_set(shuffle_focus_btn, volume_focus_btn, + ELM_FOCUS_DOWN); + + elm_object_focus_next_object_set(repeat_focus_btn, queue_focus_btn, + ELM_FOCUS_DOWN); #endif } -MpPlayerView_t *mp_player_view_create(Evas_Object *parent, int launch_type, bool start_new_file) + +MpPlayerView_t *mp_player_view_create(Evas_Object * parent, + int launch_type, bool start_new_file) { eventfunc; int ret; @@ -3279,11 +3855,12 @@ MpPlayerView_t *mp_player_view_create(Evas_Object *parent, int launch_type, bool view->start_new_file = start_new_file; _mp_player_view_content_layout_load(view); - mp_volume_key_event_callback_add(_mp_player_view_volume_hw_key_cb, view); + mp_volume_key_event_callback_add(_mp_player_view_volume_hw_key_cb, + view); return view; -Error: + Error: ERROR_TRACE("Error: mp_player_view_create()"); IF_FREE(view); return NULL; @@ -3293,7 +3870,7 @@ bool mp_player_view_refresh(void *data) { startfunc; - MpPlayerView_t *playing_view = (MpPlayerView_t *)data; + MpPlayerView_t *playing_view = (MpPlayerView_t *) data; MP_CHECK_FALSE(playing_view); CHECK_VIEW(playing_view); @@ -3308,7 +3885,8 @@ bool mp_player_view_refresh(void *data) mp_player_view_set_title_and_buttons(playing_view); #ifndef MP_SOUND_PLAYER if (playing_view->queue_list) { - mp_now_playing_list_refresh((MpNowPlayingList_t *)playing_view->queue_list); + mp_now_playing_list_refresh((MpNowPlayingList_t *) playing_view-> + queue_list); } if (playing_view->queue_status) { _mp_player_view_refresh_queue_list(playing_view); @@ -3321,11 +3899,12 @@ bool mp_player_view_refresh(void *data) _mp_player_view_show_lyric(playing_view); - if (ad->player_state == PLAY_STATE_PLAYING || ad->player_state == PLAY_STATE_PAUSED) { + if (ad->player_state == PLAY_STATE_PLAYING + || ad->player_state == PLAY_STATE_PAUSED) { mp_player_view_update_state(playing_view); } - /*add favourite begin*/ + /*add favourite begin */ bool favourite = FALSE; mp_plst_item *item = mp_playlist_mgr_get_current(ad->playlist_mgr); MP_CHECK_FALSE(item); @@ -3363,24 +3942,28 @@ void mp_player_view_update_state(void *data) return; } - if ((int)mp_player_mgr_get_state() == (int)PLAYER_STATE_PLAYING) { + if ((int) mp_player_mgr_get_state() == (int) PLAYER_STATE_PLAYING) { mp_player_view_update_buffering_progress(view, 100); mp_player_view_set_play_image(view, true); - /*mp_player_view_set_album_playing(view, true);*/ - } else if ((int)mp_player_mgr_get_state() == (int)PLAYER_STATE_READY) { - /*don't update play/puase button if next track exist.*/ + /*mp_player_view_set_album_playing(view, true); */ + } else if ((int) mp_player_mgr_get_state() == (int) PLAYER_STATE_READY) { + /*don't update play/puase button if next track exist. */ if (!ad->auto_next) { mp_player_view_set_play_image(view, false); - /*mp_player_view_set_album_playing(view, false);*/ + /*mp_player_view_set_album_playing(view, false); */ } } else { mp_player_view_set_play_image(view, false); - /*mp_player_view_set_album_playing(view, false);*/ + /*mp_player_view_set_album_playing(view, false); */ } #ifndef MP_SOUND_PLAYER - _mp_player_view_set_rep_image(view, mp_playlist_mgr_get_repeat(ad->playlist_mgr)); - _mp_player_view_set_shuffle_image(view, mp_playlist_mgr_get_shuffle(ad->playlist_mgr)); + _mp_player_view_set_rep_image(view, + mp_playlist_mgr_get_repeat(ad-> + playlist_mgr)); + _mp_player_view_set_shuffle_image(view, + mp_playlist_mgr_get_shuffle(ad-> + playlist_mgr)); #endif _mp_player_view_volume_update(view); @@ -3389,8 +3972,7 @@ void mp_player_view_update_state(void *data) endfunc; } -void -mp_player_view_update_buffering_progress(void *data, int percent) +void mp_player_view_update_buffering_progress(void *data, int percent) { startfunc; struct appdata *ad = mp_util_get_appdata(); @@ -3407,14 +3989,18 @@ mp_player_view_update_buffering_progress(void *data, int percent) } if (!view->buffering_progress) { - view->buffering_progress = mp_widget_loading_icon_add(view->player_view_layout, MP_LOADING_ICON_SIZE_LARGE); - elm_object_part_content_set(view->player_view_layout, "buffering_area", view->buffering_progress); + view->buffering_progress = + mp_widget_loading_icon_add(view->player_view_layout, + MP_LOADING_ICON_SIZE_LARGE); + elm_object_part_content_set(view->player_view_layout, + "buffering_area", + view->buffering_progress); } evas_object_show(view->buffering_progress); } -void mp_player_view_set_data(MpPlayerView_t *view, ...) +void mp_player_view_set_data(MpPlayerView_t * view, ...) { startfunc; MP_CHECK(view); @@ -3427,13 +4013,13 @@ void mp_player_view_set_data(MpPlayerView_t *view, ...) field = va_arg(var_args, int); switch (field) { - case MP_PLAYER_VIEW_LAUNCH_TYPE: { - int val = va_arg((var_args), int); + case MP_PLAYER_VIEW_LAUNCH_TYPE:{ + int val = va_arg((var_args), int); - view->launch_type = val; - DEBUG_TRACE("view->launch_type = %d", view->launch_type); - break; - } + view->launch_type = val; + DEBUG_TRACE("view->launch_type = %d", view->launch_type); + break; + } default: DEBUG_TRACE("Invalid arguments"); } diff --git a/src/view/mp-playlist-detail-view.c b/src/view/mp-playlist-detail-view.c index 5671adc..17bcf96 100644 --- a/src/view/mp-playlist-detail-view.c +++ b/src/view/mp-playlist-detail-view.c @@ -25,23 +25,29 @@ #include "mp-edit-playlist.h" #include -static void _mp_playlist_detail_view_tracklist_add_cb(void *data, Evas_Object *obj, void *event_info); -static void _mp_playlist_detail_view_tracklist_reorder_cb(void *data, Evas_Object *obj, void *event_info); - -static void _mp_playlist_detail_view_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_playlist_detail_view_tracklist_add_cb(void *data, + Evas_Object * obj, + void *event_info); +static void _mp_playlist_detail_view_tracklist_reorder_cb(void *data, + Evas_Object * + obj, + void + *event_info); + +static void _mp_playlist_detail_view_cb(void *data, Evas_Object * obj, + void *event_info) { elm_naviframe_item_pop(GET_NAVIFRAME); } -static void -_mp_playlist_detail_view_destory_cb(void *thiz) +static void _mp_playlist_detail_view_destory_cb(void *thiz) { eventfunc; MpPlaylistDetailView_t *view = thiz; MP_CHECK(view); - mp_list_view_fini((MpListView_t *)view); + mp_list_view_fini((MpListView_t *) view); - /* TODO: release resource..*/ + /* TODO: release resource.. */ mp_playlist_detail_view_destory(view); free(view); @@ -54,40 +60,44 @@ int _mp_playlist_detail_view_update(void *thiz) MP_CHECK_VAL(view, -1); view->content_set(view); - mp_view_update_options((MpView_t *)view); + mp_view_update_options((MpView_t *) view); return 0; } static void -_mp_playlist_detail_rename_cb(void *data, Evas_Object *obj, void *event_info) +_mp_playlist_detail_rename_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); - MpPlaylistDetailView_t *view = (MpPlaylistDetailView_t *)data; + MpPlaylistDetailView_t *view = (MpPlaylistDetailView_t *) data; MP_CHECK(view); mp_evas_object_del(view->more_btn_ctxpopup); - Mp_Playlist_Data *mp_playlist_data = mp_edit_playlist_create(MP_PLST_RENAME); + Mp_Playlist_Data *mp_playlist_data = + mp_edit_playlist_create(MP_PLST_RENAME); MP_CHECK(mp_playlist_data); - ad->popup_data = (Mp_Playlist_Data *)mp_playlist_data; + ad->popup_data = (Mp_Playlist_Data *) mp_playlist_data; - MpTrackList_t *track_list = (MpTrackList_t *)view->content_to_show; + MpTrackList_t *track_list = (MpTrackList_t *) view->content_to_show; if (track_list != NULL) { mp_playlist_data->playlist_handle = track_list->playlist_handle; } mp_edit_playlist_content_create(mp_playlist_data); } -static void _mp_playlist_detail_view_normal_more_btn_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_playlist_detail_view_normal_more_btn_cb(void *data, + Evas_Object * obj, + void *event_info) { eventfunc; - MpPlaylistDetailView_t *view = (MpPlaylistDetailView_t *)data; + MpPlaylistDetailView_t *view = (MpPlaylistDetailView_t *) data; MP_CHECK(view); mp_evas_object_del(view->more_btn_ctxpopup); @@ -99,52 +109,66 @@ static void _mp_playlist_detail_view_normal_more_btn_cb(void *data, Evas_Object int count = 0; mp_media_info_list_count(MP_TRACK_ALL, NULL, NULL, NULL, 0, &count); if (count > 0) { - if ((view->list_type == MP_TRACK_BY_PLAYLIST) || !strcmp((STR_MP_FAVOURITES), view->name) || - !strcmp(GET_STR(STR_MP_FAVOURITES), view->name)) { - /*add tracks*/ + if ((view->list_type == MP_TRACK_BY_PLAYLIST) + || !strcmp((STR_MP_FAVOURITES), view->name) + || !strcmp(GET_STR(STR_MP_FAVOURITES), view->name)) { + /*add tracks */ mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_ADD_TRACKS, MP_PLAYER_MORE_BTN_ADD, - _mp_playlist_detail_view_tracklist_add_cb, - view); + STR_MP_ADD_TRACKS, + MP_PLAYER_MORE_BTN_ADD, + _mp_playlist_detail_view_tracklist_add_cb, + view); } if (view->list_type == MP_TRACK_BY_PLAYLIST) { mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_RENAME, MP_PLAYER_MORE_BTN_RENAME_IMAGE, _mp_playlist_detail_rename_cb, view); + STR_MP_RENAME, + MP_PLAYER_MORE_BTN_RENAME_IMAGE, + _mp_playlist_detail_rename_cb, + view); } - if ((mp_list_get_editable_count(view->content_to_show, MP_LIST_EDIT_TYPE_NORMAL) > 1) && - view->list_type == MP_TRACK_BY_PLAYLIST) { - /*reorder*/ + if ((mp_list_get_editable_count + (view->content_to_show, MP_LIST_EDIT_TYPE_NORMAL) > 1) + && view->list_type == MP_TRACK_BY_PLAYLIST) { + /*reorder */ mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_REORDER, MP_PLAYER_MORE_BTN_SET_REORDER, - _mp_playlist_detail_view_tracklist_reorder_cb, - view); + STR_MP_REORDER, + MP_PLAYER_MORE_BTN_SET_REORDER, + _mp_playlist_detail_view_tracklist_reorder_cb, + view); } - if (mp_list_get_editable_count(view->content_to_show, MP_LIST_EDIT_TYPE_NORMAL)) { - /*remove*/ + if (mp_list_get_editable_count + (view->content_to_show, MP_LIST_EDIT_TYPE_NORMAL)) { + /*remove */ mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_REMOVE, MP_PLAYER_MORE_BTN_EDIT, - mp_playlist_detail_view_tracklist_edit_cb, view); + STR_MP_REMOVE, + MP_PLAYER_MORE_BTN_EDIT, + mp_playlist_detail_view_tracklist_edit_cb, + view); } if (count) { - /*search*/ + /*search */ mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_SEARCH, NULL, mp_common_create_search_view_cb, view); + STR_MP_SEARCH, NULL, + mp_common_create_search_view_cb, + view); } /*mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_SETTINGS, MP_PLAYER_MORE_BTN_SETTING, mp_common_ctxpopup_setting_cb, view);*/ + STR_MP_SETTINGS, MP_PLAYER_MORE_BTN_SETTING, mp_common_ctxpopup_setting_cb, view); */ #ifndef MP_FEATURE_NO_END mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_END, MP_PLAYER_MORE_BTN_VIEW_END, mp_common_ctxpopup_end_cb, view); + STR_MP_END, + MP_PLAYER_MORE_BTN_VIEW_END, + mp_common_ctxpopup_end_cb, view); #endif /* - mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - GET_SYS_STR(STR_MP_END), MP_PLAYER_MORE_BTN_VIEW_END, mp_common_ctxpopup_end_cb, view); - */ + mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, + GET_SYS_STR(STR_MP_END), MP_PLAYER_MORE_BTN_VIEW_END, mp_common_ctxpopup_end_cb, view); + */ mp_util_more_btn_move_ctxpopup(view->more_btn_ctxpopup, obj); @@ -152,7 +176,10 @@ static void _mp_playlist_detail_view_normal_more_btn_cb(void *data, Evas_Object } else { if (view->list_type == MP_TRACK_BY_PLAYLIST) { mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_RENAME, MP_PLAYER_MORE_BTN_RENAME_IMAGE, _mp_playlist_detail_rename_cb, view); + STR_MP_RENAME, + MP_PLAYER_MORE_BTN_RENAME_IMAGE, + _mp_playlist_detail_rename_cb, + view); mp_util_more_btn_move_ctxpopup(view->more_btn_ctxpopup, obj); evas_object_show(view->more_btn_ctxpopup); @@ -160,26 +187,31 @@ static void _mp_playlist_detail_view_normal_more_btn_cb(void *data, Evas_Object } } -/*************** functions for track list update *******************/ -void mp_playlist_detail_view_tracklist_edit_cb(void *data, Evas_Object * obj, void *event_info) +/*************** functions for track list update *******************/ +void mp_playlist_detail_view_tracklist_edit_cb(void *data, + Evas_Object * obj, + void *event_info) { eventfunc; MpPlaylistDetailView_t *view = (MpPlaylistDetailView_t *) data; MP_CHECK(view); /* - if (view->list_type == MP_TRACK_BY_PLAYLIST) { - mp_list_set_reorder((MpList_t *)view->content_to_show, TRUE); + if (view->list_type == MP_TRACK_BY_PLAYLIST) { + mp_list_set_reorder((MpList_t *)view->content_to_show, TRUE); - } - */ + } + */ view->content_to_show->reorderable = 0; mp_evas_object_del(view->more_btn_ctxpopup); - mp_common_show_edit_view((MpListView_t *)view, MP_DONE_REMOVED_TYPE); + mp_common_show_edit_view((MpListView_t *) view, MP_DONE_REMOVED_TYPE); } -static void _mp_playlist_detail_view_tracklist_reorder_cb(void *data, Evas_Object * obj, void *event_info) +static void _mp_playlist_detail_view_tracklist_reorder_cb(void *data, + Evas_Object * + obj, + void *event_info) { eventfunc; MpPlaylistDetailView_t *view = (MpPlaylistDetailView_t *) data; @@ -187,13 +219,15 @@ static void _mp_playlist_detail_view_tracklist_reorder_cb(void *data, Evas_Objec mp_evas_object_del(view->more_btn_ctxpopup); - mp_common_set_list_to_reorder_view((MpListView_t *)view); + mp_common_set_list_to_reorder_view((MpListView_t *) view); } -static void _mp_playlist_detail_view_tracklist_add_cb(void *data, Evas_Object * obj, void *event_info) +static void _mp_playlist_detail_view_tracklist_add_cb(void *data, + Evas_Object * obj, + void *event_info) { eventfunc; - MpPlaylistDetailView_t *parent_view = (MpPlaylistDetailView_t *)data; + MpPlaylistDetailView_t *parent_view = (MpPlaylistDetailView_t *) data; MP_CHECK(parent_view); mp_common_show_add_tracks_view(parent_view->p_id); } @@ -228,10 +262,11 @@ static void _mp_playlist_detail_view_tracklist_add_cb(void *data, Evas_Object * return EINA_TRUE; }*/ -static Eina_Bool _mp_playlist_detail_view_pop_cb(void *data, Elm_Object_Item *it) +static Eina_Bool _mp_playlist_detail_view_pop_cb(void *data, + Elm_Object_Item * it) { startfunc; - MpPlaylistDetailView_t *view = (MpPlaylistDetailView_t *)data; + MpPlaylistDetailView_t *view = (MpPlaylistDetailView_t *) data; MP_CHECK_VAL(view, EINA_TRUE); mp_view_mgr_pop_view(GET_VIEW_MGR, true); @@ -242,25 +277,34 @@ static Eina_Bool _mp_playlist_detail_view_pop_cb(void *data, Elm_Object_Item *it static int _mp_playlist_detail_view_update_options(void *thiz) { startfunc; - MpPlaylistDetailView_t *view = (MpPlaylistDetailView_t *)thiz; + MpPlaylistDetailView_t *view = (MpPlaylistDetailView_t *) thiz; MP_CHECK_VAL(view, -1); Evas_Object *btn = NULL; - btn = mp_widget_create_toolbar_btn(view->playlist_detail_view_layout, MP_TOOLBAR_BTN_MORE, NULL, _mp_playlist_detail_view_normal_more_btn_cb, view); - elm_object_item_part_content_set(view->navi_it, "toolbar_more_btn", btn); + btn = + mp_widget_create_toolbar_btn(view->playlist_detail_view_layout, + MP_TOOLBAR_BTN_MORE, NULL, + _mp_playlist_detail_view_normal_more_btn_cb, + view); + elm_object_item_part_content_set(view->navi_it, "toolbar_more_btn", + btn); /*view->toolbar_options[MP_OPTION_MORE] = btn; - elm_naviframe_item_pop_cb_set(view->navi_it, _mp_playlist_detail_view_back_cb, view);*/ + elm_naviframe_item_pop_cb_set(view->navi_it, _mp_playlist_detail_view_back_cb, view); */ - Evas_Object *back_button = elm_button_add(view->playlist_detail_view_layout); + Evas_Object *back_button = + elm_button_add(view->playlist_detail_view_layout); elm_object_style_set(back_button, "naviframe/end_btn/default"); - elm_object_item_part_content_set(view->navi_it, "prev_btn", back_button); - evas_object_smart_callback_add(back_button, "clicked", _mp_playlist_detail_view_cb, view); - elm_naviframe_item_pop_cb_set(view->navi_it, _mp_playlist_detail_view_pop_cb, view); + elm_object_item_part_content_set(view->navi_it, "prev_btn", + back_button); + evas_object_smart_callback_add(back_button, "clicked", + _mp_playlist_detail_view_cb, view); + elm_naviframe_item_pop_cb_set(view->navi_it, + _mp_playlist_detail_view_pop_cb, view); /* update the first controlbar item */ - /* mp_view_manager_update_first_controlbar_item(layout_data);*/ + /* mp_view_manager_update_first_controlbar_item(layout_data); */ endfunc; return 0; } @@ -269,23 +313,28 @@ static void _mp_playlist_detail_view_content_load(void *thiz) { startfunc; Evas_Object *content = NULL; - MpPlaylistDetailView_t *view = (MpPlaylistDetailView_t *)thiz; + MpPlaylistDetailView_t *view = (MpPlaylistDetailView_t *) thiz; MP_CHECK(view); - view->content_to_show = (MpList_t *)mp_track_list_create(view->layout); + view->content_to_show = + (MpList_t *) mp_track_list_create(view->layout); if (view->list_type == MP_TRACK_BY_PLAYLIST) { DEBUG_TRACE("playlist id: %d", view->p_id); - mp_track_list_set_data((MpTrackList_t *)view->content_to_show, MP_TRACK_LIST_TYPE, view->list_type, MP_TRACK_LIST_PLAYLIT_ID, view->p_id, -1); + mp_track_list_set_data((MpTrackList_t *) view->content_to_show, + MP_TRACK_LIST_TYPE, view->list_type, + MP_TRACK_LIST_PLAYLIT_ID, view->p_id, -1); } else { - mp_track_list_set_data((MpTrackList_t *)view->content_to_show, MP_TRACK_LIST_TYPE, view->list_type, -1); + mp_track_list_set_data((MpTrackList_t *) view->content_to_show, + MP_TRACK_LIST_TYPE, view->list_type, -1); } - /*mp_track_list_set_data((MpTrackList_t *)view->content_to_show, MP_TRACK_LIST_INDEX_TYPE, MP_TRACK_LIST_INDEX_ALBUM_ART_LIST, -1);*/ + /*mp_track_list_set_data((MpTrackList_t *)view->content_to_show, MP_TRACK_LIST_INDEX_TYPE, MP_TRACK_LIST_INDEX_ALBUM_ART_LIST, -1); */ mp_list_update(view->content_to_show); content = mp_list_get_layout(view->content_to_show); if (content != NULL) { - elm_object_part_content_set(view->playlist_detail_view_layout, "list_content", content); + elm_object_part_content_set(view->playlist_detail_view_layout, + "list_content", content); } } @@ -297,13 +346,18 @@ _mp_playlist_detail_view_on_event_cb(void *thiz, MpViewEvent_e event) mp_debug("event = %d", event); switch (event) { - case MP_ADD_TO_PLAYLIST_DONE: { - int count = mp_list_get_editable_count((MpList_t *)view->content_to_show, mp_list_get_edit_type(view->content_to_show)); - if (count != 0) { - mp_track_list_update_albumart_index((MpTrackList_t *)view->content_to_show); + case MP_ADD_TO_PLAYLIST_DONE:{ + int count = + mp_list_get_editable_count((MpList_t *) view-> + content_to_show, + mp_list_get_edit_type(view-> + content_to_show)); + if (count != 0) { + mp_track_list_update_albumart_index((MpTrackList_t *) + view->content_to_show); + } + break; } - break; - } case MP_DELETE_DONE: case MP_PLAYLIST_REORDER_DONE: mp_list_update(view->content_to_show); @@ -312,45 +366,62 @@ _mp_playlist_detail_view_on_event_cb(void *thiz, MpViewEvent_e event) mp_track_list_popup_delete_genlist_item(view->content_to_show); mp_track_list_update_genlist(view->content_to_show); break; - case MP_UPDATE_FAVORITE_LIST: { - mp_list_update(view->content_to_show); - break; - } + case MP_UPDATE_FAVORITE_LIST:{ + mp_list_update(view->content_to_show); + break; + } #ifndef MP_SOUND_PLAYER case MP_UPDATE_PLAYING_LIST: - mp_list_realized_item_part_update(view->content_to_show, "elm.text.main.left.top", ELM_GENLIST_ITEM_FIELD_TEXT); - mp_list_realized_item_part_update(view->content_to_show, "elm.text.sub.left.bottom", ELM_GENLIST_ITEM_FIELD_TEXT); + mp_list_realized_item_part_update(view->content_to_show, + "elm.text.main.left.top", + ELM_GENLIST_ITEM_FIELD_TEXT); + mp_list_realized_item_part_update(view->content_to_show, + "elm.text.sub.left.bottom", + ELM_GENLIST_ITEM_FIELD_TEXT); break; #endif - case MP_PLAY_TIME_COUNT_UPDATED: { - if (view->p_id == MP_SYS_PLST_RECENTELY_PLAYED || - view->p_id == MP_SYS_PLST_MOST_PLAYED) { - Evas_Object *content = NULL; - content = elm_object_part_content_unset(view->playlist_detail_view_layout, "list-content"); - evas_object_del(content); - mp_list_update(view->content_to_show); - int count = mp_list_get_editable_count((MpList_t *)view->content_to_show, mp_list_get_edit_type(view->content_to_show)); - if (count != 0) { - mp_track_list_update_albumart_index((MpTrackList_t *)view->content_to_show); + case MP_PLAY_TIME_COUNT_UPDATED:{ + if (view->p_id == MP_SYS_PLST_RECENTELY_PLAYED || + view->p_id == MP_SYS_PLST_MOST_PLAYED) { + Evas_Object *content = NULL; + content = + elm_object_part_content_unset(view-> + playlist_detail_view_layout, + "list-content"); + evas_object_del(content); + mp_list_update(view->content_to_show); + int count = + mp_list_get_editable_count((MpList_t *) view-> + content_to_show, + mp_list_get_edit_type(view-> + content_to_show)); + if (count != 0) { + mp_track_list_update_albumart_index((MpTrackList_t *) + view-> + content_to_show); + } } + break; } - break; - } case MP_VIEW_EVENT_ALBUMART_CHANGED: - mp_list_realized_item_part_update(view->content_to_show, "elm.icon", ELM_GENLIST_ITEM_FIELD_CONTENT); + mp_list_realized_item_part_update(view->content_to_show, + "elm.icon", + ELM_GENLIST_ITEM_FIELD_CONTENT); break; case MP_VIEW_TRANSITION_FINISHED: mp_view_mgr_post_event(GET_VIEW_MGR, MP_PLAYLIST_CREATED); -// eext_object_event_callback_add(GET_VIEW_MGR->navi, EEXT_CALLBACK_BACK, eext_naviframe_back_cb, NULL); +// eext_object_event_callback_add(GET_VIEW_MGR->navi, EEXT_CALLBACK_BACK, eext_naviframe_back_cb, NULL); break; case MP_START_PLAYBACK: case MP_RESUME_PLAYBACK: case MP_PAUSE_PLAYBACK: case MP_PLAYING_TRACK_CHANGED: - case MP_STOP_PLAYBACK: { - mp_list_realized_item_part_update(view->content_to_show, "elm.icon.left", ELM_GENLIST_ITEM_FIELD_CONTENT); - break; - } + case MP_STOP_PLAYBACK:{ + mp_list_realized_item_part_update(view->content_to_show, + "elm.icon.left", + ELM_GENLIST_ITEM_FIELD_CONTENT); + break; + } default: break; } @@ -361,45 +432,54 @@ _mp_playlist_detail_view_on_event_cb(void *thiz, MpViewEvent_e event) static void _mp_playlist_detail_view_resume(void *thiz) { startfunc; - MpPlaylistDetailView_t *view = (MpPlaylistDetailView_t *)thiz; - mp_view_freeze_nowplaying((MpView_t *)thiz, 0); + MpPlaylistDetailView_t *view = (MpPlaylistDetailView_t *) thiz; + mp_view_freeze_nowplaying((MpView_t *) thiz, 0); - /*check is no content*/ - MpTrackList_t *track_list = (MpTrackList_t *)view->content_to_show; + /*check is no content */ + MpTrackList_t *track_list = (MpTrackList_t *) view->content_to_show; if (track_list->no_content != NULL) { - mp_list_update((MpList_t *)track_list); + mp_list_update((MpList_t *) track_list); } } static int -_mp_playlist_detail_view_init(Evas_Object *parent, MpPlaylistDetailView_t *view) +_mp_playlist_detail_view_init(Evas_Object * parent, + MpPlaylistDetailView_t * view) { startfunc; int ret = 0; - ret = mp_list_view_init(parent, (MpListView_t *)view, MP_VIEW_PLAYLIST_DETAIL); + ret = + mp_list_view_init(parent, (MpListView_t *) view, + MP_VIEW_PLAYLIST_DETAIL); MP_CHECK_VAL(ret == 0, -1); view->update = _mp_playlist_detail_view_update; view->update_options = _mp_playlist_detail_view_update_options; - /*view->update_options_edit = _mp_playlist_detail_view_update_options_edit;*/ + /*view->update_options_edit = _mp_playlist_detail_view_update_options_edit; */ view->view_destroy_cb = _mp_playlist_detail_view_destory_cb; view->content_set = _mp_playlist_detail_view_content_load; view->on_event = _mp_playlist_detail_view_on_event_cb; view->view_resume = _mp_playlist_detail_view_resume; - /*Todo: we need to add a new layout style*/ + /*Todo: we need to add a new layout style */ view->playlist_detail_view_layout = view->layout; MP_CHECK_VAL(view->playlist_detail_view_layout, -1); return ret; } -MpPlaylistDetailView_t *mp_playlist_detail_view_create(Evas_Object *parent, mp_track_type_e list_type, char *name, int p_id) +MpPlaylistDetailView_t *mp_playlist_detail_view_create(Evas_Object * + parent, + mp_track_type_e + list_type, + char *name, + int p_id) { eventfunc; int ret; MP_CHECK_NULL(parent); - MpPlaylistDetailView_t *view = calloc(1, sizeof(MpPlaylistDetailView_t)); + MpPlaylistDetailView_t *view = + calloc(1, sizeof(MpPlaylistDetailView_t)); MP_CHECK_NULL(view); ret = _mp_playlist_detail_view_init(parent, view); @@ -413,13 +493,13 @@ MpPlaylistDetailView_t *mp_playlist_detail_view_create(Evas_Object *parent, mp_t view->content_set(view); return view; -Error: + Error: ERROR_TRACE("Error: mp_playlist_detail_view_create()"); IF_FREE(view); return NULL; } -int mp_playlist_detail_view_destory(MpPlaylistDetailView_t *view) +int mp_playlist_detail_view_destory(MpPlaylistDetailView_t * view) { startfunc; MP_CHECK_VAL(view, -1); @@ -428,6 +508,3 @@ int mp_playlist_detail_view_destory(MpPlaylistDetailView_t *view) return 0; } - - - diff --git a/src/view/mp-search-view.c b/src/view/mp-search-view.c index bd17064..0b54615 100644 --- a/src/view/mp-search-view.c +++ b/src/view/mp-search-view.c @@ -23,15 +23,14 @@ #define MP_SEARCHBAR_W 400*elm_config_scale_get() -static void -_mp_search_view_destory_cb(void *thiz) +static void _mp_search_view_destory_cb(void *thiz) { eventfunc; MpSearchView_t *view = thiz; MP_CHECK(view); - mp_list_view_fini((MpListView_t *)view); + mp_list_view_fini((MpListView_t *) view); - /* TODO: release resource..*/ + /* TODO: release resource.. */ mp_search_view_destory(view); mp_ecore_timer_del(view->search_timer); @@ -51,19 +50,18 @@ int _mp_search_view_update(void *thiz) static void _mp_search_view_update_option_clear(void *thiz) { startfunc; - MpSearchView_t *view = (MpSearchView_t *)thiz; + MpSearchView_t *view = (MpSearchView_t *) thiz; MP_CHECK(view); /* destroy back button */ Evas_Object *btn = NULL; btn = elm_object_item_part_content_unset(view->navi_it, - "toolbar_more_btn"); + "toolbar_more_btn"); mp_evas_object_del(btn); - endfunc -} +endfunc} /*************** functions for track list update *******************/ -static Eina_Bool _mp_search_view_back_cb(void *data, Elm_Object_Item *it) +static Eina_Bool _mp_search_view_back_cb(void *data, Elm_Object_Item * it) { eventfunc; @@ -85,15 +83,15 @@ static Eina_Bool _mp_search_view_back_cb(void *data, Elm_Object_Item *it) static int _mp_search_view_update_options(void *thiz) { startfunc; - MpSearchView_t *view = (MpSearchView_t *)thiz; + MpSearchView_t *view = (MpSearchView_t *) thiz; MP_CHECK_VAL(view, -1); _mp_search_view_update_option_clear(view); elm_naviframe_item_title_enabled_set(view->navi_it, - (Eina_Bool)EINA_FALSE, false); + (Eina_Bool) EINA_FALSE, false); elm_naviframe_item_pop_cb_set(view->navi_it, - _mp_search_view_back_cb, view); + _mp_search_view_back_cb, view); /* update the first controlba item */ /* mp_view_manager_update_first_controlbar_item(layout_data); */ @@ -101,8 +99,7 @@ static int _mp_search_view_update_options(void *thiz) return 0; } -static Eina_Bool -_mp_search_view_update_list_timer_cb(void *data) +static Eina_Bool _mp_search_view_update_list_timer_cb(void *data) { eventfunc; MpSearchView_t *view = (MpSearchView_t *) data; @@ -117,7 +114,7 @@ _mp_search_view_update_list_timer_cb(void *data) DEBUG_TRACE("view->needle: %s", view->needle); /* if (!view->needle || !strlen(view->needle)) - mp_search_show_imf_pannel(view->search_bar); */ + mp_search_show_imf_pannel(view->search_bar); */ view->search_timer = NULL; return EINA_FALSE; @@ -126,7 +123,7 @@ _mp_search_view_update_list_timer_cb(void *data) static void _mp_search_view_keyword_changed_cb(void *data, - Evas_Object *obj, void *event_info) + Evas_Object * obj, void *event_info) { MpSearchView_t *view = (MpSearchView_t *) data; MP_CHECK(view); @@ -139,10 +136,10 @@ _mp_search_view_keyword_changed_cb(void *data, int length = strlen(search_str); if (length > 0) { elm_object_signal_emit(view->search_bar, - "image,enable,1", "*"); + "image,enable,1", "*"); } else { elm_object_signal_emit(view->search_bar, - "image,disable,1", "*"); + "image,disable,1", "*"); } } if (search_str) { @@ -158,38 +155,39 @@ _mp_search_view_keyword_changed_cb(void *data, /* signal = "show.screen"; */ } /*when create search view, we use this first_called flag to load genlsit - ,then change key word, refresh the genlist*/ + ,then change key word, refresh the genlist */ /*if (view->first_called) { - view->first_called = FALSE; - return; - } else { - view->needle_change = TRUE; - }*/ + view->first_called = FALSE; + return; + } else { + view->needle_change = TRUE; + } */ view->needle_change = TRUE; mp_ecore_timer_del(view->search_timer); view->search_timer = ecore_timer_add(0.1, - _mp_search_view_update_list_timer_cb, view); + _mp_search_view_update_list_timer_cb, + view); } -static void -_mp_search_view_create_search_bar(void *thiz) +static void _mp_search_view_create_search_bar(void *thiz) { startfunc; - MpSearchView_t *view = (MpSearchView_t *)thiz; + MpSearchView_t *view = (MpSearchView_t *) thiz; MP_CHECK(view); MP_CHECK(view->search_base_layout); view->search_bar = mp_search_create_new(view->search_base_layout, - _mp_search_view_keyword_changed_cb, view, NULL, NULL, - NULL, view, NULL, view); + _mp_search_view_keyword_changed_cb, + view, NULL, NULL, NULL, view, + NULL, view); MP_CHECK(view->search_base_layout); evas_object_show(mp_search_entry_get(view->search_bar)); /*elm_object_focus_set(mp_search_entry_get(view->search_bar), TRUE); - elm_object_signal_callback_add(view->search_view_layout, - SIGNAL_MOUSE_CLICK, "elm.rect.screen", _mp_search_view_screen_ - clicked_cb, view); */ + elm_object_signal_callback_add(view->search_view_layout, + SIGNAL_MOUSE_CLICK, "elm.rect.screen", _mp_search_view_screen_ + clicked_cb, view); */ endfunc; } @@ -197,37 +195,39 @@ static void _mp_search_view_content_load(void *thiz) { startfunc; Evas_Object *layout = NULL; - MpSearchView_t *view = (MpSearchView_t *)thiz; + MpSearchView_t *view = (MpSearchView_t *) thiz; MP_CHECK(view); /* when keyword change, we hide items, - do not need create genlist again */ + do not need create genlist again */ if (view->needle_change) { - MpSearchList_t* list = (MpSearchList_t *)view->content_to_show; + MpSearchList_t *list = (MpSearchList_t *) view->content_to_show; mp_search_list_set_data(list, - MP_SEARCH_LIST_FILTER_STR, view->needle, -1); + MP_SEARCH_LIST_FILTER_STR, view->needle, + -1); list->refresh(list); } else { - Evas_Object *content = elm_object_part_content_unset( - view->search_view_layout, "elm.swallow.content"); + Evas_Object *content = + elm_object_part_content_unset(view->search_view_layout, + "elm.swallow.content"); evas_object_del(content); - view->content_to_show = (MpList_t *)mp_search_list_create( - view->layout); - mp_search_list_set_data((MpSearchList_t *)view->content_to_show - , MP_SEARCH_LIST_FILTER_STR, view->needle, -1); + view->content_to_show = + (MpList_t *) mp_search_list_create(view->layout); + mp_search_list_set_data((MpSearchList_t *) view->content_to_show, + MP_SEARCH_LIST_FILTER_STR, view->needle, + -1); mp_list_update(view->content_to_show); layout = mp_list_get_layout(view->content_to_show); if (layout != NULL) { elm_object_part_content_set(view->search_view_layout, - "elm.swallow.content", layout); + "elm.swallow.content", layout); } } } -static void -_mp_search_view_on_event_cb(void *thiz, MpViewEvent_e event) +static void _mp_search_view_on_event_cb(void *thiz, MpViewEvent_e event) { DEBUG_TRACE("event; %d", event); MpSearchView_t *view = thiz; @@ -236,39 +236,40 @@ _mp_search_view_on_event_cb(void *thiz, MpViewEvent_e event) switch (event) { case MP_VIEW_TRANSITION_FINISHED: view->transition = false; - if ((int)mp_view_mgr_get_top_view(GET_VIEW_MGR) == (int)view) { - elm_object_focus_allow_set(mp_search_entry_get(view-> - search_bar), EINA_TRUE); - elm_object_focus_set(mp_search_entry_get(view-> - search_bar), EINA_TRUE); + if ((int) mp_view_mgr_get_top_view(GET_VIEW_MGR) == (int) view) { + elm_object_focus_allow_set(mp_search_entry_get + (view->search_bar), EINA_TRUE); + elm_object_focus_set(mp_search_entry_get(view->search_bar), + EINA_TRUE); } break; - case MP_SIP_STATE_CHANGED: { - if ((int)mp_view_mgr_get_top_view(GET_VIEW_MGR) == - (int)view) { - struct appdata *ad = mp_util_get_appdata(); - MP_CHECK(ad); - elm_object_focus_allow_set( - mp_search_entry_get(view->search_bar), - EINA_TRUE); + case MP_SIP_STATE_CHANGED:{ + if ((int) mp_view_mgr_get_top_view(GET_VIEW_MGR) == (int) view) { + struct appdata *ad = mp_util_get_appdata(); + MP_CHECK(ad); + elm_object_focus_allow_set(mp_search_entry_get + (view->search_bar), EINA_TRUE); + } } - } - break; + break; default: break; } } static void -_mp_search_view_back_button_clicked(void *data, Evas_Object *o, - const char *emission, const char *source) +_mp_search_view_back_button_clicked(void *data, Evas_Object * o, + const char *emission, + const char *source) { MpViewMgr_t *view_mgr = mp_view_mgr_get_view_manager(); MP_CHECK(view_mgr); elm_naviframe_item_pop(view_mgr->navi); } -static void _mp_search_view_create_back_button(Evas_Object *parent, MpSearchView_t *view) { +static void _mp_search_view_create_back_button(Evas_Object * parent, + MpSearchView_t * view) +{ MP_CHECK(parent); MP_CHECK(view); @@ -276,16 +277,18 @@ static void _mp_search_view_create_back_button(Evas_Object *parent, MpSearchView back_button = elm_button_add(parent); elm_object_style_set(back_button, "naviframe/end_btn/default"); elm_object_part_content_set(parent, "back_button", back_button); - evas_object_smart_callback_add(back_button, "clicked", _mp_search_view_back_button_clicked, view); + evas_object_smart_callback_add(back_button, "clicked", + _mp_search_view_back_button_clicked, + view); evas_object_show(back_button); } static int -_mp_search_view_init(Evas_Object *parent, MpSearchView_t *view) +_mp_search_view_init(Evas_Object * parent, MpSearchView_t * view) { startfunc; int ret = 0; - ret = mp_list_view_init(parent, (MpListView_t *)view, MP_VIEW_SEARCH); + ret = mp_list_view_init(parent, (MpListView_t *) view, MP_VIEW_SEARCH); MP_CHECK_VAL(ret == 0, -1); view->update = _mp_search_view_update; @@ -304,43 +307,47 @@ _mp_search_view_init(Evas_Object *parent, MpSearchView_t *view) Elm_Theme *th = elm_theme_new(); elm_theme_extension_add(th, THEME_NAME); - view->search_view_layout = elm_layout_add(view->layout); + view->search_view_layout = elm_layout_add(view->layout); MP_CHECK_VAL(view->search_view_layout, -1); double scale = elm_config_scale_get(); if ((scale - 1.8) < 0.0001) { elm_layout_theme_set(view->search_view_layout, - "layout", "application", "search_view_layout_wvga"); + "layout", "application", + "search_view_layout_wvga"); } else if ((scale - 2.6) < 0.0001) { elm_layout_theme_set(view->search_view_layout, - "layout", "application", "search_view_layout_hd"); + "layout", "application", + "search_view_layout_hd"); } else { elm_layout_theme_set(view->search_view_layout, - "layout", "application", "search_view_layout_qhd"); + "layout", "application", + "search_view_layout_qhd"); } elm_object_part_content_set(view->layout, - "list_content", view->search_view_layout); + "list_content", view->search_view_layout); /* search bar Base Layout */ Elm_Theme *th1 = elm_theme_new(); elm_theme_extension_add(th1, THEME_NAME); - view->search_base_layout = elm_layout_add(view->search_view_layout); + view->search_base_layout = elm_layout_add(view->search_view_layout); elm_layout_theme_set(view->search_base_layout, - "layout", "application", "searches"); + "layout", "application", "searches"); elm_object_part_content_set(view->search_view_layout, - "search_bar", view->search_base_layout); + "search_bar", view->search_base_layout); _mp_search_view_create_search_bar(view); elm_object_part_content_set(view->search_base_layout, - "searching", view->search_bar); + "searching", view->search_bar); _mp_search_view_create_back_button(view->search_base_layout, view); return ret; } -MpSearchView_t *mp_search_view_create(Evas_Object *parent, const char *keyword) +MpSearchView_t *mp_search_view_create(Evas_Object * parent, + const char *keyword) { eventfunc; int ret; @@ -363,14 +370,13 @@ MpSearchView_t *mp_search_view_create(Evas_Object *parent, const char *keyword) return view; -Error: + Error: ERROR_TRACE("Error: mp_search_view_create()"); IF_FREE(view); return NULL; } -void -mp_search_view_set_keyword(MpSearchView_t *view, const char *keyword) +void mp_search_view_set_keyword(MpSearchView_t * view, const char *keyword) { MP_CHECK(view); IF_FREE(view->needle); @@ -378,12 +384,10 @@ mp_search_view_set_keyword(MpSearchView_t *view, const char *keyword) mp_search_text_set(view->search_bar, keyword); } -int mp_search_view_destory(MpSearchView_t *view) +int mp_search_view_destory(MpSearchView_t * view) { startfunc; MP_CHECK_VAL(view, -1); IF_G_FREE(view->needle); return 0; } - - diff --git a/src/view/mp-select-track-view.c b/src/view/mp-select-track-view.c index cd480fa..1dcd244 100644 --- a/src/view/mp-select-track-view.c +++ b/src/view/mp-select-track-view.c @@ -25,15 +25,14 @@ #define MP_LABEL_SLIDE_DURATION 5 -static void -_mp_select_track_view_destory_cb(void *thiz) +static void _mp_select_track_view_destory_cb(void *thiz) { eventfunc; MpSelectTrackView_t *view = thiz; MP_CHECK(view); - mp_list_view_fini((MpListView_t *)view); + mp_list_view_fini((MpListView_t *) view); - /* TODO: release resource..*/ + /* TODO: release resource.. */ free(view); } @@ -49,9 +48,10 @@ int _mp_select_track_view_update(void *thiz) return 0; } -/*************** functions for track list update *******************/ +/*************** functions for track list update *******************/ -static Eina_Bool _mp_select_track_view_back_cb(void *data, Elm_Object_Item *it) +static Eina_Bool _mp_select_track_view_back_cb(void *data, + Elm_Object_Item * it) { eventfunc; @@ -62,10 +62,13 @@ static Eina_Bool _mp_select_track_view_back_cb(void *data, Elm_Object_Item *it) } void -mp_select_track_view_add_to_playlist_cb(void *data, Evas_Object * obj, void *event_info) +mp_select_track_view_add_to_playlist_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; - MpAddTrackView_t *view = (MpAddTrackView_t *)mp_view_mgr_get_view(GET_VIEW_MGR, MP_VIEW_ADD_TRACK); + MpAddTrackView_t *view = + (MpAddTrackView_t *) mp_view_mgr_get_view(GET_VIEW_MGR, + MP_VIEW_ADD_TRACK); MP_CHECK(view); mp_edit_cb_excute_add_to_playlist(data, view->playlist_id, NULL, true); @@ -74,24 +77,30 @@ mp_select_track_view_add_to_playlist_cb(void *data, Evas_Object * obj, void *eve static int _mp_select_track_view_update_options(void *thiz) { startfunc; - MpSelectTrackView_t *view = (MpSelectTrackView_t *)thiz; + MpSelectTrackView_t *view = (MpSelectTrackView_t *) thiz; MP_CHECK_VAL(view, -1); - mp_util_create_selectioninfo_with_count((MpView_t *)view, mp_list_get_checked_count((MpList_t *)view->content_to_show)); + mp_util_create_selectioninfo_with_count((MpView_t *) view, + mp_list_get_checked_count((MpList_t *) view->content_to_show)); - unsigned int count = mp_list_get_editable_count((MpList_t *)view->content_to_show, MP_LIST_EDIT_TYPE_NORMAL); + unsigned int count = + mp_list_get_editable_count((MpList_t *) view->content_to_show, + MP_LIST_EDIT_TYPE_NORMAL); if (count <= 0) { - mp_view_mgr_pop_a_view((MpViewMgr_t *)GET_VIEW_MGR, (MpView_t *)view); + mp_view_mgr_pop_a_view((MpViewMgr_t *) GET_VIEW_MGR, + (MpView_t *) view); } - elm_naviframe_item_pop_cb_set(view->navi_it, _mp_select_track_view_back_cb, view); + elm_naviframe_item_pop_cb_set(view->navi_it, + _mp_select_track_view_back_cb, view); - if (mp_list_get_checked_count((MpList_t *)view->content_to_show) == count) { + if (mp_list_get_checked_count((MpList_t *) view->content_to_show) == + count) { elm_check_state_set(view->select_all_btn, EINA_TRUE); } else { elm_check_state_set(view->select_all_btn, EINA_FALSE); } if (view->done_btn) { - if (mp_list_get_checked_count((MpList_t *)view->content_to_show)) { + if (mp_list_get_checked_count((MpList_t *) view->content_to_show)) { elm_object_disabled_set(view->done_btn, EINA_FALSE); } else { elm_object_disabled_set(view->done_btn, EINA_TRUE); @@ -101,7 +110,7 @@ static int _mp_select_track_view_update_options(void *thiz) /* update the first controlba item */ - /*mp_view_manager_update_first_controlbar_item(layout_data);*/ + /*mp_view_manager_update_first_controlbar_item(layout_data); */ endfunc; return 0; } @@ -109,22 +118,24 @@ static int _mp_select_track_view_update_options(void *thiz) static void _mp_select_track_view_content_load(void *thiz) { startfunc; - MpSelectTrackView_t *view = (MpSelectTrackView_t *)thiz; + MpSelectTrackView_t *view = (MpSelectTrackView_t *) thiz; MP_CHECK(view); MP_CHECK(view->layout); - view->content_to_show = (MpList_t *)mp_track_list_create(view->layout); + view->content_to_show = + (MpList_t *) mp_track_list_create(view->layout); MP_CHECK(view->content_to_show); - /*Todo: move the followed outside*/ + /*Todo: move the followed outside */ /* mp_track_list_set_data(view->content_to_show, MP_TRACK_LIST_TYPE, MP_TRACK_BY_ALBUM, MP_TRACK_LIST_TYPE_STR, view->name, -1); - view->content_to_show->update(view->content_to_show);*/ + view->content_to_show->update(view->content_to_show); */ MP_CHECK(view->content_to_show->layout); - elm_object_part_content_set(view->layout, "list_content", view->content_to_show->layout); - edje_object_signal_emit(_EDJ(view->layout), "SHOW_SELECT_ALL_PADDING", "*"); + elm_object_part_content_set(view->layout, "list_content", + view->content_to_show->layout); + edje_object_signal_emit(_EDJ(view->layout), "SHOW_SELECT_ALL_PADDING", + "*"); } -static void -_mp_select_track_view_on_event(void *thiz, MpViewEvent_e event) +static void _mp_select_track_view_on_event(void *thiz, MpViewEvent_e event) { switch (event) { case MP_ADD_TO_PLAYLIST_DONE: @@ -137,11 +148,14 @@ _mp_select_track_view_on_event(void *thiz, MpViewEvent_e event) } static int -_mp_select_track_view_init(Evas_Object *parent, MpSelectTrackView_t *view) +_mp_select_track_view_init(Evas_Object * parent, + MpSelectTrackView_t * view) { startfunc; int ret = 0; - ret = mp_list_view_init(parent, (MpListView_t *)view, MP_VIEW_SELECT_TRACK); + ret = + mp_list_view_init(parent, (MpListView_t *) view, + MP_VIEW_SELECT_TRACK); MP_CHECK_VAL(ret == 0, -1); view->update = _mp_select_track_view_update; @@ -157,7 +171,7 @@ _mp_select_track_view_init(Evas_Object *parent, MpSelectTrackView_t *view) return ret; } -MpSelectTrackView_t *mp_select_track_view_create(Evas_Object *parent) +MpSelectTrackView_t *mp_select_track_view_create(Evas_Object * parent) { eventfunc; int ret; @@ -174,18 +188,16 @@ MpSelectTrackView_t *mp_select_track_view_create(Evas_Object *parent) _mp_select_track_view_content_load(view); return view; -Error: + Error: ERROR_TRACE("Error: mp_select_track_view_create()"); IF_FREE(view); return NULL; } -int mp_select_track_view_destory(MpSelectTrackView_t *view) +int mp_select_track_view_destory(MpSelectTrackView_t * view) { startfunc; MP_CHECK_VAL(view, -1); return 0; } - - diff --git a/src/view/mp-set-as-view.c b/src/view/mp-set-as-view.c index a23dc8f..61a5e0a 100644 --- a/src/view/mp-set-as-view.c +++ b/src/view/mp-set-as-view.c @@ -36,14 +36,14 @@ typedef struct { } item_data_s; static void _mp_set_as_view_moved_recommended_time(void *data); -static void _mp_set_as_view_enable_done_btn(MpSetAsView_t *view); +static void _mp_set_as_view_enable_done_btn(MpSetAsView_t * view); /*SMAT id; SMAT_STAT nowstat = SMAT_ERR; */ pthread_mutex_t smat_mutex; -pthread_cond_t smat_cond; +pthread_cond_t smat_cond; static char *_mp_set_as_view_time_to_string(int time) { @@ -75,10 +75,10 @@ static char *_mp_set_as_view_time_to_string(int time) /****Pre-listen related****/ static void _mp_set_as_view_create_player(void *data) { - MpSetAsView_t *view = (MpSetAsView_t *)data; + MpSetAsView_t *view = (MpSetAsView_t *) data; MP_CHECK(view); - /*1. create player*/ + /*1. create player */ int ret = 0; ret = player_create(&(view->player)); if (PLAYER_ERROR_NONE != ret) { @@ -88,10 +88,10 @@ static void _mp_set_as_view_create_player(void *data) static void _mp_set_as_view_destroy_player(void *data) { - MpSetAsView_t *view = (MpSetAsView_t *)data; + MpSetAsView_t *view = (MpSetAsView_t *) data; MP_CHECK(view); - /*1. create player*/ + /*1. create player */ int ret = 0; ret = player_destroy(view->player); if (PLAYER_ERROR_NONE != ret) { @@ -102,7 +102,7 @@ static void _mp_set_as_view_destroy_player(void *data) static int _mp_set_as_view_get_duration(void *data) { - MpSetAsView_t *view = (MpSetAsView_t *)data; + MpSetAsView_t *view = (MpSetAsView_t *) data; MP_CHECK_VAL(view, 0); MP_CHECK_VAL(view->player, 0); @@ -118,11 +118,11 @@ static int _mp_set_as_view_get_duration(void *data) static void _mp_set_as_view_prelisten_set_uri(void *data) { - MpSetAsView_t *view = (MpSetAsView_t *)data; + MpSetAsView_t *view = (MpSetAsView_t *) data; MP_CHECK(view); MP_CHECK(view->player); - char *path = NULL; /* do not free */ + char *path = NULL; /* do not free */ struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); path = view->path; @@ -137,7 +137,7 @@ static void _mp_set_as_view_prelisten_set_uri(void *data) static void _mp_set_as_view_prelisten_prepare(void *data) { - MpSetAsView_t *view = (MpSetAsView_t *)data; + MpSetAsView_t *view = (MpSetAsView_t *) data; MP_CHECK(view); MP_CHECK(view->player); @@ -150,7 +150,7 @@ static void _mp_set_as_view_prelisten_prepare(void *data) static void _mp_set_as_view_prelisten_start(void *data) { - MpSetAsView_t *view = (MpSetAsView_t *)data; + MpSetAsView_t *view = (MpSetAsView_t *) data; MP_CHECK(view); MP_CHECK(view->player); @@ -163,7 +163,7 @@ static void _mp_set_as_view_prelisten_start(void *data) static void _mp_set_as_view_prelisten_stop(void *data) { - MpSetAsView_t *view = (MpSetAsView_t *)data; + MpSetAsView_t *view = (MpSetAsView_t *) data; MP_CHECK(view); MP_CHECK(view->player); @@ -176,7 +176,7 @@ static void _mp_set_as_view_prelisten_stop(void *data) static void _mp_set_as_view_prelisten_pause(void *data) { - MpSetAsView_t *view = (MpSetAsView_t *)data; + MpSetAsView_t *view = (MpSetAsView_t *) data; MP_CHECK(view); MP_CHECK(view->player); @@ -189,7 +189,7 @@ static void _mp_set_as_view_prelisten_pause(void *data) static player_state_e _mp_set_as_view_prelisten_get_state(void *data) { - MpSetAsView_t *view = (MpSetAsView_t *)data; + MpSetAsView_t *view = (MpSetAsView_t *) data; MP_CHECK_VAL(view, PLAYER_STATE_NONE); MP_CHECK_VAL(view->player, PLAYER_STATE_NONE); @@ -204,7 +204,7 @@ static player_state_e _mp_set_as_view_prelisten_get_state(void *data) static void __mp_set_as_view_player_seek_completed_cb(void *data) { - MpSetAsView_t *view = (MpSetAsView_t *)data; + MpSetAsView_t *view = (MpSetAsView_t *) data; MP_CHECK(view); MP_CHECK(view->player); @@ -217,16 +217,21 @@ static void __mp_set_as_view_player_seek_completed_cb(void *data) _mp_set_as_view_moved_recommended_time(view); } -static void _mp_set_as_view_prelisten_set_position(void *data, player_seek_completed_cb callback, void *cb_data, bool flag_position) +static void _mp_set_as_view_prelisten_set_position(void *data, + player_seek_completed_cb + callback, void *cb_data, + bool flag_position) { - MpSetAsView_t *view = (MpSetAsView_t *)data; + MpSetAsView_t *view = (MpSetAsView_t *) data; MP_CHECK(view); MP_CHECK(view->player); DEBUG_TRACE("seek postion is %d", view->position); int position = flag_position ? view->position : 0; int ret = PLAYER_ERROR_NONE; - ret = player_set_play_position(view->player, position, TRUE, callback, cb_data); + ret = + player_set_play_position(view->player, position, TRUE, callback, + cb_data); if (ret != PLAYER_ERROR_NONE) { ERROR_TRACE("set position failed"); } @@ -235,28 +240,28 @@ static void _mp_set_as_view_prelisten_set_position(void *data, player_seek_compl /**************************/ /************SMAT related*****************/ -void *observer(void* data) +void *observer(void *data) { - MpSetAsView_t *view = (MpSetAsView_t *)data; + MpSetAsView_t *view = (MpSetAsView_t *) data; MP_CHECK_NULL(view); long int pos = 0; /*SMAT id = param; - SMAT_INFO info; - info.seg_infos = NULL; + SMAT_INFO info; + info.seg_infos = NULL; - while (1)*/ + while (1) */ { /*nowstat = smat_get_stat(id); - if (nowstat == SMAT_CLST_DONE)*/ + if (nowstat == SMAT_CLST_DONE) */ { /*smat_get_info(id,&info); - pos = info.time / 1000; - DEBUG_TRACE("*Selected Pos : [%ld:%ld]", (((pos)%3600)/60),(((pos)%3600)%60)); - view->position = info.time; - break; */ + pos = info.time / 1000; + DEBUG_TRACE("*Selected Pos : [%ld:%ld]", (((pos)%3600)/60),(((pos)%3600)%60)); + view->position = info.time; + break; */ } - /*else if (nowstat == SMAT_QUIT )*/ + /*else if (nowstat == SMAT_QUIT ) */ { /*break; */ } @@ -266,34 +271,49 @@ void *observer(void* data) return NULL; } -void _mp_set_as_view_smat_pipe_cb(void *data, void *buffer, unsigned int nbyte) +void _mp_set_as_view_smat_pipe_cb(void *data, void *buffer, + unsigned int nbyte) { startfunc; - MpSetAsView_t *view = (MpSetAsView_t *)data; + MpSetAsView_t *view = (MpSetAsView_t *) data; MP_CHECK(view); - long int message = (long int)buffer; + long int message = (long int) buffer; DEBUG_TRACE("Position is %ld", message); /* smat_deinit(id); */ - /*set recommended text*/ + /*set recommended text */ Evas_Object *genlist = view->content; - Evas_Object *layout = elm_object_item_part_content_get(elm_genlist_nth_item_get(genlist, MP_SET_AS_RECOMMEND_PRE_LISTEN), "elm.icon"); - Evas_Object *recommended_txt = elm_object_part_content_get(layout, "recommended_text_play"); - char *recommended_time = _mp_set_as_view_time_to_string(view->position); - mp_util_domain_translatable_text_set(recommended_txt, recommended_time); + Evas_Object *layout = + elm_object_item_part_content_get(elm_genlist_nth_item_get + (genlist, + MP_SET_AS_RECOMMEND_PRE_LISTEN), + "elm.icon"); + Evas_Object *recommended_txt = + elm_object_part_content_get(layout, "recommended_text_play"); + char *recommended_time = + _mp_set_as_view_time_to_string(view->position); + mp_util_domain_translatable_text_set(recommended_txt, + recommended_time); IF_FREE(recommended_time); /* evas_object_show(recommended_txt); */ - Evas_Object *progressbar = elm_object_part_content_get(layout, "progress_bar"); - elm_progressbar_value_set(progressbar, (double)(1.0 - (double)view->position / (double)view->duration)); - - _mp_set_as_view_prelisten_set_position(view, __mp_set_as_view_player_seek_completed_cb, view, true); + Evas_Object *progressbar = + elm_object_part_content_get(layout, "progress_bar"); + elm_progressbar_value_set(progressbar, + (double) (1.0 - + (double) view->position / + (double) view->duration)); + + _mp_set_as_view_prelisten_set_position(view, + __mp_set_as_view_player_seek_completed_cb, + view, true); } void -_mp_set_as_view_smat_popup_back_cb(void *data, Evas_Object *obj, void *event_info) +_mp_set_as_view_smat_popup_back_cb(void *data, Evas_Object * obj, + void *event_info) { return; } @@ -301,7 +321,7 @@ _mp_set_as_view_smat_popup_back_cb(void *data, Evas_Object *obj, void *event_inf /**************************/ static void _mp_set_as_view_moved_recommended_time(void *data) { - MpSetAsView_t *view = (MpSetAsView_t *)data; + MpSetAsView_t *view = (MpSetAsView_t *) data; MP_CHECK(view); MP_CHECK(view->player); @@ -309,13 +329,23 @@ static void _mp_set_as_view_moved_recommended_time(void *data) Evas_Coord px = 0, py = 0, pw = 0, ph = 0; Evas_Coord rx = 0, ry = 0, rw = 0, rh = 0; Evas_Object *genlist = view->content; - Evas_Object *layout = elm_object_item_part_content_get(elm_genlist_nth_item_get(genlist, MP_SET_AS_RECOMMEND_PRE_LISTEN), "elm.icon"); - Evas_Object *recommended_layout = elm_object_part_content_get(layout, "recommended_text_play"); - Evas_Object *recommended_txt = elm_object_part_content_get(recommended_layout, "progressbar_playing"); - Evas_Object *progressbar = elm_object_part_content_get(layout, "progress_bar"); - - char *recommended_time = _mp_set_as_view_time_to_string(view->position); - mp_util_domain_translatable_text_set(recommended_txt, recommended_time); + Evas_Object *layout = + elm_object_item_part_content_get(elm_genlist_nth_item_get + (genlist, + MP_SET_AS_RECOMMEND_PRE_LISTEN), + "elm.icon"); + Evas_Object *recommended_layout = + elm_object_part_content_get(layout, "recommended_text_play"); + Evas_Object *recommended_txt = + elm_object_part_content_get(recommended_layout, + "progressbar_playing"); + Evas_Object *progressbar = + elm_object_part_content_get(layout, "progress_bar"); + + char *recommended_time = + _mp_set_as_view_time_to_string(view->position); + mp_util_domain_translatable_text_set(recommended_txt, + recommended_time); IF_FREE(recommended_time); if (progressbar == NULL) { @@ -323,8 +353,8 @@ static void _mp_set_as_view_moved_recommended_time(void *data) } else { evas_object_geometry_get(progressbar, &px, &py, &pw, &ph); } - if ((double)view->duration != 0) { - ratio = (double)view->position / (double)view->duration; + if ((double) view->duration != 0) { + ratio = (double) view->position / (double) view->duration; } int position = pw * ratio + px; if (recommended_txt == NULL) { @@ -334,17 +364,21 @@ static void _mp_set_as_view_moved_recommended_time(void *data) evas_object_geometry_get(recommended_txt, &rx, &ry, &rw, &rh); if (pw != 0) { - edje_object_part_drag_value_set(elm_layout_edje_get(recommended_layout), "progressbar_playing", (double)(position - rw / 2) / (double)pw, 0.0); + edje_object_part_drag_value_set(elm_layout_edje_get + (recommended_layout), + "progressbar_playing", + (double) (position - + rw / 2) / + (double) pw, 0.0); } } evas_object_show(recommended_txt); mp_evas_object_del(view->progress_popup); } -static Eina_Bool -_move_idler(void *data) +static Eina_Bool _move_idler(void *data) { - MpSetAsView_t *view = (MpSetAsView_t *)data; + MpSetAsView_t *view = (MpSetAsView_t *) data; MP_CHECK_FALSE(view); _mp_set_as_view_moved_recommended_time(view); @@ -353,14 +387,15 @@ _move_idler(void *data) return ECORE_CALLBACK_CANCEL; } -static Evas_Object * -_mp_set_as_view_gl_contents_get(void *data, Evas_Object * obj, const char *part) +static Evas_Object *_mp_set_as_view_gl_contents_get(void *data, + Evas_Object * obj, + const char *part) { MpSetAsView_t *view = evas_object_data_get(obj, "view"); MP_CHECK_VAL(view, NULL); Evas_Object *content = NULL; - item_data_s *item_data = (item_data_s *)data; + item_data_s *item_data = (item_data_s *) data; MP_CHECK_NULL(item_data); const Elm_Genlist_Item_Class *item_class = NULL; int index = item_data->index; @@ -369,67 +404,107 @@ _mp_set_as_view_gl_contents_get(void *data, Evas_Object * obj, const char *part) /* if edit mode */ if (!strcmp(part, "elm.icon")) { switch (index) { - case MP_SET_AS_FROM_START: - case MP_SET_AS_RECOMMEND: - case MP_SET_AS_PHONE_RINGTONE: - case MP_SET_AS_CALLER_RINGTONE: - case MP_SET_AS_ALARM_TONE: + case MP_SET_AS_FROM_START: + case MP_SET_AS_RECOMMEND: + case MP_SET_AS_PHONE_RINGTONE: + case MP_SET_AS_CALLER_RINGTONE: + case MP_SET_AS_ALARM_TONE: /* swallow checkbox or radio button */ content = elm_radio_add(obj); elm_radio_state_value_set(content, index); - if (index == MP_SET_AS_FROM_START || index == MP_SET_AS_RECOMMEND) { + if (index == MP_SET_AS_FROM_START + || index == MP_SET_AS_RECOMMEND) { elm_radio_group_add(content, g_radio_recommend); - } else if (index >= MP_SET_AS_PHONE_RINGTONE && index <= MP_SET_AS_ALARM_TONE) { + } else if (index >= MP_SET_AS_PHONE_RINGTONE + && index <= MP_SET_AS_ALARM_TONE) { elm_radio_group_add(content, g_radio_set_as_type); } - evas_object_size_hint_weight_set(content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(content, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(content, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(content, EVAS_HINT_FILL, + EVAS_HINT_FILL); evas_object_propagate_events_set(content, TRUE); /* evas_object_smart_callback_add(content, "changed", _radio_cb, view); */ break; - case MP_SET_AS_RECOMMEND_PRE_LISTEN: + case MP_SET_AS_RECOMMEND_PRE_LISTEN: item_class = elm_genlist_item_item_class_get(item_data->item); - if (!g_strcmp0(item_class->item_style, "music/1icon/set_as_full")) { + if (!g_strcmp0 + (item_class->item_style, "music/1icon/set_as_full")) { if (!mp_util_is_landscape()) { - content = mp_common_load_edj(obj, MP_EDJ_NAME, "music/set_as/prelisten"); + content = + mp_common_load_edj(obj, MP_EDJ_NAME, + "music/set_as/prelisten"); } else { - content = mp_common_load_edj(obj, MP_EDJ_NAME, "music/set_as/prelisten_ld"); + content = + mp_common_load_edj(obj, MP_EDJ_NAME, + "music/set_as/prelisten_ld"); } - mp_util_domain_translatable_part_text_set(content, "recommended_text", STR_MP_SET_AS_RECOMMENDED_TXT); + mp_util_domain_translatable_part_text_set(content, + "recommended_text", + STR_MP_SET_AS_RECOMMENDED_TXT); Evas_Object *progressbar = elm_progressbar_add(content); elm_object_style_set(progressbar, "list_progress"); elm_progressbar_inverted_set(progressbar, EINA_TRUE); elm_progressbar_horizontal_set(progressbar, EINA_TRUE); - evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_progressbar_value_set(progressbar, (double)(1.0 - (double)view->position / (double)view->duration)); + evas_object_size_hint_align_set(progressbar, + EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_size_hint_weight_set(progressbar, + EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + elm_progressbar_value_set(progressbar, + (double) (1.0 - + (double) view-> + position / + (double) view-> + duration)); evas_object_show(progressbar); - elm_object_part_content_set(content, "progress_bar", progressbar); - - Evas_Object *recommended_layout = mp_common_load_edj(content, MP_EDJ_NAME, "movable_text"); - elm_object_part_content_set(content, "recommended_text_play", recommended_layout); - Evas_Object *recommended_txt = elm_label_add(recommended_layout); - elm_object_part_content_set(recommended_layout, "progressbar_playing", recommended_txt); + elm_object_part_content_set(content, "progress_bar", + progressbar); + + Evas_Object *recommended_layout = + mp_common_load_edj(content, MP_EDJ_NAME, + "movable_text"); + elm_object_part_content_set(content, + "recommended_text_play", + recommended_layout); + Evas_Object *recommended_txt = + elm_label_add(recommended_layout); + elm_object_part_content_set(recommended_layout, + "progressbar_playing", + recommended_txt); if (view->position != -1) { - char *recommended_time = _mp_set_as_view_time_to_string(view->position); - mp_util_domain_translatable_text_set(recommended_txt, recommended_time); + char *recommended_time = + _mp_set_as_view_time_to_string(view->position); + mp_util_domain_translatable_text_set(recommended_txt, + recommended_time); IF_FREE(recommended_time); if (view->move_idler == NULL) { - view->move_idler = ecore_idler_add(_move_idler, view); + view->move_idler = + ecore_idler_add(_move_idler, view); } } else { evas_object_hide(recommended_layout); } - /*set duration*/ - char *total_time = _mp_set_as_view_time_to_string(view->duration); - mp_util_domain_translatable_part_text_set(content, "progress_text_total", total_time); + /*set duration */ + char *total_time = + _mp_set_as_view_time_to_string(view->duration); + mp_util_domain_translatable_part_text_set(content, + "progress_text_total", + total_time); IF_FREE(total_time); - } else if (!g_strcmp0(item_class->item_style, "music/1icon/set_as_text")) { - content = mp_common_load_edj(obj, MP_EDJ_NAME, "music/set_as/prelisten_text"); - mp_util_domain_translatable_part_text_set(content, "recommended_text", STR_MP_SET_AS_RECOMMENDED_TXT); + } else + if (!g_strcmp0 + (item_class->item_style, "music/1icon/set_as_text")) { + content = + mp_common_load_edj(obj, MP_EDJ_NAME, + "music/set_as/prelisten_text"); + mp_util_domain_translatable_part_text_set(content, + "recommended_text", + STR_MP_SET_AS_RECOMMENDED_TXT); } break; } @@ -439,10 +514,10 @@ _mp_set_as_view_gl_contents_get(void *data, Evas_Object * obj, const char *part) } -static char * -_mp_set_as_view_gl_label_get(void *data, Evas_Object * obj, const char *part) +static char *_mp_set_as_view_gl_label_get(void *data, Evas_Object * obj, + const char *part) { - item_data_s *item_data = (item_data_s *)data; + item_data_s *item_data = (item_data_s *) data; MP_CHECK_NULL(item_data); int index = item_data->index; @@ -478,21 +553,22 @@ _mp_set_as_view_gl_label_get(void *data, Evas_Object * obj, const char *part) return g_strdup(GET_STR(txt)); } -static void _mp_set_as_view_enable_done_btn(MpSetAsView_t *view) +static void _mp_set_as_view_enable_done_btn(MpSetAsView_t * view) { MP_CHECK(view); - Evas_Object *left_btn = elm_object_item_part_content_get(view->navi_it, "title_right_btn"); + Evas_Object *left_btn = + elm_object_item_part_content_get(view->navi_it, "title_right_btn"); elm_object_disabled_set(left_btn, false); } -static void _gl_sel(void *data, Evas_Object *obj, void *event_info) +static void _gl_sel(void *data, Evas_Object * obj, void *event_info) { startfunc; MpSetAsView_t *view = evas_object_data_get(obj, "view"); MP_CHECK(view); - item_data_s *item_data = (item_data_s *)data; + item_data_s *item_data = (item_data_s *) data; MP_CHECK(item_data); int index = item_data->index; int old_index = -1; @@ -505,7 +581,7 @@ static void _gl_sel(void *data, Evas_Object *obj, void *event_info) old_index = view->recommended; view->recommended = index; - /*pause the main player*/ + /*pause the main player */ struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); if (ad->player_state == PLAY_STATE_PLAYING) { @@ -513,13 +589,14 @@ static void _gl_sel(void *data, Evas_Object *obj, void *event_info) mp_play_control_play_pause(ad, FALSE); } - } else if (index >= MP_SET_AS_PHONE_RINGTONE && index <= MP_SET_AS_ALARM_TONE) { + } else if (index >= MP_SET_AS_PHONE_RINGTONE + && index <= MP_SET_AS_ALARM_TONE) { radio_group = g_radio_set_as_type; old_index = view->set_as_type; view->set_as_type = index; } - if (view->set_as_type != -1 && view->recommended != -1) { /*enable left_button*/ + if (view->set_as_type != -1 && view->recommended != -1) { /*enable left_button */ _mp_set_as_view_enable_done_btn(view); view->button_enable = TRUE; } @@ -528,13 +605,14 @@ static void _gl_sel(void *data, Evas_Object *obj, void *event_info) evas_object_smart_callback_call(radio_group, "changed", NULL); if (!mp_media_info_uri_is_exist_in_db(view->path)) { - /*the popup followed S5*/ + /*the popup followed S5 */ if (index == MP_SET_AS_FROM_START) { mp_widget_text_popup(NULL, GET_STR(STR_MP_PLAYER_UNSUPPORT)); } else if (index == MP_SET_AS_RECOMMEND) { - mp_widget_text_popup(NULL, GET_STR(STR_MP_RECOMMENDATION_UNSUPPORT)); + mp_widget_text_popup(NULL, + GET_STR(STR_MP_RECOMMENDATION_UNSUPPORT)); } - return ; + return; } player_state_e state = _mp_set_as_view_prelisten_get_state(view); @@ -544,10 +622,12 @@ static void _gl_sel(void *data, Evas_Object *obj, void *event_info) if (state == PLAYER_STATE_PLAYING) { _mp_set_as_view_prelisten_pause(view); if (index == MP_SET_AS_FROM_START) { - _mp_set_as_view_prelisten_set_position(view, NULL, NULL, false); + _mp_set_as_view_prelisten_set_position(view, NULL, + NULL, false); } if (index == MP_SET_AS_RECOMMEND) { - _mp_set_as_view_prelisten_set_position(view, NULL, NULL, true); + _mp_set_as_view_prelisten_set_position(view, NULL, + NULL, true); } } else if (state == PLAYER_STATE_PAUSED) { _mp_set_as_view_prelisten_start(view); @@ -556,42 +636,52 @@ static void _gl_sel(void *data, Evas_Object *obj, void *event_info) } else { if (old_index == MP_SET_AS_RECOMMEND) { /*get item */ - Elm_Object_Item *recommended_item = elm_genlist_nth_item_get(obj, MP_SET_AS_RECOMMEND_PRE_LISTEN); - /*update item class to text*/ - elm_genlist_item_item_class_update(recommended_item, view->recommend_itc_text); + Elm_Object_Item *recommended_item = + elm_genlist_nth_item_get(obj, + MP_SET_AS_RECOMMEND_PRE_LISTEN); + /*update item class to text */ + elm_genlist_item_item_class_update(recommended_item, + view->recommend_itc_text); elm_genlist_item_update(recommended_item); /* view->position = 0; */ } else { if (index == MP_SET_AS_RECOMMEND) { /*get item */ - Elm_Object_Item *recommended_item = elm_genlist_nth_item_get(obj, MP_SET_AS_RECOMMEND_PRE_LISTEN); - /*update item class to full*/ - elm_genlist_item_item_class_update(recommended_item, view->recommend_itc_full); + Elm_Object_Item *recommended_item = + elm_genlist_nth_item_get(obj, + MP_SET_AS_RECOMMEND_PRE_LISTEN); + /*update item class to full */ + elm_genlist_item_item_class_update(recommended_item, + view-> + recommend_itc_full); elm_genlist_item_update(recommended_item); /*get smat - SMAT_INFO infos; - memset(&infos, 0, sizeof(SMAT_INFO)); - if (view->position == -1) - _mp_set_as_view_get_recommend(view, &infos);*/ + SMAT_INFO infos; + memset(&infos, 0, sizeof(SMAT_INFO)); + if (view->position == -1) + _mp_set_as_view_get_recommend(view, &infos); */ } } if (index == MP_SET_AS_FROM_START) { - _mp_set_as_view_prelisten_set_position(view, __mp_set_as_view_player_seek_completed_cb, view, false); + _mp_set_as_view_prelisten_set_position(view, + __mp_set_as_view_player_seek_completed_cb, + view, false); } if (index == MP_SET_AS_RECOMMEND && view->position != -1) { - _mp_set_as_view_prelisten_set_position(view, __mp_set_as_view_player_seek_completed_cb, view, true); + _mp_set_as_view_prelisten_set_position(view, + __mp_set_as_view_player_seek_completed_cb, + view, true); } } return; } -static void -_mp_set_as_list_item_del(void *data, Evas_Object * obj) +static void _mp_set_as_list_item_del(void *data, Evas_Object * obj) { startfunc; item_data_s *item_data = data; @@ -599,8 +689,7 @@ _mp_set_as_list_item_del(void *data, Evas_Object * obj) free(item_data); } -static void -_mp_set_as_view_load_genlist_itc(MpSetAsView_t *view) +static void _mp_set_as_view_load_genlist_itc(MpSetAsView_t * view) { startfunc; mp_retm_if(!view, "INVALID param"); @@ -610,7 +699,8 @@ _mp_set_as_view_load_genlist_itc(MpSetAsView_t *view) MP_CHECK(view->radio_itc); view->radio_itc->item_style = "1text.1icon.3"; view->radio_itc->func.text_get = _mp_set_as_view_gl_label_get; - view->radio_itc->func.content_get = _mp_set_as_view_gl_contents_get; + view->radio_itc->func.content_get = + _mp_set_as_view_gl_contents_get; view->radio_itc->func.del = _mp_set_as_list_item_del; } @@ -627,26 +717,29 @@ _mp_set_as_view_load_genlist_itc(MpSetAsView_t *view) view->recommend_itc_full = elm_genlist_item_class_new(); MP_CHECK(view->recommend_itc_full); view->recommend_itc_full->item_style = "music/1icon/set_as_full"; - view->recommend_itc_full->func.content_get = _mp_set_as_view_gl_contents_get; + view->recommend_itc_full->func.content_get = + _mp_set_as_view_gl_contents_get; view->recommend_itc_full->func.del = _mp_set_as_list_item_del; } if (view->recommend_itc_text == NULL) { view->recommend_itc_text = elm_genlist_item_class_new(); MP_CHECK(view->recommend_itc_text); view->recommend_itc_text->item_style = "music/1icon/set_as_text"; - view->recommend_itc_text->func.content_get = _mp_set_as_view_gl_contents_get; + view->recommend_itc_text->func.content_get = + _mp_set_as_view_gl_contents_get; view->recommend_itc_text->func.del = _mp_set_as_list_item_del; } } static void -_mp_set_as_view_append_genlist_items(Evas_Object *genlist, MpSetAsView_t *view) +_mp_set_as_view_append_genlist_items(Evas_Object * genlist, + MpSetAsView_t * view) { startfunc; int i; Elm_Genlist_Item_Class *itc = NULL; - /*Elm_Object_Item *item;*/ + /*Elm_Object_Item *item; */ Elm_Genlist_Item_Type flag = ELM_GENLIST_ITEM_NONE; mp_retm_if(!view, "INVALID param"); @@ -673,23 +766,29 @@ _mp_set_as_view_append_genlist_items(Evas_Object *genlist, MpSetAsView_t *view) MP_CHECK(item_data); item_data->index = i; - item_data->item = elm_genlist_item_append(genlist, itc, (void *)item_data, NULL, flag, _gl_sel, (void *)item_data); + item_data->item = + elm_genlist_item_append(genlist, itc, (void *) item_data, NULL, + flag, _gl_sel, (void *) item_data); if (i == MP_SET_AS_TITLE || i == MP_SET_AS_RECOMMEND_PRE_LISTEN) { - elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + elm_genlist_item_select_mode_set(item_data->item, + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); } } } -static Evas_Object* -_mp_set_as_view_create_list(MpSetAsView_t *view, Evas_Object *parent) +static Evas_Object *_mp_set_as_view_create_list(MpSetAsView_t * view, + Evas_Object * parent) { startfunc; MP_CHECK_VAL(view, NULL); Evas_Object *genlist = mp_widget_genlist_create(parent); - elm_scroller_policy_set(genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); - evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_scroller_policy_set(genlist, ELM_SCROLLER_POLICY_OFF, + ELM_SCROLLER_POLICY_AUTO); + evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, + EVAS_HINT_FILL); view->content = genlist; g_radio_recommend = elm_radio_add(genlist); @@ -707,12 +806,11 @@ _mp_set_as_view_create_list(MpSetAsView_t *view, Evas_Object *parent) return genlist; } -static Eina_Bool -_mp_set_as_view_pop_cb(void *data, Elm_Object_Item *it) +static Eina_Bool _mp_set_as_view_pop_cb(void *data, Elm_Object_Item * it) { startfunc; - MpSetAsView_t *view = (MpSetAsView_t *)data; + MpSetAsView_t *view = (MpSetAsView_t *) data; MP_CHECK_VAL(view, EINA_TRUE); mp_view_mgr_pop_view(GET_VIEW_MGR, true); @@ -720,8 +818,7 @@ _mp_set_as_view_pop_cb(void *data, Elm_Object_Item *it) return EINA_TRUE; } -static int -_mp_set_as_view_update(void *thiz) +static int _mp_set_as_view_update(void *thiz) { startfunc; MpSetAsView_t *view = thiz; @@ -733,11 +830,12 @@ _mp_set_as_view_update(void *thiz) return 0; } -static int -_mp_set_as_view_set_caller_rington(char *path) +static int _mp_set_as_view_set_caller_rington(char *path) { int ret = -1; - ret = system_settings_set_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, path); + ret = + system_settings_set_value_string + (SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, path); if (ret != SYSTEM_SETTINGS_ERROR_NONE) { mp_error("system_settings_set_value_string()... [0x%x]", ret); return -1; @@ -746,14 +844,15 @@ _mp_set_as_view_set_caller_rington(char *path) } -static void _done_button_clicked_cb(void *data, Evas_Object * obj, void *event_info) +static void _done_button_clicked_cb(void *data, Evas_Object * obj, + void *event_info) { - MpSetAsView_t *view = (MpSetAsView_t *)data; + MpSetAsView_t *view = (MpSetAsView_t *) data; MP_CHECK(view); /*1. get selected item - 1.1 get from start or recommended */ + 1.1 get from start or recommended */ int recommend = elm_radio_value_get(g_radio_recommend); - /*1.2 get what to set as*/ + /*1.2 get what to set as */ int type = elm_radio_value_get(g_radio_set_as_type); int position = 0; @@ -765,79 +864,90 @@ static void _done_button_clicked_cb(void *data, Evas_Object * obj, void *event_i } int ret = 0; - char *path = NULL; /* do not free */ + char *path = NULL; /* do not free */ struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); path = view->path; MP_CHECK(path); if (!mp_media_info_uri_is_exist_in_db(view->path)) { - /*delete set as view*/ + /*delete set as view */ MpViewMgr_t *view_mgr = GET_VIEW_MGR; mp_view_mgr_delete_view(view_mgr, MP_VIEW_SET_AS); - return ; + return; } switch (type) { - case MP_SET_AS_PHONE_RINGTONE: { - char *popup_txt = NULL; - ret = _mp_set_as_view_set_caller_rington(path); + case MP_SET_AS_PHONE_RINGTONE:{ + char *popup_txt = NULL; + ret = _mp_set_as_view_set_caller_rington(path); + + if (!ret) { + popup_txt = GET_SYS_STR("IDS_COM_POP_SUCCESS"); + } else { + popup_txt = GET_SYS_STR("IDS_COM_POP_FAILED"); + } - if (!ret) { - popup_txt = GET_SYS_STR("IDS_COM_POP_SUCCESS"); - } else { - popup_txt = GET_SYS_STR("IDS_COM_POP_FAILED"); + mp_widget_text_popup(ad, popup_txt); + break; } - - mp_widget_text_popup(ad, popup_txt); - break; - } - case MP_SET_AS_CALLER_RINGTONE: + case MP_SET_AS_CALLER_RINGTONE: mp_ug_contact_user_sel(path, ad); break; - case MP_SET_AS_ALARM_TONE: + case MP_SET_AS_ALARM_TONE: mp_ug_set_as_alarm_tone(path, position); break; default: break; } - /*delete set as view*/ + /*delete set as view */ MpViewMgr_t *view_mgr = GET_VIEW_MGR; mp_view_mgr_delete_view(view_mgr, MP_VIEW_SET_AS); } -static void _cancel_button_clicked_cb(void *data, Evas_Object * obj, void *event_info) +static void _cancel_button_clicked_cb(void *data, Evas_Object * obj, + void *event_info) { - MpSetAsView_t *view = (MpSetAsView_t *)data; + MpSetAsView_t *view = (MpSetAsView_t *) data; MP_CHECK(view); MpViewMgr_t *view_mgr = GET_VIEW_MGR; mp_view_mgr_delete_view(view_mgr, MP_VIEW_SET_AS); } -static int -_mp_set_as_view_update_option_cb(void *thiz) +static int _mp_set_as_view_update_option_cb(void *thiz) { startfunc; MpSetAsView_t *view = thiz; MP_CHECK_VAL(view, -1); MP_CHECK_VAL(view->navi_it, -1); - elm_naviframe_item_pop_cb_set(view->navi_it, _mp_set_as_view_pop_cb, view); + elm_naviframe_item_pop_cb_set(view->navi_it, _mp_set_as_view_pop_cb, + view); - Evas_Object *left_btn = elm_object_item_part_content_unset(view->navi_it, "title_left_btn"); - Evas_Object *right_btn = elm_object_item_part_content_unset(view->navi_it, "title_right_btn"); + Evas_Object *left_btn = + elm_object_item_part_content_unset(view->navi_it, + "title_left_btn"); + Evas_Object *right_btn = + elm_object_item_part_content_unset(view->navi_it, + "title_right_btn"); mp_evas_object_del(left_btn); mp_evas_object_del(right_btn); - left_btn = mp_create_title_text_btn(view->layout, STR_MP_CANCEL, NULL, NULL); - elm_object_item_part_content_set(view->navi_it, "title_left_btn", left_btn); - evas_object_smart_callback_add(left_btn, "clicked", _cancel_button_clicked_cb, view); - - right_btn = mp_create_title_text_btn(view->layout, STR_MP_DONE, NULL, NULL); - elm_object_item_part_content_set(view->navi_it, "title_right_btn", right_btn); - evas_object_smart_callback_add(right_btn, "clicked", _done_button_clicked_cb, view); + left_btn = + mp_create_title_text_btn(view->layout, STR_MP_CANCEL, NULL, NULL); + elm_object_item_part_content_set(view->navi_it, "title_left_btn", + left_btn); + evas_object_smart_callback_add(left_btn, "clicked", + _cancel_button_clicked_cb, view); + + right_btn = + mp_create_title_text_btn(view->layout, STR_MP_DONE, NULL, NULL); + elm_object_item_part_content_set(view->navi_it, "title_right_btn", + right_btn); + evas_object_smart_callback_add(right_btn, "clicked", + _done_button_clicked_cb, view); if (!view->button_enable) { elm_object_disabled_set(right_btn, true); } @@ -846,21 +956,19 @@ _mp_set_as_view_update_option_cb(void *thiz) return 0; } -static void -_mp_set_as_view_destory_cb(void *thiz) +static void _mp_set_as_view_destory_cb(void *thiz) { startfunc; MpSetAsView_t *view = thiz; MP_CHECK(view); mp_set_as_view_destory(view); - mp_view_fini((MpView_t *)view); + mp_view_fini((MpView_t *) view); free(view); } -static void -_mp_set_as_view_on_event(void *thiz, MpViewEvent_e event) +static void _mp_set_as_view_on_event(void *thiz, MpViewEvent_e event) { startfunc; MpSetAsView_t *view = thiz; @@ -869,8 +977,10 @@ _mp_set_as_view_on_event(void *thiz, MpViewEvent_e event) /* when the track rename/move/delete should destroy the player */ case MP_DB_UPDATED: if (!mp_media_info_uri_is_exist_in_db(view->path)) { - player_state_e state = _mp_set_as_view_prelisten_get_state(view); - if (state <= PLAYER_STATE_PAUSED && state >= PLAYER_STATE_READY) { + player_state_e state = + _mp_set_as_view_prelisten_get_state(view); + if (state <= PLAYER_STATE_PAUSED + && state >= PLAYER_STATE_READY) { _mp_set_as_view_prelisten_stop(view); _mp_set_as_view_destroy_player(view); } @@ -886,17 +996,18 @@ _mp_set_as_view_on_event(void *thiz, MpViewEvent_e event) static void _mp_set_as_view_resume(void *thiz) { startfunc; - MpSetAsView_t *view = (MpSetAsView_t *)thiz; - _mp_set_as_view_update((void *)view); + MpSetAsView_t *view = (MpSetAsView_t *) thiz; + _mp_set_as_view_update((void *) view); } static int -_mp_set_as_view_init(Evas_Object *parent, MpSetAsView_t *view, void *data) +_mp_set_as_view_init(Evas_Object * parent, MpSetAsView_t * view, + void *data) { startfunc; int ret = 0; - ret = mp_view_init(parent, (MpView_t *)view, MP_VIEW_SET_AS); + ret = mp_view_init(parent, (MpView_t *) view, MP_VIEW_SET_AS); MP_CHECK_VAL(ret == 0, -1); view->update = _mp_set_as_view_update; @@ -914,9 +1025,10 @@ _mp_set_as_view_init(Evas_Object *parent, MpSetAsView_t *view, void *data) view->content = _mp_set_as_view_create_list(view, parent); MP_CHECK_VAL(view->content, -1); - elm_object_part_content_set(view->layout, "list_content", view->content); + elm_object_part_content_set(view->layout, "list_content", + view->content); - view->path = (char *)data; + view->path = (char *) data; _mp_set_as_view_create_player(view); _mp_set_as_view_prelisten_set_uri(view); _mp_set_as_view_prelisten_prepare(view); @@ -932,7 +1044,8 @@ _mp_set_as_view_init(Evas_Object *parent, MpSetAsView_t *view, void *data) /*param void *data is used to update previous view.. change mp_media_info_h to path,becacuse path can deal with exception(rename...)*/ -EXPORT_API MpSetAsView_t *mp_set_as_view_create(Evas_Object *parent, char* path) +EXPORT_API MpSetAsView_t *mp_set_as_view_create(Evas_Object * parent, + char *path) { startfunc; int ret; @@ -941,20 +1054,20 @@ EXPORT_API MpSetAsView_t *mp_set_as_view_create(Evas_Object *parent, char* path) MpSetAsView_t *view = calloc(1, sizeof(MpSetAsView_t)); MP_CHECK_NULL(view); - ret = _mp_set_as_view_init(parent, view, (void *)path); + ret = _mp_set_as_view_init(parent, view, (void *) path); if (ret) { goto Error; } return view; -Error: + Error: ERROR_TRACE("Error: mp_set_as_view_create()"); IF_FREE(view); return NULL; } -int mp_set_as_view_destory(MpSetAsView_t *view) +int mp_set_as_view_destory(MpSetAsView_t * view) { startfunc; MP_CHECK_VAL(view, -1); @@ -974,7 +1087,7 @@ int mp_set_as_view_destory(MpSetAsView_t *view) player_state_e state = _mp_set_as_view_prelisten_get_state(view); - if (state <= PLAYER_STATE_PAUSED && state >= PLAYER_STATE_READY) { /*player is active */ + if (state <= PLAYER_STATE_PAUSED && state >= PLAYER_STATE_READY) { /*player is active */ _mp_set_as_view_prelisten_stop(view); _mp_set_as_view_destroy_player(view); } @@ -991,6 +1104,3 @@ int mp_set_as_view_destory(MpSetAsView_t *view) return 0; } - - - diff --git a/src/view/mp-setting-view.c b/src/view/mp-setting-view.c index d88b7eb..8995340 100644 --- a/src/view/mp-setting-view.c +++ b/src/view/mp-setting-view.c @@ -52,20 +52,21 @@ #define TAB_COUNT 7 -static Evas_Object* group_radio; -static char *tab_str[TAB_COUNT] = {STR_MP_PLAYLISTS, STR_MP_TRACKS, - STR_MP_ALBUMS, STR_MP_ARTISTS, - STR_MP_GENRES, STR_MP_FOLDERS, STR_MP_SQUARE - }; -static int tab_index[TAB_COUNT] = {0}; +static Evas_Object *group_radio; +static char *tab_str[TAB_COUNT] = { STR_MP_PLAYLISTS, STR_MP_TRACKS, + STR_MP_ALBUMS, STR_MP_ARTISTS, + STR_MP_GENRES, STR_MP_FOLDERS, STR_MP_SQUARE +}; +static int tab_index[TAB_COUNT] = { 0 }; static Evas_Object *check_boxs[MP_SETTING_TABS_ITEM_MAX]; static int tab_state = 0; -static Evas_Object *_mp_setting_view_tabs_list_create(MpSettingView_t *view, - Evas_Object *parent); +static Evas_Object *_mp_setting_view_tabs_list_create(MpSettingView_t * + view, + Evas_Object * + parent); -static int -_ms_se_state_set(MpSettingView_t *data) +static int _ms_se_state_set(MpSettingView_t * data) { MpSettingView_t *view = data; @@ -74,36 +75,34 @@ _ms_se_state_set(MpSettingView_t *data) return 0; } -static void -_ms_key_change_cb(const char *key, void *user_data) +static void _ms_key_change_cb(const char *key, void *user_data) { MpSettingView_t *view = NULL; - view = (MpSettingView_t *)user_data; + view = (MpSettingView_t *) user_data; if (strcmp(key, KEY_MUSIC_SE_CHANGE) == 0) { _ms_se_state_set(view); } return; } -static void -_ms_key_change_cb_init(void *data) +static void _ms_key_change_cb_init(void *data) { MpSettingView_t *view = NULL; - view = (MpSettingView_t *)data; + view = (MpSettingView_t *) data; if (preference_set_changed_cb(KEY_MUSIC_SE_CHANGE, - _ms_key_change_cb, view)) { + _ms_key_change_cb, view)) { ERROR_TRACE("Error when register callback"); } } -static void -_ms_key_change_cb_deinit(void) +static void _ms_key_change_cb_deinit(void) { preference_unset_changed_cb(KEY_MUSIC_SE_CHANGE); runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_AUDIO_JACK_STATUS); } -static void _lyrics_check_clicked_cb(void *data, Evas_Object *obj, void *event_info) +static void _lyrics_check_clicked_cb(void *data, Evas_Object * obj, + void *event_info) { Eina_Bool state = elm_check_state_get(obj); @@ -114,29 +113,30 @@ static void _lyrics_check_clicked_cb(void *data, Evas_Object *obj, void *event_i } -static Evas_Object * -_ms_gl_contents_get(void *data, Evas_Object * obj, const char *part) +static Evas_Object *_ms_gl_contents_get(void *data, Evas_Object * obj, + const char *part) { Evas_Object *content = NULL; if (!strcmp(part, "elm.icon.2")) { - content = elm_check_add(obj); + content = elm_check_add(obj); elm_check_state_set(content, EINA_TRUE); elm_object_style_set(content, "on&off"); - evas_object_smart_callback_add(content, "changed", _lyrics_check_clicked_cb, NULL); + evas_object_smart_callback_add(content, "changed", + _lyrics_check_clicked_cb, NULL); bool lyrics_state = FALSE; preference_get_boolean(KEY_MUSIC_LYRICS, &lyrics_state); - elm_check_state_set(content, (int)lyrics_state); + elm_check_state_set(content, (int) lyrics_state); evas_object_propagate_events_set(content, EINA_FALSE); } return content; } -static char * -_ms_gl_lyrics_label_get(void *data, Evas_Object * obj, const char *part) +static char *_ms_gl_lyrics_label_get(void *data, Evas_Object * obj, + const char *part) { /* DEBUG_TRACE("part name = [%s]", part); */ @@ -204,7 +204,7 @@ _ms_setting_playlist_cb(void *data, Evas_Object * obj, void *event_info) { startfunc; mp_evas_object_del(obj); - int response = (int)event_info; + int response = (int) event_info; int temp_playlist_state, playlist_state; if (response == MP_POPUP_NO) { @@ -227,7 +227,7 @@ _ms_setting_playlist_cb(void *data, Evas_Object * obj, void *event_info) } -static void _gl_sel(void *data, Evas_Object *obj, void *event_info) +static void _gl_sel(void *data, Evas_Object * obj, void *event_info) { mp_retm_if(!obj, "INVALID param"); mp_retm_if(!event_info, "INVALID param"); @@ -235,7 +235,7 @@ static void _gl_sel(void *data, Evas_Object *obj, void *event_info) Elm_Object_Item *item = event_info; elm_genlist_item_selected_set(item, EINA_FALSE); - ms_main_menu_item_t menu_item = (ms_main_menu_item_t)data; + ms_main_menu_item_t menu_item = (ms_main_menu_item_t) data; if (menu_item == MS_MAIN_MENU_LYRICS) { bool lyrics_state = false; preference_get_boolean(KEY_MUSIC_LYRICS, &lyrics_state); @@ -250,9 +250,11 @@ static void _gl_sel(void *data, Evas_Object *obj, void *event_info) Evas_Object *popup = NULL; popup = mp_genlist_popup_create(ad->win_main, - MP_POPUP_SETTING_PLAYLIST, NULL, ad); + MP_POPUP_SETTING_PLAYLIST, NULL, + ad); mp_retm_if(!popup, "popup is NULL !!!"); - mp_popup_response_callback_set(popup, _ms_setting_playlist_cb, NULL); + mp_popup_response_callback_set(popup, _ms_setting_playlist_cb, + NULL); Evas_Object *genlist = evas_object_data_get(popup, "genlist"); _ms_playlist_append_pop_genlist(genlist, view_mgr->navi); @@ -266,34 +268,33 @@ static void _gl_sel(void *data, Evas_Object *obj, void *event_info) } } -static void -_ms_load_genlist_itc(MpSettingView_t *view) +static void _ms_load_genlist_itc(MpSettingView_t * view) { mp_retm_if(!view, "INVALID param"); /*if (view->itc[MS_ITC_TYPE_1TEXT_NO_EXP] == NULL) { - view->itc[MS_ITC_TYPE_1TEXT_NO_EXP] = - elm_genlist_item_class_new(); - mp_assert(view->itc[MS_ITC_TYPE_1TEXT_NO_EXP]); - view->itc[MS_ITC_TYPE_1TEXT_NO_EXP]->func.text_get = - _ms_gl_label_get; - view->itc[MS_ITC_TYPE_1TEXT_NO_EXP]->item_style = "1line"; - }*/ + view->itc[MS_ITC_TYPE_1TEXT_NO_EXP] = + elm_genlist_item_class_new(); + mp_assert(view->itc[MS_ITC_TYPE_1TEXT_NO_EXP]); + view->itc[MS_ITC_TYPE_1TEXT_NO_EXP]->func.text_get = + _ms_gl_label_get; + view->itc[MS_ITC_TYPE_1TEXT_NO_EXP]->item_style = "1line"; + } */ if (view->itc[MS_ITC_TYPE_1TEXT_1ICON] == NULL) { - view->itc[MS_ITC_TYPE_1TEXT_1ICON] = - elm_genlist_item_class_new(); + view->itc[MS_ITC_TYPE_1TEXT_1ICON] = elm_genlist_item_class_new(); mp_assert(view->itc[MS_ITC_TYPE_1TEXT_1ICON]); - view->itc[MS_ITC_TYPE_1TEXT_1ICON]->func.text_get = _ms_gl_lyrics_label_get; + view->itc[MS_ITC_TYPE_1TEXT_1ICON]->func.text_get = + _ms_gl_lyrics_label_get; view->itc[MS_ITC_TYPE_1TEXT_1ICON]->func.content_get = - _ms_gl_contents_get; + _ms_gl_contents_get; view->itc[MS_ITC_TYPE_1TEXT_1ICON]->item_style = "1line"; } } static void -_ms_append_genlist_items(Evas_Object *genlist, MpSettingView_t *view) +_ms_append_genlist_items(Evas_Object * genlist, MpSettingView_t * view) { int i; Elm_Genlist_Item_Class *itc; @@ -313,13 +314,14 @@ _ms_append_genlist_items(Evas_Object *genlist, MpSettingView_t *view) } view->gl_it[i] = elm_genlist_item_append(genlist, itc, - (void *)i, NULL, flag, _gl_sel, - (void *)i); + (void *) i, NULL, flag, + _gl_sel, (void *) i); } } static void -_mp_setting_view_gl_realized_cb(void *data, Evas_Object *obj, void *event_info) +_mp_setting_view_gl_realized_cb(void *data, Evas_Object * obj, + void *event_info) { Elm_Object_Item *gl_item = event_info; MP_CHECK(gl_item); @@ -337,40 +339,42 @@ _mp_setting_view_gl_realized_cb(void *data, Evas_Object *obj, void *event_info) elm_object_item_signal_emit(gl_item, signal, ""); } -static void _mp_setting_view_gl_resize_cb(void *data, Evas *e, - Evas_Object *obj, void *event_info) +static void _mp_setting_view_gl_resize_cb(void *data, Evas * e, + Evas_Object * obj, + void *event_info) { - MpSettingView_t *view = (MpSettingView_t *)data; + MpSettingView_t *view = (MpSettingView_t *) data; MP_CHECK(view); - Elm_Object_Item *customized_item = (Elm_Object_Item *)evas_object_data_get( - obj, "customized_item"); - int customized_on = (int)evas_object_data_get( - view->content, "customized_on"); + Elm_Object_Item *customized_item = + (Elm_Object_Item *) evas_object_data_get(obj, "customized_item"); + int customized_on = + (int) evas_object_data_get(view->content, "customized_on"); if (customized_on) elm_genlist_item_show(customized_item, - ELM_GENLIST_ITEM_SCROLLTO_IN); + ELM_GENLIST_ITEM_SCROLLTO_IN); } -static Evas_Object* -_mp_setting_view_create_list(MpSettingView_t *view, Evas_Object *parent) +static Evas_Object *_mp_setting_view_create_list(MpSettingView_t * view, + Evas_Object * parent) { MP_CHECK_VAL(view, NULL); Evas_Object *genlist = mp_widget_genlist_create(parent); elm_scroller_policy_set(genlist, - ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); - evas_object_size_hint_weight_set(genlist, - EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(genlist, - EVAS_HINT_FILL, EVAS_HINT_FILL); + ELM_SCROLLER_POLICY_OFF, + ELM_SCROLLER_POLICY_AUTO); + evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, + EVAS_HINT_FILL); view->content = genlist; elm_object_style_set(genlist, "dialogue"); evas_object_smart_callback_add(genlist, "realized", - _mp_setting_view_gl_realized_cb, view); + _mp_setting_view_gl_realized_cb, view); evas_object_event_callback_add(genlist, EVAS_CALLBACK_RESIZE, - _mp_setting_view_gl_resize_cb, view); + _mp_setting_view_gl_resize_cb, view); _ms_append_genlist_items(genlist, view); @@ -380,12 +384,11 @@ _mp_setting_view_create_list(MpSettingView_t *view, Evas_Object *parent) return genlist; } -static Eina_Bool -_mp_setting_view_pop_cb(void *data, Elm_Object_Item *it) +static Eina_Bool _mp_setting_view_pop_cb(void *data, Elm_Object_Item * it) { startfunc; - MpSettingView_t *view = (MpSettingView_t *)data; + MpSettingView_t *view = (MpSettingView_t *) data; MP_CHECK_VAL(view, EINA_TRUE); mp_view_mgr_pop_view(GET_VIEW_MGR, true); @@ -393,8 +396,7 @@ _mp_setting_view_pop_cb(void *data, Elm_Object_Item *it) return EINA_TRUE; } -static int -_mp_setting_view_update(void *thiz) +static int _mp_setting_view_update(void *thiz) { startfunc; MpSettingView_t *view = thiz; @@ -415,8 +417,8 @@ static void _mp_setting_view_refresh(void *thiz) MP_CHECK(view); MP_CHECK(view->navi_it); - Evas_Object *content = elm_object_part_content_get( - view->layout, "list_content"); + Evas_Object *content = + elm_object_part_content_get(view->layout, "list_content"); if (content) { mp_evas_object_del(content); view->content = NULL; @@ -424,18 +426,18 @@ static void _mp_setting_view_refresh(void *thiz) if (view->setting_type == MP_SETTING_VIEW_TABS) { ms_key_get_tabs_val(&tab_state); view->content = _mp_setting_view_tabs_list_create(view, - view->parent); + view->parent); } else if (view->setting_type == MP_SETTING_VIEW_PLAYLISTS) { - view->content = ms_playlist_list_create( - view, view->parent); + view->content = ms_playlist_list_create(view, view->parent); } MP_CHECK(view->content); elm_object_part_content_set(view->layout, - "list_content", view->content); + "list_content", view->content); /* elm_object_signal_emit(view->layout, - "SHOW_INFO_TEXT_PADDING", ""); */ + "SHOW_INFO_TEXT_PADDING", ""); */ } + static Eina_Bool _mp_setting_view_reorder_back_cb(void *thiz) { startfunc; @@ -451,17 +453,18 @@ static Eina_Bool _mp_setting_view_reorder_back_cb(void *thiz) void _mp_setting_view_tabs_reorder_update_cb(void *data, - Evas_Object *obj, void *event_info) + Evas_Object * obj, + void *event_info) { eventfunc; - MpSettingView_t *view = (MpSettingView_t *)data; + MpSettingView_t *view = (MpSettingView_t *) data; MP_CHECK(view); - char str[TAB_COUNT + 1] = {0}; + char str[TAB_COUNT + 1] = { 0 }; int i = 0; Elm_Object_Item *temp = elm_genlist_first_item_get(view->content); while (temp) { mp_setting_genlist_item_data_t *item_data = - elm_object_item_data_get(temp); + elm_object_item_data_get(temp); MP_CHECK(item_data); str[i++] = (item_data->index + 0x30); temp = elm_genlist_item_next_get(temp); @@ -473,12 +476,13 @@ void _mp_setting_view_tabs_reorder_update_cb(void *data, mp_view_mgr_post_event(GET_VIEW_MGR, MP_TABS_REORDER_DONE); view->back_timer = ecore_timer_add(0.1, - _mp_setting_view_reorder_back_cb, view); + _mp_setting_view_reorder_back_cb, + view); } -static void _mp_setting_reorder_cb(void *data, Evas_Object *obj, - void *event_info) +static void _mp_setting_reorder_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; MpSettingView_t *view = (MpSettingView_t *) data; @@ -489,18 +493,21 @@ static void _mp_setting_reorder_cb(void *data, Evas_Object *obj, MpViewMgr_t *view_mgr = mp_view_mgr_get_view_manager(); MP_CHECK(view_mgr); MpSettingView_t *reorder_view = mp_setting_view_create(view_mgr->navi, - MP_SETTING_VIEW_REORDERS, (void *)view->setting_type); - mp_view_mgr_push_view(view_mgr, (MpView_t *)reorder_view, NULL); - mp_view_update_options((MpView_t *)reorder_view); - mp_view_set_title((MpView_t *)reorder_view, STR_MP_REORDER); + MP_SETTING_VIEW_REORDERS, + (void *) view-> + setting_type); + mp_view_mgr_push_view(view_mgr, (MpView_t *) reorder_view, NULL); + mp_view_update_options((MpView_t *) reorder_view); + mp_view_set_title((MpView_t *) reorder_view, STR_MP_REORDER); } static void _mp_tab_view_normal_more_btn_cb(void *data, - Evas_Object *obj, void *event_info) + Evas_Object * obj, + void *event_info) { eventfunc; - MpSettingView_t *view = (MpSettingView_t *)data; + MpSettingView_t *view = (MpSettingView_t *) data; MP_CHECK(view); mp_evas_object_del(view->more_btn_ctxpopup); @@ -509,9 +516,9 @@ static void _mp_tab_view_normal_more_btn_cb(void *data, MP_CHECK(view->more_btn_ctxpopup); mp_util_ctxpopup_item_append(view->more_btn_ctxpopup, - STR_MP_REORDER, MP_PLAYER_MORE_BTN_SET_REORDER, - _mp_setting_reorder_cb, - view); + STR_MP_REORDER, + MP_PLAYER_MORE_BTN_SET_REORDER, + _mp_setting_reorder_cb, view); mp_util_more_btn_move_ctxpopup(view->more_btn_ctxpopup, obj); @@ -519,20 +526,19 @@ static void _mp_tab_view_normal_more_btn_cb(void *data, evas_object_show(view->more_btn_ctxpopup); } -void _mp_setting_view_playlists_reorder_update_cb(void *data, Evas_Object - *obj, void *event_info) +void _mp_setting_view_playlists_reorder_update_cb(void *data, Evas_Object *obj, void *event_info) { eventfunc; - MpSettingView_t *view = (MpSettingView_t *)data; + MpSettingView_t *view = (MpSettingView_t *) data; MP_CHECK(view); /* int index = 0; */ - char str[5] = {0}; + char str[5] = { 0 }; int i = 0; Elm_Object_Item *temp = elm_genlist_first_item_get(view->content); while (temp) { /* index = elm_genlist_item_index_get(temp); */ mp_setting_genlist_item_data_t *item_data = - elm_object_item_data_get(temp); + elm_object_item_data_get(temp); MP_CHECK(item_data); str[i++] = (item_data->index + 0x30); temp = elm_genlist_item_next_get(temp); @@ -544,11 +550,12 @@ void _mp_setting_view_playlists_reorder_update_cb(void *data, Evas_Object mp_view_mgr_post_event(GET_VIEW_MGR, MP_PLAYLISTS_REORDER_DONE); view->back_timer = ecore_timer_add(0.1, - _mp_setting_view_reorder_back_cb, view); + _mp_setting_view_reorder_back_cb, + view); } -static Eina_Bool _mp_setting_view_back_cb(void *data, Elm_Object_Item *it) +static Eina_Bool _mp_setting_view_back_cb(void *data, Elm_Object_Item * it) { eventfunc; MpSettingView_t *view = (MpSettingView_t *) data; @@ -566,8 +573,7 @@ static Eina_Bool _mp_setting_view_back_cb(void *data, Elm_Object_Item *it) } -static int -_mp_setting_view_update_option_cb(void *thiz) +static int _mp_setting_view_update_option_cb(void *thiz) { startfunc; MpSettingView_t *view = thiz; @@ -575,82 +581,88 @@ _mp_setting_view_update_option_cb(void *thiz) MP_CHECK_VAL(view->navi_it, -1); elm_naviframe_item_pop_cb_set(view->navi_it, _mp_setting_view_pop_cb, - view); + view); - Evas_Object *right_btn = elm_object_item_part_content_unset( - view->navi_it, "title_right_btn"); + Evas_Object *right_btn = + elm_object_item_part_content_unset(view->navi_it, + "title_right_btn"); mp_evas_object_del(right_btn); - Evas_Object *left_btn = elm_object_item_part_content_unset( - view->navi_it, "title_left_btn"); + Evas_Object *left_btn = + elm_object_item_part_content_unset(view->navi_it, + "title_left_btn"); mp_evas_object_del(left_btn); if (view->setting_type == MP_SETTING_VIEW_TABS || view->setting_type - == MP_SETTING_VIEW_PLAYLISTS) { + == MP_SETTING_VIEW_PLAYLISTS) { Evas_Object *btn = NULL; btn = mp_widget_create_toolbar_btn(view->layout, - MP_TOOLBAR_BTN_MORE, NULL, - _mp_tab_view_normal_more_btn_cb, view); - elm_object_item_part_content_set(view->navi_it, - "toolbar_more_btn", btn); - - } else if (view->setting_type == MP_SETTING_VIEW_REORDERS) { - Evas_Object *toolbar = mp_widget_create_naviframe_toolbar( - view->navi_it); + MP_TOOLBAR_BTN_MORE, NULL, + _mp_tab_view_normal_more_btn_cb, + view); + elm_object_item_part_content_set(view->navi_it, "toolbar_more_btn", + btn); + + } else if (view->setting_type == MP_SETTING_VIEW_REORDERS) { + Evas_Object *toolbar = + mp_widget_create_naviframe_toolbar(view->navi_it); Elm_Object_Item *toolbar_item = NULL; if (view->reorder_type == MP_SETTING_REORDER_TABS) { - toolbar_item = mp_widget_create_toolbar_item_btn(toolbar - , MP_TOOLBAR_BTN_LEFT, STR_MP_DONE, - _mp_setting_view_tabs_reorder_update_cb, view); + toolbar_item = + mp_widget_create_toolbar_item_btn(toolbar, + MP_TOOLBAR_BTN_LEFT, + STR_MP_DONE, + _mp_setting_view_tabs_reorder_update_cb, + view); } else if (view->reorder_type == MP_SETTING_REORDER_PLAYLISTS) { - toolbar_item = mp_widget_create_toolbar_item_btn( - toolbar, MP_TOOLBAR_BTN_LEFT, STR_MP_DONE, - _mp_setting_view_playlists_reorder_update_cb, - view); + toolbar_item = + mp_widget_create_toolbar_item_btn(toolbar, + MP_TOOLBAR_BTN_LEFT, + STR_MP_DONE, + _mp_setting_view_playlists_reorder_update_cb, + view); } view->toolbar_options[MP_OPTION_LEFT] = toolbar_item; if (!view->reorder) { - elm_object_item_disabled_set(view->toolbar_options[ - MP_OPTION_LEFT], EINA_TRUE); + elm_object_item_disabled_set(view-> + toolbar_options[MP_OPTION_LEFT], + EINA_TRUE); } } elm_naviframe_item_pop_cb_set(view->navi_it, - _mp_setting_view_back_cb, view); + _mp_setting_view_back_cb, view); endfunc; return 0; } -static void -_mp_setting_view_destory_cb(void *thiz) +static void _mp_setting_view_destory_cb(void *thiz) { startfunc; MpSettingView_t *view = thiz; MP_CHECK(view); mp_setting_view_destory(view); - mp_view_fini((MpView_t *)view); + mp_view_fini((MpView_t *) view); free(view); } -static void -_mp_setting_view_on_event(void *thiz, MpViewEvent_e event) +static void _mp_setting_view_on_event(void *thiz, MpViewEvent_e event) { MpSettingView_t *view = thiz; DEBUG_TRACE("event is %d", event); switch (event) { case MP_PLAYLISTS_REORDER_DONE: - case MP_TABS_REORDER_DONE: { - if ((view->setting_type == MP_SETTING_VIEW_TABS - || view->setting_type == - MP_SETTING_VIEW_PLAYLISTS) - && view->content) { - _mp_setting_view_refresh(view); + case MP_TABS_REORDER_DONE:{ + if ((view->setting_type == MP_SETTING_VIEW_TABS + || view->setting_type == MP_SETTING_VIEW_PLAYLISTS) + && view->content) { + _mp_setting_view_refresh(view); + } } - } - break; + break; default: break; } @@ -660,12 +672,12 @@ _mp_setting_view_on_event(void *thiz, MpViewEvent_e event) static void _mp_setting_view_resume(void *thiz) { startfunc; - MpSettingView_t *view = (MpSettingView_t *)thiz; - _mp_setting_view_update((void *)view); + MpSettingView_t *view = (MpSettingView_t *) thiz; + _mp_setting_view_update((void *) view); } static void _mp_tabs_reorder_gl_sel(void *data, - Evas_Object *obj, void *event_info) + Evas_Object * obj, void *event_info) { mp_retm_if(!obj, "INVALID param"); mp_retm_if(!event_info, "INVALID param"); @@ -675,12 +687,13 @@ static void _mp_tabs_reorder_gl_sel(void *data, } -static void _mp_tabs_gl_sel(void *data, Evas_Object *obj, void *event_info) +static void _mp_tabs_gl_sel(void *data, Evas_Object * obj, + void *event_info) { mp_retm_if(!obj, "INVALID param"); mp_retm_if(!event_info, "INVALID param"); mp_setting_genlist_item_data_t *item_data = - (mp_setting_genlist_item_data_t *)data; + (mp_setting_genlist_item_data_t *) data; MP_CHECK(item_data); Elm_Object_Item *item = event_info; @@ -693,15 +706,15 @@ static void _mp_tabs_gl_sel(void *data, Evas_Object *obj, void *event_info) } evas_object_smart_callback_call(check_boxs[item_data->index - 1], - "changed", NULL); + "changed", NULL); } -static char * -_mp_tabs_gl_label_get(void *data, Evas_Object * obj, const char *part) +static char *_mp_tabs_gl_label_get(void *data, Evas_Object * obj, + const char *part) { mp_setting_genlist_item_data_t *item_data = - (mp_setting_genlist_item_data_t *)data; + (mp_setting_genlist_item_data_t *) data; MP_CHECK_NULL(item_data); if (strcmp(part, "elm.text") == 0) { @@ -713,9 +726,10 @@ _mp_tabs_gl_label_get(void *data, Evas_Object * obj, const char *part) } static void _mp_setting_tabs_check_changed_cb(void *data, - Evas_Object *obj, void *event_info) + Evas_Object * obj, + void *event_info) { - int index = (int)evas_object_data_get(obj, "index"); + int index = (int) evas_object_data_get(obj, "index"); DEBUG_TRACE("index:%d", index); if (tab_state & (1 << index)) { @@ -731,12 +745,12 @@ static void _mp_setting_tabs_check_changed_cb(void *data, } -static Evas_Object * -_mp_tabs_gl_icon_get(void *data, Evas_Object * obj, const char *part) +static Evas_Object *_mp_tabs_gl_icon_get(void *data, Evas_Object * obj, + const char *part) { mp_setting_genlist_item_data_t *item_data = - (mp_setting_genlist_item_data_t *)data; + (mp_setting_genlist_item_data_t *) data; MP_CHECK_NULL(item_data); int param = item_data->index - 1; @@ -747,13 +761,14 @@ _mp_tabs_gl_icon_get(void *data, Evas_Object * obj, const char *part) if (strcmp(part, "elm.icon") == 0) { Evas_Object *check_box = elm_check_add(obj); elm_object_style_set(check_box, "default/genlist"); - evas_object_data_set(check_box, "index", (void *)param); + evas_object_data_set(check_box, "index", (void *) param); DEBUG_TRACE("%d", param); evas_object_repeat_events_set(check_box, EINA_TRUE); evas_object_propagate_events_set(check_box, FALSE); elm_check_state_set(check_box, tab_state & (1 << param)); evas_object_smart_callback_add(check_box, "changed", - _mp_setting_tabs_check_changed_cb, NULL); + _mp_setting_tabs_check_changed_cb, + NULL); evas_object_show(check_box); @@ -769,15 +784,14 @@ void _mp_tabs_sequence_get() ms_key_get_tabs_str(&get_str); int value = atoi(get_str); int j = 0; - for (j = TAB_COUNT - 1; j >= 0 ; j--) { + for (j = TAB_COUNT - 1; j >= 0; j--) { tab_index[j] = value % 10; value = value / 10; } } -static void -_mp_tabs_list_item_del_cb(void *data, Evas_Object *obj) +static void _mp_tabs_list_item_del_cb(void *data, Evas_Object * obj) { mp_setting_genlist_item_data_t *item_data = data; MP_CHECK(item_data); @@ -786,10 +800,11 @@ _mp_tabs_list_item_del_cb(void *data, Evas_Object *obj) } EXPORT_API void mp_setting_items_reorder_cb(void *data, - Evas_Object *obj, void *event_info) + Evas_Object * obj, + void *event_info) { startfunc; - MpSettingView_t *view = (MpSettingView_t *)data; + MpSettingView_t *view = (MpSettingView_t *) data; MP_CHECK(view); MP_CHECK(view->content); Evas_Object *genlist = view->content; @@ -797,27 +812,29 @@ EXPORT_API void mp_setting_items_reorder_cb(void *data, int cur_sequence = 0; Elm_Object_Item *temp = elm_genlist_first_item_get(genlist); while (temp) { - mp_setting_genlist_item_data_t *item_data = ( - mp_setting_genlist_item_data_t *) - elm_object_item_data_get(temp); + mp_setting_genlist_item_data_t *item_data = + (mp_setting_genlist_item_data_t *) + elm_object_item_data_get(temp); MP_CHECK(item_data); if (cur_sequence != item_data->seq) { - elm_object_item_disabled_set(view->toolbar_options[ - MP_OPTION_LEFT], EINA_FALSE); + elm_object_item_disabled_set(view-> + toolbar_options[MP_OPTION_LEFT], + EINA_FALSE); view->reorder = TRUE; return; } temp = elm_genlist_item_next_get(temp); cur_sequence++; } - elm_object_item_disabled_set(view->toolbar_options[ - MP_OPTION_LEFT], EINA_TRUE); + elm_object_item_disabled_set(view->toolbar_options[MP_OPTION_LEFT], + EINA_TRUE); view->reorder = FALSE; } static void -_mp_tabs_append_genlist_items(Evas_Object *genlist, MpSettingView_t *view) +_mp_tabs_append_genlist_items(Evas_Object * genlist, + MpSettingView_t * view) { int i; mp_retm_if(!view, "INVALID param"); @@ -827,12 +844,10 @@ _mp_tabs_append_genlist_items(Evas_Object *genlist, MpSettingView_t *view) if (!view->tabs_itc[0]) { view->tabs_itc[0] = elm_genlist_item_class_new(); MP_CHECK(view->tabs_itc[0]); - view->tabs_itc[0]->func.text_get = - _mp_tabs_gl_label_get; - view->tabs_itc[0]->func.content_get = - _mp_tabs_gl_icon_get; + view->tabs_itc[0]->func.text_get = _mp_tabs_gl_label_get; + view->tabs_itc[0]->func.content_get = _mp_tabs_gl_icon_get; view->tabs_itc[0]->item_style = - "dialogue/1text.1icon/expandable2"; + "dialogue/1text.1icon/expandable2"; view->tabs_itc[0]->func.del = _mp_tabs_list_item_del_cb; } itc = view->tabs_itc[0]; @@ -840,16 +855,14 @@ _mp_tabs_append_genlist_items(Evas_Object *genlist, MpSettingView_t *view) if (!view->tabs_itc[1]) { view->tabs_itc[1] = elm_genlist_item_class_new(); MP_CHECK(view->tabs_itc[1]); - view->tabs_itc[1]->func.text_get = - _mp_tabs_gl_label_get; - view->tabs_itc[1]->func.content_get = - _mp_tabs_gl_icon_get; + view->tabs_itc[1]->func.text_get = _mp_tabs_gl_label_get; + view->tabs_itc[1]->func.content_get = _mp_tabs_gl_icon_get; view->tabs_itc[1]->func.del = _mp_tabs_list_item_del_cb; view->tabs_itc[1]->item_style = "dialogue/1text"; } itc = view->tabs_itc[1]; evas_object_smart_callback_add(genlist, "moved", - mp_setting_items_reorder_cb, view); + mp_setting_items_reorder_cb, view); } @@ -866,44 +879,51 @@ _mp_tabs_append_genlist_items(Evas_Object *genlist, MpSettingView_t *view) } DEBUG_TRACE("m %d %s", m, tab_str[m - 1]); mp_setting_genlist_item_data_t *item_data = calloc(1, - sizeof(mp_setting_genlist_item_data_t)); + sizeof + (mp_setting_genlist_item_data_t)); MP_CHECK(item_data); item_data->index = m; item_data->seq = i; item_data->str = g_strdup(tab_str[m - 1]); if (view->setting_type == MP_SETTING_VIEW_TABS) { - item_data->it = elm_genlist_item_append(genlist, itc, - (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, - _mp_tabs_gl_sel, (void *)item_data); + item_data->it = elm_genlist_item_append(genlist, itc, + (void *) item_data, + NULL, + ELM_GENLIST_ITEM_NONE, + _mp_tabs_gl_sel, + (void *) item_data); } else if (view->setting_type == MP_SETTING_VIEW_REORDERS) { - item_data->it = elm_genlist_item_append(genlist, itc, - (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, - _mp_tabs_reorder_gl_sel, - (void *)item_data); + item_data->it = elm_genlist_item_append(genlist, itc, + (void *) item_data, + NULL, + ELM_GENLIST_ITEM_NONE, + _mp_tabs_reorder_gl_sel, + (void *) item_data); } elm_object_item_data_set(item_data->it, item_data); } } -static Evas_Object* -_mp_setting_view_tabs_list_create(MpSettingView_t *view, Evas_Object *parent) +static Evas_Object *_mp_setting_view_tabs_list_create(MpSettingView_t * + view, + Evas_Object * parent) { MP_CHECK_VAL(view, NULL); Evas_Object *genlist = mp_widget_genlist_create(parent); elm_scroller_policy_set(genlist, ELM_SCROLLER_POLICY_OFF, - ELM_SCROLLER_POLICY_AUTO); + ELM_SCROLLER_POLICY_AUTO); evas_object_size_hint_weight_set(genlist, - EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(genlist, - EVAS_HINT_FILL, EVAS_HINT_FILL); + EVAS_HINT_FILL, EVAS_HINT_FILL); elm_object_style_set(genlist, "dialogue"); evas_object_smart_callback_add(genlist, "realized", - _mp_setting_view_gl_realized_cb, view); + _mp_setting_view_gl_realized_cb, view); evas_object_event_callback_add(genlist, EVAS_CALLBACK_RESIZE, - _mp_setting_view_gl_resize_cb, view); + _mp_setting_view_gl_resize_cb, view); _mp_tabs_append_genlist_items(genlist, view); @@ -911,14 +931,16 @@ _mp_setting_view_tabs_list_create(MpSettingView_t *view, Evas_Object *parent) return genlist; } -void mp_lyrics_lang_changed(void *data, Evas_Object *obj, void *event_info) +void mp_lyrics_lang_changed(void *data, Evas_Object * obj, + void *event_info) { elm_genlist_realized_items_update(obj); } -static void _lyrics_state_on_cb(void *data, Evas_Object * obj, void *event_info) +static void _lyrics_state_on_cb(void *data, Evas_Object * obj, + void *event_info) { - mp_setting_lyric_popup *ly_popup = (mp_setting_lyric_popup *)data; + mp_setting_lyric_popup *ly_popup = (mp_setting_lyric_popup *) data; Elm_Object_Item *item = (Elm_Object_Item *) event_info; struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); @@ -933,15 +955,16 @@ static void _lyrics_state_on_cb(void *data, Evas_Object * obj, void *event_info) } evas_object_del(ly_popup->popup); - MpPlayerView_t *player_view = (MpPlayerView_t *)GET_PLAYER_VIEW; + MpPlayerView_t *player_view = (MpPlayerView_t *) GET_PLAYER_VIEW; if (player_view) { mp_player_view_refresh(player_view); } } -static void _lyrics_state_off_cb(void *data, Evas_Object * obj, void *event_info) +static void _lyrics_state_off_cb(void *data, Evas_Object * obj, + void *event_info) { - mp_setting_lyric_popup *ly_popup = (mp_setting_lyric_popup *)data; + mp_setting_lyric_popup *ly_popup = (mp_setting_lyric_popup *) data; Elm_Object_Item *item = (Elm_Object_Item *) event_info; struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); @@ -956,15 +979,16 @@ static void _lyrics_state_off_cb(void *data, Evas_Object * obj, void *event_info } evas_object_del(ly_popup->popup); - MpPlayerView_t *player_view = (MpPlayerView_t *)GET_PLAYER_VIEW; + MpPlayerView_t *player_view = (MpPlayerView_t *) GET_PLAYER_VIEW; if (player_view) { mp_player_view_refresh(player_view); } } -static char *_lyrics_view_label_get(void *data, Evas_Object * obj, const char *part) +static char *_lyrics_view_label_get(void *data, Evas_Object * obj, + const char *part) { - int *index = (int *)data; + int *index = (int *) data; DEBUG_TRACE("inddex : %d:", *index); if (*index == 0) { return g_strdup(GET_STR(STR_MP_SHOW_LYRICS)); @@ -974,9 +998,10 @@ static char *_lyrics_view_label_get(void *data, Evas_Object * obj, const char *p return NULL; } -static Evas_Object *_lyrics_view_content_get(void *data, Evas_Object * obj, const char *part) +static Evas_Object *_lyrics_view_content_get(void *data, Evas_Object * obj, + const char *part) { - int *index = (int *)data; + int *index = (int *) data; if (!strcmp(part, "elm.swallow.end")) { bool lyrics_state; @@ -991,8 +1016,10 @@ static Evas_Object *_lyrics_view_content_get(void *data, Evas_Object * obj, cons Evas_Object *radio = elm_radio_add(obj); elm_radio_group_add(radio, group_radio); elm_radio_state_value_set(radio, *index); - evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - 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_size_hint_align_set(radio, EVAS_HINT_FILL, + EVAS_HINT_FILL); evas_object_propagate_events_set(radio, EINA_TRUE); evas_object_show(radio); return radio; @@ -1013,22 +1040,28 @@ void mp_music_viewas_pop_cb(void) /* elm_object_style_set(popup, "content/default"); */ elm_popup_orient_set(popup, ELM_POPUP_ORIENT_CENTER); evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - mp_util_domain_translatable_part_text_set(popup, "title,text", STR_MP_LYRICS); + EVAS_HINT_EXPAND); + mp_util_domain_translatable_part_text_set(popup, "title,text", + STR_MP_LYRICS); eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, - eext_popup_back_cb, NULL); + eext_popup_back_cb, NULL); evas_object_repeat_events_set(popup, EINA_FALSE); genlist = elm_genlist_add(popup); elm_object_focus_set(genlist, EINA_FALSE); - evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_smart_callback_add(genlist, "language,changed", mp_lyrics_lang_changed, NULL); + evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_smart_callback_add(genlist, "language,changed", + mp_lyrics_lang_changed, NULL); box = elm_box_add(popup); - evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); evas_object_size_hint_min_set(box, -1, - ELMEMTARY_SCALE_SIZE(MP_POPUP_MENUSTYLE_HEIGHT(2))); + ELMEMTARY_SCALE_SIZE + (MP_POPUP_MENUSTYLE_HEIGHT(2))); elm_box_pack_end(box, genlist); evas_object_show(popup); evas_object_show(genlist); @@ -1039,7 +1072,8 @@ void mp_music_viewas_pop_cb(void) elm_radio_state_value_set(group_radio, -1); elm_radio_value_set(group_radio, -1); - mp_setting_lyric_popup *ly_popup = (mp_setting_lyric_popup *)malloc(sizeof(mp_setting_lyric_popup)); + mp_setting_lyric_popup *ly_popup = + (mp_setting_lyric_popup *) malloc(sizeof(mp_setting_lyric_popup)); MP_CHECK(ly_popup); ly_popup->popup = popup; @@ -1055,20 +1089,22 @@ void mp_music_viewas_pop_cb(void) itc->func.del = NULL; } elm_genlist_item_append(genlist, itc, &(ly_popup->show_lyrics), NULL, - ELM_GENLIST_ITEM_NONE, _lyrics_state_on_cb, (mp_setting_lyric_popup *)ly_popup); -// data = 1; + ELM_GENLIST_ITEM_NONE, _lyrics_state_on_cb, + (mp_setting_lyric_popup *) ly_popup); +// data = 1; elm_genlist_item_append(genlist, itc, &(ly_popup->hide_lyrics), NULL, - ELM_GENLIST_ITEM_NONE, _lyrics_state_off_cb, (mp_setting_lyric_popup *)ly_popup); + ELM_GENLIST_ITEM_NONE, _lyrics_state_off_cb, + (mp_setting_lyric_popup *) ly_popup); } static int -_mp_setting_view_init(Evas_Object *parent, MpSettingView_t *view, - MpSettingViewType_e type, void *data) +_mp_setting_view_init(Evas_Object * parent, MpSettingView_t * view, + MpSettingViewType_e type, void *data) { startfunc; int ret = 0; - ret = mp_view_init(parent, (MpView_t *)view, MP_VIEW_SETTING); + ret = mp_view_init(parent, (MpView_t *) view, MP_VIEW_SETTING); MP_CHECK_VAL(ret == 0, -1); view->update = _mp_setting_view_update; @@ -1090,10 +1126,10 @@ _mp_setting_view_init(Evas_Object *parent, MpSettingView_t *view, ms_key_get_tabs_val(&tab_state); view->content = _mp_setting_view_tabs_list_create(view, parent); } else if (type == MP_SETTING_VIEW_REORDERS) { - int parent_type = (int)data; + int parent_type = (int) data; if (parent_type == MP_SETTING_VIEW_TABS) { - view->content = _mp_setting_view_tabs_list_create( - view, parent); + view->content = + _mp_setting_view_tabs_list_create(view, parent); view->reorder_type = MP_SETTING_REORDER_TABS; } else if (parent_type == MP_SETTING_VIEW_PLAYLISTS) { view->content = ms_playlist_list_create(view, parent); @@ -1101,7 +1137,7 @@ _mp_setting_view_init(Evas_Object *parent, MpSettingView_t *view, } mp_list_reorder_mode_set(view->content, EINA_TRUE); mp_list_select_mode_set(view->content, - ELM_OBJECT_SELECT_MODE_ALWAYS); + ELM_OBJECT_SELECT_MODE_ALWAYS); } else if (type == MP_SETTING_VIEW_PLAYLISTS) { view->content = ms_playlist_list_create(view, parent); } else { @@ -1109,15 +1145,16 @@ _mp_setting_view_init(Evas_Object *parent, MpSettingView_t *view, } MP_CHECK_VAL(view->content, -1); elm_object_part_content_set(view->layout, "list_content", - view->content); - /*elm_object_signal_emit(view->layout, "SHOW_INFO_TEXT_PADDING", "");*/ + view->content); + /*elm_object_signal_emit(view->layout, "SHOW_INFO_TEXT_PADDING", ""); */ return ret; } /* param void *data is used to update previous view.. */ -EXPORT_API MpSettingView_t *mp_setting_view_create(Evas_Object *parent, - MpSettingViewType_e type, void *data) +EXPORT_API MpSettingView_t *mp_setting_view_create(Evas_Object * parent, + MpSettingViewType_e + type, void *data) { startfunc; int ret; @@ -1133,13 +1170,13 @@ EXPORT_API MpSettingView_t *mp_setting_view_create(Evas_Object *parent, return view; -Error: + Error: ERROR_TRACE("Error: mp_setting_view_create()"); IF_FREE(view); return NULL; } -int mp_setting_view_destory(MpSettingView_t *view) +int mp_setting_view_destory(MpSettingView_t * view) { startfunc; MP_CHECK_VAL(view, -1); @@ -1162,4 +1199,3 @@ int mp_setting_view_destory(MpSettingView_t *view) } return 0; } - diff --git a/src/view/mp-view.c b/src/view/mp-view.c index ca7120b..1ca766a 100644 --- a/src/view/mp-view.c +++ b/src/view/mp-view.c @@ -28,8 +28,8 @@ #define CHECK_VIEW(view, val) \ do {\ MP_CHECK_VAL(view, val);\ - mp_retvm_if (view->view_magic != VIEW_MAGIC, val,\ - "Error: param is not view object!!!magic: %d", view->view_magic);\ + mp_retvm_if(view->view_magic != VIEW_MAGIC, val,\ + "Error: param is not view object!!!magic: %d", view->view_magic);\ } while (0); @@ -43,11 +43,16 @@ static int _mp_view_set_title(void *thiz, char *text_id) MpView_t *view = thiz; MP_CHECK_VAL(view, -1); - mp_util_item_domain_translatable_part_text_set(view->navi_it, "elm.text.title", (const char *)text_id); + mp_util_item_domain_translatable_part_text_set(view->navi_it, + "elm.text.title", + (const char *) text_id); if (!view->disable_title_icon && view->layout) { - Evas_Object *title_icon = mp_widget_create_title_icon(view->layout, IMAGE_EDJ_NAME, MP_ICON_APP_MUSIC); - elm_object_item_part_content_set(view->navi_it, "icon", title_icon); + Evas_Object *title_icon = + mp_widget_create_title_icon(view->layout, IMAGE_EDJ_NAME, + MP_ICON_APP_MUSIC); + elm_object_item_part_content_set(view->navi_it, "icon", + title_icon); } return 0; @@ -60,7 +65,7 @@ static int _mp_view_set_sub_title(void *thiz, char *title) MP_CHECK_VAL(view, -1); /*Evas_Object *label = _get_sub_title_label(view->layout, title); - elm_object_style_set(label, "music/naviframe_subtitle");*/ + elm_object_style_set(label, "music/naviframe_subtitle"); */ elm_object_item_part_text_set(view->navi_it, "subtitle", title); return 0; @@ -73,12 +78,14 @@ static int _mp_view_title_slide_go(void *thiz) MP_CHECK_VAL(view, -1); Elm_Object_Item *nf_it = view->navi_it; - Evas_Object *label = elm_object_item_part_content_get(nf_it, "elm.swallow.title"); + Evas_Object *label = + elm_object_item_part_content_get(nf_it, "elm.swallow.title"); if (label) { elm_label_slide_go(label); } - label = elm_object_item_part_content_get(nf_it, "elm.swallow.subtitle"); + label = + elm_object_item_part_content_get(nf_it, "elm.swallow.subtitle"); if (label) { elm_label_slide_go(label); } @@ -128,9 +135,10 @@ static int _mp_view_update_nowplaying(void *thiz, bool with_title) if (mp_util_is_image_valid(ad->evas, info->thumbnail_path)) { thumbpath = info->thumbnail_path; } else { - char default_thumbnail[1024] = {0}; + char default_thumbnail[1024] = { 0 }; char *shared_path = app_get_shared_resource_path(); - snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, "shared_images", DEFAULT_THUMBNAIL); + snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, + "shared_images", DEFAULT_THUMBNAIL); free(shared_path); thumbpath = g_strdup(default_thumbnail); } @@ -139,7 +147,8 @@ static int _mp_view_update_nowplaying(void *thiz, bool with_title) mp_view_set_nowplaying(thiz); } - mp_now_playing_update(view->nowplaying_bar, info->title, info->artist, thumbpath, with_title); + mp_now_playing_update(view->nowplaying_bar, info->title, info->artist, + thumbpath, with_title); return 0; } @@ -178,11 +187,14 @@ static void _mp_view_show_now_playing(void *thiz, int show) MP_CHECK(view->layout); MP_CHECK(view->nowplaying_bar); if (show) { - edje_object_signal_emit(_EDJ(view->layout), "SHOW_NOW_PLAING", "music_app"); + edje_object_signal_emit(_EDJ(view->layout), "SHOW_NOW_PLAING", + "music_app"); } else { - edje_object_signal_emit(_EDJ(view->layout), "HIDE_NOW_PLAING", "music_app"); + edje_object_signal_emit(_EDJ(view->layout), "HIDE_NOW_PLAING", + "music_app"); } - evas_object_data_set(view->nowplaying_bar, "NOW_PLAYING_SHOW_FLAG", (void *)show); + evas_object_data_set(view->nowplaying_bar, "NOW_PLAYING_SHOW_FLAG", + (void *) show); } static int _mp_view_set_nowplaying(void *thiz) @@ -190,10 +202,10 @@ static int _mp_view_set_nowplaying(void *thiz) startfunc; MpView_t *view = thiz; #ifndef MP_SOUND_PLAYER - bool val = false; - mp_list_view_is_list_view((MpListView_t *)view, &val); + bool val = false; + mp_list_view_is_list_view((MpListView_t *) view, &val); - MpList_t *list = ((MpListView_t *)view)->content_to_show; + MpList_t *list = ((MpListView_t *) view)->content_to_show; if (val && mp_list_get_edit(list) && mp_list_get_reorder(list)) { return 0; } @@ -203,12 +215,15 @@ static int _mp_view_set_nowplaying(void *thiz) if (!ad->current_track_info) { return 0; } - #endif if (!view->nowplaying_bar) { view->rotate_flag = FALSE; - view->nowplaying_bar = mp_now_playing_create(view->layout, _mp_view_now_playing_play_pause_cb, _mp_view_now_playing_cb, view); - elm_object_part_content_set(view->layout, "now_playing", view->nowplaying_bar); + view->nowplaying_bar = + mp_now_playing_create(view->layout, + _mp_view_now_playing_play_pause_cb, + _mp_view_now_playing_cb, view); + elm_object_part_content_set(view->layout, "now_playing", + view->nowplaying_bar); mp_view_update_nowplaying(view, true); } else { mp_view_update_nowplaying(view, true); @@ -278,23 +293,30 @@ static int _mp_view_clear_options(void *thiz) } Evas_Object *btn = NULL; - btn = elm_object_item_part_content_unset(view->navi_it, "toolbar_button1"); + btn = + elm_object_item_part_content_unset(view->navi_it, + "toolbar_button1"); mp_evas_object_del(btn); - btn = elm_object_item_part_content_unset(view->navi_it, "toolbar_button2"); + btn = + elm_object_item_part_content_unset(view->navi_it, + "toolbar_button2"); mp_evas_object_del(btn); - btn = elm_object_item_part_content_unset(view->navi_it, "toolbar_more_btn"); + btn = + elm_object_item_part_content_unset(view->navi_it, + "toolbar_more_btn"); mp_evas_object_del(btn); - Evas_Object *toolbar = elm_object_item_part_content_unset(view->navi_it, "toolbar"); + Evas_Object *toolbar = + elm_object_item_part_content_unset(view->navi_it, "toolbar"); mp_evas_object_del(toolbar); - endfunc - return 0; + endfunc return 0; } #endif static void -_mp_view_layout_del_cb(void *data, Evas * e, Evas_Object * obj, void *event_info) +_mp_view_layout_del_cb(void *data, Evas * e, Evas_Object * obj, + void *event_info) { MpView_t *view = data; MP_CHECK(view); @@ -354,13 +376,13 @@ static void _mp_view_view_resume(void *thiz) #endif } -static void -_mp_view_on_event(void *thiz, MpViewEvent_e event) +static void _mp_view_on_event(void *thiz, MpViewEvent_e event) { DEBUG_TRACE("event; %d", event); } -int mp_view_init(Evas_Object *parent, MpView_t *view, MpViewType_e view_type, ...) +int mp_view_init(Evas_Object * parent, MpView_t * view, + MpViewType_e view_type, ...) { startfunc; MP_CHECK_VAL(view, -1); @@ -393,8 +415,10 @@ int mp_view_init(Evas_Object *parent, MpView_t *view, MpViewType_e view_type, .. #ifdef MP_FEATURE_MULTIWINDOW if (!view->disable_scroller) { view->scroller = elm_scroller_add(parent); - evas_object_size_hint_weight_set(view->scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(view->scroller, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(view->scroller, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(view->scroller, EVAS_HINT_FILL, + EVAS_HINT_FILL); elm_object_content_set(view->scroller, view->layout); elm_scroller_bounce_set(view->scroller, EINA_FALSE, EINA_FALSE); evas_object_show(view->scroller); @@ -404,22 +428,22 @@ int mp_view_init(Evas_Object *parent, MpView_t *view, MpViewType_e view_type, .. evas_object_data_set(view->layout, "view_data", view); - evas_object_event_callback_add(view->layout, EVAS_CALLBACK_FREE, _mp_view_layout_del_cb, - view); + evas_object_event_callback_add(view->layout, EVAS_CALLBACK_FREE, + _mp_view_layout_del_cb, view); if (view_type == MP_VIEW_PLAYER - || view_type == MP_VIEW_SEARCH - || view_type == MP_VIEW_EDIT - || view_type == MP_VIEW_ADD_TRACK - || view_type == MP_VIEW_SELECT_TRACK - || view_type == MP_VIEW_MAKE_OFFLINE) { + || view_type == MP_VIEW_SEARCH + || view_type == MP_VIEW_EDIT + || view_type == MP_VIEW_ADD_TRACK + || view_type == MP_VIEW_SELECT_TRACK + || view_type == MP_VIEW_MAKE_OFFLINE) { view->disable_title_icon = true; } return 0; } -int mp_view_fini(MpView_t *view) +int mp_view_fini(MpView_t * view) { startfunc; CHECK_VIEW(view, -1); @@ -428,7 +452,7 @@ int mp_view_fini(MpView_t *view) return 0; } -EXPORT_API int mp_view_update(MpView_t *view) +EXPORT_API int mp_view_update(MpView_t * view) { startfunc; CHECK_VIEW(view, -1); @@ -436,9 +460,9 @@ EXPORT_API int mp_view_update(MpView_t *view) view->update(view); #ifndef MP_SOUND_PLAYER bool val = false; - mp_list_view_is_list_view((MpListView_t *)view, &val); + mp_list_view_is_list_view((MpListView_t *) view, &val); - if (val && mp_list_get_edit(((MpListView_t *)view)->content_to_show)) { + if (val && mp_list_get_edit(((MpListView_t *) view)->content_to_show)) { mp_view_update_options_edit(view); } else #endif @@ -447,7 +471,7 @@ EXPORT_API int mp_view_update(MpView_t *view) return 0; } -EXPORT_API int mp_view_update_options(MpView_t *view) +EXPORT_API int mp_view_update_options(MpView_t * view) { startfunc; CHECK_VIEW(view, -1); @@ -458,7 +482,7 @@ EXPORT_API int mp_view_update_options(MpView_t *view) return ret; } -int mp_view_update_options_edit(MpView_t *view) +int mp_view_update_options_edit(MpView_t * view) { startfunc; CHECK_VIEW(view, -1); @@ -471,7 +495,7 @@ int mp_view_update_options_edit(MpView_t *view) return ret; } -int mp_view_clear_options(MpView_t *view) +int mp_view_clear_options(MpView_t * view) { startfunc; CHECK_VIEW(view, -1); @@ -479,7 +503,7 @@ int mp_view_clear_options(MpView_t *view) return view->clear_options(view); } -Evas_Object *mp_view_get_base_obj(MpView_t *view) +Evas_Object *mp_view_get_base_obj(MpView_t * view) { startfunc; CHECK_VIEW(view, NULL); @@ -492,7 +516,7 @@ Evas_Object *mp_view_get_base_obj(MpView_t *view) } -EXPORT_API int mp_view_set_title(MpView_t *view, char *title) +EXPORT_API int mp_view_set_title(MpView_t * view, char *title) { startfunc; CHECK_VIEW(view, -1); @@ -500,7 +524,7 @@ EXPORT_API int mp_view_set_title(MpView_t *view, char *title) return view->set_title(view, title); } -int mp_view_set_sub_title(MpView_t *view, char *title) +int mp_view_set_sub_title(MpView_t * view, char *title) { startfunc; CHECK_VIEW(view, -1); @@ -508,16 +532,17 @@ int mp_view_set_sub_title(MpView_t *view, char *title) return view->set_subtitle(view, title); } -int mp_view_set_title_visible(MpView_t *view, int visible) +int mp_view_set_title_visible(MpView_t * view, int visible) { startfunc; CHECK_VIEW(view, -1); MP_CHECK_VAL(view->navi_it, -1); - elm_naviframe_item_title_enabled_set(view->navi_it, (Eina_Bool)visible, false); + elm_naviframe_item_title_enabled_set(view->navi_it, + (Eina_Bool) visible, false); return 0; } -int mp_view_title_slide_go(MpView_t *view) +int mp_view_title_slide_go(MpView_t * view) { startfunc; CHECK_VIEW(view, -1); @@ -526,7 +551,7 @@ int mp_view_title_slide_go(MpView_t *view) } -int mp_view_set_nowplaying(MpView_t *view) +int mp_view_set_nowplaying(MpView_t * view) { startfunc; CHECK_VIEW(view, -1); @@ -536,7 +561,7 @@ int mp_view_set_nowplaying(MpView_t *view) return 0; } -int mp_view_unset_nowplaying(MpView_t *view) +int mp_view_unset_nowplaying(MpView_t * view) { startfunc; CHECK_VIEW(view, -1); @@ -546,7 +571,7 @@ int mp_view_unset_nowplaying(MpView_t *view) return 0; } -int mp_view_update_nowplaying(MpView_t *view, bool with_title) +int mp_view_update_nowplaying(MpView_t * view, bool with_title) { startfunc; CHECK_VIEW(view, -1); @@ -556,7 +581,7 @@ int mp_view_update_nowplaying(MpView_t *view, bool with_title) return 0; } -int mp_view_freeze_nowplaying(MpView_t *view, int freeze) +int mp_view_freeze_nowplaying(MpView_t * view, int freeze) { startfunc; CHECK_VIEW(view, -1); @@ -566,15 +591,17 @@ int mp_view_freeze_nowplaying(MpView_t *view, int freeze) return 0; } -int mp_view_get_nowplaying_show_flag(MpView_t *view) +int mp_view_get_nowplaying_show_flag(MpView_t * view) { startfunc; CHECK_VIEW(view, 0); MP_CHECK_VAL(view->update_nowplaying, 0); - return ((int)evas_object_data_get(view->nowplaying_bar, "NOW_PLAYING_SHOW_FLAG")); + return ((int) + evas_object_data_get(view->nowplaying_bar, + "NOW_PLAYING_SHOW_FLAG")); } -int mp_view_start_playback(MpView_t *view) +int mp_view_start_playback(MpView_t * view) { startfunc; CHECK_VIEW(view, -1); @@ -582,7 +609,7 @@ int mp_view_start_playback(MpView_t *view) return view->start_playback(view); } -int mp_view_pause_playback(MpView_t *view) +int mp_view_pause_playback(MpView_t * view) { startfunc; CHECK_VIEW(view, -1); @@ -590,7 +617,7 @@ int mp_view_pause_playback(MpView_t *view) return view->pause_playback(view); } -int mp_view_stop_playback(MpView_t *view) +int mp_view_stop_playback(MpView_t * view) { startfunc; CHECK_VIEW(view, -1); @@ -598,7 +625,7 @@ int mp_view_stop_playback(MpView_t *view) return view->stop_playback(view); } -int mp_view_view_lcd_off(MpView_t *view) +int mp_view_view_lcd_off(MpView_t * view) { CHECK_VIEW(view, -1); MP_CHECK_VAL(view->view_lcd_off, -1); @@ -606,7 +633,7 @@ int mp_view_view_lcd_off(MpView_t *view) return 0; } -int mp_view_view_lcd_on(MpView_t *view) +int mp_view_view_lcd_on(MpView_t * view) { CHECK_VIEW(view, -1); MP_CHECK_VAL(view->view_lcd_on, -1); @@ -615,7 +642,7 @@ int mp_view_view_lcd_on(MpView_t *view) return 0; } -int mp_view_view_pause(MpView_t *view) +int mp_view_view_pause(MpView_t * view) { CHECK_VIEW(view, -1); view->paused = true; @@ -624,7 +651,7 @@ int mp_view_view_pause(MpView_t *view) return 0; } -int mp_view_view_resume(MpView_t *view) +int mp_view_view_resume(MpView_t * view) { CHECK_VIEW(view, -1); view->paused = false; @@ -633,7 +660,7 @@ int mp_view_view_resume(MpView_t *view) return 0; } -EXPORT_API int mp_view_on_event(MpView_t *view, MpViewEvent_e event) +EXPORT_API int mp_view_on_event(MpView_t * view, MpViewEvent_e event) { CHECK_VIEW(view, -1); diff --git a/src/widget/include/mp-album-detail-list.h b/src/widget/include/mp-album-detail-list.h index 207bc50..38131d8 100644 --- a/src/widget/include/mp-album-detail-list.h +++ b/src/widget/include/mp-album-detail-list.h @@ -20,8 +20,7 @@ #include "mp-list.h" #include "mp-media-info.h" -enum -{ +enum { MP_ALBUM_DETAIL_LIST_TYPE, //mp_track_type_e MP_ALBUM_DETAIL_TYPE_STR, //type_str for db query MP_ALBUM_DETAIL_ARTIST, @@ -29,10 +28,8 @@ enum }; -typedef struct __MpAlbumDetailList{ - INHERIT_MP_LIST - - void (*set_edit_default)(void *thiz, bool edit); +typedef struct __MpAlbumDetailList { + INHERIT_MP_LIST void (*set_edit_default) (void *thiz, bool edit); Elm_Genlist_Item_Class *itc; Elm_Genlist_Item_Class *itc_album; @@ -49,14 +46,15 @@ typedef struct __MpAlbumDetailList{ char *artist; char *thumbnail; -}MpAlbumDetailList_t; +} MpAlbumDetailList_t; -MpAlbumDetailList_t * mp_album_detail_list_create(Evas_Object *parent); -void mp_album_detail_list_set_data(MpAlbumDetailList_t *list, ...); -void mp_album_detail_list_set_reorder(MpAlbumDetailList_t *list, bool reorder); +MpAlbumDetailList_t *mp_album_detail_list_create(Evas_Object * parent); +void mp_album_detail_list_set_data(MpAlbumDetailList_t * list, ...); +void mp_album_detail_list_set_reorder(MpAlbumDetailList_t * list, + bool reorder); void mp_album_detail_list_show_shuffle(void *thiz, bool show); void mp_album_detail_list_update_genlist(void *thiz); void mp_album_detail_list_popup_delete_genlist_item(void *thiz); -void mp_album_detail_list_copy_data(MpAlbumDetailList_t *src, MpAlbumDetailList_t *dest); +void mp_album_detail_list_copy_data(MpAlbumDetailList_t * src, + MpAlbumDetailList_t * dest); #endif - diff --git a/src/widget/include/mp-album-list.h b/src/widget/include/mp-album-list.h index 88cab48..d3c4365 100644 --- a/src/widget/include/mp-album-list.h +++ b/src/widget/include/mp-album-list.h @@ -20,30 +20,26 @@ #include "mp-list.h" #include "mp-media-info.h" -enum -{ - MP_ALBUM_LIST_FUNC, //indicate in all-view or add-track-view +enum { + MP_ALBUM_LIST_FUNC, //indicate in all-view or add-track-view MP_ALBUM_LIST_DISPLAY_MODE, }; -typedef struct __MpAlbumList{ - INHERIT_MP_LIST - - Elm_Genlist_Item_Class *itc; +typedef struct __MpAlbumList { + INHERIT_MP_LIST Elm_Genlist_Item_Class * itc; Elm_Gengrid_Item_Class *gengrid_itc; Elm_Genlist_Item_Class *itc_group_index; Elm_Object_Item *group_it; - void (*set_edit_default)(void *thiz, bool edit); + void (*set_edit_default) (void *thiz, bool edit); mp_media_list_h album_list; int album_list_count; -}MpAlbumList_t; +} MpAlbumList_t; -MpAlbumList_t * mp_album_list_create(Evas_Object *parent); -void mp_album_list_set_data(MpAlbumList_t *list, ...); -void mp_album_list_copy_data(MpAlbumList_t*src, MpAlbumList_t *dest); -void mp_album_list_set_reorder(MpAlbumList_t *list, bool reorder); +MpAlbumList_t *mp_album_list_create(Evas_Object * parent); +void mp_album_list_set_data(MpAlbumList_t * list, ...); +void mp_album_list_copy_data(MpAlbumList_t * src, MpAlbumList_t * dest); +void mp_album_list_set_reorder(MpAlbumList_t * list, bool reorder); #endif - diff --git a/src/widget/include/mp-artist-detail-list.h b/src/widget/include/mp-artist-detail-list.h index 3421e5b..0985183 100644 --- a/src/widget/include/mp-artist-detail-list.h +++ b/src/widget/include/mp-artist-detail-list.h @@ -20,17 +20,14 @@ #include "mp-list.h" #include "mp-media-info.h" -enum -{ +enum { MP_ARTIST_DETAIL_LIST_TYPE, //mp_track_type_e MP_ARTIST_DETAIL_LIST_TYPE_STR, //type_str for db query MP_ARTIST_DETAIL_LIST_FILTER_STR, }; -typedef struct __MpArtistDetailList{ - INHERIT_MP_LIST - - void (*set_edit_default)(void *thiz, bool edit); +typedef struct __MpArtistDetailList { + INHERIT_MP_LIST void (*set_edit_default) (void *thiz, bool edit); Elm_Genlist_Item_Class *itc_track; Elm_Genlist_Item_Class *itc_album; @@ -43,13 +40,14 @@ typedef struct __MpArtistDetailList{ int count_album; //int edit_mode; -}MpArtistDetailList_t; +} MpArtistDetailList_t; -MpArtistDetailList_t * mp_artist_detail_list_create(Evas_Object *parent); -void mp_artist_detail_list_set_data(MpArtistDetailList_t *list, ...); -void mp_artist_detail_list_set_reorder(MpArtistDetailList_t *list, bool reorder); -void mp_artist_detail_list_copy_data(MpArtistDetailList_t *src, MpArtistDetailList_t *dest); +MpArtistDetailList_t *mp_artist_detail_list_create(Evas_Object * parent); +void mp_artist_detail_list_set_data(MpArtistDetailList_t * list, ...); +void mp_artist_detail_list_set_reorder(MpArtistDetailList_t * list, + bool reorder); +void mp_artist_detail_list_copy_data(MpArtistDetailList_t * src, + MpArtistDetailList_t * dest); void mp_artist_detail_list_update_genlist(void *thiz); #endif - diff --git a/src/widget/include/mp-artist-list.h b/src/widget/include/mp-artist-list.h index 2cdf9c8..42bd3e8 100644 --- a/src/widget/include/mp-artist-list.h +++ b/src/widget/include/mp-artist-list.h @@ -20,9 +20,8 @@ #include "mp-list.h" #include "mp-media-info.h" -enum -{ - MP_ARTIST_LIST_TYPE, //mp_track_type_e +enum { + MP_ARTIST_LIST_TYPE, //mp_track_type_e MP_ARTIST_LIST_FUNC, MP_ARTIST_LIST_PLAYLIT_ID, MP_ARTIST_LIST_TYPE_STR, //type_str for db query @@ -30,23 +29,20 @@ enum MP_ARTIST_LIST_DISPLAY_MODE, }; -typedef struct __MpArtistList{ - INHERIT_MP_LIST - - Elm_Genlist_Item_Class *itc; +typedef struct __MpArtistList { + INHERIT_MP_LIST Elm_Genlist_Item_Class * itc; Elm_Gengrid_Item_Class *gengrid_itc; - Elm_Genlist_Item_Class *itc_group_index; - Elm_Object_Item *group_it; - void (*set_edit_default)(void *thiz, bool edit); + Elm_Genlist_Item_Class *itc_group_index; + Elm_Object_Item *group_it; + void (*set_edit_default) (void *thiz, bool edit); mp_media_list_h artist_list; int artist_list_count; -}MpArtistList_t; +} MpArtistList_t; -MpArtistList_t * mp_artist_list_create(Evas_Object *parent); -void mp_artist_list_set_data(MpArtistList_t *list, ...); -void mp_artist_list_copy_data(MpArtistList_t*src, MpArtistList_t *dest); -void mp_artist_list_set_reorder(MpArtistList_t *list, bool reorder); +MpArtistList_t *mp_artist_list_create(Evas_Object * parent); +void mp_artist_list_set_data(MpArtistList_t * list, ...); +void mp_artist_list_copy_data(MpArtistList_t * src, MpArtistList_t * dest); +void mp_artist_list_set_reorder(MpArtistList_t * list, bool reorder); #endif - diff --git a/src/widget/include/mp-ctxpopup.h b/src/widget/include/mp-ctxpopup.h index 1dfd839..ab61854 100644 --- a/src/widget/include/mp-ctxpopup.h +++ b/src/widget/include/mp-ctxpopup.h @@ -20,8 +20,7 @@ #include -typedef enum _mp_ctxpopup_t -{ +typedef enum _mp_ctxpopup_t { MP_CTXPOPUP_PV_SET_AS = 0, MP_CTXPOPUP_PV_SET_AS_INCLUDE_ADD_TO_HOME, MP_CTXPOPUP_PV_SHARE, @@ -29,9 +28,9 @@ typedef enum _mp_ctxpopup_t MP_CTXPOPUP_CHANGE_AXIS, } mp_ctxpopup_t; -Evas_Object * -mp_ctxpopup_create(Evas_Object *parent, int type, void *user_data, void *ad); +Evas_Object *mp_ctxpopup_create(Evas_Object * parent, int type, + void *user_data, void *ad); void mp_ctxpopup_clear(Evas_Object * popup); void mp_ctxpopup_destroy(Evas_Object * popup); -#endif // __MP_ctxpopup_H_ +#endif // __MP_ctxpopup_H_ diff --git a/src/widget/include/mp-edit-playlist.h b/src/widget/include/mp-edit-playlist.h index d979ba5..70df0c8 100644 --- a/src/widget/include/mp-edit-playlist.h +++ b/src/widget/include/mp-edit-playlist.h @@ -25,9 +25,9 @@ typedef enum { } mp_plst_create_type_e; typedef enum { - MP_PLST_NORMAL, - MP_PLST_CREATE, - MP_PLST_CREATE_TO_ADD_TRACK, + MP_PLST_NORMAL, + MP_PLST_CREATE, + MP_PLST_CREATE_TO_ADD_TRACK, MP_PLST_RENAME, MP_PLST_SAVE_AS, } mp_plst_operation_type; @@ -37,32 +37,35 @@ typedef struct { struct appdata *ad; mp_plst_operation_type type; - char *new_playlist_name; - char *name; + char *new_playlist_name; + char *name; char *oldname; - Evas_Object *popup; - Evas_Object *layout; - Evas_Object *editfiled_entry; - Evas_Object *btn_ok; + Evas_Object *popup; + Evas_Object *layout; + Evas_Object *editfiled_entry; + Evas_Object *btn_ok; - bool add_to_selected; - mp_media_info_h playlist_handle; + bool add_to_selected; + mp_media_info_h playlist_handle; MpList_t *adding_list; char *adding_media_id; - mp_plst_create_type_e creation_type; + mp_plst_create_type_e creation_type; - Ecore_Timer *entry_show_timer; - Ecore_Idler *set_line_end_idler; - bool set_to_end; + Ecore_Timer *entry_show_timer; + Ecore_Idler *set_line_end_idler; + bool set_to_end; } Mp_Playlist_Data; void *mp_edit_playlist_create(mp_plst_operation_type type); void mp_edit_playlist_content_create(void *thiz); void mp_edit_playlist_add_to_selected_mode(void *data, bool selected); -int mp_edit_playlist_set_edit_list(Mp_Playlist_Data *mp_playlist_data, MpList_t *adding_list); -int mp_edit_playlist_set_media_id(Mp_Playlist_Data *mp_playlist_data, const char *adding_media_id); -int mp_edit_playlist_set_create_type(Mp_Playlist_Data *mp_playlist_data, mp_plst_create_type_e type); +int mp_edit_playlist_set_edit_list(Mp_Playlist_Data * mp_playlist_data, + MpList_t * adding_list); +int mp_edit_playlist_set_media_id(Mp_Playlist_Data * mp_playlist_data, + const char *adding_media_id); +int mp_edit_playlist_set_create_type(Mp_Playlist_Data * mp_playlist_data, + mp_plst_create_type_e type); #endif diff --git a/src/widget/include/mp-genre-list.h b/src/widget/include/mp-genre-list.h index 4a476cc..c2abfa3 100644 --- a/src/widget/include/mp-genre-list.h +++ b/src/widget/include/mp-genre-list.h @@ -20,28 +20,23 @@ #include "mp-list.h" #include "mp-media-info.h" -enum -{ - MP_GENRE_LIST_FUNC, //indicate in all-view or add-track-view +enum { + MP_GENRE_LIST_FUNC, //indicate in all-view or add-track-view MP_GENRE_LIST_DISPLAY_MODE, }; -typedef struct __MpGenreList{ - INHERIT_MP_LIST - - Elm_Genlist_Item_Class *itc; +typedef struct __MpGenreList { + INHERIT_MP_LIST Elm_Genlist_Item_Class * itc; Elm_Gengrid_Item_Class *gengrid_itc; mp_media_list_h genre_list; int genre_list_count; -}MpGenreList_t; +} MpGenreList_t; -MpGenreList_t * mp_genre_list_create(Evas_Object *parent); -void mp_genre_list_set_data(MpGenreList_t *list, ...); -void mp_genre_list_copy_data(MpGenreList_t*src, MpGenreList_t *dest); -void mp_genre_list_set_reorder(MpGenreList_t *list, bool reorder); +MpGenreList_t *mp_genre_list_create(Evas_Object * parent); +void mp_genre_list_set_data(MpGenreList_t * list, ...); +void mp_genre_list_copy_data(MpGenreList_t * src, MpGenreList_t * dest); +void mp_genre_list_set_reorder(MpGenreList_t * list, bool reorder); #endif - - diff --git a/src/widget/include/mp-index.h b/src/widget/include/mp-index.h index 8bfbcfb..ff0af82 100644 --- a/src/widget/include/mp-index.h +++ b/src/widget/include/mp-index.h @@ -20,11 +20,11 @@ #include #include -typedef void (*MpIndexCb)(void *data); +typedef void (*MpIndexCb) (void *data); -Evas_Object *mp_index_create(Evas_Object *parent, int group_type, void *data); -void mp_index_append_item(Evas_Object *index, MpList_t *list); +Evas_Object *mp_index_create(Evas_Object * parent, int group_type, + void *data); +void mp_index_append_item(Evas_Object * index, MpList_t * list); #endif - diff --git a/src/widget/include/mp-list.h b/src/widget/include/mp-list.h index cbfa4d8..922be81 100644 --- a/src/widget/include/mp-list.h +++ b/src/widget/include/mp-list.h @@ -22,55 +22,49 @@ #include "mp-player-debug.h" #include "mp-popup.h" -typedef enum -{ +typedef enum { MP_LIST_TYPE_TRACK, MP_LIST_TYPE_GROUP, MP_LIST_TYPE_PLAYLIST, - MP_LIST_TYPE_ALBUM_DETAIL, + MP_LIST_TYPE_ALBUM_DETAIL, MP_LIST_TYPE_ARTIST_DETAIL, MP_LIST_TYPE_ALL, - MP_LIST_TYPE_SQUARE, + MP_LIST_TYPE_SQUARE, MP_LIST_TYPE_MAX, -}MpListType_e; +} MpListType_e; -typedef enum -{ - MP_LIST_FUNC_NORMAL, //in all-view - MP_LIST_FUNC_ADD_TRACK, //in add-track-view +typedef enum { + MP_LIST_FUNC_NORMAL, //in all-view + MP_LIST_FUNC_ADD_TRACK, //in add-track-view MP_LIST_FUNC_MAX, -}MpListFunction_e; +} MpListFunction_e; -typedef enum -{ +typedef enum { MP_LIST_DISPLAY_MODE_NORMAL, MP_LIST_DISPLAY_MODE_THUMBNAIL, MP_LIST_DISPLAY_MODE_MAX, -} MpListDisplayMode_e; // view as +} MpListDisplayMode_e; // view as -typedef enum -{ +typedef enum { MP_LIST_EDIT_TYPE_NORMAL, MP_LIST_EDIT_TYPE_SHARE, } MpListEditType_e; -typedef enum -{ - MP_LIST_ITEM_TYPE_NORMAL = 0, - MP_LIST_ITEM_TYPE_SHUFFLE, +typedef enum { + MP_LIST_ITEM_TYPE_NORMAL = 0, + MP_LIST_ITEM_TYPE_SHUFFLE, MP_LIST_ITEM_TYPE_GROUP_TITLE, MP_LIST_ITEM_TYPE_SELECTABLE_GROUP_TITLE, MP_LIST_ITEM_TYPE_ALBUMART_INDEX, MP_LIST_ITEM_TYPE_BOTTOM_COUNTER, } MpListItemType_e; -typedef enum -{ +typedef enum { MP_TRACK_LIST_VIEW_ALL, MP_TRACK_LIST_VIEW_LOCAL, MP_TRACK_LIST_VIEW_CLOUD, MP_TRACK_LIST_VIEW_MAX, -}MpCloudView_e; +} MpCloudView_e; typedef enum { MP_TRACK_LIST_INDEX_NONE, @@ -119,15 +113,15 @@ typedef enum { MpListPersonalPage_t personal_page_type; \ MpListPersonalPageLocation_t personal_page_storage; \ void (*update)(void *thiz);\ - void (*realized_item_update)(void *thiz, const char *part, int field);\ + void (*realized_item_update)(void *thiz, const char *part, int field);\ void (*set_edit)(void *thiz, bool edit);\ void (*set_reorder)(void *thiz, bool reorder);\ void (*rotate)(void *thiz);\ int (*show_fastscroll)(void *thiz);\ int (*hide_fastscroll)(void *thiz);\ void (*edit_mode_sel)(void *list, void *data);\ - mp_group_type_e (*get_group_type)(void *thiz);\ - mp_track_type_e (*get_track_type)(void *thiz);\ + mp_group_type_e(*get_group_type)(void *thiz);\ + mp_track_type_e(*get_track_type)(void *thiz);\ void *(*get_playlist_handle)(void *thiz);\ void (*destory_cb)(void *thiz);\ unsigned int (*get_count)(void *thiz, MpListEditType_e type);\ @@ -139,11 +133,11 @@ typedef enum { void (*mode_right_cb)(void *thiz, Evas_Object * obj, void *event_info);\ void (*mode_cancel_cb)(void *thiz, Evas_Object * obj, void *event_info);\ void (*longpressed_cb)(void *data, Evas_Object *obj, void *event_info);\ - void (*drag_start_cb)(void *data, Evas_Object *obj, void *event_info);\ - void (*drag_stop_cb)(void *data, Evas_Object *obj, void *event_info);\ + void (*drag_start_cb)(void *data, Evas_Object *obj, void *event_info);\ + void (*drag_stop_cb)(void *data, Evas_Object *obj, void *event_info);\ void (*change_display_mode)(void *thiz, MpListDisplayMode_e mode); \ void (*selected_item_data_get)(void *thiz, GList **selected);\ - void (*all_item_data_get)(void *thiz, GList **selected);\ + void (*all_item_data_get)(void *thiz, GList **selected);\ const char *(*get_label)(void *thiz, void *event_info);\ mp_group_type_e group_type; \ char *type_str; \ @@ -155,9 +149,8 @@ typedef enum { MpListFunction_e function_type; \ GList *checked_path_list; \ -typedef struct __MpList{ - INHERIT_MP_LIST -}MpList_t; +typedef struct __MpList { +INHERIT_MP_LIST} MpList_t; #define INHERIT_MP_LIST_ITEM_DATA \ int index; \ @@ -171,15 +164,13 @@ typedef struct __MpList{ int artist_album_page; \ void *plst_item; -typedef struct -{ +typedef struct { // for mh_list_item_data; INHERIT_MP_LIST_ITEM_DATA; } mp_list_item_data_t; -typedef struct -{ +typedef struct { int item_count; mp_list_item_data_t **item_data; } mp_grid_item_data_t; @@ -187,53 +178,61 @@ typedef struct #define MP_LIST_OBJ_SET_AS_GENGRID(obj) (evas_object_data_set(obj, "is_gengrid", (void *)1)) #define MP_LIST_OBJ_IS_GENGRID(obj) ((int)evas_object_data_get(obj, "is_gengrid")) -void mp_list_init(MpList_t *list, Evas_Object *parent, MpListType_e list_type); -Evas_Object *mp_list_get_layout(MpList_t *list); -int mp_list_hide_fast_scroll(MpList_t *list); -int mp_list_show_fast_scroll(MpList_t *list); -void mp_list_update(MpList_t *list); -void mp_list_realized_item_part_update(MpList_t *list, const char *part, int field); -void mp_list_set_edit(MpList_t *list, bool edit); -bool mp_list_get_edit(MpList_t *list); -void mp_list_set_reorder(MpList_t *list, bool reorder); -bool mp_list_get_reorder(MpList_t *list); -void mp_list_set_edit_type(MpList_t *list, MpListEditType_e type); -MpListEditType_e mp_list_get_edit_type(MpList_t *list); -void mp_list_edit_mode_sel(MpList_t *list, void *data); -mp_group_type_e mp_list_get_group_type(MpList_t *list); -mp_track_type_e mp_list_get_track_type(MpList_t *list); -void *mp_list_get_playlist_handle(MpList_t *list); -unsigned int mp_list_get_editable_count(MpList_t *list, MpListEditType_e type); +void mp_list_init(MpList_t * list, Evas_Object * parent, + MpListType_e list_type); +Evas_Object *mp_list_get_layout(MpList_t * list); +int mp_list_hide_fast_scroll(MpList_t * list); +int mp_list_show_fast_scroll(MpList_t * list); +void mp_list_update(MpList_t * list); +void mp_list_realized_item_part_update(MpList_t * list, const char *part, + int field); +void mp_list_set_edit(MpList_t * list, bool edit); +bool mp_list_get_edit(MpList_t * list); +void mp_list_set_reorder(MpList_t * list, bool reorder); +bool mp_list_get_reorder(MpList_t * list); +void mp_list_set_edit_type(MpList_t * list, MpListEditType_e type); +MpListEditType_e mp_list_get_edit_type(MpList_t * list); +void mp_list_edit_mode_sel(MpList_t * list, void *data); +mp_group_type_e mp_list_get_group_type(MpList_t * list); +mp_track_type_e mp_list_get_track_type(MpList_t * list); +void *mp_list_get_playlist_handle(MpList_t * list); +unsigned int mp_list_get_editable_count(MpList_t * list, + MpListEditType_e type); unsigned int _mp_list_get_count(void *thiz, MpListEditType_e type); -unsigned int mp_list_get_checked_count(MpList_t *list); -bool mp_list_is_display_mode_changable(MpList_t *list); -MpListDisplayMode_e mp_list_get_display_mode(MpList_t *list); -void mp_list_change_display_mode(MpList_t *list, MpListDisplayMode_e mode); -void mp_list_selected_item_data_get(MpList_t *list, GList **selected); -void mp_list_all_item_data_get(MpList_t *list, GList **selected); -Elm_Object_Item *mp_list_first_item_get(Evas_Object *obj); -Elm_Object_Item *mp_list_item_next_get(Elm_Object_Item *item); -void mp_list_select_mode_set(Evas_Object *obj, Elm_Object_Select_Mode select_mode); -Elm_Object_Select_Mode mp_list_select_mode_get(Evas_Object *obj); -void mp_list_item_select_mode_set(Elm_Object_Item *item, Elm_Object_Select_Mode select_mode); -Elm_Object_Select_Mode mp_list_item_select_mode_get(Elm_Object_Item *item); -void mp_list_reorder_mode_set(Evas_Object *obj, Eina_Bool reorder_mode); -void mp_list_item_selected_set(Elm_Object_Item *item, Eina_Bool selected); -Eina_Bool mp_list_item_selected_get(Elm_Object_Item *item); -const char * mp_list_get_list_item_label(MpList_t *list, Elm_Object_Item *item); -void mp_list_double_tap(MpList_t *list); -void mp_list_rotate(MpList_t *list); +unsigned int mp_list_get_checked_count(MpList_t * list); +bool mp_list_is_display_mode_changable(MpList_t * list); +MpListDisplayMode_e mp_list_get_display_mode(MpList_t * list); +void mp_list_change_display_mode(MpList_t * list, + MpListDisplayMode_e mode); +void mp_list_selected_item_data_get(MpList_t * list, GList ** selected); +void mp_list_all_item_data_get(MpList_t * list, GList ** selected); +Elm_Object_Item *mp_list_first_item_get(Evas_Object * obj); +Elm_Object_Item *mp_list_item_next_get(Elm_Object_Item * item); +void mp_list_select_mode_set(Evas_Object * obj, + Elm_Object_Select_Mode select_mode); +Elm_Object_Select_Mode mp_list_select_mode_get(Evas_Object * obj); +void mp_list_item_select_mode_set(Elm_Object_Item * item, + Elm_Object_Select_Mode select_mode); +Elm_Object_Select_Mode mp_list_item_select_mode_get(Elm_Object_Item * + item); +void mp_list_reorder_mode_set(Evas_Object * obj, Eina_Bool reorder_mode); +void mp_list_item_selected_set(Elm_Object_Item * item, Eina_Bool selected); +Eina_Bool mp_list_item_selected_get(Elm_Object_Item * item); +const char *mp_list_get_list_item_label(MpList_t * list, + Elm_Object_Item * item); +void mp_list_double_tap(MpList_t * list); +void mp_list_rotate(MpList_t * list); mp_list_item_data_t *mp_list_item_data_create(MpListItemType_e item_type); -void mp_list_item_check_set(Elm_Object_Item *item, Eina_Bool checked); -Elm_Object_Item *mp_list_bottom_counter_item_append(MpList_t *list); +void mp_list_item_check_set(Elm_Object_Item * item, Eina_Bool checked); +Elm_Object_Item *mp_list_bottom_counter_item_append(MpList_t * list); -GList *mp_list_get_checked_path_list(MpList_t *list); -bool mp_list_is_in_checked_path_list(GList *path_list, char *file_path); -void mp_list_free_checked_path_list(GList *path_list); +GList *mp_list_get_checked_path_list(MpList_t * list); +bool mp_list_is_in_checked_path_list(GList * path_list, char *file_path); +void mp_list_free_checked_path_list(GList * path_list); -void mp_list_item_reorder_moved_cb(void *data, Evas_Object *obj, void *event_info); +void mp_list_item_reorder_moved_cb(void *data, Evas_Object * obj, + void *event_info); int _mp_list_set_fastscroll(void *thiz); #endif - diff --git a/src/widget/include/mp-lyric.h b/src/widget/include/mp-lyric.h index ddfa05e..6dede9d 100644 --- a/src/widget/include/mp-lyric.h +++ b/src/widget/include/mp-lyric.h @@ -19,9 +19,8 @@ #include -Evas_Object *mp_lyric_create(Evas_Object *parent, const char *path); -void mp_lyric_sync_update(Evas_Object *lyric); -const char *mp_lyric_get_path(Evas_Object *lyric); +Evas_Object *mp_lyric_create(Evas_Object * parent, const char *path); +void mp_lyric_sync_update(Evas_Object * lyric); +const char *mp_lyric_get_path(Evas_Object * lyric); #endif - diff --git a/src/widget/include/mp-notification.h b/src/widget/include/mp-notification.h index e11b686..1912646 100644 --- a/src/widget/include/mp-notification.h +++ b/src/widget/include/mp-notification.h @@ -27,14 +27,13 @@ extern "C" { #endif //mp_noti_h mp_noti_on_going_create(const char *title, const char *extra_data); -void mp_noti_destroy(mp_noti_h noti); -bool mp_noti_update_size(mp_noti_h noti, unsigned long long total, unsigned long long byte); + void mp_noti_destroy(mp_noti_h noti); + bool mp_noti_update_size(mp_noti_h noti, unsigned long long total, + unsigned long long byte); //mp_noti_h mp_noti_box_create(const char *title, const char *extra_data); //void mp_noti_box_update(mp_noti_h noti, const char *title, const char *info, time_t time); #ifdef __cplusplus } #endif - -#endif /* __MP_NOTIFICATION_H__ */ - +#endif /* __MP_NOTIFICATION_H__ */ diff --git a/src/widget/include/mp-now-playing-list.h b/src/widget/include/mp-now-playing-list.h index a08a891..29f61cb 100644 --- a/src/widget/include/mp-now-playing-list.h +++ b/src/widget/include/mp-now-playing-list.h @@ -24,22 +24,19 @@ enum { }; typedef struct { - INHERIT_MP_LIST - - Elm_Genlist_Item_Class *itc; + INHERIT_MP_LIST Elm_Genlist_Item_Class * itc; bool highlight_current; Ecore_Timer *loading_timer; Evas_Object *loading_progress; - Ecore_Idler *sel_idler; -}MpNowPlayingList_t; + Ecore_Idler *sel_idler; +} MpNowPlayingList_t; -MpNowPlayingList_t * mp_now_playing_list_create(Evas_Object *parent); -void mp_now_playing_list_set_data(MpNowPlayingList_t *list, ...); -void mp_now_playing_list_remove_selected_item(MpNowPlayingList_t *list); -void mp_now_playing_list_refresh(MpNowPlayingList_t *list); -void mp_now_playing_list_current_item_show(MpNowPlayingList_t *list); +MpNowPlayingList_t *mp_now_playing_list_create(Evas_Object * parent); +void mp_now_playing_list_set_data(MpNowPlayingList_t * list, ...); +void mp_now_playing_list_remove_selected_item(MpNowPlayingList_t * list); +void mp_now_playing_list_refresh(MpNowPlayingList_t * list); +void mp_now_playing_list_current_item_show(MpNowPlayingList_t * list); #endif - diff --git a/src/widget/include/mp-now-playing.h b/src/widget/include/mp-now-playing.h index 6b27248..ac29741 100644 --- a/src/widget/include/mp-now-playing.h +++ b/src/widget/include/mp-now-playing.h @@ -20,14 +20,17 @@ #include #include -typedef void (*MpNowplayingCb)(void *data); +typedef void (*MpNowplayingCb) (void *data); -Evas_Object *mp_now_playing_create(Evas_Object *parent, MpNowplayingCb play_bt_clicked, MpNowplayingCb clicked, void *data); -void mp_now_playing_thaw_timer(Evas_Object *now_playing); -void mp_now_playing_freeze_timer(Evas_Object *now_playing); -void mp_now_playing_update(Evas_Object *now_playing, const char *title, const char *artist, const char *thumbnail, bool with_title); -bool mp_now_playing_is_landscape(Evas_Object *now_playing); -void mp_now_playing_set_layout(Evas_Object *now_playing); +Evas_Object *mp_now_playing_create(Evas_Object * parent, + MpNowplayingCb play_bt_clicked, + MpNowplayingCb clicked, void *data); +void mp_now_playing_thaw_timer(Evas_Object * now_playing); +void mp_now_playing_freeze_timer(Evas_Object * now_playing); +void mp_now_playing_update(Evas_Object * now_playing, const char *title, + const char *artist, const char *thumbnail, + bool with_title); +bool mp_now_playing_is_landscape(Evas_Object * now_playing); +void mp_now_playing_set_layout(Evas_Object * now_playing); #endif - diff --git a/src/widget/include/mp-player-volume-widget.h b/src/widget/include/mp-player-volume-widget.h index 19003a0..2b58693 100644 --- a/src/widget/include/mp-player-volume-widget.h +++ b/src/widget/include/mp-player-volume-widget.h @@ -23,22 +23,24 @@ typedef enum { VOLUME_WIDGET_EVENT_DRAG_START, VOLUME_WIDGET_EVENT_DRAG_STOP, - VOLUME_WIDGET_EVENT_DRAG_MAX, + VOLUME_WIDGET_EVENT_DRAG_MAX, } volume_widget_event_e; -typedef void (*Volume_Widget_Cb)(void *user_data, Evas_Object *obj, volume_widget_event_e event); +typedef void (*Volume_Widget_Cb) (void *user_data, Evas_Object * obj, + volume_widget_event_e event); #ifdef __cplusplus extern "C" { #endif -Evas_Object *mp_player_volume_widget_add(Evas_Object *parent); -void mp_player_volume_widget_event_callback_add(Evas_Object *obj, Volume_Widget_Cb event_cb, void *user_data); -int mp_player_volume_widget_set_val(Evas_Object *obj, int val); + Evas_Object *mp_player_volume_widget_add(Evas_Object * parent); + void mp_player_volume_widget_event_callback_add(Evas_Object * obj, + Volume_Widget_Cb + event_cb, + void *user_data); + int mp_player_volume_widget_set_val(Evas_Object * obj, int val); #ifdef __cplusplus } #endif - -#endif /* __MP_PLAYER_VOLUME_WIDGET_H__ */ - +#endif /* __MP_PLAYER_VOLUME_WIDGET_H__ */ diff --git a/src/widget/include/mp-playlist-list.h b/src/widget/include/mp-playlist-list.h index e8ca9c5..5131428 100644 --- a/src/widget/include/mp-playlist-list.h +++ b/src/widget/include/mp-playlist-list.h @@ -20,27 +20,23 @@ #include "mp-list.h" #include "mp-media-info.h" -enum -{ - MP_PLAYLIST_LIST_TYPE, //mp_track_type_e - MP_PLAYLIST_LIST_FUNC, //indicate in all-view or add-track-view +enum { + MP_PLAYLIST_LIST_TYPE, //mp_track_type_e + MP_PLAYLIST_LIST_FUNC, //indicate in all-view or add-track-view MP_PLAYLIST_LIST_PLAYLIT_ID, MP_PLAYLIST_LIST_TYPE_STR, //type_str for db query MP_PLAYLIST_LIST_FILTER_STR, MP_PLAYLIST_LIST_DISPLAY_MODE, }; -enum -{ +enum { MP_PLAYLIST_GROUP_INDEX_DEFAULT, MP_PLAYLIST_GROUP_INDEX_MY_PLAYLIST, MP_PLAYLIST_GROUP_INDEX_NUM, }; -typedef struct __MpPlaylistList{ - INHERIT_MP_LIST - - Elm_Genlist_Item_Class *itc_group_index_default; +typedef struct __MpPlaylistList { + INHERIT_MP_LIST Elm_Genlist_Item_Class * itc_group_index_default; Elm_Genlist_Item_Class *itc_group_index_user; Elm_Genlist_Item_Class *itc_auto; Elm_Genlist_Item_Class *itc_user; @@ -56,14 +52,14 @@ typedef struct __MpPlaylistList{ Elm_Object_Item *group_index[MP_PLAYLIST_GROUP_INDEX_NUM + 1]; //int edit_mode; -}MpPlaylistList_t; +} MpPlaylistList_t; -MpPlaylistList_t * mp_playlist_list_create(Evas_Object *parent); -void mp_playlist_list_set_data(MpPlaylistList_t *list, ...); -void mp_playlist_list_copy_data(MpPlaylistList_t *src, MpPlaylistList_t *dest); -void mp_playlist_list_set_reorder(MpPlaylistList_t *list, bool reorder); -int mp_playlist_list_set_playlist(mp_plst_mgr *plst_mgr, int playlist_id); +MpPlaylistList_t *mp_playlist_list_create(Evas_Object * parent); +void mp_playlist_list_set_data(MpPlaylistList_t * list, ...); +void mp_playlist_list_copy_data(MpPlaylistList_t * src, + MpPlaylistList_t * dest); +void mp_playlist_list_set_reorder(MpPlaylistList_t * list, bool reorder); +int mp_playlist_list_set_playlist(mp_plst_mgr * plst_mgr, int playlist_id); #endif - diff --git a/src/widget/include/mp-popup.h b/src/widget/include/mp-popup.h index a1d5421..47b2983 100644 --- a/src/widget/include/mp-popup.h +++ b/src/widget/include/mp-popup.h @@ -21,8 +21,7 @@ #include #include "music.h" -typedef enum _mp_popup_t -{ +typedef enum _mp_popup_t { MP_POPUP_PV_SET_AS = 0, MP_POPUP_PV_SET_AS_INCLUDE_ADD_TO_HOME, MP_POPUP_PV_SHARE, @@ -47,14 +46,13 @@ typedef enum { MP_POPUP_BTN_MAX, } popup_button_t; -typedef enum -{ +typedef enum { MP_POPUP_NORMAL = 0, MP_POPUP_GENLIST, MP_POPUP_CTX, MP_POPUP_PROGRESS, MP_POPUP_PROGRESS_NO_BUTTON, - MP_POPUP_NOTIFY, // NOT destroyed by mp_popup_destroy() + MP_POPUP_NOTIFY, // NOT destroyed by mp_popup_destroy() MP_POPUP_CONTENT_EXPAND, MP_POPUP_ENTRY, MP_POPUP_PRIVACY, @@ -69,33 +67,42 @@ typedef enum } mp_popup_type; typedef struct { - char *label; /*label for String ID*/ - char *content; /*real content get from db*/ + char *label; /*label for String ID */ + char *content; /*real content get from db */ void *item_data; } Popup_genlist_item; #define mp_popup_desc_set(obj, desc) elm_object_text_set((obj), (desc)) -Elm_Object_Item *mp_genlist_popup_item_append(Evas_Object * popup, char *label, char *content, Evas_Object * icon, void *item_data, void *cb, - void *data); -Evas_Object *mp_genlist_popup_create(Evas_Object * parent, mp_popup_t type, void *user_data, struct appdata *ad); +Elm_Object_Item *mp_genlist_popup_item_append(Evas_Object * popup, + char *label, char *content, + Evas_Object * icon, + void *item_data, void *cb, + void *data); +Evas_Object *mp_genlist_popup_create(Evas_Object * parent, mp_popup_t type, + void *user_data, struct appdata *ad); Evas_Object *mp_entry_popup_create(char *title); -Evas_Object *mp_popup_create(Evas_Object * parent, mp_popup_type type, char *title, void *user_data, Evas_Smart_Cb response_cb, - void *ad); +Evas_Object *mp_popup_create(Evas_Object * parent, mp_popup_type type, + char *title, void *user_data, + Evas_Smart_Cb response_cb, void *ad); void mp_popup_destroy(struct appdata *ad); void mp_longpress_popup_destroy(struct appdata *ad); -void mp_popup_response_callback_set(Evas_Object *popup, Evas_Smart_Cb cb, void *user_data); -void mp_popup_response(Evas_Object *popup, int response); -bool mp_popup_button_set(Evas_Object *popup, popup_button_t btn_index, const char *text, int response); -void mp_popup_timeout_set(Evas_Object *popup, double timeout); -bool mp_popup_max_length(Evas_Object *entry, const char *text); -void mp_popup_back_cb(void *data, Evas_Object *obj, void *event_info); +void mp_popup_response_callback_set(Evas_Object * popup, Evas_Smart_Cb cb, + void *user_data); +void mp_popup_response(Evas_Object * popup, int response); +bool mp_popup_button_set(Evas_Object * popup, popup_button_t btn_index, + const char *text, int response); +void mp_popup_timeout_set(Evas_Object * popup, double timeout); +bool mp_popup_max_length(Evas_Object * entry, const char *text); +void mp_popup_back_cb(void *data, Evas_Object * obj, void *event_info); -Evas_Object *mp_popup_multi_window_center_add(Evas_Object *parent); -Evas_Object *elm_popup_win_get(Evas_Object *popup); -Evas_Object *mp_popup_message_create(Evas_Object * parent, mp_popup_type type, char *title,char *message, void *user_data, Evas_Smart_Cb response_cb, - void *ad); +Evas_Object *mp_popup_multi_window_center_add(Evas_Object * parent); +Evas_Object *elm_popup_win_get(Evas_Object * popup); +Evas_Object *mp_popup_message_create(Evas_Object * parent, + mp_popup_type type, char *title, + char *message, void *user_data, + Evas_Smart_Cb response_cb, void *ad); -#endif // __MP_contextpopup_H_ +#endif // __MP_contextpopup_H_ diff --git a/src/widget/include/mp-search-list.h b/src/widget/include/mp-search-list.h index ee047c3..ad3b077 100644 --- a/src/widget/include/mp-search-list.h +++ b/src/widget/include/mp-search-list.h @@ -20,13 +20,11 @@ #include "mp-list.h" #include "mp-media-info.h" -enum -{ +enum { MP_SEARCH_LIST_FILTER_STR, }; -enum -{ +enum { MP_SEARCH_ARTIST_GROUP, MP_SEARCH_ALBUM_GROUP, MP_SEARCH_TRACK_GROUP, @@ -34,10 +32,8 @@ enum }; -typedef struct __MpSearchList{ - INHERIT_MP_LIST - - Elm_Genlist_Item_Class *itc_track; +typedef struct __MpSearchList { + INHERIT_MP_LIST Elm_Genlist_Item_Class * itc_track; Elm_Genlist_Item_Class *itc_album; Elm_Genlist_Item_Class *itc_artist; Elm_Genlist_Item_Class *itc_group_title; @@ -48,15 +44,14 @@ typedef struct __MpSearchList{ mp_media_list_h track_handle; //for search mp_media_list_h artist_handle; //for search mp_media_list_h album_handle; //for search - void (*refresh)(void *thiz); - GList* artist_list; - GList* album_list; - GList* track_list; -}MpSearchList_t; + void (*refresh) (void *thiz); + GList *artist_list; + GList *album_list; + GList *track_list; +} MpSearchList_t; -MpSearchList_t * mp_search_list_create(Evas_Object *parent); -void mp_search_list_set_data(MpSearchList_t *list, ...); -void mp_search_list_set_reorder(MpSearchList_t *list, bool reorder); +MpSearchList_t *mp_search_list_create(Evas_Object * parent); +void mp_search_list_set_data(MpSearchList_t * list, ...); +void mp_search_list_set_reorder(MpSearchList_t * list, bool reorder); #endif - diff --git a/src/widget/include/mp-search.h b/src/widget/include/mp-search.h index 895617f..134ab53 100644 --- a/src/widget/include/mp-search.h +++ b/src/widget/include/mp-search.h @@ -18,11 +18,19 @@ #define __MP_SEARCH_H_ #include -Evas_Object *mp_search_create_new(Evas_Object * parent, Evas_Smart_Cb change_cb, void *change_cb_data, Evas_Smart_Cb cancel_cb, void *cancel_cb_data, Evas_Smart_Cb focus_cb, void *focus_cb_data, Evas_Smart_Cb unfocus_cb, void *unfocus_cb_data); +Evas_Object *mp_search_create_new(Evas_Object * parent, + Evas_Smart_Cb change_cb, + void *change_cb_data, + Evas_Smart_Cb cancel_cb, + void *cancel_cb_data, + Evas_Smart_Cb focus_cb, + void *focus_cb_data, + Evas_Smart_Cb unfocus_cb, + void *unfocus_cb_data); void mp_search_hide_imf_pannel(Evas_Object * search); void mp_search_show_imf_pannel(Evas_Object * search); -Evas_Object *mp_search_entry_get(Evas_Object *search); -char *mp_search_text_get(Evas_Object *search); -void mp_search_text_set(Evas_Object *search, const char *text); +Evas_Object *mp_search_entry_get(Evas_Object * search); +char *mp_search_text_get(Evas_Object * search); +void mp_search_text_set(Evas_Object * search, const char *text); -#endif //__MP_SEARCH_H_ +#endif //__MP_SEARCH_H_ diff --git a/src/widget/include/mp-smart-event-box.h b/src/widget/include/mp-smart-event-box.h index 3b8d277..01e2bab 100644 --- a/src/widget/include/mp-smart-event-box.h +++ b/src/widget/include/mp-smart-event-box.h @@ -18,14 +18,17 @@ #ifndef __MP_SMART_EVENT_BOX_H_ #define __MP_SMART_EVENT_BOX_H_ -typedef enum{ +typedef enum { MP_EVENT_CLICK, MP_EVENT_LEFT, MP_EVENT_RIGHT, MP_EVENT_MAX, -}MpEventCallback_e; +} MpEventCallback_e; Evas_Object *mp_smart_event_box_add(Evas_Object * parent); -void mp_smart_event_box_callback_add(Evas_Object *event_box, MpEventCallback_e event, void (*event_cb)(void *), void *user_data); +void mp_smart_event_box_callback_add(Evas_Object * event_box, + MpEventCallback_e event, + void (*event_cb) (void *), + void *user_data); -#endif //__MP_SMART_EVENT_BOX_H_ +#endif //__MP_SMART_EVENT_BOX_H_ diff --git a/src/widget/include/mp-track-list.h b/src/widget/include/mp-track-list.h index f263a2b..91117c0 100644 --- a/src/widget/include/mp-track-list.h +++ b/src/widget/include/mp-track-list.h @@ -20,11 +20,10 @@ #include "mp-list.h" #include "mp-media-info.h" -enum -{ - MP_TRACK_LIST_TYPE, //mp_track_type_e +enum { + MP_TRACK_LIST_TYPE, //mp_track_type_e MP_TRACK_LIST_PLAYLIT_ID, - MP_TRACK_LIST_TYPE_STR, //type_str for db query + MP_TRACK_LIST_TYPE_STR, //type_str for db query MP_TRACK_LIST_TYPE_STR2, //type_str for db query MP_TRACK_LIST_FILTER_STR, MP_TRACK_LIST_INDEX_TYPE, // album art list, .... @@ -32,37 +31,34 @@ enum MP_TRACK_LIST_CHECKED_LIST, }; -typedef struct __MpTrackList{ - INHERIT_MP_LIST - - void (*set_edit_default)(void *thiz, bool edit); +typedef struct __MpTrackList { + INHERIT_MP_LIST void (*set_edit_default) (void *thiz, bool edit); Elm_Genlist_Item_Class *itc; - Elm_Genlist_Item_Class *itc_shuffle; + Elm_Genlist_Item_Class *itc_shuffle; mp_media_list_h track_list[2]; Ecore_Timer *load_timer; Elm_Object_Item *albumart_index_item; - Elm_Object_Item *shuffle_it; + Elm_Object_Item *shuffle_it; GList *albumart_index_list; mp_media_list_h playlists; mp_media_info_h playlist_handle; int track_count; - bool get_by_view; + bool get_by_view; -}MpTrackList_t; +} MpTrackList_t; -MpTrackList_t * mp_track_list_create(Evas_Object *parent); -void mp_track_list_set_data(MpTrackList_t *list, ...); -void mp_track_list_set_reorder(MpTrackList_t *list, bool reorder); -void mp_track_list_update_albumart_index(MpTrackList_t *list); +MpTrackList_t *mp_track_list_create(Evas_Object * parent); +void mp_track_list_set_data(MpTrackList_t * list, ...); +void mp_track_list_set_reorder(MpTrackList_t * list, bool reorder); +void mp_track_list_update_albumart_index(MpTrackList_t * list); void mp_track_list_show_shuffle(void *thiz, bool show); -MpCloudView_e mp_track_list_get_cloud_view(MpTrackList_t *list); +MpCloudView_e mp_track_list_get_cloud_view(MpTrackList_t * list); void mp_track_list_update_genlist(void *thiz); void mp_track_list_popup_delete_genlist_item(void *thiz); -void mp_track_list_copy_data(MpTrackList_t *src, MpTrackList_t *dest); +void mp_track_list_copy_data(MpTrackList_t * src, MpTrackList_t * dest); #endif - diff --git a/src/widget/include/mp-volume-widget.h b/src/widget/include/mp-volume-widget.h index 9c9b5ba..0ca3559 100644 --- a/src/widget/include/mp-volume-widget.h +++ b/src/widget/include/mp-volume-widget.h @@ -24,22 +24,22 @@ typedef enum { VOLUME_WIDGET_EVENT_DRAG_STOP, } volume_widget_event_e; -typedef void (*Mp_Volume_Widget_Cb)(void *user_data, Evas_Object *obj, volume_widget_event_e event); +typedef void (*Mp_Volume_Widget_Cb) (void *user_data, Evas_Object * obj, + volume_widget_event_e event); #ifdef __cplusplus extern "C" { #endif -Evas_Object *mp_volume_widget_add(Evas_Object *parent); -void mp_volume_widget_event_callback_add(Evas_Object *obj, Mp_Volume_Widget_Cb event_cb, void *user_data); -void mp_volume_widget_volume_up(Evas_Object *obj); -void mp_volume_widget_volume_down(Evas_Object *obj); + Evas_Object *mp_volume_widget_add(Evas_Object * parent); + void mp_volume_widget_event_callback_add(Evas_Object * obj, + Mp_Volume_Widget_Cb event_cb, + void *user_data); + void mp_volume_widget_volume_up(Evas_Object * obj); + void mp_volume_widget_volume_down(Evas_Object * obj); #ifdef __cplusplus } #endif - - -#endif /* __MP_VOLUME_WIDGET_H__ */ - +#endif /* __MP_VOLUME_WIDGET_H__ */ diff --git a/src/widget/mp-album-detail-list.c b/src/widget/mp-album-detail-list.c index b57f9e5..356e63f 100644 --- a/src/widget/mp-album-detail-list.c +++ b/src/widget/mp-album-detail-list.c @@ -30,7 +30,8 @@ #include -static bool _mp_ablum_detail_list_check_artist_name(mp_media_list_h thiz, int count) +static bool _mp_ablum_detail_list_check_artist_name(mp_media_list_h thiz, + int count) { startfunc; MP_CHECK_FALSE(thiz); @@ -41,7 +42,7 @@ static bool _mp_ablum_detail_list_check_artist_name(mp_media_list_h thiz, int co if (count > 1) { for (i = 0; i < count - 1; i++) { mp_media_info_h item = NULL; - char* artist = NULL; + char *artist = NULL; item = mp_media_info_list_nth_item(svc_handle, i); MP_CHECK_FALSE(item); mp_media_info_get_artist(item, &artist); @@ -49,13 +50,13 @@ static bool _mp_ablum_detail_list_check_artist_name(mp_media_list_h thiz, int co for (j = i + 1; j < count; j++) { mp_media_info_h item_temp = NULL; - char* artist_temp = NULL; + char *artist_temp = NULL; item_temp = mp_media_info_list_nth_item(svc_handle, j); MP_CHECK_FALSE(item_temp); mp_media_info_get_artist(item_temp, &artist_temp); MP_CHECK_FALSE(artist_temp); if (!g_strcmp0(artist, artist_temp)) { - continue ; + continue; } else { return TRUE; } @@ -67,12 +68,12 @@ static bool _mp_ablum_detail_list_check_artist_name(mp_media_list_h thiz, int co return FALSE; } -static char * -_mp_album_detail_list_label_get(void *data, Evas_Object * obj, const char *part) +static char *_mp_album_detail_list_label_get(void *data, Evas_Object * obj, + const char *part) { mp_list_item_data_t *item = (mp_list_item_data_t *) data; MP_CHECK_NULL(item); - mp_media_info_h track = (mp_media_info_h)(item->handle); + mp_media_info_h track = (mp_media_info_h) (item->handle); mp_retvm_if(!track, NULL, "data is null"); MpAlbumDetailList_t *list = evas_object_data_get(obj, "list_data"); @@ -82,13 +83,13 @@ _mp_album_detail_list_label_get(void *data, Evas_Object * obj, const char *part) if (!strcmp(part, "elm.text")) { char *title = NULL; - bool match = mp_common_track_is_current(track, (MpList_t *)list); + bool match = mp_common_track_is_current(track, (MpList_t *) list); if (list->track_type == MP_TRACK_BY_FOLDER) { mp_media_info_get_display_name(track, &title); } else { - mp_media_info_get_title(track, &title); + mp_media_info_get_title(track, &title); } mp_retv_if(!title, NULL); @@ -100,11 +101,12 @@ _mp_album_detail_list_label_get(void *data, Evas_Object * obj, const char *part) int r = 21; int g = 108; int b = 148; - int a = 255 ; + int a = 255; memset(result, 0x00, DEF_STR_LEN + 1); snprintf(result, DEF_STR_LEN, - "%s", r, g, b, a, info); + "%s", r, g, b, a, + info); IF_FREE(info); return g_strdup(result); @@ -118,7 +120,8 @@ _mp_album_detail_list_label_get(void *data, Evas_Object * obj, const char *part) if (!strcmp(part, "elm.text.end")) { int duration; char time[16] = ""; - bool match = mp_common_track_is_current(track, (MpList_t *)list); + bool match = + mp_common_track_is_current(track, (MpList_t *) list); mp_media_info_get_duration(track, &duration); @@ -128,11 +131,12 @@ _mp_album_detail_list_label_get(void *data, Evas_Object * obj, const char *part) int r = 21; int g = 108; int b = 148; - int a = 255 ; + int a = 255; memset(result, 0x00, DEF_STR_LEN + 1); snprintf(result, DEF_STR_LEN, - "%s", r, g, b, a, time); + "%s", r, g, b, a, + time); return g_strdup(result); } @@ -143,8 +147,8 @@ _mp_album_detail_list_label_get(void *data, Evas_Object * obj, const char *part) } -Evas_Object * -_mp_album_detail_list_icon_get(void *data, Evas_Object * obj, const char *part) +Evas_Object *_mp_album_detail_list_icon_get(void *data, Evas_Object * obj, + const char *part) { mp_list_item_data_t *item = (mp_list_item_data_t *) data; MP_CHECK_NULL(item); @@ -167,7 +171,9 @@ _mp_album_detail_list_icon_get(void *data, Evas_Object * obj, const char *part) icon = elm_check_add(obj); elm_object_style_set(icon, "default"); evas_object_propagate_events_set(icon, EINA_FALSE); - evas_object_smart_callback_add(icon, "changed", mp_common_view_check_changed_cb, NULL); + evas_object_smart_callback_add(icon, "changed", + mp_common_view_check_changed_cb, + NULL); elm_check_state_pointer_set(icon, &item->checked); return icon; @@ -186,7 +192,8 @@ _mp_album_detail_list_item_del_cb(void *data, Evas_Object * obj) } static void -_mp_album_detail_genlist_sel_cb(void *data, Evas_Object * obj, void *event_info) +_mp_album_detail_genlist_sel_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; Elm_Object_Item *gli = (Elm_Object_Item *) event_info; @@ -200,12 +207,17 @@ _mp_album_detail_genlist_sel_cb(void *data, Evas_Object * obj, void *event_info) struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); if (_mp_is_current_focus_available(ad) != 0) { - ERROR_TRACE("Some other application has the focus currently... Returning..."); + ERROR_TRACE + ("Some other application has the focus currently... Returning..."); char *message = STR_MP_UNABLE_TO_PLAY_DURING_CALL; if (message) { - int ret = notification_status_message_post(dgettext("music-player", message)); + int ret = + notification_status_message_post(dgettext + ("music-player", + message)); if (ret != 0) { - ERROR_TRACE("notification_status_message_post()... [0x%x]", ret); + ERROR_TRACE("notification_status_message_post()... [0x%x]", + ret); } else { DEBUG_TRACE("message: [%s]", message); } @@ -213,7 +225,8 @@ _mp_album_detail_genlist_sel_cb(void *data, Evas_Object * obj, void *event_info) return; } - mp_list_item_data_t *item = (mp_list_item_data_t *) elm_object_item_data_get(gli); + mp_list_item_data_t *item = + (mp_list_item_data_t *) elm_object_item_data_get(gli); MP_CHECK(item); if (list->edit_mode) { @@ -229,7 +242,9 @@ _mp_album_detail_genlist_sel_cb(void *data, Evas_Object * obj, void *event_info) return; } -static void _mp_album_detail_list_append_item(MpAlbumDetailList_t *list, mp_media_list_h svc_handle, int count) +static void _mp_album_detail_list_append_item(MpAlbumDetailList_t * list, + mp_media_list_h svc_handle, + int count) { int index = 0; @@ -245,7 +260,7 @@ static void _mp_album_detail_list_append_item(MpAlbumDetailList_t *list, mp_medi goto append_album_items; } - if (mp_util_is_in_personal_page((const char *)path)) { + if (mp_util_is_in_personal_page((const char *) path)) { if (list->personal_page_type == MP_LIST_PERSONAL_PAGE_ADD) { continue; } @@ -254,7 +269,7 @@ static void _mp_album_detail_list_append_item(MpAlbumDetailList_t *list, mp_medi continue; } } -append_album_items: + append_album_items: #endif item_data = calloc(1, sizeof(mp_list_item_data_t)); @@ -263,8 +278,10 @@ append_album_items: item_data->index = index; item_data->group_type = MP_GROUP_NONE; - item_data->it = elm_genlist_item_append(list->genlist, list->itc, item_data, NULL, - ELM_GENLIST_ITEM_NONE, _mp_album_detail_genlist_sel_cb, list); + item_data->it = + elm_genlist_item_append(list->genlist, list->itc, item_data, + NULL, ELM_GENLIST_ITEM_NONE, + _mp_album_detail_genlist_sel_cb, list); elm_object_item_data_set(item_data->it, item_data); } @@ -272,8 +289,9 @@ append_album_items: } -static char * -_mp_album_detail_list_album_text_get(void *data, Evas_Object *obj, const char *part) +static char *_mp_album_detail_list_album_text_get(void *data, + Evas_Object * obj, + const char *part) { startfunc; @@ -286,11 +304,14 @@ _mp_album_detail_list_album_text_get(void *data, Evas_Object *obj, const char *p char *text = NULL; char *tmp = NULL; char time[16] = ""; - char make_up[DEF_STR_LEN + 1] = {0, }; + char make_up[DEF_STR_LEN + 1] = { 0, }; mp_util_format_duration(time, list->total_duration); time[15] = '\0'; - tmp = (list->track_count == 1) ? g_strdup(GET_STR(STR_MP_1_SONG)) : g_strdup_printf(GET_STR(STR_MP_PD_SONGS), list->track_count); + tmp = + (list->track_count == + 1) ? g_strdup(GET_STR(STR_MP_1_SONG)) : + g_strdup_printf(GET_STR(STR_MP_PD_SONGS), list->track_count); text = g_strdup_printf("%s / %s", tmp, time); memset(make_up, 0x00, DEF_STR_LEN + 1); @@ -304,8 +325,9 @@ _mp_album_detail_list_album_text_get(void *data, Evas_Object *obj, const char *p } -static char * -_mp_album_detail_list_shuffle_text_get(void *data, Evas_Object *obj, const char *part) +static char *_mp_album_detail_list_shuffle_text_get(void *data, + Evas_Object * obj, + const char *part) { startfunc; int res = -1; @@ -320,15 +342,22 @@ _mp_album_detail_list_shuffle_text_get(void *data, Evas_Object *obj, const char int r = 21; int g = 108; int b = 148; - int a = 255 ; + int a = 255; - res = mp_media_info_list_count(MP_TRACK_BY_ALBUM, list->type_str, NULL, NULL, 0, &count); + res = + mp_media_info_list_count(MP_TRACK_BY_ALBUM, list->type_str, + NULL, NULL, 0, &count); MP_CHECK_NULL(res == 0); - markup = (count == 1) ? g_strdup(GET_STR(STR_MP_SHUFFLE_1_TRACK)) : g_strdup_printf(GET_STR(STR_MP_SHUFFLE_PD_TRACKS), count); + markup = + (count == + 1) ? g_strdup(GET_STR(STR_MP_SHUFFLE_1_TRACK)) : + g_strdup_printf(GET_STR(STR_MP_SHUFFLE_PD_TRACKS), count); memset(result, 0x00, DEF_STR_LEN + 1); - snprintf(result, DEF_STR_LEN, "%s", r, g, b, a, markup); + snprintf(result, DEF_STR_LEN, + "%s", r, g, b, a, + markup); IF_FREE(markup); return g_strdup(result); @@ -337,8 +366,9 @@ _mp_album_detail_list_shuffle_text_get(void *data, Evas_Object *obj, const char } -Evas_Object * -_mp_album_detail_list_album_icon_get(void *data, Evas_Object * obj, const char *part) +Evas_Object *_mp_album_detail_list_album_icon_get(void *data, + Evas_Object * obj, + const char *part) { if (!strcmp(part, "elm.swallow.icon")) { MpAlbumDetailList_t *list = evas_object_data_get(obj, "list_data"); @@ -348,9 +378,13 @@ _mp_album_detail_list_album_icon_get(void *data, Evas_Object * obj, const char * Evas_Object *content = NULL; content = elm_layout_add(obj); - icon = mp_util_create_thumb_icon(obj, list->thumbnail, MP_LIST_ALBUM_ICON_SIZE, MP_LIST_ALBUM_ICON_SIZE); + icon = + mp_util_create_thumb_icon(obj, list->thumbnail, + MP_LIST_ALBUM_ICON_SIZE, + MP_LIST_ALBUM_ICON_SIZE); - elm_layout_theme_set(content, "layout", "list/B/music.type.1", "default"); + elm_layout_theme_set(content, "layout", "list/B/music.type.1", + "default"); elm_layout_content_set(content, "elm.swallow.content", icon); return content; @@ -358,25 +392,30 @@ _mp_album_detail_list_album_icon_get(void *data, Evas_Object * obj, const char * return NULL; } -Evas_Object * -_mp_album_detail_list_shuffle_icon_get(void *data, Evas_Object * obj, const char *part) +Evas_Object *_mp_album_detail_list_shuffle_icon_get(void *data, + Evas_Object * obj, + const char *part) { if (!strcmp(part, "elm.swallow.icon")) { Evas_Object *content = NULL; content = elm_layout_add(obj); Evas_Object *icon; - char edje_path[1024] ={0}; - char * path = app_get_resource_path(); + char edje_path[1024] = { 0 }; + char *path = app_get_resource_path(); MP_CHECK_NULL(path); snprintf(edje_path, 1024, "%s%s/%s", path, "edje", IMAGE_EDJ_NAME); - icon = mp_util_create_image(obj, edje_path, MP_LITE_SHUFFLE_ICON, MP_LIST_SHUFFLE_ICON_SIZE, MP_LIST_SHUFFLE_ICON_SIZE); + icon = + mp_util_create_image(obj, edje_path, MP_LITE_SHUFFLE_ICON, + MP_LIST_SHUFFLE_ICON_SIZE, + MP_LIST_SHUFFLE_ICON_SIZE); evas_object_color_set(icon, 21, 108, 148, 255); free(path); - elm_layout_theme_set(content, "layout", "list/B/music.type.3", "default"); + elm_layout_theme_set(content, "layout", "list/B/music.type.3", + "default"); elm_layout_content_set(content, "elm.swallow.content", icon); return content; @@ -387,7 +426,8 @@ _mp_album_detail_list_shuffle_icon_get(void *data, Evas_Object * obj, const char static void -_mp_album_detail_list_shuffle_cb(void *data, Evas_Object * obj, void *event_info) +_mp_album_detail_list_shuffle_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; Elm_Object_Item *gli = (Elm_Object_Item *) event_info; @@ -398,7 +438,8 @@ _mp_album_detail_list_shuffle_cb(void *data, Evas_Object * obj, void *event_info MpList_t *list = data; MP_CHECK(list); - mp_list_item_data_t *item = (mp_list_item_data_t *) elm_object_item_data_get(gli); + mp_list_item_data_t *item = + (mp_list_item_data_t *) elm_object_item_data_get(gli); MP_CHECK(item); mp_play_control_shuffle_set(NULL, true); mp_common_play_track_list_with_playlist_id(item, obj, 0); @@ -413,7 +454,10 @@ _mp_album_detail_list_shuffle_item_del_cb(void *data, Evas_Object * obj) SAFE_FREE(item_data); } -static int _mp_album_detail_list_get_total_duration(MpAlbumDetailList_t *list, mp_media_list_h svc_handle, int count) +static int _mp_album_detail_list_get_total_duration(MpAlbumDetailList_t * + list, + mp_media_list_h + svc_handle, int count) { int total_duration = 0; int duration = 0; @@ -428,7 +472,7 @@ static int _mp_album_detail_list_get_total_duration(MpAlbumDetailList_t *list, m goto calc_total_duration; } - if (mp_util_is_in_personal_page((const char *)path)) { + if (mp_util_is_in_personal_page((const char *) path)) { if (list->personal_page_type == MP_LIST_PERSONAL_PAGE_ADD) { continue; } @@ -437,7 +481,7 @@ static int _mp_album_detail_list_get_total_duration(MpAlbumDetailList_t *list, m continue; } } -calc_total_duration: + calc_total_duration: #endif mp_media_info_get_duration(item, &duration); duration /= 1000; @@ -448,7 +492,8 @@ calc_total_duration: return total_duration; } -static void _mp_album_detail_list_append_album_item(MpAlbumDetailList_t *list) +static void _mp_album_detail_list_append_album_item(MpAlbumDetailList_t * + list) { startfunc; MP_CHECK(list); @@ -456,10 +501,11 @@ static void _mp_album_detail_list_append_album_item(MpAlbumDetailList_t *list) list->itc_album = elm_genlist_item_class_new(); MP_CHECK(list->itc_album); - list->itc_album->item_style = "type1";//"music/1text.2icon.3";//"music/3text.1icon.2" + list->itc_album->item_style = "type1"; //"music/1text.2icon.3";//"music/3text.1icon.2" list->itc_album->func.text_get = _mp_album_detail_list_album_text_get; list->itc_album->decorate_all_item_style = NULL; - list->itc_album->func.content_get = _mp_album_detail_list_album_icon_get; + list->itc_album->func.content_get = + _mp_album_detail_list_album_icon_get; list->itc_album->func.del = _mp_album_detail_list_shuffle_item_del_cb; mp_list_item_data_t *item_data; @@ -467,11 +513,14 @@ static void _mp_album_detail_list_append_album_item(MpAlbumDetailList_t *list) MP_CHECK(item_data); item_data->item_type = MP_LIST_ITEM_TYPE_SELECTABLE_GROUP_TITLE; - item_data->it = list_item = elm_genlist_item_append(list->genlist, list->itc_album, item_data, NULL, - ELM_GENLIST_ITEM_NONE, _mp_album_detail_list_shuffle_cb, list); + item_data->it = list_item = + elm_genlist_item_append(list->genlist, list->itc_album, item_data, + NULL, ELM_GENLIST_ITEM_NONE, + _mp_album_detail_list_shuffle_cb, list); if (!list->edit_mode) { - elm_genlist_item_select_mode_set(list_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + elm_genlist_item_select_mode_set(list_item, + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); } endfunc; } @@ -483,7 +532,8 @@ void mp_album_detail_list_show_shuffle(void *thiz, bool show) MpAlbumDetailList_t *list = thiz; MP_CHECK(list->genlist); - DEBUG_TRACE("show shuffle: %d list->shuffle_it: %0x", show, list->shuffle_it); + DEBUG_TRACE("show shuffle: %d list->shuffle_it: %0x", show, + list->shuffle_it); if (show) { _mp_album_detail_list_append_album_item(list); @@ -491,17 +541,23 @@ void mp_album_detail_list_show_shuffle(void *thiz, bool show) MP_CHECK(list->itc_shuffle); //list->itc_shuffle->item_style = "music/1line"; list->itc_shuffle->item_style = "default"; - list->itc_shuffle->func.text_get = _mp_album_detail_list_shuffle_text_get; + list->itc_shuffle->func.text_get = + _mp_album_detail_list_shuffle_text_get; list->itc_shuffle->decorate_all_item_style = NULL; - list->itc_shuffle->func.content_get = _mp_album_detail_list_shuffle_icon_get; - list->itc_shuffle->func.del = _mp_album_detail_list_shuffle_item_del_cb; + list->itc_shuffle->func.content_get = + _mp_album_detail_list_shuffle_icon_get; + list->itc_shuffle->func.del = + _mp_album_detail_list_shuffle_item_del_cb; mp_list_item_data_t *item_data; item_data = mp_list_item_data_create(MP_LIST_ITEM_TYPE_SHUFFLE); MP_CHECK(item_data); - item_data->it = list->shuffle_it = elm_genlist_item_append(list->genlist, list->itc_shuffle, item_data, NULL, - ELM_GENLIST_ITEM_NONE, _mp_album_detail_list_shuffle_cb, list); + item_data->it = list->shuffle_it = + elm_genlist_item_append(list->genlist, list->itc_shuffle, + item_data, NULL, ELM_GENLIST_ITEM_NONE, + _mp_album_detail_list_shuffle_cb, + list); elm_object_item_data_set(item_data->it, item_data); } else if (list->shuffle_it) { elm_object_item_del(list->shuffle_it); @@ -543,10 +599,10 @@ static void _mp_album_detail_list_load_list(void *thiz, int count) MpAlbumDetailList_t *list = thiz; MP_CHECK(list); - /*media-svc related*/ + /*media-svc related */ mp_media_list_h svc_handle = NULL; - /*clear genlist*/ + /*clear genlist */ Elm_Object_Item *item = elm_genlist_first_item_get(list->genlist); if (item) { elm_genlist_item_bring_in(item, ELM_GENLIST_ITEM_SCROLLTO_IN); @@ -555,16 +611,22 @@ static void _mp_album_detail_list_load_list(void *thiz, int count) mp_ecore_timer_del(list->load_timer); - /*get data from DB*/ + /*get data from DB */ PROFILE_IN("mp_media_info_list_create"); - mp_media_info_list_create(&svc_handle, list->track_type, list->type_str, list->type_str2, list->filter_str, list->playlist_id, 0, count); + mp_media_info_list_create(&svc_handle, list->track_type, + list->type_str, list->type_str2, + list->filter_str, list->playlist_id, 0, + count); PROFILE_OUT("mp_media_info_list_create"); mp_album_detail_list_show_shuffle(list, true); - list->total_duration = _mp_album_detail_list_get_total_duration(list, svc_handle, list->track_count); + list->total_duration = + _mp_album_detail_list_get_total_duration(list, svc_handle, + list->track_count); - list->various_name = _mp_ablum_detail_list_check_artist_name(svc_handle, count); + list->various_name = + _mp_ablum_detail_list_check_artist_name(svc_handle, count); PROFILE_IN("_mp_album_detail_list_append_item"); _mp_album_detail_list_append_item(list, svc_handle, count); @@ -576,6 +638,7 @@ static void _mp_album_detail_list_load_list(void *thiz, int count) list->track_list[0] = svc_handle; } + static void _mp_album_detail_list_destory_cb(void *thiz) { eventfunc; @@ -614,7 +677,9 @@ static void _mp_album_detail_list_destory_cb(void *thiz) free(list); } -static void _mp_album_detail_list_item_highlighted(void *data, Evas_Object *obj, void *event_info) +static void _mp_album_detail_list_item_highlighted(void *data, + Evas_Object * obj, + void *event_info) { MpAlbumDetailList_t *list = data; MP_CHECK(list); @@ -623,14 +688,18 @@ static void _mp_album_detail_list_item_highlighted(void *data, Evas_Object *obj, MP_CHECK(it); if (list->shuffle_it == it) { - Evas_Object *icon = elm_object_item_part_content_get(it, "elm.icon.2"); + Evas_Object *icon = + elm_object_item_part_content_get(it, "elm.icon.2"); if (icon) { - elm_image_file_set(icon, IMAGE_EDJ_NAME, MP_ICON_SHUFFLE_PRESS); + elm_image_file_set(icon, IMAGE_EDJ_NAME, + MP_ICON_SHUFFLE_PRESS); } } } -static void _mp_album_detail_list_item_unhighlighted(void *data, Evas_Object *obj, void *event_info) +static void _mp_album_detail_list_item_unhighlighted(void *data, + Evas_Object * obj, + void *event_info) { MpAlbumDetailList_t *list = data; MP_CHECK(list); @@ -639,7 +708,8 @@ static void _mp_album_detail_list_item_unhighlighted(void *data, Evas_Object *ob MP_CHECK(it); if (list->shuffle_it == it) { - Evas_Object *icon = elm_object_item_part_content_get(it, "elm.icon.2"); + Evas_Object *icon = + elm_object_item_part_content_get(it, "elm.icon.2"); if (icon) { elm_image_file_set(icon, IMAGE_EDJ_NAME, MP_ICON_SHUFFLE); } @@ -654,7 +724,10 @@ static void _mp_album_detail_list_update(void *thiz) MP_CHECK(list); PROFILE_IN("mp_media_info_list_count"); - res = mp_media_info_list_count(list->track_type, list->type_str, list->type_str2, list->filter_str, list->playlist_id, &count); + res = + mp_media_info_list_count(list->track_type, list->type_str, + list->type_str2, list->filter_str, + list->playlist_id, &count); PROFILE_OUT("mp_media_info_list_count"); MP_CHECK(res == 0); list->track_count = count; @@ -663,16 +736,19 @@ static void _mp_album_detail_list_update(void *thiz) mp_evas_object_del(list->genlist); if (count) { - /*create new genlist*/ + /*create new genlist */ PROFILE_IN("elm_genlist_add"); list->genlist = mp_widget_genlist_create(list->box); - elm_scroller_policy_set(list->genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); - evas_object_size_hint_weight_set(list->genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(list->genlist, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_scroller_policy_set(list->genlist, ELM_SCROLLER_POLICY_OFF, + ELM_SCROLLER_POLICY_AUTO); + evas_object_size_hint_weight_set(list->genlist, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(list->genlist, EVAS_HINT_FILL, + EVAS_HINT_FILL); elm_genlist_homogeneous_set(list->genlist, EINA_TRUE); elm_genlist_mode_set(list->genlist, ELM_LIST_COMPRESS); evas_object_show(list->genlist); - /*packet genlist to box*/ + /*packet genlist to box */ elm_box_pack_end(list->box, list->genlist); evas_object_data_set(list->genlist, "list_data", list); @@ -681,15 +757,22 @@ static void _mp_album_detail_list_update(void *thiz) if (list->itc) { list->itc->item_style = "type1"; list->itc->func.text_get = _mp_album_detail_list_label_get; - list->itc->func.content_get = _mp_album_detail_list_icon_get; + list->itc->func.content_get = + _mp_album_detail_list_icon_get; list->itc->func.del = _mp_album_detail_list_item_del_cb; } } - evas_object_smart_callback_add(list->genlist, "scroll,drag,start", list->drag_start_cb, list); - evas_object_smart_callback_add(list->genlist, "scroll,drag,stop", list->drag_stop_cb, list); - evas_object_smart_callback_add(list->genlist, "highlighted", _mp_album_detail_list_item_highlighted, list); - evas_object_smart_callback_add(list->genlist, "unhighlighted", _mp_album_detail_list_item_unhighlighted, list); + evas_object_smart_callback_add(list->genlist, "scroll,drag,start", + list->drag_start_cb, list); + evas_object_smart_callback_add(list->genlist, "scroll,drag,stop", + list->drag_stop_cb, list); + evas_object_smart_callback_add(list->genlist, "highlighted", + _mp_album_detail_list_item_highlighted, + list); + evas_object_smart_callback_add(list->genlist, "unhighlighted", + _mp_album_detail_list_item_unhighlighted, + list); PROFILE_OUT("elm_genlist_add"); /* load list */ @@ -704,10 +787,12 @@ static void _mp_album_detail_list_update(void *thiz) return; } -NoContents: + NoContents: mp_evas_object_del(list->genlist); if (!list->no_content) { - list->no_content = mp_widget_create_no_contents(list->box, MP_NOCONTENT_TRACKS, NULL, list); + list->no_content = + mp_widget_create_no_contents(list->box, MP_NOCONTENT_TRACKS, + NULL, list); elm_box_pack_end(list->box, list->no_content); } } @@ -725,7 +810,7 @@ static const char *_get_label(void *thiz, void *event_info) MP_CHECK_NULL(list); char *title = NULL; - mp_list_item_data_t *track = elm_object_item_data_get(event_info); + mp_list_item_data_t *track = elm_object_item_data_get(event_info); MP_CHECK_NULL(track); mp_media_info_get_title(track->handle, &title); @@ -741,7 +826,8 @@ static void _mp_album_detail_list_set_edit(void *thiz, bool edit) mp_album_detail_list_show_shuffle(list, false); /* check DRM FL */ - if (mp_list_get_edit_type((MpList_t*)list) == MP_LIST_EDIT_TYPE_SHARE) { + if (mp_list_get_edit_type((MpList_t *) list) == + MP_LIST_EDIT_TYPE_SHARE) { _mp_album_detail_list_update(list); } @@ -759,9 +845,11 @@ _mp_album_detail_list_get_editable_count(void *thiz, MpListEditType_e type) int count = elm_genlist_items_count(list->genlist); if (type == MP_LIST_EDIT_TYPE_SHARE) { - Elm_Object_Item *gl_item = elm_genlist_first_item_get(list->genlist); + Elm_Object_Item *gl_item = + elm_genlist_first_item_get(list->genlist); while (gl_item) { - mp_list_item_data_t *item_data = elm_object_item_data_get(gl_item); + mp_list_item_data_t *item_data = + elm_object_item_data_get(gl_item); if (item_data && item_data->handle) { char *path = NULL; mp_media_info_get_file_path(item_data->handle, &path); @@ -782,13 +870,15 @@ _mp_album_detail_list_get_editable_count(void *thiz, MpListEditType_e type) return count - 1; } -static char * -_mp_album_detail_list_bottom_counter_text_cb(void *thiz) +static char *_mp_album_detail_list_bottom_counter_text_cb(void *thiz) { MpAlbumDetailList_t *list = thiz; MP_CHECK_NULL(list); - unsigned int count = mp_list_get_editable_count((MpList_t *)list, mp_list_get_edit_type((MpList_t *)list)); + unsigned int count = + mp_list_get_editable_count((MpList_t *) list, + mp_list_get_edit_type((MpList_t *) + list)); char *text = NULL; if (count == 1) { @@ -807,7 +897,7 @@ static mp_group_type_e _mp_album_detail_list_get_group_type(void *thiz) return MP_GROUP_NONE; } -MpAlbumDetailList_t * mp_album_detail_list_create(Evas_Object *parent) +MpAlbumDetailList_t *mp_album_detail_list_create(Evas_Object * parent) { eventfunc; MP_CHECK_NULL(parent); @@ -815,7 +905,7 @@ MpAlbumDetailList_t * mp_album_detail_list_create(Evas_Object *parent) MpAlbumDetailList_t *list = calloc(1, sizeof(MpAlbumDetailList_t)); MP_CHECK_NULL(list); - mp_list_init((MpList_t *)list, parent, MP_LIST_TYPE_ALBUM_DETAIL); + mp_list_init((MpList_t *) list, parent, MP_LIST_TYPE_ALBUM_DETAIL); list->update = _mp_album_detail_list_update; list->destory_cb = _mp_album_detail_list_destory_cb; @@ -827,12 +917,13 @@ MpAlbumDetailList_t * mp_album_detail_list_create(Evas_Object *parent) list->set_edit_default = list->set_edit; list->set_edit = _mp_album_detail_list_set_edit; list->get_count = _mp_album_detail_list_get_editable_count; - list->bottom_counter_text_get_cb = _mp_album_detail_list_bottom_counter_text_cb; + list->bottom_counter_text_get_cb = + _mp_album_detail_list_bottom_counter_text_cb; return list; } -void mp_album_detail_list_set_data(MpAlbumDetailList_t *list, ...) +void mp_album_detail_list_set_data(MpAlbumDetailList_t * list, ...) { startfunc; MP_CHECK(list); @@ -846,40 +937,40 @@ void mp_album_detail_list_set_data(MpAlbumDetailList_t *list, ...) DEBUG_TRACE("field is %d", field); switch (field) { - case MP_ALBUM_DETAIL_LIST_TYPE: { - int val = va_arg((var_args), int); + case MP_ALBUM_DETAIL_LIST_TYPE:{ + int val = va_arg((var_args), int); - list->track_type = val; - DEBUG_TRACE("list->track_type = %d", list->track_type); - break; - } + list->track_type = val; + DEBUG_TRACE("list->track_type = %d", list->track_type); + break; + } - case MP_ALBUM_DETAIL_TYPE_STR: { - char *val = va_arg((var_args), char *); - SAFE_FREE(list->type_str); - list->type_str = g_strdup(val); - DEBUG_TRACE("list->type_str = %s", list->type_str); + case MP_ALBUM_DETAIL_TYPE_STR:{ + char *val = va_arg((var_args), char *); + SAFE_FREE(list->type_str); + list->type_str = g_strdup(val); + DEBUG_TRACE("list->type_str = %s", list->type_str); - break; - } + break; + } - case MP_ALBUM_DETAIL_ARTIST: { - char *val = va_arg((var_args), char *); - SAFE_FREE(list->artist); - list->artist = g_strdup(val); - DEBUG_TRACE("list->artist = %s", list->artist); + case MP_ALBUM_DETAIL_ARTIST:{ + char *val = va_arg((var_args), char *); + SAFE_FREE(list->artist); + list->artist = g_strdup(val); + DEBUG_TRACE("list->artist = %s", list->artist); - break; - } + break; + } - case MP_ALBUM_DETAIL_THUMBNAIL: { - char *val = va_arg((var_args), char *); - SAFE_FREE(list->thumbnail); - list->thumbnail = g_strdup(val); - DEBUG_TRACE("list->thumbnail = %s", list->thumbnail); + case MP_ALBUM_DETAIL_THUMBNAIL:{ + char *val = va_arg((var_args), char *); + SAFE_FREE(list->thumbnail); + list->thumbnail = g_strdup(val); + DEBUG_TRACE("list->thumbnail = %s", list->thumbnail); - break; - } + break; + } default: DEBUG_TRACE("Invalid arguments"); } @@ -889,7 +980,8 @@ void mp_album_detail_list_set_data(MpAlbumDetailList_t *list, ...) va_end(var_args); } -void mp_album_detail_list_copy_data(MpAlbumDetailList_t *src, MpAlbumDetailList_t *dest) +void mp_album_detail_list_copy_data(MpAlbumDetailList_t * src, + MpAlbumDetailList_t * dest) { MP_CHECK(src); MP_CHECK(dest); @@ -903,4 +995,3 @@ void mp_album_detail_list_copy_data(MpAlbumDetailList_t *src, MpAlbumDetailList_ SAFE_FREE(dest->thumbnail); dest->thumbnail = g_strdup(src->thumbnail); } - diff --git a/src/widget/mp-album-list.c b/src/widget/mp-album-list.c index 2324be3..8dcc269 100644 --- a/src/widget/mp-album-list.c +++ b/src/widget/mp-album-list.c @@ -37,8 +37,9 @@ static void _mp_album_select_cb(void *data, Evas_Object * obj, void *event_info); -static char * -_mp_album_list_group_index_text_get(void *data, Evas_Object * obj, const char *part) +static char *_mp_album_list_group_index_text_get(void *data, + Evas_Object * obj, + const char *part) { mp_list_item_data_t *item_data = data; MP_CHECK_NULL(item_data); @@ -48,7 +49,10 @@ _mp_album_list_group_index_text_get(void *data, Evas_Object * obj, const char *p MpAlbumList_t *list = evas_object_data_get(obj, "list_data"); MP_CHECK_NULL(list); - unsigned int count = mp_list_get_editable_count((MpList_t *)list, mp_list_get_edit_type((MpList_t *)list)); + unsigned int count = + mp_list_get_editable_count((MpList_t *) list, + mp_list_get_edit_type((MpList_t *) + list)); if (count == 1) { text = g_strdup(GET_STR(STR_MP_1_ALBUM)); @@ -60,8 +64,8 @@ _mp_album_list_group_index_text_get(void *data, Evas_Object * obj, const char *p return text; } -static char * -_mp_album_list_label_get(void *data, Evas_Object * obj, const char *part) +static char *_mp_album_list_label_get(void *data, Evas_Object * obj, + const char *part) { char *name = NULL; int ret = 0; @@ -96,8 +100,8 @@ _mp_album_list_label_get(void *data, Evas_Object * obj, const char *part) -Evas_Object * -_mp_album_list_icon_get(void *data, Evas_Object * obj, const char *part) +Evas_Object *_mp_album_list_icon_get(void *data, Evas_Object * obj, + const char *part) { Evas_Object *icon = NULL; @@ -127,9 +131,11 @@ _mp_album_list_icon_get(void *data, Evas_Object * obj, const char *part) w = ALBUM_ICON_SIZE; } h = w; - icon = mp_util_create_lazy_update_thumb_icon(obj, thumb_name, w, h); + icon = + mp_util_create_lazy_update_thumb_icon(obj, thumb_name, w, h); - elm_layout_theme_set(content, "layout", "list/B/music.type.1", "default"); + elm_layout_theme_set(content, "layout", "list/B/music.type.1", + "default"); evas_object_resize(content, w, h); elm_layout_content_set(content, "elm.swallow.content", icon); return content; @@ -148,7 +154,9 @@ _mp_album_list_icon_get(void *data, Evas_Object * obj, const char *part) check = elm_check_add(obj); elm_object_style_set(check, "default"); evas_object_propagate_events_set(check, EINA_FALSE); - evas_object_smart_callback_add(check, "changed", mp_common_view_check_changed_cb, NULL); + evas_object_smart_callback_add(check, "changed", + mp_common_view_check_changed_cb, + NULL); elm_check_state_pointer_set(check, &item->checked); return check; } @@ -157,8 +165,7 @@ _mp_album_list_icon_get(void *data, Evas_Object * obj, const char *part) return NULL; } -static void -_mp_album_list_item_del_cb(void *data, Evas_Object *obj) +static void _mp_album_list_item_del_cb(void *data, Evas_Object * obj) { mp_list_item_data_t *item_data = data; MP_CHECK(item_data); @@ -170,9 +177,9 @@ static void _mp_album_select_cb(void *data, Evas_Object * obj, void *event_info) { eventfunc; - MpAlbumList_t *list = (MpAlbumList_t *)data; + MpAlbumList_t *list = (MpAlbumList_t *) data; int ret = 0; - int index = 0;//(int)data; + int index = 0; //(int)data; char *name = NULL; char *artist = NULL; char *title = NULL; @@ -200,7 +207,8 @@ _mp_album_select_cb(void *data, Evas_Object * obj, void *event_info) DEBUG_TRACE(""); ret = mp_media_info_group_get_sub_info(gli_data->handle, &artist); DEBUG_TRACE(""); - mp_media_info_group_get_thumbnail_path(gli_data->handle, &thumbnail); + mp_media_info_group_get_thumbnail_path(gli_data->handle, + &thumbnail); DEBUG_TRACE("thumbnail=%s", thumbnail); mp_retm_if(ret != 0, "Fail to get value"); mp_retm_if(name == NULL, "Fail to get value"); @@ -212,24 +220,33 @@ _mp_album_select_cb(void *data, Evas_Object * obj, void *event_info) if (list->function_type == MP_LIST_FUNC_ADD_TRACK) { MpViewMgr_t *view_manager = mp_view_mgr_get_view_manager(); MP_CHECK(view_manager); - MpSelectTrackView_t *view_select_track = mp_select_track_view_create(view_manager->navi); + MpSelectTrackView_t *view_select_track = + mp_select_track_view_create(view_manager->navi); MP_CHECK(view_select_track); - mp_view_mgr_push_view(view_manager, (MpView_t *)view_select_track, NULL); - - mp_view_set_title((MpView_t *)view_select_track, STR_MP_TILTE_SELECT_ITEM); - mp_track_list_set_data((MpTrackList_t *)view_select_track->content_to_show, MP_TRACK_LIST_TYPE, MP_TRACK_BY_ALBUM, MP_TRACK_LIST_TYPE_STR, name, -1); + mp_view_mgr_push_view(view_manager, (MpView_t *) view_select_track, + NULL); + + mp_view_set_title((MpView_t *) view_select_track, + STR_MP_TILTE_SELECT_ITEM); + mp_track_list_set_data((MpTrackList_t *) view_select_track-> + content_to_show, MP_TRACK_LIST_TYPE, + MP_TRACK_BY_ALBUM, MP_TRACK_LIST_TYPE_STR, + name, -1); mp_list_update(view_select_track->content_to_show); - mp_view_update_options((MpView_t *)view_select_track); + mp_view_update_options((MpView_t *) view_select_track); mp_list_set_edit(view_select_track->content_to_show, TRUE); - mp_list_view_set_cancel_btn((MpListView_t*)view_select_track, true); - mp_list_view_set_done_btn((MpListView_t*)view_select_track, true, MP_DONE_SELECT_ADD_TRACK_TYPE); - mp_list_view_set_select_all((MpListView_t *)view_select_track, TRUE); + mp_list_view_set_cancel_btn((MpListView_t *) view_select_track, + true); + mp_list_view_set_done_btn((MpListView_t *) view_select_track, true, + MP_DONE_SELECT_ADD_TRACK_TYPE); + mp_list_view_set_select_all((MpListView_t *) view_select_track, + TRUE); return; } if (list->edit_mode) { //mp_edit_view_genlist_sel_cb(data, obj, event_info); - mp_list_edit_mode_sel((MpList_t *)list, gli_data); + mp_list_edit_mode_sel((MpList_t *) list, gli_data); MpViewMgr_t *view_mgr = mp_view_mgr_get_view_manager(); MpView_t *view = mp_view_mgr_get_top_view(view_mgr); mp_view_update_options_edit(view); @@ -240,11 +257,14 @@ _mp_album_select_cb(void *data, Evas_Object * obj, void *event_info) /* create the view of album detail */ MpViewMgr_t *view_manager = mp_view_mgr_get_view_manager(); MP_CHECK(view_manager); - MpAlbumDetailView_t *view_album_detail = mp_album_detail_view_create(view_manager->navi, name, artist, thumbnail); - mp_view_mgr_push_view(view_manager, (MpView_t *)view_album_detail, NULL); + MpAlbumDetailView_t *view_album_detail = + mp_album_detail_view_create(view_manager->navi, name, artist, + thumbnail); + mp_view_mgr_push_view(view_manager, (MpView_t *) view_album_detail, + NULL); - mp_view_update_options((MpView_t *)view_album_detail); - mp_view_set_title((MpView_t *)view_album_detail, title); + mp_view_update_options((MpView_t *) view_album_detail); + mp_view_set_title((MpView_t *) view_album_detail, title); //mp_util_reset_genlist_mode_item(layout_data->genlist); @@ -252,10 +272,9 @@ _mp_album_select_cb(void *data, Evas_Object * obj, void *event_info) } -static void -_mp_album_list_append_group_index_item(void *thiz) +static void _mp_album_list_append_group_index_item(void *thiz) { - MpAlbumList_t *list = (MpAlbumList_t *)thiz; + MpAlbumList_t *list = (MpAlbumList_t *) thiz; MP_CHECK(list); MP_CHECK(list->genlist); @@ -268,17 +287,23 @@ _mp_album_list_append_group_index_item(void *thiz) } list->itc_group_index->item_style = "music/groupindex.sub"; - list->itc_group_index->func.text_get = _mp_album_list_group_index_text_get; + list->itc_group_index->func.text_get = + _mp_album_list_group_index_text_get; list->itc_group_index->func.del = _mp_album_list_item_del_cb; } - mp_list_item_data_t *item_data = mp_list_item_data_create(MP_LIST_ITEM_TYPE_GROUP_TITLE); + mp_list_item_data_t *item_data = + mp_list_item_data_create(MP_LIST_ITEM_TYPE_GROUP_TITLE); if (item_data == NULL) { ERROR_TRACE("list item data is not found"); return; } - item_data->it = list->group_it = elm_genlist_item_append(list->genlist, list->itc_group_index, item_data, NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL); - elm_genlist_item_select_mode_set(list->group_it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + item_data->it = list->group_it = + elm_genlist_item_append(list->genlist, list->itc_group_index, + item_data, NULL, ELM_GENLIST_ITEM_GROUP, + NULL, NULL); + elm_genlist_item_select_mode_set(list->group_it, + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); } void mp_album_list_show_group_index(void *thiz, bool show) @@ -288,7 +313,8 @@ void mp_album_list_show_group_index(void *thiz, bool show) MpAlbumList_t *list = thiz; MP_CHECK(list->genlist); - DEBUG_TRACE("show group index: %d list->group_it: %0x", show, list->group_it); + DEBUG_TRACE("show group index: %d list->group_it: %0x", show, + list->group_it); if (show) { _mp_album_list_append_group_index_item(list); } else if (list->group_it) { @@ -302,7 +328,7 @@ static void _mp_album_list_load_list(void *thiz, int count) MpAlbumList_t *list = thiz; MP_CHECK(list); - /*media-svc related*/ + /*media-svc related */ mp_media_list_h svc_handle; gint index = 0; int ret = 0; @@ -318,14 +344,17 @@ static void _mp_album_list_load_list(void *thiz, int count) list->album_list = NULL; } - ret = mp_media_info_group_list_create(&list->album_list, MP_GROUP_BY_ALBUM, NULL, NULL, 0, count); + ret = + mp_media_info_group_list_create(&list->album_list, + MP_GROUP_BY_ALBUM, NULL, NULL, 0, + count); if (ret != 0) { DEBUG_TRACE("Fail to get items"); goto END; } - svc_handle = list->album_list ; + svc_handle = list->album_list; mp_album_list_show_group_index(list, false); @@ -336,7 +365,9 @@ static void _mp_album_list_load_list(void *thiz, int count) item = mp_media_info_group_list_nth_item(svc_handle, index); if (!item) { - DEBUG_TRACE("Fail to mp_media_info_group_list_nth_item, ret[%d], index[%d]", ret, index); + DEBUG_TRACE + ("Fail to mp_media_info_group_list_nth_item, ret[%d], index[%d]", + ret, index); goto END; } mp_media_info_group_get_main_info(item, &title); @@ -346,21 +377,29 @@ static void _mp_album_list_load_list(void *thiz, int count) MP_CHECK(item_data); item_data->handle = item; item_data->index = index; - item_data->checked = mp_list_is_in_checked_path_list(list->checked_path_list, title); + item_data->checked = + mp_list_is_in_checked_path_list(list->checked_path_list, + title); if (MP_LIST_OBJ_IS_GENGRID(list->genlist)) { - list_item = elm_gengrid_item_append(list->genlist, list->gengrid_itc, item_data, - _mp_album_select_cb, (void *)list); + list_item = + elm_gengrid_item_append(list->genlist, list->gengrid_itc, + item_data, _mp_album_select_cb, + (void *) list); } else { Elm_Object_Item *parent_group = NULL; - list_item = elm_genlist_item_append(list->genlist, list->itc, item_data, parent_group, - ELM_GENLIST_ITEM_NONE, _mp_album_select_cb, (void *)list); + list_item = + elm_genlist_item_append(list->genlist, list->itc, + item_data, parent_group, + ELM_GENLIST_ITEM_NONE, + _mp_album_select_cb, + (void *) list); } item_data->it = list_item; elm_object_item_data_set(item_data->it, item_data); } -END: + END: endfunc; } @@ -401,21 +440,23 @@ static mp_group_type_e _mp_album_list_get_group_type(void *thiz) return MP_GROUP_BY_ALBUM; } -static void -_mp_album_list_genlist_create(MpAlbumList_t *list) +static void _mp_album_list_genlist_create(MpAlbumList_t * list) { MP_CHECK(list); - /*create new genlist*/ + /*create new genlist */ list->genlist = mp_widget_genlist_create(list->box); - elm_scroller_policy_set(list->genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); - evas_object_size_hint_weight_set(list->genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(list->genlist, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_scroller_policy_set(list->genlist, ELM_SCROLLER_POLICY_OFF, + ELM_SCROLLER_POLICY_AUTO); + evas_object_size_hint_weight_set(list->genlist, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(list->genlist, EVAS_HINT_FILL, + EVAS_HINT_FILL); elm_genlist_homogeneous_set(list->genlist, EINA_TRUE); evas_object_show(list->genlist); - /*packet genlist to box*/ + /*packet genlist to box */ elm_box_pack_end(list->box, list->genlist); - /*add long press callback*/ + /*add long press callback */ //evas_object_smart_callback_add(list->genlist, "longpressed", _mp_album_list_item_longpressed_cb, list); elm_genlist_mode_set(list->genlist, ELM_LIST_COMPRESS); @@ -433,8 +474,7 @@ _mp_album_list_genlist_create(MpAlbumList_t *list) endfunc; } -static void -_mp_album_list_set_grid_style(MpAlbumList_t *list) +static void _mp_album_list_set_grid_style(MpAlbumList_t * list) { bool landscape = mp_util_is_landscape(); @@ -450,30 +490,31 @@ _mp_album_list_set_grid_style(MpAlbumList_t *list) int w; int h; if (landscape) { - w = (int)(ALBUM_GRID_LAND_W * scale); - h = (int)(ALBUM_GRID_LAND_H * scale); + w = (int) (ALBUM_GRID_LAND_W * scale); + h = (int) (ALBUM_GRID_LAND_H * scale); } else { - w = (int)(ALBUM_GRID_W * scale); - h = (int)(ALBUM_GRID_H * scale); + w = (int) (ALBUM_GRID_W * scale); + h = (int) (ALBUM_GRID_H * scale); } elm_gengrid_item_size_set(list->genlist, w, h); } -static void -_mp_album_list_gengrid_create(MpAlbumList_t *list) +static void _mp_album_list_gengrid_create(MpAlbumList_t * list) { startfunc; MP_CHECK(list); - /*create new genlist*/ + /*create new genlist */ mp_evas_object_del(list->genlist); list->genlist = elm_gengrid_add(list->box); - evas_object_size_hint_weight_set(list->genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(list->genlist, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(list->genlist, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(list->genlist, EVAS_HINT_FILL, + EVAS_HINT_FILL); evas_object_show(list->genlist); MP_LIST_OBJ_SET_AS_GENGRID(list->genlist); - /*packet genlist to box*/ + /*packet genlist to box */ elm_box_pack_end(list->box, list->genlist); if (!list->gengrid_itc) { @@ -500,11 +541,14 @@ static void _mp_album_list_update(void *thiz) struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); - res = mp_media_info_group_list_count(MP_GROUP_BY_ALBUM, NULL, NULL, &count); + res = + mp_media_info_group_list_count(MP_GROUP_BY_ALBUM, NULL, NULL, + &count); MP_CHECK(res == 0); mp_list_free_checked_path_list(list->checked_path_list); - list->checked_path_list = mp_list_get_checked_path_list((MpList_t *)list); + list->checked_path_list = + mp_list_get_checked_path_list((MpList_t *) list); mp_evas_object_del(list->genlist); mp_evas_object_del(list->no_content); @@ -519,7 +563,7 @@ static void _mp_album_list_update(void *thiz) evas_object_data_set(list->genlist, "list_handle", list); if (ad->del_cb_invoked == 0) { - mp_list_bottom_counter_item_append((MpList_t *)list); + mp_list_bottom_counter_item_append((MpList_t *) list); } /* load list */ @@ -528,7 +572,9 @@ static void _mp_album_list_update(void *thiz) } else { DEBUG_TRACE("count is 0"); - list->no_content = mp_widget_create_no_contents(list->box, MP_NOCONTENT_ALBUMS, NULL, NULL); + list->no_content = + mp_widget_create_no_contents(list->box, MP_NOCONTENT_ALBUMS, + NULL, NULL); list->hide_fastscroll(list); elm_box_pack_end(list->box, list->no_content); } @@ -537,8 +583,9 @@ static void _mp_album_list_update(void *thiz) void _mp_album_list_rotate(void *thiz) { - MpAlbumList_t * list = thiz; - if (mp_list_get_display_mode((MpList_t *)list) == MP_LIST_DISPLAY_MODE_THUMBNAIL) { + MpAlbumList_t *list = thiz; + if (mp_list_get_display_mode((MpList_t *) list) == + MP_LIST_DISPLAY_MODE_THUMBNAIL) { _mp_album_list_set_grid_style(list); } } @@ -549,7 +596,7 @@ static const char *_get_label(void *thiz, void *event_info) MP_CHECK_NULL(list); char *title = NULL; - mp_list_item_data_t *album = elm_object_item_data_get(event_info); + mp_list_item_data_t *album = elm_object_item_data_get(event_info); MP_CHECK_NULL(album); mp_media_info_group_get_main_info(album->handle, &title); @@ -561,7 +608,10 @@ static char *_mp_album_list_bottom_counter_text_cb(void *thiz) MpAlbumList_t *list = thiz; MP_CHECK_NULL(list); - unsigned int count = mp_list_get_editable_count((MpList_t *)list, mp_list_get_edit_type((MpList_t *)list)); + unsigned int count = + mp_list_get_editable_count((MpList_t *) list, + mp_list_get_edit_type((MpList_t *) + list)); char *text = NULL; if (count == 1) { @@ -593,9 +643,13 @@ _mp_album_list_get_count(void *thiz, MpListEditType_e type) MpAlbumList_t *list = thiz; MP_CHECK_VAL(list->genlist, 0); - int count = MP_LIST_OBJ_IS_GENGRID(list->genlist) ? elm_gengrid_items_count(list->genlist) : elm_genlist_items_count(list->genlist); + int count = + MP_LIST_OBJ_IS_GENGRID(list-> + genlist) ? elm_gengrid_items_count(list-> + genlist) + : elm_genlist_items_count(list->genlist); - if (list->group_it) { //group index + if (list->group_it) { //group index --count; } @@ -606,7 +660,7 @@ _mp_album_list_get_count(void *thiz, MpListEditType_e type) return count; } -MpAlbumList_t * mp_album_list_create(Evas_Object *parent) +MpAlbumList_t *mp_album_list_create(Evas_Object * parent) { eventfunc; MP_CHECK_NULL(parent); @@ -614,7 +668,7 @@ MpAlbumList_t * mp_album_list_create(Evas_Object *parent) MpAlbumList_t *list = calloc(1, sizeof(MpAlbumList_t)); MP_CHECK_NULL(list); - mp_list_init((MpList_t *)list, parent, MP_LIST_TYPE_GROUP); + mp_list_init((MpList_t *) list, parent, MP_LIST_TYPE_GROUP); list->update = _mp_album_list_update; list->destory_cb = _mp_album_list_destory_cb; @@ -624,7 +678,8 @@ MpAlbumList_t * mp_album_list_create(Evas_Object *parent) list->display_mode_changable = true; - list->bottom_counter_text_get_cb = _mp_album_list_bottom_counter_text_cb; + list->bottom_counter_text_get_cb = + _mp_album_list_bottom_counter_text_cb; list->set_edit_default = list->set_edit; list->set_edit = _mp_album_list_set_edit; @@ -633,7 +688,7 @@ MpAlbumList_t * mp_album_list_create(Evas_Object *parent) return list; } -void mp_album_list_set_data(MpAlbumList_t *list, ...) +void mp_album_list_set_data(MpAlbumList_t * list, ...) { startfunc; MP_CHECK(list); @@ -646,20 +701,21 @@ void mp_album_list_set_data(MpAlbumList_t *list, ...) field = va_arg(var_args, int); switch (field) { - case MP_ALBUM_LIST_FUNC: { - int val = va_arg((var_args), int); + case MP_ALBUM_LIST_FUNC:{ + int val = va_arg((var_args), int); - list->function_type = val; - DEBUG_TRACE("list->function_type = %d", list->function_type); - break; - } - case MP_ALBUM_LIST_DISPLAY_MODE: { - int val = va_arg((var_args), int); - list->display_mode = val; - DEBUG_TRACE("list->display_mode = %d", list->display_mode); + list->function_type = val; + DEBUG_TRACE("list->function_type = %d", + list->function_type); + break; + } + case MP_ALBUM_LIST_DISPLAY_MODE:{ + int val = va_arg((var_args), int); + list->display_mode = val; + DEBUG_TRACE("list->display_mode = %d", list->display_mode); - break; - } + break; + } default: DEBUG_TRACE("Invalid arguments"); @@ -670,7 +726,7 @@ void mp_album_list_set_data(MpAlbumList_t *list, ...) va_end(var_args); } -void mp_album_list_copy_data(MpAlbumList_t*src, MpAlbumList_t *dest) +void mp_album_list_copy_data(MpAlbumList_t * src, MpAlbumList_t * dest) { MP_CHECK(src); MP_CHECK(dest); @@ -678,4 +734,3 @@ void mp_album_list_copy_data(MpAlbumList_t*src, MpAlbumList_t *dest) dest->function_type = src->function_type; dest->display_mode = src->display_mode; } - diff --git a/src/widget/mp-artist-detail-list.c b/src/widget/mp-artist-detail-list.c index a6da7ba..4046981 100644 --- a/src/widget/mp-artist-detail-list.c +++ b/src/widget/mp-artist-detail-list.c @@ -26,8 +26,9 @@ #include "mp-minicontroller.h" #include "mp-common.h" -static char * -_mp_artist_detail_list_album_label_get(void *data, Evas_Object * obj, const char *part) +static char *_mp_artist_detail_list_album_label_get(void *data, + Evas_Object * obj, + const char *part) { char *name = NULL; int ret = 0; @@ -53,18 +54,21 @@ _mp_artist_detail_list_album_label_get(void *data, Evas_Object * obj, const char return NULL; } -static void _mp_aritst_detail_list_update_check(mp_list_item_data_t *it_data) +static void _mp_aritst_detail_list_update_check(mp_list_item_data_t * + it_data) { MP_CHECK(it_data); - Elm_Object_Item *gli = (Elm_Object_Item *)it_data->it; + Elm_Object_Item *gli = (Elm_Object_Item *) it_data->it; if (it_data->item_type == MP_LIST_ITEM_TYPE_SELECTABLE_GROUP_TITLE) { Eina_Bool checked = it_data->checked; Elm_Object_Item *item = elm_genlist_item_next_get(gli); while (item) { - mp_list_item_data_t *item_data = elm_object_item_data_get(item); - if (item_data && item_data->item_type == MP_LIST_ITEM_TYPE_NORMAL) { + mp_list_item_data_t *item_data = + elm_object_item_data_get(item); + if (item_data + && item_data->item_type == MP_LIST_ITEM_TYPE_NORMAL) { mp_list_item_check_set(item, checked); } else { break; @@ -78,8 +82,10 @@ static void _mp_aritst_detail_list_update_check(mp_list_item_data_t *it_data) Eina_Bool checked_all = EINA_TRUE; Elm_Object_Item *item = elm_genlist_item_next_get(parent_item); while (item) { - mp_list_item_data_t *item_data = elm_object_item_data_get(item); - if (item_data && item_data->item_type == MP_LIST_ITEM_TYPE_NORMAL) { + mp_list_item_data_t *item_data = + elm_object_item_data_get(item); + if (item_data + && item_data->item_type == MP_LIST_ITEM_TYPE_NORMAL) { if (!item_data->checked) { checked_all = EINA_FALSE; break; @@ -96,7 +102,9 @@ static void _mp_aritst_detail_list_update_check(mp_list_item_data_t *it_data) } } -static void _mp_artist_detail_list_check_changed_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_artist_detail_list_check_changed_cb(void *data, + Evas_Object * obj, + void *event_info) { mp_list_item_data_t *item = (mp_list_item_data_t *) data; MP_CHECK(item); @@ -109,8 +117,9 @@ static void _mp_artist_detail_list_check_changed_cb(void *data, Evas_Object *obj mp_view_update_options_edit(view); } -Evas_Object * -_mp_artist_detail_list_album_icon_get(void *data, Evas_Object * obj, const char *part) +Evas_Object *_mp_artist_detail_list_album_icon_get(void *data, + Evas_Object * obj, + const char *part) { mp_list_item_data_t *item = (mp_list_item_data_t *) data; MP_CHECK_NULL(item); @@ -127,9 +136,13 @@ _mp_artist_detail_list_album_icon_get(void *data, Evas_Object * obj, const char char *thumb_name = NULL; mp_media_info_group_get_thumbnail_path(svc_item, &thumb_name); - icon = mp_util_create_lazy_update_thumb_icon(obj, thumb_name, MP_LIST_ICON_SIZE, MP_LIST_ICON_SIZE); + icon = + mp_util_create_lazy_update_thumb_icon(obj, thumb_name, + MP_LIST_ICON_SIZE, + MP_LIST_ICON_SIZE); - elm_layout_theme_set(content, "layout", "list/B/music.type.1", "default"); + elm_layout_theme_set(content, "layout", "list/B/music.type.1", + "default"); elm_layout_content_set(content, "elm.swallow.content", icon); return content; @@ -140,7 +153,9 @@ _mp_artist_detail_list_album_icon_get(void *data, Evas_Object * obj, const char elm_object_style_set(icon, "default"); evas_object_propagate_events_set(icon, EINA_FALSE); elm_check_state_pointer_set(icon, &item->checked); - evas_object_smart_callback_add(icon, "changed", _mp_artist_detail_list_check_changed_cb, item); + evas_object_smart_callback_add(icon, "changed", + _mp_artist_detail_list_check_changed_cb, + item); return icon; } @@ -150,7 +165,8 @@ _mp_artist_detail_list_album_icon_get(void *data, Evas_Object * obj, const char /*sweep button callbacks*/ static void -_mp_artist_detail_list_set_cb(void *data, Evas_Object * obj, void *event_info) +_mp_artist_detail_list_set_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; @@ -167,12 +183,13 @@ _mp_artist_detail_list_set_cb(void *data, Evas_Object * obj, void *event_info) /*end of sweep button callbacks*/ -static char * -_mp_artist_detail_list_track_label_get(void *data, Evas_Object * obj, const char *part) +static char *_mp_artist_detail_list_track_label_get(void *data, + Evas_Object * obj, + const char *part) { mp_list_item_data_t *item = (mp_list_item_data_t *) data; MP_CHECK_NULL(item); - mp_media_info_h track = (mp_media_info_h)(item->handle); + mp_media_info_h track = (mp_media_info_h) (item->handle); mp_retvm_if(!track, NULL, "data is null"); MpArtistDetailList_t *list = evas_object_data_get(obj, "list_data"); @@ -183,10 +200,10 @@ _mp_artist_detail_list_track_label_get(void *data, Evas_Object * obj, const char if (!strcmp(part, "elm.text")) { - bool match = mp_common_track_is_current(track, (MpList_t *)list); + bool match = mp_common_track_is_current(track, (MpList_t *) list); char *title = NULL; - mp_media_info_get_title(track, &title); + mp_media_info_get_title(track, &title); mp_retv_if(!title, NULL); char *markup = NULL; @@ -197,11 +214,12 @@ _mp_artist_detail_list_track_label_get(void *data, Evas_Object * obj, const char int r = 21; int g = 108; int b = 148; - int a = 255 ; + int a = 255; memset(result, 0x00, DEF_STR_LEN + 1); snprintf(result, DEF_STR_LEN, - "%s", r, g, b, a, info); + "%s", r, g, b, a, + info); IF_FREE(info); return g_strdup(result); @@ -215,7 +233,8 @@ _mp_artist_detail_list_track_label_get(void *data, Evas_Object * obj, const char if (!strcmp(part, "elm.text.end")) { int duration; char time[16] = ""; - bool match = mp_common_track_is_current(track, (MpList_t *)list); + bool match = + mp_common_track_is_current(track, (MpList_t *) list); mp_media_info_get_duration(track, &duration); mp_util_format_duration(time, duration); @@ -224,11 +243,12 @@ _mp_artist_detail_list_track_label_get(void *data, Evas_Object * obj, const char int r = 21; int g = 108; int b = 148; - int a = 255 ; + int a = 255; memset(result, 0x00, DEF_STR_LEN + 1); snprintf(result, DEF_STR_LEN, - "%s", r, g, b, a, time); + "%s", r, g, b, a, + time); return g_strdup(result); } @@ -238,8 +258,9 @@ _mp_artist_detail_list_track_label_get(void *data, Evas_Object * obj, const char return NULL; } -Evas_Object * -_mp_artist_detail_list_track_icon_get(void *data, Evas_Object * obj, const char *part) +Evas_Object *_mp_artist_detail_list_track_icon_get(void *data, + Evas_Object * obj, + const char *part) { mp_list_item_data_t *item = (mp_list_item_data_t *) data; MP_CHECK_NULL(item); @@ -249,16 +270,16 @@ _mp_artist_detail_list_track_icon_get(void *data, Evas_Object * obj, const char MpArtistDetailList_t *list = evas_object_data_get(obj, "list_data"); MP_CHECK_NULL(list); /* - if (!strcmp(part, "elm.icon")) - { - char *thumbpath = NULL; - Evas_Object *icon; - - mp_media_info_get_thumbnail_path(track, &thumbpath); - icon = mp_util_create_thumb_icon(obj, thumbpath, MP_LIST_ICON_SIZE, MP_LIST_ICON_SIZE); - return icon; - } - */ + if (!strcmp(part, "elm.icon")) + { + char *thumbpath = NULL; + Evas_Object *icon; + + mp_media_info_get_thumbnail_path(track, &thumbpath); + icon = mp_util_create_thumb_icon(obj, thumbpath, MP_LIST_ICON_SIZE, MP_LIST_ICON_SIZE); + return icon; + } + */ Evas_Object *button; if (!strcmp(part, "elm.slide.swallow.3")) { @@ -267,15 +288,20 @@ _mp_artist_detail_list_track_icon_get(void *data, Evas_Object * obj, const char //elm_object_text_set(button, GET_STR(STR_MP_ADD_TO)); //mp_language_mgr_register_object(button, OBJ_TYPE_ELM_OBJECT, NULL, STR_MP_ADD_TO); mp_util_domain_translatable_text_set(button, STR_MP_ADD_TO); - evas_object_smart_callback_add(button, "clicked", mp_common_button_add_to_playlist_cb, evas_object_data_get(obj, "list_data")); + evas_object_smart_callback_add(button, "clicked", + mp_common_button_add_to_playlist_cb, + evas_object_data_get(obj, + "list_data")); return button; } else if (!strcmp(part, "elm.slide.swallow.1")) { button = elm_button_add(obj); elm_object_style_set(button, "sweep"); //elm_object_text_set(button, GET_SYS_STR("IDS_COM_BUTTON_SHARE")); //mp_language_mgr_register_object(button, OBJ_TYPE_ELM_OBJECT, NULL, "IDS_COM_BUTTON_SHARE"); - mp_util_domain_translatable_text_set(button, "IDS_COM_BUTTON_SHARE"); - evas_object_smart_callback_add(button, "clicked", mp_common_sweep_share_cb, track); + mp_util_domain_translatable_text_set(button, + "IDS_COM_BUTTON_SHARE"); + evas_object_smart_callback_add(button, "clicked", + mp_common_sweep_share_cb, track); return button; } else if (!strcmp(part, "elm.slide.swallow.2")) { button = elm_button_add(obj); @@ -283,7 +309,9 @@ _mp_artist_detail_list_track_icon_get(void *data, Evas_Object * obj, const char //elm_object_text_set(button, GET_SYS_STR("IDS_COM_SK_SET")); //mp_language_mgr_register_object(button, OBJ_TYPE_ELM_OBJECT, NULL, "IDS_COM_SK_SET"); mp_util_domain_translatable_text_set(button, "IDS_COM_SK_SET"); - evas_object_smart_callback_add(button, "clicked", _mp_artist_detail_list_set_cb, track); + evas_object_smart_callback_add(button, "clicked", + _mp_artist_detail_list_set_cb, + track); return button; } else if (!strcmp(part, "elm.slide.swallow.4")) { button = elm_button_add(obj); @@ -292,21 +320,26 @@ _mp_artist_detail_list_track_icon_get(void *data, Evas_Object * obj, const char //elm_object_text_set(button, GET_SYS_STR("IDS_COM_OPT_DELETE")); //mp_language_mgr_register_object(button, OBJ_TYPE_ELM_OBJECT, NULL, "IDS_COM_OPT_DELETE"); mp_util_domain_translatable_text_set(button, "IDS_COM_OPT_DELETE"); - evas_object_smart_callback_add(button, "clicked", mp_common_button_delete_list_cb, evas_object_data_get(obj, "list_data")); + evas_object_smart_callback_add(button, "clicked", + mp_common_button_delete_list_cb, + evas_object_data_get(obj, + "list_data")); return button; } if (list->edit_mode) { // if edit mode DEBUG_TRACE("edit mode starts"); - if (!strcmp(part, "elm.swallow.end")) { // swallow checkbox or radio button + if (!strcmp(part, "elm.swallow.end")) { // swallow checkbox or radio button Evas_Object *icon = NULL; icon = elm_check_add(obj); elm_object_style_set(icon, "default"); evas_object_propagate_events_set(icon, EINA_FALSE); elm_check_state_pointer_set(icon, &item->checked); - evas_object_smart_callback_add(icon, "changed", _mp_artist_detail_list_check_changed_cb, item); + evas_object_smart_callback_add(icon, "changed", + _mp_artist_detail_list_check_changed_cb, + item); return icon; } @@ -317,7 +350,8 @@ _mp_artist_detail_list_track_icon_get(void *data, Evas_Object * obj, const char static void -_mp_artist_detail_list_select_cb(void *data, Evas_Object * obj, void *event_info) +_mp_artist_detail_list_select_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; Elm_Object_Item *gli = (Elm_Object_Item *) event_info; @@ -326,18 +360,23 @@ _mp_artist_detail_list_select_cb(void *data, Evas_Object * obj, void *event_info elm_genlist_item_selected_set(gli, FALSE); - MpArtistDetailList_t *list = (MpArtistDetailList_t *)data; + MpArtistDetailList_t *list = (MpArtistDetailList_t *) data; MP_CHECK(list); struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); if (_mp_is_current_focus_available(ad) != 0) { - ERROR_TRACE("Some other application has the focus currently... Returning..."); + ERROR_TRACE + ("Some other application has the focus currently... Returning..."); char *message = STR_MP_UNABLE_TO_PLAY_DURING_CALL; if (message) { - int ret = notification_status_message_post(dgettext("music-player", message)); + int ret = + notification_status_message_post(dgettext + ("music-player", + message)); if (ret != 0) { - ERROR_TRACE("notification_status_message_post()... [0x%x]", ret); + ERROR_TRACE("notification_status_message_post()... [0x%x]", + ret); } else { DEBUG_TRACE("message: [%s]", message); } @@ -345,13 +384,14 @@ _mp_artist_detail_list_select_cb(void *data, Evas_Object * obj, void *event_info return; } - mp_list_item_data_t *item = (mp_list_item_data_t *) elm_object_item_data_get(gli); + mp_list_item_data_t *item = + (mp_list_item_data_t *) elm_object_item_data_get(gli); MP_CHECK(item); DEBUG_TRACE("item selected"); if (list->edit_mode) { - mp_list_edit_mode_sel((MpList_t *)list, item); + mp_list_edit_mode_sel((MpList_t *) list, item); MpViewMgr_t *view_mgr = mp_view_mgr_get_view_manager(); MpView_t *view = mp_view_mgr_get_top_view(view_mgr); @@ -366,7 +406,9 @@ _mp_artist_detail_list_select_cb(void *data, Evas_Object * obj, void *event_info return; } -static void _mp_artist_detail_list_album_title_select_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_artist_detail_list_album_title_select_cb(void *data, + Evas_Object * obj, + void *event_info) { eventfunc; Elm_Object_Item *gli = (Elm_Object_Item *) event_info; @@ -376,47 +418,57 @@ static void _mp_artist_detail_list_album_title_select_cb(void *data, Evas_Object MpArtistDetailList_t *list = data; MP_CHECK(list); - mp_list_item_data_t *item = (mp_list_item_data_t *) elm_object_item_data_get(gli); + mp_list_item_data_t *item = + (mp_list_item_data_t *) elm_object_item_data_get(gli); MP_CHECK(item); if (list->edit_mode) { - mp_list_edit_mode_sel((MpList_t *)list, item); + mp_list_edit_mode_sel((MpList_t *) list, item); MpViewMgr_t *view_mgr = mp_view_mgr_get_view_manager(); MpView_t *view = mp_view_mgr_get_top_view(view_mgr); ERROR_TRACE("update options of edit view"); - mp_util_create_selectioninfo_with_count(view, mp_list_get_checked_count((MpList_t *)list)); + mp_util_create_selectioninfo_with_count(view, + mp_list_get_checked_count((MpList_t *) list)); mp_view_update_options_edit(view); ERROR_TRACE("set selected count"); return; } } -static int _mp_artist_detail_list_append_album_tracks(void *thiz, char *name, Elm_Object_Item *parent_group) +static int _mp_artist_detail_list_append_album_tracks(void *thiz, + char *name, + Elm_Object_Item * + parent_group) { MpArtistDetailList_t *list = thiz; MP_CHECK_VAL(list, 0); - /*media-svc related*/ + /*media-svc related */ mp_media_list_h svc_handle; - /*clear genlist*/ + /*clear genlist */ /* - Elm_Object_Item *item = elm_genlist_first_item_get(list->genlist); - if (item) - { - elm_genlist_item_bring_in(item, ELM_GENLIST_ITEM_SCROLLTO_IN); - elm_genlist_clear(list->genlist); - } - */ - /*get data from DB*/ + Elm_Object_Item *item = elm_genlist_first_item_get(list->genlist); + if (item) + { + elm_genlist_item_bring_in(item, ELM_GENLIST_ITEM_SCROLLTO_IN); + elm_genlist_clear(list->genlist); + } + */ + /*get data from DB */ int ret = 0; int count = 0; int real_count = 0; - ret = mp_media_info_list_count(MP_TRACK_BY_ARTIST_ALBUM, name, list->type_str, NULL, 0, &count); + ret = + mp_media_info_list_count(MP_TRACK_BY_ARTIST_ALBUM, name, + list->type_str, NULL, 0, &count); MP_CHECK_VAL(ret == 0, 0); - ret = mp_media_info_list_create(&svc_handle, MP_TRACK_BY_ARTIST_ALBUM, name, list->type_str, NULL, -1, 0, count); + ret = + mp_media_info_list_create(&svc_handle, MP_TRACK_BY_ARTIST_ALBUM, + name, list->type_str, NULL, -1, 0, + count); MP_CHECK_VAL(ret == 0, 0); DEBUG_TRACE("count is %d", count); @@ -429,7 +481,9 @@ static int _mp_artist_detail_list_append_album_tracks(void *thiz, char *name, El item = mp_media_info_list_nth_item(svc_handle, index); ret = mp_media_info_get_title(item, &title); if (ret != 0) { - DEBUG_TRACE("Fail to mp_media_info_get_title, ret[%d], index[%d]", ret, index); + DEBUG_TRACE + ("Fail to mp_media_info_get_title, ret[%d], index[%d]", + ret, index); goto END; } @@ -442,7 +496,7 @@ static int _mp_artist_detail_list_append_album_tracks(void *thiz, char *name, El goto append_artist_items; } - if (mp_util_is_in_personal_page((const char *)path)) { + if (mp_util_is_in_personal_page((const char *) path)) { if (list->personal_page_type == MP_LIST_PERSONAL_PAGE_ADD) { real_count--; continue; @@ -453,33 +507,37 @@ static int _mp_artist_detail_list_append_album_tracks(void *thiz, char *name, El continue; } } -append_artist_items: + append_artist_items: #endif item_data = mp_list_item_data_create(MP_LIST_ITEM_TYPE_NORMAL); MP_CHECK_VAL(item_data, real_count); item_data->handle = item; item_data->index = index; - item_data->it = elm_genlist_item_append(list->genlist, list->itc_track, item_data, parent_group, - ELM_GENLIST_ITEM_NONE, _mp_artist_detail_list_select_cb, list); + item_data->it = + elm_genlist_item_append(list->genlist, list->itc_track, + item_data, parent_group, + ELM_GENLIST_ITEM_NONE, + _mp_artist_detail_list_select_cb, + list); } list->track_lists = g_list_append(list->track_lists, svc_handle); return real_count; -END: + END: return 0; endfunc; } -static void -_free_track_lists(void *data) +static void _free_track_lists(void *data) { mp_media_info_list_destroy(data); } -static char * -_mp_artist_detail_list_shuffle_text_get(void *data, Evas_Object *obj, const char *part) +static char *_mp_artist_detail_list_shuffle_text_get(void *data, + Evas_Object * obj, + const char *part) { startfunc; int res = -1; @@ -488,21 +546,29 @@ _mp_artist_detail_list_shuffle_text_get(void *data, Evas_Object *obj, const char static char result[DEF_STR_LEN + 1] = { 0, }; if (!strcmp(part, "elm.text")) { - MpArtistDetailList_t *list = evas_object_data_get(obj, "list_data"); + MpArtistDetailList_t *list = + evas_object_data_get(obj, "list_data"); MP_CHECK_NULL(list); int r = 21; int g = 108; int b = 148; - int a = 255 ; + int a = 255; - res = mp_media_info_list_count(MP_TRACK_BY_ARTIST, list->type_str, NULL, NULL, 0, &count); + res = + mp_media_info_list_count(MP_TRACK_BY_ARTIST, list->type_str, + NULL, NULL, 0, &count); MP_CHECK_NULL(res == 0); - markup = (count == 1) ? g_strdup(GET_STR(STR_MP_SHUFFLE_1_TRACK)) : g_strdup_printf(GET_STR(STR_MP_SHUFFLE_PD_TRACKS), count); + markup = + (count == + 1) ? g_strdup(GET_STR(STR_MP_SHUFFLE_1_TRACK)) : + g_strdup_printf(GET_STR(STR_MP_SHUFFLE_PD_TRACKS), count); memset(result, 0x00, DEF_STR_LEN + 1); - snprintf(result, DEF_STR_LEN, "%s", r, g, b, a, markup); + snprintf(result, DEF_STR_LEN, + "%s", r, g, b, a, + markup); IF_FREE(markup); return g_strdup(result); @@ -510,25 +576,30 @@ _mp_artist_detail_list_shuffle_text_get(void *data, Evas_Object *obj, const char return NULL; } -Evas_Object * -_mp_artist_detail_list_shuffle_icon_get(void *data, Evas_Object * obj, const char *part) +Evas_Object *_mp_artist_detail_list_shuffle_icon_get(void *data, + Evas_Object * obj, + const char *part) { if (!strcmp(part, "elm.swallow.icon")) { Evas_Object *content = NULL; content = elm_layout_add(obj); Evas_Object *icon = NULL; - char edje_path[1024] ={0}; - char * path = app_get_resource_path(); + char edje_path[1024] = { 0 }; + char *path = app_get_resource_path(); MP_CHECK_NULL(path); snprintf(edje_path, 1024, "%s%s/%s", path, "edje", IMAGE_EDJ_NAME); - icon = mp_util_create_image(obj, edje_path, MP_LITE_SHUFFLE_ICON, MP_LIST_SHUFFLE_ICON_SIZE, MP_LIST_SHUFFLE_ICON_SIZE); + icon = + mp_util_create_image(obj, edje_path, MP_LITE_SHUFFLE_ICON, + MP_LIST_SHUFFLE_ICON_SIZE, + MP_LIST_SHUFFLE_ICON_SIZE); evas_object_color_set(icon, 21, 108, 148, 255); free(path); - elm_layout_theme_set(content, "layout", "list/B/music.type.3", "default"); + elm_layout_theme_set(content, "layout", "list/B/music.type.3", + "default"); elm_layout_content_set(content, "elm.swallow.content", icon); return content; @@ -538,7 +609,8 @@ _mp_artist_detail_list_shuffle_icon_get(void *data, Evas_Object * obj, const cha static void -_mp_artist_detail_list_shuffle_cb(void *data, Evas_Object * obj, void *event_info) +_mp_artist_detail_list_shuffle_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; Elm_Object_Item *gli = (Elm_Object_Item *) event_info; @@ -550,7 +622,8 @@ _mp_artist_detail_list_shuffle_cb(void *data, Evas_Object * obj, void *event_inf MpList_t *list = data; MP_CHECK(list); - mp_list_item_data_t *item = (mp_list_item_data_t *) elm_object_item_data_get(gli); + mp_list_item_data_t *item = + (mp_list_item_data_t *) elm_object_item_data_get(gli); MP_CHECK(item); mp_play_control_shuffle_set(NULL, true); @@ -568,7 +641,8 @@ void mp_artist_detail_list_update_genlist(void *thiz) MP_CHECK(list->genlist); int count = 0; - mp_media_info_list_count(MP_TRACK_BY_ARTIST, list->type_str, NULL, NULL, 0, &count); + mp_media_info_list_count(MP_TRACK_BY_ARTIST, list->type_str, NULL, + NULL, 0, &count); if (count <= 0) { mp_list_update(thiz); @@ -584,7 +658,8 @@ _mp_artist_detail_list_item_del_cb(void *data, Evas_Object * obj) SAFE_FREE(item_data); } -static void _mp_artist_detail_list_append_shuffle_item(MpArtistDetailList_t *list) +static void _mp_artist_detail_list_append_shuffle_item(MpArtistDetailList_t + *list) { startfunc; MP_CHECK(list); @@ -596,17 +671,21 @@ static void _mp_artist_detail_list_append_shuffle_item(MpArtistDetailList_t *lis return; } //list->itc_shuffle->item_style = "music/1line";//"music/1text.2icon.3";//"music/3text.1icon.2" - list->itc_shuffle->item_style = "default";//"music/1text.2icon.3";//"music/3text.1icon.2" - list->itc_shuffle->func.text_get = _mp_artist_detail_list_shuffle_text_get; + list->itc_shuffle->item_style = "default"; //"music/1text.2icon.3";//"music/3text.1icon.2" + list->itc_shuffle->func.text_get = + _mp_artist_detail_list_shuffle_text_get; list->itc_shuffle->decorate_all_item_style = NULL; - list->itc_shuffle->func.content_get = _mp_artist_detail_list_shuffle_icon_get; + list->itc_shuffle->func.content_get = + _mp_artist_detail_list_shuffle_icon_get; list->itc_shuffle->func.del = _mp_artist_detail_list_item_del_cb; mp_list_item_data_t *item_data; item_data = mp_list_item_data_create(MP_LIST_ITEM_TYPE_SHUFFLE); MP_CHECK(item_data); - item_data->it = list->shuffle_it = elm_genlist_item_append(list->genlist, list->itc_shuffle, item_data, NULL, - ELM_GENLIST_ITEM_NONE, _mp_artist_detail_list_shuffle_cb, list); + item_data->it = list->shuffle_it = + elm_genlist_item_append(list->genlist, list->itc_shuffle, + item_data, NULL, ELM_GENLIST_ITEM_NONE, + _mp_artist_detail_list_shuffle_cb, list); elm_object_item_data_set(item_data->it, item_data); endfunc; @@ -617,10 +696,10 @@ static void _mp_artist_detail_list_load_list(void *thiz, int count) MpArtistDetailList_t *list = thiz; MP_CHECK(list); - /*media-svc related*/ + /*media-svc related */ mp_media_list_h svc_handle; - /*clear genlist*/ + /*clear genlist */ Elm_Object_Item *item = elm_genlist_first_item_get(list->genlist); if (item) { elm_genlist_item_bring_in(item, ELM_GENLIST_ITEM_SCROLLTO_IN); @@ -642,7 +721,11 @@ static void _mp_artist_detail_list_load_list(void *thiz, int count) list->track_lists = NULL; } - ret = mp_media_info_group_list_create(&list->album_list, MP_GROUP_BY_ARTIST_ALBUM, list->type_str, list->filter_str, 0, count); + ret = + mp_media_info_group_list_create(&list->album_list, + MP_GROUP_BY_ARTIST_ALBUM, + list->type_str, list->filter_str, + 0, count); if (ret != 0) { DEBUG_TRACE("Fail to get items"); @@ -650,7 +733,7 @@ static void _mp_artist_detail_list_load_list(void *thiz, int count) } - svc_handle = list->album_list ; + svc_handle = list->album_list; _mp_artist_detail_list_append_shuffle_item(list); @@ -661,33 +744,43 @@ static void _mp_artist_detail_list_load_list(void *thiz, int count) item = mp_media_info_group_list_nth_item(svc_handle, index); if (!item) { - DEBUG_TRACE("Fail to mp_media_info_group_list_nth_item, ret[%d], index[%d]", ret, index); + DEBUG_TRACE + ("Fail to mp_media_info_group_list_nth_item, ret[%d], index[%d]", + ret, index); goto END; } mp_media_info_group_get_main_info(item, &title); mp_list_item_data_t *item_data; - item_data = mp_list_item_data_create(MP_LIST_ITEM_TYPE_SELECTABLE_GROUP_TITLE); + item_data = + mp_list_item_data_create + (MP_LIST_ITEM_TYPE_SELECTABLE_GROUP_TITLE); MP_CHECK(item_data); item_data->handle = item; item_data->group_type = list->group_type; item_data->index = index; - item_data->it = list_item = elm_genlist_item_append(list->genlist, list->itc_album, item_data, NULL, - ELM_GENLIST_ITEM_NONE, _mp_artist_detail_list_album_title_select_cb, (void *)list); + item_data->it = list_item = + elm_genlist_item_append(list->genlist, list->itc_album, + item_data, NULL, ELM_GENLIST_ITEM_NONE, + _mp_artist_detail_list_album_title_select_cb, + (void *) list); if (!list->edit_mode) { - elm_genlist_item_select_mode_set(list_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + elm_genlist_item_select_mode_set(list_item, + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); } /* append tracks of the album */ - int appended_track_num = _mp_artist_detail_list_append_album_tracks(list, title, list_item); + int appended_track_num = + _mp_artist_detail_list_append_album_tracks(list, title, + list_item); if (!appended_track_num) { elm_object_item_del(list_item); list->count_album--; } } -END: + END: endfunc; } @@ -722,7 +815,9 @@ void _mp_artist_detail_list_destory_cb(void *thiz) free(list); } -static void _mp_artist_detail_list_item_highlighted(void *data, Evas_Object *obj, void *event_info) +static void _mp_artist_detail_list_item_highlighted(void *data, + Evas_Object * obj, + void *event_info) { MpArtistDetailList_t *list = data; MP_CHECK(list); @@ -731,14 +826,18 @@ static void _mp_artist_detail_list_item_highlighted(void *data, Evas_Object *obj MP_CHECK(it); if (list->shuffle_it == it) { - Evas_Object *icon = elm_object_item_part_content_get(it, "elm.icon.2"); + Evas_Object *icon = + elm_object_item_part_content_get(it, "elm.icon.2"); if (icon) { - elm_image_file_set(icon, IMAGE_EDJ_NAME, MP_ICON_SHUFFLE_PRESS); + elm_image_file_set(icon, IMAGE_EDJ_NAME, + MP_ICON_SHUFFLE_PRESS); } } } -static void _mp_artist_detail_list_item_unhighlighted(void *data, Evas_Object *obj, void *event_info) +static void _mp_artist_detail_list_item_unhighlighted(void *data, + Evas_Object * obj, + void *event_info) { MpArtistDetailList_t *list = data; MP_CHECK(list); @@ -747,7 +846,8 @@ static void _mp_artist_detail_list_item_unhighlighted(void *data, Evas_Object *o MP_CHECK(it); if (list->shuffle_it == it) { - Evas_Object *icon = elm_object_item_part_content_get(it, "elm.icon.2"); + Evas_Object *icon = + elm_object_item_part_content_get(it, "elm.icon.2"); if (icon) { elm_image_file_set(icon, IMAGE_EDJ_NAME, MP_ICON_SHUFFLE); } @@ -765,24 +865,33 @@ static void _mp_artist_detail_list_set_edit(void *thiz, bool edit) Elm_Object_Item *item = mp_list_first_item_get(list->genlist); while (item) { - mp_list_item_data_t *item_data = (mp_list_item_data_t *) elm_object_item_data_get(item); - if (item_data && item_data->item_type == MP_LIST_ITEM_TYPE_SELECTABLE_GROUP_TITLE) { - mp_list_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DEFAULT); + mp_list_item_data_t *item_data = + (mp_list_item_data_t *) elm_object_item_data_get(item); + if (item_data + && item_data->item_type == + MP_LIST_ITEM_TYPE_SELECTABLE_GROUP_TITLE) { + mp_list_item_select_mode_set(item, + ELM_OBJECT_SELECT_MODE_DEFAULT); } item = mp_list_item_next_get(item); } - mp_list_select_mode_set(list->genlist, ELM_OBJECT_SELECT_MODE_ALWAYS); + mp_list_select_mode_set(list->genlist, + ELM_OBJECT_SELECT_MODE_ALWAYS); } else { - mp_list_select_mode_set(list->genlist, ELM_OBJECT_SELECT_MODE_DEFAULT); + mp_list_select_mode_set(list->genlist, + ELM_OBJECT_SELECT_MODE_DEFAULT); Elm_Object_Item *item = mp_list_first_item_get(list->genlist); while (item) { - mp_list_item_data_t *item_data = (mp_list_item_data_t *) elm_object_item_data_get(item); + mp_list_item_data_t *item_data = + (mp_list_item_data_t *) elm_object_item_data_get(item); if (item_data) { item_data->checked = EINA_FALSE; - if (item_data->item_type == MP_LIST_ITEM_TYPE_SELECTABLE_GROUP_TITLE) { - mp_list_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + if (item_data->item_type == + MP_LIST_ITEM_TYPE_SELECTABLE_GROUP_TITLE) { + mp_list_item_select_mode_set(item, + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); } } item = mp_list_item_next_get(item); @@ -802,7 +911,10 @@ void _mp_artist_detail_list_update(void *thiz) MpArtistDetailList_t *list = thiz; MP_CHECK(list); - res = mp_media_info_group_list_count(MP_GROUP_BY_ARTIST_ALBUM, list->type_str, list->filter_str, &count_album); + res = + mp_media_info_group_list_count(MP_GROUP_BY_ARTIST_ALBUM, + list->type_str, list->filter_str, + &count_album); MP_CHECK(res == 0); DEBUG_TRACE("count is %d", count_album); list->count_album = count_album; @@ -811,51 +923,73 @@ void _mp_artist_detail_list_update(void *thiz) mp_evas_object_del(list->no_content); if (count_album) { - /*create new genlist*/ + /*create new genlist */ list->genlist = mp_widget_genlist_create(list->box); - evas_object_size_hint_weight_set(list->genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(list->genlist, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(list->genlist, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(list->genlist, EVAS_HINT_FILL, + EVAS_HINT_FILL); elm_genlist_mode_set(list->genlist, ELM_LIST_COMPRESS); evas_object_show(list->genlist); - /*packet genlist to box*/ + /*packet genlist to box */ elm_box_pack_end(list->box, list->genlist); evas_object_data_set(list->genlist, "list_data", list); list->itc_album = elm_genlist_item_class_new(); if (list->itc_album) { list->itc_album->item_style = "default"; - list->itc_album->func.text_get = _mp_artist_detail_list_album_label_get; - list->itc_album->func.content_get = _mp_artist_detail_list_album_icon_get; + list->itc_album->func.text_get = + _mp_artist_detail_list_album_label_get; + list->itc_album->func.content_get = + _mp_artist_detail_list_album_icon_get; list->itc_album->func.del = _mp_artist_detail_list_item_del_cb; list->itc_track = elm_genlist_item_class_new(); if (list->itc_track) { list->itc_track->item_style = "type1"; - list->itc_track->func.text_get = _mp_artist_detail_list_track_label_get; - list->itc_track->func.content_get = _mp_artist_detail_list_track_icon_get; - list->itc_track->func.del = _mp_artist_detail_list_item_del_cb; + list->itc_track->func.text_get = + _mp_artist_detail_list_track_label_get; + list->itc_track->func.content_get = + _mp_artist_detail_list_track_icon_get; + list->itc_track->func.del = + _mp_artist_detail_list_item_del_cb; } } - evas_object_smart_callback_add(list->genlist, "drag,start,left", list->flick_left_cb, NULL); - evas_object_smart_callback_add(list->genlist, "drag,start,right", list->flick_right_cb, NULL); - evas_object_smart_callback_add(list->genlist, "drag,stop", list->flick_stop_cb, NULL); - - evas_object_smart_callback_add(list->genlist, "drag,start,right", list->mode_right_cb, NULL); - evas_object_smart_callback_add(list->genlist, "drag,start,left", list->mode_left_cb, NULL); - evas_object_smart_callback_add(list->genlist, "drag,start,up", list->mode_cancel_cb, NULL); - evas_object_smart_callback_add(list->genlist, "drag,start,down", list->mode_cancel_cb, NULL); - - evas_object_smart_callback_add(list->genlist, "scroll,drag,start", list->drag_start_cb, list); - evas_object_smart_callback_add(list->genlist, "scroll,drag,stop", list->drag_stop_cb, list); - evas_object_smart_callback_add(list->genlist, "highlighted", _mp_artist_detail_list_item_highlighted, list); - evas_object_smart_callback_add(list->genlist, "unhighlighted", _mp_artist_detail_list_item_unhighlighted, list); + evas_object_smart_callback_add(list->genlist, "drag,start,left", + list->flick_left_cb, NULL); + evas_object_smart_callback_add(list->genlist, "drag,start,right", + list->flick_right_cb, NULL); + evas_object_smart_callback_add(list->genlist, "drag,stop", + list->flick_stop_cb, NULL); + + evas_object_smart_callback_add(list->genlist, "drag,start,right", + list->mode_right_cb, NULL); + evas_object_smart_callback_add(list->genlist, "drag,start,left", + list->mode_left_cb, NULL); + evas_object_smart_callback_add(list->genlist, "drag,start,up", + list->mode_cancel_cb, NULL); + evas_object_smart_callback_add(list->genlist, "drag,start,down", + list->mode_cancel_cb, NULL); + + evas_object_smart_callback_add(list->genlist, "scroll,drag,start", + list->drag_start_cb, list); + evas_object_smart_callback_add(list->genlist, "scroll,drag,stop", + list->drag_stop_cb, list); + evas_object_smart_callback_add(list->genlist, "highlighted", + _mp_artist_detail_list_item_highlighted, + list); + evas_object_smart_callback_add(list->genlist, "unhighlighted", + _mp_artist_detail_list_item_unhighlighted, + list); /* load list */ _mp_artist_detail_list_load_list(thiz, count_album); } else { DEBUG_TRACE("count is 0"); - list->no_content = mp_widget_create_no_contents(list->box, MP_NOCONTENT_NORMAL, NULL, NULL); + list->no_content = + mp_widget_create_no_contents(list->box, MP_NOCONTENT_NORMAL, + NULL, NULL); elm_box_pack_end(list->box, list->no_content); } @@ -883,22 +1017,23 @@ _mp_artist_detail_list_get_count(void *thiz, MpListEditType_e type) if (list->bottom_counter_item) { --count; } - count = count - list->count_album ; + count = count - list->count_album; return count; } -static void -_mp_aritst_detail_list_edit_mode_sel(void *thiz, void *data) +static void _mp_aritst_detail_list_edit_mode_sel(void *thiz, void *data) { startfunc; - MpList_t *list = (MpList_t *)thiz; - mp_list_item_data_t *it_data = (mp_list_item_data_t *)data; - Elm_Object_Item *gli = (Elm_Object_Item *)it_data->it; + MpList_t *list = (MpList_t *) thiz; + mp_list_item_data_t *it_data = (mp_list_item_data_t *) data; + Elm_Object_Item *gli = (Elm_Object_Item *) it_data->it; mp_list_item_selected_set(gli, EINA_FALSE); - if (elm_genlist_item_flip_get(gli) || elm_genlist_item_select_mode_get(gli) == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) { + if (elm_genlist_item_flip_get(gli) + || elm_genlist_item_select_mode_get(gli) == + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) { return; } @@ -909,15 +1044,18 @@ _mp_aritst_detail_list_edit_mode_sel(void *thiz, void *data) MpViewMgr_t *view_mgr = mp_view_mgr_get_view_manager(); MpView_t *view = mp_view_mgr_get_top_view(view_mgr); if (view) { - mp_util_create_selectioninfo_with_count(view, mp_list_get_checked_count(list)); + mp_util_create_selectioninfo_with_count(view, + mp_list_get_checked_count + (list)); } } static void -_mp_artist_detail_list_selected_item_data_get(void *thiz, GList **selected) +_mp_artist_detail_list_selected_item_data_get(void *thiz, + GList ** selected) { startfunc; - MpList_t *list = (MpList_t *)thiz; + MpList_t *list = (MpList_t *) thiz; GList *sel_list = NULL; if (!list->genlist) { @@ -940,19 +1078,21 @@ _mp_artist_detail_list_selected_item_data_get(void *thiz, GList **selected) item = mp_list_item_next_get(item); } -END: + END: if (selected) { *selected = sel_list; } } -static char * -_mp_artist_detail_list_bottom_counter_text_cb(void *thiz) +static char *_mp_artist_detail_list_bottom_counter_text_cb(void *thiz) { MpArtistDetailList_t *list = thiz; MP_CHECK_NULL(list); - unsigned int count = mp_list_get_editable_count((MpList_t *)list, mp_list_get_edit_type((MpList_t *)list)); + unsigned int count = + mp_list_get_editable_count((MpList_t *) list, + mp_list_get_edit_type((MpList_t *) + list)); char *text = NULL; if (count == 1) { text = g_strdup(GET_STR(STR_MP_1_SONG)); @@ -971,7 +1111,7 @@ static mp_group_type_e _mp_artist_detail_list_get_group_type(void *thiz) } -MpArtistDetailList_t * mp_artist_detail_list_create(Evas_Object *parent) +MpArtistDetailList_t *mp_artist_detail_list_create(Evas_Object * parent) { eventfunc; MP_CHECK_NULL(parent); @@ -979,7 +1119,7 @@ MpArtistDetailList_t * mp_artist_detail_list_create(Evas_Object *parent) MpArtistDetailList_t *list = calloc(1, sizeof(MpArtistDetailList_t)); MP_CHECK_NULL(list); - mp_list_init((MpList_t *)list, parent, MP_LIST_TYPE_ARTIST_DETAIL); + mp_list_init((MpList_t *) list, parent, MP_LIST_TYPE_ARTIST_DETAIL); list->update = _mp_artist_detail_list_update; list->destory_cb = _mp_artist_detail_list_destory_cb; @@ -989,15 +1129,17 @@ MpArtistDetailList_t * mp_artist_detail_list_create(Evas_Object *parent) list->set_edit_default = list->set_edit; list->set_edit = _mp_artist_detail_list_set_edit; list->edit_mode_sel = _mp_aritst_detail_list_edit_mode_sel; - list->selected_item_data_get = _mp_artist_detail_list_selected_item_data_get; + list->selected_item_data_get = + _mp_artist_detail_list_selected_item_data_get; list->set_reorder = NULL; - list->bottom_counter_text_get_cb = _mp_artist_detail_list_bottom_counter_text_cb; + list->bottom_counter_text_get_cb = + _mp_artist_detail_list_bottom_counter_text_cb; return list; } -void mp_artist_detail_list_set_data(MpArtistDetailList_t *list, ...) +void mp_artist_detail_list_set_data(MpArtistDetailList_t * list, ...) { startfunc; MP_CHECK(list); @@ -1009,30 +1151,30 @@ void mp_artist_detail_list_set_data(MpArtistDetailList_t *list, ...) do { field = va_arg(var_args, int); switch (field) { - case MP_ARTIST_DETAIL_LIST_TYPE: { - int val = va_arg((var_args), int); + case MP_ARTIST_DETAIL_LIST_TYPE:{ + int val = va_arg((var_args), int); - list->group_type = val; - DEBUG_TRACE("list->group_type = %d", list->group_type); - break; - } + list->group_type = val; + DEBUG_TRACE("list->group_type = %d", list->group_type); + break; + } - case MP_ARTIST_DETAIL_LIST_TYPE_STR: { - char *val = va_arg((var_args), char *); - SAFE_FREE(list->type_str); - list->type_str = g_strdup(val); - DEBUG_TRACE("list->type_str = %s", list->type_str); + case MP_ARTIST_DETAIL_LIST_TYPE_STR:{ + char *val = va_arg((var_args), char *); + SAFE_FREE(list->type_str); + list->type_str = g_strdup(val); + DEBUG_TRACE("list->type_str = %s", list->type_str); - break; - } - case MP_ARTIST_DETAIL_LIST_FILTER_STR: { - char *val = va_arg((var_args), char *); - SAFE_FREE(list->filter_str); - list->filter_str = g_strdup(val); - DEBUG_TRACE("list->filter_str = %s", list->filter_str); + break; + } + case MP_ARTIST_DETAIL_LIST_FILTER_STR:{ + char *val = va_arg((var_args), char *); + SAFE_FREE(list->filter_str); + list->filter_str = g_strdup(val); + DEBUG_TRACE("list->filter_str = %s", list->filter_str); - break; - } + break; + } default: DEBUG_TRACE("Invalid arguments"); @@ -1043,7 +1185,8 @@ void mp_artist_detail_list_set_data(MpArtistDetailList_t *list, ...) va_end(var_args); } -void mp_artist_detail_list_copy_data(MpArtistDetailList_t *src, MpArtistDetailList_t *dest) +void mp_artist_detail_list_copy_data(MpArtistDetailList_t * src, + MpArtistDetailList_t * dest) { MP_CHECK(src); MP_CHECK(dest); @@ -1054,4 +1197,3 @@ void mp_artist_detail_list_copy_data(MpArtistDetailList_t *src, MpArtistDetailLi SAFE_FREE(dest->filter_str); dest->filter_str = g_strdup(src->filter_str); } - diff --git a/src/widget/mp-artist-list.c b/src/widget/mp-artist-list.c index 4513184..ae92e5b 100644 --- a/src/widget/mp-artist-list.c +++ b/src/widget/mp-artist-list.c @@ -31,8 +31,9 @@ #define ARTIST_GRID_LAND_W 179 #define ARTIST_GRID_LAND_H 240 -static char * -_mp_artist_list_group_index_text_get(void *data, Evas_Object *obj, const char *part) +static char *_mp_artist_list_group_index_text_get(void *data, + Evas_Object * obj, + const char *part) { mp_list_item_data_t *item_data = data; MP_CHECK_NULL(item_data); @@ -42,7 +43,10 @@ _mp_artist_list_group_index_text_get(void *data, Evas_Object *obj, const char *p MpArtistList_t *list = evas_object_data_get(obj, "list_data"); MP_CHECK_NULL(list); - unsigned int count = mp_list_get_editable_count((MpList_t *)list, mp_list_get_edit_type((MpList_t *)list)); + unsigned int count = + mp_list_get_editable_count((MpList_t *) list, + mp_list_get_edit_type((MpList_t *) + list)); if (count == 1) { text = g_strdup(GET_STR(STR_MP_1_ARTIST)); @@ -55,15 +59,16 @@ _mp_artist_list_group_index_text_get(void *data, Evas_Object *obj, const char *p } static void -_mp_artist_list_add_to_playlist_cb(void *data, Evas_Object *obj, void *event_info) +_mp_artist_list_add_to_playlist_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; mp_edit_create_add_to_playlist_popup(data); return; } -static char * -_mp_artist_list_label_get(void *data, Evas_Object *obj, const char *part) +static char *_mp_artist_list_label_get(void *data, Evas_Object * obj, + const char *part) { char *name = NULL; int ret = 0; @@ -85,18 +90,24 @@ _mp_artist_list_label_get(void *data, Evas_Object *obj, const char *part) int album_count = 0; int song_count = 0; - mp_media_info_group_get_album_thumnail_paths(item->handle, &album_thumbs, &album_count); + mp_media_info_group_get_album_thumnail_paths(item->handle, + &album_thumbs, + &album_count); mp_media_info_group_get_track_count(item->handle, &song_count); char *sub_text = NULL; if (album_count == 1 && song_count == 1) { sub_text = g_strdup(GET_STR(STR_MP_1_ALBUM_1_SONG)); } else if (album_count == 1 && song_count > 1) { - sub_text = g_strdup_printf(GET_STR(STR_MP_1_ALBUM_PD_SONGS), song_count); + sub_text = + g_strdup_printf(GET_STR(STR_MP_1_ALBUM_PD_SONGS), + song_count); } else { - sub_text = g_strdup_printf(GET_STR(STR_MP_PD_ALBUMS_PD_SONGS), album_count, song_count); + sub_text = + g_strdup_printf(GET_STR(STR_MP_PD_ALBUMS_PD_SONGS), + album_count, song_count); } - return sub_text; + return sub_text; } return NULL; @@ -116,8 +127,9 @@ _mp_artist_list_more_btn_cb(void *data, Evas_Object *obj, void *event_info) } */ -static Evas_Object * -_mp_artist_list_album_icon_get(Evas_Object *obj, mp_list_item_data_t *item) +static Evas_Object *_mp_artist_list_album_icon_get(Evas_Object * obj, + mp_list_item_data_t * + item) { MP_CHECK_NULL(item); MP_CHECK_NULL(item->handle); @@ -132,9 +144,11 @@ _mp_artist_list_album_icon_get(Evas_Object *obj, mp_list_item_data_t *item) int icon_area_w = 78; int image_size = 68; int thumnail_max = 8; - char *path = NULL; + char *path = NULL; - mp_media_info_group_get_album_thumnail_paths(item->handle, &album_thumbs, &album_count); + mp_media_info_group_get_album_thumnail_paths(item->handle, + &album_thumbs, + &album_count); mp_media_info_group_get_track_count(item->handle, &song_count); for (i = 0; i < album_count; i++) { @@ -144,16 +158,18 @@ _mp_artist_list_album_icon_get(Evas_Object *obj, mp_list_item_data_t *item) } } - for (i = 0; i < album_count ; i++) { + for (i = 0; i < album_count; i++) { path = album_thumbs[i]; } - Evas_Object *icon = mp_util_create_lazy_update_thumb_icon(obj, path, image_size, image_size); + Evas_Object *icon = + mp_util_create_lazy_update_thumb_icon(obj, path, image_size, + image_size); return icon; } -Evas_Object * -_mp_artist_list_icon_get(void *data, Evas_Object *obj, const char *part) +Evas_Object *_mp_artist_list_icon_get(void *data, Evas_Object * obj, + const char *part) { Evas_Object *icon = NULL; @@ -166,10 +182,12 @@ _mp_artist_list_icon_get(void *data, Evas_Object *obj, const char *part) Evas_Object *content = NULL; if (item->display_mode == MP_LIST_DISPLAY_MODE_NORMAL) { - if (!strcmp(part, "elm.icon.1") || !strcmp(part, "elm.swallow.icon")) { + if (!strcmp(part, "elm.icon.1") + || !strcmp(part, "elm.swallow.icon")) { content = elm_layout_add(obj); Evas_Object *icon = _mp_artist_list_album_icon_get(obj, item); - elm_layout_theme_set(content, "layout", "list/B/music.type.1", "default"); + elm_layout_theme_set(content, "layout", "list/B/music.type.1", + "default"); elm_layout_content_set(content, "elm.swallow.content", icon); return content; @@ -183,9 +201,11 @@ _mp_artist_list_icon_get(void *data, Evas_Object *obj, const char *part) button = elm_button_add(obj); elm_object_style_set(button, "sweep"); /*elm_object_text_set(button, GET_STR(STR_MP_ADD_TO)); - mp_language_mgr_register_object(button, OBJ_TYPE_ELM_OBJECT, NULL, STR_MP_ADD_TO);*/ + mp_language_mgr_register_object(button, OBJ_TYPE_ELM_OBJECT, NULL, STR_MP_ADD_TO); */ mp_util_domain_translatable_text_set(button, STR_MP_ADD_TO); - evas_object_smart_callback_add(button, "clicked", _mp_artist_list_add_to_playlist_cb, list); + evas_object_smart_callback_add(button, "clicked", + _mp_artist_list_add_to_playlist_cb, + list); return button; } @@ -195,7 +215,9 @@ _mp_artist_list_icon_get(void *data, Evas_Object *obj, const char *part) check = elm_check_add(obj); elm_object_style_set(check, "default"); evas_object_propagate_events_set(check, EINA_FALSE); - evas_object_smart_callback_add(check, "changed", mp_common_view_check_changed_cb, NULL); + evas_object_smart_callback_add(check, "changed", + mp_common_view_check_changed_cb, + NULL); elm_check_state_pointer_set(check, &item->checked); return check; @@ -204,8 +226,7 @@ _mp_artist_list_icon_get(void *data, Evas_Object *obj, const char *part) return icon; } -static void -_mp_artist_list_item_del_cb(void *data, Evas_Object *obj) +static void _mp_artist_list_item_del_cb(void *data, Evas_Object * obj) { mp_list_item_data_t *item_data = data; MP_CHECK(item_data); @@ -217,10 +238,10 @@ _mp_artist_list_item_del_cb(void *data, Evas_Object *obj) static void _mp_artist_select_cb(void *data, Evas_Object * obj, void *event_info) { - MpArtistList_t *list = (MpArtistList_t *)data; + MpArtistList_t *list = (MpArtistList_t *) data; eventfunc; int ret = 0; - int index = 0;/*(int)data;*/ + int index = 0; /*(int)data; */ char *name = NULL; char *thumbnail = NULL; @@ -229,7 +250,7 @@ _mp_artist_select_cb(void *data, Evas_Object * obj, void *event_info) MP_CHECK(list); if (list->display_mode == MP_LIST_DISPLAY_MODE_THUMBNAIL) { elm_gengrid_item_selected_set(gli, EINA_FALSE); - /*temp update item to avoid blue check in checkbox*/ + /*temp update item to avoid blue check in checkbox */ elm_gengrid_item_update(gli); } else { elm_genlist_item_selected_set(gli, EINA_FALSE); @@ -240,9 +261,10 @@ _mp_artist_select_cb(void *data, Evas_Object * obj, void *event_info) index = gli_data->index; if (index >= 0) { - /*item_handle = mp_media_info_group_list_nth_item(gli_data->handle, index);*/ + /*item_handle = mp_media_info_group_list_nth_item(gli_data->handle, index); */ ret = mp_media_info_group_get_main_info(gli_data->handle, &name); - mp_media_info_group_get_thumbnail_path(gli_data->handle, &thumbnail); + mp_media_info_group_get_thumbnail_path(gli_data->handle, + &thumbnail); mp_retm_if(ret != 0, "Fail to get value"); mp_retm_if(name == NULL, "Fail to get value"); } @@ -250,46 +272,56 @@ _mp_artist_select_cb(void *data, Evas_Object * obj, void *event_info) if (list->function_type == MP_LIST_FUNC_ADD_TRACK) { MpViewMgr_t *view_manager = mp_view_mgr_get_view_manager(); MP_CHECK(view_manager); - MpSelectTrackView_t *view_select_track = mp_select_track_view_create(view_manager->navi); + MpSelectTrackView_t *view_select_track = + mp_select_track_view_create(view_manager->navi); MP_CHECK(view_select_track); - mp_view_mgr_push_view(view_manager, (MpView_t *)view_select_track, NULL); - - mp_view_set_title((MpView_t *)view_select_track, STR_MP_TILTE_SELECT_ITEM); - mp_track_list_set_data((MpTrackList_t *)view_select_track->content_to_show, MP_TRACK_LIST_TYPE, MP_TRACK_BY_ARTIST, MP_TRACK_LIST_TYPE_STR, name, -1); + mp_view_mgr_push_view(view_manager, (MpView_t *) view_select_track, + NULL); + + mp_view_set_title((MpView_t *) view_select_track, + STR_MP_TILTE_SELECT_ITEM); + mp_track_list_set_data((MpTrackList_t *) view_select_track-> + content_to_show, MP_TRACK_LIST_TYPE, + MP_TRACK_BY_ARTIST, MP_TRACK_LIST_TYPE_STR, + name, -1); mp_list_update(view_select_track->content_to_show); - mp_view_update_options((MpView_t *)view_select_track); + mp_view_update_options((MpView_t *) view_select_track); mp_list_set_edit(view_select_track->content_to_show, TRUE); - mp_list_view_set_cancel_btn((MpListView_t *)view_select_track, true); - mp_list_view_set_done_btn((MpListView_t *)view_select_track, true, MP_DONE_SELECT_ADD_TRACK_TYPE); - mp_list_view_set_select_all((MpListView_t *)view_select_track, TRUE); + mp_list_view_set_cancel_btn((MpListView_t *) view_select_track, + true); + mp_list_view_set_done_btn((MpListView_t *) view_select_track, true, + MP_DONE_SELECT_ADD_TRACK_TYPE); + mp_list_view_set_select_all((MpListView_t *) view_select_track, + TRUE); return; } if (list->edit_mode) { - mp_list_edit_mode_sel((MpList_t *)list, gli_data); + mp_list_edit_mode_sel((MpList_t *) list, gli_data); MpViewMgr_t *view_mgr = mp_view_mgr_get_view_manager(); MpView_t *view = mp_view_mgr_get_top_view(view_mgr); ERROR_TRACE("update options of edit view"); - mp_view_update_options_edit((MpView_t *)view); + mp_view_update_options_edit((MpView_t *) view); return; } /* create the view of album detail */ MpViewMgr_t *view_manager = mp_view_mgr_get_view_manager(); MP_CHECK(view_manager); - MpArtistDetailView_t *view_artist_detail = mp_artist_detail_view_create(view_manager->navi, name, thumbnail); + MpArtistDetailView_t *view_artist_detail = + mp_artist_detail_view_create(view_manager->navi, name, thumbnail); MP_CHECK(view_artist_detail); - mp_view_mgr_push_view(view_manager, (MpView_t *)view_artist_detail, NULL); - mp_view_update_options((MpView_t *)view_artist_detail); - mp_view_set_title((MpView_t *)view_artist_detail, name); + mp_view_mgr_push_view(view_manager, (MpView_t *) view_artist_detail, + NULL); + mp_view_update_options((MpView_t *) view_artist_detail); + mp_view_set_title((MpView_t *) view_artist_detail, name); } -static void -_mp_artist_list_append_group_index_item(void *thiz) +static void _mp_artist_list_append_group_index_item(void *thiz) { - MpArtistList_t *list = (MpArtistList_t *)thiz; + MpArtistList_t *list = (MpArtistList_t *) thiz; MP_CHECK(list); MP_CHECK(list->genlist); @@ -297,14 +329,20 @@ _mp_artist_list_append_group_index_item(void *thiz) list->itc_group_index = elm_genlist_item_class_new(); MP_CHECK(list->itc_group_index); list->itc_group_index->item_style = "music/groupindex.sub"; - list->itc_group_index->func.text_get = _mp_artist_list_group_index_text_get; + list->itc_group_index->func.text_get = + _mp_artist_list_group_index_text_get; list->itc_group_index->func.del = _mp_artist_list_item_del_cb; } - mp_list_item_data_t *item_data = mp_list_item_data_create(MP_LIST_ITEM_TYPE_GROUP_TITLE); + mp_list_item_data_t *item_data = + mp_list_item_data_create(MP_LIST_ITEM_TYPE_GROUP_TITLE); MP_CHECK(item_data); - item_data->it = list->group_it = elm_genlist_item_append(list->genlist, list->itc_group_index, item_data, NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL); - elm_genlist_item_select_mode_set(list->group_it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + item_data->it = list->group_it = + elm_genlist_item_append(list->genlist, list->itc_group_index, + item_data, NULL, ELM_GENLIST_ITEM_GROUP, + NULL, NULL); + elm_genlist_item_select_mode_set(list->group_it, + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); } void mp_artist_list_show_group_index(void *thiz, bool show) @@ -314,7 +352,8 @@ void mp_artist_list_show_group_index(void *thiz, bool show) MpArtistList_t *list = thiz; MP_CHECK(list->genlist); - DEBUG_TRACE("show group index: %d list->group_it: %0x", show, list->group_it); + DEBUG_TRACE("show group index: %d list->group_it: %0x", show, + list->group_it); if (show) { _mp_artist_list_append_group_index_item(list); } else if (list->group_it) { @@ -328,7 +367,7 @@ static void _mp_artist_list_load_list(void *thiz, int count) MpArtistList_t *list = thiz; MP_CHECK(list); - /*media-svc related*/ + /*media-svc related */ mp_media_list_h svc_handle; gint index = 0; int ret = 0; @@ -339,7 +378,10 @@ static void _mp_artist_list_load_list(void *thiz, int count) goto END; } - ret = mp_media_info_group_list_create(&svc_handle, MP_GROUP_BY_ARTIST, list->type_str, list->filter_str, 0, count); + ret = + mp_media_info_group_list_create(&svc_handle, MP_GROUP_BY_ARTIST, + list->type_str, list->filter_str, + 0, count); if (ret != 0) { DEBUG_TRACE("Fail to get items"); @@ -361,7 +403,9 @@ static void _mp_artist_list_load_list(void *thiz, int count) item = mp_media_info_group_list_nth_item(svc_handle, index); if (!item) { - DEBUG_TRACE("Fail to mp_media_info_group_list_nth_item, ret[%d], index[%d]", ret, index); + DEBUG_TRACE + ("Fail to mp_media_info_group_list_nth_item, ret[%d], index[%d]", + ret, index); goto END; } mp_media_info_group_get_main_info(item, &title); @@ -373,21 +417,28 @@ static void _mp_artist_list_load_list(void *thiz, int count) item_data->group_type = list->group_type; item_data->index = index; item_data->display_mode = list->display_mode; - item_data->checked = mp_list_is_in_checked_path_list(list->checked_path_list, title); + item_data->checked = + mp_list_is_in_checked_path_list(list->checked_path_list, + title); Elm_Object_Item *parent_group = NULL; if (MP_LIST_OBJ_IS_GENGRID(list->genlist)) { - list_item = elm_gengrid_item_append(list->genlist, list->gengrid_itc, item_data, - _mp_artist_select_cb, (void *)list); + list_item = + elm_gengrid_item_append(list->genlist, list->gengrid_itc, + item_data, _mp_artist_select_cb, + (void *) list); } else { - list_item = elm_genlist_item_append(list->genlist, list->itc, item_data, parent_group, - ELM_GENLIST_ITEM_NONE, _mp_artist_select_cb, list); + list_item = + elm_genlist_item_append(list->genlist, list->itc, + item_data, parent_group, + ELM_GENLIST_ITEM_NONE, + _mp_artist_select_cb, list); } item_data->it = list_item; } -END: + END: endfunc; } @@ -431,7 +482,8 @@ static mp_group_type_e _mp_artist_list_get_group_type(void *thiz) } static void -_mp_artist_list_item_highlighted_cb(void *data, Evas_Object *obj, void *event_info) +_mp_artist_list_item_highlighted_cb(void *data, Evas_Object * obj, + void *event_info) { MpArtistList_t *list = data; MP_CHECK(list); @@ -440,14 +492,16 @@ _mp_artist_list_item_highlighted_cb(void *data, Evas_Object *obj, void *event_in Elm_Object_Item *item = event_info; MP_CHECK(item); - Evas_Object *layout = elm_object_item_part_content_get(item, "elm.icon"); + Evas_Object *layout = + elm_object_item_part_content_get(item, "elm.icon"); if (layout) { elm_object_signal_emit(layout, "elm,state,selected", "elm"); } } static void -_mp_artist_list_item_unhighlighted_cb(void *data, Evas_Object *obj, void *event_info) +_mp_artist_list_item_unhighlighted_cb(void *data, Evas_Object * obj, + void *event_info) { MpArtistList_t *list = data; MP_CHECK(list); @@ -456,34 +510,37 @@ _mp_artist_list_item_unhighlighted_cb(void *data, Evas_Object *obj, void *event_ Elm_Object_Item *item = event_info; MP_CHECK(item); - Evas_Object *layout = elm_object_item_part_content_get(item, "elm.icon"); + Evas_Object *layout = + elm_object_item_part_content_get(item, "elm.icon"); if (layout) { elm_object_signal_emit(layout, "elm,state,unselected", "elm"); } } -static void -_mp_artist_list_genlist_create(MpArtistList_t *list) +static void _mp_artist_list_genlist_create(MpArtistList_t * list) { startfunc; MP_CHECK(list); - /*create new genlist*/ + /*create new genlist */ mp_evas_object_del(list->genlist); - /*create new genlist*/ + /*create new genlist */ list->genlist = mp_widget_genlist_create(list->box); MP_CHECK(list->genlist); - elm_scroller_policy_set(list->genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); - evas_object_size_hint_weight_set(list->genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(list->genlist, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_scroller_policy_set(list->genlist, ELM_SCROLLER_POLICY_OFF, + ELM_SCROLLER_POLICY_AUTO); + evas_object_size_hint_weight_set(list->genlist, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(list->genlist, EVAS_HINT_FILL, + EVAS_HINT_FILL); elm_genlist_homogeneous_set(list->genlist, EINA_TRUE); elm_genlist_mode_set(list->genlist, ELM_LIST_COMPRESS); evas_object_show(list->genlist); - /*packet genlist to box*/ + /*packet genlist to box */ elm_box_pack_end(list->box, list->genlist); - /*add long press callback*/ - /*evas_object_smart_callback_add(list->genlist, "longpressed", _mp_artist_list_item_longpressed_cb, list);*/ + /*add long press callback */ + /*evas_object_smart_callback_add(list->genlist, "longpressed", _mp_artist_list_item_longpressed_cb, list); */ evas_object_data_set(list->genlist, "list_data", list); if (!list->itc) { @@ -498,23 +555,33 @@ _mp_artist_list_genlist_create(MpArtistList_t *list) list->itc->func.del = _mp_artist_list_item_del_cb; } - evas_object_smart_callback_add(list->genlist, "drag,start,left", list->flick_left_cb, NULL); - evas_object_smart_callback_add(list->genlist, "drag,start,right", list->flick_right_cb, NULL); - evas_object_smart_callback_add(list->genlist, "drag,stop", list->flick_stop_cb, NULL); - - evas_object_smart_callback_add(list->genlist, "drag,start,right", list->mode_right_cb, NULL); - evas_object_smart_callback_add(list->genlist, "drag,start,left", list->mode_left_cb, NULL); - evas_object_smart_callback_add(list->genlist, "drag,start,up", list->mode_cancel_cb, NULL); - evas_object_smart_callback_add(list->genlist, "drag,start,down", list->mode_cancel_cb, NULL); - - evas_object_smart_callback_add(list->genlist, "highlighted", _mp_artist_list_item_highlighted_cb, list); - evas_object_smart_callback_add(list->genlist, "unhighlighted", _mp_artist_list_item_unhighlighted_cb, list); + evas_object_smart_callback_add(list->genlist, "drag,start,left", + list->flick_left_cb, NULL); + evas_object_smart_callback_add(list->genlist, "drag,start,right", + list->flick_right_cb, NULL); + evas_object_smart_callback_add(list->genlist, "drag,stop", + list->flick_stop_cb, NULL); + + evas_object_smart_callback_add(list->genlist, "drag,start,right", + list->mode_right_cb, NULL); + evas_object_smart_callback_add(list->genlist, "drag,start,left", + list->mode_left_cb, NULL); + evas_object_smart_callback_add(list->genlist, "drag,start,up", + list->mode_cancel_cb, NULL); + evas_object_smart_callback_add(list->genlist, "drag,start,down", + list->mode_cancel_cb, NULL); + + evas_object_smart_callback_add(list->genlist, "highlighted", + _mp_artist_list_item_highlighted_cb, + list); + evas_object_smart_callback_add(list->genlist, "unhighlighted", + _mp_artist_list_item_unhighlighted_cb, + list); endfunc; } -static void -_mp_artist_list_set_grid_style(MpArtistList_t *list) +static void _mp_artist_list_set_grid_style(MpArtistList_t * list) { bool landscape = mp_util_is_landscape(); @@ -526,32 +593,33 @@ _mp_artist_list_set_grid_style(MpArtistList_t *list) int w; int h; if (landscape) { - w = (int)(ARTIST_GRID_LAND_W * scale); - h = (int)(ARTIST_GRID_LAND_H * scale); + w = (int) (ARTIST_GRID_LAND_W * scale); + h = (int) (ARTIST_GRID_LAND_H * scale); } else { - w = (int)(ARTIST_GRID_W * scale); - h = (int)(ARTIST_GRID_H * scale); + w = (int) (ARTIST_GRID_W * scale); + h = (int) (ARTIST_GRID_H * scale); } elm_gengrid_item_size_set(list->genlist, w, h); } -static void -_mp_artist_list_gengrid_create(MpArtistList_t *list) +static void _mp_artist_list_gengrid_create(MpArtistList_t * list) { startfunc; MP_CHECK(list); - /*create new genlist*/ + /*create new genlist */ mp_evas_object_del(list->genlist); list->genlist = elm_gengrid_add(list->box); MP_CHECK(list->genlist); - evas_object_size_hint_weight_set(list->genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(list->genlist, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(list->genlist, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(list->genlist, EVAS_HINT_FILL, + EVAS_HINT_FILL); evas_object_show(list->genlist); MP_LIST_OBJ_SET_AS_GENGRID(list->genlist); - /*packet genlist to box*/ + /*packet genlist to box */ elm_box_pack_end(list->box, list->genlist); if (!list->gengrid_itc) { @@ -565,9 +633,13 @@ _mp_artist_list_gengrid_create(MpArtistList_t *list) _mp_artist_list_set_grid_style(list); elm_gengrid_align_set(list->genlist, 0.5, 0.0); - evas_object_smart_callback_add(list->genlist, "highlighted", _mp_artist_list_item_highlighted_cb, list); - evas_object_smart_callback_add(list->genlist, "unhighlighted", _mp_artist_list_item_unhighlighted_cb, list); - /*evas_object_smart_callback_add(list->genlist, "longpressed", _mp_artist_list_item_longpressed_cb, list);*/ + evas_object_smart_callback_add(list->genlist, "highlighted", + _mp_artist_list_item_highlighted_cb, + list); + evas_object_smart_callback_add(list->genlist, "unhighlighted", + _mp_artist_list_item_unhighlighted_cb, + list); + /*evas_object_smart_callback_add(list->genlist, "longpressed", _mp_artist_list_item_longpressed_cb, list); */ endfunc; } @@ -583,11 +655,14 @@ void _mp_artist_list_update(void *thiz) struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); - res = mp_media_info_group_list_count(MP_GROUP_BY_ARTIST, NULL, list->filter_str, &count); + res = + mp_media_info_group_list_count(MP_GROUP_BY_ARTIST, NULL, + list->filter_str, &count); MP_CHECK(res == 0); mp_list_free_checked_path_list(list->checked_path_list); - list->checked_path_list = mp_list_get_checked_path_list((MpList_t *)list); + list->checked_path_list = + mp_list_get_checked_path_list((MpList_t *) list); mp_evas_object_del(list->genlist); mp_evas_object_del(list->no_content); @@ -602,14 +677,16 @@ void _mp_artist_list_update(void *thiz) evas_object_data_set(list->genlist, "list_handle", list); if (ad->del_cb_invoked == 0) { - mp_list_bottom_counter_item_append((MpList_t *)list); + mp_list_bottom_counter_item_append((MpList_t *) list); } /* load list */ _mp_artist_list_load_list(thiz, count); list->show_fastscroll(list); } else { - list->no_content = mp_widget_create_no_contents(list->box , MP_NOCONTENT_ARTISTS, NULL, list); + list->no_content = + mp_widget_create_no_contents(list->box, MP_NOCONTENT_ARTISTS, + NULL, list); list->hide_fastscroll(list); elm_box_pack_end(list->box, list->no_content); @@ -620,7 +697,8 @@ void _mp_artist_list_update(void *thiz) void _mp_artist_list_rotate(void *thiz) { MpArtistList_t *list = thiz; - if (mp_list_get_display_mode((MpList_t *)list) == MP_LIST_DISPLAY_MODE_THUMBNAIL) { + if (mp_list_get_display_mode((MpList_t *) list) == + MP_LIST_DISPLAY_MODE_THUMBNAIL) { _mp_artist_list_set_grid_style(list); } if (list->genlist) { @@ -634,7 +712,7 @@ static const char *_get_label(void *thiz, void *event_info) MP_CHECK_NULL(list); char *title = NULL; - mp_list_item_data_t *artist = elm_object_item_data_get(event_info); + mp_list_item_data_t *artist = elm_object_item_data_get(event_info); MP_CHECK_NULL(artist); mp_media_info_group_get_main_info(artist->handle, &title); @@ -646,7 +724,10 @@ static char *_mp_artist_list_bottom_counter_text_cb(void *thiz) MpArtistList_t *list = thiz; MP_CHECK_NULL(list); - unsigned int count = mp_list_get_editable_count((MpList_t *)list, mp_list_get_edit_type((MpList_t *)list)); + unsigned int count = + mp_list_get_editable_count((MpList_t *) list, + mp_list_get_edit_type((MpList_t *) + list)); char *text = NULL; if (count == 1) { @@ -678,9 +759,13 @@ _mp_artist_list_get_count(void *thiz, MpListEditType_e type) MpArtistList_t *list = thiz; MP_CHECK_VAL(list->genlist, 0); - int count = MP_LIST_OBJ_IS_GENGRID(list->genlist) ? elm_gengrid_items_count(list->genlist) : elm_genlist_items_count(list->genlist); + int count = + MP_LIST_OBJ_IS_GENGRID(list-> + genlist) ? elm_gengrid_items_count(list-> + genlist) + : elm_genlist_items_count(list->genlist); - if (list->group_it) { /*group index*/ + if (list->group_it) { /*group index */ --count; } @@ -691,7 +776,7 @@ _mp_artist_list_get_count(void *thiz, MpListEditType_e type) return count; } -MpArtistList_t *mp_artist_list_create(Evas_Object *parent) +MpArtistList_t *mp_artist_list_create(Evas_Object * parent) { eventfunc; MP_CHECK_NULL(parent); @@ -699,7 +784,7 @@ MpArtistList_t *mp_artist_list_create(Evas_Object *parent) MpArtistList_t *list = calloc(1, sizeof(MpArtistList_t)); MP_CHECK_NULL(list); - mp_list_init((MpList_t *)list, parent, MP_LIST_TYPE_GROUP); + mp_list_init((MpList_t *) list, parent, MP_LIST_TYPE_GROUP); list->update = _mp_artist_list_update; list->destory_cb = _mp_artist_list_destory_cb; @@ -709,7 +794,8 @@ MpArtistList_t *mp_artist_list_create(Evas_Object *parent) list->display_mode_changable = true; - list->bottom_counter_text_get_cb = _mp_artist_list_bottom_counter_text_cb; + list->bottom_counter_text_get_cb = + _mp_artist_list_bottom_counter_text_cb; list->set_edit_default = list->set_edit; list->set_edit = _mp_artist_list_set_edit; @@ -719,7 +805,7 @@ MpArtistList_t *mp_artist_list_create(Evas_Object *parent) return list; } -void mp_artist_list_set_data(MpArtistList_t *list, ...) +void mp_artist_list_set_data(MpArtistList_t * list, ...) { startfunc; MP_CHECK(list); @@ -732,45 +818,46 @@ void mp_artist_list_set_data(MpArtistList_t *list, ...) field = va_arg(var_args, int); switch (field) { - case MP_ARTIST_LIST_TYPE: { - int val = va_arg((var_args), int); - - list->group_type = val; - DEBUG_TRACE("list->group_type = %d", list->group_type); - break; - } - - case MP_ARTIST_LIST_FUNC: { - int val = va_arg((var_args), int); - - list->function_type = val; - DEBUG_TRACE("list->function_type = %d", list->function_type); - break; - } - - case MP_ARTIST_LIST_TYPE_STR: { - char *val = va_arg((var_args), char *); - SAFE_FREE(list->type_str); - list->type_str = g_strdup(val); - DEBUG_TRACE("list->type_str = %s", list->type_str); - - break; - } - case MP_ARTIST_LIST_FILTER_STR: { - char *val = va_arg((var_args), char *); - SAFE_FREE(list->filter_str); - list->filter_str = g_strdup(val); - DEBUG_TRACE("list->filter_str = %s", list->filter_str); - - break; - } - - case MP_ARTIST_LIST_DISPLAY_MODE: { - int val = va_arg((var_args), int); - list->display_mode = val; - DEBUG_TRACE("list->display_mode = %d", list->display_mode); - break; - } + case MP_ARTIST_LIST_TYPE:{ + int val = va_arg((var_args), int); + + list->group_type = val; + DEBUG_TRACE("list->group_type = %d", list->group_type); + break; + } + + case MP_ARTIST_LIST_FUNC:{ + int val = va_arg((var_args), int); + + list->function_type = val; + DEBUG_TRACE("list->function_type = %d", + list->function_type); + break; + } + + case MP_ARTIST_LIST_TYPE_STR:{ + char *val = va_arg((var_args), char *); + SAFE_FREE(list->type_str); + list->type_str = g_strdup(val); + DEBUG_TRACE("list->type_str = %s", list->type_str); + + break; + } + case MP_ARTIST_LIST_FILTER_STR:{ + char *val = va_arg((var_args), char *); + SAFE_FREE(list->filter_str); + list->filter_str = g_strdup(val); + DEBUG_TRACE("list->filter_str = %s", list->filter_str); + + break; + } + + case MP_ARTIST_LIST_DISPLAY_MODE:{ + int val = va_arg((var_args), int); + list->display_mode = val; + DEBUG_TRACE("list->display_mode = %d", list->display_mode); + break; + } default: DEBUG_TRACE("Invalid arguments"); @@ -781,7 +868,7 @@ void mp_artist_list_set_data(MpArtistList_t *list, ...) va_end(var_args); } -void mp_artist_list_copy_data(MpArtistList_t *src, MpArtistList_t *dest) +void mp_artist_list_copy_data(MpArtistList_t * src, MpArtistList_t * dest) { MP_CHECK(src); MP_CHECK(dest); diff --git a/src/widget/mp-ctxpopup.c b/src/widget/mp-ctxpopup.c index 1a2b122..8995f54 100644 --- a/src/widget/mp-ctxpopup.c +++ b/src/widget/mp-ctxpopup.c @@ -29,7 +29,7 @@ #include "mp-widget.h" -static void _dismissed_cb(void *data, Evas_Object *obj, void *event_info) +static void _dismissed_cb(void *data, Evas_Object * obj, void *event_info) { DEBUG_TRACE(""); @@ -39,17 +39,18 @@ static void _dismissed_cb(void *data, Evas_Object *obj, void *event_info) evas_object_smart_callback_del(data, "dismissed", _dismissed_cb); } -static void _move_ctxpopup(Evas_Object *ctxpopup, Evas_Object *btn) +static void _move_ctxpopup(Evas_Object * ctxpopup, Evas_Object * btn) { DEBUG_TRACE(""); - Evas_Coord x, y, w , h; + Evas_Coord x, y, w, h; evas_object_geometry_get(btn, &x, &y, &w, &h); evas_object_move(ctxpopup, x + (w / 2), y + (h / 2)); } -Evas_Object * -_mp_ctxpopup_pv_share_create(Evas_Object *parent, void *user_data, struct appdata *ad) +Evas_Object *_mp_ctxpopup_pv_share_create(Evas_Object * parent, + void *user_data, + struct appdata *ad) { DEBUG_TRACE(""); @@ -57,26 +58,33 @@ _mp_ctxpopup_pv_share_create(Evas_Object *parent, void *user_data, struct appdat MP_CHECK_NULL(parent); Evas_Object *popup = elm_ctxpopup_add(GET_WINDOW()); - evas_object_smart_callback_add(popup, "dismissed", _dismissed_cb, popup); - elm_ctxpopup_direction_priority_set(popup, - ELM_CTXPOPUP_DIRECTION_DOWN, - ELM_CTXPOPUP_DIRECTION_LEFT, - ELM_CTXPOPUP_DIRECTION_UP, - ELM_CTXPOPUP_DIRECTION_RIGHT); + evas_object_smart_callback_add(popup, "dismissed", _dismissed_cb, + popup); + elm_ctxpopup_direction_priority_set(popup, ELM_CTXPOPUP_DIRECTION_DOWN, + ELM_CTXPOPUP_DIRECTION_LEFT, + ELM_CTXPOPUP_DIRECTION_UP, + ELM_CTXPOPUP_DIRECTION_RIGHT); #ifndef MP_FEATURE_DISABLE_MMS - mp_util_ctxpopup_item_append(popup, "IDS_COM_BODY_MESSAGE", NULL, mp_menu_ctxpopup_share_select_cb, user_data); + mp_util_ctxpopup_item_append(popup, "IDS_COM_BODY_MESSAGE", NULL, + mp_menu_ctxpopup_share_select_cb, + user_data); #endif - mp_util_ctxpopup_item_append(popup, "IDS_COM_BODY_EMAIL", NULL, mp_menu_ctxpopup_share_select_cb, user_data); - mp_util_ctxpopup_item_append(popup, "IDS_COM_BODY_BLUETOOTH", NULL, mp_menu_ctxpopup_share_select_cb, user_data); + mp_util_ctxpopup_item_append(popup, "IDS_COM_BODY_EMAIL", NULL, + mp_menu_ctxpopup_share_select_cb, + user_data); + mp_util_ctxpopup_item_append(popup, "IDS_COM_BODY_BLUETOOTH", NULL, + mp_menu_ctxpopup_share_select_cb, + user_data); _move_ctxpopup(popup, parent); evas_object_show(popup); return popup; } -Evas_Object * -_mp_ctxpopup_list_share_create(Evas_Object *parent, void *user_data, struct appdata *ad) +Evas_Object *_mp_ctxpopup_list_share_create(Evas_Object * parent, + void *user_data, + struct appdata * ad) { DEBUG_TRACE(""); @@ -84,17 +92,23 @@ _mp_ctxpopup_list_share_create(Evas_Object *parent, void *user_data, struct appd MP_CHECK_NULL(parent); Evas_Object *popup = elm_ctxpopup_add(GET_WINDOW()); - evas_object_smart_callback_add(popup, "dismissed", _dismissed_cb, popup); - elm_ctxpopup_direction_priority_set(popup, - ELM_CTXPOPUP_DIRECTION_DOWN, - ELM_CTXPOPUP_DIRECTION_LEFT, - ELM_CTXPOPUP_DIRECTION_UP, - ELM_CTXPOPUP_DIRECTION_RIGHT); - - mp_util_ctxpopup_item_append(popup, "IDS_COM_BODY_BLUETOOTH", NULL, mp_menu_ctxpopup_share_select_cb, user_data); - mp_util_ctxpopup_item_append(popup, "IDS_COM_BODY_EMAIL", NULL, mp_menu_ctxpopup_share_select_cb, user_data); + evas_object_smart_callback_add(popup, "dismissed", _dismissed_cb, + popup); + elm_ctxpopup_direction_priority_set(popup, ELM_CTXPOPUP_DIRECTION_DOWN, + ELM_CTXPOPUP_DIRECTION_LEFT, + ELM_CTXPOPUP_DIRECTION_UP, + ELM_CTXPOPUP_DIRECTION_RIGHT); + + mp_util_ctxpopup_item_append(popup, "IDS_COM_BODY_BLUETOOTH", NULL, + mp_menu_ctxpopup_share_select_cb, + user_data); + mp_util_ctxpopup_item_append(popup, "IDS_COM_BODY_EMAIL", NULL, + mp_menu_ctxpopup_share_select_cb, + user_data); #ifndef MP_FEATURE_DISABLE_MMS - mp_util_ctxpopup_item_append(popup, "IDS_COM_BODY_MESSAGE", NULL, mp_menu_ctxpopup_share_select_cb, user_data); + mp_util_ctxpopup_item_append(popup, "IDS_COM_BODY_MESSAGE", NULL, + mp_menu_ctxpopup_share_select_cb, + user_data); #endif _move_ctxpopup(popup, parent); evas_object_show(popup); @@ -102,14 +116,12 @@ _mp_ctxpopup_list_share_create(Evas_Object *parent, void *user_data, struct appd return popup; } -void -mp_ctxpopup_destroy(Evas_Object * popup) +void mp_ctxpopup_destroy(Evas_Object * popup) { mp_evas_object_del(popup); } -void -mp_ctxpopup_clear(Evas_Object * popup) +void mp_ctxpopup_clear(Evas_Object * popup) { DEBUG_TRACE(""); @@ -117,8 +129,8 @@ mp_ctxpopup_clear(Evas_Object * popup) elm_ctxpopup_clear(popup); } -Evas_Object * -mp_ctxpopup_create(Evas_Object *parent, int type, void *user_data, void *ad) +Evas_Object *mp_ctxpopup_create(Evas_Object * parent, int type, + void *user_data, void *ad) { DEBUG_TRACE(""); diff --git a/src/widget/mp-edit-playlist.c b/src/widget/mp-edit-playlist.c index c6e8a36..a14afb2 100644 --- a/src/widget/mp-edit-playlist.c +++ b/src/widget/mp-edit-playlist.c @@ -33,10 +33,10 @@ typedef struct _Item_Data { #define mp_edit_popup_set_popup_data(obj, data) evas_object_data_set((obj), "popup_data", (data)) static void -mp_edit_playlist_rename_done_cb(void *data, Evas_Object * obj, void *event_info); +mp_edit_playlist_rename_done_cb(void *data, Evas_Object * obj, + void *event_info); -static void -_mp_edit_playlist_destory(void * thiz) +static void _mp_edit_playlist_destory(void *thiz) { eventfunc; Mp_Playlist_Data *mp_playlist_data = thiz; @@ -57,7 +57,8 @@ _mp_edit_playlist_destory(void * thiz) } static void -_mp_edit_playlist_create_new_done_cb(void *data, Evas_Object * obj, void *event_info) +_mp_edit_playlist_create_new_done_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; Mp_Playlist_Data *mp_playlist_data = data; @@ -69,11 +70,14 @@ _mp_edit_playlist_create_new_done_cb(void *data, Evas_Object * obj, void *event_ //Evas_Object *entry = mp_widget_editfield_entry_get(view->editfiled_new_playlist); //const char *name = elm_entry_entry_get(entry); - const char *name = elm_entry_entry_get(mp_playlist_data->editfiled_entry); + const char *name = + elm_entry_entry_get(mp_playlist_data->editfiled_entry); if (name == NULL || strlen(name) == 0) { //name = elm_object_part_text_get(view->editfiled_new_playlist, "elm.guidetext"); - name = elm_object_part_text_get(mp_playlist_data->editfiled_entry, "elm.guide"); + name = + elm_object_part_text_get(mp_playlist_data->editfiled_entry, + "elm.guide"); } converted_name = elm_entry_markup_to_utf8(name); @@ -94,44 +98,51 @@ _mp_edit_playlist_create_new_done_cb(void *data, Evas_Object * obj, void *event_ if (mp_playlist_data->adding_list) { WARN_TRACE("adding list = %p", mp_playlist_data->adding_list); - mp_edit_cb_excute_add_to_playlist(mp_playlist_data->adding_list, plst_uid, converted_name, mp_playlist_data->add_to_selected); + mp_edit_cb_excute_add_to_playlist(mp_playlist_data->adding_list, + plst_uid, converted_name, + mp_playlist_data-> + add_to_selected); goto END; } if (mp_playlist_data->adding_media_id) { mp_media_info_h media_info = NULL; char *path = NULL; - mp_media_info_create(&media_info, mp_playlist_data->adding_media_id); + mp_media_info_create(&media_info, + mp_playlist_data->adding_media_id); mp_media_info_get_thumbnail_path(media_info, &path); - if (mp_media_info_playlist_add_item(playlist, mp_playlist_data->adding_media_id, path) == 0) { + if (mp_media_info_playlist_add_item + (playlist, mp_playlist_data->adding_media_id, path) == 0) { mp_media_info_playlist_db_update(playlist); } mp_media_info_destroy(media_info); } - //create playlist view MpViewMgr_t *view_mgr = mp_view_mgr_get_view_manager(); - MpPlaylistDetailView_t *view_plst_detail = mp_playlist_detail_view_create(view_mgr->navi, - MP_TRACK_BY_PLAYLIST, converted_name, plst_uid); - mp_view_mgr_push_view(view_mgr, (MpView_t *)view_plst_detail, NULL); + MpPlaylistDetailView_t *view_plst_detail = + mp_playlist_detail_view_create(view_mgr->navi, + MP_TRACK_BY_PLAYLIST, + converted_name, plst_uid); + mp_view_mgr_push_view(view_mgr, (MpView_t *) view_plst_detail, NULL); /*post event to update all-view in playlist detail view transition finished - A.push playlist detail view will give the zoom out effect - B.update all view will delete the gengrid and create new - since zoom out will cover the screen little by little, - there will give a phase of all view is blank which is called blink - temparory remove back key callback, to avoid quick back which transaction is not done case - back key callback will be added in playlist detail view transaction finished event handle routine - */ - eext_object_event_callback_del(view_mgr->navi, EEXT_CALLBACK_BACK, eext_naviframe_back_cb); + A.push playlist detail view will give the zoom out effect + B.update all view will delete the gengrid and create new + since zoom out will cover the screen little by little, + there will give a phase of all view is blank which is called blink + temparory remove back key callback, to avoid quick back which transaction is not done case + back key callback will be added in playlist detail view transaction finished event handle routine + */ + eext_object_event_callback_del(view_mgr->navi, EEXT_CALLBACK_BACK, + eext_naviframe_back_cb); - mp_view_update_options((MpView_t *)view_plst_detail); - mp_view_set_title((MpView_t *)view_plst_detail, converted_name); + mp_view_update_options((MpView_t *) view_plst_detail); + mp_view_set_title((MpView_t *) view_plst_detail, converted_name); -END: + END: mp_media_info_playlist_handle_destroy(playlist); IF_FREE(converted_name); @@ -139,12 +150,11 @@ END: _mp_edit_playlist_destory(mp_playlist_data); } -static void -_mp_edit_playlist_entry_eraser_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source) // When X marked button is clicked, empty entry's contents. +static void _mp_edit_playlist_entry_eraser_clicked_cb(void *data, Evas_Object * obj, const char *emission, const char *source) // When X marked button is clicked, empty entry's contents. { eventfunc; - Evas_Object *entry = (Evas_Object *)data; + Evas_Object *entry = (Evas_Object *) data; MP_CHECK(entry); elm_entry_entry_set(entry, ""); @@ -162,14 +172,18 @@ _mp_edit_playlist_entry_eraser_status_set(void *obj, void *data) if (elm_object_focus_get(editfield)) { if (elm_entry_is_empty(editfield)) { - elm_object_signal_emit(editfield, "elm,state,eraser,hide", "elm"); + elm_object_signal_emit(editfield, "elm,state,eraser,hide", + "elm"); if (mp_playlist_data->btn_ok) { - elm_object_disabled_set(mp_playlist_data->btn_ok, EINA_TRUE); + elm_object_disabled_set(mp_playlist_data->btn_ok, + EINA_TRUE); } } else { - elm_object_signal_emit(editfield, "elm,state,eraser,show", "elm"); + elm_object_signal_emit(editfield, "elm,state,eraser,show", + "elm"); if (mp_playlist_data->btn_ok) { - elm_object_disabled_set(mp_playlist_data->btn_ok, EINA_FALSE); + elm_object_disabled_set(mp_playlist_data->btn_ok, + EINA_FALSE); } } } @@ -213,7 +227,8 @@ static bool __mp_rename_ctrl_check_valid_text(const char *text, int *nLen) } static void -_mp_edit_playlist_entry_changed_cb(void *data, Evas_Object * obj, void *event_info) +_mp_edit_playlist_entry_changed_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; struct appdata *ad = mp_util_get_appdata(); @@ -228,14 +243,17 @@ _mp_edit_playlist_entry_changed_cb(void *data, Evas_Object * obj, void *event_in if (text) { int length = strlen(text); if (length > 0) { - elm_object_signal_emit(mp_playlist_data->layout, "image,enable,1", "*"); + elm_object_signal_emit(mp_playlist_data->layout, + "image,enable,1", "*"); } else { - elm_object_signal_emit(mp_playlist_data->layout, "image,disable,1", "*"); + elm_object_signal_emit(mp_playlist_data->layout, + "image,disable,1", "*"); } } _mp_edit_playlist_entry_eraser_status_set(editfield, data); - char *name = (char *)elm_entry_entry_get(mp_playlist_data->editfiled_entry); + char *name = + (char *) elm_entry_entry_get(mp_playlist_data->editfiled_entry); char *szFileName = elm_entry_markup_to_utf8(name); if (!szFileName) { return; @@ -249,7 +267,7 @@ _mp_edit_playlist_entry_changed_cb(void *data, Evas_Object * obj, void *event_in return; } - char * popup_txt = "Invalid Character"; + char *popup_txt = "Invalid Character"; if (!__mp_rename_ctrl_check_valid_text(szFileName, &nDstLen)) { elm_object_disabled_set(mp_playlist_data->btn_ok, TRUE); if (strlen(szFileName) == 1) { @@ -260,12 +278,17 @@ _mp_edit_playlist_entry_changed_cb(void *data, Evas_Object * obj, void *event_in IF_FREE(text); return; } else { - int position = elm_entry_cursor_pos_get(mp_playlist_data->editfiled_entry); + int position = + elm_entry_cursor_pos_get(mp_playlist_data-> + editfiled_entry); ERROR_TRACE("THE cursor position is %d", position); elm_entry_cursor_begin_set(mp_playlist_data->editfiled_entry); - elm_entry_entry_set(mp_playlist_data->editfiled_entry, elm_entry_utf8_to_markup(mp_playlist_data->oldname)); + elm_entry_entry_set(mp_playlist_data->editfiled_entry, + elm_entry_utf8_to_markup(mp_playlist_data-> + oldname)); elm_entry_cursor_begin_set(mp_playlist_data->editfiled_entry); - elm_entry_cursor_pos_set(mp_playlist_data->editfiled_entry, position - 1); + elm_entry_cursor_pos_set(mp_playlist_data->editfiled_entry, + position - 1); mp_util_post_status_message(ad, popup_txt); IF_FREE(text); IF_FREE(szFileName); @@ -285,7 +308,8 @@ _mp_edit_playlist_entry_changed_cb(void *data, Evas_Object * obj, void *event_in } else { if (mp_playlist_data->editfiled_entry != NULL) { IF_FREE(mp_playlist_data->new_playlist_name); - mp_playlist_data->new_playlist_name = elm_entry_markup_to_utf8(name); + mp_playlist_data->new_playlist_name = + elm_entry_markup_to_utf8(name); } } @@ -295,18 +319,21 @@ _mp_edit_playlist_entry_changed_cb(void *data, Evas_Object * obj, void *event_in if (mp_playlist_data->set_to_end) { mp_ecore_idler_del(mp_playlist_data->set_line_end_idler); - mp_playlist_data->set_line_end_idler = ecore_idler_add(_mp_edit_playlist_entry_set_line_end, data); + mp_playlist_data->set_line_end_idler = + ecore_idler_add(_mp_edit_playlist_entry_set_line_end, data); } IF_FREE(szFileName); IF_FREE(text); } -static char * -_mp_edit_playlist_get_new_playlist_name(void) +static char *_mp_edit_playlist_get_new_playlist_name(void) { char unique_name[MP_PLAYLIST_NAME_SIZE] = "\0"; int ret = 0; - ret = mp_media_info_playlist_unique_name(GET_STR(STR_MP_MY_PLAYLIST), unique_name, MP_PLAYLIST_NAME_SIZE); + ret = + mp_media_info_playlist_unique_name(GET_STR(STR_MP_MY_PLAYLIST), + unique_name, + MP_PLAYLIST_NAME_SIZE); if (ret == 0) { if (strlen(unique_name) <= 0) { ERROR_TRACE("playlist name is NULL"); @@ -315,14 +342,16 @@ _mp_edit_playlist_get_new_playlist_name(void) return g_strdup(unique_name); } } else { - ERROR_TRACE("fail to mp_media_info_playlist_unique_name() : error code [%x] ", ret); + ERROR_TRACE + ("fail to mp_media_info_playlist_unique_name() : error code [%x] ", + ret); return NULL; } return NULL; } -static void _mp_edit_playlist_entry_focused_cb(void *data, Evas_Object *obj, void *event_info) // Focused callback will show X marked button and hide rename icon. +static void _mp_edit_playlist_entry_focused_cb(void *data, Evas_Object * obj, void *event_info) // Focused callback will show X marked button and hide rename icon. { eventfunc; @@ -343,7 +372,7 @@ static void _mp_edit_playlist_entry_focused_cb(void *data, Evas_Object *obj, voi } } -static void _mp_edit_playlist_entry_unfocused_cb(void *data, Evas_Object *obj, void *event_info) // Unfocused callback will show rename icon and hide X marked button. +static void _mp_edit_playlist_entry_unfocused_cb(void *data, Evas_Object * obj, void *event_info) // Unfocused callback will show rename icon and hide X marked button. { eventfunc; @@ -355,28 +384,30 @@ static void _mp_edit_playlist_entry_unfocused_cb(void *data, Evas_Object *obj, v } static void -_mp_create_plst_entry_maxlength_reached_cb(void *data, Evas_Object * obj, void *event_info) +_mp_create_plst_entry_maxlength_reached_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; mp_popup_max_length(obj, STR_NH_COM_POPUP_CHARACTERS_MAXNUM_REACHED); } static void -_mp_search_edit_cancel_button_clicked(void *data, Evas_Object *o, const char *emission, const char *source) +_mp_search_edit_cancel_button_clicked(void *data, Evas_Object * o, + const char *emission, + const char *source) { Evas_Object *en = (Evas_Object *) data; elm_object_text_set(en, ""); } -Evas_Object * -_mp_edit_playlist_create_editfield(void *thiz) +Evas_Object *_mp_edit_playlist_create_editfield(void *thiz) { startfunc; struct appdata *ad = mp_util_get_appdata(); MP_CHECK_NULL(ad); - Mp_Playlist_Data *mp_playlist_data = (Mp_Playlist_Data *)thiz; + Mp_Playlist_Data *mp_playlist_data = (Mp_Playlist_Data *) thiz; MP_CHECK_NULL(mp_playlist_data); MP_CHECK_NULL(mp_playlist_data->popup); @@ -385,42 +416,63 @@ _mp_edit_playlist_create_editfield(void *thiz) Evas_Object *entry = elm_entry_add(mp_playlist_data->layout); MP_CHECK_NULL(entry); elm_entry_scrollable_set(entry, EINA_TRUE); - elm_scroller_policy_set(entry, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); + elm_scroller_policy_set(entry, ELM_SCROLLER_POLICY_OFF, + ELM_SCROLLER_POLICY_AUTO); elm_entry_single_line_set(entry, EINA_TRUE); elm_entry_cnp_mode_set(entry, ELM_CNP_MODE_PLAINTEXT); elm_entry_input_panel_layout_set(entry, ELM_INPUT_PANEL_LAYOUT_NORMAL); elm_entry_editable_set(entry, TRUE); - elm_entry_input_panel_return_key_type_set(entry, ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE); + elm_entry_input_panel_return_key_type_set(entry, + ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE); elm_entry_input_panel_return_key_disabled_set(entry, EINA_FALSE); //elm_entry_prediction_allow_set(entry, EINA_FALSE); - evas_object_smart_callback_add(entry, "changed", _mp_edit_playlist_entry_changed_cb, mp_playlist_data); - evas_object_smart_callback_add(entry, "preedit,changed", _mp_edit_playlist_entry_changed_cb, mp_playlist_data); - evas_object_smart_callback_add(entry, "focused", _mp_edit_playlist_entry_focused_cb, mp_playlist_data); - evas_object_smart_callback_add(entry, "unfocused", _mp_edit_playlist_entry_unfocused_cb, mp_playlist_data); + evas_object_smart_callback_add(entry, "changed", + _mp_edit_playlist_entry_changed_cb, + mp_playlist_data); + evas_object_smart_callback_add(entry, "preedit,changed", + _mp_edit_playlist_entry_changed_cb, + mp_playlist_data); + evas_object_smart_callback_add(entry, "focused", + _mp_edit_playlist_entry_focused_cb, + mp_playlist_data); + evas_object_smart_callback_add(entry, "unfocused", + _mp_edit_playlist_entry_unfocused_cb, + mp_playlist_data); static Elm_Entry_Filter_Limit_Size limit_filter_data; limit_filter_data.max_char_count = MP_PLAYLIST_NAME_SIZE; limit_filter_data.max_byte_count = 0; - elm_entry_markup_filter_append(entry, elm_entry_filter_limit_size, &limit_filter_data); - evas_object_smart_callback_add(entry, "maxlength,reached", _mp_create_plst_entry_maxlength_reached_cb, mp_playlist_data); - edje_object_signal_callback_add(_EDJ(mp_playlist_data->layout), "elm,action,click", "cancel_image", _mp_search_edit_cancel_button_clicked, entry); + elm_entry_markup_filter_append(entry, elm_entry_filter_limit_size, + &limit_filter_data); + evas_object_smart_callback_add(entry, "maxlength,reached", + _mp_create_plst_entry_maxlength_reached_cb, + mp_playlist_data); + edje_object_signal_callback_add(_EDJ(mp_playlist_data->layout), + "elm,action,click", "cancel_image", + _mp_search_edit_cancel_button_clicked, + entry); //elm_entry_cursor_end_set (entry); evas_object_show(entry); - if (mp_playlist_data->new_playlist_name && (mp_playlist_data->type != MP_PLST_RENAME)) { + if (mp_playlist_data->new_playlist_name + && (mp_playlist_data->type != MP_PLST_RENAME)) { //elm_object_part_text_set(entry, "elm.guide", mp_playlist_data->new_playlist_name); - char *text = elm_entry_utf8_to_markup(mp_playlist_data->new_playlist_name); + char *text = + elm_entry_utf8_to_markup(mp_playlist_data->new_playlist_name); elm_entry_entry_set(entry, text); IF_FREE(text); elm_entry_cursor_end_set(entry); } if (mp_playlist_data->type == MP_PLST_RENAME) { - evas_object_smart_callback_add(entry, "activated", mp_edit_playlist_rename_done_cb, mp_playlist_data); + evas_object_smart_callback_add(entry, "activated", + mp_edit_playlist_rename_done_cb, + mp_playlist_data); char *name = NULL; - mp_media_info_group_get_main_info(mp_playlist_data->playlist_handle, &name); + mp_media_info_group_get_main_info(mp_playlist_data-> + playlist_handle, &name); IF_FREE(mp_playlist_data->name); mp_playlist_data->name = g_strdup(name); @@ -431,15 +483,20 @@ _mp_edit_playlist_create_editfield(void *thiz) elm_entry_cursor_end_set(entry); } } else { - evas_object_smart_callback_add(entry, "activated", _mp_edit_playlist_create_new_done_cb, mp_playlist_data); + evas_object_smart_callback_add(entry, "activated", + _mp_edit_playlist_create_new_done_cb, + mp_playlist_data); } - elm_object_signal_callback_add(entry, "elm,eraser,clicked", "elm", _mp_edit_playlist_entry_eraser_clicked_cb, entry); + elm_object_signal_callback_add(entry, "elm,eraser,clicked", "elm", + _mp_edit_playlist_entry_eraser_clicked_cb, + entry); return entry; } -static void _mp_edit_playlist_cancel_cb(void *data, Evas_Object * obj, void *event_info) +static void _mp_edit_playlist_cancel_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; struct appdata *ad = mp_util_get_appdata(); @@ -449,7 +506,7 @@ static void _mp_edit_playlist_cancel_cb(void *data, Evas_Object * obj, void *eve mp_view_mgr_post_event(GET_VIEW_MGR, MP_POPUP_CANCEL); - Mp_Playlist_Data *mp_playlist_data = (Mp_Playlist_Data *)data; + Mp_Playlist_Data *mp_playlist_data = (Mp_Playlist_Data *) data; MP_CHECK(mp_playlist_data); IF_FREE(mp_playlist_data->oldname); @@ -460,14 +517,13 @@ void mp_edit_playlist_add_to_selected_mode(void *data, bool selected) { eventfunc; - Mp_Playlist_Data *mp_playlist_data = (Mp_Playlist_Data *)data; + Mp_Playlist_Data *mp_playlist_data = (Mp_Playlist_Data *) data; MP_CHECK(mp_playlist_data); mp_playlist_data->add_to_selected = selected; } -static Eina_Bool -_entry_focus_timer_cb(void *data) +static Eina_Bool _entry_focus_timer_cb(void *data) { Mp_Playlist_Data *mp_playlist_data = data; elm_object_focus_set(mp_playlist_data->editfiled_entry, EINA_TRUE); @@ -475,12 +531,11 @@ _entry_focus_timer_cb(void *data) return false; } -void -mp_edit_playlist_content_create(void *thiz) +void mp_edit_playlist_content_create(void *thiz) { startfunc; char *new_playlist_name = NULL; - Mp_Playlist_Data *mp_playlist_data = (Mp_Playlist_Data *)thiz; + Mp_Playlist_Data *mp_playlist_data = (Mp_Playlist_Data *) thiz; MP_CHECK(mp_playlist_data); struct appdata *ad = mp_util_get_appdata(); @@ -492,28 +547,37 @@ mp_edit_playlist_content_create(void *thiz) mp_playlist_data->add_to_selected = true; layout = elm_layout_add(mp_playlist_data->popup); - char edje_path[1024] ={0}; - char * path = app_get_resource_path(); + char edje_path[1024] = { 0 }; + char *path = app_get_resource_path(); MP_CHECK(path); snprintf(edje_path, 1024, "%s%s/%s", path, "edje", PLAY_VIEW_EDJ_NAME); elm_layout_file_set(layout, edje_path, "popup_entryview"); free(path); - evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); elm_object_focus_set(layout, EINA_FALSE); mp_playlist_data->layout = layout; - mp_playlist_data->new_playlist_name = _mp_edit_playlist_get_new_playlist_name(); - mp_playlist_data->editfiled_entry = _mp_edit_playlist_create_editfield(mp_playlist_data); + mp_playlist_data->new_playlist_name = + _mp_edit_playlist_get_new_playlist_name(); + mp_playlist_data->editfiled_entry = + _mp_edit_playlist_create_editfield(mp_playlist_data); IF_FREE(new_playlist_name); - mp_popup_response_callback_set(mp_playlist_data->popup, _mp_edit_playlist_cancel_cb, mp_playlist_data); - Evas_Object *btn1 = mp_widget_create_button(mp_playlist_data->popup, "popup", STR_MP_CANCEL, NULL, - _mp_edit_playlist_cancel_cb, mp_playlist_data); - - if (mp_playlist_data->type == MP_PLST_CREATE || mp_playlist_data->type == MP_PLST_CREATE_TO_ADD_TRACK) { + mp_popup_response_callback_set(mp_playlist_data->popup, + _mp_edit_playlist_cancel_cb, + mp_playlist_data); + Evas_Object *btn1 = + mp_widget_create_button(mp_playlist_data->popup, "popup", + STR_MP_CANCEL, NULL, + _mp_edit_playlist_cancel_cb, + mp_playlist_data); + + if (mp_playlist_data->type == MP_PLST_CREATE + || mp_playlist_data->type == MP_PLST_CREATE_TO_ADD_TRACK) { btn_str = STR_MP_CREATE; } else if (mp_playlist_data->type == MP_PLST_RENAME) { btn_str = STR_MP_RENAME; @@ -521,34 +585,43 @@ mp_edit_playlist_content_create(void *thiz) btn_str = STR_MP_OK; } - Evas_Object *btn2 = mp_widget_create_button(mp_playlist_data->popup, "popup", btn_str, NULL, NULL, NULL); + Evas_Object *btn2 = + mp_widget_create_button(mp_playlist_data->popup, "popup", btn_str, + NULL, NULL, NULL); mp_playlist_data->btn_ok = btn2; elm_object_part_content_set(mp_playlist_data->popup, "button1", btn1); elm_object_part_content_set(mp_playlist_data->popup, "button2", btn2); - elm_object_part_content_set(layout, "elm.swallow.content", mp_playlist_data->editfiled_entry); + elm_object_part_content_set(layout, "elm.swallow.content", + mp_playlist_data->editfiled_entry); elm_object_content_set(mp_playlist_data->popup, layout); if (mp_playlist_data->type == MP_PLST_RENAME) { - evas_object_smart_callback_add(btn2, "clicked", mp_edit_playlist_rename_done_cb, mp_playlist_data); + evas_object_smart_callback_add(btn2, "clicked", + mp_edit_playlist_rename_done_cb, + mp_playlist_data); } else { - evas_object_smart_callback_add(btn2, "clicked", _mp_edit_playlist_create_new_done_cb, mp_playlist_data); + evas_object_smart_callback_add(btn2, "clicked", + _mp_edit_playlist_create_new_done_cb, + mp_playlist_data); } if (mp_playlist_data->editfiled_entry && !ad->popup[MP_POPUP_NOTIFY]) { - mp_playlist_data->entry_show_timer = ecore_timer_add(0.1, _entry_focus_timer_cb, mp_playlist_data); + mp_playlist_data->entry_show_timer = + ecore_timer_add(0.1, _entry_focus_timer_cb, mp_playlist_data); } return; } static void -_mp_edit_playlist_popup_timeout_cb(void *data, Evas_Object *obj, void *event_info) +_mp_edit_playlist_popup_timeout_cb(void *data, Evas_Object * obj, + void *event_info) { startfunc; mp_evas_object_del(obj); - Evas_Object *editfiled_entry = (Evas_Object *)data; + Evas_Object *editfiled_entry = (Evas_Object *) data; MP_CHECK(editfiled_entry); elm_entry_cursor_end_set(editfiled_entry); elm_object_focus_set(editfiled_entry, EINA_TRUE); @@ -557,7 +630,8 @@ _mp_edit_playlist_popup_timeout_cb(void *data, Evas_Object *obj, void *event_inf static void -mp_edit_playlist_rename_done_cb(void *data, Evas_Object * obj, void *event_info) +mp_edit_playlist_rename_done_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; Mp_Playlist_Data *mp_playlist_data = data; @@ -575,19 +649,26 @@ mp_edit_playlist_rename_done_cb(void *data, Evas_Object * obj, void *event_info) MP_CHECK(ad); text = mp_util_isf_get_edited_str(editfiled_entry, TRUE); - if (!mp_util_is_playlist_name_valid((char *)text)) { - mp_widget_notify_cb_popup(ad, GET_STR("IDS_MUSIC_POP_UNABLE_RENAME_PLAYLIST"), _mp_edit_playlist_popup_timeout_cb, (void*)editfiled_entry); + if (!mp_util_is_playlist_name_valid((char *) text)) { + mp_widget_notify_cb_popup(ad, + GET_STR + ("IDS_MUSIC_POP_UNABLE_RENAME_PLAYLIST"), + _mp_edit_playlist_popup_timeout_cb, + (void *) editfiled_entry); IF_FREE(text); - return ; + return; } else { bool exist = false; ret = mp_media_info_playlist_is_exist(text, &exist); if (ret != 0) { ERROR_TRACE("Fail to get playlist count by name: %d", ret); - mp_widget_text_popup(ad, GET_STR("IDS_MUSIC_POP_UNABLE_RENAME_PLAYLIST")); + mp_widget_text_popup(ad, + GET_STR + ("IDS_MUSIC_POP_UNABLE_RENAME_PLAYLIST")); } else if (exist) { char *message = NULL; - message = g_strdup_printf(GET_STR(STR_MP_POP_PLAYLIST_EXISTS), text); + message = + g_strdup_printf(GET_STR(STR_MP_POP_PLAYLIST_EXISTS), text); mp_widget_text_popup(ad, message); IF_FREE(message); mp_edit_playlist_content_create(mp_playlist_data); @@ -596,10 +677,14 @@ mp_edit_playlist_rename_done_cb(void *data, Evas_Object * obj, void *event_info) ret = mp_media_info_playlist_rename(playlist, text); if (ret == 0) { mp_debug("mp_media_info_playlist_rename().. OK"); - MpView_t *create_playlist_detail_view = mp_view_mgr_get_view(GET_VIEW_MGR, MP_VIEW_PLAYLIST_DETAIL); + MpView_t *create_playlist_detail_view = + mp_view_mgr_get_view(GET_VIEW_MGR, + MP_VIEW_PLAYLIST_DETAIL); if (create_playlist_detail_view != NULL) { mp_view_set_title(create_playlist_detail_view, text); - ((MpPlaylistDetailView_t *)create_playlist_detail_view)->content_set(create_playlist_detail_view); + ((MpPlaylistDetailView_t *) + create_playlist_detail_view)-> +content_set(create_playlist_detail_view); } mp_view_mgr_post_event(GET_VIEW_MGR, MP_PLAYLIST_RENAMED); @@ -621,7 +706,8 @@ void *mp_edit_playlist_create(mp_plst_operation_type type) Evas_Object *popup = NULL; - Mp_Playlist_Data *mp_playlist_data = (Mp_Playlist_Data *)calloc(1, sizeof(Mp_Playlist_Data)); + Mp_Playlist_Data *mp_playlist_data = + (Mp_Playlist_Data *) calloc(1, sizeof(Mp_Playlist_Data)); MP_CHECK_NULL(mp_playlist_data); mp_playlist_data->type = type; @@ -646,7 +732,8 @@ void *mp_edit_playlist_create(mp_plst_operation_type type) return mp_playlist_data; } -int mp_edit_playlist_set_edit_list(Mp_Playlist_Data *mp_playlist_data, MpList_t *adding_list) +int mp_edit_playlist_set_edit_list(Mp_Playlist_Data * mp_playlist_data, + MpList_t * adding_list) { startfunc; MP_CHECK_VAL(mp_playlist_data, -1); @@ -654,7 +741,8 @@ int mp_edit_playlist_set_edit_list(Mp_Playlist_Data *mp_playlist_data, MpList_t return 0; } -int mp_edit_playlist_set_media_id(Mp_Playlist_Data *mp_playlist_data, const char *adding_media_id) +int mp_edit_playlist_set_media_id(Mp_Playlist_Data * mp_playlist_data, + const char *adding_media_id) { startfunc; MP_CHECK_VAL(mp_playlist_data, -1); @@ -662,10 +750,10 @@ int mp_edit_playlist_set_media_id(Mp_Playlist_Data *mp_playlist_data, const char return 0; } -int mp_edit_playlist_set_create_type(Mp_Playlist_Data *mp_playlist_data, mp_plst_create_type_e type) +int mp_edit_playlist_set_create_type(Mp_Playlist_Data * mp_playlist_data, + mp_plst_create_type_e type) { MP_CHECK_VAL(mp_playlist_data, -1); mp_playlist_data->creation_type = type; return 0; } - diff --git a/src/widget/mp-genre-list.c b/src/widget/mp-genre-list.c index 5c69d90..93d62fd 100644 --- a/src/widget/mp-genre-list.c +++ b/src/widget/mp-genre-list.c @@ -34,10 +34,10 @@ #define GENRE_GRID_LAND_H 240 static void -_mp_genre_select_cb(void *data, Evas_Object *obj, void *event_info); +_mp_genre_select_cb(void *data, Evas_Object * obj, void *event_info); -static char * -_mp_genre_list_label_get(void *data, Evas_Object * obj, const char *part) +static char *_mp_genre_list_label_get(void *data, Evas_Object * obj, + const char *part) { char *name = NULL; int ret = 0; @@ -48,7 +48,9 @@ _mp_genre_list_label_get(void *data, Evas_Object * obj, const char *part) mp_retv_if(svc_item == NULL, NULL); - if (!strcmp(part, "elm.text.main.left") || !strcmp(part, "elm.slide.text.1") || !strcmp(part, "elm.text")) { + if (!strcmp(part, "elm.text.main.left") + || !strcmp(part, "elm.slide.text.1") + || !strcmp(part, "elm.text")) { ret = mp_media_info_group_get_main_info(svc_item, &name); mp_retvm_if((ret != 0), NULL, "Fail to get value"); if (!name || !strlen(name)) { @@ -63,28 +65,28 @@ _mp_genre_list_label_get(void *data, Evas_Object * obj, const char *part) } /* - else if (!strcmp(part, "elm.text.2")) - { - int count = 0; - char *sub_text = NULL; - mp_media_info_group_get_track_count(svc_item, &count); + else if (!strcmp(part, "elm.text.2")) + { + int count = 0; + char *sub_text = NULL; + mp_media_info_group_get_track_count(svc_item, &count); - if (count == 1) - sub_text = g_strdup(GET_STR(STR_MP_1_SONG)); - else - sub_text = g_strdup_printf(GET_STR(STR_MP_PD_SONGS), count); + if (count == 1) + sub_text = g_strdup(GET_STR(STR_MP_1_SONG)); + else + sub_text = g_strdup_printf(GET_STR(STR_MP_PD_SONGS), count); - return sub_text; - }*/ + return sub_text; + } */ - /*DEBUG_TRACE("Unusing part: %s", part);*/ + /*DEBUG_TRACE("Unusing part: %s", part); */ return NULL; } -Evas_Object * -_mp_genre_list_icon_get(void *data, Evas_Object *obj, const char *part) +Evas_Object *_mp_genre_list_icon_get(void *data, Evas_Object * obj, + const char *part) { Evas_Object *icon = NULL; @@ -104,7 +106,8 @@ _mp_genre_list_icon_get(void *data, Evas_Object *obj, const char *part) int w, h; if (item->display_mode == MP_LIST_DISPLAY_MODE_THUMBNAIL) { if (landscape) { - w = MP_LANDSCAPE_ALBUM_THUMB_ICON_SIZE * elm_config_scale_get(); + w = MP_LANDSCAPE_ALBUM_THUMB_ICON_SIZE * + elm_config_scale_get(); } else { w = MP_ALBUM_THUMB_ICON_SIZE * elm_config_scale_get(); } @@ -112,9 +115,11 @@ _mp_genre_list_icon_get(void *data, Evas_Object *obj, const char *part) w = MP_LIST_ICON_SIZE; } h = w; - icon = mp_util_create_lazy_update_thumb_icon(obj, thumb_name, w, h); + icon = + mp_util_create_lazy_update_thumb_icon(obj, thumb_name, w, h); - elm_layout_theme_set(content, "layout", "list/B/type.1", "default"); + elm_layout_theme_set(content, "layout", "list/B/type.1", + "default"); elm_layout_content_set(content, "elm.swallow.content", icon); } @@ -124,8 +129,8 @@ _mp_genre_list_icon_get(void *data, Evas_Object *obj, const char *part) Evas_Object *check = NULL; DEBUG_TRACE("list->edit_mode = %d", list->edit_mode); - if (list->edit_mode) { /* if edit mode*/ - if (!strcmp(part, "elm.edit.icon.1") || !strcmp(part, "elm.swallow.end")) { /* swallow checkbox or radio button*/ + if (list->edit_mode) { /* if edit mode */ + if (!strcmp(part, "elm.edit.icon.1") || !strcmp(part, "elm.swallow.end")) { /* swallow checkbox or radio button */ check = elm_check_add(obj); if (MP_LIST_OBJ_IS_GENGRID(obj)) { elm_object_style_set(check, "grid"); @@ -139,8 +144,7 @@ _mp_genre_list_icon_get(void *data, Evas_Object *obj, const char *part) return content; } -static void -_mp_genre_list_item_del_cb(void *data, Evas_Object *obj) +static void _mp_genre_list_item_del_cb(void *data, Evas_Object * obj) { mp_list_item_data_t *item_data = data; MP_CHECK(item_data); @@ -152,10 +156,10 @@ static void _mp_genre_select_cb(void *data, Evas_Object * obj, void *event_info) { eventfunc; - MpGenreList_t *list = (MpGenreList_t *)data; + MpGenreList_t *list = (MpGenreList_t *) data; MP_CHECK(list); int ret = 0; - int index = 0;/*(int)data;*/ + int index = 0; /*(int)data; */ char *name = NULL; char *artist = NULL; char *title = NULL; @@ -176,13 +180,14 @@ _mp_genre_select_cb(void *data, Evas_Object * obj, void *event_info) DEBUG_TRACE("index is %d", index); if (index >= 0) { - /*item_handle = mp_media_info_group_list_nth_item(gli_data->handle, index);*/ + /*item_handle = mp_media_info_group_list_nth_item(gli_data->handle, index); */ DEBUG_TRACE(""); ret = mp_media_info_group_get_main_info(gli_data->handle, &name); DEBUG_TRACE(""); ret = mp_media_info_group_get_sub_info(gli_data->handle, &artist); DEBUG_TRACE(""); - mp_media_info_group_get_thumbnail_path(gli_data->handle, &thumbnail); + mp_media_info_group_get_thumbnail_path(gli_data->handle, + &thumbnail); DEBUG_TRACE("thumbnail=%s", thumbnail); mp_retm_if(ret != 0, "Fail to get value"); mp_retm_if(name == NULL, "Fail to get value"); @@ -194,22 +199,29 @@ _mp_genre_select_cb(void *data, Evas_Object * obj, void *event_info) if (list->function_type == MP_LIST_FUNC_ADD_TRACK) { MpViewMgr_t *view_manager = mp_view_mgr_get_view_manager(); MP_CHECK(view_manager); - MpSelectTrackView_t *view_select_track = mp_select_track_view_create(view_manager->navi); + MpSelectTrackView_t *view_select_track = + mp_select_track_view_create(view_manager->navi); MP_CHECK(view_select_track); - mp_view_mgr_push_view(view_manager, (MpView_t *)view_select_track, NULL); - - mp_view_set_title((MpView_t *)view_select_track, STR_MP_TILTE_SELECT_ITEM); - mp_track_list_set_data((MpTrackList_t *)view_select_track->content_to_show, MP_TRACK_LIST_TYPE, MP_TRACK_BY_GENRE, MP_TRACK_LIST_TYPE_STR, name, -1); + mp_view_mgr_push_view(view_manager, (MpView_t *) view_select_track, + NULL); + + mp_view_set_title((MpView_t *) view_select_track, + STR_MP_TILTE_SELECT_ITEM); + mp_track_list_set_data((MpTrackList_t *) view_select_track-> + content_to_show, MP_TRACK_LIST_TYPE, + MP_TRACK_BY_GENRE, MP_TRACK_LIST_TYPE_STR, + name, -1); mp_list_update(view_select_track->content_to_show); - mp_view_update_options((MpView_t *)view_select_track); + mp_view_update_options((MpView_t *) view_select_track); mp_list_set_edit(view_select_track->content_to_show, TRUE); - mp_list_view_set_select_all((MpListView_t *)view_select_track, TRUE); + mp_list_view_set_select_all((MpListView_t *) view_select_track, + TRUE); return; } if (list->edit_mode) { - /*mp_edit_view_genlist_sel_cb(data, obj, event_info);*/ - mp_list_edit_mode_sel((MpList_t *)list, gli_data); + /*mp_edit_view_genlist_sel_cb(data, obj, event_info); */ + mp_list_edit_mode_sel((MpList_t *) list, gli_data); MpViewMgr_t *view_mgr = mp_view_mgr_get_view_manager(); MpView_t *view = mp_view_mgr_get_top_view(view_mgr); mp_view_update_options_edit(view); @@ -218,11 +230,14 @@ _mp_genre_select_cb(void *data, Evas_Object * obj, void *event_info) /* create the view of genre detail */ - MpGenreDetailView_t *view_genre_detail = mp_genre_detail_view_create(GET_NAVIFRAME, name, artist, thumbnail); - mp_view_mgr_push_view(GET_VIEW_MGR, (MpView_t *)view_genre_detail, NULL); + MpGenreDetailView_t *view_genre_detail = + mp_genre_detail_view_create(GET_NAVIFRAME, name, artist, + thumbnail); + mp_view_mgr_push_view(GET_VIEW_MGR, (MpView_t *) view_genre_detail, + NULL); - mp_view_update_options((MpView_t *)view_genre_detail); - mp_view_set_title((MpView_t *)view_genre_detail, title); + mp_view_update_options((MpView_t *) view_genre_detail); + mp_view_set_title((MpView_t *) view_genre_detail, title); } @@ -231,7 +246,7 @@ void _mp_genre_list_load_list(void *thiz, int count) MpGenreList_t *list = thiz; MP_CHECK(list); - /*media-svc related*/ + /*media-svc related */ mp_media_list_h svc_handle; gint index = 0; int ret = 0; @@ -247,14 +262,17 @@ void _mp_genre_list_load_list(void *thiz, int count) list->genre_list = NULL; } - ret = mp_media_info_group_list_create(&list->genre_list, MP_GROUP_BY_GENRE, NULL, NULL, 0, count); + ret = + mp_media_info_group_list_create(&list->genre_list, + MP_GROUP_BY_GENRE, NULL, NULL, 0, + count); if (ret != 0) { DEBUG_TRACE("Fail to get items"); goto END; } - svc_handle = list->genre_list ; + svc_handle = list->genre_list; for (index = 0; index < count; index++) { mp_media_info_h item = NULL; @@ -263,7 +281,9 @@ void _mp_genre_list_load_list(void *thiz, int count) item = mp_media_info_group_list_nth_item(svc_handle, index); if (!item) { - DEBUG_TRACE("Fail to mp_media_info_group_list_nth_item, ret[%d], index[%d]", ret, index); + DEBUG_TRACE + ("Fail to mp_media_info_group_list_nth_item, ret[%d], index[%d]", + ret, index); goto END; } mp_media_info_group_get_main_info(item, &title); @@ -273,21 +293,29 @@ void _mp_genre_list_load_list(void *thiz, int count) MP_CHECK(item_data); item_data->handle = item; item_data->index = index; - item_data->checked = mp_list_is_in_checked_path_list(list->checked_path_list, title); + item_data->checked = + mp_list_is_in_checked_path_list(list->checked_path_list, + title); if (MP_LIST_OBJ_IS_GENGRID(list->genlist)) { - list_item = elm_gengrid_item_append(list->genlist, list->gengrid_itc, item_data, - _mp_genre_select_cb, (void *)list); + list_item = + elm_gengrid_item_append(list->genlist, list->gengrid_itc, + item_data, _mp_genre_select_cb, + (void *) list); } else { Elm_Object_Item *parent_group = NULL; - list_item = elm_genlist_item_append(list->genlist, list->itc, item_data, parent_group, - ELM_GENLIST_ITEM_NONE, _mp_genre_select_cb, (void *)list); + list_item = + elm_genlist_item_append(list->genlist, list->itc, + item_data, parent_group, + ELM_GENLIST_ITEM_NONE, + _mp_genre_select_cb, + (void *) list); } item_data->it = list_item; elm_object_item_data_set(item_data->it, item_data); } -END: + END: endfunc; } @@ -324,15 +352,16 @@ static mp_group_type_e _mp_genre_list_get_group_type(void *thiz) } static void -_mp_genre_list_item_longpressed_cb(void *data, Evas_Object *obj, void *event_info) +_mp_genre_list_item_longpressed_cb(void *data, Evas_Object * obj, + void *event_info) { startfunc; - MpGenreList_t *list = (MpGenreList_t *)data; + MpGenreList_t *list = (MpGenreList_t *) data; MP_CHECK(list); if (list->edit_mode) { - return ; + return; } struct appdata *ad = mp_util_get_appdata(); @@ -380,7 +409,9 @@ _mp_genre_list_item_longpressed_cb(void *data, Evas_Object *obj, void *event_inf pop_item_count = 4; mp_media_info_group_get_main_info(item_data->handle, &title); - popup = mp_genlist_popup_create(obj, MP_POPUP_LIST_LONGPRESSED, &pop_item_count, ad); + popup = + mp_genlist_popup_create(obj, MP_POPUP_LIST_LONGPRESSED, + &pop_item_count, ad); MP_CHECK(popup); char *up_title = g_strdup(title); @@ -389,13 +420,14 @@ _mp_genre_list_item_longpressed_cb(void *data, Evas_Object *obj, void *event_inf IF_FREE(up_title); mp_genlist_popup_item_append(popup, STR_MP_PLAY_ALL, NULL, NULL, NULL, - mp_common_playall_cb, list); + mp_common_playall_cb, list); - mp_genlist_popup_item_append(popup, STR_MP_ADD_TO_PLAYLIST, NULL, NULL, NULL, - mp_common_list_add_to_playlist_cb, list); + mp_genlist_popup_item_append(popup, STR_MP_ADD_TO_PLAYLIST, NULL, NULL, + NULL, mp_common_list_add_to_playlist_cb, + list); mp_genlist_popup_item_append(popup, STR_MP_DELETE, NULL, NULL, NULL, - mp_common_list_delete_cb, list); + mp_common_list_delete_cb, list); if (MP_LIST_OBJ_IS_GENGRID(list->genlist)) { MP_GENGRID_ITEM_LONG_PRESSED(obj, popup, event_info); @@ -404,23 +436,27 @@ _mp_genre_list_item_longpressed_cb(void *data, Evas_Object *obj, void *event_inf } } -static void -_mp_genre_list_genlist_create(MpGenreList_t *list) +static void _mp_genre_list_genlist_create(MpGenreList_t * list) { MP_CHECK(list); - /*create new genlist*/ + /*create new genlist */ list->genlist = mp_widget_genlist_create(list->box); MP_CHECK(list->genlist); - elm_scroller_policy_set(list->genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); - evas_object_size_hint_weight_set(list->genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(list->genlist, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_scroller_policy_set(list->genlist, ELM_SCROLLER_POLICY_OFF, + ELM_SCROLLER_POLICY_AUTO); + evas_object_size_hint_weight_set(list->genlist, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(list->genlist, EVAS_HINT_FILL, + EVAS_HINT_FILL); elm_genlist_homogeneous_set(list->genlist, EINA_TRUE); evas_object_show(list->genlist); - /*packet genlist to box*/ + /*packet genlist to box */ elm_box_pack_end(list->box, list->genlist); - /*add long press callback*/ - evas_object_smart_callback_add(list->genlist, "longpressed", _mp_genre_list_item_longpressed_cb, list); + /*add long press callback */ + evas_object_smart_callback_add(list->genlist, "longpressed", + _mp_genre_list_item_longpressed_cb, + list); const char *group_slide_style = "mode/slide"; if (!list->itc) { @@ -437,47 +473,47 @@ _mp_genre_list_genlist_create(MpGenreList_t *list) endfunc; } -static void -_mp_genre_list_set_grid_style(MpGenreList_t *list) +static void _mp_genre_list_set_grid_style(MpGenreList_t * list) { bool landscape = mp_util_is_landscape(); MP_CHECK(list->gengrid_itc); /*if (landscape) - list->gengrid_itc->item_style = "music/artist_grid"; - else*/ + list->gengrid_itc->item_style = "music/artist_grid"; + else */ list->gengrid_itc->item_style = "music/artist_grid"; double scale = elm_config_scale_get(); int w; int h; if (landscape) { - w = (int)(GENRE_GRID_LAND_W * scale); - h = (int)(GENRE_GRID_LAND_H * scale); + w = (int) (GENRE_GRID_LAND_W * scale); + h = (int) (GENRE_GRID_LAND_H * scale); } else { - w = (int)(GENRE_GRID_W * scale); - h = (int)(GENRE_GRID_H * scale); + w = (int) (GENRE_GRID_W * scale); + h = (int) (GENRE_GRID_H * scale); } elm_gengrid_item_size_set(list->genlist, w, h); } -static void -_mp_genre_list_gengrid_create(MpGenreList_t *list) +static void _mp_genre_list_gengrid_create(MpGenreList_t * list) { startfunc; MP_CHECK(list); - /*create new genlist*/ + /*create new genlist */ mp_evas_object_del(list->genlist); list->genlist = elm_gengrid_add(list->box); MP_CHECK(list->genlist); - evas_object_size_hint_weight_set(list->genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(list->genlist, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(list->genlist, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(list->genlist, EVAS_HINT_FILL, + EVAS_HINT_FILL); evas_object_show(list->genlist); MP_LIST_OBJ_SET_AS_GENGRID(list->genlist); - /*packet genlist to box*/ + /*packet genlist to box */ elm_box_pack_end(list->box, list->genlist); if (!list->gengrid_itc) { @@ -500,11 +536,14 @@ static void _mp_genre_list_update(void *thiz) MpGenreList_t *list = thiz; MP_CHECK(list); - res = mp_media_info_group_list_count(MP_GROUP_BY_GENRE, NULL, NULL, &count); + res = + mp_media_info_group_list_count(MP_GROUP_BY_GENRE, NULL, NULL, + &count); MP_CHECK(res == 0); mp_list_free_checked_path_list(list->checked_path_list); - list->checked_path_list = mp_list_get_checked_path_list((MpList_t *)list); + list->checked_path_list = + mp_list_get_checked_path_list((MpList_t *) list); mp_evas_object_del(list->genlist); mp_evas_object_del(list->no_content); @@ -521,11 +560,13 @@ static void _mp_genre_list_update(void *thiz) /* load list */ _mp_genre_list_load_list(thiz, count); - /*mp_list_bottom_counter_item_append((MpList_t *)list);*/ + /*mp_list_bottom_counter_item_append((MpList_t *)list); */ } else { DEBUG_TRACE("count is 0"); - list->no_content = mp_widget_create_no_contents(list->box, MP_NOCONTENT_GENRES, NULL, NULL); + list->no_content = + mp_widget_create_no_contents(list->box, MP_NOCONTENT_GENRES, + NULL, NULL); elm_box_pack_end(list->box, list->no_content); } @@ -534,7 +575,8 @@ static void _mp_genre_list_update(void *thiz) void _mp_genre_list_rotate(void *thiz) { MpGenreList_t *list = thiz; - if (mp_list_get_display_mode((MpList_t *)list) == MP_LIST_DISPLAY_MODE_THUMBNAIL) { + if (mp_list_get_display_mode((MpList_t *) list) == + MP_LIST_DISPLAY_MODE_THUMBNAIL) { _mp_genre_list_set_grid_style(list); } } @@ -545,7 +587,7 @@ static const char *_get_label(void *thiz, void *event_info) MP_CHECK_NULL(list); char *title = NULL; - mp_list_item_data_t *genre = elm_object_item_data_get(event_info); + mp_list_item_data_t *genre = elm_object_item_data_get(event_info); MP_CHECK_NULL(genre); mp_media_info_group_get_main_info(genre->handle, &title); @@ -557,7 +599,10 @@ static char *_mp_genre_list_bottom_counter_text_cb(void *thiz) MpGenreList_t *list = thiz; MP_CHECK_NULL(list); - unsigned int count = mp_list_get_editable_count((MpList_t *)list, mp_list_get_edit_type((MpList_t *)list)); + unsigned int count = + mp_list_get_editable_count((MpList_t *) list, + mp_list_get_edit_type((MpList_t *) + list)); char *text = NULL; if (count == 1) { @@ -569,7 +614,7 @@ static char *_mp_genre_list_bottom_counter_text_cb(void *thiz) return text; } -MpGenreList_t *mp_genre_list_create(Evas_Object *parent) +MpGenreList_t *mp_genre_list_create(Evas_Object * parent) { eventfunc; MP_CHECK_NULL(parent); @@ -577,7 +622,7 @@ MpGenreList_t *mp_genre_list_create(Evas_Object *parent) MpGenreList_t *list = calloc(1, sizeof(MpGenreList_t)); MP_CHECK_NULL(list); - mp_list_init((MpList_t *)list, parent, MP_LIST_TYPE_GROUP); + mp_list_init((MpList_t *) list, parent, MP_LIST_TYPE_GROUP); list->update = _mp_genre_list_update; list->destory_cb = _mp_genre_list_destory_cb; @@ -586,12 +631,13 @@ MpGenreList_t *mp_genre_list_create(Evas_Object *parent) list->get_label = _get_label; list->display_mode_changable = true; - list->bottom_counter_text_get_cb = _mp_genre_list_bottom_counter_text_cb; + list->bottom_counter_text_get_cb = + _mp_genre_list_bottom_counter_text_cb; return list; } -void mp_genre_list_set_data(MpGenreList_t *list, ...) +void mp_genre_list_set_data(MpGenreList_t * list, ...) { startfunc; MP_CHECK(list); @@ -604,20 +650,21 @@ void mp_genre_list_set_data(MpGenreList_t *list, ...) field = va_arg(var_args, int); switch (field) { - case MP_GENRE_LIST_FUNC: { - int val = va_arg((var_args), int); + case MP_GENRE_LIST_FUNC:{ + int val = va_arg((var_args), int); - list->function_type = val; - DEBUG_TRACE("list->function_type = %d", list->function_type); - break; - } - case MP_GENRE_LIST_DISPLAY_MODE: { - int val = va_arg((var_args), int); - list->display_mode = val; - DEBUG_TRACE("list->display_mode = %d", list->display_mode); + list->function_type = val; + DEBUG_TRACE("list->function_type = %d", + list->function_type); + break; + } + case MP_GENRE_LIST_DISPLAY_MODE:{ + int val = va_arg((var_args), int); + list->display_mode = val; + DEBUG_TRACE("list->display_mode = %d", list->display_mode); - break; - } + break; + } default: DEBUG_TRACE("Invalid arguments"); @@ -628,7 +675,7 @@ void mp_genre_list_set_data(MpGenreList_t *list, ...) va_end(var_args); } -void mp_genre_list_copy_data(MpGenreList_t *src, MpGenreList_t *dest) +void mp_genre_list_copy_data(MpGenreList_t * src, MpGenreList_t * dest) { MP_CHECK(src); MP_CHECK(dest); @@ -636,5 +683,3 @@ void mp_genre_list_copy_data(MpGenreList_t *src, MpGenreList_t *dest) dest->function_type = src->function_type; dest->display_mode = src->display_mode; } - - diff --git a/src/widget/mp-index.c b/src/widget/mp-index.c index 0a14fc6..6ea6d81 100644 --- a/src/widget/mp-index.c +++ b/src/widget/mp-index.c @@ -25,60 +25,61 @@ typedef struct { } MpIndexData_t; static char *non_latin_lan[] = { - "ar_AE.UTF-8", - "as_IN.UTF-8", - "bg_BG.UTF-8", - "bn_IN.UTF-8", - "el_GR.UTF-8", - "fa_IR.UTF-8", - "gu_IN.UTF-8", - "he_IL.UTF-8", - "hi_IN.UTF-8", - "hy_AM.UTF-8", - "ja_JP.UTF-8", - "ka_GE.UTF-8", - "kk_KZ.UTF-8", - "km_KH.UTF-8", - "kn_IN.UTF-8", - "ko_KR.UTF-8", - "lo_LA.UTF-8", - "mk_MK.UTF-8", - "ml_IN.UTF-8", - "mn_MN.UTF-8", - "mr_IN.UTF-8", - "ne_NP.UTF-8", - "or_IN.UTF-8", - "pa_IN.UTF-8", - "ru_RU.UTF-8", - "si_LK.UTF-8", - "ta_IN.UTF-8", - "te_IN.UTF-8", - "th_TH.UTF-8", - "uk_UA.UTF-8", - "ur_PK.UTF-8", - "zh_TW.UTF-8", - NULL + "ar_AE.UTF-8", + "as_IN.UTF-8", + "bg_BG.UTF-8", + "bn_IN.UTF-8", + "el_GR.UTF-8", + "fa_IR.UTF-8", + "gu_IN.UTF-8", + "he_IL.UTF-8", + "hi_IN.UTF-8", + "hy_AM.UTF-8", + "ja_JP.UTF-8", + "ka_GE.UTF-8", + "kk_KZ.UTF-8", + "km_KH.UTF-8", + "kn_IN.UTF-8", + "ko_KR.UTF-8", + "lo_LA.UTF-8", + "mk_MK.UTF-8", + "ml_IN.UTF-8", + "mn_MN.UTF-8", + "mr_IN.UTF-8", + "ne_NP.UTF-8", + "or_IN.UTF-8", + "pa_IN.UTF-8", + "ru_RU.UTF-8", + "si_LK.UTF-8", + "ta_IN.UTF-8", + "te_IN.UTF-8", + "th_TH.UTF-8", + "uk_UA.UTF-8", + "ur_PK.UTF-8", + "zh_TW.UTF-8", + NULL }; #define GET_WIDGET_DATA(o) evas_object_data_get(o, "widget_d"); static void -_index_selected_cb(void *data, Evas_Object *obj, void *event_info) +_index_selected_cb(void *data, Evas_Object * obj, void *event_info) { - Elm_Object_Item *item = (Elm_Object_Item*)event_info; + Elm_Object_Item *item = (Elm_Object_Item *) event_info; elm_index_item_selected_set(item, EINA_FALSE); } static void -_mp_index_item_selected_cb(void *data, Evas_Object *obj, void *event_info) +_mp_index_item_selected_cb(void *data, Evas_Object * obj, void *event_info) { const char *index_letter = NULL, *label = NULL; MpList_t *list = data; MP_CHECK(list); Evas_Object *genlist = list->genlist; MP_CHECK(genlist); - MP_CHECK(mp_list_get_display_mode(list) == MP_LIST_DISPLAY_MODE_NORMAL); + MP_CHECK(mp_list_get_display_mode(list) == + MP_LIST_DISPLAY_MODE_NORMAL); MpIndexData_t *wd = GET_WIDGET_DATA(obj); MP_CHECK(wd); @@ -97,9 +98,12 @@ _mp_index_item_selected_cb(void *data, Evas_Object *obj, void *event_info) goto END; } - gunichar uni_index = g_utf8_get_char_validated(index_letter, g_utf8_strlen(index_letter, -1)); + gunichar uni_index = + g_utf8_get_char_validated(index_letter, + g_utf8_strlen(index_letter, -1)); if (uni_index == (gunichar) - 1 || uni_index == (gunichar) - 2) { - DEBUG_TRACE("failed to convert a sequence of bytes encoded as UTF-8 to a Unicode character."); + DEBUG_TRACE + ("failed to convert a sequence of bytes encoded as UTF-8 to a Unicode character."); return; } @@ -114,14 +118,15 @@ _mp_index_item_selected_cb(void *data, Evas_Object *obj, void *event_info) if (uni == uni_index) { matched = gl_item; break; - } else if (closed == NULL && (g_unichar_isalpha(uni) || uni > 0x0400)) { + } else if (closed == NULL + && (g_unichar_isalpha(uni) || uni > 0x0400)) { /* - char first[10] = {0,}, index[10]= {0,}; - g_unichar_to_utf8(uni, first); - g_unichar_to_utf8(uni, index); - DEBUG_TRACE("uni[0x%x, %s], uni_index[0x%x, %s]", uni, first, uni_index, index); - */ - if (capital && uni > uni_index) { //move to most close item + char first[10] = {0,}, index[10]= {0,}; + g_unichar_to_utf8(uni, first); + g_unichar_to_utf8(uni, index); + DEBUG_TRACE("uni[0x%x, %s], uni_index[0x%x, %s]", uni, first, uni_index, index); + */ + if (capital && uni > uni_index) { //move to most close item closed = gl_item; } IF_FREE(capital); @@ -130,7 +135,7 @@ _mp_index_item_selected_cb(void *data, Evas_Object *obj, void *event_info) gl_item = elm_genlist_item_next_get(gl_item); } -END: + END: if (matched) { elm_genlist_item_show(matched, ELM_GENLIST_ITEM_SCROLLTO_TOP); } else if (closed) { @@ -156,14 +161,14 @@ Eina_Bool ea_locale_latin_get(const char *locale) } -static void _mp_fastscoller_append_item(void *data, Evas_Object *obj) +static void _mp_fastscoller_append_item(void *data, Evas_Object * obj) { int i = 0, j, len; char *str = NULL; - char buf[PATH_MAX] = {0, }; + char buf[PATH_MAX] = { 0, }; Eina_Unicode uni; char *locale = NULL; - MpList_t *list = (MpList_t *)data; + MpList_t *list = (MpList_t *) data; MP_CHECK(obj); elm_index_item_clear(obj); @@ -174,9 +179,10 @@ static void _mp_fastscoller_append_item(void *data, Evas_Object *obj) if (!wd->first) { wd->first = g_strdup("#"); } - //2. Local language - str = dgettext("efl-extension", "IDS_EA_BODY_ABCDEFGHIJKLMNOPQRSTUVWXYZ"); + str = + dgettext("efl-extension", + "IDS_EA_BODY_ABCDEFGHIJKLMNOPQRSTUVWXYZ"); MP_CHECK(str); len = strlen(str); if (len == 0) { @@ -194,13 +200,19 @@ static void _mp_fastscoller_append_item(void *data, Evas_Object *obj) } //3. English - in case of non-latin - int retcode = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale); + int retcode = + system_settings_get_value_string + (SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale); if (retcode != SYSTEM_SETTINGS_ERROR_NONE) { - ERROR_TRACE("Unable to fetch the current language setting with return value %d", retcode); + ERROR_TRACE + ("Unable to fetch the current language setting with return value %d", + retcode); } MP_CHECK(locale); if (!ea_locale_latin_get(locale)) { - str = dgettext("efl-extension", "IDS_EA_BODY_ABCDEFGHIJKLMNOPQRSTUVWXYZ_SECOND"); + str = + dgettext("efl-extension", + "IDS_EA_BODY_ABCDEFGHIJKLMNOPQRSTUVWXYZ_SECOND"); MP_CHECK(str); len = strlen(str); @@ -212,7 +224,8 @@ static void _mp_fastscoller_append_item(void *data, Evas_Object *obj) snprintf(buf, i - j + 1, "%s", str + j); buf[i - j + 1] = 0; - elm_index_item_append(obj, buf, _mp_index_item_selected_cb, list); + elm_index_item_append(obj, buf, _mp_index_item_selected_cb, + list); //elm_index_item_priority_set(it, 1); } @@ -221,14 +234,17 @@ static void _mp_fastscoller_append_item(void *data, Evas_Object *obj) IF_FREE(locale); } -static void _append_item(Evas_Object *index, MpList_t *list) + +static void _append_item(Evas_Object * index, MpList_t * list) { - _mp_fastscoller_append_item((void*)list, index); - evas_object_smart_callback_add(index, "changed", _mp_index_item_selected_cb, list); - evas_object_smart_callback_add(index, "selected", _index_selected_cb, NULL); + _mp_fastscoller_append_item((void *) list, index); + evas_object_smart_callback_add(index, "changed", + _mp_index_item_selected_cb, list); + evas_object_smart_callback_add(index, "selected", _index_selected_cb, + NULL); } -static Evas_Object* _create_fastscroll(Evas_Object* parent) +static Evas_Object *_create_fastscroll(Evas_Object * parent) { Evas_Object *index; index = elm_index_add(parent); @@ -246,21 +262,25 @@ _widget_del_cb(void *data, Evas * e, Evas_Object * obj, void *event_info) IF_FREE(wd); } -void _language_changed(void *data, Evas_Object *obj, void *event_info) +void _language_changed(void *data, Evas_Object * obj, void *event_info) { MP_CHECK(data); MP_CHECK(obj); _mp_fastscoller_append_item(data, obj); elm_index_level_go(obj, 0); - evas_object_smart_callback_add(obj, "changed", _mp_index_item_selected_cb, (MpList_t *)data); - evas_object_smart_callback_add(obj, "selected", _index_selected_cb, NULL); + evas_object_smart_callback_add(obj, "changed", + _mp_index_item_selected_cb, + (MpList_t *) data); + evas_object_smart_callback_add(obj, "selected", _index_selected_cb, + NULL); } -Evas_Object *mp_index_create(Evas_Object *parent, int group_type, void *data) +Evas_Object *mp_index_create(Evas_Object * parent, int group_type, + void *data) { Evas_Object *index = NULL; MpIndexData_t *wd = NULL; - MpList_t *list = (MpList_t *)data; + MpList_t *list = (MpList_t *) data; MP_CHECK_NULL(list); // Create index index = _create_fastscroll(parent); @@ -275,17 +295,17 @@ Evas_Object *mp_index_create(Evas_Object *parent, int group_type, void *data) evas_object_data_set(index, "widget_d", wd); - evas_object_event_callback_add(index, EVAS_CALLBACK_FREE, _widget_del_cb, wd); + evas_object_event_callback_add(index, EVAS_CALLBACK_FREE, + _widget_del_cb, wd); //language change the fast scroll language will change too - evas_object_smart_callback_add(index, "language,changed", _language_changed, list); + evas_object_smart_callback_add(index, "language,changed", + _language_changed, list); return index; } -void mp_index_append_item(Evas_Object *index, MpList_t *list) +void mp_index_append_item(Evas_Object * index, MpList_t * list) { MP_CHECK(list); _append_item(index, list); elm_index_level_go(index, 0); } - - diff --git a/src/widget/mp-list.c b/src/widget/mp-list.c index 80fd2dd..e9abe90 100644 --- a/src/widget/mp-list.c +++ b/src/widget/mp-list.c @@ -26,7 +26,7 @@ _mp_list_gl_flick_left_cb(void *data, Evas_Object * obj, void *event_info) //struct appdata *ad = (struct appdata *)data; //MP_CHECK(ad); //if (ad->vertical_scroll) - // return; + // return; elm_object_scroll_freeze_push(obj); } @@ -36,7 +36,7 @@ _mp_list_gl_flick_right_cb(void *data, Evas_Object * obj, void *event_info) //struct appdata *ad = (struct appdata *)data; //MP_CHECK(ad); //if (ad->vertical_scroll) - // return; + // return; elm_object_scroll_freeze_push(obj); } @@ -54,13 +54,15 @@ _mp_list_gl_mode_left(void *data, Evas_Object * obj, void *event_info) { MP_CHECK(obj); MP_CHECK(event_info); - MP_CHECK(elm_genlist_item_select_mode_get(event_info) != ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + MP_CHECK(elm_genlist_item_select_mode_get(event_info) != + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); //MP_CHECK(elm_genlist_item_select_mode_get(event_info) != ELM_OBJECT_SELECT_MODE_NONE); // disable sweep if edit mode. MP_CHECK(elm_genlist_item_flip_get(event_info) == EINA_FALSE); // Finish genlist sweep elm_genlist_item_decorate_mode_set(event_info, "slide", EINA_FALSE); - elm_genlist_item_select_mode_set(event_info, ELM_OBJECT_SELECT_MODE_DEFAULT); + elm_genlist_item_select_mode_set(event_info, + ELM_OBJECT_SELECT_MODE_DEFAULT); mp_list_item_data_t *item_data = elm_object_item_data_get(event_info); item_data->checked = false; } @@ -70,21 +72,24 @@ _mp_list_gl_mode_right(void *data, Evas_Object * obj, void *event_info) { MP_CHECK(obj); MP_CHECK(event_info); - MP_CHECK(elm_genlist_item_select_mode_get(event_info) != ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + MP_CHECK(elm_genlist_item_select_mode_get(event_info) != + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); /* reset old sweep item mode */ - Elm_Object_Item *it = (Elm_Object_Item *)elm_genlist_decorated_item_get(obj); + Elm_Object_Item *it = + (Elm_Object_Item *) elm_genlist_decorated_item_get(obj); if (it && (it != event_info)) { elm_genlist_item_decorate_mode_set(it, "slide", EINA_FALSE); - elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DEFAULT); + elm_genlist_item_select_mode_set(it, + ELM_OBJECT_SELECT_MODE_DEFAULT); mp_list_item_data_t *item_data = elm_object_item_data_get(it); item_data->checked = false; } - // disable sweep if edit mode. MP_CHECK(elm_genlist_item_flip_get(event_info) == EINA_FALSE); // Start genlist sweep elm_genlist_item_decorate_mode_set(event_info, "slide", EINA_TRUE); - elm_genlist_item_select_mode_set(event_info, ELM_OBJECT_SELECT_MODE_NONE); + elm_genlist_item_select_mode_set(event_info, + ELM_OBJECT_SELECT_MODE_NONE); mp_list_item_data_t *item_data = elm_object_item_data_get(event_info); item_data->checked = true; @@ -105,35 +110,38 @@ _mp_list_gl_mode_cancel(void *data, Evas_Object * obj, void *event_info) #endif static void -_mp_list_drag_start_cb(void *data, Evas_Object *obj, void *event_info) +_mp_list_drag_start_cb(void *data, Evas_Object * obj, void *event_info) { startfunc; - MpList_t *list = (MpList_t*)data; + MpList_t *list = (MpList_t *) data; MP_CHECK(list); list->scroll_drag_status = true; } static void -_mp_list_drag_stop_cb(void *data, Evas_Object *obj, void *event_info) +_mp_list_drag_stop_cb(void *data, Evas_Object * obj, void *event_info) { startfunc; - MpList_t *list = (MpList_t*)data; + MpList_t *list = (MpList_t *) data; MP_CHECK(list); list->scroll_drag_status = false; } -unsigned int -_mp_list_get_count(void *thiz, MpListEditType_e type) +unsigned int _mp_list_get_count(void *thiz, MpListEditType_e type) { MpList_t *list = thiz; MP_CHECK_VAL(list->genlist, 0); - unsigned int count = MP_LIST_OBJ_IS_GENGRID(list->genlist) ? elm_gengrid_items_count(list->genlist) : elm_genlist_items_count(list->genlist); + unsigned int count = + MP_LIST_OBJ_IS_GENGRID(list-> + genlist) ? elm_gengrid_items_count(list-> + genlist) + : elm_genlist_items_count(list->genlist); if (list->bottom_counter_item) { --count; @@ -142,8 +150,7 @@ _mp_list_get_count(void *thiz, MpListEditType_e type) return count; } -static unsigned int -_mp_list_get_select_count(void *thiz) +static unsigned int _mp_list_get_select_count(void *thiz) { MpList_t *list = thiz; MP_CHECK_VAL(list->genlist, 0); @@ -155,7 +162,8 @@ _mp_list_get_select_count(void *thiz) while (item) { data = elm_object_item_data_get(item); item = mp_list_item_next_get(item); - if (data && data->item_type == MP_LIST_ITEM_TYPE_NORMAL && data->checked) { + if (data && data->item_type == MP_LIST_ITEM_TYPE_NORMAL + && data->checked) { count++; } } @@ -163,7 +171,8 @@ _mp_list_get_select_count(void *thiz) } static void -_mp_list_layout_del_cb(void *data, Evas * e, Evas_Object * obj, void *event_info) +_mp_list_layout_del_cb(void *data, Evas * e, Evas_Object * obj, + void *event_info) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); @@ -179,12 +188,12 @@ _mp_list_layout_del_cb(void *data, Evas * e, Evas_Object * obj, void *event_info endfunc; } -static Evas_Object * -_mp_list_view_create_box(MpList_t *list) +static Evas_Object *_mp_list_view_create_box(MpList_t * list) { startfunc; Evas_Object *box = elm_box_add(list->layout); - evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); evas_object_show(box); return box; @@ -203,12 +212,15 @@ int _mp_list_set_fastscroll(void *thiz) if (list->fast_scroll == NULL) { ERROR_TRACE("list->fast_scroll create failed"); } - elm_object_part_content_set(list->layout, "elm.swallow.content.index", list->fast_scroll); + elm_object_part_content_set(list->layout, + "elm.swallow.content.index", + list->fast_scroll); mp_index_append_item(list->fast_scroll, list); } elm_object_signal_emit(list->layout, "show.fastscroll", "*"); if (list->genlist) { - elm_scroller_policy_set(list->genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); + elm_scroller_policy_set(list->genlist, ELM_SCROLLER_POLICY_OFF, + ELM_SCROLLER_POLICY_OFF); } } else { elm_object_signal_emit(list->layout, "hide.fastscroll", "*"); @@ -246,17 +258,20 @@ static void _mp_list_set_reorder(void *thiz, bool reorder) if (reorder) { mp_list_reorder_mode_set(list->genlist, EINA_TRUE); - mp_list_select_mode_set(list->genlist, ELM_OBJECT_SELECT_MODE_ALWAYS); + mp_list_select_mode_set(list->genlist, + ELM_OBJECT_SELECT_MODE_ALWAYS); } else { - mp_list_select_mode_set(list->genlist, ELM_OBJECT_SELECT_MODE_DEFAULT); + mp_list_select_mode_set(list->genlist, + ELM_OBJECT_SELECT_MODE_DEFAULT); mp_list_reorder_mode_set(list->genlist, EINA_FALSE); } } -static void _mp_list_realized_item_update(void *thiz, const char *part, int field) +static void _mp_list_realized_item_update(void *thiz, const char *part, + int field) { DEBUG_TRACE(""); MpList_t *list = thiz; @@ -288,14 +303,19 @@ static void _mp_list_set_edit(void *thiz, bool edit) if (edit) { if (!MP_LIST_OBJ_IS_GENGRID(list->genlist)) { - Elm_Object_Item *sweeped_item = (Elm_Object_Item *)elm_genlist_decorated_item_get(list->genlist); + Elm_Object_Item *sweeped_item = + (Elm_Object_Item *) elm_genlist_decorated_item_get(list-> + genlist); if (sweeped_item) { - mp_list_item_data_t *data = elm_object_item_data_get(sweeped_item); + mp_list_item_data_t *data = + elm_object_item_data_get(sweeped_item); if (data) { data->checked = false; } - elm_genlist_item_decorate_mode_set(sweeped_item, "slide", EINA_FALSE); - elm_genlist_item_select_mode_set(sweeped_item, ELM_OBJECT_SELECT_MODE_DEFAULT); + elm_genlist_item_decorate_mode_set(sweeped_item, "slide", + EINA_FALSE); + elm_genlist_item_select_mode_set(sweeped_item, + ELM_OBJECT_SELECT_MODE_DEFAULT); elm_genlist_item_update(sweeped_item); } @@ -305,19 +325,23 @@ static void _mp_list_set_edit(void *thiz, bool edit) mp_list_reorder_mode_set(list->genlist, EINA_TRUE); } - mp_list_select_mode_set(list->genlist, ELM_OBJECT_SELECT_MODE_ALWAYS); + mp_list_select_mode_set(list->genlist, + ELM_OBJECT_SELECT_MODE_ALWAYS); } else { if (!MP_LIST_OBJ_IS_GENGRID(list->genlist)) { } - mp_list_select_mode_set(list->genlist, ELM_OBJECT_SELECT_MODE_DEFAULT); + mp_list_select_mode_set(list->genlist, + ELM_OBJECT_SELECT_MODE_DEFAULT); mp_list_reorder_mode_set(list->genlist, EINA_FALSE); if (mp_list_get_checked_count(list)) { Elm_Object_Item *item = mp_list_first_item_get(list->genlist); while (item) { - if (mp_list_item_select_mode_get(item) != ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) { + if (mp_list_item_select_mode_get(item) != + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) { mp_list_item_data_t *item_data = - (mp_list_item_data_t *) elm_object_item_data_get(item); + (mp_list_item_data_t *) + elm_object_item_data_get(item); MP_CHECK(item_data); item_data->checked = EINA_FALSE; } @@ -329,24 +353,24 @@ static void _mp_list_set_edit(void *thiz, bool edit) if (MP_LIST_OBJ_IS_GENGRID(list->genlist)) { elm_gengrid_realized_items_update(list->genlist); } - //char *title = NULL; //title = _mp_edit_view_get_view_title(list); //mp_common_set_toolbar_button_sensitivity(layout_data, 0); } -static void -_mp_list_edit_mode_sel(void *thiz, void *data) +static void _mp_list_edit_mode_sel(void *thiz, void *data) { startfunc; - MpList_t *list = (MpList_t *)thiz; - mp_list_item_data_t *it_data = (mp_list_item_data_t *)data; - Elm_Object_Item *gli = (Elm_Object_Item *)it_data->it; + MpList_t *list = (MpList_t *) thiz; + mp_list_item_data_t *it_data = (mp_list_item_data_t *) data; + Elm_Object_Item *gli = (Elm_Object_Item *) it_data->it; mp_list_item_selected_set(gli, EINA_FALSE); if (!MP_LIST_OBJ_IS_GENGRID(list->genlist)) { - if (elm_genlist_item_flip_get(gli) || elm_genlist_item_select_mode_get(gli) == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) { + if (elm_genlist_item_flip_get(gli) + || elm_genlist_item_select_mode_get(gli) == + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) { return; } } @@ -357,7 +381,9 @@ _mp_list_edit_mode_sel(void *thiz, void *data) MpView_t *view = mp_view_mgr_get_top_view(view_mgr); MP_CHECK(view); - mp_util_create_selectioninfo_with_count(view, mp_list_get_checked_count(list)); + mp_util_create_selectioninfo_with_count(view, + mp_list_get_checked_count + (list)); //view->selection_info = mp_util_create_selectioninfo_with_count(view, mp_list_get_checked_count(list)); } @@ -365,7 +391,7 @@ _mp_list_edit_mode_sel(void *thiz, void *data) static void _mp_list_change_display_mode(void *thiz, MpListDisplayMode_e mode) { - MpList_t *list = (MpList_t *)thiz; + MpList_t *list = (MpList_t *) thiz; MP_CHECK(list); list->display_mode = mode; @@ -382,11 +408,10 @@ _mp_list_change_display_mode(void *thiz, MpListDisplayMode_e mode) } } -static void -_mp_list_selected_item_data_get(void *thiz, GList **selected) +static void _mp_list_selected_item_data_get(void *thiz, GList ** selected) { startfunc; - MpList_t *list = (MpList_t *)thiz; + MpList_t *list = (MpList_t *) thiz; GList *sel_list = NULL; if (!list->genlist) { @@ -401,7 +426,8 @@ _mp_list_selected_item_data_get(void *thiz, GList **selected) } while (item) { - if (mp_list_item_select_mode_get(item) != ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) { + if (mp_list_item_select_mode_get(item) != + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) { gl_item = elm_object_item_data_get(item); if (gl_item && gl_item->checked) { sel_list = g_list_append(sel_list, gl_item); @@ -409,17 +435,16 @@ _mp_list_selected_item_data_get(void *thiz, GList **selected) } item = mp_list_item_next_get(item); } -END: + END: if (selected) { *selected = sel_list; } } -static void -_mp_list_all_item_data_get(void *thiz, GList **selected) +static void _mp_list_all_item_data_get(void *thiz, GList ** selected) { startfunc; - MpList_t *list = (MpList_t *)thiz; + MpList_t *list = (MpList_t *) thiz; GList *sel_list = NULL; if (!list->genlist) { @@ -440,13 +465,14 @@ _mp_list_all_item_data_get(void *thiz, GList **selected) } item = mp_list_item_next_get(item); } -END: + END: if (selected) { *selected = sel_list; } } -void mp_list_init(MpList_t *list, Evas_Object *parent, MpListType_e list_type) +void mp_list_init(MpList_t * list, Evas_Object * parent, + MpListType_e list_type) { startfunc; MP_CHECK(list); @@ -460,8 +486,10 @@ void mp_list_init(MpList_t *list, Evas_Object *parent, MpListType_e list_type) list->box = _mp_list_view_create_box(list); MP_CHECK(list->box); - evas_object_size_hint_weight_set(list->box, EVAS_HINT_EXPAND, EVAS_HINT_FILL); - evas_object_size_hint_align_set(list->box, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(list->box, EVAS_HINT_EXPAND, + EVAS_HINT_FILL); + evas_object_size_hint_align_set(list->box, EVAS_HINT_FILL, + EVAS_HINT_FILL); elm_object_part_content_set(list->layout, "list_content", list->box); evas_object_show(list->box); @@ -488,18 +516,19 @@ void mp_list_init(MpList_t *list, Evas_Object *parent, MpListType_e list_type) list->drag_stop_cb = _mp_list_drag_stop_cb; list->realized_item_update = _mp_list_realized_item_update; //add free callback - evas_object_event_callback_add(list->layout, EVAS_CALLBACK_FREE, _mp_list_layout_del_cb, - list); + evas_object_event_callback_add(list->layout, EVAS_CALLBACK_FREE, + _mp_list_layout_del_cb, list); } -Evas_Object *mp_list_get_layout(MpList_t *list) +Evas_Object *mp_list_get_layout(MpList_t * list) { startfunc; MP_CHECK_NULL(list); MP_CHECK_NULL(list->layout); return list->layout; } -int mp_list_hide_fast_scroll(MpList_t *list) + +int mp_list_hide_fast_scroll(MpList_t * list) { startfunc; MP_CHECK_VAL(list, -1); @@ -507,7 +536,7 @@ int mp_list_hide_fast_scroll(MpList_t *list) return list->hide_fastscroll(list); } -int mp_list_show_fast_scroll(MpList_t *list) +int mp_list_show_fast_scroll(MpList_t * list) { startfunc; MP_CHECK_VAL(list, -1); @@ -515,7 +544,7 @@ int mp_list_show_fast_scroll(MpList_t *list) return list->show_fastscroll(list); } -void mp_list_update(MpList_t *list) +void mp_list_update(MpList_t * list) { startfunc; MP_CHECK(list); @@ -523,7 +552,8 @@ void mp_list_update(MpList_t *list) list->update(list); } -void mp_list_realized_item_part_update(MpList_t *list, const char *part, int field) +void mp_list_realized_item_part_update(MpList_t * list, const char *part, + int field) { startfunc; MP_CHECK(list); @@ -531,7 +561,7 @@ void mp_list_realized_item_part_update(MpList_t *list, const char *part, int fie list->realized_item_update(list, part, field); } -void mp_list_set_reorder(MpList_t *list, bool reorder) +void mp_list_set_reorder(MpList_t * list, bool reorder) { startfunc; MP_CHECK(list); @@ -540,14 +570,14 @@ void mp_list_set_reorder(MpList_t *list, bool reorder) list->set_reorder(list, reorder); } -bool mp_list_get_reorder(MpList_t *list) +bool mp_list_get_reorder(MpList_t * list) { startfunc; MP_CHECK_FALSE(list); return list->reorderable; } -void mp_list_set_edit(MpList_t *list, bool edit) +void mp_list_set_edit(MpList_t * list, bool edit) { startfunc; MP_CHECK(list); @@ -557,30 +587,31 @@ void mp_list_set_edit(MpList_t *list, bool edit) if (!edit) { MpView_t *view = mp_view_mgr_get_top_view(GET_VIEW_MGR); MP_CHECK(view); - view->selection_info = mp_util_create_selectioninfo_with_count(view, 0); + view->selection_info = + mp_util_create_selectioninfo_with_count(view, 0); } } -bool mp_list_get_edit(MpList_t *list) +bool mp_list_get_edit(MpList_t * list) { MP_CHECK_FALSE(list); return list->edit_mode; } -void mp_list_set_edit_type(MpList_t *list, MpListEditType_e type) +void mp_list_set_edit_type(MpList_t * list, MpListEditType_e type) { MP_CHECK(list); list->edit_type = type; mp_debug("list edit type set as [%d]", list->edit_type); } -MpListEditType_e mp_list_get_edit_type(MpList_t *list) +MpListEditType_e mp_list_get_edit_type(MpList_t * list) { MP_CHECK_VAL(list, 0); return list->edit_type; } -void mp_list_edit_mode_sel(MpList_t *list, void *data) +void mp_list_edit_mode_sel(MpList_t * list, void *data) { startfunc; MP_CHECK(list); @@ -588,7 +619,7 @@ void mp_list_edit_mode_sel(MpList_t *list, void *data) list->edit_mode_sel(list, data); } -mp_group_type_e mp_list_get_group_type(MpList_t *list) +mp_group_type_e mp_list_get_group_type(MpList_t * list) { startfunc; MP_CHECK_VAL(list, -1); @@ -596,7 +627,7 @@ mp_group_type_e mp_list_get_group_type(MpList_t *list) return list->get_group_type(list); } -mp_track_type_e mp_list_get_track_type(MpList_t *list) +mp_track_type_e mp_list_get_track_type(MpList_t * list) { startfunc; MP_CHECK_VAL(list, -1); @@ -604,7 +635,7 @@ mp_track_type_e mp_list_get_track_type(MpList_t *list) return list->get_track_type(list); } -void *mp_list_get_playlist_handle(MpList_t *list) +void *mp_list_get_playlist_handle(MpList_t * list) { startfunc; MP_CHECK_NULL(list); @@ -612,7 +643,8 @@ void *mp_list_get_playlist_handle(MpList_t *list) return list->get_playlist_handle(list); } -unsigned int mp_list_get_editable_count(MpList_t *list, MpListEditType_e type) +unsigned int mp_list_get_editable_count(MpList_t * list, + MpListEditType_e type) { startfunc; MP_CHECK_VAL(list, 0); @@ -620,7 +652,7 @@ unsigned int mp_list_get_editable_count(MpList_t *list, MpListEditType_e type) return list->get_count(list, type); } -unsigned int mp_list_get_checked_count(MpList_t *list) +unsigned int mp_list_get_checked_count(MpList_t * list) { startfunc; MP_CHECK_VAL(list, 0); @@ -628,22 +660,19 @@ unsigned int mp_list_get_checked_count(MpList_t *list) return list->get_select_count(list); } -bool -mp_list_is_display_mode_changable(MpList_t *list) +bool mp_list_is_display_mode_changable(MpList_t * list) { MP_CHECK_FALSE(list); return list->display_mode_changable; } -MpListDisplayMode_e -mp_list_get_display_mode(MpList_t *list) +MpListDisplayMode_e mp_list_get_display_mode(MpList_t * list) { MP_CHECK_VAL(list, 0); return list->display_mode; } -void -mp_list_change_display_mode(MpList_t *list, MpListDisplayMode_e mode) +void mp_list_change_display_mode(MpList_t * list, MpListDisplayMode_e mode) { startfunc; MP_CHECK(list); @@ -653,24 +682,25 @@ mp_list_change_display_mode(MpList_t *list, MpListDisplayMode_e mode) list->change_display_mode(list, mode); } -Elm_Object_Item * -mp_list_first_item_get(Evas_Object *obj) +Elm_Object_Item *mp_list_first_item_get(Evas_Object * obj) { MP_CHECK_NULL(obj); - return MP_LIST_OBJ_IS_GENGRID(obj) ? elm_gengrid_first_item_get(obj) : elm_genlist_first_item_get(obj); + return MP_LIST_OBJ_IS_GENGRID(obj) ? elm_gengrid_first_item_get(obj) : + elm_genlist_first_item_get(obj); } -Elm_Object_Item * -mp_list_item_next_get(Elm_Object_Item *item) +Elm_Object_Item *mp_list_item_next_get(Elm_Object_Item * item) { MP_CHECK_NULL(item); Evas_Object *obj = elm_object_item_widget_get(item); MP_CHECK_NULL(obj); - return MP_LIST_OBJ_IS_GENGRID(obj) ? elm_gengrid_item_next_get(item) : elm_genlist_item_next_get(item); + return MP_LIST_OBJ_IS_GENGRID(obj) ? elm_gengrid_item_next_get(item) : + elm_genlist_item_next_get(item); } void -mp_list_select_mode_set(Evas_Object *obj, Elm_Object_Select_Mode select_mode) +mp_list_select_mode_set(Evas_Object * obj, + Elm_Object_Select_Mode select_mode) { MP_CHECK(obj); @@ -681,15 +711,16 @@ mp_list_select_mode_set(Evas_Object *obj, Elm_Object_Select_Mode select_mode) } } -Elm_Object_Select_Mode -mp_list_select_mode_get(Evas_Object *obj) +Elm_Object_Select_Mode mp_list_select_mode_get(Evas_Object * obj) { MP_CHECK_VAL(obj, ELM_OBJECT_SELECT_MODE_DEFAULT); - return MP_LIST_OBJ_IS_GENGRID(obj) ? elm_gengrid_select_mode_get(obj) : elm_genlist_select_mode_get(obj); + return MP_LIST_OBJ_IS_GENGRID(obj) ? elm_gengrid_select_mode_get(obj) : + elm_genlist_select_mode_get(obj); } void -mp_list_item_select_mode_set(Elm_Object_Item *item, Elm_Object_Select_Mode select_mode) +mp_list_item_select_mode_set(Elm_Object_Item * item, + Elm_Object_Select_Mode select_mode) { MP_CHECK(item); Evas_Object *obj = elm_object_item_widget_get(item); @@ -702,17 +733,17 @@ mp_list_item_select_mode_set(Elm_Object_Item *item, Elm_Object_Select_Mode selec } } -Elm_Object_Select_Mode -mp_list_item_select_mode_get(Elm_Object_Item *item) +Elm_Object_Select_Mode mp_list_item_select_mode_get(Elm_Object_Item * item) { MP_CHECK_VAL(item, ELM_OBJECT_SELECT_MODE_DEFAULT); Evas_Object *obj = elm_object_item_widget_get(item); MP_CHECK_VAL(obj, ELM_OBJECT_SELECT_MODE_DEFAULT); - return MP_LIST_OBJ_IS_GENGRID(obj) ? elm_gengrid_item_select_mode_get(item) : elm_genlist_item_select_mode_get(item); + return MP_LIST_OBJ_IS_GENGRID(obj) ? + elm_gengrid_item_select_mode_get(item) : + elm_genlist_item_select_mode_get(item); } -void -mp_list_reorder_mode_set(Evas_Object *obj, Eina_Bool reorder_mode) +void mp_list_reorder_mode_set(Evas_Object * obj, Eina_Bool reorder_mode) { MP_CHECK(obj); if (MP_LIST_OBJ_IS_GENGRID(obj)) { @@ -722,8 +753,7 @@ mp_list_reorder_mode_set(Evas_Object *obj, Eina_Bool reorder_mode) } } -void -mp_list_item_selected_set(Elm_Object_Item *item, Eina_Bool selected) +void mp_list_item_selected_set(Elm_Object_Item * item, Eina_Bool selected) { MP_CHECK(item); Evas_Object *obj = elm_object_item_widget_get(item); @@ -736,16 +766,17 @@ mp_list_item_selected_set(Elm_Object_Item *item, Eina_Bool selected) } } -Eina_Bool -mp_list_item_selected_get(Elm_Object_Item *item) +Eina_Bool mp_list_item_selected_get(Elm_Object_Item * item) { MP_CHECK_FALSE(item); Evas_Object *obj = elm_object_item_widget_get(item); MP_CHECK_FALSE(obj); - return MP_LIST_OBJ_IS_GENGRID(obj) ? elm_gengrid_item_selected_get(item) : elm_genlist_item_selected_get(item); + return MP_LIST_OBJ_IS_GENGRID(obj) ? + elm_gengrid_item_selected_get(item) : + elm_genlist_item_selected_get(item); } -void mp_list_selected_item_data_get(MpList_t *list, GList **selected) +void mp_list_selected_item_data_get(MpList_t * list, GList ** selected) { startfunc; MP_CHECK(list); @@ -757,7 +788,7 @@ void mp_list_selected_item_data_get(MpList_t *list, GList **selected) return; } -void mp_list_all_item_data_get(MpList_t *list, GList **selected) +void mp_list_all_item_data_get(MpList_t * list, GList ** selected) { startfunc; MP_CHECK(list); @@ -771,7 +802,8 @@ void mp_list_all_item_data_get(MpList_t *list, GList **selected) //this is for fastscroll index -const char * mp_list_get_list_item_label(MpList_t *list, Elm_Object_Item *item) +const char *mp_list_get_list_item_label(MpList_t * list, + Elm_Object_Item * item) { MP_CHECK_NULL(list); if (list->get_label) { @@ -781,17 +813,21 @@ const char * mp_list_get_list_item_label(MpList_t *list, Elm_Object_Item *item) return NULL; } -void mp_list_double_tap(MpList_t *list) +void mp_list_double_tap(MpList_t * list) { startfunc; MP_CHECK(list); MP_CHECK(list->genlist); MP_LIST_OBJ_IS_GENGRID(list->genlist) ? - elm_gengrid_item_bring_in(elm_gengrid_first_item_get(list->genlist), ELM_GENGRID_ITEM_SCROLLTO_TOP) : - elm_genlist_item_bring_in(elm_genlist_first_item_get(list->genlist), ELM_GENLIST_ITEM_SCROLLTO_TOP); + elm_gengrid_item_bring_in(elm_gengrid_first_item_get + (list->genlist), + ELM_GENGRID_ITEM_SCROLLTO_TOP) : + elm_genlist_item_bring_in(elm_genlist_first_item_get + (list->genlist), + ELM_GENLIST_ITEM_SCROLLTO_TOP); } -void mp_list_rotate(MpList_t *list) +void mp_list_rotate(MpList_t * list) { startfunc; MP_CHECK(list); @@ -802,7 +838,8 @@ void mp_list_rotate(MpList_t *list) mp_list_item_data_t *mp_list_item_data_create(MpListItemType_e item_type) { - mp_list_item_data_t *item_data = calloc(1, sizeof(mp_list_item_data_t)); + mp_list_item_data_t *item_data = + calloc(1, sizeof(mp_list_item_data_t)); if (item_data) { item_data->item_type = item_type; } @@ -810,15 +847,18 @@ mp_list_item_data_t *mp_list_item_data_create(MpListItemType_e item_type) return item_data; } -void mp_list_item_check_set(Elm_Object_Item *item, Eina_Bool checked) +void mp_list_item_check_set(Elm_Object_Item * item, Eina_Bool checked) { MP_CHECK(item); mp_list_item_data_t *item_data = elm_object_item_data_get(item); MP_CHECK(item_data); item_data->checked = checked; - Evas_Object *check_box_layout = elm_object_item_part_content_get(item, "elm.icon.2"); - Evas_Object *chk = elm_object_part_content_get(check_box_layout, "elm.swallow.content"); + Evas_Object *check_box_layout = + elm_object_item_part_content_get(item, "elm.icon.2"); + Evas_Object *chk = + elm_object_part_content_get(check_box_layout, + "elm.swallow.content"); if (chk) { elm_check_state_set(chk, checked); } else { @@ -829,12 +869,14 @@ void mp_list_item_check_set(Elm_Object_Item *item, Eina_Bool checked) } } -static char *_mp_list_bottom_counter_item_text_get_cb(void *data, Evas_Object *obj, const char *part) +static char *_mp_list_bottom_counter_item_text_get_cb(void *data, + Evas_Object * obj, + const char *part) { mp_list_item_data_t *item_data = data; MP_CHECK_NULL(item_data); - MpList_t *list = (MpList_t *)evas_object_data_get(obj, "list_data"); + MpList_t *list = (MpList_t *) evas_object_data_get(obj, "list_data"); MP_CHECK_NULL(list); MP_CHECK_NULL(list->bottom_counter_text_get_cb); if (!strcmp(part, "elm.text.end")) { @@ -844,17 +886,18 @@ static char *_mp_list_bottom_counter_item_text_get_cb(void *data, Evas_Object *o } } -static void _mp_list_bottom_counter_item_del_cb(void *data, Evas_Object *obj) +static void _mp_list_bottom_counter_item_del_cb(void *data, + Evas_Object * obj) { mp_list_item_data_t *item_data = data; IF_FREE(item_data); - MpList_t *list = (MpList_t *)evas_object_data_get(obj, "list_data"); + MpList_t *list = (MpList_t *) evas_object_data_get(obj, "list_data"); MP_CHECK(list); list->bottom_counter_item = NULL; } -Elm_Object_Item *mp_list_bottom_counter_item_append(MpList_t *list) +Elm_Object_Item *mp_list_bottom_counter_item_append(MpList_t * list) { MP_CHECK_NULL(list); MP_CHECK_NULL(list->genlist); @@ -872,16 +915,20 @@ Elm_Object_Item *mp_list_bottom_counter_item_append(MpList_t *list) itc.func.text_get = _mp_list_bottom_counter_item_text_get_cb; itc.func.del = _mp_list_bottom_counter_item_del_cb; - mp_list_item_data_t *item_data = mp_list_item_data_create(MP_LIST_ITEM_TYPE_BOTTOM_COUNTER); + mp_list_item_data_t *item_data = + mp_list_item_data_create(MP_LIST_ITEM_TYPE_BOTTOM_COUNTER); MP_CHECK_NULL(item_data); - Elm_Object_Item *item = elm_genlist_item_append(list->genlist, &itc, item_data, NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL); - elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + Elm_Object_Item *item = + elm_genlist_item_append(list->genlist, &itc, item_data, NULL, + ELM_GENLIST_ITEM_GROUP, NULL, NULL); + elm_genlist_item_select_mode_set(item, + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); list->bottom_counter_item = item; return item; } -GList * mp_list_get_checked_path_list(MpList_t *list) +GList *mp_list_get_checked_path_list(MpList_t * list) { MP_CHECK_NULL(list); GList *sel_list = NULL; @@ -897,7 +944,8 @@ GList * mp_list_get_checked_path_list(MpList_t *list) if (item && item->handle) { char *file_path = NULL; if (list->list_type == MP_LIST_TYPE_GROUP) { - mp_media_info_group_get_main_info(item->handle, &file_path); + mp_media_info_group_get_main_info(item->handle, + &file_path); } else { mp_media_info_get_file_path(item->handle, &file_path); } @@ -911,7 +959,7 @@ GList * mp_list_get_checked_path_list(MpList_t *list) return path_list; } -bool mp_list_is_in_checked_path_list(GList *path_list, char *file_path) +bool mp_list_is_in_checked_path_list(GList * path_list, char *file_path) { MP_CHECK_FALSE(path_list); MP_CHECK_FALSE(file_path); @@ -929,7 +977,7 @@ bool mp_list_is_in_checked_path_list(GList *path_list, char *file_path) return false; } -void mp_list_free_checked_path_list(GList *path_list) +void mp_list_free_checked_path_list(GList * path_list) { MP_CHECK(path_list); GList *node = NULL; @@ -943,7 +991,8 @@ void mp_list_free_checked_path_list(GList *path_list) g_list_free(path_list); } -void mp_list_item_reorder_moved_cb(void *data, Evas_Object *obj, void *event_info) +void mp_list_item_reorder_moved_cb(void *data, Evas_Object * obj, + void *event_info) { startfunc; @@ -954,7 +1003,8 @@ void mp_list_item_reorder_moved_cb(void *data, Evas_Object *obj, void *event_inf int cur_sequence = 0; Elm_Object_Item *temp = elm_genlist_first_item_get(list->genlist); while (temp) { - mp_list_item_data_t *item_data = (mp_list_item_data_t *) elm_object_item_data_get(temp); + mp_list_item_data_t *item_data = + (mp_list_item_data_t *) elm_object_item_data_get(temp); MP_CHECK(item_data); if (cur_sequence != item_data->index) { mp_view_mgr_post_event(GET_VIEW_MGR, MP_REORDER_ENABLE); @@ -965,4 +1015,3 @@ void mp_list_item_reorder_moved_cb(void *data, Evas_Object *obj, void *event_inf } mp_view_mgr_post_event(GET_VIEW_MGR, MP_REORDER_DISABLE); } - diff --git a/src/widget/mp-lockscreenmini.c b/src/widget/mp-lockscreenmini.c index 979ca59..703a3a8 100644 --- a/src/widget/mp-lockscreenmini.c +++ b/src/widget/mp-lockscreenmini.c @@ -49,32 +49,39 @@ enum { static time_t press_time; static time_t release_time; -static Evas_Object *_load_edj(Evas_Object * parent, const char *file, const char *group); +static Evas_Object *_load_edj(Evas_Object * parent, const char *file, + const char *group); static void _load_lockscreenmini(struct appdata *ad); -static void _mp_lockscreenmini_update_layout(struct appdata *ad, bool landscape); +static void _mp_lockscreenmini_update_layout(struct appdata *ad, + bool landscape); static int port_id; -static void lockscreen_message_port_cb(int trusted_local_port_id, const char *remote_app_id, - const char *remote_port, bool trusted_remote_port, bundle *message, void *data) +static void lockscreen_message_port_cb(int trusted_local_port_id, + const char *remote_app_id, + const char *remote_port, + bool trusted_remote_port, + bundle * message, void *data) { //do nothing } void register_port() { - port_id = message_port_register_trusted_local_port("local/port/id/to/specify", lockscreen_message_port_cb, NULL); - if (port_id < 0) { - DEBUG_TRACE("unable to register port"); - } + port_id = + message_port_register_trusted_local_port + ("local/port/id/to/specify", lockscreen_message_port_cb, NULL); + if (port_id < 0) { + DEBUG_TRACE("unable to register port"); + } } void deregister_port() { int ret; - ret = message_port_unregister_trusted_local_port(port_id); - if (ret != MESSAGE_PORT_ERROR_NONE) { - DEBUG_TRACE("unable to deregister"); - } + ret = message_port_unregister_trusted_local_port(port_id); + if (ret != MESSAGE_PORT_ERROR_NONE) { + DEBUG_TRACE("unable to deregister"); + } } static bool _mp_lockscreenmini_is_long_press() @@ -93,16 +100,16 @@ static bool _mp_lockscreenmini_is_long_press() return result; } -static Evas_Object * -_load_edj(Evas_Object *parent, const char *file, const char *group) +static Evas_Object *_load_edj(Evas_Object * parent, const char *file, + const char *group) { Evas_Object *eo; int r; eo = elm_layout_add(parent); if (eo) { - char edje_path[1024] ={0}; - char * path = app_get_resource_path(); + char edje_path[1024] = { 0 }; + char *path = app_get_resource_path(); MP_CHECK_NULL(path); snprintf(edje_path, 1024, "%s%s/%s", path, "edje", file); @@ -114,7 +121,8 @@ _load_edj(Evas_Object *parent, const char *file, const char *group) evas_object_del(eo); return NULL; } - evas_object_size_hint_weight_set(eo, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(eo, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); elm_win_resize_object_add(parent, eo); evas_object_show(eo); } @@ -122,22 +130,28 @@ _load_edj(Evas_Object *parent, const char *file, const char *group) return eo; } -static void _lockscreen_cb(minicontrol_viewer_event_e event_type, bundle *event_arg) +static void _lockscreen_cb(minicontrol_viewer_event_e event_type, + bundle * event_arg) { - /*Need to handle events*/ + /*Need to handle events */ } -static void -_load_lockscreenmini(struct appdata *ad) +static void _load_lockscreenmini(struct appdata *ad) { DEBUG_TRACE_FUNC(); MP_CHECK(ad); Evas_Object *win = NULL; #ifndef MP_SOUND_PLAYER - win = minicontrol_create_window("music-minicontrol.LOCKSCREEN", MINICONTROL_TARGET_VIEWER_STOCK_LOCK_SCREEN, _lockscreen_cb); + win = + minicontrol_create_window("music-minicontrol.LOCKSCREEN", + MINICONTROL_TARGET_VIEWER_STOCK_LOCK_SCREEN, + _lockscreen_cb); #else - win = minicontrol_create_window("sound-minicontrol.LOCKSCREEN", MINICONTROL_TARGET_VIEWER_STOCK_LOCK_SCREEN, _lockscreen_cb); + win = + minicontrol_create_window("sound-minicontrol.LOCKSCREEN", + MINICONTROL_TARGET_VIEWER_STOCK_LOCK_SCREEN, + _lockscreen_cb); #endif if (!win) { @@ -155,22 +169,25 @@ _load_lockscreenmini(struct appdata *ad) return; } - ad->lockscreen_wallpaper = (char *)malloc(WALLPAPER_LENGTH * sizeof(char)); - ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, &ad->lockscreen_wallpaper); - if(ret != SYSTEM_SETTINGS_ERROR_NONE) { + ad->lockscreen_wallpaper = + (char *) malloc(WALLPAPER_LENGTH * sizeof(char)); + ret = + system_settings_get_value_string + (SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, + &ad->lockscreen_wallpaper); + if (ret != SYSTEM_SETTINGS_ERROR_NONE) { ERROR_TRACE("Failed to get locksreen wallpaper"); } /* load edje */ _mp_lockscreenmini_update_layout(ad, false); - /*evas_object_show(eo);*/ + /*evas_object_show(eo); */ bundle_free(b); return; } -void -mp_lockscreenmini_update_winmini_size(struct appdata *ad) +void mp_lockscreenmini_update_winmini_size(struct appdata *ad) { DEBUG_TRACE_FUNC(); MP_CHECK(ad); @@ -190,13 +207,14 @@ mp_lockscreenmini_update_winmini_size(struct appdata *ad) LOCKSCREEN_MINI_CONTROLLER_WIDTH = 300; } - evas_object_resize(ad->win_lockmini, LOCKSCREEN_MINI_CONTROLLER_WIDTH * scale, LOCKSCREEN_MINI_CONTROLLER_HEIGHT * scale); + evas_object_resize(ad->win_lockmini, + LOCKSCREEN_MINI_CONTROLLER_WIDTH * scale, + LOCKSCREEN_MINI_CONTROLLER_HEIGHT * scale); return; } -int -mp_lockscreenmini_create(struct appdata *ad) +int mp_lockscreenmini_create(struct appdata *ad) { DEBUG_TRACE_FUNC(); mp_retvm_if(ad == NULL, -1, "appdata is NULL"); @@ -217,8 +235,7 @@ mp_lockscreenmini_create(struct appdata *ad) } -int -mp_lockscreenmini_show(struct appdata *ad) +int mp_lockscreenmini_show(struct appdata *ad) { DEBUG_TRACE("minicontroller view show!!"); mp_retvm_if(ad == NULL, -1, "appdata is NULL"); @@ -236,7 +253,7 @@ mp_lockscreenmini_show(struct appdata *ad) mp_lockscreenmini_update(ad); char *path = app_get_data_path(); - char lscr_state[1024] = {0}; + char lscr_state[1024] = { 0 }; snprintf(lscr_state, 1024, "%s%s", path, MP_LSCR_CONTROL); free(path); FILE *fp = fopen(lscr_state, "w"); @@ -257,16 +274,19 @@ static void _mp_lockscreenmini_update_btn(struct appdata *ad) MP_CHECK(!ad->is_lcd_off); if (ad->player_state == PLAY_STATE_PLAYING) { - edje_object_signal_emit(elm_layout_edje_get(ad->lockmini_layout), "play_btn_visible", "play_btn"); - edje_object_signal_emit(elm_layout_edje_get(ad->lockmini_layout), "pause_btn_invisible", "pause_btn"); + edje_object_signal_emit(elm_layout_edje_get(ad->lockmini_layout), + "play_btn_visible", "play_btn"); + edje_object_signal_emit(elm_layout_edje_get(ad->lockmini_layout), + "pause_btn_invisible", "pause_btn"); } else { - edje_object_signal_emit(elm_layout_edje_get(ad->lockmini_layout), "play_btn_invisible", "play_btn"); - edje_object_signal_emit(elm_layout_edje_get(ad->lockmini_layout), "pause_btn_visible", "pause_btn"); + edje_object_signal_emit(elm_layout_edje_get(ad->lockmini_layout), + "play_btn_invisible", "play_btn"); + edje_object_signal_emit(elm_layout_edje_get(ad->lockmini_layout), + "pause_btn_visible", "pause_btn"); } } -static Eina_Bool -_mp_lockscreenmini_btn_update_timer(void *data) +static Eina_Bool _mp_lockscreenmini_btn_update_timer(void *data) { struct appdata *ad = data; MP_CHECK_FALSE(ad); @@ -281,15 +301,16 @@ static void _mp_lockscreenmini_update_playpause_btn(struct appdata *ad) { mp_ecore_timer_del(ad->lockmini_button_timer); - if (ad->player_state == PLAY_STATE_PLAYING || ad->player_state == PLAY_STATE_PAUSED) { + if (ad->player_state == PLAY_STATE_PLAYING + || ad->player_state == PLAY_STATE_PAUSED) { _mp_lockscreenmini_update_btn(ad); } else { - ad->lockmini_button_timer = ecore_timer_add(1.0, _mp_lockscreenmini_btn_update_timer, ad); + ad->lockmini_button_timer = + ecore_timer_add(1.0, _mp_lockscreenmini_btn_update_timer, ad); } } -void -mp_lockscreenmini_update_control(struct appdata *ad) +void mp_lockscreenmini_update_control(struct appdata *ad) { startfunc; mp_retm_if(ad == NULL, "appdata is NULL"); @@ -312,7 +333,9 @@ Eina_Bool _mp_lockscreenmini_hide_music_controller(void *data) return EINA_FALSE; } -static void _mp_lockscreenmini_play_pause_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_lockscreenmini_play_pause_btn_clicked_cb(void *data, + Evas_Object * obj, + void *event_info) { DEBUG_TRACE("play/pause button clicked"); @@ -322,10 +345,14 @@ static void _mp_lockscreenmini_play_pause_btn_clicked_cb(void *data, Evas_Object if (ad->player_state == PLAY_STATE_PLAYING) { ad->idle_unlocked = true; - system_settings_get_value_int(SYSTEM_SETTINGS_KEY_LOCK_STATE, &lock_state); + system_settings_get_value_int(SYSTEM_SETTINGS_KEY_LOCK_STATE, + &lock_state); DEBUG_TRACE("lock state : %d", lock_state); if (lock_state == SYSTEM_SETTINGS_LOCK_STATE_LOCK) { - ad->lockmini_idle_timer = ecore_timer_add((2 * 60), _mp_lockscreenmini_hide_music_controller, ad); + ad->lockmini_idle_timer = + ecore_timer_add((2 * 60), + _mp_lockscreenmini_hide_music_controller, + ad); } mp_play_control_play_pause(ad, false); } else { @@ -337,11 +364,13 @@ static void _mp_lockscreenmini_play_pause_btn_clicked_cb(void *data, Evas_Object } } -static void _mp_lockscreenmini_ff_rew_btn_pressed_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_lockscreenmini_ff_rew_btn_pressed_cb(void *data, + Evas_Object * obj, + void *event_info) { DEBUG_TRACE("button pressed"); time(&press_time); - char *source = (char *)data; + char *source = (char *) data; if (!g_strcmp0(source, CONTROLLER_FF_SOURCE)) { mp_play_control_ff(true, false, false); } else { @@ -349,7 +378,9 @@ static void _mp_lockscreenmini_ff_rew_btn_pressed_cb(void *data, Evas_Object *ob } } -static void _mp_lockscreenmini_ff_rew_btn_unpressed_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_lockscreenmini_ff_rew_btn_unpressed_cb(void *data, + Evas_Object * obj, + void *event_info) { DEBUG_TRACE("button unpressed"); time(&release_time); @@ -358,24 +389,28 @@ static void _mp_lockscreenmini_ff_rew_btn_unpressed_cb(void *data, Evas_Object * MP_CHECK(ad); MP_CHECK(ad->lockmini_layout); - char *source = (char *)data; + char *source = (char *) data; if (!g_strcmp0(source, CONTROLLER_FF_SOURCE)) { - elm_object_signal_emit(ad->lockmini_layout, "signal.button.unpressed", "ff_btn"); + elm_object_signal_emit(ad->lockmini_layout, + "signal.button.unpressed", "ff_btn"); mp_play_control_ff(false, false, false); } else { - elm_object_signal_emit(ad->lockmini_layout, "signal.button.unpressed", "rew_btn"); + elm_object_signal_emit(ad->lockmini_layout, + "signal.button.unpressed", "rew_btn"); mp_play_control_rew(false, false, false); } } -static void _mp_lockscreenmini_ff_rew_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_lockscreenmini_ff_rew_btn_clicked_cb(void *data, + Evas_Object * obj, + void *event_info) { DEBUG_TRACE("button clicked"); if (_mp_lockscreenmini_is_long_press()) { return; } - char *source = (char *)data; + char *source = (char *) data; if (!g_strcmp0(source, CONTROLLER_FF_SOURCE)) { mp_play_control_ff(false, false, true); } else { @@ -397,44 +432,66 @@ _mp_lockscreenmini_update_layout(struct appdata *ad, bool landscape) mp_ecore_timer_del(ad->lockmini_button_timer); mp_evas_object_del(ad->lockmini_layout); - ad->lockmini_layout = _load_edj(ad->win_lockmini, LOCKSCREENMINI_EDJ_NAME, "music-lockscreenmini"); + ad->lockmini_layout = + _load_edj(ad->win_lockmini, LOCKSCREENMINI_EDJ_NAME, + "music-lockscreenmini"); if (!ad->lockmini_layout) { - return ; + return; } elm_win_resize_object_add(ad->win_lockmini, ad->lockmini_layout); - /*add focused UI related*/ + /*add focused UI related */ /*-------> REW button ------->*/ Evas_Object *rew_focus_btn = elm_button_add(ad->lockmini_layout); elm_object_style_set(rew_focus_btn, "focus"); - elm_object_part_content_set(ad->lockmini_layout, "rew_focus", rew_focus_btn); - elm_object_focus_custom_chain_append(ad->lockmini_layout, rew_focus_btn, NULL); - evas_object_smart_callback_add(rew_focus_btn, "clicked", _mp_lockscreenmini_ff_rew_btn_clicked_cb, CONTROLLER_REW_SOURCE); - evas_object_smart_callback_add(rew_focus_btn, "pressed", _mp_lockscreenmini_ff_rew_btn_pressed_cb, CONTROLLER_REW_SOURCE); - evas_object_smart_callback_add(rew_focus_btn, "unpressed", _mp_lockscreenmini_ff_rew_btn_unpressed_cb, CONTROLLER_REW_SOURCE); + elm_object_part_content_set(ad->lockmini_layout, "rew_focus", + rew_focus_btn); + elm_object_focus_custom_chain_append(ad->lockmini_layout, + rew_focus_btn, NULL); + evas_object_smart_callback_add(rew_focus_btn, "clicked", + _mp_lockscreenmini_ff_rew_btn_clicked_cb, + CONTROLLER_REW_SOURCE); + evas_object_smart_callback_add(rew_focus_btn, "pressed", + _mp_lockscreenmini_ff_rew_btn_pressed_cb, + CONTROLLER_REW_SOURCE); + evas_object_smart_callback_add(rew_focus_btn, "unpressed", + _mp_lockscreenmini_ff_rew_btn_unpressed_cb, + CONTROLLER_REW_SOURCE); /*-------> play/pause button ------->*/ - Evas_Object *play_pause_focus_btn = elm_button_add(ad->lockmini_layout); + Evas_Object *play_pause_focus_btn = + elm_button_add(ad->lockmini_layout); elm_object_style_set(play_pause_focus_btn, "focus"); - elm_object_part_content_set(ad->lockmini_layout, "play_pause_focus", play_pause_focus_btn); - elm_object_focus_custom_chain_append(ad->lockmini_layout, play_pause_focus_btn, NULL); - evas_object_smart_callback_add(play_pause_focus_btn, "clicked", _mp_lockscreenmini_play_pause_btn_clicked_cb, NULL); + elm_object_part_content_set(ad->lockmini_layout, "play_pause_focus", + play_pause_focus_btn); + elm_object_focus_custom_chain_append(ad->lockmini_layout, + play_pause_focus_btn, NULL); + evas_object_smart_callback_add(play_pause_focus_btn, "clicked", + _mp_lockscreenmini_play_pause_btn_clicked_cb, + NULL); /*------->FF button ------->*/ Evas_Object *ff_focus_btn = elm_button_add(ad->lockmini_layout); elm_object_style_set(ff_focus_btn, "focus"); - elm_object_part_content_set(ad->lockmini_layout, "ff_focus", ff_focus_btn); - elm_object_focus_custom_chain_append(ad->lockmini_layout, ff_focus_btn, NULL); - evas_object_smart_callback_add(ff_focus_btn, "clicked", _mp_lockscreenmini_ff_rew_btn_clicked_cb, CONTROLLER_FF_SOURCE); - evas_object_smart_callback_add(ff_focus_btn, "pressed", _mp_lockscreenmini_ff_rew_btn_pressed_cb, CONTROLLER_FF_SOURCE); - evas_object_smart_callback_add(ff_focus_btn, "unpressed", _mp_lockscreenmini_ff_rew_btn_unpressed_cb, CONTROLLER_FF_SOURCE); + elm_object_part_content_set(ad->lockmini_layout, "ff_focus", + ff_focus_btn); + elm_object_focus_custom_chain_append(ad->lockmini_layout, ff_focus_btn, + NULL); + evas_object_smart_callback_add(ff_focus_btn, "clicked", + _mp_lockscreenmini_ff_rew_btn_clicked_cb, + CONTROLLER_FF_SOURCE); + evas_object_smart_callback_add(ff_focus_btn, "pressed", + _mp_lockscreenmini_ff_rew_btn_pressed_cb, + CONTROLLER_FF_SOURCE); + evas_object_smart_callback_add(ff_focus_btn, "unpressed", + _mp_lockscreenmini_ff_rew_btn_unpressed_cb, + CONTROLLER_FF_SOURCE); _mp_lockscreenmini_update_btn(ad); } -static void -_mp_lockscreenmini_title_set(struct appdata *ad) +static void _mp_lockscreenmini_title_set(struct appdata *ad) { DEBUG_TRACE("title set"); @@ -449,23 +506,35 @@ _mp_lockscreenmini_title_set(struct appdata *ad) char *markup_title = elm_entry_utf8_to_markup(current_item->title); char *markup_artist = elm_entry_utf8_to_markup(current_item->artist); - char *title_shadow = g_strdup_printf("far_shadow,bottom shadow_color=#00000080"); - char *title_format = "%s - %s"; + char *title_shadow = + g_strdup_printf("far_shadow,bottom shadow_color=#00000080"); + char *title_format = + "%s - %s"; char *title = NULL; - char *title_format_left = "%s - %s"; + char *title_format_left = + "%s - %s"; if (markup_title && markup_artist) { if (strlen(markup_artist) + strlen(markup_title) + 3 <= 50) { - title = g_strdup_printf(title_format, title_shadow, 30, "FFFFFFFF", "ATO003", markup_title, markup_artist); + title = + g_strdup_printf(title_format, title_shadow, 30, "FFFFFFFF", + "ATO003", markup_title, markup_artist); } else { - title = g_strdup_printf(title_format_left, title_shadow, 30, "FFFFFFFF", "ATO003", markup_title, markup_artist); + title = + g_strdup_printf(title_format_left, title_shadow, 30, + "FFFFFFFF", "ATO003", markup_title, + markup_artist); } } - edje_object_part_text_set(_EDJ(ad->lockmini_layout), "artist.text", markup_artist); + edje_object_part_text_set(_EDJ(ad->lockmini_layout), "artist.text", + markup_artist); if (!label) { - label = mp_widget_slide_title_create(ad->lockmini_layout, "slide_roll", title); - elm_object_part_content_set(ad->lockmini_layout, "elm.text", label); + label = + mp_widget_slide_title_create(ad->lockmini_layout, "slide_roll", + title); + elm_object_part_content_set(ad->lockmini_layout, "elm.text", + label); } else { elm_object_text_set(label, title); } @@ -480,8 +549,7 @@ _mp_lockscreenmini_title_set(struct appdata *ad) evas_object_show(label); } -void -mp_lockscreenmini_update(struct appdata *ad) +void mp_lockscreenmini_update(struct appdata *ad) { DEBUG_TRACE(); @@ -500,28 +568,38 @@ mp_lockscreenmini_update(struct appdata *ad) } if (ad->current_track_info->thumbnail_path) { - DEBUG_TRACE("Thumbnail Location: %s", ad->current_track_info->thumbnail_path); - ret = bundle_add_str(b,"lockscreen/background/file_path", ad->current_track_info->thumbnail_path); + DEBUG_TRACE("Thumbnail Location: %s", + ad->current_track_info->thumbnail_path); + ret = + bundle_add_str(b, "lockscreen/background/file_path", + ad->current_track_info->thumbnail_path); if (ret != BUNDLE_ERROR_NONE) { - ERROR_TRACE("failed bundle_add_str in ad->current_track_info->thumbnail_path"); + ERROR_TRACE + ("failed bundle_add_str in ad->current_track_info->thumbnail_path"); bundle_free(b); return; } - } - else { - if(ad->lockscreen_wallpaper) { - ret = bundle_add_str(b,"lockscreen/background/file_path", ad->lockscreen_wallpaper); + } else { + if (ad->lockscreen_wallpaper) { + ret = + bundle_add_str(b, "lockscreen/background/file_path", + ad->lockscreen_wallpaper); if (ret != BUNDLE_ERROR_NONE) { - ERROR_TRACE("failed bundle_add_str in ad->lockscreen_wallpaper"); + ERROR_TRACE + ("failed bundle_add_str in ad->lockscreen_wallpaper"); bundle_free(b); } } else { DEBUG_TRACE("wallpaper is empty"); } } - ret = message_port_send_trusted_message_with_local_port("org.tizen.lockscreen", "lockscreen/port/background/ondemand", b, port_id); + ret = + message_port_send_trusted_message_with_local_port + ("org.tizen.lockscreen", "lockscreen/port/background/ondemand", b, + port_id); if (ret != MESSAGE_PORT_ERROR_NONE) { - ERROR_TRACE("Failed to send message via port, value = %s ", get_error_message(ret)); + ERROR_TRACE("Failed to send message via port, value = %s ", + get_error_message(ret)); bundle_free(b); return; } @@ -536,8 +614,7 @@ mp_lockscreenmini_update(struct appdata *ad) } } -int -mp_lockscreenmini_hide(struct appdata *ad) +int mp_lockscreenmini_hide(struct appdata *ad) { DEBUG_TRACE("lockscreenmini view hide!!\n"); mp_retvm_if(ad == NULL, -1, "appdata is NULL"); @@ -552,8 +629,7 @@ mp_lockscreenmini_hide(struct appdata *ad) return 0; } -int -mp_lockscreenmini_destroy(struct appdata *ad) +int mp_lockscreenmini_destroy(struct appdata *ad) { DEBUG_TRACE("lockscreenmini view destroy!!"); mp_retvm_if(ad == NULL, -1, "appdata is NULL"); @@ -569,20 +645,22 @@ mp_lockscreenmini_destroy(struct appdata *ad) ad->lockmini_visible = false; deregister_port(); - int ret = system_settings_set_value_string(SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, ad->lockscreen_wallpaper); + int ret = + system_settings_set_value_string + (SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, + ad->lockscreen_wallpaper); if (ret != SYSTEM_SETTINGS_ERROR_NONE) { ERROR_TRACE("Failed to set original locksreen wallpaper"); } char *path = app_get_data_path(); - char lscr_state[1024] = {0}; + char lscr_state[1024] = { 0 }; snprintf(lscr_state, 1024, "%s%s", path, MP_LSCR_CONTROL); free(path); ecore_file_remove(lscr_state); return 0; } -void -mp_lockscreenmini_visible_set(struct appdata *ad, bool visible) +void mp_lockscreenmini_visible_set(struct appdata *ad, bool visible) { DEBUG_TRACE("visible: %d", visible); MP_CHECK(ad); @@ -599,14 +677,14 @@ mp_lockscreenmini_visible_set(struct appdata *ad, bool visible) } else { ERROR_TRACE("[ERROR] Return value is %d", ret); } - if (lock_state == DISPLAY_STATE_SCREEN_OFF || lock_state == DISPLAY_STATE_SCREEN_DIM) { + if (lock_state == DISPLAY_STATE_SCREEN_OFF + || lock_state == DISPLAY_STATE_SCREEN_DIM) { ERROR_TRACE("timer locks deleted"); mp_ecore_timer_del(ad->lockmini_progress_timer); } } -bool -mp_lockscreenmini_visible_get(struct appdata *ad) +bool mp_lockscreenmini_visible_get(struct appdata *ad) { MP_CHECK_FALSE(ad); MP_CHECK_FALSE(ad->win_lockmini); diff --git a/src/widget/mp-lyric.c b/src/widget/mp-lyric.c index 25cf5d5..6fda3d8 100644 --- a/src/widget/mp-lyric.c +++ b/src/widget/mp-lyric.c @@ -42,19 +42,19 @@ typedef struct { #define MP_LRC_STR_NO_LYRIC ("IDS_MUSIC_SK3_NO_LYRICS") #define MP_LRC_FOLDER_PATH "/opt/usr/media/Sounds/Lyric/" #define MP_LRC_SIFFIX_NAME ".lrc" -#define MP_LRC_FILE_PATH_LEN (int)255 /* The max length of file path */ +#define MP_LRC_FILE_PATH_LEN (int)255 /* The max length of file path */ -#define MP_LRC_LINE_COLOR_DEFAULT "#FFFFFF" /* 62:62:62 -> 707070*/ -#define MP_LRC_LINE_COLOR_PLAYING "#277EE6" /* 0:0:0 -> #3b7352*/ -#define MP_LRC_FONT_CURRENT_SIZE (int)30 /* The size of current playing line */ -#define MP_LRC_FONT_NORMAL_SIZE (int)30 /* The size of normal line */ +#define MP_LRC_LINE_COLOR_DEFAULT "#FFFFFF" /* 62:62:62 -> 707070 */ +#define MP_LRC_LINE_COLOR_PLAYING "#277EE6" /* 0:0:0 -> #3b7352 */ +#define MP_LRC_FONT_CURRENT_SIZE (int)30 /* The size of current playing line */ +#define MP_LRC_FONT_NORMAL_SIZE (int)30 /* The size of normal line */ #define HD_MAIN_W 720 #define HD_MAIN_H 1280 /* Portrait mode */ -#define MP_LRC_VIEW_H_SCALE 720/HD_MAIN_H /* The hight of lyric view */ -#define MP_LRC_VIEW_W_SCALE 608/HD_MAIN_W /* The wigth of lyric view */ +#define MP_LRC_VIEW_H_SCALE 720/HD_MAIN_H /* The hight of lyric view */ +#define MP_LRC_VIEW_W_SCALE 608/HD_MAIN_W /* The wigth of lyric view */ /* Landscape mode */ #define MP_LRC_VIEW_H_SCALE_LS 104/HD_MAIN_W @@ -64,7 +64,8 @@ typedef struct { #define MP_LRC_HEAD_H_SCALE_LS 10/HD_MAIN_W static void -_mp_lyric_view_drag_start(void *data, Evas *e, Evas_Object *obj, void *event_info) +_mp_lyric_view_drag_start(void *data, Evas * e, Evas_Object * obj, + void *event_info) { startfunc; MpLyricData_t *wd = data; @@ -74,7 +75,8 @@ _mp_lyric_view_drag_start(void *data, Evas *e, Evas_Object *obj, void *event_inf } static void -_mp_lyric_view_drag_stop(void *data, Evas *e, Evas_Object *obj, void *event_info) +_mp_lyric_view_drag_stop(void *data, Evas * e, Evas_Object * obj, + void *event_info) { startfunc; MpLyricData_t *wd = data; @@ -84,7 +86,8 @@ _mp_lyric_view_drag_stop(void *data, Evas *e, Evas_Object *obj, void *event_info } static void -_mp_lyric_view_layout_del_cb(void *data, Evas * e, Evas_Object * obj, void *event_info) +_mp_lyric_view_layout_del_cb(void *data, Evas * e, Evas_Object * obj, + void *event_info) { startfunc; MpLyricData_t *wd = data; @@ -94,30 +97,32 @@ _mp_lyric_view_layout_del_cb(void *data, Evas * e, Evas_Object * obj, void *even IF_FREE(wd); } -static Evas_Object * -_create_lyric(Evas_Object *parent, MpLyricData_t *wd) +static Evas_Object *_create_lyric(Evas_Object * parent, MpLyricData_t * wd) { startfunc; Evas_Object *layout = NULL; /* Create layout */ - layout = mp_common_load_edj(parent, PLAY_VIEW_EDJ_NAME, "mp_lrc_layout"); + layout = + mp_common_load_edj(parent, PLAY_VIEW_EDJ_NAME, "mp_lrc_layout"); MP_CHECK_NULL(layout); - evas_object_event_callback_add(layout, EVAS_CALLBACK_FREE, _mp_lyric_view_layout_del_cb, - wd); + evas_object_event_callback_add(layout, EVAS_CALLBACK_FREE, + _mp_lyric_view_layout_del_cb, wd); wd->layout = layout; /* Create scroller */ Evas_Object *scroller = elm_scroller_add(layout); elm_scroller_bounce_set(scroller, EINA_FALSE, EINA_TRUE); - elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); + elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, + ELM_SCROLLER_POLICY_AUTO); evas_object_show(scroller); wd->scroller = scroller; /* Create box */ Evas_Object *box = elm_box_add(scroller); evas_object_show(box); - evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + 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); wd->box = box; @@ -126,8 +131,10 @@ _create_lyric(Evas_Object *parent, MpLyricData_t *wd) elm_object_part_content_set(layout, "lyric", scroller); /* Set event callback */ - evas_object_event_callback_add(scroller, EVAS_CALLBACK_MOUSE_DOWN, _mp_lyric_view_drag_start, wd); - evas_object_event_callback_add(scroller, EVAS_CALLBACK_MOUSE_UP, _mp_lyric_view_drag_stop, wd); + evas_object_event_callback_add(scroller, EVAS_CALLBACK_MOUSE_DOWN, + _mp_lyric_view_drag_start, wd); + evas_object_event_callback_add(scroller, EVAS_CALLBACK_MOUSE_UP, + _mp_lyric_view_drag_stop, wd); elm_win_screen_size_get(parent, NULL, NULL, &wd->win_w, &wd->win_h); evas_object_data_set(layout, "wd", wd); @@ -135,8 +142,7 @@ _create_lyric(Evas_Object *parent, MpLyricData_t *wd) return layout; } -static void -_mp_lyric_view_load_lyric(MpLyricData_t *wd) +static void _mp_lyric_view_load_lyric(MpLyricData_t * wd) { startfunc; MP_CHECK(wd); @@ -156,13 +162,17 @@ _mp_lyric_view_load_lyric(MpLyricData_t *wd) elm_box_clear(wd->box); for (index = 0; index < count; index++) { - mp_lrc_node_t *lrc_node = (mp_lrc_node_t*)eina_list_nth(list, index); + mp_lrc_node_t *lrc_node = + (mp_lrc_node_t *) eina_list_nth(list, index); MP_CHECK(lrc_node); - Evas_Object* label = elm_label_add(wd->box); + Evas_Object *label = elm_label_add(wd->box); MP_CHECK(label); evas_object_size_hint_fill_set(label, EVAS_HINT_FILL, 0.5); elm_label_line_wrap_set(label, ELM_WRAP_MIXED); - char *label_text = g_strdup_printf("%s", lrc_node->lyric); + char *label_text = + g_strdup_printf + ("%s", + lrc_node->lyric); elm_object_text_set(label, label_text); IF_FREE(label_text); evas_object_show(label); @@ -171,12 +181,14 @@ _mp_lyric_view_load_lyric(MpLyricData_t *wd) } /* Add gap for head and tail */ - Evas_Object* head = mp_common_load_edj(wd->box, PLAY_VIEW_EDJ_NAME, "mp_lrc_head"); + Evas_Object *head = + mp_common_load_edj(wd->box, PLAY_VIEW_EDJ_NAME, "mp_lrc_head"); elm_box_pack_start(wd->box, head); } static void -_mp_lyric_set_line_color(MpLyricData_t *wd, Evas_Object *obj, int index, const char *color) +_mp_lyric_set_line_color(MpLyricData_t * wd, Evas_Object * obj, int index, + const char *color) { MP_CHECK(obj); MP_CHECK(color); @@ -191,21 +203,22 @@ _mp_lyric_set_line_color(MpLyricData_t *wd, Evas_Object *obj, int index, const c list = wd->lyric_mgr->unsynclrc_list; } - mp_lrc_node_t *lrc_node = (mp_lrc_node_t*)eina_list_nth(list, index); + mp_lrc_node_t *lrc_node = (mp_lrc_node_t *) eina_list_nth(list, index); MP_CHECK(lrc_node); char *text_old = lrc_node->lyric; MP_CHECK(text_old); - char *text_new = (char*)malloc(sizeof(char) * (strlen(text_old) + 50)); + char *text_new = + (char *) malloc(sizeof(char) * (strlen(text_old) + 50)); MP_CHECK(text_new); - char * text = g_strdup(""); strncat(text_new, text, strlen(text)); IF_G_FREE(text); - strncat(text_new, text_old , strlen(text_old)); + strncat(text_new, text_old, strlen(text_old)); text = g_strdup(""); strncat(text_new, text, strlen(text)); IF_G_FREE(text); @@ -216,8 +229,7 @@ _mp_lyric_set_line_color(MpLyricData_t *wd, Evas_Object *obj, int index, const c } -static Eina_List* -_mp_lyric_get_line_list(MpLyricData_t *wd) +static Eina_List *_mp_lyric_get_line_list(MpLyricData_t * wd) { MP_CHECK_NULL(wd); @@ -227,14 +239,13 @@ _mp_lyric_get_line_list(MpLyricData_t *wd) Eina_List *list = NULL; MpLyricData_t *lyric = wd; - Evas_Object *scroller = lyric->scroller; + Evas_Object *scroller = lyric->scroller; Evas_Object *content = elm_object_content_get(scroller); list = elm_box_children_get(content); return list; } -static Evas_Object* -_mp_lyric_get_line(MpLyricData_t *wd, int index) +static Evas_Object *_mp_lyric_get_line(MpLyricData_t * wd, int index) { MP_CHECK_NULL(index >= 0); Eina_List *list = _mp_lyric_get_line_list(wd); @@ -248,8 +259,7 @@ _mp_lyric_get_line(MpLyricData_t *wd, int index) return line; } -static void -_mp_lyric_set_current_line(MpLyricData_t *wd, int index) +static void _mp_lyric_set_current_line(MpLyricData_t * wd, int index) { MP_CHECK(index >= 0); MP_CHECK(wd); @@ -290,12 +300,14 @@ _mp_lyric_set_current_line(MpLyricData_t *wd, int index) int scale_head_h_ls = wd->win_w * MP_LRC_HEAD_H_SCALE_LS; if ((y - y0) > (scale_h_ls / 2 - scale_head_h_ls)) { - new_y = y - head_gap + (h) - (scale_h_ls / 2 - scale_head_h_ls); + new_y = + y - head_gap + (h) - (scale_h_ls / 2 - scale_head_h_ls); } else { new_y = y - head_gap + (h / 2) - (y - y0); } - elm_scroller_region_bring_in(wd->scroller, x, new_y, scale_w_ls, scale_h_ls); + elm_scroller_region_bring_in(wd->scroller, x, new_y, scale_w_ls, + scale_h_ls); } else { int scale_h = wd->win_h * MP_LRC_VIEW_H_SCALE; int scale_w = wd->win_w * MP_LRC_VIEW_W_SCALE; @@ -307,20 +319,23 @@ _mp_lyric_set_current_line(MpLyricData_t *wd, int index) new_y = y - head_gap + (h / 2) - (y - y0); } - elm_scroller_region_bring_in(wd->scroller, x, new_y, scale_w, scale_h); + elm_scroller_region_bring_in(wd->scroller, x, new_y, scale_w, + scale_h); } - _mp_lyric_set_line_color(wd, wd->cur_line, wd->cur_line_index, MP_LRC_LINE_COLOR_PLAYING); + _mp_lyric_set_line_color(wd, wd->cur_line, wd->cur_line_index, + MP_LRC_LINE_COLOR_PLAYING); if (wd->prev_line != NULL) { - _mp_lyric_set_line_color(wd, wd->prev_line, wd->prev_line_index, MP_LRC_LINE_COLOR_DEFAULT); + _mp_lyric_set_line_color(wd, wd->prev_line, wd->prev_line_index, + MP_LRC_LINE_COLOR_DEFAULT); } evas_object_show(wd->scroller); } -Evas_Object *mp_lyric_create(Evas_Object *parent, const char *path) +Evas_Object *mp_lyric_create(Evas_Object * parent, const char *path) { startfunc; MP_CHECK_NULL(parent); @@ -353,7 +368,7 @@ Evas_Object *mp_lyric_create(Evas_Object *parent, const char *path) return lyric_layout; -ERROR: + ERROR: ERROR_TRACE("Unable to create lyric"); IF_FREE(wd->path); IF_FREE(wd); @@ -362,10 +377,10 @@ ERROR: return NULL; } -void mp_lyric_sync_update(Evas_Object *lyric) +void mp_lyric_sync_update(Evas_Object * lyric) { MP_CHECK(lyric); - MpLyricData_t *wd = evas_object_data_get(lyric, "wd"); + MpLyricData_t *wd = evas_object_data_get(lyric, "wd"); MP_CHECK(wd); if (wd->b_drag) { @@ -384,7 +399,8 @@ void mp_lyric_sync_update(Evas_Object *lyric) //DEBUG_TRACE("pos=%d, count=%d", pos, count); /* Get the current playing line */ for (index = 0; index < count - 1; index++) { - mp_lrc_node_t *node1 = (mp_lrc_node_t*)eina_list_nth(list, index); + mp_lrc_node_t *node1 = + (mp_lrc_node_t *) eina_list_nth(list, index); //mp_lrc_node_t *node2 = (mp_lrc_node_t*)eina_list_nth(list, index+1); MP_CHECK(node1); //MP_CHECK(node2); @@ -398,13 +414,12 @@ void mp_lyric_sync_update(Evas_Object *lyric) } -const char *mp_lyric_get_path(Evas_Object *lyric) +const char *mp_lyric_get_path(Evas_Object * lyric) { MP_CHECK_NULL(lyric); - MpLyricData_t *wd = evas_object_data_get(lyric, "wd"); + MpLyricData_t *wd = evas_object_data_get(lyric, "wd"); MP_CHECK_NULL(wd); return wd->path; } - diff --git a/src/widget/mp-minicontroller.c b/src/widget/mp-minicontroller.c index 95ee10a..4dfd83c 100644 --- a/src/widget/mp-minicontroller.c +++ b/src/widget/mp-minicontroller.c @@ -31,7 +31,7 @@ #include #define MINI_CONTROLLER_HEIGHT (93) -#define WL_INDI_H 27 //Window Layout Indicator Height +#define WL_INDI_H 27 //Window Layout Indicator Height #define PAUSE_TIME_OUT 120. #define CTR_EDJ_SIG_SRC "ctrl_edj" @@ -49,10 +49,14 @@ int MINI_CONTROLLER_WIDTH_LANDSCAPE; bool hide_from_mp = false; -static void _minicontroller_action_cb(void *data, Evas_Object * obj, const char *emission, const char *source); -static Evas_Object *_load_edj(Evas_Object * parent, const char *file, const char *group); +static void _minicontroller_action_cb(void *data, Evas_Object * obj, + const char *emission, + const char *source); +static Evas_Object *_load_edj(Evas_Object * parent, const char *file, + const char *group); static void _load_minicontroller(struct appdata *ad); -static void _mp_minicontroller_update_layout(struct appdata *ad, bool landscape); +static void _mp_minicontroller_update_layout(struct appdata *ad, + bool landscape); static void _mp_minicontroller_title_set(struct appdata *ad); static bool _mp_minicontroller_is_long_press() @@ -71,14 +75,13 @@ static bool _mp_minicontroller_is_long_press() return result; } -static bool -_mp_minicontroller_landscape_is(struct appdata *ad, int angle) +static bool _mp_minicontroller_landscape_is(struct appdata *ad, int angle) { startfunc; MP_CHECK_FALSE(ad); MP_CHECK_FALSE(ad->win_minicon); - bool landscape = false; + bool landscape = false; if (angle == 90 || angle == 270) { landscape = true; } else { @@ -87,15 +90,15 @@ _mp_minicontroller_landscape_is(struct appdata *ad, int angle) return landscape; } -static void -_mp_minicontroller_action_show_player_view(struct appdata *ad) +static void _mp_minicontroller_action_show_player_view(struct appdata *ad) { startfunc; MP_CHECK(ad); #ifndef MP_SOUND_PLAYER if (GET_PLAYER_VIEW != mp_view_mgr_get_top_view(GET_VIEW_MGR)) { if (!ad->is_focus_out) { - minicontrol_send_event(ad->win_minicon, MINICONTROL_EVENT_REQUEST_HIDE, NULL); + minicontrol_send_event(ad->win_minicon, + MINICONTROL_EVENT_REQUEST_HIDE, NULL); } else { mp_util_app_resume(); } @@ -104,7 +107,8 @@ _mp_minicontroller_action_show_player_view(struct appdata *ad) #endif { if (!ad->is_focus_out) { - minicontrol_send_event(ad->win_minicon, MINICONTROL_EVENT_REQUEST_HIDE, NULL); + minicontrol_send_event(ad->win_minicon, + MINICONTROL_EVENT_REQUEST_HIDE, NULL); } else { mp_util_app_resume(); } @@ -112,9 +116,10 @@ _mp_minicontroller_action_show_player_view(struct appdata *ad) } static void -_minicontroller_action_cb(void *data, Evas_Object * obj, const char *emission, const char *source) +_minicontroller_action_cb(void *data, Evas_Object * obj, + const char *emission, const char *source) { - struct appdata *ad = (struct appdata *)data; + struct appdata *ad = (struct appdata *) data; mp_retm_if(ad == NULL, "appdata is NULL"); //EVENT_TRACE("emission: %s", emission); if (emission) { @@ -122,7 +127,8 @@ _minicontroller_action_cb(void *data, Evas_Object * obj, const char *emission, c EVENT_TRACE("CLOSE"); if (!mp_util_is_other_player_playing()) { int ret_set = 0; - ret_set = preference_set_int(PREF_MUSIC_STATE, PREF_MUSIC_OFF); + ret_set = + preference_set_int(PREF_MUSIC_STATE, PREF_MUSIC_OFF); if (ret_set) { ERROR_TRACE("set preference failed"); } @@ -137,16 +143,16 @@ _minicontroller_action_cb(void *data, Evas_Object * obj, const char *emission, c } -static Evas_Object * -_load_edj(Evas_Object * parent, const char *file, const char *group) +static Evas_Object *_load_edj(Evas_Object * parent, const char *file, + const char *group) { Evas_Object *eo; int r; eo = elm_layout_add(parent); if (eo) { - char edje_path[1024] ={0}; - char * path = app_get_resource_path(); + char edje_path[1024] = { 0 }; + char *path = app_get_resource_path(); MP_CHECK_NULL(path); snprintf(edje_path, 1024, "%s%s/%s", path, "edje", file); @@ -157,7 +163,8 @@ _load_edj(Evas_Object * parent, const char *file, const char *group) evas_object_del(eo); return NULL; } - evas_object_size_hint_weight_set(eo, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(eo, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); elm_win_resize_object_add(parent, eo); evas_object_show(eo); } @@ -165,12 +172,14 @@ _load_edj(Evas_Object * parent, const char *file, const char *group) return eo; } -static void _quick_panel_cb(minicontrol_viewer_event_e event_type, bundle *event_arg) +static void _quick_panel_cb(minicontrol_viewer_event_e event_type, + bundle * event_arg) { startfunc; struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); - minicontrol_viewer_event_e event_hide = (minicontrol_viewer_event_e)MINICONTROL_EVENT_REQUEST_HIDE; + minicontrol_viewer_event_e event_hide = + (minicontrol_viewer_event_e) MINICONTROL_EVENT_REQUEST_HIDE; if (event_type == event_hide) { DEBUG_TRACE("CLOSE"); if (!mp_util_is_other_player_playing()) { @@ -192,7 +201,8 @@ static void _quick_panel_cb(minicontrol_viewer_event_e event_type, bundle *event elm_exit(); } } - if (event_type == (minicontrol_viewer_event_e)MINICONTROL_VIEWER_EVENT_REPORT_ANGLE) { + if (event_type == + (minicontrol_viewer_event_e) MINICONTROL_VIEWER_EVENT_REPORT_ANGLE) { char *value = NULL; int angle = 0; bundle_get_str(event_arg, "angle", &value); @@ -205,18 +215,23 @@ static void _quick_panel_cb(minicontrol_viewer_event_e event_type, bundle *event hide_from_mp = false; } -static void -_load_minicontroller(struct appdata *ad) +static void _load_minicontroller(struct appdata *ad) { DEBUG_TRACE_FUNC(); MP_CHECK(ad); Evas_Object *win = NULL; #ifndef MP_SOUND_PLAYER - win = minicontrol_create_window("musicplayer-mini", MINICONTROL_TARGET_VIEWER_QUICK_PANEL, _quick_panel_cb); + win = + minicontrol_create_window("musicplayer-mini", + MINICONTROL_TARGET_VIEWER_QUICK_PANEL, + _quick_panel_cb); #else - win = minicontrol_create_window("soundplayer-mini", MINICONTROL_TARGET_VIEWER_QUICK_PANEL, _quick_panel_cb); + win = + minicontrol_create_window("soundplayer-mini", + MINICONTROL_TARGET_VIEWER_QUICK_PANEL, + _quick_panel_cb); #endif if (!win) { @@ -228,7 +243,8 @@ _load_minicontroller(struct appdata *ad) ad->win_minicon = win; /* load edje */ - bool landscape = _mp_minicontroller_landscape_is(ad, ad->quickpanel_angle); + bool landscape = + _mp_minicontroller_landscape_is(ad, ad->quickpanel_angle); _mp_minicontroller_update_layout(ad, landscape); //evas_object_show(eo); @@ -236,15 +252,13 @@ _load_minicontroller(struct appdata *ad) return; } -static void -_mp_minicontroller_register_reader(void *data) +static void _mp_minicontroller_register_reader(void *data) { struct appdata *ad = data; MP_CHECK(ad); } -void -mp_minicontroller_update_winmini_size(struct appdata *ad) +void mp_minicontroller_update_winmini_size(struct appdata *ad) { DEBUG_TRACE_FUNC(); MP_CHECK(ad); @@ -275,14 +289,15 @@ mp_minicontroller_update_winmini_size(struct appdata *ad) } double scale = elm_config_scale_get(); - DEBUG_TRACE("scale: %f and width: %d and height: %d", scale, w, MINI_CONTROLLER_HEIGHT); - evas_object_resize(ad->win_minicon, w * scale, MINI_CONTROLLER_HEIGHT * scale); + DEBUG_TRACE("scale: %f and width: %d and height: %d", scale, w, + MINI_CONTROLLER_HEIGHT); + evas_object_resize(ad->win_minicon, w * scale, + MINI_CONTROLLER_HEIGHT * scale); return; } -int -mp_minicontroller_create(struct appdata *ad) +int mp_minicontroller_create(struct appdata *ad) { DEBUG_TRACE_FUNC(); mp_retvm_if(ad == NULL, -1, "appdata is NULL"); @@ -295,7 +310,6 @@ mp_minicontroller_create(struct appdata *ad) DEBUG_TRACE("ERROR"); return -1; } - //mp_language_mgr_register_object(ad->minicontroller_layout, OBJ_TYPE_EDJE_OBJECT, "elm.text.app_name", "IDS_COM_BODY_MUSIC"); //elm_object_part_text_set(ad->minicontroller_layout, "elm.text.app_name", GET_SYS_STR("IDS_COM_BODY_MUSIC")); } @@ -309,8 +323,7 @@ mp_minicontroller_create(struct appdata *ad) } -int -mp_minicontroller_show(struct appdata *ad) +int mp_minicontroller_show(struct appdata *ad) { DEBUG_TRACE("minicontroller view show!!"); mp_retvm_if(ad == NULL, -1, "appdata is NULL"); @@ -334,14 +347,15 @@ static void _mp_minicontroller_update_btn(struct appdata *ad) MP_CHECK(!ad->is_lcd_off); if (ad->player_state == PLAY_STATE_PLAYING) { - elm_object_signal_emit(ad->minicontroller_layout, "set_pause", "c_source"); + elm_object_signal_emit(ad->minicontroller_layout, "set_pause", + "c_source"); } else { - elm_object_signal_emit(ad->minicontroller_layout, "set_play", "c_source"); + elm_object_signal_emit(ad->minicontroller_layout, "set_play", + "c_source"); } } -static Eina_Bool -_mp_minicontroller_btn_update_timer(void *data) +static Eina_Bool _mp_minicontroller_btn_update_timer(void *data) { struct appdata *ad = data; MP_CHECK_FALSE(ad); @@ -356,15 +370,16 @@ static void _mp_minicontroller_update_playpause_btn(struct appdata *ad) { mp_ecore_timer_del(ad->minicon_button_timer); - if (ad->player_state == PLAY_STATE_PLAYING || ad->player_state == PLAY_STATE_PAUSED) { + if (ad->player_state == PLAY_STATE_PLAYING + || ad->player_state == PLAY_STATE_PAUSED) { _mp_minicontroller_update_btn(ad); } else { - ad->minicon_button_timer = ecore_timer_add(1.0, _mp_minicontroller_btn_update_timer, ad); + ad->minicon_button_timer = + ecore_timer_add(1.0, _mp_minicontroller_btn_update_timer, ad); } } -void -mp_minicontroller_update_control(struct appdata *ad) +void mp_minicontroller_update_control(struct appdata *ad) { startfunc; mp_retm_if(ad == NULL, "appdata is NULL"); @@ -376,19 +391,23 @@ mp_minicontroller_update_control(struct appdata *ad) int _mp_is_current_focus_available(struct appdata *ad) { - sound_stream_focus_change_reason_e changed_by = SOUND_STREAM_FOCUS_CHANGED_BY_MEDIA; + sound_stream_focus_change_reason_e changed_by = + SOUND_STREAM_FOCUS_CHANGED_BY_MEDIA; int ret = SOUND_MANAGER_ERROR_NONE; int rec_flag = SOUND_BEHAVIOR_NONE; int playback_flag = SOUND_BEHAVIOR_NONE; char *additional_info = NULL; - ret = sound_manager_get_current_recording_focus(&changed_by, &rec_flag, &additional_info); + ret = + sound_manager_get_current_recording_focus(&changed_by, &rec_flag, + &additional_info); if (ret != SOUND_MANAGER_ERROR_NONE) { ERROR_TRACE("Cannot determine current recording focus"); } if (!g_strcmp0(additional_info, "video_recorder")) { - DEBUG_TRACE("Video Recorder Timer is active. Cannot resume Music Player"); + DEBUG_TRACE + ("Video Recorder Timer is active. Cannot resume Music Player"); return -1; } @@ -401,26 +420,35 @@ int _mp_is_current_focus_available(struct appdata *ad) IF_FREE(additional_info); changed_by = SOUND_STREAM_FOCUS_CHANGED_BY_MEDIA; - ret = sound_manager_get_current_playback_focus(&changed_by, &playback_flag, &additional_info); + ret = + sound_manager_get_current_playback_focus(&changed_by, + &playback_flag, + &additional_info); if (ret != SOUND_MANAGER_ERROR_NONE) { ERROR_TRACE("Cannot determine current playback focus"); } DEBUG_TRACE("Playback state changed by : %d", changed_by); - if (changed_by == SOUND_STREAM_FOCUS_CHANGED_BY_CALL || changed_by == SOUND_STREAM_FOCUS_CHANGED_BY_VOIP || changed_by == SOUND_STREAM_FOCUS_CHANGED_BY_RINGTONE) { + if (changed_by == SOUND_STREAM_FOCUS_CHANGED_BY_CALL + || changed_by == SOUND_STREAM_FOCUS_CHANGED_BY_VOIP + || changed_by == SOUND_STREAM_FOCUS_CHANGED_BY_RINGTONE) { DEBUG_TRACE("Cannot resume Music Player due to call"); return -1; } - if (ad->recorder_state == RECORDER_DEVICE_STATE_RECORDING || ad->recorder_state == RECORDER_DEVICE_STATE_PAUSED) { - DEBUG_TRACE("Cannot resume Music Player. Video Recorder is in use"); + if (ad->recorder_state == RECORDER_DEVICE_STATE_RECORDING + || ad->recorder_state == RECORDER_DEVICE_STATE_PAUSED) { + DEBUG_TRACE + ("Cannot resume Music Player. Video Recorder is in use"); return -1; } return 0; } -static void _mp_minicontroller_play_pause_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_minicontroller_play_pause_btn_clicked_cb(void *data, + Evas_Object * obj, + void *event_info) { DEBUG_TRACE("play/pause button clicked"); @@ -428,12 +456,17 @@ static void _mp_minicontroller_play_pause_btn_clicked_cb(void *data, Evas_Object MP_CHECK(ad); if (_mp_is_current_focus_available(ad) != 0) { - ERROR_TRACE("Some other application has the focus currently... Returning..."); + ERROR_TRACE + ("Some other application has the focus currently... Returning..."); char *message = STR_MP_UNABLE_TO_PLAY_DURING_CALL; if (message) { - int ret = notification_status_message_post(dgettext("music-player", message)); + int ret = + notification_status_message_post(dgettext + ("music-player", + message)); if (ret != 0) { - ERROR_TRACE("notification_status_message_post()... [0x%x]", ret); + ERROR_TRACE("notification_status_message_post()... [0x%x]", + ret); } else { DEBUG_TRACE("message: [%s]", message); } @@ -448,7 +481,9 @@ static void _mp_minicontroller_play_pause_btn_clicked_cb(void *data, Evas_Object } } -static void _mp_minicontroller_ff_rew_btn_pressed_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_minicontroller_ff_rew_btn_pressed_cb(void *data, + Evas_Object * obj, + void *event_info) { DEBUG_TRACE("button pressed"); time(&press_time); @@ -457,11 +492,12 @@ static void _mp_minicontroller_ff_rew_btn_pressed_cb(void *data, Evas_Object *ob MP_CHECK(ad); if (_mp_is_current_focus_available(ad) != 0) { - ERROR_TRACE("Some other application has the focus currently... Changing to paused state..."); + ERROR_TRACE + ("Some other application has the focus currently... Changing to paused state..."); ad->paused_by_user = TRUE; } - char *source = (char *)data; + char *source = (char *) data; if (!g_strcmp0(source, CONTROLLER_FF_SOURCE)) { mp_play_control_ff(true, false, false); } else { @@ -469,32 +505,38 @@ static void _mp_minicontroller_ff_rew_btn_pressed_cb(void *data, Evas_Object *ob } } -static void _mp_minicontroller_ff_rew_btn_unpressed_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_minicontroller_ff_rew_btn_unpressed_cb(void *data, + Evas_Object * obj, + void *event_info) { DEBUG_TRACE("button unpressed"); time(&release_time); - char *source = (char *)data; + char *source = (char *) data; struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); MP_CHECK(ad->minicontroller_layout); if (!g_strcmp0(source, CONTROLLER_FF_SOURCE)) { mp_play_control_ff(false, false, false); - elm_object_signal_emit(ad->minicontroller_layout, "ff_btn_unpressed", "c_source"); + elm_object_signal_emit(ad->minicontroller_layout, + "ff_btn_unpressed", "c_source"); } else { mp_play_control_rew(false, false, false); - elm_object_signal_emit(ad->minicontroller_layout, "rew_btn_unpressed", "c_source"); + elm_object_signal_emit(ad->minicontroller_layout, + "rew_btn_unpressed", "c_source"); } } -static void _mp_minicontroller_ff_rew_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_minicontroller_ff_rew_btn_clicked_cb(void *data, + Evas_Object * obj, + void *event_info) { DEBUG_TRACE("button clicked"); if (_mp_minicontroller_is_long_press()) { return; } - char *source = (char *)data; + char *source = (char *) data; if (!g_strcmp0(source, CONTROLLER_FF_SOURCE)) { mp_play_control_ff(false, false, true); } else { @@ -505,7 +547,8 @@ static void _mp_minicontroller_ff_rew_btn_clicked_cb(void *data, Evas_Object *ob /*end of focused UI callbacks*/ static void -_mp_minicontroller_ff_rew_btn_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +_mp_minicontroller_ff_rew_btn_del_cb(void *data, Evas * e, + Evas_Object * obj, void *event_info) { startfunc; mp_play_control_reset_ff_rew(); @@ -526,69 +569,103 @@ _mp_minicontroller_update_layout(struct appdata *ad, bool landscape) if (landscape) { DEBUG_TRACE("angle: 90 or 270"); - ad->minicontroller_layout = _load_edj(ad->win_minicon, MINICON_EDJ_NAME, "music-minicontroller-ld"); + ad->minicontroller_layout = + _load_edj(ad->win_minicon, MINICON_EDJ_NAME, + "music-minicontroller-ld"); } else { DEBUG_TRACE("angle: 0"); - ad->minicontroller_layout = _load_edj(ad->win_minicon, MINICON_EDJ_NAME, "music-minicontroller"); + ad->minicontroller_layout = + _load_edj(ad->win_minicon, MINICON_EDJ_NAME, + "music-minicontroller"); } if (!ad->minicontroller_layout) { - return ; + return; } elm_win_resize_object_add(ad->win_minicon, ad->minicontroller_layout); - /*add focused UI related*/ + /*add focused UI related */ ad->minicon_icon = elm_image_add(ad->minicontroller_layout); - evas_object_size_hint_align_set(ad->minicon_icon, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(ad->minicon_icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ad->minicon_icon, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_size_hint_weight_set(ad->minicon_icon, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); elm_image_fill_outside_set(ad->minicon_icon, true); - elm_object_part_content_set(ad->minicontroller_layout, "albumart_image", ad->minicon_icon); - elm_object_focus_custom_chain_append(ad->minicontroller_layout, ad->minicon_icon, NULL); + elm_object_part_content_set(ad->minicontroller_layout, + "albumart_image", ad->minicon_icon); + elm_object_focus_custom_chain_append(ad->minicontroller_layout, + ad->minicon_icon, NULL); elm_object_focus_allow_set(ad->minicon_icon, EINA_TRUE); /*-------> REW button ------->*/ Evas_Object *rew_focus_btn = elm_button_add(ad->minicontroller_layout); elm_object_style_set(rew_focus_btn, "focus"); - elm_object_part_content_set(ad->minicontroller_layout, "rew_btn_focus", rew_focus_btn); - - elm_object_focus_custom_chain_append(ad->minicontroller_layout, rew_focus_btn, NULL); - evas_object_smart_callback_add(rew_focus_btn, "clicked", _mp_minicontroller_ff_rew_btn_clicked_cb, CONTROLLER_REW_SOURCE); - evas_object_smart_callback_add(rew_focus_btn, "pressed", _mp_minicontroller_ff_rew_btn_pressed_cb, CONTROLLER_REW_SOURCE); - evas_object_smart_callback_add(rew_focus_btn, "unpressed", _mp_minicontroller_ff_rew_btn_unpressed_cb, CONTROLLER_REW_SOURCE); - evas_object_event_callback_add(rew_focus_btn, EVAS_CALLBACK_DEL, _mp_minicontroller_ff_rew_btn_del_cb, NULL); + elm_object_part_content_set(ad->minicontroller_layout, "rew_btn_focus", + rew_focus_btn); + + elm_object_focus_custom_chain_append(ad->minicontroller_layout, + rew_focus_btn, NULL); + evas_object_smart_callback_add(rew_focus_btn, "clicked", + _mp_minicontroller_ff_rew_btn_clicked_cb, + CONTROLLER_REW_SOURCE); + evas_object_smart_callback_add(rew_focus_btn, "pressed", + _mp_minicontroller_ff_rew_btn_pressed_cb, + CONTROLLER_REW_SOURCE); + evas_object_smart_callback_add(rew_focus_btn, "unpressed", + _mp_minicontroller_ff_rew_btn_unpressed_cb, + CONTROLLER_REW_SOURCE); + evas_object_event_callback_add(rew_focus_btn, EVAS_CALLBACK_DEL, + _mp_minicontroller_ff_rew_btn_del_cb, + NULL); /*-------> play/pause button ------->*/ - Evas_Object *play_pause_focus_btn = elm_button_add(ad->minicontroller_layout); + Evas_Object *play_pause_focus_btn = + elm_button_add(ad->minicontroller_layout); elm_object_style_set(play_pause_focus_btn, "focus"); - elm_object_part_content_set(ad->minicontroller_layout, "play_pause_focus", play_pause_focus_btn); - elm_object_focus_custom_chain_append(ad->minicontroller_layout, play_pause_focus_btn, NULL); - evas_object_smart_callback_add(play_pause_focus_btn, "clicked", _mp_minicontroller_play_pause_btn_clicked_cb, NULL); + elm_object_part_content_set(ad->minicontroller_layout, + "play_pause_focus", play_pause_focus_btn); + elm_object_focus_custom_chain_append(ad->minicontroller_layout, + play_pause_focus_btn, NULL); + evas_object_smart_callback_add(play_pause_focus_btn, "clicked", + _mp_minicontroller_play_pause_btn_clicked_cb, + NULL); /*------->FF button ------->*/ Evas_Object *ff_focus_btn = elm_button_add(ad->minicontroller_layout); elm_object_style_set(ff_focus_btn, "focus"); - elm_object_part_content_set(ad->minicontroller_layout, "ff_btn_focus", ff_focus_btn); - - elm_object_focus_custom_chain_append(ad->minicontroller_layout, ff_focus_btn, NULL); - evas_object_smart_callback_add(ff_focus_btn, "clicked", _mp_minicontroller_ff_rew_btn_clicked_cb, CONTROLLER_FF_SOURCE); - evas_object_smart_callback_add(ff_focus_btn, "pressed", _mp_minicontroller_ff_rew_btn_pressed_cb, CONTROLLER_FF_SOURCE); - evas_object_smart_callback_add(ff_focus_btn, "unpressed", _mp_minicontroller_ff_rew_btn_unpressed_cb, CONTROLLER_FF_SOURCE); - evas_object_event_callback_add(ff_focus_btn, EVAS_CALLBACK_DEL, _mp_minicontroller_ff_rew_btn_del_cb, NULL); + elm_object_part_content_set(ad->minicontroller_layout, "ff_btn_focus", + ff_focus_btn); + + elm_object_focus_custom_chain_append(ad->minicontroller_layout, + ff_focus_btn, NULL); + evas_object_smart_callback_add(ff_focus_btn, "clicked", + _mp_minicontroller_ff_rew_btn_clicked_cb, + CONTROLLER_FF_SOURCE); + evas_object_smart_callback_add(ff_focus_btn, "pressed", + _mp_minicontroller_ff_rew_btn_pressed_cb, + CONTROLLER_FF_SOURCE); + evas_object_smart_callback_add(ff_focus_btn, "unpressed", + _mp_minicontroller_ff_rew_btn_unpressed_cb, + CONTROLLER_FF_SOURCE); + evas_object_event_callback_add(ff_focus_btn, EVAS_CALLBACK_DEL, + _mp_minicontroller_ff_rew_btn_del_cb, + NULL); /*-------> close button ------->*/ - edje_object_signal_callback_add(_EDJ(ad->minicontroller_layout), "*", "*", _minicontroller_action_cb, ad); + edje_object_signal_callback_add(_EDJ(ad->minicontroller_layout), "*", + "*", _minicontroller_action_cb, ad); _mp_minicontroller_update_btn(ad); _mp_minicontroller_register_reader(ad); } -static void -_mp_minicontroller_title_set(struct appdata *ad) +static void _mp_minicontroller_title_set(struct appdata *ad) { MP_CHECK(ad); MP_CHECK(ad->minicontroller_layout); - Evas_Object *label = elm_object_part_content_get(ad->minicontroller_layout, "elm.text"); + Evas_Object *label = + elm_object_part_content_get(ad->minicontroller_layout, "elm.text"); mp_track_info_t *current_item = ad->current_track_info; MP_CHECK(current_item); @@ -601,18 +678,24 @@ _mp_minicontroller_title_set(struct appdata *ad) char *markup_title = elm_entry_utf8_to_markup(current_item->title); char *markup_artist = elm_entry_utf8_to_markup(current_item->artist); - char *title_format = "%s - %s"; + char *title_format = + "%s - %s"; char *title = NULL; if ((markup_title == NULL || strlen(markup_title) == 0) - && (markup_artist == NULL || strlen(markup_artist) == 0)) { + && (markup_artist == NULL || strlen(markup_artist) == 0)) { title = NULL; } else { - title = g_strdup_printf(title_format, 24, r, g, b, a, markup_title, 24, r, g, b, a, markup_artist); + title = + g_strdup_printf(title_format, 24, r, g, b, a, markup_title, 24, + r, g, b, a, markup_artist); } if (!label) { - label = mp_widget_slide_title_create(ad->minicontroller_layout, "slide_roll", title); - elm_object_part_content_set(ad->minicontroller_layout, "elm.text", label); + label = + mp_widget_slide_title_create(ad->minicontroller_layout, + "slide_roll", title); + elm_object_part_content_set(ad->minicontroller_layout, "elm.text", + label); } else { elm_object_text_set(label, title); } @@ -627,8 +710,7 @@ _mp_minicontroller_title_set(struct appdata *ad) } -void -mp_minicontroller_update(struct appdata *ad, bool with_title) +void mp_minicontroller_update(struct appdata *ad, bool with_title) { DEBUG_TRACE(); @@ -642,12 +724,15 @@ mp_minicontroller_update(struct appdata *ad, bool with_title) if (current_item) { SECURE_DEBUG("album art is %s", current_item->thumbnail_path); if (mp_util_is_image_valid(ad->evas, current_item->thumbnail_path) - && strcmp(BROKEN_ALBUMART_IMAGE_PATH, current_item->thumbnail_path)) { - elm_image_file_set(ad->minicon_icon, current_item->thumbnail_path, NULL); + && strcmp(BROKEN_ALBUMART_IMAGE_PATH, + current_item->thumbnail_path)) { + elm_image_file_set(ad->minicon_icon, + current_item->thumbnail_path, NULL); } else { - char default_thumbnail[1024] = {0}; + char default_thumbnail[1024] = { 0 }; char *shared_path = app_get_shared_resource_path(); - snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, "shared_images", DEFAULT_THUMBNAIL); + snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, + "shared_images", DEFAULT_THUMBNAIL); free(shared_path); elm_image_file_set(ad->minicon_icon, default_thumbnail, NULL); } @@ -660,8 +745,7 @@ mp_minicontroller_update(struct appdata *ad, bool with_title) } } -int -mp_minicontroller_hide(struct appdata *ad) +int mp_minicontroller_hide(struct appdata *ad) { DEBUG_TRACE("minicontroller view hide!!\n"); mp_retvm_if(ad == NULL, -1, "appdata is NULL"); @@ -678,8 +762,7 @@ mp_minicontroller_hide(struct appdata *ad) } -int -mp_minicontroller_destroy(struct appdata *ad) +int mp_minicontroller_destroy(struct appdata *ad) { DEBUG_TRACE("minicontroller view destroy!!"); mp_retvm_if(ad == NULL, -1, "appdata is NULL"); @@ -698,8 +781,7 @@ mp_minicontroller_destroy(struct appdata *ad) return 0; } -void -mp_minicontroller_rotate(struct appdata *ad, int angle) +void mp_minicontroller_rotate(struct appdata *ad, int angle) { startfunc; MP_CHECK(ad); @@ -708,7 +790,7 @@ mp_minicontroller_rotate(struct appdata *ad, int angle) int w = 0; const char *signal = NULL; - bool landscape = _mp_minicontroller_landscape_is(ad, angle); + bool landscape = _mp_minicontroller_landscape_is(ad, angle); if (landscape) { signal = "sig_set_landscape_mode"; w = MINI_CONTROLLER_WIDTH_LANDSCAPE; @@ -722,13 +804,13 @@ mp_minicontroller_rotate(struct appdata *ad, int angle) elm_object_signal_emit(ad->minicontroller_layout, signal, "c_source"); double scale = elm_config_scale_get(); - evas_object_resize(ad->win_minicon, w * scale, MINI_CONTROLLER_HEIGHT * scale); + evas_object_resize(ad->win_minicon, w * scale, + MINI_CONTROLLER_HEIGHT * scale); _mp_minicontroller_update_layout(ad, landscape); mp_minicontroller_update(ad, true); } -void -mp_minicontroller_visible_set(struct appdata *ad, bool visible) +void mp_minicontroller_visible_set(struct appdata *ad, bool visible) { DEBUG_TRACE("visible: %d", visible); MP_CHECK(ad); @@ -748,14 +830,14 @@ mp_minicontroller_visible_set(struct appdata *ad, bool visible) } DEBUG_TRACE("lock_state: %d", lock_state); - if (lock_state == DISPLAY_STATE_SCREEN_OFF || lock_state == DISPLAY_STATE_SCREEN_DIM) { + if (lock_state == DISPLAY_STATE_SCREEN_OFF + || lock_state == DISPLAY_STATE_SCREEN_DIM) { ERROR_TRACE("Timer deleted"); mp_ecore_timer_del(ad->minicon_progress_timer); } } -bool -mp_minicontroller_visible_get(struct appdata *ad) +bool mp_minicontroller_visible_get(struct appdata *ad) { MP_CHECK_FALSE(ad); MP_CHECK_FALSE(ad->win_minicon); diff --git a/src/widget/mp-notification.c b/src/widget/mp-notification.c index a91a4bb..d9a4c08 100644 --- a/src/widget/mp-notification.c +++ b/src/widget/mp-notification.c @@ -37,7 +37,7 @@ _mp_noti_make_excute_option(const char *key, const char *value) app_control_h service = NULL; - int err = app_control_create(&service); + int err = app_control_create(&service); if (err) { mp_error("app_control_create() .. [0x%x]", err); return NULL; @@ -70,8 +70,7 @@ _mp_noti_make_excute_option(const char *key, const char *value) return service; }*/ -void -mp_noti_destroy(mp_noti_h noti) +void mp_noti_destroy(mp_noti_h noti) { startfunc; mp_noti_s *noti_data = noti; @@ -98,7 +97,8 @@ mp_noti_destroy(mp_noti_h noti) } bool -mp_noti_update_size(mp_noti_h noti, unsigned long long total, unsigned long long byte) +mp_noti_update_size(mp_noti_h noti, unsigned long long total, + unsigned long long byte) { mp_noti_s *noti_data = noti; MP_CHECK_FALSE(noti_data); @@ -106,13 +106,13 @@ mp_noti_update_size(mp_noti_h noti, unsigned long long total, unsigned long long int err = 0; if (total > 0) { - double progress = (double)byte / total; + double progress = (double) byte / total; err = notification_set_progress(noti_data->handle, progress); if (err != NOTIFICATION_ERROR_NONE) { mp_error("notification_set_progress().. [0x%x]", err); } } else { - err = notification_set_size(noti_data->handle, (double)byte); + err = notification_set_size(noti_data->handle, (double) byte); if (err != NOTIFICATION_ERROR_NONE) { mp_error("notification_set_size().. [0x%x]", err); } @@ -298,4 +298,3 @@ mp_noti_box_update(mp_noti_h noti, const char *title, const char *info, time_t t } } }*/ - diff --git a/src/widget/mp-now-playing-list.c b/src/widget/mp-now-playing-list.c index 0a8afa7..20beca9 100644 --- a/src/widget/mp-now-playing-list.c +++ b/src/widget/mp-now-playing-list.c @@ -27,8 +27,8 @@ #include -static char * -_mp_now_playing_list_label_get(void *data, Evas_Object * obj, const char *part) +static char *_mp_now_playing_list_label_get(void *data, Evas_Object * obj, + const char *part) { mp_list_item_data_t *item = (mp_list_item_data_t *) data; MP_CHECK_NULL(item); @@ -36,17 +36,17 @@ _mp_now_playing_list_label_get(void *data, Evas_Object * obj, const char *part) MpNowPlayingList_t *list = evas_object_data_get(obj, "list_data"); MP_CHECK_NULL(list); - mp_media_info_h track = (mp_media_info_h)(item->handle); + mp_media_info_h track = (mp_media_info_h) (item->handle); mp_retvm_if(!track, NULL, "data is null"); struct appdata *ad = mp_util_get_appdata(); MP_CHECK_NULL(ad); - mp_plst_item * current = mp_playlist_mgr_get_current(ad->playlist_mgr); + mp_plst_item *current = mp_playlist_mgr_get_current(ad->playlist_mgr); if (!strcmp(part, "elm.text") || !strcmp(part, "elm.text.sub")) { char *title = NULL; if (!strcmp(part, "elm.text")) { - mp_media_info_get_title(track, &title); + mp_media_info_get_title(track, &title); } else { mp_media_info_get_artist(track, &title); } @@ -65,7 +65,8 @@ _mp_now_playing_list_label_get(void *data, Evas_Object * obj, const char *part) a = 255; memset(result, 0x00, DEF_STR_LEN + 1); snprintf(result, DEF_STR_LEN, - "%s", r, g, b, a, info); + "%s", r, g, b, a, + info); IF_FREE(info); return g_strdup(result); @@ -77,8 +78,9 @@ _mp_now_playing_list_label_get(void *data, Evas_Object * obj, const char *part) return NULL; } -static Evas_Object * -_mp_now_playing_list_content_get(void *data, Evas_Object * obj, const char *part) +static Evas_Object *_mp_now_playing_list_content_get(void *data, + Evas_Object * obj, + const char *part) { mp_list_item_data_t *item = (mp_list_item_data_t *) data; MP_CHECK_NULL(item); @@ -94,13 +96,14 @@ _mp_now_playing_list_content_get(void *data, Evas_Object * obj, const char *part //get player status struct appdata *ad = mp_util_get_appdata(); MP_CHECK_NULL(ad); - mp_plst_item * current = mp_playlist_mgr_get_current(ad->playlist_mgr); + mp_plst_item *current = mp_playlist_mgr_get_current(ad->playlist_mgr); MP_CHECK_NULL(current); char *uri = NULL; mp_media_info_get_file_path(track, &uri); mp_retv_if(!uri, NULL); - Evas_Object *part_content = elm_object_item_part_content_get(item->it, "elm.icon.1"); + Evas_Object *part_content = + elm_object_item_part_content_get(item->it, "elm.icon.1"); if (part_content) { elm_object_signal_emit(part_content, "show_default", "*"); @@ -112,10 +115,14 @@ _mp_now_playing_list_content_get(void *data, Evas_Object * obj, const char *part } if (match && part_content) { - ERROR_TRACE("set state: %d", (int)mp_player_mgr_get_state()); - if ((int)mp_player_mgr_get_state() == (int)PLAYER_STATE_PLAYING) { + ERROR_TRACE("set state: %d", (int) mp_player_mgr_get_state()); + if ((int) mp_player_mgr_get_state() == (int) PLAYER_STATE_PLAYING) { elm_object_signal_emit(part_content, "show_play", "*"); - } else if (((int)mp_player_mgr_get_state() == (int)PLAYER_STATE_PAUSED) || ((int)mp_player_mgr_get_state() == (int)PLAYER_STATE_READY)) { + } else + if (((int) mp_player_mgr_get_state() == + (int) PLAYER_STATE_PAUSED) + || ((int) mp_player_mgr_get_state() == + (int) PLAYER_STATE_READY)) { elm_object_signal_emit(part_content, "show_pause", "*"); } } @@ -124,13 +131,18 @@ _mp_now_playing_list_content_get(void *data, Evas_Object * obj, const char *part char *thumbpath = NULL; mp_media_info_get_thumbnail_path(track, &thumbpath); - icon = mp_util_create_lazy_update_thumb_icon(obj, thumbpath, MP_LIST_ICON_SIZE, MP_LIST_ICON_SIZE); + icon = + mp_util_create_lazy_update_thumb_icon(obj, thumbpath, + MP_LIST_ICON_SIZE, + MP_LIST_ICON_SIZE); - elm_layout_theme_set(content, "layout", "list/B/music.type.1", "default"); + elm_layout_theme_set(content, "layout", "list/B/music.type.1", + "default"); elm_layout_content_set(content, "elm.swallow.content", icon); if (match && content) { - if ((int)mp_player_mgr_get_state() == (int)PLAYER_STATE_PLAYING) { + if ((int) mp_player_mgr_get_state() == + (int) PLAYER_STATE_PLAYING) { elm_object_signal_emit(content, "show_play", "*"); } else { elm_object_signal_emit(content, "show_pause", "*"); @@ -148,8 +160,7 @@ _mp_now_playing_list_content_get(void *data, Evas_Object * obj, const char *part return content; } -static void -_mp_now_playing_list_item_del_cb(void *data, Evas_Object *obj) +static void _mp_now_playing_list_item_del_cb(void *data, Evas_Object * obj) { mp_list_item_data_t *item_data = data; MP_CHECK(item_data); @@ -163,8 +174,7 @@ _mp_now_playing_list_item_del_cb(void *data, Evas_Object *obj) free(item_data); } -static Eina_Bool -_mp_now_playing_genlist_sel_timer_cb(void *data) +static Eina_Bool _mp_now_playing_genlist_sel_timer_cb(void *data) { MpNowPlayingList_t *list = data; MP_CHECK_FALSE(list); @@ -174,7 +184,8 @@ _mp_now_playing_genlist_sel_timer_cb(void *data) Elm_Object_Item *gl_item = elm_genlist_first_item_get(list->genlist); while (gl_item) { - elm_genlist_item_select_mode_set(gl_item, ELM_OBJECT_SELECT_MODE_DEFAULT); + elm_genlist_item_select_mode_set(gl_item, + ELM_OBJECT_SELECT_MODE_DEFAULT); gl_item = elm_genlist_item_next_get(gl_item); } return ECORE_CALLBACK_DONE; @@ -182,7 +193,8 @@ _mp_now_playing_genlist_sel_timer_cb(void *data) static void -_mp_now_playing_genlist_sel_cb(void *data, Evas_Object * obj, void *event_info) +_mp_now_playing_genlist_sel_cb(void *data, Evas_Object * obj, + void *event_info) { Elm_Object_Item *gli = (Elm_Object_Item *) event_info; MP_CHECK(gli); @@ -200,7 +212,7 @@ _mp_now_playing_genlist_sel_cb(void *data, Evas_Object * obj, void *event_info) MpNowPlayingList_t *list = data; MP_CHECK(list); if (list->edit_mode) { - mp_list_edit_mode_sel((MpList_t *)list, item_data); + mp_list_edit_mode_sel((MpList_t *) list, item_data); MpViewMgr_t *view_mgr = mp_view_mgr_get_view_manager(); MpView_t *view = mp_view_mgr_get_top_view(view_mgr); mp_view_update_options_edit(view); @@ -208,7 +220,8 @@ _mp_now_playing_genlist_sel_cb(void *data, Evas_Object * obj, void *event_info) } mp_plst_item *select_plst_item = item_data->plst_item; - mp_plst_item *current_plst_item = mp_playlist_mgr_get_current(ad->playlist_mgr); + mp_plst_item *current_plst_item = + mp_playlist_mgr_get_current(ad->playlist_mgr); if (select_plst_item != current_plst_item) { mp_playlist_mgr_set_current(ad->playlist_mgr, select_plst_item); @@ -221,7 +234,7 @@ _mp_now_playing_genlist_sel_cb(void *data, Evas_Object * obj, void *event_info) } } else { /*if click the current track, it should chang the playing status. - If at the beginning, should play the song*/ + If at the beginning, should play the song */ if (ad->player_state == PLAY_STATE_PLAYING) { mp_play_control_play_pause(ad, false); } else if (ad->player_state == PLAY_STATE_PAUSED) { @@ -232,36 +245,37 @@ _mp_now_playing_genlist_sel_cb(void *data, Evas_Object * obj, void *event_info) } } - MpPlayerView_t *player_view = (MpPlayerView_t *)GET_PLAYER_VIEW; + MpPlayerView_t *player_view = (MpPlayerView_t *) GET_PLAYER_VIEW; if (player_view) { mp_player_view_refresh(player_view); } Elm_Object_Item *gl_item = elm_genlist_first_item_get(list->genlist); while (gl_item) { - elm_genlist_item_select_mode_set(gl_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + elm_genlist_item_select_mode_set(gl_item, + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); gl_item = elm_genlist_item_next_get(gl_item); } mp_ecore_idler_del(list->sel_idler); - list->sel_idler = ecore_idler_add(_mp_now_playing_genlist_sel_timer_cb, list); + list->sel_idler = + ecore_idler_add(_mp_now_playing_genlist_sel_timer_cb, list); return; } -static void -_mp_now_playing_list_load_list(void *thiz, int count) +static void _mp_now_playing_list_load_list(void *thiz, int count) { MpNowPlayingList_t *list = thiz; MP_CHECK(list); - /*clear genlist*/ + /*clear genlist */ Elm_Object_Item *item = elm_genlist_first_item_get(list->genlist); if (item) { elm_genlist_item_bring_in(item, ELM_GENLIST_ITEM_SCROLLTO_IN); elm_genlist_clear(list->genlist); } - /*get data from playlist mgr*/ + /*get data from playlist mgr */ struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); MP_CHECK(ad->playlist_mgr); @@ -272,12 +286,14 @@ _mp_now_playing_list_load_list(void *thiz, int count) int res = 0; int index = 0; for (index = 0; index < count; index++) { - plst_item = mp_playlist_mgr_normal_list_get_nth(ad->playlist_mgr, index); + plst_item = + mp_playlist_mgr_normal_list_get_nth(ad->playlist_mgr, index); if (!plst_item) { continue; } - mp_list_item_data_t *item_data = calloc(1, sizeof(mp_list_item_data_t)); + mp_list_item_data_t *item_data = + calloc(1, sizeof(mp_list_item_data_t)); mp_assert(item_data); item_data->index = index; @@ -293,15 +309,18 @@ _mp_now_playing_list_load_list(void *thiz, int count) } item_data->handle = handle; - item_data->it = elm_genlist_item_append(list->genlist, list->itc, item_data, NULL, - ELM_GENLIST_ITEM_NONE, _mp_now_playing_genlist_sel_cb, list); + item_data->it = + elm_genlist_item_append(list->genlist, list->itc, item_data, + NULL, ELM_GENLIST_ITEM_NONE, + _mp_now_playing_genlist_sel_cb, list); } endfunc; } static void -_mp_now_playing_list_item_moved_cb(void *data, Evas_Object *obj, void *event_info) +_mp_now_playing_list_item_moved_cb(void *data, Evas_Object * obj, + void *event_info) { startfunc; MpNowPlayingList_t *list = data; @@ -335,7 +354,8 @@ _mp_now_playing_list_item_moved_cb(void *data, Evas_Object *obj, void *event_inf mp_media_info_get_media_id(media, &uid); } - mp_plst_item *plst_item = mp_playlist_mgr_get_item_by_uid(ad->playlist_mgr, uid); + mp_plst_item *plst_item = + mp_playlist_mgr_get_item_by_uid(ad->playlist_mgr, uid); if (plst_item) { mp_playlist_mgr_item_reorder(ad->playlist_mgr, plst_item, index); @@ -343,8 +363,7 @@ _mp_now_playing_list_item_moved_cb(void *data, Evas_Object *obj, void *event_inf } } -static void -_mp_now_playing_list_destory_cb(void *thiz) +static void _mp_now_playing_list_destory_cb(void *thiz) { startfunc; MpNowPlayingList_t *list = thiz; @@ -361,8 +380,7 @@ _mp_now_playing_list_destory_cb(void *thiz) free(list); } -static void -_mp_now_playing_list_update(void *thiz) +static void _mp_now_playing_list_update(void *thiz) { startfunc; MpNowPlayingList_t *list = thiz; @@ -381,19 +399,23 @@ _mp_now_playing_list_update(void *thiz) int count = mp_playlist_mgr_count(ad->playlist_mgr); if (count) { if (!list->genlist) { - /*create new genlist*/ + /*create new genlist */ list->genlist = mp_widget_genlist_create(list->box); MP_CHECK(list->genlist); - elm_scroller_policy_set(list->genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); - evas_object_size_hint_weight_set(list->genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(list->genlist, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_scroller_policy_set(list->genlist, ELM_SCROLLER_POLICY_OFF, + ELM_SCROLLER_POLICY_AUTO); + evas_object_size_hint_weight_set(list->genlist, + EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(list->genlist, EVAS_HINT_FILL, + EVAS_HINT_FILL); elm_genlist_homogeneous_set(list->genlist, EINA_TRUE); elm_genlist_mode_set(list->genlist, ELM_LIST_COMPRESS); evas_object_show(list->genlist); evas_object_data_set(list->genlist, "list_data", list); - /*packet genlist to box*/ + /*packet genlist to box */ elm_box_pack_end(list->box, list->genlist); list->itc = elm_genlist_item_class_new(); @@ -403,7 +425,9 @@ _mp_now_playing_list_update(void *thiz) list->itc->func.content_get = _mp_now_playing_list_content_get; list->itc->func.del = _mp_now_playing_list_item_del_cb; - evas_object_smart_callback_add(list->genlist, "moved", _mp_now_playing_list_item_moved_cb, list); + evas_object_smart_callback_add(list->genlist, "moved", + _mp_now_playing_list_item_moved_cb, + list); //evas_object_smart_callback_add(list->genlist, "drag,start,left", list->flick_left_cb, NULL); //evas_object_smart_callback_add(list->genlist, "drag,start,right", list->flick_right_cb, NULL); @@ -420,14 +444,15 @@ _mp_now_playing_list_update(void *thiz) } else { DEBUG_TRACE("count is 0"); - list->no_content = mp_widget_create_no_contents(list->box, MP_NOCONTENT_NORMAL, NULL, NULL); + list->no_content = + mp_widget_create_no_contents(list->box, MP_NOCONTENT_NORMAL, + NULL, NULL); elm_box_pack_end(list->box, list->no_content); } } -static Eina_Bool -_mp_now_playing_list_loading_timer_cb(void *data) +static Eina_Bool _mp_now_playing_list_loading_timer_cb(void *data) { MpNowPlayingList_t *list = data; MP_CHECK_FALSE(list); @@ -435,14 +460,14 @@ _mp_now_playing_list_loading_timer_cb(void *data) list->loading_timer = NULL; mp_evas_object_del(list->loading_progress); - list->loading_progress = mp_widget_loading_icon_add(list->box, MP_LOADING_ICON_SIZE_XLARGE); + list->loading_progress = + mp_widget_loading_icon_add(list->box, MP_LOADING_ICON_SIZE_XLARGE); elm_box_pack_end(list->box, list->loading_progress); return ECORE_CALLBACK_DONE; } -MpNowPlayingList_t * -mp_now_playing_list_create(Evas_Object *parent) +MpNowPlayingList_t *mp_now_playing_list_create(Evas_Object * parent) { startfunc; MP_CHECK_NULL(parent); @@ -450,20 +475,20 @@ mp_now_playing_list_create(Evas_Object *parent) MpNowPlayingList_t *list = calloc(1, sizeof(MpNowPlayingList_t)); MP_CHECK_NULL(list); - mp_list_init((MpList_t *)list, parent, MP_LIST_TYPE_TRACK); + mp_list_init((MpList_t *) list, parent, MP_LIST_TYPE_TRACK); list->update = _mp_now_playing_list_update; list->destory_cb = _mp_now_playing_list_destory_cb; list->reorderable = TRUE; - list->loading_timer = ecore_timer_add(0.1, _mp_now_playing_list_loading_timer_cb, list); + list->loading_timer = + ecore_timer_add(0.1, _mp_now_playing_list_loading_timer_cb, list); return list; } -void -mp_now_playing_list_set_data(MpNowPlayingList_t *list, ...) +void mp_now_playing_list_set_data(MpNowPlayingList_t * list, ...) { MP_CHECK(list); @@ -476,13 +501,14 @@ mp_now_playing_list_set_data(MpNowPlayingList_t *list, ...) DEBUG_TRACE("field is %d", field); switch (field) { - case MP_NOW_PLAYING_LIST_ATTR_HIGHLIGHT_CURRENT: { - int val = va_arg((var_args), int); + case MP_NOW_PLAYING_LIST_ATTR_HIGHLIGHT_CURRENT:{ + int val = va_arg((var_args), int); - list->highlight_current = val; - DEBUG_TRACE("list->highlight_current = %d", list->highlight_current); - break; - } + list->highlight_current = val; + DEBUG_TRACE("list->highlight_current = %d", + list->highlight_current); + break; + } default: DEBUG_TRACE("Invalid arguments"); } @@ -492,8 +518,7 @@ mp_now_playing_list_set_data(MpNowPlayingList_t *list, ...) va_end(var_args); } -void -mp_now_playing_list_remove_selected_item(MpNowPlayingList_t *list) +void mp_now_playing_list_remove_selected_item(MpNowPlayingList_t * list) { startfunc; MP_CHECK(list); @@ -504,7 +529,8 @@ mp_now_playing_list_remove_selected_item(MpNowPlayingList_t *list) MP_CHECK(ad->playlist_mgr); bool now_playing_changed = false; - mp_plst_item *current_plst = mp_playlist_mgr_get_current(ad->playlist_mgr); + mp_plst_item *current_plst = + mp_playlist_mgr_get_current(ad->playlist_mgr); Elm_Object_Item *item = elm_genlist_first_item_get(list->genlist); while (item) { mp_list_item_data_t *item_data = elm_object_item_data_get(item); @@ -513,13 +539,17 @@ mp_now_playing_list_remove_selected_item(MpNowPlayingList_t *list) if (item_data && item_data->checked && item_data->handle) { char *uid = NULL; mp_media_info_get_media_id(item_data->handle, &uid); - mp_plst_item *remove_item = mp_playlist_mgr_get_item_by_uid(ad->playlist_mgr, uid); + mp_plst_item *remove_item = + mp_playlist_mgr_get_item_by_uid(ad->playlist_mgr, uid); if (remove_item == current_plst) { WARN_TRACE("remove current play list item"); - current_plst = mp_playlist_mgr_get_next(ad->playlist_mgr, EINA_FALSE, false); + current_plst = + mp_playlist_mgr_get_next(ad->playlist_mgr, EINA_FALSE, + false); now_playing_changed = true; } - mp_playlist_mgr_item_remove_item(ad->playlist_mgr, remove_item); + mp_playlist_mgr_item_remove_item(ad->playlist_mgr, + remove_item); elm_object_item_del(item_data->it); } } @@ -537,8 +567,7 @@ mp_now_playing_list_remove_selected_item(MpNowPlayingList_t *list) } } -void -mp_now_playing_list_refresh(MpNowPlayingList_t *list) +void mp_now_playing_list_refresh(MpNowPlayingList_t * list) { MP_CHECK(list); MP_CHECK(list->genlist); @@ -553,8 +582,12 @@ mp_now_playing_list_refresh(MpNowPlayingList_t *list) mp_list_item_data_t *item_data = elm_object_item_data_get(it); if (item_data) { mp_plst_item *plst_item = item_data->plst_item; - if (plst_item && plst_item->uri && plst_item->track_type == MP_TRACK_URI) { - if (!mp_file_exists(plst_item->uri) || (mmc_removed && strstr(plst_item->uri, MP_MMC_ROOT_PATH) == plst_item->uri)) { + if (plst_item && plst_item->uri + && plst_item->track_type == MP_TRACK_URI) { + if (!mp_file_exists(plst_item->uri) + || (mmc_removed + && strstr(plst_item->uri, + MP_MMC_ROOT_PATH) == plst_item->uri)) { WARN_TRACE("removed uri %s", plst_item->uri); elm_object_item_del(it); itemDeleted = true; @@ -568,12 +601,14 @@ mp_now_playing_list_refresh(MpNowPlayingList_t *list) itemDeleted = false; it = next; } - Eina_List *realized_items = elm_genlist_realized_items_get(list->genlist); + Eina_List *realized_items = + elm_genlist_realized_items_get(list->genlist); Eina_List *l = NULL; Elm_Object_Item *data_tmp = NULL; EINA_LIST_FOREACH(realized_items, l, data_tmp) - elm_genlist_item_fields_update(data_tmp, "elm.text.*", ELM_GENLIST_ITEM_FIELD_TEXT); + elm_genlist_item_fields_update(data_tmp, "elm.text.*", + ELM_GENLIST_ITEM_FIELD_TEXT); mp_now_playing_list_current_item_show(list); if (realized_items) { @@ -581,8 +616,7 @@ mp_now_playing_list_refresh(MpNowPlayingList_t *list) } } -void -mp_now_playing_list_current_item_show(MpNowPlayingList_t *list) +void mp_now_playing_list_current_item_show(MpNowPlayingList_t * list) { startfunc; MP_CHECK(list); @@ -592,7 +626,8 @@ mp_now_playing_list_current_item_show(MpNowPlayingList_t *list) MP_CHECK(ad); MP_CHECK(ad->playlist_mgr); - mp_plst_item *current_plst = mp_playlist_mgr_get_current(ad->playlist_mgr); + mp_plst_item *current_plst = + mp_playlist_mgr_get_current(ad->playlist_mgr); MP_CHECK(current_plst); MP_CHECK(current_plst->uid); @@ -604,7 +639,8 @@ mp_now_playing_list_current_item_show(MpNowPlayingList_t *list) mp_media_info_get_media_id(item_data->handle, &uid); if (!g_strcmp0(uid, current_plst->uid)) { - elm_genlist_item_show(item, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE); + elm_genlist_item_show(item, + ELM_GENLIST_ITEM_SCROLLTO_MIDDLE); break; } } @@ -614,4 +650,3 @@ mp_now_playing_list_current_item_show(MpNowPlayingList_t *list) endfunc; } - diff --git a/src/widget/mp-now-playing.c b/src/widget/mp-now-playing.c index 012f8b5..981dfaa 100644 --- a/src/widget/mp-now-playing.c +++ b/src/widget/mp-now-playing.c @@ -41,8 +41,8 @@ typedef struct { MpNowplayingCb clicked; void *userdata; char *play_time; - Evas_Object* shuffle_focus_btn; - Evas_Object* repeate_focus_btn; + Evas_Object *shuffle_focus_btn; + Evas_Object *repeate_focus_btn; } MpNpData_t; #define GET_WIDGET_DATA(o) evas_object_data_get(o, "widget_d"); @@ -62,19 +62,22 @@ typedef struct { #undef MP_NOW_PLAYING_MINI_EQ #endif -static void _mp_now_playing_update_playpause_btn(Evas_Object *obj); +static void _mp_now_playing_update_playpause_btn(Evas_Object * obj); static void _mp_now_playing_update_time(void *data); char *g_tts_located_part = NULL; #ifdef MP_NOW_PLAYING_MINI_EQ -static Evas_Object * -_mp_now_playing_create_thumb_icon(Evas_Object * obj, const char *path, int w, int h) +static Evas_Object *_mp_now_playing_create_thumb_icon(Evas_Object * obj, + const char *path, + int w, int h) { Evas_Object *thumbnail = elm_image_add(obj); elm_image_file_set(thumbnail, IMAGE_EDJ_NAME, path); - evas_object_size_hint_weight_set(thumbnail, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_fill_set(thumbnail, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(thumbnail, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_fill_set(thumbnail, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); return thumbnail; } #endif @@ -82,7 +85,7 @@ _mp_now_playing_create_thumb_icon(Evas_Object * obj, const char *path, int w, in void _progressbar_value_update_to_zero(void *data) { startfunc; - MpNpData_t *wd = data; + MpNpData_t *wd = data; MP_CHECK(wd); MP_CHECK(wd->progress); @@ -97,7 +100,7 @@ void _progressbar_value_update_to_zero(void *data) static void _progressbar_value_set(void *data) { - MpNpData_t *wd = data; + MpNpData_t *wd = data; MP_CHECK(wd); MP_CHECK(wd->progress); @@ -111,7 +114,8 @@ static void _progressbar_value_set(void *data) value = pos / duration; } - ERROR_TRACE("wishjox pos :%f, duration: %f, val: %f", pos, duration, value); + ERROR_TRACE("wishjox pos :%f, duration: %f, val: %f", pos, duration, + value); elm_progressbar_value_set(wd->progress, value); } @@ -212,11 +216,10 @@ static void _mini_eq_get_image(char **path1, char **path2, char **path3) } #endif -static Eina_Bool -_mp_nowplaying_timer_cb(void *data) +static Eina_Bool _mp_nowplaying_timer_cb(void *data) { TIMER_TRACE(); - MpNpData_t *wd = data; + MpNpData_t *wd = data; MP_CHECK_FALSE(wd); MP_CHECK_FALSE(wd->now_playing); struct appdata *ad = mp_util_get_appdata(); @@ -248,9 +251,12 @@ _mp_nowplaying_timer_cb(void *data) unused_image = elm_object_part_content_unset(wd->mini_eq, "image3"); evas_object_del(unused_image); - Evas_Object *image1 = _mp_now_playing_create_thumb_icon(wd->mini_eq, path1, 11, 38); - Evas_Object *image2 = _mp_now_playing_create_thumb_icon(wd->mini_eq, path2, 11, 38); - Evas_Object *image3 = _mp_now_playing_create_thumb_icon(wd->mini_eq, path3, 11, 38); + Evas_Object *image1 = + _mp_now_playing_create_thumb_icon(wd->mini_eq, path1, 11, 38); + Evas_Object *image2 = + _mp_now_playing_create_thumb_icon(wd->mini_eq, path2, 11, 38); + Evas_Object *image3 = + _mp_now_playing_create_thumb_icon(wd->mini_eq, path3, 11, 38); elm_object_part_content_set(wd->mini_eq, "image1", image1); elm_object_part_content_set(wd->mini_eq, "image2", image2); elm_object_part_content_set(wd->mini_eq, "image3", image3); @@ -276,22 +282,26 @@ _widget_del_cb(void *data, Evas * e, Evas_Object * obj, void *event_info) IF_FREE(wd); } -static void _mp_now_playing_update_btn(Evas_Object *obj) +static void _mp_now_playing_update_btn(Evas_Object * obj) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); if (ad->player_state == PLAY_STATE_PLAYING) { - edje_object_signal_emit(elm_layout_edje_get(obj), "control_play_visible", "control_play"); - edje_object_signal_emit(elm_layout_edje_get(obj), "control_pause_invisible", "control_pause"); + edje_object_signal_emit(elm_layout_edje_get(obj), + "control_play_visible", "control_play"); + edje_object_signal_emit(elm_layout_edje_get(obj), + "control_pause_invisible", + "control_pause"); } else { - edje_object_signal_emit(elm_layout_edje_get(obj), "control_play_invisible", "control_play"); - edje_object_signal_emit(elm_layout_edje_get(obj), "control_pause_visible", "control_pause"); + edje_object_signal_emit(elm_layout_edje_get(obj), + "control_play_invisible", "control_play"); + edje_object_signal_emit(elm_layout_edje_get(obj), + "control_pause_visible", "control_pause"); } } -static Eina_Bool -_btn_update_timer(void *data) +static Eina_Bool _btn_update_timer(void *data) { TIMER_TRACE(""); MpNpData_t *wd = GET_WIDGET_DATA(data); @@ -303,7 +313,7 @@ _btn_update_timer(void *data) return EINA_FALSE; } -static void _mp_now_playing_update_playpause_btn(Evas_Object *obj) +static void _mp_now_playing_update_playpause_btn(Evas_Object * obj) { MP_CHECK(obj); MpNpData_t *wd = GET_WIDGET_DATA(obj); @@ -314,22 +324,23 @@ static void _mp_now_playing_update_playpause_btn(Evas_Object *obj) struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); - if (ad->player_state == PLAY_STATE_PLAYING || ad->player_state == PLAY_STATE_PAUSED) { + if (ad->player_state == PLAY_STATE_PLAYING + || ad->player_state == PLAY_STATE_PAUSED) { _mp_now_playing_update_btn(obj); } else { - wd->stop_update_timer = ecore_timer_add(1.0, _btn_update_timer, obj); + wd->stop_update_timer = + ecore_timer_add(1.0, _btn_update_timer, obj); } } -static void -_mp_now_playing_update_time(void *data) +static void _mp_now_playing_update_time(void *data) { struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); MP_CHECK(!ad->is_lcd_off); - MpNpData_t *wd = data; + MpNpData_t *wd = data; MP_CHECK(wd); MP_CHECK(wd->progress); @@ -341,26 +352,32 @@ _mp_now_playing_update_time(void *data) if (duration > 0.) { if (duration > 3600.) { snprintf(total_time, sizeof(total_time), "%" MUSIC_TIME_FORMAT, - MUSIC_TIME_ARGS(duration)); - snprintf(play_time, sizeof(play_time), "%" MUSIC_TIME_FORMAT, MUSIC_TIME_ARGS(ad->music_pos)); + MUSIC_TIME_ARGS(duration)); + snprintf(play_time, sizeof(play_time), "%" MUSIC_TIME_FORMAT, + MUSIC_TIME_ARGS(ad->music_pos)); } else { snprintf(total_time, sizeof(total_time), "%" PLAY_TIME_FORMAT, - PLAY_TIME_ARGS(duration)); - snprintf(play_time, sizeof(play_time), "%" PLAY_TIME_FORMAT, PLAY_TIME_ARGS(ad->music_pos)); + PLAY_TIME_ARGS(duration)); + snprintf(play_time, sizeof(play_time), "%" PLAY_TIME_FORMAT, + PLAY_TIME_ARGS(ad->music_pos)); } } else { if (ad->current_track_info) snprintf(total_time, sizeof(total_time), "%" PLAY_TIME_FORMAT, - PLAY_TIME_ARGS(ad->current_track_info->duration / 1000.)); - snprintf(play_time, sizeof(play_time), "%" PLAY_TIME_FORMAT, PLAY_TIME_ARGS(ad->music_pos)); + PLAY_TIME_ARGS(ad->current_track_info->duration / + 1000.)); + snprintf(play_time, sizeof(play_time), "%" PLAY_TIME_FORMAT, + PLAY_TIME_ARGS(ad->music_pos)); } if (g_strcmp0(play_time, wd->play_time)) { IF_FREE(wd->play_time); wd->play_time = g_strdup(play_time); - edje_object_part_text_set(_EDJ(wd->now_playing), "np_progress_text_total", total_time); - edje_object_part_text_set(_EDJ(wd->now_playing), "np_progress_text_playing", play_time); + edje_object_part_text_set(_EDJ(wd->now_playing), + "np_progress_text_total", total_time); + edje_object_part_text_set(_EDJ(wd->now_playing), + "np_progress_text_playing", play_time); _progressbar_value_set(wd); } @@ -368,11 +385,12 @@ _mp_now_playing_update_time(void *data) } static void -_mp_now_playing_progressarea_down_cb(void *data, Evas * e, Evas_Object * obj, void *event_info) +_mp_now_playing_progressarea_down_cb(void *data, Evas * e, + Evas_Object * obj, void *event_info) { startfunc; - MpNpData_t *wd = data; + MpNpData_t *wd = data; MP_CHECK(wd); MP_CHECK(wd->progress); @@ -394,7 +412,7 @@ _mp_now_playing_progressarea_down_cb(void *data, Evas * e, Evas_Object * obj, vo current = w; } - ratio = (double)current / w; + ratio = (double) current / w; DEBUG_TRACE("canvas.x:%d x:%d w:%d", ev->canvas.x, x, w); int duration = mp_player_mgr_get_duration(); @@ -411,7 +429,8 @@ _mp_now_playing_progressarea_down_cb(void *data, Evas * e, Evas_Object * obj, vo wd->dragging = true; - ERROR_TRACE("wishjox pos :%f, duration: %f, val: %f", ad->music_pos , ad->music_length, ratio); + ERROR_TRACE("wishjox pos :%f, duration: %f, val: %f", ad->music_pos, + ad->music_length, ratio); elm_progressbar_value_set(wd->progress, ratio); _mp_now_playing_update_time(wd); @@ -419,10 +438,11 @@ _mp_now_playing_progressarea_down_cb(void *data, Evas * e, Evas_Object * obj, vo } static void -_mp_now_playing_progressarea_move_cb(void *data, Evas * e, Evas_Object * obj, void *event_info) +_mp_now_playing_progressarea_move_cb(void *data, Evas * e, + Evas_Object * obj, void *event_info) { startfunc; - MpNpData_t *wd = data; + MpNpData_t *wd = data; MP_CHECK(wd); MP_CHECK(wd->progress); @@ -443,7 +463,7 @@ _mp_now_playing_progressarea_move_cb(void *data, Evas * e, Evas_Object * obj, vo current = w; } - ratio = (double)current / w; + ratio = (double) current / w; new_pos = ratio * ad->music_length; ad->music_pos = new_pos; @@ -454,10 +474,11 @@ _mp_now_playing_progressarea_move_cb(void *data, Evas * e, Evas_Object * obj, vo } static void -_mp_now_playing_progressarea_up_cb(void *data, Evas * e, Evas_Object * obj, void *event_info) +_mp_now_playing_progressarea_up_cb(void *data, Evas * e, Evas_Object * obj, + void *event_info) { startfunc; - MpNpData_t *wd = data; + MpNpData_t *wd = data; MP_CHECK(wd); MP_CHECK(wd->progress); @@ -479,7 +500,7 @@ _mp_now_playing_progressarea_up_cb(void *data, Evas * e, Evas_Object * obj, void current = w; } - ratio = (double)current / w; + ratio = (double) current / w; ad->music_pos = ratio * ad->music_length; @@ -517,7 +538,7 @@ static char* _mp_now_playing_progress_total_text_tts_info_cb(void *data, Evas_Ob #define ALBUMART_W 195 #define CENTER_MIN_W 160 -static void _set_layout(Evas_Object *obj) +static void _set_layout(Evas_Object * obj) { int w, h; struct appdata *ad = mp_util_get_appdata(); @@ -530,10 +551,12 @@ static void _set_layout(Evas_Object *obj) if (w < CONTROL_W * elm_config_scale_get()) { DEBUG_TRACE("control_only mode"); elm_object_signal_emit(obj, "control_only", "*"); - } else if (w < (CONTROL_W + ALBUMART_W)*elm_config_scale_get()) { + } else if (w < (CONTROL_W + ALBUMART_W) * elm_config_scale_get()) { DEBUG_TRACE("hide_center"); elm_object_signal_emit(obj, "hide_center", "*"); - } else if (w < (CONTROL_W + ALBUMART_W + CENTER_MIN_W)*elm_config_scale_get()) { + } else if (w < + (CONTROL_W + ALBUMART_W + + CENTER_MIN_W) * elm_config_scale_get()) { DEBUG_TRACE("center min mode"); elm_object_signal_emit(obj, "center_min", "*"); } else { @@ -542,7 +565,9 @@ static void _set_layout(Evas_Object *obj) } } -static void _mp_now_left_area_clicked_cb(void *data, Evas_Object *o, const char *emission, const char *source) +static void _mp_now_left_area_clicked_cb(void *data, Evas_Object * o, + const char *emission, + const char *source) { startfunc; DEBUG_TRACE("album clicked"); @@ -554,7 +579,8 @@ static void _mp_now_left_area_clicked_cb(void *data, Evas_Object *o, const char } } -static void _mp_now_playing_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_now_playing_btn_clicked_cb(void *data, Evas_Object * obj, + void *event_info) { DEBUG_TRACE("button clicked"); @@ -562,12 +588,17 @@ static void _mp_now_playing_btn_clicked_cb(void *data, Evas_Object *obj, void *e MP_CHECK(ad); if (_mp_is_current_focus_available(ad) != 0) { - ERROR_TRACE("Some other application has the focus currently... Returning..."); + ERROR_TRACE + ("Some other application has the focus currently... Returning..."); char *message = STR_MP_UNABLE_TO_PLAY_DURING_CALL; if (message) { - int ret = notification_status_message_post(dgettext("music-player", message)); + int ret = + notification_status_message_post(dgettext + ("music-player", + message)); if (ret != 0) { - ERROR_TRACE("notification_status_message_post()... [0x%x]", ret); + ERROR_TRACE("notification_status_message_post()... [0x%x]", + ret); } else { DEBUG_TRACE("message: [%s]", message); } @@ -585,7 +616,8 @@ static void _mp_now_playing_btn_clicked_cb(void *data, Evas_Object *obj, void *e } -static void _mp_now_playing_btn_pressed_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_now_playing_btn_pressed_cb(void *data, Evas_Object * obj, + void *event_info) { DEBUG_TRACE("button pressed"); @@ -593,11 +625,12 @@ static void _mp_now_playing_btn_pressed_cb(void *data, Evas_Object *obj, void *e MP_CHECK(ad); if (_mp_is_current_focus_available(ad) != 0) { - ERROR_TRACE("Some other application has the focus currently... Changing state in paused state..."); + ERROR_TRACE + ("Some other application has the focus currently... Changing state in paused state..."); ad->paused_by_user = TRUE; } - char *source = (char *)data; + char *source = (char *) data; if (!g_strcmp0(source, NOW_PLAYING_FF_SOURCE)) { mp_play_control_ff(true, false, true); } else { @@ -605,10 +638,11 @@ static void _mp_now_playing_btn_pressed_cb(void *data, Evas_Object *obj, void *e } } -static void _mp_now_playing_btn_unpressed_cb(void *data, Evas_Object *obj, void *event_info) +static void _mp_now_playing_btn_unpressed_cb(void *data, Evas_Object * obj, + void *event_info) { DEBUG_TRACE("button unpressed"); - char *source = (char *)data; + char *source = (char *) data; if (!g_strcmp0(source, NOW_PLAYING_FF_SOURCE)) { mp_play_control_ff(false, false, true); } else { @@ -616,7 +650,9 @@ static void _mp_now_playing_btn_unpressed_cb(void *data, Evas_Object *obj, void } } -Evas_Object *mp_now_playing_create(Evas_Object *parent, MpNowplayingCb play_bt_clicked, MpNowplayingCb clicked, void *data) +Evas_Object *mp_now_playing_create(Evas_Object * parent, + MpNowplayingCb play_bt_clicked, + MpNowplayingCb clicked, void *data) { startfunc; Evas_Object *playing_pannel = NULL; @@ -626,13 +662,15 @@ Evas_Object *mp_now_playing_create(Evas_Object *parent, MpNowplayingCb play_bt_c playing_pannel = elm_layout_add(parent); if (playing_pannel) { - char edje_path[1024] ={0}; - char * path = app_get_resource_path(); + char edje_path[1024] = { 0 }; + char *path = app_get_resource_path(); MP_CHECK_NULL(path); - snprintf(edje_path, 1024, "%s%s/%s", path, "edje", PLAY_VIEW_EDJ_NAME); + snprintf(edje_path, 1024, "%s%s/%s", path, "edje", + PLAY_VIEW_EDJ_NAME); - r = elm_layout_file_set(playing_pannel, edje_path, "mp_now_playing"); + r = elm_layout_file_set(playing_pannel, edje_path, + "mp_now_playing"); free(path); if (!r) { @@ -640,7 +678,8 @@ Evas_Object *mp_now_playing_create(Evas_Object *parent, MpNowplayingCb play_bt_c evas_object_del(playing_pannel); return NULL; } - evas_object_size_hint_weight_set(playing_pannel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(playing_pannel, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); } wd = calloc(1, sizeof(MpNpData_t)); @@ -652,11 +691,13 @@ Evas_Object *mp_now_playing_create(Evas_Object *parent, MpNowplayingCb play_bt_c evas_object_data_set(playing_pannel, "widget_d", wd); - /* wd->landscape = landscape;*/ + /* wd->landscape = landscape; */ Evas_Object *thumbnail = elm_image_add(playing_pannel); - evas_object_size_hint_align_set(thumbnail, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(thumbnail, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(thumbnail, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_size_hint_weight_set(thumbnail, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); //elm_image_aspect_fixed_set(thumbnail, true); elm_image_fill_outside_set(thumbnail, true); elm_image_prescale_set(thumbnail, 100); @@ -666,26 +707,33 @@ Evas_Object *mp_now_playing_create(Evas_Object *parent, MpNowplayingCb play_bt_c Evas_Object *progress = elm_progressbar_add(playing_pannel); elm_object_style_set(progress, "music/list_progress"); elm_progressbar_horizontal_set(progress, EINA_TRUE); - evas_object_size_hint_align_set(progress, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(progress, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(progress, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_size_hint_weight_set(progress, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); elm_progressbar_value_set(progress, 0.0); evas_object_show(progress); Evas_Object *progress_focus_btn = elm_button_add(playing_pannel); elm_object_style_set(progress_focus_btn, "focus"); - elm_object_part_content_set(progress_focus_btn, "elm.swallow.content", progress); + elm_object_part_content_set(progress_focus_btn, "elm.swallow.content", + progress); wd->progress = progress; evas_object_event_callback_add(progress, EVAS_CALLBACK_MOUSE_DOWN, - _mp_now_playing_progressarea_down_cb, wd); + _mp_now_playing_progressarea_down_cb, + wd); evas_object_event_callback_add(progress, EVAS_CALLBACK_MOUSE_UP, - _mp_now_playing_progressarea_up_cb, wd); + _mp_now_playing_progressarea_up_cb, wd); evas_object_event_callback_add(progress, EVAS_CALLBACK_MOUSE_MOVE, - _mp_now_playing_progressarea_move_cb, wd); + _mp_now_playing_progressarea_move_cb, + wd); #ifdef MP_NOW_PLAYING_MINI_EQ Evas_Object *mini_eq_ani = NULL; - mini_eq_ani = mp_common_load_edj(playing_pannel, PLAY_VIEW_EDJ_NAME, "mini_eq_layout"); + mini_eq_ani = + mp_common_load_edj(playing_pannel, PLAY_VIEW_EDJ_NAME, + "mini_eq_layout"); if (mini_eq_ani == NULL) { ERROR_TRACE("create mini_eq_ani failed"); } @@ -694,9 +742,12 @@ Evas_Object *mp_now_playing_create(Evas_Object *parent, MpNowplayingCb play_bt_c char *path2 = NULL; char *path3 = NULL; _mini_eq_get_image(&path1, &path2, &path3); - Evas_Object *image1 = _mp_now_playing_create_thumb_icon(mini_eq_ani, path1, 11, 38); - Evas_Object *image2 = _mp_now_playing_create_thumb_icon(mini_eq_ani, path2, 11, 38); - Evas_Object *image3 = _mp_now_playing_create_thumb_icon(mini_eq_ani, path3, 11, 38); + Evas_Object *image1 = + _mp_now_playing_create_thumb_icon(mini_eq_ani, path1, 11, 38); + Evas_Object *image2 = + _mp_now_playing_create_thumb_icon(mini_eq_ani, path2, 11, 38); + Evas_Object *image3 = + _mp_now_playing_create_thumb_icon(mini_eq_ani, path3, 11, 38); elm_object_part_content_set(mini_eq_ani, "image1", image1); elm_object_part_content_set(mini_eq_ani, "image2", image2); elm_object_part_content_set(mini_eq_ani, "image3", image3); @@ -714,9 +765,12 @@ Evas_Object *mp_now_playing_create(Evas_Object *parent, MpNowplayingCb play_bt_c wd->timer = ecore_timer_add(0.25, _mp_nowplaying_timer_cb, wd); MP_TIMER_FREEZE(wd->timer); - evas_object_event_callback_add(playing_pannel, EVAS_CALLBACK_FREE, _widget_del_cb, wd); + evas_object_event_callback_add(playing_pannel, EVAS_CALLBACK_FREE, + _widget_del_cb, wd); - edje_object_signal_callback_add(_EDJ(playing_pannel), "now_playing_clicked", "*", _mp_now_left_area_clicked_cb, wd); + edje_object_signal_callback_add(_EDJ(playing_pannel), + "now_playing_clicked", "*", + _mp_now_left_area_clicked_cb, wd); //elm_object_signal_callback_add(playing_pannel, SIGNAL_NOW_PLAYING_CLICKED, "*", _mp_now_playing_control_cb, wd); //elm_object_signal_callback_add(playing_pannel, SIGNAL_PREVIOUS, "*", _mp_now_playing_control_cb, wd); @@ -728,38 +782,54 @@ Evas_Object *mp_now_playing_create(Evas_Object *parent, MpNowplayingCb play_bt_c //elm_object_signal_callback_add(playing_pannel, SIGNAL_MOUSE_DOWN, "control_next",_mp_now_playing_seek_btn_down_cb, wd); //elm_object_signal_callback_add(playing_pannel, SIGNAL_MOUSE_UP, "control_next",_mp_now_playing_seek_btn_up_cb, wd); - elm_object_part_content_set(wd->now_playing, "now_playing_label", wd->label); + elm_object_part_content_set(wd->now_playing, "now_playing_label", + wd->label); - /*set focused UI*/ + /*set focused UI */ elm_object_focus_allow_set(playing_pannel, EINA_TRUE); elm_object_focus_allow_set(progress, EINA_TRUE); //elm_object_focus_custom_chain_append(playing_pannel, progress_focus_btn, NULL); Evas_Object *prev_focus_btn = elm_button_add(playing_pannel); elm_object_style_set(prev_focus_btn, "focus"); - elm_object_part_content_set(playing_pannel, "previous_focus", prev_focus_btn); - elm_object_focus_custom_chain_append(playing_pannel, prev_focus_btn, NULL); - evas_object_smart_callback_add(prev_focus_btn, "pressed", _mp_now_playing_btn_pressed_cb, "control_previous"); - evas_object_smart_callback_add(prev_focus_btn, "unpressed", _mp_now_playing_btn_unpressed_cb, "control_previous"); + elm_object_part_content_set(playing_pannel, "previous_focus", + prev_focus_btn); + elm_object_focus_custom_chain_append(playing_pannel, prev_focus_btn, + NULL); + evas_object_smart_callback_add(prev_focus_btn, "pressed", + _mp_now_playing_btn_pressed_cb, + "control_previous"); + evas_object_smart_callback_add(prev_focus_btn, "unpressed", + _mp_now_playing_btn_unpressed_cb, + "control_previous"); Evas_Object *play_pause_focus_btn = elm_button_add(playing_pannel); elm_object_style_set(play_pause_focus_btn, "focus"); - elm_object_part_content_set(playing_pannel, "play_pause_focus", play_pause_focus_btn); - elm_object_focus_custom_chain_append(playing_pannel, play_pause_focus_btn, NULL); - evas_object_smart_callback_add(play_pause_focus_btn, "clicked", _mp_now_playing_btn_clicked_cb, wd); + elm_object_part_content_set(playing_pannel, "play_pause_focus", + play_pause_focus_btn); + elm_object_focus_custom_chain_append(playing_pannel, + play_pause_focus_btn, NULL); + evas_object_smart_callback_add(play_pause_focus_btn, "clicked", + _mp_now_playing_btn_clicked_cb, wd); Evas_Object *next_focus_btn = elm_button_add(playing_pannel); elm_object_style_set(next_focus_btn, "focus"); - elm_object_part_content_set(playing_pannel, "next_focus", next_focus_btn); - elm_object_focus_custom_chain_append(playing_pannel, next_focus_btn, NULL); - evas_object_smart_callback_add(next_focus_btn, "pressed", _mp_now_playing_btn_pressed_cb, "control_next"); - evas_object_smart_callback_add(next_focus_btn, "unpressed", _mp_now_playing_btn_unpressed_cb, "control_next"); + elm_object_part_content_set(playing_pannel, "next_focus", + next_focus_btn); + elm_object_focus_custom_chain_append(playing_pannel, next_focus_btn, + NULL); + evas_object_smart_callback_add(next_focus_btn, "pressed", + _mp_now_playing_btn_pressed_cb, + "control_next"); + evas_object_smart_callback_add(next_focus_btn, "unpressed", + _mp_now_playing_btn_unpressed_cb, + "control_next"); _mp_now_playing_update_btn(wd->now_playing); return playing_pannel; } -void mp_now_playing_thaw_timer(Evas_Object *now_playing) +void mp_now_playing_thaw_timer(Evas_Object * now_playing) { startfunc; MpNpData_t *wd = GET_WIDGET_DATA(now_playing); @@ -773,7 +843,7 @@ void mp_now_playing_thaw_timer(Evas_Object *now_playing) } } -void mp_now_playing_freeze_timer(Evas_Object *now_playing) +void mp_now_playing_freeze_timer(Evas_Object * now_playing) { startfunc; MpNpData_t *wd = GET_WIDGET_DATA(now_playing); @@ -791,7 +861,9 @@ void mp_now_playing_freeze_timer(Evas_Object *now_playing) MP_TIMER_FREEZE(wd->timer); } -static void _mp_now_playing_set_title(Evas_Object *now_playing, const char *title, const char *artist) +static void _mp_now_playing_set_title(Evas_Object * now_playing, + const char *title, + const char *artist) { startfunc; MpNpData_t *wd = GET_WIDGET_DATA(now_playing); @@ -802,7 +874,8 @@ static void _mp_now_playing_set_title(Evas_Object *now_playing, const char *titl char *mtitle = NULL; char *martist = NULL; - char *title_format = "%s"; + char *title_format = + "%s"; mtitle = g_strdup_printf(title_format, 28, markup_title); martist = g_strdup_printf(title_format, 25, markup_artist); @@ -812,7 +885,8 @@ static void _mp_now_playing_set_title(Evas_Object *now_playing, const char *titl elm_label_wrap_width_set(label_title, 1); elm_object_text_set(label_title, mtitle); elm_label_slide_go(label_title); - elm_object_part_content_set(wd->now_playing, "now_playing_label", label_title); + elm_object_part_content_set(wd->now_playing, "now_playing_label", + label_title); Evas_Object *label_artist = elm_label_add(wd->now_playing); @@ -821,7 +895,8 @@ static void _mp_now_playing_set_title(Evas_Object *now_playing, const char *titl elm_label_wrap_width_set(label_artist, 1); elm_object_text_set(label_artist, martist); elm_label_slide_go(label_artist); - elm_object_part_content_set(wd->now_playing, "now_playing_artist", label_artist); + elm_object_part_content_set(wd->now_playing, "now_playing_artist", + label_artist); IF_FREE(mtitle); IF_FREE(martist); @@ -829,7 +904,10 @@ static void _mp_now_playing_set_title(Evas_Object *now_playing, const char *titl IF_FREE(markup_artist); } -void mp_now_playing_update(Evas_Object *now_playing, const char *title, const char *artist, const char *thumbnail, bool with_title) + +void mp_now_playing_update(Evas_Object * now_playing, const char *title, + const char *artist, const char *thumbnail, + bool with_title) { startfunc; MpNpData_t *wd = GET_WIDGET_DATA(now_playing); @@ -848,8 +926,7 @@ void mp_now_playing_update(Evas_Object *now_playing, const char *title, const ch if (ad->player_state == PLAY_STATE_PAUSED && ad->is_Longpress) { _progressbar_value_set(wd); - } - else if (((MpView_t *)(wd->userdata))->rotate_flag) { + } else if (((MpView_t *) (wd->userdata))->rotate_flag) { _progressbar_value_set(wd); #ifdef MP_NOW_PLAYING_MINI_EQ elm_object_part_content_set(wd->mini_eq, "image1", NULL); @@ -857,7 +934,6 @@ void mp_now_playing_update(Evas_Object *now_playing, const char *title, const ch elm_object_part_content_set(wd->mini_eq, "image3", NULL); #endif } - #ifndef MP_SOUND_PLAYER mp_setting_save_now_playing(ad); #endif @@ -866,7 +942,7 @@ void mp_now_playing_update(Evas_Object *now_playing, const char *title, const ch _mp_now_playing_update_playpause_btn(wd->now_playing); } -bool mp_now_playing_is_landscape(Evas_Object *now_playing) +bool mp_now_playing_is_landscape(Evas_Object * now_playing) { MP_CHECK_FALSE(now_playing); MpNpData_t *wd = GET_WIDGET_DATA(now_playing); @@ -875,8 +951,7 @@ bool mp_now_playing_is_landscape(Evas_Object *now_playing) return wd->landscape; } -void mp_now_playing_set_layout(Evas_Object *now_playing) +void mp_now_playing_set_layout(Evas_Object * now_playing) { _set_layout(now_playing); } - diff --git a/src/widget/mp-player-volume-widget.c b/src/widget/mp-player-volume-widget.c index 0f77cb6..2fbe30b 100644 --- a/src/widget/mp-player-volume-widget.c +++ b/src/widget/mp-player-volume-widget.c @@ -35,10 +35,10 @@ #define VOLUME_WIDGET_SLIDER_LEVEL_MAX 16 #define VOLUME_WIDGET_SLIDER_LEVEL_MIN 0 -#define MP_VOLUME_WIDGET_W 64 +#define MP_VOLUME_WIDGET_W 64 #define MP_VOLUME_WIDGET_H 348 -#define MP_VOLUME_WIDGET_LD_W 116 +#define MP_VOLUME_WIDGET_LD_W 116 #define MP_VOLUME_WIDGET_LD_H 438 #define VOLUME_SLIDER_MUL_START_POINT 96 @@ -62,7 +62,7 @@ int VOLUME_WIDGET_SLIDER_SIZE; int VOLUME_WIDGET_SLIDER_START_POINT; static inline void -_mp_player_volume_widget_set_indicator(Volume_Widget_Data *wd, int val) +_mp_player_volume_widget_set_indicator(Volume_Widget_Data * wd, int val) { MP_CHECK(wd); @@ -73,18 +73,21 @@ _mp_player_volume_widget_set_indicator(Volume_Widget_Data *wd, int val) wd->current = val; } -static inline int -_mp_player_volume_widget_get_val(Volume_Widget_Data *wd) +static inline int _mp_player_volume_widget_get_val(Volume_Widget_Data * wd) { MP_CHECK_VAL(wd, 0); double val = 0.0; - edje_object_part_drag_value_get(_EDJ(wd->obj), VOLUME_WIDGET_SLIDER_HANDLE, NULL, &val); - return (int)(val * wd->max); + edje_object_part_drag_value_get(_EDJ(wd->obj), + VOLUME_WIDGET_SLIDER_HANDLE, NULL, + &val); + return (int) (val * wd->max); } static void -_mp_player_volume_widget_drag_start_cb(void *data, Evas_Object *obj, const char *emission, const char *source) +_mp_player_volume_widget_drag_start_cb(void *data, Evas_Object * obj, + const char *emission, + const char *source) { startfunc; Volume_Widget_Data *wd = data; @@ -96,7 +99,9 @@ _mp_player_volume_widget_drag_start_cb(void *data, Evas_Object *obj, const char } static void -_mp_player_volume_widget_drag_stop_cb(void *data, Evas_Object *obj, const char *emission, const char *source) +_mp_player_volume_widget_drag_stop_cb(void *data, Evas_Object * obj, + const char *emission, + const char *source) { startfunc; Volume_Widget_Data *wd = data; @@ -108,7 +113,8 @@ _mp_player_volume_widget_drag_stop_cb(void *data, Evas_Object *obj, const char * } static void -_mp_player_volume_widget_mousedown_cb(void *data, Evas * e, Evas_Object * obj, void *event_info) +_mp_player_volume_widget_mousedown_cb(void *data, Evas * e, + Evas_Object * obj, void *event_info) { startfunc; if (data == NULL && obj == NULL && event_info == NULL) { @@ -142,11 +148,14 @@ _mp_player_volume_widget_mousedown_cb(void *data, Evas * e, Evas_Object * obj, v int max_vol = VOLUME_WIDGET_SLIDER_LEVEL_MAX; current = ev->canvas.y; - double dval = (((VOLUME_WIDGET_SLIDER_START_POINT - current) * max_vol) * 1.0) / VOLUME_WIDGET_SLIDER_SIZE ; + double dval = + (((VOLUME_WIDGET_SLIDER_START_POINT - + current) * max_vol) * 1.0) / VOLUME_WIDGET_SLIDER_SIZE; val = dval; - DEBUG_TRACE("dval = %f, val = %d, dval-val=%f ", dval, val, (dval - val)); + DEBUG_TRACE("dval = %f, val = %d, dval-val=%f ", dval, val, + (dval - val)); if ((dval - val) > 0.5) { - val = val + 1; + val = val + 1; } if (val < VOLUME_WIDGET_SLIDER_LEVEL_MIN) { @@ -154,14 +163,13 @@ _mp_player_volume_widget_mousedown_cb(void *data, Evas * e, Evas_Object * obj, v } else if (val > max_vol) { val = max_vol; } - //int val = _mp_player_volume_widget_get_val(wd); DEBUG_TRACE("val = %d", val); DEBUG_TRACE("wd->current = %d", wd->current); if (val != wd->current) { if (!mp_player_mgr_volume_set(val)) { - return ; + return; } _mp_player_volume_widget_set_indicator(wd, val); } @@ -173,7 +181,8 @@ _mp_player_volume_widget_mousedown_cb(void *data, Evas * e, Evas_Object * obj, v } static void -_mp_player_volume_widget_mouseup_cb(void *data, Evas * e, Evas_Object * obj, void *event_info) +_mp_player_volume_widget_mouseup_cb(void *data, Evas * e, + Evas_Object * obj, void *event_info) { startfunc; if (data == NULL && obj == NULL && event_info == NULL) { @@ -183,7 +192,8 @@ _mp_player_volume_widget_mouseup_cb(void *data, Evas * e, Evas_Object * obj, voi Volume_Widget_Data *wd = data; MP_CHECK(wd); - mp_player_volume_widget_set_val(wd->obj, mp_player_mgr_volume_get_current()); + mp_player_volume_widget_set_val(wd->obj, + mp_player_mgr_volume_get_current()); if (wd->event_cb) { wd->event_cb(wd->user_data, obj, VOLUME_WIDGET_EVENT_DRAG_STOP); @@ -194,7 +204,9 @@ _mp_player_volume_widget_mouseup_cb(void *data, Evas * e, Evas_Object * obj, voi static void -_mp_player_volume_widget_changed_cb(void *data, Evas_Object *obj, const char *emission, const char *source) +_mp_player_volume_widget_changed_cb(void *data, Evas_Object * obj, + const char *emission, + const char *source) { startfunc; Volume_Widget_Data *wd = data; @@ -217,26 +229,32 @@ _mp_player_volume_widget_changed_cb(void *data, Evas_Object *obj, const char *em } static void -_mp_player_volume_widget_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +_mp_player_volume_widget_del_cb(void *data, Evas * e, Evas_Object * obj, + void *event_info) { Volume_Widget_Data *wd = data; SAFE_FREE(wd); } -Evas_Object * -mp_player_volume_widget_add(Evas_Object *parent) +Evas_Object *mp_player_volume_widget_add(Evas_Object * parent) { startfunc; MP_CHECK_NULL(parent); Evas_Object *widget = NULL; if (mp_util_is_landscape()) { - widget = mp_common_load_edj(parent, PLAY_VIEW_EDJ_NAME, VOLUME_WIDGET_GROUP_NAME_LD); + widget = + mp_common_load_edj(parent, PLAY_VIEW_EDJ_NAME, + VOLUME_WIDGET_GROUP_NAME_LD); } else { - widget = mp_common_load_edj(parent, PLAY_VIEW_EDJ_NAME, VOLUME_WIDGET_GROUP_NAME); + widget = + mp_common_load_edj(parent, PLAY_VIEW_EDJ_NAME, + VOLUME_WIDGET_GROUP_NAME); } - evas_object_size_hint_weight_set(widget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(widget, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(widget, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(widget, EVAS_HINT_FILL, + EVAS_HINT_FILL); Volume_Widget_Data *wd = calloc(1, sizeof(Volume_Widget_Data)); MP_CHECK_NULL(wd); @@ -244,16 +262,31 @@ mp_player_volume_widget_add(Evas_Object *parent) wd->max = mp_player_mgr_volume_get_max(); evas_object_data_set(widget, "widget_data", wd); - mp_player_volume_widget_set_val(widget, mp_player_mgr_volume_get_current()); + mp_player_volume_widget_set_val(widget, + mp_player_mgr_volume_get_current()); Evas_Object *edj_obj = _EDJ(widget); - edje_object_signal_callback_add(edj_obj, "drag,start", VOLUME_WIDGET_SLIDER_HANDLE, _mp_player_volume_widget_drag_start_cb, wd); - edje_object_signal_callback_add(edj_obj, "drag", VOLUME_WIDGET_SLIDER_HANDLE, _mp_player_volume_widget_changed_cb, wd); - edje_object_signal_callback_add(edj_obj, "drag,stop", VOLUME_WIDGET_SLIDER_HANDLE, _mp_player_volume_widget_drag_stop_cb, wd); - - evas_object_event_callback_add(widget, EVAS_CALLBACK_MOUSE_DOWN, _mp_player_volume_widget_mousedown_cb, wd); - evas_object_event_callback_add(widget, EVAS_CALLBACK_MOUSE_UP, _mp_player_volume_widget_mouseup_cb, wd); - evas_object_event_callback_add(widget, EVAS_CALLBACK_FREE, _mp_player_volume_widget_del_cb, wd); + edje_object_signal_callback_add(edj_obj, "drag,start", + VOLUME_WIDGET_SLIDER_HANDLE, + _mp_player_volume_widget_drag_start_cb, + wd); + edje_object_signal_callback_add(edj_obj, "drag", + VOLUME_WIDGET_SLIDER_HANDLE, + _mp_player_volume_widget_changed_cb, + wd); + edje_object_signal_callback_add(edj_obj, "drag,stop", + VOLUME_WIDGET_SLIDER_HANDLE, + _mp_player_volume_widget_drag_stop_cb, + wd); + + evas_object_event_callback_add(widget, EVAS_CALLBACK_MOUSE_DOWN, + _mp_player_volume_widget_mousedown_cb, + wd); + evas_object_event_callback_add(widget, EVAS_CALLBACK_MOUSE_UP, + _mp_player_volume_widget_mouseup_cb, + wd); + evas_object_event_callback_add(widget, EVAS_CALLBACK_FREE, + _mp_player_volume_widget_del_cb, wd); #ifdef MP_SOUND_PLAYER edje_object_signal_emit(edj_obj, "hide,sound,alive", "*"); @@ -263,7 +296,9 @@ mp_player_volume_widget_add(Evas_Object *parent) } void -mp_player_volume_widget_event_callback_add(Evas_Object *obj, Volume_Widget_Cb event_cb, void *user_data) +mp_player_volume_widget_event_callback_add(Evas_Object * obj, + Volume_Widget_Cb event_cb, + void *user_data) { MP_CHECK(obj); Volume_Widget_Data *wd = evas_object_data_get(obj, "widget_data"); @@ -273,8 +308,7 @@ mp_player_volume_widget_event_callback_add(Evas_Object *obj, Volume_Widget_Cb ev wd->user_data = user_data; } -int -mp_player_volume_widget_set_val(Evas_Object *obj, int val) +int mp_player_volume_widget_set_val(Evas_Object * obj, int val) { MP_CHECK_VAL(obj, 0); Volume_Widget_Data *wd = evas_object_data_get(obj, "widget_data"); @@ -286,10 +320,11 @@ mp_player_volume_widget_set_val(Evas_Object *obj, int val) if (val > wd->max) { val = wd->max; } - double ratio = (double)val / (double)wd->max; - edje_object_part_drag_value_set(_EDJ(wd->obj), VOLUME_WIDGET_SLIDER_HANDLE, 1.0, ratio); + double ratio = (double) val / (double) wd->max; + edje_object_part_drag_value_set(_EDJ(wd->obj), + VOLUME_WIDGET_SLIDER_HANDLE, 1.0, + ratio); _mp_player_volume_widget_set_indicator(wd, val); return val; } - diff --git a/src/widget/mp-playlist-list.c b/src/widget/mp-playlist-list.c index 696e45e..4f790db 100644 --- a/src/widget/mp-playlist-list.c +++ b/src/widget/mp-playlist-list.c @@ -35,11 +35,12 @@ #define ALBUM_GRID_LAND_H 320 static void _mp_playlist_list_update(void *thiz); -static void _mp_playlist_append_user_playlists(void *thiz, Elm_Object_Item *parent_item); -static void _mp_playlist_list_set_grid_style(MpPlaylistList_t *list); +static void _mp_playlist_append_user_playlists(void *thiz, + Elm_Object_Item * + parent_item); +static void _mp_playlist_list_set_grid_style(MpPlaylistList_t * list); -static int -_mp_playlist_list_get_track_type_by_playlist_id(int playlist_id) +static int _mp_playlist_list_get_track_type_by_playlist_id(int playlist_id) { int track_type; if (playlist_id == MP_SYS_PLST_MOST_PLAYED) { @@ -57,8 +58,8 @@ _mp_playlist_list_get_track_type_by_playlist_id(int playlist_id) return track_type; } -static char * -_mp_playlist_list_label_get(void *data, Evas_Object * obj, const char *part) +static char *_mp_playlist_list_label_get(void *data, Evas_Object * obj, + const char *part) { mp_list_item_data_t *item = (mp_list_item_data_t *) data; MP_CHECK_NULL(item); @@ -78,7 +79,7 @@ _mp_playlist_list_label_get(void *data, Evas_Object * obj, const char *part) int count = -1; int plst_id = -1; int total_time = 0; - char time[20] = {0,}; + char time[20] = { 0, }; char *format_text = NULL; // TODO: fix performance issue @@ -86,10 +87,14 @@ _mp_playlist_list_label_get(void *data, Evas_Object * obj, const char *part) mp_retvm_if((ret != 0), NULL, "Fail to get value"); char *text = NULL; - int track_type = _mp_playlist_list_get_track_type_by_playlist_id(plst_id); - ret = mp_media_info_list_count(track_type, NULL, NULL, NULL, plst_id, &count); - - total_time = mp_common_get_playlist_totaltime(track_type, plst_id, count); + int track_type = + _mp_playlist_list_get_track_type_by_playlist_id(plst_id); + ret = + mp_media_info_list_count(track_type, NULL, NULL, NULL, plst_id, + &count); + + total_time = + mp_common_get_playlist_totaltime(track_type, plst_id, count); mp_util_format_duration(time, total_time); if (count == 1) { @@ -120,14 +125,15 @@ static mp_group_type_e _mp_playlist_list_get_group_type(void *thiz) } static void -_mp_playlist_list_item_longpressed_cb(void *data, Evas_Object *obj, void *event_info) +_mp_playlist_list_item_longpressed_cb(void *data, Evas_Object * obj, + void *event_info) { startfunc; - MpPlaylistList_t *list = (MpPlaylistList_t *)data; + MpPlaylistList_t *list = (MpPlaylistList_t *) data; MP_CHECK(list); if (list->edit_mode) { - return ; + return; } struct appdata *ad = mp_util_get_appdata(); @@ -207,7 +213,9 @@ _mp_playlist_list_item_longpressed_cb(void *data, Evas_Object *obj, void *event_ } } - popup = mp_genlist_popup_create(obj, MP_POPUP_LIST_LONGPRESSED, &pop_item_count, ad); + popup = + mp_genlist_popup_create(obj, MP_POPUP_LIST_LONGPRESSED, + &pop_item_count, ad); MP_CHECK(popup); char *up_title = elm_entry_utf8_to_markup(title); @@ -216,13 +224,14 @@ _mp_playlist_list_item_longpressed_cb(void *data, Evas_Object *obj, void *event_ IF_FREE(up_title); mp_genlist_popup_item_append(popup, STR_MP_PLAY_ALL, NULL, NULL, NULL, - mp_common_playall_cb, list); + mp_common_playall_cb, list); if (pop_del_status) { - mp_genlist_popup_item_append(popup, STR_MP_DELETE, NULL, NULL, NULL, - mp_common_list_delete_cb, list); - mp_genlist_popup_item_append(popup, STR_MP_RENAME, NULL, NULL, NULL, - mp_common_playlist_rename_cb, list); + mp_genlist_popup_item_append(popup, STR_MP_DELETE, NULL, NULL, + NULL, mp_common_list_delete_cb, list); + mp_genlist_popup_item_append(popup, STR_MP_RENAME, NULL, NULL, + NULL, mp_common_playlist_rename_cb, + list); } @@ -235,7 +244,8 @@ _mp_playlist_list_item_longpressed_cb(void *data, Evas_Object *obj, void *event_ } void -mp_playlist_list_view_rename_done_cb(void *data, Evas_Object * obj, void *event_info) +mp_playlist_list_view_rename_done_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; char *text = NULL; @@ -258,14 +268,18 @@ mp_playlist_list_view_rename_done_cb(void *data, Evas_Object * obj, void *event_ MP_CHECK(ad); text = mp_util_isf_get_edited_str(editfiled_entry, TRUE); - if (!mp_util_is_playlist_name_valid((char *)text)) { - mp_widget_text_popup(ad, GET_STR("IDS_MUSIC_POP_UNABLE_RENAME_PLAYLIST")); + if (!mp_util_is_playlist_name_valid((char *) text)) { + mp_widget_text_popup(ad, + GET_STR + ("IDS_MUSIC_POP_UNABLE_RENAME_PLAYLIST")); } else { bool exist = false; ret = mp_media_info_playlist_is_exist(text, &exist); if (ret != 0) { ERROR_TRACE("Fail to get playlist count by name: %d", ret); - mp_widget_text_popup(ad, GET_STR("IDS_MUSIC_POP_UNABLE_CREATE_PLAYLIST")); + mp_widget_text_popup(ad, + GET_STR + ("IDS_MUSIC_POP_UNABLE_CREATE_PLAYLIST")); } else { char *origin_name = NULL; mp_media_info_group_get_main_info(plst, &origin_name); @@ -293,7 +307,8 @@ mp_playlist_list_view_rename_done_cb(void *data, Evas_Object * obj, void *event_ /* update content */ MpViewMgr_t *view_mgr = mp_view_mgr_get_view_manager(); MP_CHECK(view_mgr); - MpListView_t *view_to_update = (MpListView_t *)mp_view_mgr_get_top_view(view_mgr); + MpListView_t *view_to_update = + (MpListView_t *) mp_view_mgr_get_top_view(view_mgr); MP_CHECK(view_to_update); mp_list_update(view_to_update->content_to_show); mp_list_set_edit(view_to_update->content_to_show, TRUE); @@ -308,8 +323,7 @@ mp_playlist_list_view_rename_done_cb(void *data, Evas_Object * obj, void *event_ return; } -int -mp_playlist_list_set_playlist(mp_plst_mgr *plst_mgr, int playlist_id) +int mp_playlist_list_set_playlist(mp_plst_mgr * plst_mgr, int playlist_id) { MP_CHECK_VAL(plst_mgr, 0); mp_media_list_h svc_handle = NULL; @@ -318,11 +332,15 @@ mp_playlist_list_set_playlist(mp_plst_mgr *plst_mgr, int playlist_id) DEBUG_TRACE("playlist_id %d", playlist_id); - track_type = _mp_playlist_list_get_track_type_by_playlist_id(playlist_id); - mp_media_info_list_count(track_type, NULL, NULL, NULL, playlist_id, &count); + track_type = + _mp_playlist_list_get_track_type_by_playlist_id(playlist_id); + mp_media_info_list_count(track_type, NULL, NULL, NULL, playlist_id, + &count); /* get music item data */ - ret = mp_media_info_list_create(&svc_handle, track_type, NULL, NULL, NULL, playlist_id, 0, count); + ret = + mp_media_info_list_create(&svc_handle, track_type, NULL, NULL, + NULL, playlist_id, 0, count); if (ret != 0) { DEBUG_TRACE("fail to get list item: %d", ret); ret = mp_media_info_list_destroy(svc_handle); @@ -331,7 +349,8 @@ mp_playlist_list_set_playlist(mp_plst_mgr *plst_mgr, int playlist_id) if (count) { mp_playlist_mgr_clear(plst_mgr); - mp_util_append_media_list_item_to_playlist(plst_mgr, svc_handle, count, 0, NULL); + mp_util_append_media_list_item_to_playlist(plst_mgr, svc_handle, + count, 0, NULL); } if (svc_handle) { @@ -341,8 +360,8 @@ mp_playlist_list_set_playlist(mp_plst_mgr *plst_mgr, int playlist_id) return count; } -Evas_Object * -_mp_playlist_list_icon_get(void *data, Evas_Object * obj, const char *part) +Evas_Object *_mp_playlist_list_icon_get(void *data, Evas_Object * obj, + const char *part) { mp_list_item_data_t *item = (mp_list_item_data_t *) data; MP_CHECK_NULL(item); @@ -365,12 +384,17 @@ _mp_playlist_list_icon_get(void *data, Evas_Object * obj, const char *part) ret = mp_media_info_playlist_get_thumbnail_path(plst, &thumb_path); mp_retvm_if(ret != 0, NULL, "Fail to get value"); if (playlist_id >= 0) { - eo = mp_util_create_lazy_update_thumb_icon(obj, thumb_path, MP_LIST_ICON_SIZE, MP_LIST_ICON_SIZE); + eo = mp_util_create_lazy_update_thumb_icon(obj, thumb_path, + MP_LIST_ICON_SIZE, + MP_LIST_ICON_SIZE); } else { - eo = mp_util_create_thumb_icon(obj, thumb_path, MP_LIST_ICON_SIZE, MP_LIST_ICON_SIZE); + eo = mp_util_create_thumb_icon(obj, thumb_path, + MP_LIST_ICON_SIZE, + MP_LIST_ICON_SIZE); } - elm_layout_theme_set(content, "layout", "list/B/music.type.1", "default"); + elm_layout_theme_set(content, "layout", "list/B/music.type.1", + "default"); elm_layout_content_set(content, "elm.swallow.content", eo); return content; @@ -389,7 +413,9 @@ _mp_playlist_list_icon_get(void *data, Evas_Object * obj, const char *part) elm_object_style_set(check, "default"); } evas_object_propagate_events_set(check, EINA_FALSE); - evas_object_smart_callback_add(check, "changed", mp_common_view_check_changed_cb, NULL); + evas_object_smart_callback_add(check, "changed", + mp_common_view_check_changed_cb, + NULL); elm_check_state_pointer_set(check, &item->checked); return check; } @@ -397,24 +423,26 @@ _mp_playlist_list_icon_get(void *data, Evas_Object * obj, const char *part) return NULL; } -Evas_Object * -_mp_playlist_add_icon_get(void *data, Evas_Object * obj, const char *part) +Evas_Object *_mp_playlist_add_icon_get(void *data, Evas_Object * obj, + const char *part) { if (!strcmp(part, "elm.icon.1") || !strcmp(part, "elm.swallow.icon")) { Evas_Object *eo = NULL; Evas_Object *content = NULL; content = elm_layout_add(obj); - char image_path[1024] ={0}; - char * path = app_get_resource_path(); + char image_path[1024] = { 0 }; + char *path = app_get_resource_path(); MP_CHECK_NULL(path); - snprintf(image_path, 1024, "%s%s/%s", path, "images/music_player", PLAYLIST_CREATE_THUMBNAIL); + snprintf(image_path, 1024, "%s%s/%s", path, "images/music_player", + PLAYLIST_CREATE_THUMBNAIL); eo = mp_util_create_thumb_icon(obj, image_path, MP_LIST_ICON_SIZE, - MP_LIST_ICON_SIZE); + MP_LIST_ICON_SIZE); - elm_layout_theme_set(content, "layout", "list/B/music.type.1", "default"); + elm_layout_theme_set(content, "layout", "list/B/music.type.1", + "default"); elm_layout_content_set(content, "elm.swallow.content", eo); return content; @@ -423,8 +451,7 @@ _mp_playlist_add_icon_get(void *data, Evas_Object * obj, const char *part) return NULL; } -static void -_mp_playlist_list_item_del_cb(void *data, Evas_Object * obj) +static void _mp_playlist_list_item_del_cb(void *data, Evas_Object * obj) { startfunc; mp_list_item_data_t *item_data = data; @@ -454,7 +481,8 @@ static void _mp_playlist_list_set_edit(void *thiz, bool edit) mp_list_reorder_mode_set(list->genlist, EINA_TRUE); } - mp_list_select_mode_set(list->genlist, ELM_OBJECT_SELECT_MODE_ALWAYS); + mp_list_select_mode_set(list->genlist, + ELM_OBJECT_SELECT_MODE_ALWAYS); //mp_list_bottom_counter_item_append((MpList_t *)list); @@ -463,10 +491,11 @@ static void _mp_playlist_list_set_edit(void *thiz, bool edit) } static void -_mp_playlist_user_playlist_select_cb(void *data, Evas_Object * obj, void *event_info) +_mp_playlist_user_playlist_select_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; - MpPlaylistList_t *list = (MpPlaylistList_t *)data; + MpPlaylistList_t *list = (MpPlaylistList_t *) data; MP_CHECK(list); int ret = 0; @@ -495,22 +524,30 @@ _mp_playlist_user_playlist_select_cb(void *data, Evas_Object * obj, void *event_ if (list->function_type == MP_LIST_FUNC_ADD_TRACK) { MpViewMgr_t *view_manager = mp_view_mgr_get_view_manager(); MP_CHECK(view_manager); - MpSelectTrackView_t *view_select_track = mp_select_track_view_create(view_manager->navi); + MpSelectTrackView_t *view_select_track = + mp_select_track_view_create(view_manager->navi); MP_CHECK(view_select_track); - mp_view_mgr_push_view(view_manager, (MpView_t *)view_select_track, NULL); - - mp_view_update_options((MpView_t *)view_select_track); - mp_view_set_title((MpView_t *)view_select_track, STR_MP_TILTE_SELECT_ITEM); - mp_track_list_set_data((MpTrackList_t *)view_select_track->content_to_show, MP_TRACK_LIST_TYPE, MP_TRACK_BY_PLAYLIST, MP_TRACK_LIST_PLAYLIT_ID, p_id, -1); - mp_list_update((MpList_t *)view_select_track->content_to_show); - mp_list_set_edit((MpList_t *)view_select_track->content_to_show, TRUE); - mp_list_view_set_select_all((MpListView_t *)view_select_track, TRUE); + mp_view_mgr_push_view(view_manager, (MpView_t *) view_select_track, + NULL); + + mp_view_update_options((MpView_t *) view_select_track); + mp_view_set_title((MpView_t *) view_select_track, + STR_MP_TILTE_SELECT_ITEM); + mp_track_list_set_data((MpTrackList_t *) view_select_track-> + content_to_show, MP_TRACK_LIST_TYPE, + MP_TRACK_BY_PLAYLIST, + MP_TRACK_LIST_PLAYLIT_ID, p_id, -1); + mp_list_update((MpList_t *) view_select_track->content_to_show); + mp_list_set_edit((MpList_t *) view_select_track->content_to_show, + TRUE); + mp_list_view_set_select_all((MpListView_t *) view_select_track, + TRUE); return; } if (list->edit_mode) { //mp_edit_view_genlist_sel_cb(data, obj, event_info); - mp_list_edit_mode_sel((MpList_t *)list, item_data); + mp_list_edit_mode_sel((MpList_t *) list, item_data); MpViewMgr_t *view_mgr = mp_view_mgr_get_view_manager(); MpView_t *view = mp_view_mgr_get_top_view(view_mgr); @@ -522,20 +559,25 @@ _mp_playlist_user_playlist_select_cb(void *data, Evas_Object * obj, void *event_ MpViewMgr_t *view_manager = mp_view_mgr_get_view_manager(); MP_CHECK(view_manager); - MpPlaylistDetailView_t *view_plst_detail = mp_playlist_detail_view_create(view_manager->navi, MP_TRACK_BY_PLAYLIST, name, p_id); + MpPlaylistDetailView_t *view_plst_detail = + mp_playlist_detail_view_create(view_manager->navi, + MP_TRACK_BY_PLAYLIST, name, p_id); MP_CHECK(view_plst_detail); - mp_view_mgr_push_view(view_manager, (MpView_t *)view_plst_detail, NULL); + mp_view_mgr_push_view(view_manager, (MpView_t *) view_plst_detail, + NULL); - mp_view_update_options((MpView_t *)view_plst_detail); - mp_view_set_title((MpView_t *)view_plst_detail, name); + mp_view_update_options((MpView_t *) view_plst_detail); + mp_view_set_title((MpView_t *) view_plst_detail, name); } static void -_mp_playlist_create_auto_playlist(void *data, mp_list_item_data_t *item_data, char *name) +_mp_playlist_create_auto_playlist(void *data, + mp_list_item_data_t * item_data, + char *name) { MP_CHECK(item_data); - MpPlaylistList_t *list = (MpPlaylistList_t *)data; + MpPlaylistList_t *list = (MpPlaylistList_t *) data; MP_CHECK(list); mp_track_type_e type = MP_TRACK_ALL; @@ -556,49 +598,58 @@ _mp_playlist_create_auto_playlist(void *data, mp_list_item_data_t *item_data, ch if (list->function_type == MP_LIST_FUNC_ADD_TRACK) { MpViewMgr_t *view_manager = mp_view_mgr_get_view_manager(); MP_CHECK(view_manager); - MpSelectTrackView_t *view_select_track = mp_select_track_view_create(view_manager->navi); + MpSelectTrackView_t *view_select_track = + mp_select_track_view_create(view_manager->navi); MP_CHECK(view_select_track); - mp_view_mgr_push_view(view_manager, (MpView_t *)view_select_track, NULL); - - mp_view_update_options((MpView_t *)view_select_track); - mp_view_set_title((MpView_t *)view_select_track, STR_MP_TILTE_SELECT_ITEM); - mp_track_list_set_data((MpTrackList_t *)view_select_track->content_to_show, MP_TRACK_LIST_TYPE, type, -1); - mp_list_update((MpList_t *)view_select_track->content_to_show); - mp_list_set_edit((MpList_t *)view_select_track->content_to_show, TRUE); + mp_view_mgr_push_view(view_manager, (MpView_t *) view_select_track, + NULL); + + mp_view_update_options((MpView_t *) view_select_track); + mp_view_set_title((MpView_t *) view_select_track, + STR_MP_TILTE_SELECT_ITEM); + mp_track_list_set_data((MpTrackList_t *) view_select_track-> + content_to_show, MP_TRACK_LIST_TYPE, type, + -1); + mp_list_update((MpList_t *) view_select_track->content_to_show); + mp_list_set_edit((MpList_t *) view_select_track->content_to_show, + TRUE); return; } if (list->edit_mode) { //mp_edit_view_genlist_sel_cb(data, obj, event_info); - mp_list_edit_mode_sel((MpList_t *)list, item_data); + mp_list_edit_mode_sel((MpList_t *) list, item_data); MpViewMgr_t *view_mgr = mp_view_mgr_get_view_manager(); MP_CHECK(view_mgr); MpView_t *view = mp_view_mgr_get_top_view(view_mgr); MP_CHECK(view); ERROR_TRACE("update options of edit view"); - mp_view_update_options_edit((MpView_t *)view); + mp_view_update_options_edit((MpView_t *) view); ERROR_TRACE("set selected count"); return; } MpViewMgr_t *view_manager = mp_view_mgr_get_view_manager(); MP_CHECK(view_manager); - MpPlaylistDetailView_t *view_plst_detail = mp_playlist_detail_view_create(view_manager->navi, type, name, -1); + MpPlaylistDetailView_t *view_plst_detail = + mp_playlist_detail_view_create(view_manager->navi, type, name, -1); MP_CHECK(view_plst_detail); - mp_view_mgr_push_view(view_manager, (MpView_t *)view_plst_detail, NULL); + mp_view_mgr_push_view(view_manager, (MpView_t *) view_plst_detail, + NULL); - mp_view_update_options((MpView_t *)view_plst_detail); - mp_view_set_title((MpView_t *)view_plst_detail, name); + mp_view_update_options((MpView_t *) view_plst_detail); + mp_view_set_title((MpView_t *) view_plst_detail, name); } static void -_mp_playlist_auto_playlist_select_cb(void *data, Evas_Object * obj, void *event_info) +_mp_playlist_auto_playlist_select_cb(void *data, Evas_Object * obj, + void *event_info) { eventfunc; int ret = 0; char *name = NULL; mp_list_item_data_t *item_data = NULL; - MpPlaylistList_t *list = (MpPlaylistList_t *)data; + MpPlaylistList_t *list = (MpPlaylistList_t *) data; MP_CHECK(list); Elm_Object_Item *gli = (Elm_Object_Item *) event_info; @@ -621,12 +672,13 @@ _mp_playlist_auto_playlist_select_cb(void *data, Evas_Object * obj, void *event_ } static void -_mp_playlist_append_auto_playlists(void *thiz, Elm_Object_Item *parent_item) +_mp_playlist_append_auto_playlists(void *thiz, + Elm_Object_Item * parent_item) { int i; int playlist_state = 0; - MpPlaylistList_t *plst = (MpPlaylistList_t *)thiz; + MpPlaylistList_t *plst = (MpPlaylistList_t *) thiz; MP_CHECK(plst); if (plst->playlists_auto) { @@ -635,20 +687,22 @@ _mp_playlist_append_auto_playlists(void *thiz, Elm_Object_Item *parent_item) mp_setting_playlist_get_state(&playlist_state); - char* str = NULL; + char *str = NULL; ms_key_get_playlist_str(&str); int value = atoi(str); - int playlist[4] = {0}; + int playlist[4] = { 0 }; DEBUG_TRACE("value %d", value); int j = 0; - for (j = 3; j >= 0 ; j--) { + for (j = 3; j >= 0; j--) { playlist[j] = value % 10; value = value / 10; DEBUG_TRACE("index %d %d", j, playlist[j]); } - mp_media_info_group_list_create(&(plst->playlists_auto), MP_GROUP_BY_SYS_PLAYLIST, NULL, NULL, 0, 0); + mp_media_info_group_list_create(&(plst->playlists_auto), + MP_GROUP_BY_SYS_PLAYLIST, NULL, NULL, + 0, 0); for (i = 0; i < MP_SYS_PLST_COUNT; i++) { int enable = playlist_state & (1 << (playlist[i] - 1)); DEBUG_TRACE("index: %d, state: %d", i, enable); @@ -658,7 +712,9 @@ _mp_playlist_append_auto_playlists(void *thiz, Elm_Object_Item *parent_item) mp_media_info_h item; //item = mp_media_info_group_list_nth_item(plst->playlists_auto, i); - item = mp_media_info_group_list_nth_item(plst->playlists_auto, playlist[i] - 1); + item = + mp_media_info_group_list_nth_item(plst->playlists_auto, + playlist[i] - 1); mp_list_item_data_t *item_data; item_data = calloc(1, sizeof(mp_list_item_data_t)); @@ -668,30 +724,37 @@ _mp_playlist_append_auto_playlists(void *thiz, Elm_Object_Item *parent_item) plst->auto_playlist_count++; if (MP_LIST_OBJ_IS_GENGRID(plst->genlist)) { - item_data->it = elm_gengrid_item_append(plst->genlist, plst->gengrid_itc, item_data, - _mp_playlist_auto_playlist_select_cb, (void *)plst); + item_data->it = + elm_gengrid_item_append(plst->genlist, plst->gengrid_itc, + item_data, + _mp_playlist_auto_playlist_select_cb, + (void *) plst); } else { - item_data->it = elm_genlist_item_append(plst->genlist, plst->itc_auto, - item_data, parent_item, - ELM_GENLIST_ITEM_NONE, _mp_playlist_auto_playlist_select_cb, - plst); + item_data->it = + elm_genlist_item_append(plst->genlist, plst->itc_auto, + item_data, parent_item, + ELM_GENLIST_ITEM_NONE, + _mp_playlist_auto_playlist_select_cb, + plst); } elm_object_item_data_set(item_data->it, item_data); } } static void -_mp_playlist_append_user_playlists(void *thiz, Elm_Object_Item *parent_item) +_mp_playlist_append_user_playlists(void *thiz, + Elm_Object_Item * parent_item) { startfunc; gint count = -1; gint index = 0; int ret = 0; - MpPlaylistList_t *plst = (MpPlaylistList_t *)thiz; + MpPlaylistList_t *plst = (MpPlaylistList_t *) thiz; mp_retm_if(!plst, "plst is null"); - mp_media_info_group_list_count(MP_GROUP_BY_PLAYLIST, plst->type_str, plst->filter_str, &count); + mp_media_info_group_list_count(MP_GROUP_BY_PLAYLIST, plst->type_str, + plst->filter_str, &count); if (count < 0) { goto END; @@ -702,7 +765,11 @@ _mp_playlist_append_user_playlists(void *thiz, Elm_Object_Item *parent_item) plst->playlists_user = NULL; } - ret = mp_media_info_group_list_create(&plst->playlists_user, MP_GROUP_BY_PLAYLIST, plst->type_str, plst->filter_str, 0, count); + ret = + mp_media_info_group_list_create(&plst->playlists_user, + MP_GROUP_BY_PLAYLIST, + plst->type_str, plst->filter_str, + 0, count); if (ret != 0) { DEBUG_TRACE("Fail to get items"); goto END; @@ -712,9 +779,12 @@ _mp_playlist_append_user_playlists(void *thiz, Elm_Object_Item *parent_item) mp_media_info_h item = NULL; char *title = NULL; - item = mp_media_info_group_list_nth_item(plst->playlists_user, index); + item = + mp_media_info_group_list_nth_item(plst->playlists_user, index); if (!item) { - DEBUG_TRACE("Fail to mp_media_info_group_list_nth_item, ret[%d], index[%d]", ret, index); + DEBUG_TRACE + ("Fail to mp_media_info_group_list_nth_item, ret[%d], index[%d]", + ret, index); goto END; } mp_media_info_group_get_main_info(item, &title); @@ -726,42 +796,54 @@ _mp_playlist_append_user_playlists(void *thiz, Elm_Object_Item *parent_item) item_data->index = index; if (MP_LIST_OBJ_IS_GENGRID(plst->genlist)) { - item_data->it = elm_gengrid_item_append(plst->genlist, plst->gengrid_itc, item_data, - _mp_playlist_user_playlist_select_cb, (void *)plst); + item_data->it = + elm_gengrid_item_append(plst->genlist, plst->gengrid_itc, + item_data, + _mp_playlist_user_playlist_select_cb, + (void *) plst); } else { - item_data->it = elm_genlist_item_append(plst->genlist, plst->itc_auto, - item_data, parent_item, - ELM_GENLIST_ITEM_NONE, _mp_playlist_user_playlist_select_cb, - plst); + item_data->it = + elm_genlist_item_append(plst->genlist, plst->itc_auto, + item_data, parent_item, + ELM_GENLIST_ITEM_NONE, + _mp_playlist_user_playlist_select_cb, + plst); } elm_object_item_data_set(item_data->it, item_data); } -END: + END: endfunc; } -static Elm_Object_Item * -_mp_playlist_append_group_index(void *thiz, int index, Elm_Genlist_Item_Class *itc_group_index) +static Elm_Object_Item *_mp_playlist_append_group_index(void *thiz, + int index, + Elm_Genlist_Item_Class + *itc_group_index) { - MpPlaylistList_t *list = (MpPlaylistList_t *)thiz; + MpPlaylistList_t *list = (MpPlaylistList_t *) thiz; MP_CHECK_NULL(list); MP_CHECK_NULL(list->genlist); Elm_Object_Item *group_index = NULL; - mp_list_item_data_t *item_data = mp_list_item_data_create(MP_LIST_ITEM_TYPE_GROUP_TITLE); + mp_list_item_data_t *item_data = + mp_list_item_data_create(MP_LIST_ITEM_TYPE_GROUP_TITLE); MP_CHECK_NULL(item_data); item_data->index = index; - item_data->it = elm_genlist_item_append(list->genlist, itc_group_index, item_data, NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL); + item_data->it = + elm_genlist_item_append(list->genlist, itc_group_index, item_data, + NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL); group_index = item_data->it; - elm_genlist_item_select_mode_set(group_index, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + elm_genlist_item_select_mode_set(group_index, + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); list->group_index[index] = group_index; return group_index; } -static void _mp_playlist_list_load_list(void *thiz, int count_auto, int count_user) +static void _mp_playlist_list_load_list(void *thiz, int count_auto, + int count_user) { MpPlaylistList_t *list = thiz; MP_CHECK(list); @@ -774,15 +856,24 @@ static void _mp_playlist_list_load_list(void *thiz, int count_auto, int count_us Elm_Object_Item *group_index = NULL; if (count_auto) { - if (!list->edit_mode && !MP_LIST_OBJ_IS_GENGRID(list->genlist) && (ad->del_cb_invoked == 0)) { - group_index = _mp_playlist_append_group_index(list, MP_PLAYLIST_GROUP_INDEX_DEFAULT, list->itc_group_index_default); + if (!list->edit_mode && !MP_LIST_OBJ_IS_GENGRID(list->genlist) + && (ad->del_cb_invoked == 0)) { + group_index = + _mp_playlist_append_group_index(list, + MP_PLAYLIST_GROUP_INDEX_DEFAULT, + list-> + itc_group_index_default); } _mp_playlist_append_auto_playlists(list, group_index); group_index = NULL; } - if (!list->edit_mode && !MP_LIST_OBJ_IS_GENGRID(list->genlist) && (ad->del_cb_invoked == 0)) { - group_index = _mp_playlist_append_group_index(list, MP_PLAYLIST_GROUP_INDEX_NUM, list->itc_group_index_user); + if (!list->edit_mode && !MP_LIST_OBJ_IS_GENGRID(list->genlist) + && (ad->del_cb_invoked == 0)) { + group_index = + _mp_playlist_append_group_index(list, + MP_PLAYLIST_GROUP_INDEX_NUM, + list->itc_group_index_user); } if (count_user) { @@ -790,10 +881,10 @@ static void _mp_playlist_list_load_list(void *thiz, int count_auto, int count_us } /*if (!list->edit_mode) - _mp_playlist_append_add_playlist(list, group_index);*/ + _mp_playlist_append_add_playlist(list, group_index); */ /*if (count_user) - mp_list_bottom_counter_item_append((MpList_t *)list);*/ + mp_list_bottom_counter_item_append((MpList_t *)list); */ endfunc; } @@ -844,21 +935,22 @@ void _mp_playlist_list_destory_cb(void *thiz) free(list); } -static void -_mp_playlist_list_gengrid_create(MpPlaylistList_t *list) +static void _mp_playlist_list_gengrid_create(MpPlaylistList_t * list) { startfunc; MP_CHECK(list); - /*create new genlist*/ + /*create new genlist */ mp_evas_object_del(list->genlist); list->genlist = elm_gengrid_add(list->box); - evas_object_size_hint_weight_set(list->genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(list->genlist, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(list->genlist, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(list->genlist, EVAS_HINT_FILL, + EVAS_HINT_FILL); evas_object_show(list->genlist); MP_LIST_OBJ_SET_AS_GENGRID(list->genlist); - /*packet genlist to box*/ + /*packet genlist to box */ elm_box_pack_end(list->box, list->genlist); if (!list->gengrid_itc) { @@ -869,14 +961,19 @@ _mp_playlist_list_gengrid_create(MpPlaylistList_t *list) list->gengrid_itc->func.del = _mp_playlist_list_item_del_cb; } _mp_playlist_list_set_grid_style(list); - evas_object_smart_callback_add(list->genlist, "longpressed", _mp_playlist_list_item_longpressed_cb, list); + evas_object_smart_callback_add(list->genlist, "longpressed", + _mp_playlist_list_item_longpressed_cb, + list); elm_gengrid_align_set(list->genlist, 0.5, 0.0); endfunc; } -static char * -_mp_playlist_genlist_group_index_default_text_get(void *data, Evas_Object * obj, const char *part) +static char *_mp_playlist_genlist_group_index_default_text_get(void *data, + Evas_Object + *obj, + const char + *part) { mp_list_item_data_t *item_data = data; MP_CHECK_NULL(item_data); @@ -889,8 +986,11 @@ _mp_playlist_genlist_group_index_default_text_get(void *data, Evas_Object * obj, return g_strdup(GET_STR(text)); } -static char * -_mp_playlist_genlist_group_index_user_text_get(void *data, Evas_Object * obj, const char *part) +static char *_mp_playlist_genlist_group_index_user_text_get(void *data, + Evas_Object * + obj, + const char + *part) { mp_list_item_data_t *item_data = data; MP_CHECK_NULL(item_data); @@ -902,14 +1002,18 @@ _mp_playlist_genlist_group_index_user_text_get(void *data, Evas_Object * obj, co } else if (!strcmp(part, "elm.text.end")) { MpPlaylistList_t *list = evas_object_data_get(obj, "list_data"); MP_CHECK_NULL(list); - unsigned int count = mp_list_get_editable_count((MpList_t *)list, mp_list_get_edit_type((MpList_t *)list)); + unsigned int count = + mp_list_get_editable_count((MpList_t *) list, + mp_list_get_edit_type((MpList_t *) + list)); if (item_data->index != 0) { if (count <= 0) { text = g_strdup(GET_STR(STR_MP_NO_PLAYLISTS)); } else if (count == 1) { text = g_strdup(GET_STR(STR_MP_1_PLAYLIST)); } else { - text = g_strdup_printf(GET_STR(STR_MP_PD_PLAYLISTS), count); + text = + g_strdup_printf(GET_STR(STR_MP_PD_PLAYLISTS), count); } } } @@ -930,32 +1034,34 @@ _mp_playlist_genlist_group_index_del_cb(void *data, Evas_Object * obj) free(item_data); } -static void -_mp_playlist_list_genlist_create(MpPlaylistList_t *list) +static void _mp_playlist_list_genlist_create(MpPlaylistList_t * list) { MP_CHECK(list); - /*create new genlist*/ + /*create new genlist */ list->genlist = mp_widget_genlist_create(list->box); - elm_scroller_policy_set(list->genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); - evas_object_size_hint_weight_set(list->genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(list->genlist, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_scroller_policy_set(list->genlist, ELM_SCROLLER_POLICY_OFF, + ELM_SCROLLER_POLICY_AUTO); + evas_object_size_hint_weight_set(list->genlist, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(list->genlist, EVAS_HINT_FILL, + EVAS_HINT_FILL); elm_genlist_homogeneous_set(list->genlist, EINA_TRUE); elm_genlist_mode_set(list->genlist, ELM_LIST_COMPRESS); evas_object_show(list->genlist); - /*packet genlist to box*/ + /*packet genlist to box */ elm_box_pack_end(list->box, list->genlist); //evas_object_smart_callback_add(list->genlist, "longpressed", _mp_playlist_list_item_longpressed_cb, list); evas_object_data_set(list->genlist, "list_data", list); /* current not used - if (!list->itc_user) - list->itc_user = elm_genlist_item_class_new(); - list->itc_user->item_style = "music/musiclist/2text.1icon"; - list->itc_user->func.text_get = _mp_playlist_list_label_get; - list->itc_user->func.content_get = _mp_playlist_list_icon_get; - list->itc_user->func.del = _mp_playlist_list_item_del_cb; */ + if (!list->itc_user) + list->itc_user = elm_genlist_item_class_new(); + list->itc_user->item_style = "music/musiclist/2text.1icon"; + list->itc_user->func.text_get = _mp_playlist_list_label_get; + list->itc_user->func.content_get = _mp_playlist_list_icon_get; + list->itc_user->func.del = _mp_playlist_list_item_del_cb; */ if (!list->itc_auto) { list->itc_auto = elm_genlist_item_class_new(); @@ -970,16 +1076,20 @@ _mp_playlist_list_genlist_create(MpPlaylistList_t *list) list->itc_group_index_default = elm_genlist_item_class_new(); MP_CHECK(list->itc_group_index_default); list->itc_group_index_default->item_style = "group_index"; - list->itc_group_index_default->func.text_get = _mp_playlist_genlist_group_index_default_text_get; - list->itc_group_index_default->func.del = _mp_playlist_genlist_group_index_del_cb; + list->itc_group_index_default->func.text_get = + _mp_playlist_genlist_group_index_default_text_get; + list->itc_group_index_default->func.del = + _mp_playlist_genlist_group_index_del_cb; } if (!list->itc_group_index_user) { list->itc_group_index_user = elm_genlist_item_class_new(); MP_CHECK(list->itc_group_index_user); list->itc_group_index_user->item_style = "group_index"; - list->itc_group_index_user->func.text_get = _mp_playlist_genlist_group_index_user_text_get; - list->itc_group_index_user->func.del = _mp_playlist_genlist_group_index_del_cb; + list->itc_group_index_user->func.text_get = + _mp_playlist_genlist_group_index_user_text_get; + list->itc_group_index_user->func.del = + _mp_playlist_genlist_group_index_del_cb; } endfunc; @@ -996,7 +1106,9 @@ static void _mp_playlist_list_update(void *thiz) MpPlaylistList_t *list = thiz; MP_CHECK(list); - res = mp_media_info_group_list_count(MP_GROUP_BY_PLAYLIST, NULL, list->filter_str, &count_user); + res = + mp_media_info_group_list_count(MP_GROUP_BY_PLAYLIST, NULL, + list->filter_str, &count_user); MP_CHECK(res == 0); if (!list->edit_mode) { @@ -1025,16 +1137,16 @@ static void _mp_playlist_list_update(void *thiz) //} /* - else - { - DEBUG_TRACE("count is 0"); - if (!list->no_content) - { - list->no_content = mp_widget_create_no_contents(list->box, MP_NOCONTENT_PLAYLIST, NULL, NULL); - elm_box_pack_end(list->box, list->no_content); - } - } - */ + else + { + DEBUG_TRACE("count is 0"); + if (!list->no_content) + { + list->no_content = mp_widget_create_no_contents(list->box, MP_NOCONTENT_PLAYLIST, NULL, NULL); + elm_box_pack_end(list->box, list->no_content); + } + } + */ } @@ -1044,7 +1156,11 @@ _mp_playlist_list_get_count(void *thiz, MpListEditType_e type) MpPlaylistList_t *list = thiz; MP_CHECK_VAL(list->genlist, 0); - int count = MP_LIST_OBJ_IS_GENGRID(list->genlist) ? elm_gengrid_items_count(list->genlist) : elm_genlist_items_count(list->genlist); + int count = + MP_LIST_OBJ_IS_GENGRID(list-> + genlist) ? elm_gengrid_items_count(list-> + genlist) + : elm_genlist_items_count(list->genlist); int group_index_count = 0; int i = 0; @@ -1059,7 +1175,7 @@ _mp_playlist_list_get_count(void *thiz, MpListEditType_e type) count = count - list->auto_playlist_count - group_index_count; if (!list->edit_mode) { - --count; /// create playlist item + --count; /// create playlist item } if (list->bottom_counter_item) { @@ -1069,48 +1185,53 @@ _mp_playlist_list_get_count(void *thiz, MpListEditType_e type) return count; } -static void -_mp_playlist_list_set_grid_style(MpPlaylistList_t *list) +static void _mp_playlist_list_set_grid_style(MpPlaylistList_t * list) { bool landscape = mp_util_is_landscape(); MP_CHECK(list->gengrid_itc); if (landscape) { - list->gengrid_add_itc->item_style = list->gengrid_itc->item_style = "music/landscape/album_grid"; + list->gengrid_add_itc->item_style = list->gengrid_itc->item_style = + "music/landscape/album_grid"; } else { - list->gengrid_add_itc->item_style = list->gengrid_itc->item_style = "music/album_grid2"; + list->gengrid_add_itc->item_style = list->gengrid_itc->item_style = + "music/album_grid2"; } double scale = elm_config_scale_get(); int w; int h; if (landscape) { - w = (int)(ALBUM_GRID_LAND_W * scale); - h = (int)(ALBUM_GRID_LAND_H * scale); + w = (int) (ALBUM_GRID_LAND_W * scale); + h = (int) (ALBUM_GRID_LAND_H * scale); } else { - w = (int)(ALBUM_GRID_W * scale); - h = (int)(ALBUM_GRID_H * scale); + w = (int) (ALBUM_GRID_W * scale); + h = (int) (ALBUM_GRID_H * scale); } elm_gengrid_item_size_set(list->genlist, w, h); } void _mp_playlist_list_rotate(void *thiz) { - MpPlaylistList_t * list = thiz; - if (mp_list_get_display_mode((MpList_t *)list) == MP_LIST_DISPLAY_MODE_THUMBNAIL) { + MpPlaylistList_t *list = thiz; + if (mp_list_get_display_mode((MpList_t *) list) == + MP_LIST_DISPLAY_MODE_THUMBNAIL) { _mp_playlist_list_set_grid_style(list); } } -static char * _mp_playlist_list_bottom_counter_text_get_cb(void *thiz) +static char *_mp_playlist_list_bottom_counter_text_get_cb(void *thiz) { - MpPlaylistList_t * list = thiz; + MpPlaylistList_t *list = thiz; MP_CHECK_NULL(list); char *text = NULL; - unsigned int count = mp_list_get_editable_count((MpList_t *)list, mp_list_get_edit_type((MpList_t *)list)); + unsigned int count = + mp_list_get_editable_count((MpList_t *) list, + mp_list_get_edit_type((MpList_t *) + list)); if (count == 1) { text = g_strdup(GET_STR(STR_MP_1_PLAYLIST)); } else { @@ -1119,7 +1240,7 @@ static char * _mp_playlist_list_bottom_counter_text_get_cb(void *thiz) return text; } -MpPlaylistList_t * mp_playlist_list_create(Evas_Object *parent) +MpPlaylistList_t *mp_playlist_list_create(Evas_Object * parent) { eventfunc; MP_CHECK_NULL(parent); @@ -1127,7 +1248,7 @@ MpPlaylistList_t * mp_playlist_list_create(Evas_Object *parent) MpPlaylistList_t *list = calloc(1, sizeof(MpPlaylistList_t)); MP_CHECK_NULL(list); - mp_list_init((MpList_t *)list, parent, MP_LIST_TYPE_PLAYLIST); + mp_list_init((MpList_t *) list, parent, MP_LIST_TYPE_PLAYLIST); list->get_count = _mp_playlist_list_get_count; list->update = _mp_playlist_list_update; @@ -1139,13 +1260,14 @@ MpPlaylistList_t * mp_playlist_list_create(Evas_Object *parent) list->display_mode_changable = true; - list->bottom_counter_text_get_cb = _mp_playlist_list_bottom_counter_text_get_cb; + list->bottom_counter_text_get_cb = + _mp_playlist_list_bottom_counter_text_get_cb; list->update(list); return list; } -void mp_playlist_list_set_data(MpPlaylistList_t *list, ...) +void mp_playlist_list_set_data(MpPlaylistList_t * list, ...) { startfunc; MP_CHECK(list); @@ -1163,45 +1285,46 @@ void mp_playlist_list_set_data(MpPlaylistList_t *list, ...) } switch (field) { - case MP_PLAYLIST_LIST_TYPE: { - int val = va_arg((var_args), int); + case MP_PLAYLIST_LIST_TYPE:{ + int val = va_arg((var_args), int); - list->group_type = val; - DEBUG_TRACE("list->group_type = %d", list->group_type); - break; - } + list->group_type = val; + DEBUG_TRACE("list->group_type = %d", list->group_type); + break; + } - case MP_PLAYLIST_LIST_FUNC: { - int val = va_arg((var_args), int); + case MP_PLAYLIST_LIST_FUNC:{ + int val = va_arg((var_args), int); - list->function_type = val; - DEBUG_TRACE("list->function_type = %d", list->function_type); - break; - } + list->function_type = val; + DEBUG_TRACE("list->function_type = %d", + list->function_type); + break; + } - case MP_PLAYLIST_LIST_TYPE_STR: { - char *val = va_arg((var_args), char *); - SAFE_FREE(list->type_str); - list->type_str = g_strdup(val); - DEBUG_TRACE("list->type_str = %s", list->type_str); + case MP_PLAYLIST_LIST_TYPE_STR:{ + char *val = va_arg((var_args), char *); + SAFE_FREE(list->type_str); + list->type_str = g_strdup(val); + DEBUG_TRACE("list->type_str = %s", list->type_str); - break; - } - case MP_PLAYLIST_LIST_FILTER_STR: { - char *val = va_arg((var_args), char *); - SAFE_FREE(list->filter_str); - list->filter_str = g_strdup(val); - DEBUG_TRACE("list->filter_str = %s", list->filter_str); + break; + } + case MP_PLAYLIST_LIST_FILTER_STR:{ + char *val = va_arg((var_args), char *); + SAFE_FREE(list->filter_str); + list->filter_str = g_strdup(val); + DEBUG_TRACE("list->filter_str = %s", list->filter_str); - break; - } - case MP_PLAYLIST_LIST_DISPLAY_MODE: { - int val = va_arg((var_args), int); - list->display_mode = val; - DEBUG_TRACE("list->display_mode = %d", list->display_mode); + break; + } + case MP_PLAYLIST_LIST_DISPLAY_MODE:{ + int val = va_arg((var_args), int); + list->display_mode = val; + DEBUG_TRACE("list->display_mode = %d", list->display_mode); - break; - } + break; + } default: DEBUG_TRACE("Invalid arguments"); @@ -1212,7 +1335,8 @@ void mp_playlist_list_set_data(MpPlaylistList_t *list, ...) va_end(var_args); } -void mp_playlist_list_copy_data(MpPlaylistList_t *src, MpPlaylistList_t *dest) +void mp_playlist_list_copy_data(MpPlaylistList_t * src, + MpPlaylistList_t * dest) { MP_CHECK(src); MP_CHECK(dest); diff --git a/src/widget/mp-popup.c b/src/widget/mp-popup.c index f6f60fc..19da330 100644 --- a/src/widget/mp-popup.c +++ b/src/widget/mp-popup.c @@ -49,11 +49,11 @@ typedef struct _AllShareListItem { } AllShareListItem; typedef struct { - void* drm_info; - void* wifidirect_info; + void *drm_info; + void *wifidirect_info; Ecore_Timer *timer; - GList *pItemList; - Evas_Object * parent; + GList *pItemList; + Evas_Object *parent; bool bStopScan; Elm_Object_Item *pLoadingItem; } Allshare_Data; @@ -65,20 +65,24 @@ typedef struct { #define MP_POPUP_ALLSHARE_MYDEVICE_ID -1 #define MP_POPUP_ALLSHARE_LOAD_ID -2 -static void __mp_popup_timeout_cb(void *data, Evas_Object *obj, void *event_info); -static void __mp_popup_block_cb(void *data, Evas_Object *obj, void *event_info); +static void __mp_popup_timeout_cb(void *data, Evas_Object * obj, + void *event_info); +static void __mp_popup_block_cb(void *data, Evas_Object * obj, + void *event_info); -static char * -_mp_popup_gl_label_get2(void *data, Evas_Object * obj, const char *part) +static char *_mp_popup_gl_label_get2(void *data, Evas_Object * obj, + const char *part) { if (!strcmp(part, "elm.text")) { MP_CHECK_NULL(data); - Popup_genlist_item *gli_data = (Popup_genlist_item *)data; + Popup_genlist_item *gli_data = (Popup_genlist_item *) data; DEBUG_TRACE("gli_data->lable is %s", gli_data->label); DEBUG_TRACE("gli_data->content is %s", gli_data->content); char *label = NULL; if (gli_data->content != NULL) { - label = g_strconcat(GET_STR(gli_data->label), " : ", gli_data->content, NULL); + label = + g_strconcat(GET_STR(gli_data->label), " : ", + gli_data->content, NULL); } else { label = g_strdup(elm_entry_utf8_to_markup(gli_data->label)); } @@ -88,8 +92,8 @@ _mp_popup_gl_label_get2(void *data, Evas_Object * obj, const char *part) return NULL; } -static char * -_mp_popup_gl_label_get(void *data, Evas_Object * obj, const char *part) +static char *_mp_popup_gl_label_get(void *data, Evas_Object * obj, + const char *part) { if (!strcmp(part, "elm.text.main.left")) { return g_strdup(data); @@ -97,21 +101,20 @@ _mp_popup_gl_label_get(void *data, Evas_Object * obj, const char *part) return NULL; } -static void -_mp_popup_gl_del(void *data, Evas_Object * obj) +static void _mp_popup_gl_del(void *data, Evas_Object * obj) { - Popup_genlist_item *gli_data = (Popup_genlist_item *)data; + Popup_genlist_item *gli_data = (Popup_genlist_item *) data; MP_CHECK(gli_data); IF_FREE(gli_data->label); IF_FREE(gli_data->content); IF_FREE(gli_data); } -static Evas_Object * -_mp_popup_gl_icon_get(void *data, Evas_Object * obj, const char *part) +static Evas_Object *_mp_popup_gl_icon_get(void *data, Evas_Object * obj, + const char *part) { MP_CHECK_NULL(data); - Popup_genlist_item *gli_data = (Popup_genlist_item *)data; + Popup_genlist_item *gli_data = (Popup_genlist_item *) data; struct appdata *ad = evas_object_data_get(obj, "ad"); MP_CHECK_NULL(ad); @@ -122,17 +125,20 @@ _mp_popup_gl_icon_get(void *data, Evas_Object * obj, const char *part) Evas_Object *radio = elm_radio_add(layout); elm_layout_theme_set(layout, "layout", "list/C/type.2", "default"); int index = 0; - index = (int)gli_data->item_data; - DEBUG_TRACE("index=%d,radio_group=%p,snd_path=%d", index, ad->radio_group, ad->snd_path); + index = (int) gli_data->item_data; + DEBUG_TRACE("index=%d,radio_group=%p,snd_path=%d", index, + ad->radio_group, ad->snd_path); elm_radio_state_value_set(radio, index); elm_radio_group_add(radio, ad->radio_group); if (index == ad->snd_path) { elm_radio_value_set(ad->radio_group, index); } - evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(radio, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_data_set(radio, "idx", (void *)(index)); + evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(radio, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_data_set(radio, "idx", (void *) (index)); elm_object_part_content_set(layout, "elm.swallow.content", radio); evas_object_show(radio); evas_object_show(layout); @@ -143,20 +149,21 @@ _mp_popup_gl_icon_get(void *data, Evas_Object * obj, const char *part) return NULL; } -static void -mp_popup_set_min_size(Evas_Object *box, int cnt) +static void mp_popup_set_min_size(Evas_Object * box, int cnt) { int min_h = 0; MP_CHECK(box); if (mp_util_is_landscape()) { - if (MP_POPUP_GENLIST_ITEM_H*cnt > MP_POPUP_GENLIST_ITEM_H_MAX_LD || cnt == 0) { + if (MP_POPUP_GENLIST_ITEM_H * cnt > MP_POPUP_GENLIST_ITEM_H_MAX_LD + || cnt == 0) { min_h = MP_POPUP_GENLIST_ITEM_H_MAX_LD; } else { min_h = MP_POPUP_GENLIST_ITEM_H * cnt; } } else { - if (MP_POPUP_GENLIST_ITEM_H*cnt > MP_POPUP_GENLIST_ITEM_H_MAX || cnt == 0) { + if (MP_POPUP_GENLIST_ITEM_H * cnt > MP_POPUP_GENLIST_ITEM_H_MAX + || cnt == 0) { min_h = MP_POPUP_GENLIST_ITEM_H_MAX; } else { min_h = MP_POPUP_GENLIST_ITEM_H * cnt; @@ -164,24 +171,26 @@ mp_popup_set_min_size(Evas_Object *box, int cnt) } ERROR_TRACE("wishjox cnt: %d, min_h: %d", cnt, min_h); - evas_object_size_hint_min_set(box, - -1, min_h); + evas_object_size_hint_min_set(box, -1, min_h); } static void -_mp_popup_cancel_button_cb(void *data, Evas_Object *obj, void *event_info) +_mp_popup_cancel_button_cb(void *data, Evas_Object * obj, void *event_info) { evas_object_del(obj); } -static void _mp_popup_genlist_gl_lang_changed(void *data, Evas_Object *obj, void *event_info) +static void _mp_popup_genlist_gl_lang_changed(void *data, + Evas_Object * obj, + void *event_info) { startfunc; elm_genlist_realized_items_update(obj); } -static void _mp_popup_gl_realized(void *data, Evas_Object *obj, void *event_info) +static void _mp_popup_gl_realized(void *data, Evas_Object * obj, + void *event_info) { startfunc; if (!event_info || !obj) { @@ -195,25 +204,30 @@ static void _mp_popup_gl_realized(void *data, Evas_Object *obj, void *event_info MP_CHECK(last_item); if (current_item == last_item) { - elm_object_item_signal_emit(last_item, "elm,state,bottomline,hide", ""); //send this signal + elm_object_item_signal_emit(last_item, "elm,state,bottomline,hide", ""); //send this signal } } -Evas_Object * -elm_popup_win_get(Evas_Object *popup) + +Evas_Object *elm_popup_win_get(Evas_Object * popup) { return evas_object_top_get(evas_object_evas_get(popup)); } -static Evas_Object * -_mp_popup_create_min_style_popup(Evas_Object * parent, char *title, int cnt, - void *user_data, Evas_Smart_Cb cb, struct appdata *ad) +static Evas_Object *_mp_popup_create_min_style_popup(Evas_Object * parent, + char *title, int cnt, + void *user_data, + Evas_Smart_Cb cb, + struct appdata *ad) { Evas_Object *genlist = NULL; Evas_Object *box = NULL; - Evas_Object *popup = mp_popup_create(parent, MP_POPUP_GENLIST, title, user_data, cb, ad); + Evas_Object *popup = + mp_popup_create(parent, MP_POPUP_GENLIST, title, user_data, cb, + ad); MP_CHECK_NULL(popup); - evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); //layout = elm_layout_add(popup); //elm_layout_theme_set(layout, "layout", "content", "min_menustyle"); @@ -221,16 +235,22 @@ _mp_popup_create_min_style_popup(Evas_Object * parent, char *title, int cnt, box = elm_box_add(popup); MP_CHECK_NULL(box); - evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); genlist = elm_genlist_add(box); MP_CHECK_NULL(genlist); //elm_object_style_set(genlist, "popup"); - evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL); - - evas_object_smart_callback_add(genlist, "language,changed", _mp_popup_genlist_gl_lang_changed, NULL); - evas_object_smart_callback_add(genlist, "realized", _mp_popup_gl_realized, NULL); + evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, + EVAS_HINT_FILL); + + evas_object_smart_callback_add(genlist, "language,changed", + _mp_popup_genlist_gl_lang_changed, + NULL); + evas_object_smart_callback_add(genlist, "realized", + _mp_popup_gl_realized, NULL); evas_object_data_set(popup, "genlist", genlist); elm_box_pack_end(box, genlist); @@ -243,8 +263,9 @@ _mp_popup_create_min_style_popup(Evas_Object * parent, char *title, int cnt, return popup; } -static Evas_Object * -_mp_popup_list_share_create(Evas_Object * parent, void *user_data, struct appdata *ad) +static Evas_Object *_mp_popup_list_share_create(Evas_Object * parent, + void *user_data, + struct appdata *ad) { DEBUG_TRACE(""); MP_CHECK_NULL(ad); @@ -252,7 +273,12 @@ _mp_popup_list_share_create(Evas_Object * parent, void *user_data, struct appdat Evas_Object *genlist; int option_count = 3; - popup = _mp_popup_create_min_style_popup(parent, GET_SYS_STR("IDS_COM_BUTTON_SHARE"), option_count, NULL, _mp_popup_cancel_button_cb, ad); + popup = + _mp_popup_create_min_style_popup(parent, + GET_SYS_STR + ("IDS_COM_BUTTON_SHARE"), + option_count, NULL, + _mp_popup_cancel_button_cb, ad); MP_CHECK_NULL(popup); itc.item_style = "1text"; @@ -265,18 +291,25 @@ _mp_popup_list_share_create(Evas_Object * parent, void *user_data, struct appdat MP_CHECK_NULL(genlist); elm_genlist_item_append(genlist, &itc, BLUETOOTH_SYS, NULL, - ELM_GENLIST_ITEM_NONE, mp_menu_genlist_popup_list_share_select_cb, user_data); + ELM_GENLIST_ITEM_NONE, + mp_menu_genlist_popup_list_share_select_cb, + user_data); elm_genlist_item_append(genlist, &itc, EMAIL_SYS, NULL, - ELM_GENLIST_ITEM_NONE, mp_menu_genlist_popup_list_share_select_cb, user_data); + ELM_GENLIST_ITEM_NONE, + mp_menu_genlist_popup_list_share_select_cb, + user_data); #ifndef MP_FEATURE_DISABLE_MMS elm_genlist_item_append(genlist, &itc, MESSAGE_SYS, NULL, - ELM_GENLIST_ITEM_NONE, mp_menu_genlist_popup_list_share_select_cb, user_data); + ELM_GENLIST_ITEM_NONE, + mp_menu_genlist_popup_list_share_select_cb, + user_data); #endif return popup; } -static Evas_Object * -_mp_popup_sound_path_create(Evas_Object * parent, void *data, struct appdata *ad) +static Evas_Object *_mp_popup_sound_path_create(Evas_Object * parent, + void *data, + struct appdata *ad) { //Replaced for _prod dependency start DEBUG_TRACE_FUNC(); @@ -289,7 +322,9 @@ _mp_popup_sound_path_create(Evas_Object * parent, void *data, struct appdata *ad sound_device_mask_e g_device_mask = SOUND_DEVICE_IO_DIRECTION_OUT_MASK; WARN_TRACE("Enter sound_manager_get_active_device"); int ret; - if ((ret = sound_manager_get_current_device_list(g_device_mask, &g_device_list))) { + if ((ret = + sound_manager_get_current_device_list(g_device_mask, + &g_device_list))) { ERROR_TRACE("sound_manager_get_active_device()... [0x%x]", ret); } @@ -310,15 +345,21 @@ _mp_popup_sound_path_create(Evas_Object * parent, void *data, struct appdata *ad } } - popup = _mp_popup_create_min_style_popup(parent, GET_SYS_STR("IDS_COM_HEADER_AUDIO_DEVICE_ABB"), cnt, NULL, _mp_popup_cancel_button_cb, ad); + popup = + _mp_popup_create_min_style_popup(parent, + GET_SYS_STR + ("IDS_COM_HEADER_AUDIO_DEVICE_ABB"), + cnt, NULL, + _mp_popup_cancel_button_cb, ad); MP_CHECK_NULL(popup); return popup; //Replaced for _prod dependency end } -static Evas_Object * -_mp_popup_tracklist_more_info(Evas_Object * parent, void *data, struct appdata *ad) +static Evas_Object *_mp_popup_tracklist_more_info(Evas_Object * parent, + void *data, + struct appdata *ad) { DEBUG_TRACE_FUNC(); @@ -326,7 +367,10 @@ _mp_popup_tracklist_more_info(Evas_Object * parent, void *data, struct appdata * Evas_Object *popup = NULL; int count = 5; - popup = _mp_popup_create_min_style_popup(parent, STR_MP_POPUP_MORE_INFO, count, NULL, _mp_popup_cancel_button_cb, ad); + popup = + _mp_popup_create_min_style_popup(parent, STR_MP_POPUP_MORE_INFO, + count, NULL, + _mp_popup_cancel_button_cb, ad); MP_CHECK_NULL(popup); mp_popup_button_set(popup, MP_POPUP_BTN_1, STR_MP_OK, MP_POPUP_YES); @@ -334,8 +378,11 @@ _mp_popup_tracklist_more_info(Evas_Object * parent, void *data, struct appdata * } -static Evas_Object * -_mp_popup_tracklist_longpressed_create(Evas_Object * parent, void *data, struct appdata *ad) +static Evas_Object *_mp_popup_tracklist_longpressed_create(Evas_Object * + parent, + void *data, + struct appdata + *ad) { DEBUG_TRACE_FUNC(); @@ -344,29 +391,41 @@ _mp_popup_tracklist_longpressed_create(Evas_Object * parent, void *data, struct //int count = *(int *)data; int count = 0; - popup = _mp_popup_create_min_style_popup(parent, GET_STR("IDS_MUSIC_BODY_ADD_TO_PLAYLIST"), count, NULL, _mp_popup_cancel_button_cb, ad); + popup = + _mp_popup_create_min_style_popup(parent, + GET_STR + ("IDS_MUSIC_BODY_ADD_TO_PLAYLIST"), + count, NULL, + _mp_popup_cancel_button_cb, ad); MP_CHECK_NULL(popup); return popup; } -static Evas_Object * -_mp_popup_setting_playlist_create(Evas_Object * parent, void *data, struct appdata *ad) + +static Evas_Object *_mp_popup_setting_playlist_create(Evas_Object * parent, + void *data, + struct appdata *ad) { DEBUG_TRACE_FUNC(); MP_CHECK_NULL(ad); Evas_Object *popup = NULL; int count = 4; - popup = _mp_popup_create_min_style_popup(parent, GET_STR(STR_MP_PLAYLISTS), count, NULL, _mp_popup_cancel_button_cb, ad); + popup = + _mp_popup_create_min_style_popup(parent, GET_STR(STR_MP_PLAYLISTS), + count, NULL, + _mp_popup_cancel_button_cb, ad); MP_CHECK_NULL(popup); - mp_popup_button_set(popup, MP_POPUP_BTN_1, "IDS_COM_POP_CANCEL", MP_POPUP_NO); + mp_popup_button_set(popup, MP_POPUP_BTN_1, "IDS_COM_POP_CANCEL", + MP_POPUP_NO); mp_popup_button_set(popup, MP_POPUP_BTN_2, "Done", MP_POPUP_YES); return popup; } static void -_mp_popup_button_clicked_cb(void *data, Evas_Object *obj, void *event_info) +_mp_popup_button_clicked_cb(void *data, Evas_Object * obj, + void *event_info) { startfunc; Evas_Object *popup = data; @@ -377,7 +436,8 @@ _mp_popup_button_clicked_cb(void *data, Evas_Object *obj, void *event_info) } bool -mp_popup_button_set_add_to_palylist(Evas_Object *popup, const char *text, int response) +mp_popup_button_set_add_to_palylist(Evas_Object * popup, const char *text, + int response) { MP_CHECK_FALSE(popup); MP_CHECK_FALSE(text); @@ -387,7 +447,8 @@ mp_popup_button_set_add_to_palylist(Evas_Object *popup, const char *text, int re elm_object_style_set(button, "popup"); mp_util_domain_translatable_text_set(button, text); - evas_object_smart_callback_add(button, "clicked", _mp_popup_button_clicked_cb, popup); + evas_object_smart_callback_add(button, "clicked", + _mp_popup_button_clicked_cb, popup); if (button) { elm_object_part_content_set(popup, "button2", button); mp_evas_object_response_set(button, response); @@ -402,92 +463,122 @@ mp_popup_button_set_add_to_palylist(Evas_Object *popup, const char *text, int re return ret; } -static Evas_Object * -_mp_popup_add_to_playlist_create(Evas_Object * parent, void *data, struct appdata *ad) +static Evas_Object *_mp_popup_add_to_playlist_create(Evas_Object * parent, + void *data, + struct appdata *ad) { DEBUG_TRACE_FUNC(); MP_CHECK_NULL(ad); Evas_Object *popup = NULL; int count = 0; - mp_media_info_group_list_count(MP_GROUP_BY_PLAYLIST, NULL, NULL, &count); + mp_media_info_group_list_count(MP_GROUP_BY_PLAYLIST, NULL, NULL, + &count); if (count <= 0) { DEBUG_TRACE("temp playlist"); count = 1; } DEBUG_TRACE("count,%d", count); - popup = _mp_popup_create_min_style_popup(parent, GET_STR(STR_MP_ADD_TO_PLAYLIST), count, NULL, _mp_popup_cancel_button_cb, ad); + popup = + _mp_popup_create_min_style_popup(parent, + GET_STR(STR_MP_ADD_TO_PLAYLIST), + count, NULL, + _mp_popup_cancel_button_cb, ad); MP_CHECK_NULL(popup); mp_popup_button_set(popup, MP_POPUP_BTN_1, STR_MP_CANCEL, MP_POPUP_NO); - mp_popup_button_set_add_to_palylist(popup, STR_MP_CREATE, MP_POPUP_YES); + mp_popup_button_set_add_to_palylist(popup, STR_MP_CREATE, + MP_POPUP_YES); return popup; } -static Evas_Object * -_mp_popup_delete_track_create(Evas_Object * parent, void *data, struct appdata *ad) +static Evas_Object *_mp_popup_delete_track_create(Evas_Object * parent, + void *data, + struct appdata *ad) { DEBUG_TRACE_FUNC(); MP_CHECK_NULL(ad); Evas_Object *popup = NULL; int count = -1; - popup = _mp_popup_create_min_style_popup(parent, GET_STR(STR_MP_ONE_TRACK_DETELED), count, NULL, _mp_popup_cancel_button_cb, ad); + popup = + _mp_popup_create_min_style_popup(parent, + GET_STR(STR_MP_ONE_TRACK_DETELED), + count, NULL, + _mp_popup_cancel_button_cb, ad); MP_CHECK_NULL(popup); mp_popup_button_set(popup, MP_POPUP_BTN_1, STR_MP_CANCEL, MP_POPUP_NO); - mp_popup_button_set(popup, MP_POPUP_BTN_2, STR_MP_DELETE, MP_POPUP_YES); + mp_popup_button_set(popup, MP_POPUP_BTN_2, STR_MP_DELETE, + MP_POPUP_YES); return popup; } -static Evas_Object * -_mp_popup_info_list_create(Evas_Object * parent, void *data, struct appdata *ad) +static Evas_Object *_mp_popup_info_list_create(Evas_Object * parent, + void *data, + struct appdata *ad) { DEBUG_TRACE_FUNC(); MP_CHECK_NULL(ad); Evas_Object *popup = NULL; - int count = *(int *)data; + int count = *(int *) data; - popup = _mp_popup_create_min_style_popup(parent, GET_SYS_STR("IDS_COM_SK_SELECT"), count, NULL, _mp_popup_cancel_button_cb, ad); + popup = + _mp_popup_create_min_style_popup(parent, + GET_SYS_STR("IDS_COM_SK_SELECT"), + count, NULL, + _mp_popup_cancel_button_cb, ad); MP_CHECK_NULL(popup); return popup; } -static Evas_Object * -_mp_popup_edit_image_create(Evas_Object * parent, void *data, struct appdata *ad) +static Evas_Object *_mp_popup_edit_image_create(Evas_Object * parent, + void *data, + struct appdata *ad) { DEBUG_TRACE_FUNC(); MP_CHECK_NULL(ad); Evas_Object *popup = NULL; - popup = _mp_popup_create_min_style_popup(parent, GET_STR(STR_MP_EDIT_IMAGE), 2, NULL, _mp_popup_cancel_button_cb, ad); + popup = + _mp_popup_create_min_style_popup(parent, + GET_STR(STR_MP_EDIT_IMAGE), 2, + NULL, _mp_popup_cancel_button_cb, + ad); MP_CHECK_NULL(popup); return popup; } -static Evas_Object * -_mp_popup_search_create(Evas_Object * parent, void *data, struct appdata *ad) +static Evas_Object *_mp_popup_search_create(Evas_Object * parent, + void *data, struct appdata *ad) { DEBUG_TRACE_FUNC(); MP_CHECK_NULL(ad); Evas_Object *popup = NULL; - popup = _mp_popup_create_min_style_popup(parent, GET_STR(STR_MP_SEARCH_BY), 2, NULL, _mp_popup_cancel_button_cb, ad); + popup = + _mp_popup_create_min_style_popup(parent, GET_STR(STR_MP_SEARCH_BY), + 2, NULL, + _mp_popup_cancel_button_cb, ad); MP_CHECK_NULL(popup); return popup; } -static Evas_Object * -_mp_popup_change_list_display_mode(Evas_Object * parent, void *data, struct appdata *ad) +static Evas_Object *_mp_popup_change_list_display_mode(Evas_Object * + parent, void *data, + struct appdata *ad) { DEBUG_TRACE_FUNC(); MP_CHECK_NULL(ad); Evas_Object *popup = NULL; - popup = _mp_popup_create_min_style_popup(parent, GET_STR(STR_MP_VIEW_AS), 2, NULL, _mp_popup_cancel_button_cb, ad); + popup = + _mp_popup_create_min_style_popup(parent, GET_STR(STR_MP_VIEW_AS), + 2, NULL, + _mp_popup_cancel_button_cb, ad); MP_CHECK_NULL(popup); return popup; @@ -497,8 +588,8 @@ static void _mp_popup_del_cb(void *data, Evas * e, Evas_Object * eo, void *event_info) { DEBUG_TRACE(""); - struct appdata *ad = (struct appdata *)data; - int type = (int)evas_object_data_get(eo, "type"); + struct appdata *ad = (struct appdata *) data; + int type = (int) evas_object_data_get(eo, "type"); DEBUG_TRACE("type: %d", type); if (type >= MP_POPUP_MAX) { ERROR_TRACE("Never should be here!!!"); @@ -507,8 +598,7 @@ _mp_popup_del_cb(void *data, Evas * e, Evas_Object * eo, void *event_info) ad->popup[type] = NULL; } -static bool -_mp_popup_popup_exist(struct appdata *ad, mp_popup_t type) +static bool _mp_popup_popup_exist(struct appdata *ad, mp_popup_t type) { MP_CHECK_FALSE(ad); if (ad->popup[type]) { @@ -517,8 +607,11 @@ _mp_popup_popup_exist(struct appdata *ad, mp_popup_t type) return FALSE; } -Elm_Object_Item * -mp_genlist_popup_item_append(Evas_Object * popup, char *label, char *content, Evas_Object * icon, void *item_data, void *cb, void *data) +Elm_Object_Item *mp_genlist_popup_item_append(Evas_Object * popup, + char *label, char *content, + Evas_Object * icon, + void *item_data, void *cb, + void *data) { MP_CHECK_NULL(popup); MP_CHECK_NULL(label); @@ -535,21 +628,23 @@ mp_genlist_popup_item_append(Evas_Object * popup, char *label, char *content, Ev Elm_Object_Item *item = NULL; if (!icon) { - itc.item_style = "type1";//"default"; + itc.item_style = "type1"; //"default"; itc.func.text_get = _mp_popup_gl_label_get2; itc.func.content_get = NULL; itc.func.state_get = NULL; itc.func.del = _mp_popup_gl_del; } else { //itc.item_style = "1text.1icon.3"; - itc.item_style = "type1";//"default"; + itc.item_style = "type1"; //"default"; itc.func.text_get = _mp_popup_gl_label_get2; itc.func.content_get = _mp_popup_gl_icon_get; itc.func.state_get = NULL; itc.func.del = _mp_popup_gl_del; } - item = elm_genlist_item_append(genlist, &itc, gli_data, NULL, ELM_GENLIST_ITEM_NONE, cb, data); + item = + elm_genlist_item_append(genlist, &itc, gli_data, NULL, + ELM_GENLIST_ITEM_NONE, cb, data); Evas_Object *box = elm_object_part_content_get(popup, NULL); if (box) { @@ -560,8 +655,8 @@ mp_genlist_popup_item_append(Evas_Object * popup, char *label, char *content, Ev return item; } -Evas_Object * -mp_genlist_popup_create(Evas_Object * parent, mp_popup_t type, void *user_data, struct appdata * ad) +Evas_Object *mp_genlist_popup_create(Evas_Object * parent, mp_popup_t type, + void *user_data, struct appdata * ad) { mp_retvm_if(parent == NULL, NULL, "parent is NULL"); ad = mp_util_get_appdata(); @@ -585,11 +680,12 @@ mp_genlist_popup_create(Evas_Object * parent, mp_popup_t type, void *user_data, popup = _mp_popup_setting_playlist_create(parent, user_data, ad); break; case MP_POPUP_LIST_LONGPRESSED: - popup = _mp_popup_tracklist_longpressed_create(parent, user_data, ad); + popup = + _mp_popup_tracklist_longpressed_create(parent, user_data, ad); break; case MP_POPUP_SOUND_PATH: popup = _mp_popup_sound_path_create(parent, user_data, ad); - evas_object_data_set(popup, "sound_path", (char *)1); + evas_object_data_set(popup, "sound_path", (char *) 1); break; case MP_POPUP_CHANGE_LIST_DISPLAY_MODE: popup = _mp_popup_change_list_display_mode(parent, user_data, ad); @@ -615,16 +711,16 @@ mp_genlist_popup_create(Evas_Object * parent, mp_popup_t type, void *user_data, } if (popup) { - evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, _mp_popup_del_cb, ad); - evas_object_data_set(popup, "type", (void *)MP_POPUP_GENLIST); + evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, + _mp_popup_del_cb, ad); + evas_object_data_set(popup, "type", (void *) MP_POPUP_GENLIST); ad->popup[MP_POPUP_GENLIST] = popup; } return popup; } -static void -_mp_popup_genlist_popup_del_idler(void *data) +static void _mp_popup_genlist_popup_del_idler(void *data) { Evas_Object *genlist_popup = data; MP_CHECK(genlist_popup); @@ -633,16 +729,14 @@ _mp_popup_genlist_popup_del_idler(void *data) /*This is only for music pasue case*/ -static void -_mp_popup_genlist_pause_del_idler(void *data) +static void _mp_popup_genlist_pause_del_idler(void *data) { Evas_Object *genlist_popup = data; MP_CHECK(genlist_popup); mp_popup_response(genlist_popup, MP_POPUP_NO); } -EXPORT_API void -mp_popup_destroy(struct appdata *ad) +EXPORT_API void mp_popup_destroy(struct appdata *ad) { MP_CHECK(ad); int i = 0; @@ -654,7 +748,8 @@ mp_popup_destroy(struct appdata *ad) if (i == MP_POPUP_GENLIST) { /* do NOT destroy genlist in genlst select callback function */ evas_object_hide(ad->popup[i]); - ecore_job_add(_mp_popup_genlist_popup_del_idler, ad->popup[i]); + ecore_job_add(_mp_popup_genlist_popup_del_idler, + ad->popup[i]); } else { mp_evas_object_del(ad->popup[i]); } @@ -663,43 +758,44 @@ mp_popup_destroy(struct appdata *ad) } } -EXPORT_API void -mp_longpress_popup_destroy(struct appdata *ad) +EXPORT_API void mp_longpress_popup_destroy(struct appdata *ad) { MP_CHECK(ad); if (ad->popup[MP_POPUP_GENLIST]) { /* do NOT destroy genlist in genlst select callback function */ evas_object_hide(ad->popup[MP_POPUP_GENLIST]); - ecore_job_add(_mp_popup_genlist_pause_del_idler, ad->popup[MP_POPUP_GENLIST]); + ecore_job_add(_mp_popup_genlist_pause_del_idler, + ad->popup[MP_POPUP_GENLIST]); ad->popup[MP_POPUP_GENLIST] = NULL; } } -static void _mouseup_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +static void _mouseup_cb(void *data, Evas * e, Evas_Object * obj, + void *event_info) { EVENT_TRACE(""); Evas_Event_Mouse_Up *ev = event_info; - if (ev->button == 3) { // if mouse right button is up - mp_popup_response(data, MP_POPUP_NO); // you can call evas_object_del(obj); to remove popup if you want + if (ev->button == 3) { // if mouse right button is up + mp_popup_response(data, MP_POPUP_NO); // you can call evas_object_del(obj); to remove popup if you want } } -void -mp_popup_back_cb(void *data, Evas_Object *obj, void *event_info) + +void mp_popup_back_cb(void *data, Evas_Object * obj, void *event_info) { mp_popup_response(obj, MP_POPUP_NO); } static void -_mp_popup_cancel_cb(void *data, Evas_Object *obj, void *event_info) +_mp_popup_cancel_cb(void *data, Evas_Object * obj, void *event_info) { - Evas_Object *popup = (Evas_Object*)data; + Evas_Object *popup = (Evas_Object *) data; mp_popup_response(popup, MP_POPUP_NO); } -static void _mp_popup_rotate_cb(void *data, Evas_Object *obj, void *ei) +static void _mp_popup_rotate_cb(void *data, Evas_Object * obj, void *ei) { eventfunc; @@ -707,7 +803,7 @@ static void _mp_popup_rotate_cb(void *data, Evas_Object *obj, void *ei) Evas_Object *genlist = NULL; int cnt = 0; int min_h = 0; - Evas_Object *popup = (Evas_Object*)data; + Evas_Object *popup = (Evas_Object *) data; MP_CHECK(popup); box = elm_object_content_get(popup); genlist = evas_object_data_get(popup, "genlist"); @@ -718,14 +814,14 @@ static void _mp_popup_rotate_cb(void *data, Evas_Object *obj, void *ei) int angle = elm_win_rotation_get(ad->win_main); DEBUG_TRACE("angle = %d", angle); if (angle == 90 || angle == 270) { - /*4 items here the landscape logic is reversed*/ + /*4 items here the landscape logic is reversed */ if (cnt > 4) { min_h = MP_POPUP_GENLIST_ITEM_H_MAX_LD; } else { min_h = MP_POPUP_GENLIST_ITEM_H * cnt + cnt - 1; } } else { - /*6 items*/ + /*6 items */ if (cnt > 6) { min_h = MP_POPUP_GENLIST_ITEM_H_MAX; } else { @@ -734,19 +830,23 @@ static void _mp_popup_rotate_cb(void *data, Evas_Object *obj, void *ei) } evas_object_size_hint_min_set(box, - MP_POPUP_GENLIST_ITEM_W * elm_config_scale_get(), min_h * elm_config_scale_get()); - evas_object_size_hint_max_set(box, - 0, min_h * elm_config_scale_get()); + MP_POPUP_GENLIST_ITEM_W * + elm_config_scale_get(), + min_h * elm_config_scale_get()); + evas_object_size_hint_max_set(box, 0, min_h * elm_config_scale_get()); - return ; + return; } static void -_mp_popup_destroy_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +_mp_popup_destroy_cb(void *data, Evas * e, Evas_Object * obj, + void *event_info) { - Evas_Object *top_widget = (Evas_Object *)evas_object_data_get(obj, "top_widget"); + Evas_Object *top_widget = + (Evas_Object *) evas_object_data_get(obj, "top_widget"); if (top_widget) { - evas_object_smart_callback_del(top_widget, "rotation,changed", _mp_popup_rotate_cb); + evas_object_smart_callback_del(top_widget, "rotation,changed", + _mp_popup_rotate_cb); } Popup_Data *popup_data = data; @@ -760,9 +860,10 @@ _mp_popup_destroy_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) } -Evas_Object * -mp_popup_message_create(Evas_Object * parent, mp_popup_type type, char *title, char *message, void *user_data, Evas_Smart_Cb response_cb, - void *ad) +Evas_Object *mp_popup_message_create(Evas_Object * parent, + mp_popup_type type, char *title, + char *message, void *user_data, + Evas_Smart_Cb response_cb, void *ad) { Evas_Object *popup = NULL; Evas_Object *progressbar = NULL; @@ -773,7 +874,6 @@ mp_popup_message_create(Evas_Object * parent, mp_popup_type type, char *title, c DEBUG_TRACE("popup already exist..."); return NULL; } - #ifndef MP_FEATURE_MULTIWINDOW popup = elm_popup_add(p_ad->win_main); #else @@ -784,42 +884,53 @@ mp_popup_message_create(Evas_Object * parent, mp_popup_type type, char *title, c Evas_Object *top_widget = elm_object_top_widget_get(popup); if (top_widget) { - evas_object_smart_callback_add(top_widget, "rotation,changed", _mp_popup_rotate_cb, popup); - evas_object_data_set(popup, "top_widget", (void *)top_widget); + evas_object_smart_callback_add(top_widget, "rotation,changed", + _mp_popup_rotate_cb, popup); + evas_object_data_set(popup, "top_widget", (void *) top_widget); } - evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); - Popup_Data *popup_data = (Popup_Data *)calloc(1, sizeof(Popup_Data)); + Popup_Data *popup_data = (Popup_Data *) calloc(1, sizeof(Popup_Data)); mp_assert(popup_data); mp_popup_set_popup_data(popup, popup_data); - evas_object_event_callback_add(popup, EVAS_CALLBACK_MOUSE_UP, _mouseup_cb, popup); + evas_object_event_callback_add(popup, EVAS_CALLBACK_MOUSE_UP, + _mouseup_cb, popup); popup_data->ad = p_ad; popup_data->type = type; mp_popup_response_callback_set(popup, response_cb, user_data); - evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, _mp_popup_destroy_cb, popup_data); - eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, mp_popup_back_cb, popup_data); + evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, + _mp_popup_destroy_cb, popup_data); + eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, + mp_popup_back_cb, popup_data); switch (type) { case MP_POPUP_PROGRESS: - evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); Evas_Object *layout = NULL; layout = elm_layout_add(popup); - char edje_path[1024] ={0}; - char * path = app_get_resource_path(); + char edje_path[1024] = { 0 }; + char *path = app_get_resource_path(); MP_CHECK_NULL(path); - snprintf(edje_path, 1024, "%s%s/%s", path, "edje", PLAY_VIEW_EDJ_NAME); + snprintf(edje_path, 1024, "%s%s/%s", path, "edje", + PLAY_VIEW_EDJ_NAME); - elm_layout_file_set(layout, edje_path, "popup_processingview_string"); + elm_layout_file_set(layout, edje_path, + "popup_processingview_string"); free(path); - evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - progressbar = mp_widget_loading_icon_add(popup, MP_LOADING_ICON_SIZE_SMALL); - elm_object_part_content_set(layout, "elm.swallow.content", progressbar); + evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + progressbar = + mp_widget_loading_icon_add(popup, MP_LOADING_ICON_SIZE_SMALL); + elm_object_part_content_set(layout, "elm.swallow.content", + progressbar); elm_object_part_text_set(layout, "elm.text", GET_SYS_STR(message)); elm_object_content_set(popup, layout); break; @@ -829,7 +940,8 @@ mp_popup_message_create(Evas_Object * parent, mp_popup_type type, char *title, c } if (title) { - mp_util_domain_translatable_part_text_set(popup, "title,text", title); + mp_util_domain_translatable_part_text_set(popup, "title,text", + title); } p_ad->popup[type] = popup; @@ -837,9 +949,9 @@ mp_popup_message_create(Evas_Object * parent, mp_popup_type type, char *title, c } -Evas_Object * -mp_popup_create(Evas_Object * parent, mp_popup_type type, char *title, void *user_data, Evas_Smart_Cb response_cb, - void *ad) +Evas_Object *mp_popup_create(Evas_Object * parent, mp_popup_type type, + char *title, void *user_data, + Evas_Smart_Cb response_cb, void *ad) { Evas_Object *popup = NULL; Evas_Object *progressbar = NULL; @@ -850,7 +962,6 @@ mp_popup_create(Evas_Object * parent, mp_popup_type type, char *title, void *use DEBUG_TRACE("popup already exist..."); return NULL; } - #ifndef MP_FEATURE_MULTIWINDOW popup = elm_popup_add(p_ad->win_main); #else @@ -862,145 +973,179 @@ mp_popup_create(Evas_Object * parent, mp_popup_type type, char *title, void *use Evas_Object *top_widget = elm_object_top_widget_get(popup); if (top_widget) { - evas_object_smart_callback_add(top_widget, "rotation,changed", _mp_popup_rotate_cb, popup); - evas_object_data_set(popup, "top_widget", (void *)top_widget); + evas_object_smart_callback_add(top_widget, "rotation,changed", + _mp_popup_rotate_cb, popup); + evas_object_data_set(popup, "top_widget", (void *) top_widget); } - evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); - Popup_Data *popup_data = (Popup_Data *)calloc(1, sizeof(Popup_Data)); + Popup_Data *popup_data = (Popup_Data *) calloc(1, sizeof(Popup_Data)); mp_assert(popup_data); mp_popup_set_popup_data(popup, popup_data); - evas_object_event_callback_add(popup, EVAS_CALLBACK_MOUSE_UP, _mouseup_cb, popup); + evas_object_event_callback_add(popup, EVAS_CALLBACK_MOUSE_UP, + _mouseup_cb, popup); //evas_object_event_callback_add(popup, EVAS_CALLBACK_KEY_DOWN, _keydown_cb, popup); popup_data->ad = p_ad; popup_data->type = type; mp_popup_response_callback_set(popup, response_cb, user_data); - evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, _mp_popup_destroy_cb, popup_data); - eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, mp_popup_back_cb, popup_data); + evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, + _mp_popup_destroy_cb, popup_data); + eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, + mp_popup_back_cb, popup_data); switch (type) { case MP_POPUP_NORMAL: DEBUG_TRACE("MP_POPUP_NORMAL"); - evas_object_smart_callback_add(popup, "block,clicked", __mp_popup_block_cb, (void *)MP_POPUP_NO); + evas_object_smart_callback_add(popup, "block,clicked", + __mp_popup_block_cb, + (void *) MP_POPUP_NO); break; case MP_POPUP_GENLIST: DEBUG_TRACE("MP_POPUP_GENLIST"); //elm_object_style_set(popup, "min_menustyle"); //to destory popup if outside of popup clicked. - evas_object_smart_callback_add(popup, "block,clicked", __mp_popup_block_cb, (void *)MP_POPUP_NO); + evas_object_smart_callback_add(popup, "block,clicked", + __mp_popup_block_cb, + (void *) MP_POPUP_NO); break; case MP_POPUP_PROGRESS: - evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); Evas_Object *layout = NULL; layout = elm_layout_add(popup); - char edje_path[1024] ={0}; - char * path = app_get_resource_path(); + char edje_path[1024] = { 0 }; + char *path = app_get_resource_path(); MP_CHECK_NULL(path); - snprintf(edje_path, 1024, "%s%s/%s", path, "edje", PLAY_VIEW_EDJ_NAME); + snprintf(edje_path, 1024, "%s%s/%s", path, "edje", + PLAY_VIEW_EDJ_NAME); - elm_layout_file_set(layout, edje_path, "popup_processingview_string"); + elm_layout_file_set(layout, edje_path, + "popup_processingview_string"); free(path); - evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - progressbar = mp_widget_loading_icon_add(popup, MP_LOADING_ICON_SIZE_SMALL); - elm_object_part_content_set(layout, "elm.swallow.content", progressbar); - elm_object_part_text_set(layout, "elm.text", GET_SYS_STR(MP_POPUP_LOADING)); + evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + progressbar = + mp_widget_loading_icon_add(popup, MP_LOADING_ICON_SIZE_SMALL); + elm_object_part_content_set(layout, "elm.swallow.content", + progressbar); + elm_object_part_text_set(layout, "elm.text", + GET_SYS_STR(MP_POPUP_LOADING)); elm_object_content_set(popup, layout); break; - case MP_POPUP_PROGRESS_WITH_CANCEL: { - Evas_Object *layout; - Evas_Object *btn1; + case MP_POPUP_PROGRESS_WITH_CANCEL:{ + Evas_Object *layout; + Evas_Object *btn1; - layout = elm_layout_add(popup); - char edje_path[1024] ={0}; - char * path = app_get_resource_path(); + layout = elm_layout_add(popup); + char edje_path[1024] = { 0 }; + char *path = app_get_resource_path(); - MP_CHECK_NULL(path); - snprintf(edje_path, 1024,"%s%s/%s",path, "edje", PLAY_VIEW_EDJ_NAME); + MP_CHECK_NULL(path); + snprintf(edje_path, 1024, "%s%s/%s", path, "edje", + PLAY_VIEW_EDJ_NAME); - elm_layout_file_set(layout, edje_path, "popup_processingview_1button"); - free(path); + elm_layout_file_set(layout, edje_path, + "popup_processingview_1button"); + free(path); - progressbar = mp_widget_loading_icon_add(popup, MP_LOADING_ICON_SIZE_LARGE); + progressbar = + mp_widget_loading_icon_add(popup, + MP_LOADING_ICON_SIZE_LARGE); - elm_object_part_content_set(layout, "elm.swallow.content", progressbar); - elm_object_part_text_set(layout, "elm.text", title); + elm_object_part_content_set(layout, "elm.swallow.content", + progressbar); + elm_object_part_text_set(layout, "elm.text", title); - elm_object_content_set(popup, layout); - btn1 = elm_button_add(popup); - elm_object_style_set(btn1, "popup"); - elm_object_text_set(btn1, GET_SYS_STR(STR_MP_CANCEL)); - elm_object_part_content_set(popup, "button1", btn1); - evas_object_smart_callback_add(btn1, "clicked", _mp_popup_cancel_cb, popup); - p_ad->popup[type] = popup; - - return popup; - } - break; - case MP_POPUP_PROGRESS_WITHOUT_CANCEL: { - Evas_Object *layout; - - layout = elm_layout_add(popup); - char edje_path[1024] ={0}; - char * path = app_get_resource_path(); - - MP_CHECK_NULL(path); - snprintf(edje_path, 1024, "%s%s/%s", path, "edje", PLAY_VIEW_EDJ_NAME); - - elm_layout_file_set(layout, edje_path, "popup_processingview_1button"); - free(path); - progressbar = mp_widget_loading_icon_add(popup, MP_LOADING_ICON_SIZE_LARGE); - elm_object_part_content_set(layout, "elm.swallow.content", progressbar); - elm_object_part_text_set(layout, "elm.text", title); - elm_object_content_set(popup, layout); - p_ad->popup[type] = popup; - return popup; - } - break; - case MP_POPUP_OPERATION_PROGRESS: { - Evas_Object *layout; - Evas_Object *btn1; - - layout = elm_layout_add(popup); - char edje_path[1024] ={0}; - char * path = app_get_resource_path(); - - MP_CHECK_NULL(path); - snprintf(edje_path, 1024,"%s%s/%s",path, "edje", MP_EDJ_NAME); - - elm_layout_file_set(layout, edje_path, "popup_center_progressview"); - free(path); + elm_object_content_set(popup, layout); + btn1 = elm_button_add(popup); + elm_object_style_set(btn1, "popup"); + elm_object_text_set(btn1, GET_SYS_STR(STR_MP_CANCEL)); + elm_object_part_content_set(popup, "button1", btn1); + evas_object_smart_callback_add(btn1, "clicked", + _mp_popup_cancel_cb, popup); + p_ad->popup[type] = popup; - progressbar = elm_progressbar_add(popup); - elm_object_style_set(progressbar, "list_progress"); - elm_progressbar_horizontal_set(progressbar, EINA_TRUE); - evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_progressbar_value_set(progressbar, 0.0); - - elm_object_part_content_set(layout, "elm.swallow.content", progressbar); - elm_object_part_text_set(layout, "elm.text", title); - - elm_object_content_set(popup, layout); - btn1 = elm_button_add(popup); - elm_object_style_set(btn1, "popup"); - elm_object_text_set(btn1, GET_SYS_STR(STR_MP_CANCEL)); - elm_object_part_content_set(popup, "button1", btn1); - evas_object_smart_callback_add(btn1, "clicked", _mp_popup_cancel_cb, popup); - p_ad->popup[type] = popup; - } - break; + return popup; + } + break; + case MP_POPUP_PROGRESS_WITHOUT_CANCEL:{ + Evas_Object *layout; + + layout = elm_layout_add(popup); + char edje_path[1024] = { 0 }; + char *path = app_get_resource_path(); + + MP_CHECK_NULL(path); + snprintf(edje_path, 1024, "%s%s/%s", path, "edje", + PLAY_VIEW_EDJ_NAME); + + elm_layout_file_set(layout, edje_path, + "popup_processingview_1button"); + free(path); + progressbar = + mp_widget_loading_icon_add(popup, + MP_LOADING_ICON_SIZE_LARGE); + elm_object_part_content_set(layout, "elm.swallow.content", + progressbar); + elm_object_part_text_set(layout, "elm.text", title); + elm_object_content_set(popup, layout); + p_ad->popup[type] = popup; + return popup; + } + break; + case MP_POPUP_OPERATION_PROGRESS:{ + Evas_Object *layout; + Evas_Object *btn1; + + layout = elm_layout_add(popup); + char edje_path[1024] = { 0 }; + char *path = app_get_resource_path(); + + MP_CHECK_NULL(path); + snprintf(edje_path, 1024, "%s%s/%s", path, "edje", + MP_EDJ_NAME); + + elm_layout_file_set(layout, edje_path, + "popup_center_progressview"); + free(path); + + progressbar = elm_progressbar_add(popup); + elm_object_style_set(progressbar, "list_progress"); + elm_progressbar_horizontal_set(progressbar, EINA_TRUE); + evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + elm_progressbar_value_set(progressbar, 0.0); + + elm_object_part_content_set(layout, "elm.swallow.content", + progressbar); + elm_object_part_text_set(layout, "elm.text", title); + + elm_object_content_set(popup, layout); + btn1 = elm_button_add(popup); + elm_object_style_set(btn1, "popup"); + elm_object_text_set(btn1, GET_SYS_STR(STR_MP_CANCEL)); + elm_object_part_content_set(popup, "button1", btn1); + evas_object_smart_callback_add(btn1, "clicked", + _mp_popup_cancel_cb, popup); + p_ad->popup[type] = popup; + } + break; case MP_POPUP_PROGRESS_NO_BUTTON: - progressbar = mp_widget_loading_icon_add(popup, MP_LOADING_ICON_SIZE_LARGE); + progressbar = + mp_widget_loading_icon_add(popup, MP_LOADING_ICON_SIZE_LARGE); elm_object_content_set(popup, progressbar); break; @@ -1012,44 +1157,54 @@ mp_popup_create(Evas_Object * parent, mp_popup_type type, char *title, void *use elm_object_style_set(popup, "content_expand"); break; #ifdef MP_FEATURE_PERSONAL_PAGE - case MP_POPUP_CHECK_INFO_PERSONAL: { - Evas_Object *layout; - Evas_Object *label; - - layout = elm_layout_add(popup); - char edje_path[1024] ={0}; - char * path = app_get_resource_path(); - - MP_CHECK_NULL(path); - snprintf(edje_path, 1024, "%s%s/%s", path, "edje", MP_EDJ_NAME); - - int ret = elm_layout_file_set(layout, edje_path, "popup_checkview_personal"); - free(path); - if (!ret) { - ERROR_TRACE("Set layout style failed"); + case MP_POPUP_CHECK_INFO_PERSONAL:{ + Evas_Object *layout; + Evas_Object *label; + + layout = elm_layout_add(popup); + char edje_path[1024] = { 0 }; + char *path = app_get_resource_path(); + + MP_CHECK_NULL(path); + snprintf(edje_path, 1024, "%s%s/%s", path, "edje", + MP_EDJ_NAME); + + int ret = + elm_layout_file_set(layout, edje_path, + "popup_checkview_personal"); + free(path); + if (!ret) { + ERROR_TRACE("Set layout style failed"); + } + evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + + label = elm_label_add(popup); + elm_label_line_wrap_set(label, ELM_WRAP_MIXED); + evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(label, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_show(label); + + Evas_Object *checkbox = elm_check_add(popup); + elm_object_style_set(checkbox, "multiline"); + elm_check_state_set(checkbox, FALSE); + mp_util_domain_translatable_text_set(checkbox, + MP_PERSONAL_DONT_ASK_AGAIN); + evas_object_size_hint_align_set(checkbox, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_size_hint_weight_set(checkbox, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_show(checkbox); + + elm_object_part_content_set(layout, "elm.swallow.content", + label); + elm_object_part_content_set(layout, "elm.swallow.end", + checkbox); + + elm_object_content_set(popup, layout); } - evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - - label = elm_label_add(popup); - elm_label_line_wrap_set(label, ELM_WRAP_MIXED); - evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0); - evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_show(label); - - Evas_Object *checkbox = elm_check_add(popup); - elm_object_style_set(checkbox, "multiline"); - elm_check_state_set(checkbox, FALSE); - mp_util_domain_translatable_text_set(checkbox, MP_PERSONAL_DONT_ASK_AGAIN); - evas_object_size_hint_align_set(checkbox, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(checkbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_show(checkbox); - - elm_object_part_content_set(layout, "elm.swallow.content", label); - elm_object_part_content_set(layout, "elm.swallow.end", checkbox); - - elm_object_content_set(popup, layout); - } - break; + break; #endif default: DEBUG_TRACE("Unsupported type: %d", type); @@ -1057,7 +1212,8 @@ mp_popup_create(Evas_Object * parent, mp_popup_type type, char *title, void *use if (title) { //elm_object_part_text_set(popup, "title,text", title); - mp_util_domain_translatable_part_text_set(popup, "title,text", title); + mp_util_domain_translatable_part_text_set(popup, "title,text", + title); } p_ad->popup[type] = popup; @@ -1067,15 +1223,13 @@ mp_popup_create(Evas_Object * parent, mp_popup_type type, char *title, void *use } -static void -_popup_show_cb(void *data) +static void _popup_show_cb(void *data) { evas_object_show(data); } -Evas_Object * -mp_entry_popup_create(char *title) +Evas_Object *mp_entry_popup_create(char *title) { Evas_Object *popup = NULL; mp_popup_type type = MP_POPUP_ENTRY; @@ -1090,27 +1244,32 @@ mp_entry_popup_create(char *title) popup = elm_popup_add(GET_NAVIFRAME); MP_CHECK_NULL(popup); - evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); //elm_object_style_set(popup, "no_effect"); elm_object_focus_set(popup, EINA_FALSE); - Popup_Data *popup_data = (Popup_Data *)calloc(1, sizeof(Popup_Data)); + Popup_Data *popup_data = (Popup_Data *) calloc(1, sizeof(Popup_Data)); mp_assert(popup_data); mp_popup_set_popup_data(popup, popup_data); - eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, mp_popup_back_cb, popup_data); + eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, + mp_popup_back_cb, popup_data); - evas_object_event_callback_add(popup, EVAS_CALLBACK_MOUSE_UP, _mouseup_cb, popup); + evas_object_event_callback_add(popup, EVAS_CALLBACK_MOUSE_UP, + _mouseup_cb, popup); //evas_object_event_callback_add(popup, EVAS_CALLBACK_KEY_DOWN, _keydown_cb, popup); popup_data->ad = p_ad; popup_data->type = type; - evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, _mp_popup_destroy_cb, popup_data); + evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, + _mp_popup_destroy_cb, popup_data); if (title) { - mp_util_domain_translatable_part_text_set(popup, "title,text", title); + mp_util_domain_translatable_part_text_set(popup, "title,text", + title); } p_ad->popup[type] = popup; @@ -1121,7 +1280,8 @@ mp_entry_popup_create(char *title) } void -mp_popup_response_callback_set(Evas_Object *popup, Evas_Smart_Cb cb, void *user_data) +mp_popup_response_callback_set(Evas_Object * popup, Evas_Smart_Cb cb, + void *user_data) { MP_CHECK(popup); @@ -1132,8 +1292,7 @@ mp_popup_response_callback_set(Evas_Object *popup, Evas_Smart_Cb cb, void *user_ popup_data->cb_data = user_data; } -void -mp_popup_response(Evas_Object *popup, int response) +void mp_popup_response(Evas_Object * popup, int response) { startfunc; MP_CHECK(popup); @@ -1142,14 +1301,16 @@ mp_popup_response(Evas_Object *popup, int response) MP_CHECK(popup_data); if (popup_data->response_cb) { - popup_data->response_cb(popup_data->cb_data, popup, (void *)response); + popup_data->response_cb(popup_data->cb_data, popup, + (void *) response); } else { mp_evas_object_del(popup); } } bool -mp_popup_button_set(Evas_Object *popup, popup_button_t btn_index, const char *text, int response) +mp_popup_button_set(Evas_Object * popup, popup_button_t btn_index, + const char *text, int response) { MP_CHECK_FALSE(popup); MP_CHECK_FALSE(text); @@ -1171,7 +1332,8 @@ mp_popup_button_set(Evas_Object *popup, popup_button_t btn_index, const char *te elm_object_style_set(button, "popup"); mp_util_domain_translatable_text_set(button, text); //elm_object_text_set(button, text); - evas_object_smart_callback_add(button, "clicked", _mp_popup_button_clicked_cb, popup); + evas_object_smart_callback_add(button, "clicked", + _mp_popup_button_clicked_cb, popup); if (button) { elm_object_part_content_set(popup, part[btn_index], button); @@ -1180,26 +1342,26 @@ mp_popup_button_set(Evas_Object *popup, popup_button_t btn_index, const char *te } /* - if (!g_strcmp0(text, GET_SYS_STR(STR_MP_DELETE)) )//|| !g_strcmp0(text, GET_SYS_STR(STR_MP_REMOVE))) - { - elm_object_style_set(button, "style1/delete"); - } - */ + if (!g_strcmp0(text, GET_SYS_STR(STR_MP_DELETE)) )//|| !g_strcmp0(text, GET_SYS_STR(STR_MP_REMOVE))) + { + elm_object_style_set(button, "style1/delete"); + } + */ return ret; } static void -__mp_popup_timeout_cb(void *data, Evas_Object *obj, void *event_info) +__mp_popup_timeout_cb(void *data, Evas_Object * obj, void *event_info) { startfunc; - int response = (int)data; + int response = (int) data; mp_popup_response(obj, response); } static void -__mp_popup_block_cb(void *data, Evas_Object *obj, void *event_info) +__mp_popup_block_cb(void *data, Evas_Object * obj, void *event_info) { startfunc; @@ -1211,29 +1373,31 @@ __mp_popup_block_cb(void *data, Evas_Object *obj, void *event_info) }; for (i = 0; i < MP_POPUP_BTN_MAX; i++) { - Evas_Object *button_part = elm_object_part_content_get(obj, part[i]); + Evas_Object *button_part = + elm_object_part_content_get(obj, part[i]); if (button_part) { DEBUG_TRACE("exist button in popup"); return; } } - int response = (int)data; + int response = (int) data; mp_popup_response(obj, response); } -void -mp_popup_timeout_set(Evas_Object *popup, double timeout) +void mp_popup_timeout_set(Evas_Object * popup, double timeout) { startfunc; MP_CHECK(popup); elm_popup_timeout_set(popup, timeout); - evas_object_smart_callback_add(popup, "timeout", __mp_popup_timeout_cb, (void *)MP_POPUP_NO); + evas_object_smart_callback_add(popup, "timeout", __mp_popup_timeout_cb, + (void *) MP_POPUP_NO); //evas_object_smart_callback_add(popup, "block,clicked", __mp_popup_timeout_cb, (void *)MP_POPUP_NO); } -void _mp_popup_max_length_response_cb(void *data, Evas_Object *obj, void *event_info) +void _mp_popup_max_length_response_cb(void *data, Evas_Object * obj, + void *event_info) { if (data) { elm_object_focus_set(data, EINA_TRUE); @@ -1241,8 +1405,7 @@ void _mp_popup_max_length_response_cb(void *data, Evas_Object *obj, void *event_ evas_object_del(obj); } -bool -mp_popup_max_length(Evas_Object *entry, const char *text) +bool mp_popup_max_length(Evas_Object * entry, const char *text) { MP_CHECK_FALSE(entry); @@ -1256,7 +1419,7 @@ mp_popup_max_length(Evas_Object *entry, const char *text) return true; } -Evas_Object *mp_popup_multi_window_center_add(Evas_Object *parent) +Evas_Object *mp_popup_multi_window_center_add(Evas_Object * parent) { MP_CHECK_NULL(parent); @@ -1265,8 +1428,8 @@ Evas_Object *mp_popup_multi_window_center_add(Evas_Object *parent) Evas_Object *p_window = elm_popup_win_get(popup); if (p_window) { - char edje_path[1024] ={0}; - char * path = app_get_resource_path(); + char edje_path[1024] = { 0 }; + char *path = app_get_resource_path(); MP_CHECK_NULL(path); snprintf(edje_path, 1024, "%s%s/%s", path, "edje", THEME_NAME); @@ -1276,4 +1439,3 @@ Evas_Object *mp_popup_multi_window_center_add(Evas_Object *parent) return popup; } - diff --git a/src/widget/mp-search-list.c b/src/widget/mp-search-list.c index 48eee7f..4fa0e88 100644 --- a/src/widget/mp-search-list.c +++ b/src/widget/mp-search-list.c @@ -26,21 +26,23 @@ #include "mp-play.h" #include "mp-common.h" -static Evas_Object * -_mp_search_list_no_content_add(void *data) +static Evas_Object *_mp_search_list_no_content_add(void *data) { DEBUG_TRACE_FUNC(); - MpSearchList_t *list = (MpSearchList_t *)data; + MpSearchList_t *list = (MpSearchList_t *) data; MP_CHECK_VAL(list, NULL); Evas_Object *no_contents = NULL; no_contents = elm_layout_add(list->box); - evas_object_size_hint_weight_set(no_contents, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(no_contents, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(no_contents, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(no_contents, EVAS_HINT_FILL, + EVAS_HINT_FILL); elm_layout_theme_set(no_contents, "layout", "nocontents", "default"); - mp_util_domain_translatable_part_text_set(no_contents, "elm.text", "IDS_MUSIC_BODY_NO_RESULTS_FOUND"); + mp_util_domain_translatable_part_text_set(no_contents, "elm.text", + "IDS_MUSIC_BODY_NO_RESULTS_FOUND"); if (list->genlist) { elm_box_unpack(list->box, list->genlist); @@ -53,10 +55,9 @@ _mp_search_list_no_content_add(void *data) return no_contents; } -static int -_mp_search_list_set_sentinel(void *thiz, int count) +static int _mp_search_list_set_sentinel(void *thiz, int count) { - MpSearchList_t *list = (MpSearchList_t *)thiz; + MpSearchList_t *list = (MpSearchList_t *) thiz; MP_CHECK_VAL(list, -1); if (0 >= count && (list->filter_str && strlen(list->filter_str))) { ERROR_TRACE("no tracks"); @@ -77,8 +78,8 @@ _mp_search_list_set_sentinel(void *thiz, int count) return 0; } -static char * -_mp_search_track_list_label_get(void *data, Evas_Object * obj, const char *part) +static char *_mp_search_track_list_label_get(void *data, Evas_Object * obj, + const char *part) { startfunc; mp_list_item_data_t *item_data = data; @@ -94,13 +95,17 @@ _mp_search_track_list_label_get(void *data, Evas_Object * obj, const char *part) if (!strcmp(part, "elm.text")) { char *title = NULL; - mp_media_info_get_title(track, &title); + mp_media_info_get_title(track, &title); mp_retv_if(!title, NULL); if (!strcmp(part, "elm.text")) { bool res = false; - char *markup_name = (char *)mp_util_search_markup_keyword(title, list->filter_str, &res); - return (res) ? g_strdup(markup_name) : elm_entry_utf8_to_markup(title); + char *markup_name = + (char *) mp_util_search_markup_keyword(title, + list->filter_str, + &res); + return (res) ? g_strdup(markup_name) : + elm_entry_utf8_to_markup(title); } else { return g_strdup(title); } @@ -114,8 +119,8 @@ _mp_search_track_list_label_get(void *data, Evas_Object * obj, const char *part) return NULL; } -Evas_Object * -_mp_search_track_list_icon_get(void *data, Evas_Object * obj, const char *part) +Evas_Object *_mp_search_track_list_icon_get(void *data, Evas_Object * obj, + const char *part) { startfunc; mp_list_item_data_t *item_data = data; @@ -131,8 +136,12 @@ _mp_search_track_list_icon_get(void *data, Evas_Object * obj, const char *part) Evas_Object *icon; mp_media_info_get_thumbnail_path(track, &thumbpath); - icon = mp_util_create_lazy_update_thumb_icon(obj, thumbpath, MP_LIST_ICON_SIZE, MP_LIST_ICON_SIZE); - elm_layout_theme_set(content, "layout", "list/B/music.type.1", "default"); + icon = + mp_util_create_lazy_update_thumb_icon(obj, thumbpath, + MP_LIST_ICON_SIZE, + MP_LIST_ICON_SIZE); + elm_layout_theme_set(content, "layout", "list/B/music.type.1", + "default"); elm_layout_content_set(content, "elm.swallow.content", icon); return content; } @@ -150,10 +159,11 @@ _mp_search_track_sel_cb(void *data, Evas_Object * obj, void *event_info) struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); - MpSearchList_t *list = (MpSearchList_t *)data; + MpSearchList_t *list = (MpSearchList_t *) data; MP_CHECK(list); - mp_list_item_data_t *item = (mp_list_item_data_t *) elm_object_item_data_get(gli); + mp_list_item_data_t *item = + (mp_list_item_data_t *) elm_object_item_data_get(gli); MP_CHECK(item); DEBUG_TRACE("item selected"); @@ -174,10 +184,15 @@ _mp_search_track_sel_cb(void *data, Evas_Object * obj, void *event_info) mp_playlist_mgr_clear(ad->playlist_mgr); gli2 = elm_genlist_first_item_get(obj); while (gli2) { - if (elm_genlist_item_select_mode_get(gli2) != ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) { - mp_list_item_data_t *item_data = elm_object_item_data_get(gli2); - if (item_data && item_data->item_type == MP_LIST_ITEM_TYPE_NORMAL && item_data->handle) { - if (item_data->group_type == MP_GROUP_NONE || item_data->group_type == MP_GROUP_BY_ALLSHARE) { + if (elm_genlist_item_select_mode_get(gli2) != + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) { + mp_list_item_data_t *item_data = + elm_object_item_data_get(gli2); + if (item_data + && item_data->item_type == MP_LIST_ITEM_TYPE_NORMAL + && item_data->handle) { + if (item_data->group_type == MP_GROUP_NONE + || item_data->group_type == MP_GROUP_BY_ALLSHARE) { char *uri = NULL; char *uid = NULL; char *title = NULL; @@ -190,7 +205,10 @@ _mp_search_track_sel_cb(void *data, Evas_Object * obj, void *event_info) mp_media_info_get_title(item_data->handle, &title); mp_media_info_get_artist(item_data->handle, &artist); - plst_item = mp_playlist_mgr_item_append(ad->playlist_mgr, uri, uid, title, artist, track_type); + plst_item = + mp_playlist_mgr_item_append(ad->playlist_mgr, uri, + uid, title, artist, + track_type); if (gli2 == gli && plst_item) { to_play = plst_item; } @@ -201,14 +219,15 @@ _mp_search_track_sel_cb(void *data, Evas_Object * obj, void *event_info) } MP_CHECK(to_play); - if (!ad->current_track_info || g_strcmp0(ad->current_track_info->uri , to_play->uri)) { + if (!ad->current_track_info + || g_strcmp0(ad->current_track_info->uri, to_play->uri)) { mp_playlist_mgr_set_current(ad->playlist_mgr, to_play); mp_play_destory(ad); ad->paused_by_user = FALSE; } - //disable conformant resizing in player view when the keypad is enabled - elm_object_signal_emit(ad->conformant, "elm,state,virtualkeypad,disable", ""); + elm_object_signal_emit(ad->conformant, + "elm,state,virtualkeypad,disable", ""); mp_common_show_player_view(MP_PLAYER_NORMAL, false, true, true); IF_FREE(prev_item_uid); @@ -216,8 +235,8 @@ _mp_search_track_sel_cb(void *data, Evas_Object * obj, void *event_info) return; } -static char * -_mp_search_album_list_label_get(void *data, Evas_Object * obj, const char *part) +static char *_mp_search_album_list_label_get(void *data, Evas_Object * obj, + const char *part) { startfunc; char *name = NULL; @@ -242,8 +261,12 @@ _mp_search_album_list_label_get(void *data, Evas_Object * obj, const char *part) if (!strcmp(part, "elm.text")) { bool res = false; - char *markup_name = (char *)mp_util_search_markup_keyword(name, list->filter_str, &res); - return (res) ? g_strdup(markup_name) : elm_entry_utf8_to_markup(name); + char *markup_name = + (char *) mp_util_search_markup_keyword(name, + list->filter_str, + &res); + return (res) ? g_strdup(markup_name) : + elm_entry_utf8_to_markup(name); } else { return g_strdup(name); } @@ -260,8 +283,8 @@ _mp_search_album_list_label_get(void *data, Evas_Object * obj, const char *part) return NULL; } -Evas_Object * -_mp_search_album_list_icon_get(void *data, Evas_Object * obj, const char *part) +Evas_Object *_mp_search_album_list_icon_get(void *data, Evas_Object * obj, + const char *part) { startfunc; @@ -278,8 +301,12 @@ _mp_search_album_list_icon_get(void *data, Evas_Object * obj, const char *part) Evas_Object *icon = NULL; char *thumb_name = NULL; mp_media_info_group_get_thumbnail_path(svc_item, &thumb_name); - icon = mp_util_create_lazy_update_thumb_icon(obj, thumb_name, MP_LIST_ICON_SIZE, MP_LIST_ICON_SIZE); - elm_layout_theme_set(content, "layout", "list/B/music.type.1", "default"); + icon = + mp_util_create_lazy_update_thumb_icon(obj, thumb_name, + MP_LIST_ICON_SIZE, + MP_LIST_ICON_SIZE); + elm_layout_theme_set(content, "layout", "list/B/music.type.1", + "default"); elm_layout_content_set(content, "elm.swallow.content", icon); return content; } @@ -309,7 +336,8 @@ _mp_search_album_select_cb(void *data, Evas_Object * obj, void *event_info) if (gli_data->handle) { ret = mp_media_info_group_get_main_info(gli_data->handle, &name); ret = mp_media_info_group_get_sub_info(gli_data->handle, &artist); - mp_media_info_group_get_thumbnail_path(gli_data->handle, &thumbnail); + mp_media_info_group_get_thumbnail_path(gli_data->handle, + &thumbnail); DEBUG_TRACE("thumbnail=%s", thumbnail); mp_retm_if(ret != 0, "Fail to get value"); mp_retm_if(name == NULL, "Fail to get value"); @@ -320,15 +348,19 @@ _mp_search_album_select_cb(void *data, Evas_Object * obj, void *event_info) /* create the view of album detail */ MpViewMgr_t *view_manager = mp_view_mgr_get_view_manager(); - MpAlbumDetailView_t *view_album_detail = mp_album_detail_view_create(view_manager->navi, name, artist, thumbnail); - mp_view_mgr_push_view(view_manager, (MpView_t *)view_album_detail, NULL); - - mp_view_update_options((MpView_t *)view_album_detail); - mp_view_set_title((MpView_t *)view_album_detail, title); + MpAlbumDetailView_t *view_album_detail = + mp_album_detail_view_create(view_manager->navi, name, artist, + thumbnail); + mp_view_mgr_push_view(view_manager, (MpView_t *) view_album_detail, + NULL); + + mp_view_update_options((MpView_t *) view_album_detail); + mp_view_set_title((MpView_t *) view_album_detail, title); } -static char * -_mp_search_artist_list_label_get(void *data, Evas_Object * obj, const char *part) +static char *_mp_search_artist_list_label_get(void *data, + Evas_Object * obj, + const char *part) { startfunc; char *name = NULL; @@ -350,8 +382,12 @@ _mp_search_artist_list_label_get(void *data, Evas_Object * obj, const char *part } if (!strcmp(part, "elm.text")) { bool res = false; - char *markup_name = (char *)mp_util_search_markup_keyword(name, list->filter_str, &res); - return (res) ? g_strdup(markup_name) : elm_entry_utf8_to_markup(name); + char *markup_name = + (char *) mp_util_search_markup_keyword(name, + list->filter_str, + &res); + return (res) ? g_strdup(markup_name) : + elm_entry_utf8_to_markup(name); } else { return g_strdup(name); } @@ -359,8 +395,8 @@ _mp_search_artist_list_label_get(void *data, Evas_Object * obj, const char *part return NULL; } -Evas_Object * -_mp_search_artist_list_icon_get(void *data, Evas_Object * obj, const char *part) +Evas_Object *_mp_search_artist_list_icon_get(void *data, Evas_Object * obj, + const char *part) { startfunc; mp_list_item_data_t *item_data = data; @@ -375,8 +411,12 @@ _mp_search_artist_list_icon_get(void *data, Evas_Object * obj, const char *part) char *thumb_name = NULL; Evas_Object *icon = NULL; mp_media_info_group_get_thumbnail_path(svc_item, &thumb_name); - icon = mp_util_create_lazy_update_thumb_icon(obj, thumb_name, MP_LIST_ICON_SIZE, MP_LIST_ICON_SIZE); - elm_layout_theme_set(content, "layout", "list/B/music.type.1", "default"); + icon = + mp_util_create_lazy_update_thumb_icon(obj, thumb_name, + MP_LIST_ICON_SIZE, + MP_LIST_ICON_SIZE); + elm_layout_theme_set(content, "layout", "list/B/music.type.1", + "default"); elm_layout_content_set(content, "elm.swallow.content", icon); return content; } @@ -385,7 +425,8 @@ _mp_search_artist_list_icon_get(void *data, Evas_Object * obj, const char *part) } static void -_mp_search_artist_select_cb(void *data, Evas_Object * obj, void *event_info) +_mp_search_artist_select_cb(void *data, Evas_Object * obj, + void *event_info) { //MpSearchList_t *list = (MpSearchList_t *)data; DEBUG_TRACE(""); @@ -406,7 +447,8 @@ _mp_search_artist_select_cb(void *data, Evas_Object * obj, void *event_info) if (gli_data->handle) { ret = mp_media_info_group_get_main_info(gli_data->handle, &name); ret = mp_media_info_group_get_sub_info(gli_data->handle, &artist); - mp_media_info_group_get_thumbnail_path(gli_data->handle, &thumbnail); + mp_media_info_group_get_thumbnail_path(gli_data->handle, + &thumbnail); DEBUG_TRACE("thumbnail=%s", thumbnail); mp_retm_if(ret != 0, "Fail to get value"); mp_retm_if(name == NULL, "Fail to get value"); @@ -416,15 +458,17 @@ _mp_search_artist_select_cb(void *data, Evas_Object * obj, void *event_info) /* create the view of album detail */ MpViewMgr_t *view_manager = mp_view_mgr_get_view_manager(); - MpArtistDetailView_t *view_artist_detail = mp_artist_detail_view_create(view_manager->navi, name, thumbnail); - mp_view_mgr_push_view(view_manager, (MpView_t *)view_artist_detail, NULL); + MpArtistDetailView_t *view_artist_detail = + mp_artist_detail_view_create(view_manager->navi, name, thumbnail); + mp_view_mgr_push_view(view_manager, (MpView_t *) view_artist_detail, + NULL); - mp_view_update_options((MpView_t *)view_artist_detail); - mp_view_set_title((MpView_t *)view_artist_detail, title); + mp_view_update_options((MpView_t *) view_artist_detail); + mp_view_set_title((MpView_t *) view_artist_detail, title); } -char * -_mp_search_list_gl_label_get_title(void *data, Evas_Object * obj, const char *part) +char *_mp_search_list_gl_label_get_title(void *data, Evas_Object * obj, + const char *part) { startfunc; char *text = NULL; @@ -436,8 +480,7 @@ _mp_search_list_gl_label_get_title(void *data, Evas_Object * obj, const char *pa return NULL; } -static void -_mp_search_list_item_del(void *data, Evas_Object * obj) +static void _mp_search_list_item_del(void *data, Evas_Object * obj) { startfunc; mp_list_item_data_t *item_data = data; @@ -453,7 +496,7 @@ static void _mp_search_list_set_itc(void *thiz) if (!list->itc_track) { list->itc_track = elm_genlist_item_class_new(); MP_CHECK(list->itc_track); - list->itc_track->item_style = "type1"; + list->itc_track->item_style = "type1"; list->itc_track->func.text_get = _mp_search_track_list_label_get; list->itc_track->func.content_get = _mp_search_track_list_icon_get; list->itc_track->func.del = _mp_search_list_item_del; @@ -461,7 +504,7 @@ static void _mp_search_list_set_itc(void *thiz) if (!list->itc_album) { list->itc_album = elm_genlist_item_class_new(); MP_CHECK(list->itc_album); - list->itc_album->item_style = "type1"; + list->itc_album->item_style = "type1"; list->itc_album->func.text_get = _mp_search_album_list_label_get; list->itc_album->func.content_get = _mp_search_album_list_icon_get; list->itc_album->func.del = _mp_search_list_item_del; @@ -471,32 +514,37 @@ static void _mp_search_list_set_itc(void *thiz) MP_CHECK(list->itc_artist); list->itc_artist->item_style = "type1"; list->itc_artist->func.text_get = _mp_search_artist_list_label_get; - list->itc_artist->func.content_get = _mp_search_artist_list_icon_get; + list->itc_artist->func.content_get = + _mp_search_artist_list_icon_get; list->itc_artist->func.del = _mp_search_list_item_del; } if (!list->itc_group_title) { list->itc_group_title = elm_genlist_item_class_new(); MP_CHECK(list->itc_group_title); list->itc_group_title->item_style = "groupindex"; - list->itc_group_title->func.text_get = _mp_search_list_gl_label_get_title; + list->itc_group_title->func.text_get = + _mp_search_list_gl_label_get_title; } } static void -_mp_search_list_append_group_title(void * data, char *text_ID, int index) +_mp_search_list_append_group_title(void *data, char *text_ID, int index) { startfunc; - MpSearchList_t *list = (MpSearchList_t *)data; + MpSearchList_t *list = (MpSearchList_t *) data; MP_CHECK(list); list->search_group_git[index] = - elm_genlist_item_append(list->genlist, list->itc_group_title, text_ID, NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL); - elm_genlist_item_select_mode_set(list->search_group_git[index], ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + elm_genlist_item_append(list->genlist, list->itc_group_title, + text_ID, NULL, ELM_GENLIST_ITEM_GROUP, + NULL, NULL); + elm_genlist_item_select_mode_set(list->search_group_git[index], + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); } static void _mp_search_list_refresh_list(void *thiz) { startfunc; - MpSearchList_t *list = (MpSearchList_t *)thiz; + MpSearchList_t *list = (MpSearchList_t *) thiz; MP_CHECK(list); int count = 0; @@ -507,22 +555,29 @@ static void _mp_search_list_refresh_list(void *thiz) int ret = 0; mp_media_list_h svc_handle = NULL; - ret = mp_media_info_group_list_count(MP_GROUP_BY_ARTIST, NULL, list->filter_str, &artist_count); + ret = + mp_media_info_group_list_count(MP_GROUP_BY_ARTIST, NULL, + list->filter_str, &artist_count); if (ret != 0) { DEBUG_TRACE("Fail to create structure"); goto END; } - ret = mp_media_info_group_list_count(MP_GROUP_BY_ALBUM, NULL, list->filter_str, &album_count); + ret = + mp_media_info_group_list_count(MP_GROUP_BY_ALBUM, NULL, + list->filter_str, &album_count); if (ret != 0) { DEBUG_TRACE("Fail to create structure"); goto END; } - ret = mp_media_info_list_count(MP_TRACK_ALL, NULL, NULL, list->filter_str, 0, &track_count); + ret = + mp_media_info_list_count(MP_TRACK_ALL, NULL, NULL, + list->filter_str, 0, &track_count); if (ret != 0) { DEBUG_TRACE("Fail to create structure"); goto END; } - DEBUG_TRACE("artist %d album %d track %d", artist_count, album_count, track_count); + DEBUG_TRACE("artist %d album %d track %d", artist_count, album_count, + track_count); count = artist_count + album_count + track_count; if (_mp_search_list_set_sentinel(list, count)) { @@ -530,8 +585,14 @@ static void _mp_search_list_refresh_list(void *thiz) } elm_genlist_clear(list->genlist); if (artist_count) { - _mp_search_list_append_group_title(list, ("IDS_MUSIC_TAB4_ARTISTS"), MP_SEARCH_ARTIST_GROUP); - ret = mp_media_info_group_list_create(&svc_handle, MP_GROUP_BY_ARTIST, NULL, list->filter_str, 0, artist_count); + _mp_search_list_append_group_title(list, + ("IDS_MUSIC_TAB4_ARTISTS"), + MP_SEARCH_ARTIST_GROUP); + ret = + mp_media_info_group_list_create(&svc_handle, + MP_GROUP_BY_ARTIST, NULL, + list->filter_str, 0, + artist_count); if (ret != 0) { DEBUG_TRACE("Fail to get items"); if (svc_handle) { @@ -544,19 +605,27 @@ static void _mp_search_list_refresh_list(void *thiz) mp_media_info_h item = NULL; item = mp_media_info_group_list_nth_item(svc_handle, index); if (item == NULL) { - DEBUG_TRACE("Fail to mp_media_info_group_list_nth_item, ret[%d], index[%d]", ret, index); + DEBUG_TRACE + ("Fail to mp_media_info_group_list_nth_item, ret[%d], index[%d]", + ret, index); continue; } - mp_list_item_data_t *item_data = calloc(1, sizeof(mp_list_item_data_t)); + mp_list_item_data_t *item_data = + calloc(1, sizeof(mp_list_item_data_t)); mp_assert(item_data); item_data->handle = item; item_data->group_type = MP_GROUP_BY_ARTIST; - item_data->it = elm_genlist_item_append(list->genlist, list->itc_artist, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, _mp_search_artist_select_cb, list); + item_data->it = + elm_genlist_item_append(list->genlist, list->itc_artist, + (void *) item_data, NULL, + ELM_GENLIST_ITEM_NONE, + _mp_search_artist_select_cb, list); elm_object_item_data_set(item_data->it, item_data); - char*name = NULL; + char *name = NULL; mp_media_info_group_get_main_info(item, &name); - list->artist_list = g_list_append(list->artist_list, g_strdup(name)); + list->artist_list = + g_list_append(list->artist_list, g_strdup(name)); } if (list->artist_handle) { @@ -568,8 +637,12 @@ static void _mp_search_list_refresh_list(void *thiz) } if (album_count) { - _mp_search_list_append_group_title(list, ("IDS_MUSIC_TAB4_ALBUMS"), MP_SEARCH_ALBUM_GROUP); - ret = mp_media_info_group_list_create(&svc_handle, MP_GROUP_BY_ALBUM, NULL, list->filter_str, 0, album_count); + _mp_search_list_append_group_title(list, ("IDS_MUSIC_TAB4_ALBUMS"), + MP_SEARCH_ALBUM_GROUP); + ret = + mp_media_info_group_list_create(&svc_handle, MP_GROUP_BY_ALBUM, + NULL, list->filter_str, 0, + album_count); if (ret != 0) { DEBUG_TRACE("Fail to get items"); if (svc_handle) { @@ -583,7 +656,9 @@ static void _mp_search_list_refresh_list(void *thiz) char *title = NULL; item = mp_media_info_group_list_nth_item(svc_handle, index); if (item == NULL) { - DEBUG_TRACE("Fail to mp_media_info_group_list_nth_item, ret[%d], index[%d]", ret, index); + DEBUG_TRACE + ("Fail to mp_media_info_group_list_nth_item, ret[%d], index[%d]", + ret, index); continue; } ret = mp_media_info_group_get_main_info(item, &title); @@ -592,11 +667,16 @@ static void _mp_search_list_refresh_list(void *thiz) mp_assert(item_data); item_data->handle = item; item_data->group_type = MP_GROUP_BY_ALBUM; - item_data->it = elm_genlist_item_append(list->genlist, list->itc_album, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, _mp_search_album_select_cb, list); + item_data->it = + elm_genlist_item_append(list->genlist, list->itc_album, + (void *) item_data, NULL, + ELM_GENLIST_ITEM_NONE, + _mp_search_album_select_cb, list); elm_object_item_data_set(item_data->it, item_data); - char* name = NULL; + char *name = NULL; mp_media_info_group_get_main_info(item, &name); - list->album_list = g_list_append(list->album_list, g_strdup(name)); + list->album_list = + g_list_append(list->album_list, g_strdup(name)); } if (list->album_handle) { mp_media_info_group_list_destroy(list->album_handle); @@ -607,8 +687,12 @@ static void _mp_search_list_refresh_list(void *thiz) } if (track_count) { - _mp_search_list_append_group_title(list, (STR_MP_TRACKS), MP_SEARCH_TRACK_GROUP); - ret = mp_media_info_list_create(&svc_handle, MP_TRACK_ALL, NULL, NULL, list->filter_str, 0, 0, track_count); + _mp_search_list_append_group_title(list, (STR_MP_TRACKS), + MP_SEARCH_TRACK_GROUP); + ret = + mp_media_info_list_create(&svc_handle, MP_TRACK_ALL, NULL, + NULL, list->filter_str, 0, 0, + track_count); if (ret != 0) { DEBUG_TRACE("Fail to get items"); if (svc_handle) { @@ -620,7 +704,9 @@ static void _mp_search_list_refresh_list(void *thiz) mp_media_info_h item = NULL; item = mp_media_info_list_nth_item(svc_handle, index); if (item == NULL) { - DEBUG_TRACE("Fail to mp_media_info_group_list_nth_item, ret[%d], index[%d]", ret, index); + DEBUG_TRACE + ("Fail to mp_media_info_group_list_nth_item, ret[%d], index[%d]", + ret, index); continue; } mp_list_item_data_t *item_data; @@ -628,11 +714,16 @@ static void _mp_search_list_refresh_list(void *thiz) mp_assert(item_data); item_data->handle = item; item_data->group_type = MP_GROUP_NONE; - item_data->it = elm_genlist_item_append(list->genlist, list->itc_track, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, _mp_search_track_sel_cb, list); + item_data->it = + elm_genlist_item_append(list->genlist, list->itc_track, + (void *) item_data, NULL, + ELM_GENLIST_ITEM_NONE, + _mp_search_track_sel_cb, list); elm_object_item_data_set(item_data->it, item_data); - char* title = NULL; - mp_media_info_get_title(item, &title); - list->track_list = g_list_append(list->track_list, g_strdup(title)); + char *title = NULL; + mp_media_info_get_title(item, &title); + list->track_list = + g_list_append(list->track_list, g_strdup(title)); } if (list->track_handle) { mp_media_info_list_destroy(list->track_handle); @@ -642,14 +733,14 @@ static void _mp_search_list_refresh_list(void *thiz) svc_handle = NULL; } evas_object_show(list->genlist); -END: + END: endfunc; } static void _mp_search_list_load_list(void *thiz) { startfunc; - MpSearchList_t *list = (MpSearchList_t *)thiz; + MpSearchList_t *list = (MpSearchList_t *) thiz; MP_CHECK(list); int count = 0; @@ -661,17 +752,23 @@ static void _mp_search_list_load_list(void *thiz) int ret = 0; mp_media_list_h svc_handle = NULL; - ret = mp_media_info_group_list_count(MP_GROUP_BY_ARTIST, NULL, list->filter_str, &artist_count); + ret = + mp_media_info_group_list_count(MP_GROUP_BY_ARTIST, NULL, + list->filter_str, &artist_count); if (ret != 0) { DEBUG_TRACE("Fail to create structure"); goto END; } - ret = mp_media_info_group_list_count(MP_GROUP_BY_ALBUM, NULL, list->filter_str, &album_count); + ret = + mp_media_info_group_list_count(MP_GROUP_BY_ALBUM, NULL, + list->filter_str, &album_count); if (ret != 0) { DEBUG_TRACE("Fail to create structure"); goto END; } - ret = mp_media_info_list_count(MP_TRACK_ALL, NULL, NULL, list->filter_str, 0, &track_count); + ret = + mp_media_info_list_count(MP_TRACK_ALL, NULL, NULL, + list->filter_str, 0, &track_count); if (ret != 0) { DEBUG_TRACE("Fail to create structure"); goto END; @@ -685,30 +782,39 @@ static void _mp_search_list_load_list(void *thiz) } - /*create new genlist*/ + /*create new genlist */ if (list->genlist != NULL) { evas_object_del(list->genlist); list->genlist = NULL; } list->genlist = mp_widget_genlist_create(list->box); - elm_scroller_policy_set(list->genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); - evas_object_size_hint_weight_set(list->genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(list->genlist, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_scroller_policy_set(list->genlist, ELM_SCROLLER_POLICY_OFF, + ELM_SCROLLER_POLICY_AUTO); + evas_object_size_hint_weight_set(list->genlist, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(list->genlist, EVAS_HINT_FILL, + EVAS_HINT_FILL); elm_genlist_homogeneous_set(list->genlist, EINA_FALSE); elm_genlist_mode_set(list->genlist, ELM_LIST_COMPRESS); evas_object_show(list->genlist); - /*packet genlist to box*/ + /*packet genlist to box */ elm_box_pack_end(list->box, list->genlist); - evas_object_data_set(list->genlist, "list_handle", (void *)list); + evas_object_data_set(list->genlist, "list_handle", (void *) list); _mp_search_list_set_itc(list); if (artist_count) { DEBUG_TRACE("append artist list items"); - _mp_search_list_append_group_title(list, ("IDS_MUSIC_TAB4_ARTISTS"), MP_SEARCH_ARTIST_GROUP); - ret = mp_media_info_group_list_create(&svc_handle, MP_GROUP_BY_ARTIST, NULL, list->filter_str, 0, artist_count); + _mp_search_list_append_group_title(list, + ("IDS_MUSIC_TAB4_ARTISTS"), + MP_SEARCH_ARTIST_GROUP); + ret = + mp_media_info_group_list_create(&svc_handle, + MP_GROUP_BY_ARTIST, NULL, + list->filter_str, 0, + artist_count); if (ret != 0) { DEBUG_TRACE("Fail to get items"); if (svc_handle) { @@ -722,23 +828,29 @@ static void _mp_search_list_load_list(void *thiz) item = mp_media_info_group_list_nth_item(svc_handle, index); if (item == NULL) { - DEBUG_TRACE("Fail to mp_media_info_group_list_nth_item, ret[%d], index[%d]", ret, index); + DEBUG_TRACE + ("Fail to mp_media_info_group_list_nth_item, ret[%d], index[%d]", + ret, index); continue; } - mp_list_item_data_t *item_data = calloc(1, sizeof(mp_list_item_data_t)); + mp_list_item_data_t *item_data = + calloc(1, sizeof(mp_list_item_data_t)); mp_assert(item_data); item_data->handle = item; item_data->group_type = MP_GROUP_BY_ARTIST; - item_data->it = elm_genlist_item_append(list->genlist, list->itc_artist, (void *)item_data, - NULL, ELM_GENLIST_ITEM_NONE, - _mp_search_artist_select_cb, list); + item_data->it = + elm_genlist_item_append(list->genlist, list->itc_artist, + (void *) item_data, NULL, + ELM_GENLIST_ITEM_NONE, + _mp_search_artist_select_cb, list); elm_object_item_data_set(item_data->it, item_data); - char*name = NULL; + char *name = NULL; mp_media_info_group_get_main_info(item, &name); - list->artist_list = g_list_append(list->artist_list, g_strdup(name)); + list->artist_list = + g_list_append(list->artist_list, g_strdup(name)); } if (list->artist_handle) { @@ -752,9 +864,13 @@ static void _mp_search_list_load_list(void *thiz) if (album_count) { DEBUG_TRACE("append album_count list items"); - _mp_search_list_append_group_title(list, ("IDS_MUSIC_TAB4_ALBUMS"), MP_SEARCH_ALBUM_GROUP); + _mp_search_list_append_group_title(list, ("IDS_MUSIC_TAB4_ALBUMS"), + MP_SEARCH_ALBUM_GROUP); - ret = mp_media_info_group_list_create(&svc_handle, MP_GROUP_BY_ALBUM, NULL, list->filter_str, 0, album_count); + ret = + mp_media_info_group_list_create(&svc_handle, MP_GROUP_BY_ALBUM, + NULL, list->filter_str, 0, + album_count); if (ret != 0) { DEBUG_TRACE("Fail to get items"); if (svc_handle) { @@ -768,7 +884,9 @@ static void _mp_search_list_load_list(void *thiz) char *title = NULL; item = mp_media_info_group_list_nth_item(svc_handle, index); if (item == NULL) { - DEBUG_TRACE("Fail to mp_media_info_group_list_nth_item, ret[%d], index[%d]", ret, index); + DEBUG_TRACE + ("Fail to mp_media_info_group_list_nth_item, ret[%d], index[%d]", + ret, index); continue; } ret = mp_media_info_group_get_main_info(item, &title); @@ -779,13 +897,16 @@ static void _mp_search_list_load_list(void *thiz) item_data->handle = item; item_data->group_type = MP_GROUP_BY_ALBUM; - item_data->it = elm_genlist_item_append(list->genlist, list->itc_album, (void *)item_data, - NULL, ELM_GENLIST_ITEM_NONE, - _mp_search_album_select_cb, list); + item_data->it = + elm_genlist_item_append(list->genlist, list->itc_album, + (void *) item_data, NULL, + ELM_GENLIST_ITEM_NONE, + _mp_search_album_select_cb, list); elm_object_item_data_set(item_data->it, item_data); - char* name = NULL; + char *name = NULL; mp_media_info_group_get_main_info(item, &name); - list->album_list = g_list_append(list->album_list, g_strdup(name)); + list->album_list = + g_list_append(list->album_list, g_strdup(name)); } if (list->album_handle) { @@ -799,9 +920,13 @@ static void _mp_search_list_load_list(void *thiz) if (track_count) { DEBUG_TRACE("append track_count list items"); - _mp_search_list_append_group_title(list, (STR_MP_TRACKS), MP_SEARCH_TRACK_GROUP); + _mp_search_list_append_group_title(list, (STR_MP_TRACKS), + MP_SEARCH_TRACK_GROUP); - ret = mp_media_info_list_create(&svc_handle, MP_TRACK_ALL, NULL, NULL, list->filter_str, 0, 0, track_count); + ret = + mp_media_info_list_create(&svc_handle, MP_TRACK_ALL, NULL, + NULL, list->filter_str, 0, 0, + track_count); if (ret != 0) { DEBUG_TRACE("Fail to get items"); if (svc_handle) { @@ -823,13 +948,16 @@ static void _mp_search_list_load_list(void *thiz) item_data->handle = item; item_data->group_type = MP_GROUP_NONE; - item_data->it = elm_genlist_item_append(list->genlist, list->itc_track, (void *)item_data, - NULL, ELM_GENLIST_ITEM_NONE, - _mp_search_track_sel_cb, list); + item_data->it = + elm_genlist_item_append(list->genlist, list->itc_track, + (void *) item_data, NULL, + ELM_GENLIST_ITEM_NONE, + _mp_search_track_sel_cb, list); elm_object_item_data_set(item_data->it, item_data); - char* title = NULL; - mp_media_info_get_title(item, &title); - list->track_list = g_list_append(list->track_list, g_strdup(title)); + char *title = NULL; + mp_media_info_get_title(item, &title); + list->track_list = + g_list_append(list->track_list, g_strdup(title)); } if (list->track_handle) { @@ -840,7 +968,7 @@ static void _mp_search_list_load_list(void *thiz) svc_handle = NULL; } -END: + END: endfunc; } @@ -890,7 +1018,7 @@ static void _mp_search_list_update(void *thiz) _mp_search_list_load_list(list); } -MpSearchList_t * mp_search_list_create(Evas_Object *parent) +MpSearchList_t *mp_search_list_create(Evas_Object * parent) { startfunc; MP_CHECK_NULL(parent); @@ -898,7 +1026,7 @@ MpSearchList_t * mp_search_list_create(Evas_Object *parent) MpSearchList_t *list = calloc(1, sizeof(MpSearchList_t)); MP_CHECK_NULL(list); - mp_list_init((MpList_t *)list, parent, MP_LIST_TYPE_GROUP); + mp_list_init((MpList_t *) list, parent, MP_LIST_TYPE_GROUP); list->update = _mp_search_list_update; list->destory_cb = _mp_search_list_destory_cb; @@ -906,7 +1034,7 @@ MpSearchList_t * mp_search_list_create(Evas_Object *parent) return list; } -void mp_search_list_set_data(MpSearchList_t *list, ...) +void mp_search_list_set_data(MpSearchList_t * list, ...) { startfunc; MP_CHECK(list); @@ -920,14 +1048,14 @@ void mp_search_list_set_data(MpSearchList_t *list, ...) DEBUG_TRACE("field is %d", field); switch (field) { - case MP_SEARCH_LIST_FILTER_STR: { - char *val = va_arg((var_args), char *); - SAFE_FREE(list->filter_str); - list->filter_str = g_strdup(val); - DEBUG_TRACE("list->filter_str = %s", list->filter_str); + case MP_SEARCH_LIST_FILTER_STR:{ + char *val = va_arg((var_args), char *); + SAFE_FREE(list->filter_str); + list->filter_str = g_strdup(val); + DEBUG_TRACE("list->filter_str = %s", list->filter_str); - break; - } + break; + } default: DEBUG_TRACE("Invalid arguments"); @@ -937,4 +1065,3 @@ void mp_search_list_set_data(MpSearchList_t *list, ...) va_end(var_args); } - diff --git a/src/widget/mp-search.c b/src/widget/mp-search.c index 128925e..0b13100 100644 --- a/src/widget/mp-search.c +++ b/src/widget/mp-search.c @@ -22,7 +22,8 @@ #define MP_SEARCHBAR_W 400*elm_config_scale_get() void -_mp_search_view_activated_cb(void *data, Evas_Object * obj, void *event_info) +_mp_search_view_activated_cb(void *data, Evas_Object * obj, + void *event_info) { MP_CHECK(data); elm_object_focus_set(obj, FALSE); @@ -38,7 +39,8 @@ _mp_search_view_clicked_cb(void *data, Evas_Object * obj, void *event_info) } static void -_mp_search_eraser_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source) +_mp_search_eraser_clicked_cb(void *data, Evas_Object * obj, + const char *emission, const char *source) { startfunc; Evas_Object *entry = data; @@ -49,15 +51,16 @@ _mp_search_eraser_clicked_cb(void *data, Evas_Object *obj, const char *emission, } static void -_mp_search_entry_maxlength_reached_cb(void *data, Evas_Object * obj, void *event_info) +_mp_search_entry_maxlength_reached_cb(void *data, Evas_Object * obj, + void *event_info) { mp_popup_max_length(obj, STR_NH_COM_POPUP_CHARACTERS_MAXNUM_REACHED); } static void -_mp_searchfield_changed_cb(void *data, Evas_Object *obj, void *event_info) +_mp_searchfield_changed_cb(void *data, Evas_Object * obj, void *event_info) { - Evas_Object *editfield = (Evas_Object *)data; + Evas_Object *editfield = (Evas_Object *) data; if (!elm_entry_is_empty(obj) && elm_object_focus_get(obj)) { elm_object_signal_emit(editfield, "elm,action,show,button", ""); @@ -67,9 +70,9 @@ _mp_searchfield_changed_cb(void *data, Evas_Object *obj, void *event_info) } static void -_mp_searchfield_focused_cb(void *data, Evas_Object *obj, void *event_info) +_mp_searchfield_focused_cb(void *data, Evas_Object * obj, void *event_info) { - Evas_Object *editfield = (Evas_Object *)data; + Evas_Object *editfield = (Evas_Object *) data; elm_object_signal_emit(editfield, "elm,state,focused", ""); if (!elm_entry_is_empty(obj)) { @@ -78,14 +81,17 @@ _mp_searchfield_focused_cb(void *data, Evas_Object *obj, void *event_info) } static void -_mp_searchfield_unfocused_cb(void *data, Evas_Object *obj, void *event_info) +_mp_searchfield_unfocused_cb(void *data, Evas_Object * obj, + void *event_info) { - Evas_Object *editfield = (Evas_Object *)data; + Evas_Object *editfield = (Evas_Object *) data; elm_object_signal_emit(editfield, "elm,state,unfocused", ""); elm_object_signal_emit(editfield, "elm,action,hide,button", ""); } -static void _mp_search_cancel_button_clicked(void *data, Evas_Object *o, const char *emission, const char *source) +static void _mp_search_cancel_button_clicked(void *data, Evas_Object * o, + const char *emission, + const char *source) { Evas_Object *en = (Evas_Object *) data; elm_object_text_set(en, ""); @@ -93,9 +99,15 @@ static void _mp_search_cancel_button_clicked(void *data, Evas_Object *o, const c elm_object_focus_set(en, TRUE); } -Evas_Object * -mp_search_create_new(Evas_Object * parent, Evas_Smart_Cb change_cb, void *change_cb_data, Evas_Smart_Cb cancel_cb, void *cancel_cb_data, - Evas_Smart_Cb focus_cb, void *focus_cb_data, Evas_Smart_Cb unfocus_cb, void *unfocus_cb_data) +Evas_Object *mp_search_create_new(Evas_Object * parent, + Evas_Smart_Cb change_cb, + void *change_cb_data, + Evas_Smart_Cb cancel_cb, + void *cancel_cb_data, + Evas_Smart_Cb focus_cb, + void *focus_cb_data, + Evas_Smart_Cb unfocus_cb, + void *unfocus_cb_data) { startfunc; @@ -104,15 +116,16 @@ mp_search_create_new(Evas_Object * parent, Evas_Smart_Cb change_cb, void *change searchfield = elm_layout_add(parent); Elm_Theme *th = elm_theme_new(); - char edje_path[1024] ={0}; - char * path = app_get_resource_path(); + char edje_path[1024] = { 0 }; + char *path = app_get_resource_path(); MP_CHECK_NULL(path); snprintf(edje_path, 1024, "%s%s/%s", path, "edje", THEME_NAME); elm_theme_extension_add(th, edje_path); free(path); - elm_layout_theme_set(searchfield, "layout", "searchbar", "cancel_button_case"); + elm_layout_theme_set(searchfield, "layout", "searchbar", + "cancel_button_case"); en = elm_entry_add(searchfield); elm_entry_scrollable_set(en, EINA_TRUE); @@ -122,52 +135,72 @@ mp_search_create_new(Evas_Object * parent, Evas_Smart_Cb change_cb, void *change evas_object_data_set(searchfield, "entry", en); elm_entry_input_panel_layout_set(en, ELM_INPUT_PANEL_LAYOUT_NORMAL); - elm_entry_input_panel_return_key_type_set(en, ELM_INPUT_PANEL_RETURN_KEY_TYPE_SEARCH); - - evas_object_size_hint_weight_set(searchfield, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(searchfield, EVAS_HINT_FILL, EVAS_HINT_FILL); - mp_util_domain_translatable_part_text_set(en, "elm.guide", STR_SEARCH_GUIDE); - evas_object_smart_callback_add(en, "changed", _mp_searchfield_changed_cb, searchfield); - elm_object_signal_callback_add(searchfield, "elm,eraser,clicked", "elm", _mp_search_eraser_clicked_cb, en); - - evas_object_smart_callback_add(en, "changed", change_cb, change_cb_data); - evas_object_smart_callback_add(en, "activated", _mp_search_view_activated_cb, searchfield); - - evas_object_smart_callback_add(en, "focused", _mp_searchfield_focused_cb, focus_cb_data); - evas_object_smart_callback_add(en, "unfocused", _mp_searchfield_unfocused_cb, focus_cb_data); - evas_object_smart_callback_add(en, "preedit,changed", change_cb, change_cb_data); - evas_object_smart_callback_add(en, "clicked", _mp_search_view_clicked_cb, searchfield); - - edje_object_signal_callback_add(_EDJ(searchfield), "elm,action,click", "button_cancel_image", _mp_search_cancel_button_clicked, en); + elm_entry_input_panel_return_key_type_set(en, + ELM_INPUT_PANEL_RETURN_KEY_TYPE_SEARCH); + + evas_object_size_hint_weight_set(searchfield, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(searchfield, EVAS_HINT_FILL, + EVAS_HINT_FILL); + mp_util_domain_translatable_part_text_set(en, "elm.guide", + STR_SEARCH_GUIDE); + evas_object_smart_callback_add(en, "changed", + _mp_searchfield_changed_cb, + searchfield); + elm_object_signal_callback_add(searchfield, "elm,eraser,clicked", + "elm", _mp_search_eraser_clicked_cb, + en); + + evas_object_smart_callback_add(en, "changed", change_cb, + change_cb_data); + evas_object_smart_callback_add(en, "activated", + _mp_search_view_activated_cb, + searchfield); + + evas_object_smart_callback_add(en, "focused", + _mp_searchfield_focused_cb, + focus_cb_data); + evas_object_smart_callback_add(en, "unfocused", + _mp_searchfield_unfocused_cb, + focus_cb_data); + evas_object_smart_callback_add(en, "preedit,changed", change_cb, + change_cb_data); + evas_object_smart_callback_add(en, "clicked", + _mp_search_view_clicked_cb, + searchfield); + + edje_object_signal_callback_add(_EDJ(searchfield), "elm,action,click", + "button_cancel_image", + _mp_search_cancel_button_clicked, en); static Elm_Entry_Filter_Limit_Size limit_filter_data; limit_filter_data.max_char_count = MP_SEARCH_MAX_CHAR_COUNT; limit_filter_data.max_byte_count = 0; - elm_entry_markup_filter_append(en, elm_entry_filter_limit_size, &limit_filter_data); - evas_object_smart_callback_add(en, "maxlength,reached", _mp_search_entry_maxlength_reached_cb, NULL); + elm_entry_markup_filter_append(en, elm_entry_filter_limit_size, + &limit_filter_data); + evas_object_smart_callback_add(en, "maxlength,reached", + _mp_search_entry_maxlength_reached_cb, + NULL); evas_object_show(searchfield); return searchfield; } -void -mp_search_hide_imf_pannel(Evas_Object * search) +void mp_search_hide_imf_pannel(Evas_Object * search) { MP_CHECK(search); Evas_Object *en = mp_search_entry_get(search); elm_object_focus_set(en, EINA_FALSE); } -void -mp_search_show_imf_pannel(Evas_Object * search) +void mp_search_show_imf_pannel(Evas_Object * search) { MP_CHECK(search); Evas_Object *en = mp_search_entry_get(search); elm_object_focus_set(en, EINA_TRUE); } -Evas_Object * -mp_search_entry_get(Evas_Object *search) +Evas_Object *mp_search_entry_get(Evas_Object * search) { MP_CHECK_NULL(search); @@ -176,8 +209,7 @@ mp_search_entry_get(Evas_Object *search) return entry; } -char * -mp_search_text_get(Evas_Object *search) +char *mp_search_text_get(Evas_Object * search) { MP_CHECK_NULL(search); Evas_Object *entry = evas_object_data_get(search, "entry"); @@ -189,8 +221,7 @@ mp_search_text_get(Evas_Object *search) return markup_text; } -void -mp_search_text_set(Evas_Object *search, const char *text) +void mp_search_text_set(Evas_Object * search, const char *text) { MP_CHECK(search); Evas_Object *entry = evas_object_data_get(search, "entry"); @@ -205,5 +236,3 @@ mp_search_text_set(Evas_Object *search, const char *text) elm_entry_cursor_end_set(entry); //elm_object_text_set(entry, text); } - - diff --git a/src/widget/mp-smart-event-box.c b/src/widget/mp-smart-event-box.c index bed25d6..f322be6 100644 --- a/src/widget/mp-smart-event-box.c +++ b/src/widget/mp-smart-event-box.c @@ -27,7 +27,7 @@ #endif typedef struct _EventCallbackData_t { - void (*func)(void *); + void (*func) (void *); void *data; } EventCallbackData_t; @@ -45,7 +45,8 @@ typedef struct _MpSmartEventBoxData_t { static void -__mouse_down_cb(void *data, Evas * evas, Evas_Object * obj, void *event_info) +__mouse_down_cb(void *data, Evas * evas, Evas_Object * obj, + void *event_info) { Evas_Event_Mouse_Down *ev = (Evas_Event_Mouse_Down *) event_info; MpSmartEventBoxData_t *box_d = data; @@ -76,12 +77,13 @@ __mouse_up_cb(void *data, Evas * evas, Evas_Object * obj, void *event_info) goto END; -END: + END: box_d->move = false; } static void -__mouse_move_cb(void *data, Evas * evas, Evas_Object * obj, void *event_info) +__mouse_move_cb(void *data, Evas * evas, Evas_Object * obj, + void *event_info) { Evas_Coord diff_x = 0, diff_y = 0; Evas_Event_Mouse_Up *mu = (Evas_Event_Mouse_Up *) event_info; @@ -94,13 +96,13 @@ __mouse_move_cb(void *data, Evas * evas, Evas_Object * obj, void *event_info) if (box_d->down_x < 0) { return; } - //elm_coords_finger_size_adjust(1, &minw, 1, &minh); diff_x = box_d->down_x - mu->canvas.x; diff_y = box_d->down_y - mu->canvas.y; - if ((ABS(diff_x) > SCROLL_THREASHOLD) || (ABS(diff_y) > SCROLL_THREASHOLD)) { + if ((ABS(diff_x) > SCROLL_THREASHOLD) + || (ABS(diff_y) > SCROLL_THREASHOLD)) { // dragging box_d->move = true; @@ -110,7 +112,7 @@ __mouse_move_cb(void *data, Evas * evas, Evas_Object * obj, void *event_info) if (ABS(diff_y) > SCROLL_THREASHOLD) { if (diff_y < 0) { //down goto flick_down; - } else { //up + } else { //up goto flick_up; } } else { @@ -124,41 +126,42 @@ __mouse_move_cb(void *data, Evas * evas, Evas_Object * obj, void *event_info) } } -flick_up: + flick_up: goto END; -flick_down: + flick_down: goto END; -flick_left: + flick_left: box_d->cbs[MP_EVENT_LEFT].func(box_d->cbs[MP_EVENT_LEFT].data); goto END; -flick_right: + flick_right: box_d->cbs[MP_EVENT_RIGHT].func(box_d->cbs[MP_EVENT_RIGHT].data); goto END; -END: + END: return; } static void -_mp_smart_event_box_del_cb(void *data, Evas * e, Evas_Object * eo, void *event_info) +_mp_smart_event_box_del_cb(void *data, Evas * e, Evas_Object * eo, + void *event_info) { MpSmartEventBoxData_t *b_data = data; IF_FREE(b_data); } -Evas_Object * -mp_smart_event_box_add(Evas_Object * parent) +Evas_Object *mp_smart_event_box_add(Evas_Object * parent) { //Evas *e = NULL; //Evas_Object *obj = NULL; MpSmartEventBoxData_t *data = NULL; - Evas_Object *rect = evas_object_rectangle_add(evas_object_evas_get(parent)); + Evas_Object *rect = + evas_object_rectangle_add(evas_object_evas_get(parent)); MP_CHECK_NULL(rect); data = calloc(1, sizeof(MpSmartEventBoxData_t)); @@ -173,23 +176,29 @@ mp_smart_event_box_add(Evas_Object * parent) evas_object_size_hint_align_set(rect, EVAS_HINT_FILL, 0.0); - evas_object_event_callback_add(rect, EVAS_CALLBACK_DEL, _mp_smart_event_box_del_cb, data); - evas_object_event_callback_add(rect, EVAS_CALLBACK_MOUSE_DOWN, __mouse_down_cb, data); - evas_object_event_callback_add(rect, EVAS_CALLBACK_MOUSE_MOVE, __mouse_move_cb, data); - evas_object_event_callback_add(rect, EVAS_CALLBACK_MOUSE_UP, __mouse_up_cb, data); + evas_object_event_callback_add(rect, EVAS_CALLBACK_DEL, + _mp_smart_event_box_del_cb, data); + evas_object_event_callback_add(rect, EVAS_CALLBACK_MOUSE_DOWN, + __mouse_down_cb, data); + evas_object_event_callback_add(rect, EVAS_CALLBACK_MOUSE_MOVE, + __mouse_move_cb, data); + evas_object_event_callback_add(rect, EVAS_CALLBACK_MOUSE_UP, + __mouse_up_cb, data); data->down_x = -1; return rect; } -void mp_smart_event_box_callback_add(Evas_Object *event_box, MpEventCallback_e event, void (*event_cb)(void *), void *user_data) +void mp_smart_event_box_callback_add(Evas_Object * event_box, + MpEventCallback_e event, + void (*event_cb) (void *), + void *user_data) { - MpSmartEventBoxData_t *data = evas_object_data_get(event_box, "obj_data"); + MpSmartEventBoxData_t *data = + evas_object_data_get(event_box, "obj_data"); MP_CHECK(data); data->cbs[event].func = event_cb; data->cbs[event].data = user_data; } - - diff --git a/src/widget/mp-track-list.c b/src/widget/mp-track-list.c index 5121532..3127b58 100644 --- a/src/widget/mp-track-list.c +++ b/src/widget/mp-track-list.c @@ -38,12 +38,12 @@ typedef struct { int count; } albumart_info_s; -static char * -_mp_track_list_label_get(void *data, Evas_Object * obj, const char *part) +static char *_mp_track_list_label_get(void *data, Evas_Object * obj, + const char *part) { mp_list_item_data_t *item = (mp_list_item_data_t *) data; MP_CHECK_NULL(item); - mp_media_info_h track = (mp_media_info_h)(item->handle); + mp_media_info_h track = (mp_media_info_h) (item->handle); mp_retvm_if(!track, NULL, "data is null"); if (!strcmp(part, "elm.text") || !strcmp(part, "elm.text.sub")) { @@ -52,7 +52,7 @@ _mp_track_list_label_get(void *data, Evas_Object * obj, const char *part) struct appdata *ad = mp_util_get_appdata(); MP_CHECK_NULL(ad); - mp_track_info_t* current = ad->current_track_info; + mp_track_info_t *current = ad->current_track_info; char *title = NULL; @@ -62,7 +62,7 @@ _mp_track_list_label_get(void *data, Evas_Object * obj, const char *part) if (list->track_type == MP_TRACK_BY_FOLDER) { mp_media_info_get_display_name(track, &title); } else { - mp_media_info_get_title(track, &title); + mp_media_info_get_title(track, &title); } } else { mp_media_info_get_artist(track, &title); @@ -75,7 +75,8 @@ _mp_track_list_label_get(void *data, Evas_Object * obj, const char *part) mp_retv_if(!uri, NULL); bool match = false; - if (current && !g_strcmp0(current->uri, uri) && list->edit_mode == 0) { + if (current && !g_strcmp0(current->uri, uri) + && list->edit_mode == 0) { match = true; } @@ -98,7 +99,8 @@ _mp_track_list_label_get(void *data, Evas_Object * obj, const char *part) a = 255; memset(result, 0x00, DEF_STR_LEN + 1); snprintf(result, DEF_STR_LEN, - "%s", r, g, b, a, markup_title); + "%s", r, g, b, a, + markup_title); IF_FREE(markup_title); return g_strdup(result); @@ -109,21 +111,21 @@ _mp_track_list_label_get(void *data, Evas_Object * obj, const char *part) return markup; } /*else if (!strcmp(part, "elm.text.3") ) - { - int duration; - char time[16] = ""; + { + int duration; + char time[16] = ""; - mp_media_info_get_duration(track, &duration); + mp_media_info_get_duration(track, &duration); - mp_util_format_duration(time, duration); - time[15] = '\0'; - return g_strdup(time); - }*/ + mp_util_format_duration(time, duration); + time[15] = '\0'; + return g_strdup(time); + } */ return NULL; } -Evas_Object * -_mp_track_list_icon_get(void *data, Evas_Object * obj, const char *part) +Evas_Object *_mp_track_list_icon_get(void *data, Evas_Object * obj, + const char *part) { mp_list_item_data_t *item = (mp_list_item_data_t *) data; MP_CHECK_NULL(item); @@ -139,11 +141,12 @@ _mp_track_list_icon_get(void *data, Evas_Object * obj, const char *part) //get player status struct appdata *ad = mp_util_get_appdata(); MP_CHECK_NULL(ad); - mp_track_info_t* current = ad->current_track_info; + mp_track_info_t *current = ad->current_track_info; char *uri = NULL; mp_media_info_get_file_path(track, &uri); - Evas_Object *part_content = elm_object_item_part_content_get(item->it, "elm.swallow.icon"); + Evas_Object *part_content = + elm_object_item_part_content_get(item->it, "elm.swallow.icon"); if (part_content) { elm_object_signal_emit(part_content, "show_default", "*"); } @@ -163,9 +166,14 @@ _mp_track_list_icon_get(void *data, Evas_Object * obj, const char *part) } if (match && part_content) { - if (((int)mp_player_mgr_get_state() == (int)PLAYER_STATE_PLAYING)) { + if (((int) mp_player_mgr_get_state() == + (int) PLAYER_STATE_PLAYING)) { elm_object_signal_emit(part_content, "show_play", "*"); - } else if (((int)mp_player_mgr_get_state() == (int)PLAYER_STATE_PAUSED) || ((int)mp_player_mgr_get_state() == (int)PLAYER_STATE_READY)) { + } else + if (((int) mp_player_mgr_get_state() == + (int) PLAYER_STATE_PAUSED) + || ((int) mp_player_mgr_get_state() == + (int) PLAYER_STATE_READY)) { elm_object_signal_emit(part_content, "show_pause", "*"); } } @@ -181,19 +189,28 @@ _mp_track_list_icon_get(void *data, Evas_Object * obj, const char *part) char *filepath = NULL; mp_media_info_get_file_path(track, &filepath); if (mp_util_is_in_personal_page(filepath)) { - icon = mp_widget_lock_icon_create(obj, (const char *)thumbpath); + icon = + mp_widget_lock_icon_create(obj, (const char *) thumbpath); } else { - icon = mp_util_create_lazy_update_thumb_icon(obj, thumbpath, MP_LIST_ICON_SIZE, MP_LIST_ICON_SIZE); + icon = + mp_util_create_lazy_update_thumb_icon(obj, thumbpath, + MP_LIST_ICON_SIZE, + MP_LIST_ICON_SIZE); } #else - icon = mp_util_create_lazy_update_thumb_icon(obj, thumbpath, MP_LIST_ICON_SIZE, MP_LIST_ICON_SIZE); + icon = + mp_util_create_lazy_update_thumb_icon(obj, thumbpath, + MP_LIST_ICON_SIZE, + MP_LIST_ICON_SIZE); #endif - elm_layout_theme_set(content, "layout", "list/B/music.type.1", "default"); + elm_layout_theme_set(content, "layout", "list/B/music.type.1", + "default"); elm_layout_content_set(content, "elm.swallow.content", icon); PROFILE_OUT("_mp_track_list_icon_get"); if (match && content) { - if ((int)mp_player_mgr_get_state() == (int)PLAYER_STATE_PLAYING) { + if ((int) mp_player_mgr_get_state() == + (int) PLAYER_STATE_PLAYING) { elm_object_signal_emit(content, "show_play", "*"); } else { elm_object_signal_emit(content, "show_pause", "*"); @@ -214,7 +231,9 @@ _mp_track_list_icon_get(void *data, Evas_Object * obj, const char *part) check = elm_check_add(obj); elm_object_style_set(check, "default"); evas_object_propagate_events_set(check, EINA_FALSE); - evas_object_smart_callback_add(check, "changed", mp_common_view_check_changed_cb, NULL); + evas_object_smart_callback_add(check, "changed", + mp_common_view_check_changed_cb, + NULL); elm_check_state_pointer_set(check, &item->checked); return check; @@ -225,10 +244,13 @@ _mp_track_list_icon_get(void *data, Evas_Object * obj, const char *part) if (!strcmp(part, "elm.swallow.end")) { Evas_Object *thumbnail = NULL; thumbnail = elm_image_add(obj); - elm_image_file_set(thumbnail, IMAGE_EDJ_NAME, MP_LITE_REORDER_ICON); + elm_image_file_set(thumbnail, IMAGE_EDJ_NAME, + MP_LITE_REORDER_ICON); evas_object_color_set(thumbnail, 8, 8, 8, 204); - evas_object_size_hint_align_set(thumbnail, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(thumbnail, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(thumbnail, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_size_hint_weight_set(thumbnail, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); return thumbnail; } @@ -238,8 +260,7 @@ _mp_track_list_icon_get(void *data, Evas_Object * obj, const char *part) return NULL; } -static void -_mp_track_list_item_del_cb(void *data, Evas_Object * obj) +static void _mp_track_list_item_del_cb(void *data, Evas_Object * obj) { mp_list_item_data_t *item_data = data; MP_CHECK(item_data); @@ -261,12 +282,17 @@ _mp_track_genlist_sel_cb(void *data, Evas_Object * obj, void *event_info) struct appdata *ad = mp_util_get_appdata(); MP_CHECK(ad); if (_mp_is_current_focus_available(ad) != 0) { - ERROR_TRACE("Some other application has the focus currently... Returning..."); + ERROR_TRACE + ("Some other application has the focus currently... Returning..."); char *message = STR_MP_UNABLE_TO_PLAY_DURING_CALL; if (message) { - int ret = notification_status_message_post(dgettext("music-player", message)); + int ret = + notification_status_message_post(dgettext + ("music-player", + message)); if (ret != 0) { - ERROR_TRACE("notification_status_message_post()... [0x%x]", ret); + ERROR_TRACE("notification_status_message_post()... [0x%x]", + ret); } else { DEBUG_TRACE("message: [%s]", message); } @@ -274,7 +300,8 @@ _mp_track_genlist_sel_cb(void *data, Evas_Object * obj, void *event_info) return; } - mp_list_item_data_t *item = (mp_list_item_data_t *) elm_object_item_data_get(gli); + mp_list_item_data_t *item = + (mp_list_item_data_t *) elm_object_item_data_get(gli); MP_CHECK(item); if (list->edit_mode) { @@ -286,14 +313,15 @@ _mp_track_genlist_sel_cb(void *data, Evas_Object * obj, void *event_info) } if (!list->reorderable) { - mp_common_play_track_list_with_playlist_id(item, obj, list->playlist_id); + mp_common_play_track_list_with_playlist_id(item, obj, + list->playlist_id); } return; } static void -_mp_track_list_albumart_index_list_destroy(MpTrackList_t *list) +_mp_track_list_albumart_index_list_destroy(MpTrackList_t * list) { MP_CHECK(list); MP_CHECK(list->albumart_index_list); @@ -314,15 +342,19 @@ _mp_track_list_albumart_index_list_destroy(MpTrackList_t *list) } static void -_mp_track_list_albumart_index_shortcut_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source) +_mp_track_list_albumart_index_shortcut_clicked_cb(void *data, + Evas_Object * obj, + const char *emission, + const char *source) { MpTrackList_t *list = data; MP_CHECK(list); MP_CHECK(list->albumart_index_list); - int index = (int)evas_object_data_get(obj, "index"); + int index = (int) evas_object_data_get(obj, "index"); EVENT_TRACE("shortcut index = %d", index); - albumart_info_s *albumart = g_list_nth_data(list->albumart_index_list, index); + albumart_info_s *albumart = + g_list_nth_data(list->albumart_index_list, index); MP_CHECK(albumart); MP_CHECK(list->genlist); @@ -331,7 +363,8 @@ _mp_track_list_albumart_index_shortcut_clicked_cb(void *data, Evas_Object *obj, Elm_Object_Item *item = mp_list_first_item_get(list->genlist); while (item) { mp_list_item_data_t *data = elm_object_item_data_get(item); - if (data && data->handle && data->item_type == MP_LIST_ITEM_TYPE_NORMAL) { + if (data && data->handle + && data->item_type == MP_LIST_ITEM_TYPE_NORMAL) { mp_media_info_get_album(data->handle, &album); if (!g_strcmp0(album, albumart->name)) { mp_list_item_selected_set(item, EINA_TRUE); @@ -342,12 +375,16 @@ _mp_track_list_albumart_index_shortcut_clicked_cb(void *data, Evas_Object *obj, } } -static Evas_Object * -_mp_track_list_albumart_index_contnet_get_cb(void *data, Evas_Object *obj, const char *part) +static Evas_Object *_mp_track_list_albumart_index_contnet_get_cb(void + *data, + Evas_Object + *obj, + const char + *part) { mp_list_item_data_t *item_data = data; MP_CHECK_NULL(item_data); - MpTrackList_t *list = (MpTrackList_t *)item_data->handle; + MpTrackList_t *list = (MpTrackList_t *) item_data->handle; MP_CHECK_NULL(list); MP_CHECK_NULL(list->albumart_index_list); @@ -362,16 +399,20 @@ _mp_track_list_albumart_index_contnet_get_cb(void *data, Evas_Object *obj, const Evas_Object *layout = NULL; - char *group = g_strdup_printf("playlist_shortcut_layout_%d", shortcut_count); + char *group = + g_strdup_printf("playlist_shortcut_layout_%d", shortcut_count); layout = mp_common_load_edj(obj, MP_EDJ_NAME, group); IF_FREE(group); - evas_object_size_hint_min_set(layout, ALBUMART_INDEX_SIZE, ALBUMART_INDEX_SIZE * elm_config_scale_get()); + evas_object_size_hint_min_set(layout, ALBUMART_INDEX_SIZE, + ALBUMART_INDEX_SIZE * + elm_config_scale_get()); int i = 0; int size = 0; for (; i < shortcut_count; i++) { - albumart_info_s *info = g_list_nth_data(list->albumart_index_list, i); + albumart_info_s *info = + g_list_nth_data(list->albumart_index_list, i); if (info) { if (shortcut_count == 1) { size = ALBUMART_INDEX_SIZE; @@ -383,8 +424,12 @@ _mp_track_list_albumart_index_contnet_get_cb(void *data, Evas_Object *obj, const size = size * 2; } } - Evas_Object *shortcut = mp_widget_shorcut_box_add(layout, NULL, info->path, NULL, size, size, _mp_track_list_albumart_index_shortcut_clicked_cb, list); - evas_object_data_set(shortcut, "index", (void *)i); + Evas_Object *shortcut = + mp_widget_shorcut_box_add(layout, NULL, info->path, NULL, + size, size, + _mp_track_list_albumart_index_shortcut_clicked_cb, + list); + evas_object_data_set(shortcut, "index", (void *) i); char *part = g_strdup_printf("elm.icon.%d", i + 1); elm_object_part_content_set(layout, part, shortcut); IF_FREE(part); @@ -395,7 +440,7 @@ _mp_track_list_albumart_index_contnet_get_cb(void *data, Evas_Object *obj, const } static void -_mp_track_list_albumart_index_item_del_cb(void *data, Evas_Object *obj) +_mp_track_list_albumart_index_item_del_cb(void *data, Evas_Object * obj) { mp_list_item_data_t *item_data = data; MP_CHECK(item_data); @@ -403,7 +448,7 @@ _mp_track_list_albumart_index_item_del_cb(void *data, Evas_Object *obj) MpTrackList_t *list = evas_object_data_get(obj, "list_data"); MP_CHECK(list); - if (list->albumart_index_item == item_data->it) { + if (list->albumart_index_item == item_data->it) { list->albumart_index_item = NULL; } } @@ -416,14 +461,15 @@ _mp_track_list_album_index_list_with_sort(const void *a, const void *b) return -1; } - albumart_info_s *a_album = (albumart_info_s *)a; - albumart_info_s *b_album = (albumart_info_s *)b; + albumart_info_s *a_album = (albumart_info_s *) a; + albumart_info_s *b_album = (albumart_info_s *) b; return (b_album->count - a_album->count); } static void -_mp_track_list_albumart_index_list_append(MpTrackList_t *list, const mp_media_info_h media) +_mp_track_list_albumart_index_list_append(MpTrackList_t * list, + const mp_media_info_h media) { MP_CHECK(list); MP_CHECK(media); @@ -449,9 +495,10 @@ _mp_track_list_albumart_index_list_append(MpTrackList_t *list, const mp_media_in char *path = NULL; mp_media_info_get_thumbnail_path(media, &path); if (path == NULL || strlen(path) == 0) { - char default_thumbnail[1024] = {0}; + char default_thumbnail[1024] = { 0 }; char *shared_path = app_get_shared_resource_path(); - snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, "shared_images", DEFAULT_THUMBNAIL); + snprintf(default_thumbnail, 1024, "%s%s/%s", shared_path, + "shared_images", DEFAULT_THUMBNAIL); free(shared_path); path = g_strdup(default_thumbnail); } @@ -464,10 +511,11 @@ _mp_track_list_albumart_index_list_append(MpTrackList_t *list, const mp_media_in album->path = g_strdup(path); album->count = 1; - list->albumart_index_list = g_list_append(list->albumart_index_list, album); + list->albumart_index_list = + g_list_append(list->albumart_index_list, album); } -void mp_track_list_update_albumart_index(MpTrackList_t *list) +void mp_track_list_update_albumart_index(MpTrackList_t * list) { startfunc; MP_CHECK(list); @@ -483,7 +531,9 @@ void mp_track_list_update_albumart_index(MpTrackList_t *list) MP_CHECK(list->index_type == MP_TRACK_LIST_INDEX_ALBUM_ART_LIST); int count = 0; - mp_media_info_list_count(list->track_type, list->type_str, list->type_str2, list->filter_str, list->playlist_id, &count); + mp_media_info_list_count(list->track_type, list->type_str, + list->type_str2, list->filter_str, + list->playlist_id, &count); MP_CHECK(count); static Elm_Genlist_Item_Class itc; @@ -492,10 +542,13 @@ void mp_track_list_update_albumart_index(MpTrackList_t *list) itc.func.del = _mp_track_list_albumart_index_item_del_cb; mp_media_list_h svc_handle = NULL; - mp_media_info_list_create(&svc_handle, list->track_type, list->type_str, list->type_str2, list->filter_str, list->playlist_id, 0, count); + mp_media_info_list_create(&svc_handle, list->track_type, + list->type_str, list->type_str2, + list->filter_str, list->playlist_id, 0, + count); MP_CHECK(svc_handle); int i = 0; - for (; i < count ; i++) { + for (; i < count; i++) { mp_media_info_h media = mp_media_info_list_nth_item(svc_handle, i); _mp_track_list_albumart_index_list_append(list, media); } @@ -503,28 +556,36 @@ void mp_track_list_update_albumart_index(MpTrackList_t *list) if (list->albumart_index_list) { if (list->playlist_id > 0) { - list->albumart_index_list = g_list_sort(list->albumart_index_list, _mp_track_list_album_index_list_with_sort); + list->albumart_index_list = + g_list_sort(list->albumart_index_list, + _mp_track_list_album_index_list_with_sort); } - mp_list_item_data_t *item_data = calloc(1, sizeof(mp_list_item_data_t)); + mp_list_item_data_t *item_data = + calloc(1, sizeof(mp_list_item_data_t)); MP_CHECK(item_data); item_data->index = -1; item_data->item_type = MP_LIST_ITEM_TYPE_ALBUMART_INDEX; - item_data->handle = (mp_media_info_h)list; + item_data->handle = (mp_media_info_h) list; - item_data->it = elm_genlist_item_prepend(list->genlist, &itc, item_data, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); - elm_genlist_item_select_mode_set(item_data->it, ELM_OBJECT_SELECT_MODE_NONE); + item_data->it = + elm_genlist_item_prepend(list->genlist, &itc, item_data, NULL, + ELM_GENLIST_ITEM_NONE, NULL, NULL); + elm_genlist_item_select_mode_set(item_data->it, + ELM_OBJECT_SELECT_MODE_NONE); list->albumart_index_item = item_data->it; } endfunc; } -MpCloudView_e mp_track_list_get_cloud_view(MpTrackList_t *list) +MpCloudView_e mp_track_list_get_cloud_view(MpTrackList_t * list) { return list->cloud_view_type; } -static void _mp_track_list_append_item(MpTrackList_t *list, mp_media_list_h svc_handle, int count) +static void _mp_track_list_append_item(MpTrackList_t * list, + mp_media_list_h svc_handle, + int count) { int index = 0; @@ -536,8 +597,9 @@ static void _mp_track_list_append_item(MpTrackList_t *list, mp_media_list_h svc_ char *path = NULL; mp_media_info_get_file_path(item, &path); - if (mp_util_is_in_personal_page((const char *)path)) { - if (list->personal_page_type == MP_LIST_PERSONAL_PAGE_ADD || !mp_util_is_personal_page_on()) { + if (mp_util_is_in_personal_page((const char *) path)) { + if (list->personal_page_type == MP_LIST_PERSONAL_PAGE_ADD + || !mp_util_is_personal_page_on()) { DEBUG_TRACE("ignore the items out of personal storage"); continue; } @@ -556,18 +618,21 @@ static void _mp_track_list_append_item(MpTrackList_t *list, mp_media_list_h svc_ char *file_path = NULL; mp_media_info_get_file_path(item, &file_path); - item_data->checked = mp_list_is_in_checked_path_list(list->checked_path_list, file_path); - - item_data->it = elm_genlist_item_append(list->genlist, list->itc, item_data, NULL, - ELM_GENLIST_ITEM_NONE, _mp_track_genlist_sel_cb, list); + item_data->checked = + mp_list_is_in_checked_path_list(list->checked_path_list, + file_path); + + item_data->it = + elm_genlist_item_append(list->genlist, list->itc, item_data, + NULL, ELM_GENLIST_ITEM_NONE, + _mp_track_genlist_sel_cb, list); elm_object_item_data_set(item_data->it, item_data); } endfunc; } -static Eina_Bool -_mp_track_list_lazy_load(void *thiz) +static Eina_Bool _mp_track_list_lazy_load(void *thiz) { startfunc; int count = 0, res = 0; @@ -575,15 +640,21 @@ _mp_track_list_lazy_load(void *thiz) mp_media_list_h svc_handle = NULL; MP_CHECK_FALSE(list); - res = mp_media_info_list_count(list->track_type, list->type_str, list->type_str2, list->filter_str, list->playlist_id, &count); + res = + mp_media_info_list_count(list->track_type, list->type_str, + list->type_str2, list->filter_str, + list->playlist_id, &count); MP_CHECK_FALSE(res == 0); count = count - INITIAL_LOAD_COUNT; - mp_media_info_list_create(&svc_handle, list->track_type, list->type_str, list->type_str2, list->filter_str, list->playlist_id, INITIAL_LOAD_COUNT, count); + mp_media_info_list_create(&svc_handle, list->track_type, + list->type_str, list->type_str2, + list->filter_str, list->playlist_id, + INITIAL_LOAD_COUNT, count); _mp_track_list_append_item(list, svc_handle, count); -// mp_list_bottom_counter_item_append((MpList_t *)list); +// mp_list_bottom_counter_item_append((MpList_t *)list); if (list->track_list[1]) { mp_media_info_list_destroy(list->track_list[1]); @@ -591,7 +662,7 @@ _mp_track_list_lazy_load(void *thiz) list->track_list[1] = svc_handle; list->load_timer = NULL; - if (mp_list_get_edit((MpList_t *)list) || list->get_by_view) { + if (mp_list_get_edit((MpList_t *) list) || list->get_by_view) { MpView_t *view = mp_view_mgr_get_top_view(GET_VIEW_MGR); if (view) { mp_view_update_options(view); @@ -601,8 +672,8 @@ _mp_track_list_lazy_load(void *thiz) } -static char * -_mp_track_list_shuffle_text_get(void *data, Evas_Object *obj, const char *part) +static char *_mp_track_list_shuffle_text_get(void *data, Evas_Object * obj, + const char *part) { char *markup = NULL; static char result[DEF_STR_LEN + 1] = { 0, }; @@ -613,13 +684,18 @@ _mp_track_list_shuffle_text_get(void *data, Evas_Object *obj, const char *part) int r = 21; int g = 108; int b = 148; - int a = 255 ; + int a = 255; - markup = (list->track_count == 1) ? g_strdup(GET_STR(STR_MP_SHUFFLE_1_TRACK)) : g_strdup_printf(GET_STR(STR_MP_SHUFFLE_PD_TRACKS), list->track_count); + markup = + (list->track_count == + 1) ? g_strdup(GET_STR(STR_MP_SHUFFLE_1_TRACK)) : + g_strdup_printf(GET_STR(STR_MP_SHUFFLE_PD_TRACKS), + list->track_count); memset(result, 0x00, DEF_STR_LEN + 1); snprintf(result, DEF_STR_LEN, - "%s", r, g, b, a, markup); + "%s", r, g, b, a, + markup); IF_FREE(markup); return g_strdup(result); @@ -627,18 +703,22 @@ _mp_track_list_shuffle_text_get(void *data, Evas_Object *obj, const char *part) return NULL; } -Evas_Object * -_mp_track_list_shuffle_icon_get(void *data, Evas_Object * obj, const char *part) +Evas_Object *_mp_track_list_shuffle_icon_get(void *data, Evas_Object * obj, + const char *part) { Evas_Object *content = NULL; content = elm_layout_add(obj); if (!strcmp(part, "elm.swallow.icon")) { Evas_Object *icon; - icon = mp_util_create_image(obj, IMAGE_EDJ_NAME, MP_LITE_SHUFFLE_ICON, MP_LIST_SHUFFLE_ICON_SIZE, MP_LIST_SHUFFLE_ICON_SIZE); + icon = + mp_util_create_image(obj, IMAGE_EDJ_NAME, MP_LITE_SHUFFLE_ICON, + MP_LIST_SHUFFLE_ICON_SIZE, + MP_LIST_SHUFFLE_ICON_SIZE); evas_object_color_set(icon, 21, 108, 148, 255); - elm_layout_theme_set(content, "layout", "list/B/music.type.3", "default"); + elm_layout_theme_set(content, "layout", "list/B/music.type.3", + "default"); elm_layout_content_set(content, "elm.swallow.content", icon); return content; @@ -659,10 +739,12 @@ _mp_track_list_shuffle_cb(void *data, Evas_Object * obj, void *event_info) MpList_t *list = data; MP_CHECK(list); - mp_list_item_data_t *item = (mp_list_item_data_t *) elm_object_item_data_get(gli); + mp_list_item_data_t *item = + (mp_list_item_data_t *) elm_object_item_data_get(gli); MP_CHECK(item); mp_play_control_shuffle_set(NULL, true); - mp_common_play_track_list_with_playlist_id(item, obj, list->playlist_id); + mp_common_play_track_list_with_playlist_id(item, obj, + list->playlist_id); return; } @@ -674,7 +756,7 @@ _mp_track_list_shuffle_item_del_cb(void *data, Evas_Object * obj) SAFE_FREE(item_data); } -static void _mp_track_list_append_shuffle_item(MpTrackList_t *list) +static void _mp_track_list_append_shuffle_item(MpTrackList_t * list) { startfunc; MP_CHECK(list); @@ -683,10 +765,11 @@ static void _mp_track_list_append_shuffle_item(MpTrackList_t *list) list->itc_shuffle = elm_genlist_item_class_new(); MP_CHECK(list->itc_shuffle); //list->itc_shuffle->item_style = "music/1line";//"music/3text.1icon.2" - list->itc_shuffle->item_style = "default";//"music/3text.1icon.2" + list->itc_shuffle->item_style = "default"; //"music/3text.1icon.2" list->itc_shuffle->func.text_get = _mp_track_list_shuffle_text_get; list->itc_shuffle->decorate_all_item_style = NULL; - list->itc_shuffle->func.content_get = _mp_track_list_shuffle_icon_get; + list->itc_shuffle->func.content_get = + _mp_track_list_shuffle_icon_get; list->itc_shuffle->func.del = _mp_track_list_shuffle_item_del_cb; } @@ -695,8 +778,10 @@ static void _mp_track_list_append_shuffle_item(MpTrackList_t *list) MP_CHECK(item_data); item_data->item_type = MP_LIST_ITEM_TYPE_SHUFFLE; - item_data->it = list->shuffle_it = elm_genlist_item_append(list->genlist, list->itc_shuffle, item_data, NULL, - ELM_GENLIST_ITEM_NONE, _mp_track_list_shuffle_cb, list); + item_data->it = list->shuffle_it = + elm_genlist_item_append(list->genlist, list->itc_shuffle, + item_data, NULL, ELM_GENLIST_ITEM_NONE, + _mp_track_list_shuffle_cb, list); elm_object_item_data_set(item_data->it, item_data); @@ -710,7 +795,8 @@ void mp_track_list_show_shuffle(void *thiz, bool show) MpTrackList_t *list = thiz; MP_CHECK(list->genlist); - DEBUG_TRACE("show shuffle: %d list->shuffle_it: %0x", show, list->shuffle_it); + DEBUG_TRACE("show shuffle: %d list->shuffle_it: %0x", show, + list->shuffle_it); if (show) { _mp_track_list_append_shuffle_item(list); } else if (list->shuffle_it) { @@ -753,10 +839,10 @@ static void _mp_track_list_load_list(void *thiz, int count) MpTrackList_t *list = thiz; MP_CHECK(list); - /*media-svc related*/ + /*media-svc related */ mp_media_list_h svc_handle = NULL; - /*clear genlist*/ + /*clear genlist */ Elm_Object_Item *item = elm_genlist_first_item_get(list->genlist); if (item) { elm_genlist_item_bring_in(item, ELM_GENLIST_ITEM_SCROLLTO_IN); @@ -768,13 +854,17 @@ static void _mp_track_list_load_list(void *thiz, int count) mp_ecore_timer_del(list->load_timer); if (list->track_type == MP_TRACK_ALL && count > INITIAL_LOAD_COUNT) { count = INITIAL_LOAD_COUNT; - list->load_timer = ecore_timer_add(0.4, _mp_track_list_lazy_load, list); + list->load_timer = + ecore_timer_add(0.4, _mp_track_list_lazy_load, list); } - /*get data from DB*/ + /*get data from DB */ PROFILE_IN("mp_media_info_list_create"); - mp_media_info_list_create(&svc_handle, list->track_type, list->type_str, list->type_str2, list->filter_str, list->playlist_id, 0, count); + mp_media_info_list_create(&svc_handle, list->track_type, + list->type_str, list->type_str2, + list->filter_str, list->playlist_id, 0, + count); PROFILE_OUT("mp_media_info_list_create"); if (!list->edit_mode) { @@ -791,6 +881,7 @@ static void _mp_track_list_load_list(void *thiz, int count) list->track_list[0] = svc_handle; } + static void _mp_track_list_destory_cb(void *thiz) { eventfunc; @@ -834,7 +925,8 @@ static void _mp_track_list_destory_cb(void *thiz) free(list); } -static void _mp_track_list_item_highlighted(void *data, Evas_Object *obj, void *event_info) +static void _mp_track_list_item_highlighted(void *data, Evas_Object * obj, + void *event_info) { MpTrackList_t *list = data; MP_CHECK(list); @@ -843,14 +935,18 @@ static void _mp_track_list_item_highlighted(void *data, Evas_Object *obj, void * MP_CHECK(it); if (list->shuffle_it == it) { - Evas_Object *icon = elm_object_item_part_content_get(it, "elm.icon.2"); + Evas_Object *icon = + elm_object_item_part_content_get(it, "elm.icon.2"); if (icon) { - elm_image_file_set(icon, IMAGE_EDJ_NAME, MP_ICON_SHUFFLE_PRESS); + elm_image_file_set(icon, IMAGE_EDJ_NAME, + MP_ICON_SHUFFLE_PRESS); } } } -static void _mp_track_list_item_unhighlighted(void *data, Evas_Object *obj, void *event_info) +static void _mp_track_list_item_unhighlighted(void *data, + Evas_Object * obj, + void *event_info) { MpTrackList_t *list = data; MP_CHECK(list); @@ -859,7 +955,8 @@ static void _mp_track_list_item_unhighlighted(void *data, Evas_Object *obj, void MP_CHECK(it); if (list->shuffle_it == it) { - Evas_Object *icon = elm_object_item_part_content_get(it, "elm.icon.2"); + Evas_Object *icon = + elm_object_item_part_content_get(it, "elm.icon.2"); if (icon) { elm_image_file_set(icon, IMAGE_EDJ_NAME, MP_ICON_SHUFFLE); } @@ -874,29 +971,36 @@ static void _mp_track_list_update(void *thiz) MP_CHECK(list); PROFILE_IN("mp_media_info_list_count"); - res = mp_media_info_list_count(list->track_type, list->type_str, list->type_str2, list->filter_str, list->playlist_id, &count); + res = + mp_media_info_list_count(list->track_type, list->type_str, + list->type_str2, list->filter_str, + list->playlist_id, &count); PROFILE_OUT("mp_media_info_list_count"); MP_CHECK(res == 0); list->track_count = count; if (list->get_by_view == false) { mp_list_free_checked_path_list(list->checked_path_list); - list->checked_path_list = mp_list_get_checked_path_list((MpList_t *)list); + list->checked_path_list = + mp_list_get_checked_path_list((MpList_t *) list); } mp_evas_object_del(list->no_content); mp_evas_object_del(list->genlist); if (count) { - /*create new genlist*/ + /*create new genlist */ PROFILE_IN("elm_genlist_add"); list->genlist = mp_widget_genlist_create(list->box); - elm_scroller_policy_set(list->genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); - evas_object_size_hint_weight_set(list->genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(list->genlist, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_scroller_policy_set(list->genlist, ELM_SCROLLER_POLICY_OFF, + ELM_SCROLLER_POLICY_AUTO); + evas_object_size_hint_weight_set(list->genlist, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(list->genlist, EVAS_HINT_FILL, + EVAS_HINT_FILL); elm_genlist_homogeneous_set(list->genlist, EINA_TRUE); elm_genlist_mode_set(list->genlist, ELM_LIST_COMPRESS); evas_object_show(list->genlist); - /*packet genlist to box*/ + /*packet genlist to box */ elm_box_pack_end(list->box, list->genlist); evas_object_data_set(list->genlist, "list_data", list); @@ -912,24 +1016,32 @@ static void _mp_track_list_update(void *thiz) } if (list->reorderable) { - evas_object_smart_callback_add(list->genlist, "moved", mp_list_item_reorder_moved_cb, list); + evas_object_smart_callback_add(list->genlist, "moved", + mp_list_item_reorder_moved_cb, + list); } /* - evas_object_smart_callback_add(list->genlist, "drag,start,left", list->flick_left_cb, NULL); - evas_object_smart_callback_add(list->genlist, "drag,start,right", list->flick_right_cb, NULL); - evas_object_smart_callback_add(list->genlist, "drag,stop", list->flick_stop_cb, NULL); - - evas_object_smart_callback_add(list->genlist, "drag,start,right", list->mode_right_cb, NULL); - evas_object_smart_callback_add(list->genlist, "drag,start,left", list->mode_left_cb, NULL); - evas_object_smart_callback_add(list->genlist, "drag,start,up", list->mode_cancel_cb, NULL); - evas_object_smart_callback_add(list->genlist, "drag,start,down", list->mode_cancel_cb, NULL); - */ + evas_object_smart_callback_add(list->genlist, "drag,start,left", list->flick_left_cb, NULL); + evas_object_smart_callback_add(list->genlist, "drag,start,right", list->flick_right_cb, NULL); + evas_object_smart_callback_add(list->genlist, "drag,stop", list->flick_stop_cb, NULL); + + evas_object_smart_callback_add(list->genlist, "drag,start,right", list->mode_right_cb, NULL); + evas_object_smart_callback_add(list->genlist, "drag,start,left", list->mode_left_cb, NULL); + evas_object_smart_callback_add(list->genlist, "drag,start,up", list->mode_cancel_cb, NULL); + evas_object_smart_callback_add(list->genlist, "drag,start,down", list->mode_cancel_cb, NULL); + */ //evas_object_smart_callback_add(list->genlist, "longpressed", _mp_track_list_item_longpressed_cb, list); - evas_object_smart_callback_add(list->genlist, "scroll,drag,start", list->drag_start_cb, list); - evas_object_smart_callback_add(list->genlist, "scroll,drag,stop", list->drag_stop_cb, list); - evas_object_smart_callback_add(list->genlist, "highlighted", _mp_track_list_item_highlighted, list); - evas_object_smart_callback_add(list->genlist, "unhighlighted", _mp_track_list_item_unhighlighted, list); + evas_object_smart_callback_add(list->genlist, "scroll,drag,start", + list->drag_start_cb, list); + evas_object_smart_callback_add(list->genlist, "scroll,drag,stop", + list->drag_stop_cb, list); + evas_object_smart_callback_add(list->genlist, "highlighted", + _mp_track_list_item_highlighted, + list); + evas_object_smart_callback_add(list->genlist, "unhighlighted", + _mp_track_list_item_unhighlighted, + list); PROFILE_OUT("elm_genlist_add"); /* load list */ @@ -945,35 +1057,49 @@ static void _mp_track_list_update(void *thiz) return; } -NoContents: + NoContents: list->hide_fastscroll(list); mp_evas_object_del(list->genlist); if (!list->no_content) { - if (list->track_type > MP_TRACK_TYPE_PLAYLIST_MIN && list->track_type < MP_TRACK_TYPE_PLAYLIST_MAX) { + if (list->track_type > MP_TRACK_TYPE_PLAYLIST_MIN + && list->track_type < MP_TRACK_TYPE_PLAYLIST_MAX) { char *helptext = NULL; Evas_Smart_Cb callback = NULL; void *cb_data = NULL; if (list->track_type == MP_TRACK_BY_PLAYLIST) { char *playlist_name = NULL; - mp_media_info_group_get_main_info(list->playlist_handle, &playlist_name); + mp_media_info_group_get_main_info(list->playlist_handle, + &playlist_name); char *title = elm_entry_utf8_to_markup(playlist_name); - helptext = g_strdup_printf(GET_STR(STR_MP_YOU_CAN_ADD_TRACKS_THE_PLAYLIST_PD), title); + helptext = + g_strdup_printf(GET_STR + (STR_MP_YOU_CAN_ADD_TRACKS_THE_PLAYLIST_PD), + title); IF_FREE(title); //callback = mp_track_list_add_tracks_to_playlist_cb; //cb_data = list; } else if (list->track_type == MP_TRACK_BY_FAVORITE) { - helptext = g_strdup(STR_MP_AFTER_YOU_ADD_TRACK_TO_FAVOURITE); - } else if (list->track_type == MP_TRACK_BY_PLAYED_COUNT || list->track_type == MP_TRACK_BY_PLAYED_TIME) { - helptext = g_strdup(STR_MP_AFTER_YOU_PLAY_TRACKS_THEY_WILL_BE_SHOWN); + helptext = + g_strdup(STR_MP_AFTER_YOU_ADD_TRACK_TO_FAVOURITE); + } else if (list->track_type == MP_TRACK_BY_PLAYED_COUNT + || list->track_type == MP_TRACK_BY_PLAYED_TIME) { + helptext = + g_strdup + (STR_MP_AFTER_YOU_PLAY_TRACKS_THEY_WILL_BE_SHOWN); } else if (list->track_type == MP_TRACK_BY_ADDED_TIME) { helptext = g_strdup(STR_MP_AFTER_YOU_DOWNLOAD_TRACKS); } - list->no_content = mp_widget_create_no_content_playlist(list->box, helptext, callback, cb_data); + list->no_content = + mp_widget_create_no_content_playlist(list->box, helptext, + callback, cb_data); IF_FREE(helptext); } else { - list->no_content = mp_widget_create_no_contents(list->box, MP_NOCONTENT_TRACKS, NULL, list); + list->no_content = + mp_widget_create_no_contents(list->box, + MP_NOCONTENT_TRACKS, NULL, + list); } elm_box_pack_end(list->box, list->no_content); } @@ -999,7 +1125,7 @@ static const char *_get_label(void *thiz, void *event_info) MP_CHECK_NULL(list); char *title = NULL; - mp_list_item_data_t *track = elm_object_item_data_get(event_info); + mp_list_item_data_t *track = elm_object_item_data_get(event_info); MP_CHECK_NULL(track); mp_media_info_get_title(track->handle, &title); @@ -1015,7 +1141,8 @@ static void _mp_track_list_set_edit(void *thiz, bool edit) mp_track_list_show_shuffle(list, false); /* check DRM FL */ - if (mp_list_get_edit_type((MpList_t*)list) == MP_LIST_EDIT_TYPE_SHARE) { + if (mp_list_get_edit_type((MpList_t *) list) == + MP_LIST_EDIT_TYPE_SHARE) { _mp_track_list_update(list); } @@ -1042,9 +1169,11 @@ _mp_track_list_get_editable_count(void *thiz, MpListEditType_e type) int count = elm_genlist_items_count(list->genlist); if (type == MP_LIST_EDIT_TYPE_SHARE) { - Elm_Object_Item *gl_item = elm_genlist_first_item_get(list->genlist); + Elm_Object_Item *gl_item = + elm_genlist_first_item_get(list->genlist); while (gl_item) { - mp_list_item_data_t *item_data = elm_object_item_data_get(gl_item); + mp_list_item_data_t *item_data = + elm_object_item_data_get(gl_item); if (item_data && item_data->handle) { char *path = NULL; mp_media_info_get_file_path(item_data->handle, &path); @@ -1065,13 +1194,15 @@ _mp_track_list_get_editable_count(void *thiz, MpListEditType_e type) return count; } -static char * -_mp_track_list_bottom_counter_text_cb(void *thiz) +static char *_mp_track_list_bottom_counter_text_cb(void *thiz) { MpTrackList_t *list = thiz; MP_CHECK_NULL(list); - unsigned int count = mp_list_get_editable_count((MpList_t *)list, mp_list_get_edit_type((MpList_t *)list)); + unsigned int count = + mp_list_get_editable_count((MpList_t *) list, + mp_list_get_edit_type((MpList_t *) + list)); char *text = NULL; if (count == 1) { @@ -1091,7 +1222,7 @@ static mp_group_type_e _mp_track_list_get_group_type(void *thiz) } -MpTrackList_t * mp_track_list_create(Evas_Object *parent) +MpTrackList_t *mp_track_list_create(Evas_Object * parent) { eventfunc; MP_CHECK_NULL(parent); @@ -1099,7 +1230,7 @@ MpTrackList_t * mp_track_list_create(Evas_Object *parent) MpTrackList_t *list = calloc(1, sizeof(MpTrackList_t)); MP_CHECK_NULL(list); - mp_list_init((MpList_t *)list, parent, MP_LIST_TYPE_TRACK); + mp_list_init((MpList_t *) list, parent, MP_LIST_TYPE_TRACK); list->update = _mp_track_list_update; list->destory_cb = _mp_track_list_destory_cb; @@ -1112,23 +1243,27 @@ MpTrackList_t * mp_track_list_create(Evas_Object *parent) list->set_edit = _mp_track_list_set_edit; list->get_count = _mp_track_list_get_editable_count; - list->bottom_counter_text_get_cb = _mp_track_list_bottom_counter_text_cb; + list->bottom_counter_text_get_cb = + _mp_track_list_bottom_counter_text_cb; return list; } -static void -_set_playlist_handle(MpTrackList_t *list) +static void _set_playlist_handle(MpTrackList_t * list) { int res = 0; int i, count = 0; mp_media_list_h media_list = NULL; mp_media_info_h media = NULL; - res = mp_media_info_group_list_count(MP_GROUP_BY_PLAYLIST, NULL, NULL, &count); + res = + mp_media_info_group_list_count(MP_GROUP_BY_PLAYLIST, NULL, NULL, + &count); MP_CHECK(res == 0); - res = mp_media_info_group_list_create(&media_list, MP_GROUP_BY_PLAYLIST, NULL, NULL, 0, count); + res = + mp_media_info_group_list_create(&media_list, MP_GROUP_BY_PLAYLIST, + NULL, NULL, 0, count); MP_CHECK(res == 0); for (i = 0; i < count; i++) { @@ -1148,7 +1283,7 @@ _set_playlist_handle(MpTrackList_t *list) } -void mp_track_list_set_data(MpTrackList_t *list, ...) +void mp_track_list_set_data(MpTrackList_t * list, ...) { startfunc; MP_CHECK(list); @@ -1162,66 +1297,66 @@ void mp_track_list_set_data(MpTrackList_t *list, ...) DEBUG_TRACE("field is %d", field); switch (field) { - case MP_TRACK_LIST_TYPE: { - int val = va_arg((var_args), int); + case MP_TRACK_LIST_TYPE:{ + int val = va_arg((var_args), int); - list->track_type = val; - DEBUG_TRACE("list->track_type = %d", list->track_type); - break; - } + list->track_type = val; + DEBUG_TRACE("list->track_type = %d", list->track_type); + break; + } - case MP_TRACK_LIST_PLAYLIT_ID: { - int val = va_arg((var_args), int); - list->playlist_id = val; - DEBUG_TRACE("list->playlist_id = %d", list->playlist_id); + case MP_TRACK_LIST_PLAYLIT_ID:{ + int val = va_arg((var_args), int); + list->playlist_id = val; + DEBUG_TRACE("list->playlist_id = %d", list->playlist_id); - _set_playlist_handle(list); + _set_playlist_handle(list); - break; - } + break; + } - case MP_TRACK_LIST_TYPE_STR: { - char *val = va_arg((var_args), char *); - SAFE_FREE(list->type_str); - list->type_str = g_strdup(val); - DEBUG_TRACE("list->type_str = %s", list->type_str); + case MP_TRACK_LIST_TYPE_STR:{ + char *val = va_arg((var_args), char *); + SAFE_FREE(list->type_str); + list->type_str = g_strdup(val); + DEBUG_TRACE("list->type_str = %s", list->type_str); - break; - } - case MP_TRACK_LIST_TYPE_STR2: { - char *val = va_arg((var_args), char *); - SAFE_FREE(list->type_str2); - list->type_str2 = g_strdup(val); - DEBUG_TRACE("list->type_str = %s", list->type_str2); + break; + } + case MP_TRACK_LIST_TYPE_STR2:{ + char *val = va_arg((var_args), char *); + SAFE_FREE(list->type_str2); + list->type_str2 = g_strdup(val); + DEBUG_TRACE("list->type_str = %s", list->type_str2); - break; - } - case MP_TRACK_LIST_FILTER_STR: { - char *val = va_arg((var_args), char *); - SAFE_FREE(list->filter_str); - list->filter_str = g_strdup(val); - DEBUG_TRACE("list->filter_str = %s", list->filter_str); + break; + } + case MP_TRACK_LIST_FILTER_STR:{ + char *val = va_arg((var_args), char *); + SAFE_FREE(list->filter_str); + list->filter_str = g_strdup(val); + DEBUG_TRACE("list->filter_str = %s", list->filter_str); - break; - } - case MP_TRACK_LIST_INDEX_TYPE: { - int val = va_arg((var_args), int); - list->index_type = (MpTrackListIndex_t)val; - DEBUG_TRACE("list->index_type = %d", list->index_type); - break; - } - case MP_TRACK_LIST_CLOUD_TYPE: { - int val = va_arg((var_args), int); - list->cloud_view_type = val; - DEBUG_TRACE("list->index_type = %d", list->index_type); - break; - } - case MP_TRACK_LIST_CHECKED_LIST: { - GList *val = va_arg((var_args), GList*); - list->checked_path_list = val; - list->get_by_view = true; - break; - } + break; + } + case MP_TRACK_LIST_INDEX_TYPE:{ + int val = va_arg((var_args), int); + list->index_type = (MpTrackListIndex_t) val; + DEBUG_TRACE("list->index_type = %d", list->index_type); + break; + } + case MP_TRACK_LIST_CLOUD_TYPE:{ + int val = va_arg((var_args), int); + list->cloud_view_type = val; + DEBUG_TRACE("list->index_type = %d", list->index_type); + break; + } + case MP_TRACK_LIST_CHECKED_LIST:{ + GList *val = va_arg((var_args), GList *); + list->checked_path_list = val; + list->get_by_view = true; + break; + } default: DEBUG_TRACE("Invalid arguments"); @@ -1232,7 +1367,7 @@ void mp_track_list_set_data(MpTrackList_t *list, ...) va_end(var_args); } -void mp_track_list_copy_data(MpTrackList_t *src, MpTrackList_t *dest) +void mp_track_list_copy_data(MpTrackList_t * src, MpTrackList_t * dest) { MP_CHECK(src); MP_CHECK(dest); @@ -1253,4 +1388,3 @@ void mp_track_list_copy_data(MpTrackList_t *src, MpTrackList_t *dest) dest->index_type = src->index_type; dest->cloud_view_type = src->cloud_view_type; } - diff --git a/widget/inc/mp_widget.h b/widget/inc/mp_widget.h index 525c511..d2d3aab 100644 --- a/widget/inc/mp_widget.h +++ b/widget/inc/mp_widget.h @@ -26,7 +26,7 @@ typedef struct _widget_data { Ecore_File_Monitor *em; } WidgetData; -int mp_widget_create(WidgetData* data, int w, int h); +int mp_widget_create(WidgetData * data, int w, int h); -#endif// MP_WIDGET_H +#endif // MP_WIDGET_H /* End of a file */ diff --git a/widget/inc/mp_widget_debug.h b/widget/inc/mp_widget_debug.h index 4cf8a21..9a8b30f 100644 --- a/widget/inc/mp_widget_debug.h +++ b/widget/inc/mp_widget_debug.h @@ -43,11 +43,11 @@ #endif #define DEBUG_TRACE(fmt, arg...) dlog_print(DLOG_DEBUG, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg) -#define INFO_TRACE(fmt, arg...) dlog_print(DLOG_INFO, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg) -#define WARN_TRACE(fmt, arg...) dlog_print(DLOG_WARN, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg) +#define INFO_TRACE(fmt, arg...) dlog_print(DLOG_INFO, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg) +#define WARN_TRACE(fmt, arg...) dlog_print(DLOG_WARN, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg) #define ERROR_TRACE(fmt, arg...) dlog_print(DLOG_ERROR, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg) -#define PARAM_CHECK(fmt, arg...) dlog_print(DLOG_WARN, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg) -#define EVENT_TRACE(fmt, arg...) dlog_print(DLOG_INFO, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg) +#define PARAM_CHECK(fmt, arg...) dlog_print(DLOG_WARN, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg) +#define EVENT_TRACE(fmt, arg...) dlog_print(DLOG_INFO, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##arg) #define SECURE_DEBUG(fmt, args...) dlog_print(DLOG_DEBUG, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##args) #define SECURE_INFO(fmt, args...) dlog_print(DLOG_INFO, LOG_TAG, "[%s : %05d %lu]" fmt "\n", __func__, __LINE__, gettid(), ##args) @@ -71,7 +71,7 @@ extern FILE *__file_log_fp; } while (0) #define mp_retvm_if(expr, val, fmt, arg...) do { \ - if(expr) { \ + if (expr) { \ PARAM_CHECK(fmt, ##arg); \ return (val); \ } \ @@ -102,5 +102,5 @@ extern FILE *__file_log_fp; #define PERF_MARK(tag) #endif -#endif// MP_WIDGET_DEBUG_H +#endif // MP_WIDGET_DEBUG_H /* End of a file */ diff --git a/widget/src/mp-widget-create.c b/widget/src/mp-widget-create.c index cd43f90..a3aae57 100644 --- a/widget/src/mp-widget-create.c +++ b/widget/src/mp-widget-create.c @@ -46,20 +46,20 @@ #define domain_name "music-player" #define BROKEN_ALBUMART_IMAGE_PATH "/opt/usr/share/media/.thumb/thumb_default.png" -#define DEFAULT_ALBUM_ART_ICON "default_albumart.png" +#define DEFAULT_ALBUM_ART_ICON "default_albumart.png" #define NOW_PLAYING_INI_PATH "NowPlayingStatus" static Eina_Bool is_play = EINA_FALSE; Eina_List *widget_list = NULL; -void mp_widget_win_del_cb(void *data, Evas *evas, Evas_Object *obj, - void *event_info) +void mp_widget_win_del_cb(void *data, Evas * evas, Evas_Object * obj, + void *event_info) { ecore_timer_del(data); } -void mp_widget_key_down_cb(void *data, Evas *evas, Evas_Object *obj, - void *event_info) +void mp_widget_key_down_cb(void *data, Evas * evas, Evas_Object * obj, + void *event_info) { elm_exit(); } @@ -74,8 +74,8 @@ static void mp_widget_read_ini_file_ecore(void *data, char *path) DEBUG_TRACE("Invalid path information"); return; } - WidgetData *wgtdata = (WidgetData *)data; - Evas_Object *layout = (Evas_Object *)wgtdata->layout; + WidgetData *wgtdata = (WidgetData *) data; + Evas_Object *layout = (Evas_Object *) wgtdata->layout; if (!layout) { DEBUG_TRACE("Invalid layout"); return; @@ -83,7 +83,7 @@ static void mp_widget_read_ini_file_ecore(void *data, char *path) Evas_Object *image_object = NULL; int line_count = 0; - char str[1000] = {0,}; + char str[1000] = { 0, }; char *image_path = NULL; FILE *file = fopen(path, "r"); @@ -126,12 +126,13 @@ static void mp_widget_read_ini_file_ecore(void *data, char *path) is_play = EINA_FALSE; } } - if ((char *)wgtdata->file_path) { - free((char *)wgtdata->file_path); + if ((char *) wgtdata->file_path) { + free((char *) wgtdata->file_path); wgtdata->file_path = NULL; } if (!strcmp(key, "uri")) { - wgtdata->file_path = (char *)malloc((strlen(value) + 1) * sizeof(char)); + wgtdata->file_path = + (char *) malloc((strlen(value) + 1) * sizeof(char)); if (wgtdata->file_path) { strncpy(wgtdata->file_path, value, strlen(value)); wgtdata->file_path[strlen(value)] = '\0'; @@ -141,12 +142,12 @@ static void mp_widget_read_ini_file_ecore(void *data, char *path) elm_object_part_text_set(layout, "track_title", value); } if (!strcmp(key, "artist")) { - elm_object_part_text_set(layout, "track_artist_title", - value); + elm_object_part_text_set(layout, "track_artist_title", value); } if (!strcmp(key, "thumbnail")) { if (value) { - image_path = (char *)malloc((strlen(value) + 1) * sizeof(char)); + image_path = + (char *) malloc((strlen(value) + 1) * sizeof(char)); if (image_path != NULL) { strncpy(image_path, value, strlen(value)); @@ -156,8 +157,10 @@ static void mp_widget_read_ini_file_ecore(void *data, char *path) free(image_path); image_path = NULL; char *shared_path = app_get_shared_resource_path(); - char default_icon[1024] = {0}; - snprintf(default_icon, 1024, "%s%s/%s", shared_path, "shared_images", DEFAULT_ALBUM_ART_ICON); + char default_icon[1024] = { 0 }; + snprintf(default_icon, 1024, "%s%s/%s", + shared_path, "shared_images", + DEFAULT_ALBUM_ART_ICON); free(shared_path); image_path = g_strdup(default_icon); } @@ -179,8 +182,9 @@ static void mp_widget_read_ini_file_ecore(void *data, char *path) free(image_path); image_path = NULL; char *shared_path = app_get_shared_resource_path(); - char default_icon[1024] = {0}; - snprintf(default_icon, 1024, "%s%s/%s", shared_path, "shared_images", DEFAULT_ALBUM_ART_ICON); + char default_icon[1024] = { 0 }; + snprintf(default_icon, 1024, "%s%s/%s", shared_path, + "shared_images", DEFAULT_ALBUM_ART_ICON); free(shared_path); image_path = g_strdup(default_icon); elm_image_file_set(image_object, image_path, NULL); @@ -199,7 +203,7 @@ static void mp_widget_read_ini_file_ecore(void *data, char *path) void __create_read_ini_file(void) { char *path = app_get_data_path(); - char playing_status[1024] = {0}; + char playing_status[1024] = { 0 }; if (path == NULL) { return; } @@ -227,23 +231,24 @@ static void mp_widget_read_ini_file(char *path, void *data) DEBUG_TRACE("Invalid path information"); return; } - WidgetData *wgtdata = (WidgetData *)data; - Evas_Object *layout = (Evas_Object *)wgtdata->layout; + WidgetData *wgtdata = (WidgetData *) data; + Evas_Object *layout = (Evas_Object *) wgtdata->layout; if (!layout) { DEBUG_TRACE("Invalid layout"); return; } - char buffer[1000 + 1] = {'\0'}; + char buffer[1000 + 1] = { '\0' }; Evas_Object *image_object = NULL; int line_count = 0; - char str[1000] = {0,}; + char str[1000] = { 0, }; char *image_path = NULL; FILE *file = fopen(path, "r"); if (!file) { __create_read_ini_file(); - ERROR_TRACE("ERROR VAlUE is (%d)", strerror_r(errno, buffer, 1000)); + ERROR_TRACE("ERROR VAlUE is (%d)", + strerror_r(errno, buffer, 1000)); ERROR_TRACE("Failed to open %s file", path); elm_object_signal_emit(layout, "no_music", "elm"); return; @@ -289,12 +294,13 @@ static void mp_widget_read_ini_file(char *path, void *data) is_play = EINA_FALSE; } } - if ((char *)wgtdata->file_path) { - free((char *)wgtdata->file_path); + if ((char *) wgtdata->file_path) { + free((char *) wgtdata->file_path); wgtdata->file_path = NULL; } if (!strcmp(key, "uri")) { - wgtdata->file_path = (char *)malloc((strlen(value) + 1) * sizeof(char)); + wgtdata->file_path = + (char *) malloc((strlen(value) + 1) * sizeof(char)); if (wgtdata->file_path) { strncpy(wgtdata->file_path, value, strlen(value)); @@ -305,12 +311,12 @@ static void mp_widget_read_ini_file(char *path, void *data) elm_object_part_text_set(layout, "track_title", value); } if (!strcmp(key, "artist")) { - elm_object_part_text_set(layout, "track_artist_title", - value); + elm_object_part_text_set(layout, "track_artist_title", value); } if (!strcmp(key, "thumbnail")) { if (value) { - image_path = (char*)malloc((strlen(value) + 1) * sizeof(char)); + image_path = + (char *) malloc((strlen(value) + 1) * sizeof(char)); if (image_path) { strncpy(image_path, value, strlen(value)); image_path[strlen(value)] = '\0'; @@ -333,8 +339,9 @@ static void mp_widget_read_ini_file(char *path, void *data) image_object = elm_image_add(layout); if (!elm_image_file_set(image_object, image_path, NULL)) { char *shared_path = app_get_shared_resource_path(); - char default_icon[1024] = {0}; - snprintf(default_icon, 1024, "%s%s/%s", shared_path, "shared_images", DEFAULT_ALBUM_ART_ICON); + char default_icon[1024] = { 0 }; + snprintf(default_icon, 1024, "%s%s/%s", shared_path, + "shared_images", DEFAULT_ALBUM_ART_ICON); free(shared_path); image_path = g_strdup(default_icon); elm_image_file_set(image_object, image_path, NULL); @@ -348,7 +355,10 @@ static void mp_widget_read_ini_file(char *path, void *data) fclose(file); } -static void mp_widget_music_player_result_callback(app_control_h request, app_control_h reply, app_control_result_e result, void *user_data) +static void mp_widget_music_player_result_callback(app_control_h request, + app_control_h reply, + app_control_result_e + result, void *user_data) { if (!user_data) { return; @@ -385,7 +395,9 @@ bool check_remote_message_port(void) int ret = -1; bool found = false; - ret = message_port_check_remote_port(APP_ID, MP_MESSAGE_PORT_LIVEBOX, &found); + ret = + message_port_check_remote_port(APP_ID, MP_MESSAGE_PORT_LIVEBOX, + &found); if (ret != MESSAGE_PORT_ERROR_NONE) { ERROR_TRACE("message_port_check_remote_port error : %d", ret); } @@ -400,10 +412,14 @@ static int message_port_init(const char *event) return ret; } -static int mp_widget_music_player_launch(void *data, char **extra_data_keys, - char **extra_data_values, int extra_data_length, Eina_Bool show_player, char *filepath) +static int mp_widget_music_player_launch(void *data, + char **extra_data_keys, + char **extra_data_values, + int extra_data_length, + Eina_Bool show_player, + char *filepath) { - Evas_Object *layout = (Evas_Object *)data; + Evas_Object *layout = (Evas_Object *) data; if (layout == NULL) { return -1; } @@ -420,7 +436,7 @@ static int mp_widget_music_player_launch(void *data, char **extra_data_keys, for (i = 0; i < extra_data_length; ++i) { app_control_add_extra_data(service, extra_data_keys[i], - extra_data_values[i]); + extra_data_values[i]); } if (!show_player) { @@ -431,7 +447,8 @@ static int mp_widget_music_player_launch(void *data, char **extra_data_keys, app_control_add_extra_data(service, "uri", filepath); ret = app_control_send_launch_request(service, - mp_widget_music_player_result_callback, layout); + mp_widget_music_player_result_callback, + layout); if (ret != APP_CONTROL_ERROR_NONE) { ERROR_TRACE("Failed to send launch request"); } @@ -441,15 +458,16 @@ static int mp_widget_music_player_launch(void *data, char **extra_data_keys, return ret; } -static void mp_widget_click_on_add_tracks_cb(void *data, Evas_Object *obj, - const char *emission, const char *source) +static void mp_widget_click_on_add_tracks_cb(void *data, Evas_Object * obj, + const char *emission, + const char *source) { if (!data) { DEBUG_TRACE("Invalid data"); return; } - WidgetData *wgtdata = (WidgetData *)data; - Evas_Object *layout = (Evas_Object *)wgtdata->layout; + WidgetData *wgtdata = (WidgetData *) data; + Evas_Object *layout = (Evas_Object *) wgtdata->layout; if (!layout) { DEBUG_TRACE("Invalid layout"); return; @@ -459,24 +477,25 @@ static void mp_widget_click_on_add_tracks_cb(void *data, Evas_Object *obj, char **extra_data_keys = NULL; char **extra_data_values = NULL; - extra_data_keys = (char **)malloc(extra_data_len * sizeof(char *)); + extra_data_keys = (char **) malloc(extra_data_len * sizeof(char *)); if (!extra_data_keys) { return; } - extra_data_values = (char **)malloc(extra_data_len * sizeof(char *)); + extra_data_values = (char **) malloc(extra_data_len * sizeof(char *)); if (!extra_data_values) { free(extra_data_keys); return; } for (i = 0; i < extra_data_len; ++i) { - extra_data_keys[i] = (char *)malloc(50); - extra_data_values[i] = (char *)malloc(50); + extra_data_keys[i] = (char *) malloc(50); + extra_data_values[i] = (char *) malloc(50); } mp_widget_music_player_launch(layout, extra_data_keys, - extra_data_values, extra_data_len, EINA_TRUE, NULL); + extra_data_values, extra_data_len, + EINA_TRUE, NULL); mp_widget_music_player_result(layout); for (i = 0; i < extra_data_len; ++i) { @@ -488,15 +507,17 @@ static void mp_widget_click_on_add_tracks_cb(void *data, Evas_Object *obj, free(extra_data_values); } -static void mp_widget_click_on_track_image_cb(void *data, Evas_Object *obj, - const char *emission, const char *source) +static void mp_widget_click_on_track_image_cb(void *data, + Evas_Object * obj, + const char *emission, + const char *source) { if (!data) { DEBUG_TRACE("Invalid data"); return; } - WidgetData *wgtdata = (WidgetData *)data; - Evas_Object *layout = (Evas_Object *)wgtdata->layout; + WidgetData *wgtdata = (WidgetData *) data; + Evas_Object *layout = (Evas_Object *) wgtdata->layout; if (!layout) { DEBUG_TRACE("Invalid layout"); return; @@ -506,24 +527,25 @@ static void mp_widget_click_on_track_image_cb(void *data, Evas_Object *obj, char **extra_data_keys = NULL; char **extra_data_values = NULL; - extra_data_keys = (char **)malloc(extra_data_len * sizeof(char *)); + extra_data_keys = (char **) malloc(extra_data_len * sizeof(char *)); if (!extra_data_keys) { return; } - extra_data_values = (char **)malloc(extra_data_len * sizeof(char *)); + extra_data_values = (char **) malloc(extra_data_len * sizeof(char *)); if (!extra_data_values) { free(extra_data_keys); return; } for (i = 0; i < extra_data_len; ++i) { - extra_data_keys[i] = (char *)malloc(50); - extra_data_values[i] = (char *)malloc(50); + extra_data_keys[i] = (char *) malloc(50); + extra_data_values[i] = (char *) malloc(50); } mp_widget_music_player_launch(layout, extra_data_keys, - extra_data_values, extra_data_len, EINA_TRUE, wgtdata->file_path); + extra_data_values, extra_data_len, + EINA_TRUE, wgtdata->file_path); mp_widget_music_player_result(layout); for (i = 0; i < extra_data_len; ++i) { @@ -545,16 +567,21 @@ static bool telephony_is_call_connected(void) int tel_valid = telephony_init(&tel_list); if (tel_valid != 0) { - ERROR_TRACE("telephony is not initialized. ERROR Code is %d", tel_valid); + ERROR_TRACE("telephony is not initialized. ERROR Code is %d", + tel_valid); return false; } - ret_sim1 = telephony_call_get_call_list(tel_list.handle[0], &count_sim1, &call_list_sim1); + ret_sim1 = + telephony_call_get_call_list(tel_list.handle[0], &count_sim1, + &call_list_sim1); if (ret_sim1 != TELEPHONY_ERROR_NONE) { ERROR_TRACE("Cannot get call list information for primary sim"); } - ret_sim2 = telephony_call_get_call_list(tel_list.handle[1], &count_sim2, &call_list_sim2); + ret_sim2 = + telephony_call_get_call_list(tel_list.handle[1], &count_sim2, + &call_list_sim2); if (ret_sim2 != TELEPHONY_ERROR_NONE) { ERROR_TRACE("Cannot get call list information for secondary sim"); } @@ -572,8 +599,9 @@ static bool telephony_is_call_connected(void) return false; } -static void mp_widget_click_on_play_cb(void *data, Evas_Object *obj, - const char *emission, const char *source) +static void mp_widget_click_on_play_cb(void *data, Evas_Object * obj, + const char *emission, + const char *source) { if (!data) { DEBUG_TRACE("Invalid data"); @@ -586,9 +614,12 @@ static void mp_widget_click_on_play_cb(void *data, Evas_Object *obj, message = STR_MP_UNABLE_TO_PLAY_DURING_CALL; WARN_TRACE("receive PLAYER_INTERRUPTED_BY_CALL"); if (message) { - int ret = notification_status_message_post(dgettext(domain_name, message)); + int ret = + notification_status_message_post(dgettext + (domain_name, message)); if (ret != 0) { - ERROR_TRACE("notification_status_message_post()... [0x%x]", ret); + ERROR_TRACE("notification_status_message_post()... [0x%x]", + ret); } else { DEBUG_TRACE("message: [%s]", message); } @@ -596,8 +627,8 @@ static void mp_widget_click_on_play_cb(void *data, Evas_Object *obj, return; } - WidgetData *wgtdata = (WidgetData *)data; - Evas_Object *layout = (Evas_Object *)wgtdata->layout; + WidgetData *wgtdata = (WidgetData *) data; + Evas_Object *layout = (Evas_Object *) wgtdata->layout; if (!layout) { DEBUG_TRACE("Invalid layout"); return; @@ -608,36 +639,39 @@ static void mp_widget_click_on_play_cb(void *data, Evas_Object *obj, char **extra_data_keys = NULL; char **extra_data_values = NULL; - extra_data_keys = (char **)malloc(extra_data_len * sizeof(char *)); + extra_data_keys = (char **) malloc(extra_data_len * sizeof(char *)); if (!extra_data_keys) { return; } - extra_data_values = (char **)malloc(extra_data_len * sizeof(char *)); + extra_data_values = (char **) malloc(extra_data_len * sizeof(char *)); if (!extra_data_values) { free(extra_data_keys); return; } for (i = 0; i < extra_data_len; ++i) { - extra_data_keys[i] = (char *)malloc(50); - extra_data_values[i] = (char *)malloc(50); + extra_data_keys[i] = (char *) malloc(50); + extra_data_values[i] = (char *) malloc(50); } strncpy(extra_data_keys[0], MP_LB_EVENT_KEY, strlen(MP_LB_EVENT_KEY)); extra_data_keys[0][strlen(MP_LB_EVENT_KEY)] = '\0'; if (!is_play) { - strncpy(extra_data_values[0], MP_LB_EVENT_PLAY_CLICKED, strlen(MP_LB_EVENT_PLAY_CLICKED)); + strncpy(extra_data_values[0], MP_LB_EVENT_PLAY_CLICKED, + strlen(MP_LB_EVENT_PLAY_CLICKED)); extra_data_values[0][strlen(MP_LB_EVENT_PLAY_CLICKED)] = '\0'; } else { - strncpy(extra_data_values[0], MP_LB_EVENT_PAUSE_CLICKED, strlen(MP_LB_EVENT_PAUSE_CLICKED)); + strncpy(extra_data_values[0], MP_LB_EVENT_PAUSE_CLICKED, + strlen(MP_LB_EVENT_PAUSE_CLICKED)); extra_data_values[0][strlen(MP_LB_EVENT_PAUSE_CLICKED)] = '\0'; } if (message_port_init(extra_data_values[0]) != MESSAGE_PORT_ERROR_NONE) { mp_widget_music_player_launch(layout, extra_data_keys, - extra_data_values, extra_data_len, EINA_FALSE, wgtdata->file_path); + extra_data_values, extra_data_len, + EINA_FALSE, wgtdata->file_path); mp_widget_music_player_result(layout); } for (i = 0; i < extra_data_len; ++i) { @@ -649,8 +683,9 @@ static void mp_widget_click_on_play_cb(void *data, Evas_Object *obj, free(extra_data_values); } -static void mp_widget_click_on_previous_cb(void *data, Evas_Object *obj, - const char *emission, const char *source) +static void mp_widget_click_on_previous_cb(void *data, Evas_Object * obj, + const char *emission, + const char *source) { if (!data) { DEBUG_TRACE("Invalid data"); @@ -663,8 +698,8 @@ static void mp_widget_click_on_previous_cb(void *data, Evas_Object *obj, return; } - WidgetData *wgtdata = (WidgetData *)data; - Evas_Object *layout = (Evas_Object *)wgtdata->layout; + WidgetData *wgtdata = (WidgetData *) data; + Evas_Object *layout = (Evas_Object *) wgtdata->layout; if (!layout) { DEBUG_TRACE("Invalid layout"); return; @@ -675,31 +710,33 @@ static void mp_widget_click_on_previous_cb(void *data, Evas_Object *obj, char **extra_data_keys = NULL; char **extra_data_values = NULL; - extra_data_keys = (char **)malloc(extra_data_len * sizeof(char *)); + extra_data_keys = (char **) malloc(extra_data_len * sizeof(char *)); if (!extra_data_keys) { return; } - extra_data_values = (char **)malloc(extra_data_len * sizeof(char *)); + extra_data_values = (char **) malloc(extra_data_len * sizeof(char *)); if (!extra_data_values) { free(extra_data_keys); return; } for (i = 0; i < extra_data_len; ++i) { - extra_data_keys[i] = (char *)malloc(50); - extra_data_values[i] = (char *)malloc(50); + extra_data_keys[i] = (char *) malloc(50); + extra_data_values[i] = (char *) malloc(50); } strncpy(extra_data_keys[0], MP_LB_EVENT_KEY, strlen(MP_LB_EVENT_KEY)); extra_data_keys[0][strlen(MP_LB_EVENT_KEY)] = '\0'; - strncpy(extra_data_values[0], MP_LB_EVENT_PREV_RELEASED, strlen(MP_LB_EVENT_PREV_RELEASED)); + strncpy(extra_data_values[0], MP_LB_EVENT_PREV_RELEASED, + strlen(MP_LB_EVENT_PREV_RELEASED)); extra_data_values[0][strlen(MP_LB_EVENT_PREV_RELEASED)] = '\0'; if (message_port_init(extra_data_values[0]) != MESSAGE_PORT_ERROR_NONE) { mp_widget_music_player_launch(layout, extra_data_keys, - extra_data_values, extra_data_len, EINA_FALSE, wgtdata->file_path); + extra_data_values, extra_data_len, + EINA_FALSE, wgtdata->file_path); mp_widget_music_player_result(layout); } @@ -712,8 +749,9 @@ static void mp_widget_click_on_previous_cb(void *data, Evas_Object *obj, free(extra_data_values); } -static void mp_widget_click_on_next_cb(void *data, Evas_Object *obj, - const char *emission, const char *source) +static void mp_widget_click_on_next_cb(void *data, Evas_Object * obj, + const char *emission, + const char *source) { if (!data) { DEBUG_TRACE("Invalid data"); @@ -726,8 +764,8 @@ static void mp_widget_click_on_next_cb(void *data, Evas_Object *obj, return; } - WidgetData *wgtdata = (WidgetData *)data; - Evas_Object *layout = (Evas_Object *)wgtdata->layout; + WidgetData *wgtdata = (WidgetData *) data; + Evas_Object *layout = (Evas_Object *) wgtdata->layout; if (!layout) { DEBUG_TRACE("Invalid layout"); return; @@ -738,31 +776,33 @@ static void mp_widget_click_on_next_cb(void *data, Evas_Object *obj, char **extra_data_keys = NULL; char **extra_data_values = NULL; - extra_data_keys = (char **)malloc(extra_data_len * sizeof(char *)); + extra_data_keys = (char **) malloc(extra_data_len * sizeof(char *)); if (!extra_data_keys) { return; } - extra_data_values = (char **)malloc(extra_data_len * sizeof(char *)); + extra_data_values = (char **) malloc(extra_data_len * sizeof(char *)); if (!extra_data_values) { free(extra_data_keys); return; } for (i = 0; i < extra_data_len; ++i) { - extra_data_keys[i] = (char *)malloc(50); - extra_data_values[i] = (char *)malloc(50); + extra_data_keys[i] = (char *) malloc(50); + extra_data_values[i] = (char *) malloc(50); } strncpy(extra_data_keys[0], MP_LB_EVENT_KEY, strlen(MP_LB_EVENT_KEY)); extra_data_keys[0][strlen(MP_LB_EVENT_KEY)] = '\0'; - strncpy(extra_data_values[0], MP_LB_EVENT_NEXT_RELEASED, strlen(MP_LB_EVENT_NEXT_RELEASED)); + strncpy(extra_data_values[0], MP_LB_EVENT_NEXT_RELEASED, + strlen(MP_LB_EVENT_NEXT_RELEASED)); extra_data_values[0][strlen(MP_LB_EVENT_NEXT_RELEASED)] = '\0'; if (message_port_init(extra_data_values[0]) != MESSAGE_PORT_ERROR_NONE) { mp_widget_music_player_launch(layout, extra_data_keys, - extra_data_values, extra_data_len, EINA_FALSE, wgtdata->file_path); + extra_data_values, extra_data_len, + EINA_FALSE, wgtdata->file_path); mp_widget_music_player_result(layout); } @@ -775,19 +815,25 @@ static void mp_widget_click_on_next_cb(void *data, Evas_Object *obj, free(extra_data_values); } -static void __mp_change_multiple_widgets(void *data, Ecore_File_Monitor *em, Ecore_File_Event event, const char *path) +static void __mp_change_multiple_widgets(void *data, + Ecore_File_Monitor * em, + Ecore_File_Event event, + const char *path) { Eina_List *temp_list = NULL; - WidgetData* wgtdata = NULL; - if (event == ECORE_FILE_EVENT_MODIFIED || event == ECORE_FILE_EVENT_CREATED_FILE) { - DEBUG_TRACE("The monitored file path is: %s", ecore_file_monitor_path_get(em)); + WidgetData *wgtdata = NULL; + if (event == ECORE_FILE_EVENT_MODIFIED + || event == ECORE_FILE_EVENT_CREATED_FILE) { + DEBUG_TRACE("The monitored file path is: %s", + ecore_file_monitor_path_get(em)); EINA_LIST_FOREACH(widget_list, temp_list, wgtdata) { char *path = app_get_data_path(); - char playing_status[1024] = {0}; + char playing_status[1024] = { 0 }; if (path == NULL) { return; } - snprintf(playing_status, 1024, "%s%s", path, NOW_PLAYING_INI_PATH); + snprintf(playing_status, 1024, "%s%s", path, + NOW_PLAYING_INI_PATH); free(path); mp_widget_read_ini_file_ecore(wgtdata, playing_status); } @@ -795,13 +841,13 @@ static void __mp_change_multiple_widgets(void *data, Ecore_File_Monitor *em, Eco free(temp_list); } -int mp_widget_create(WidgetData* data, int w, int h) +int mp_widget_create(WidgetData * data, int w, int h) { if (!data) { DEBUG_TRACE("Invalid data"); return -1; } - char edj_path[PATH_MAX] = {0,}; + char edj_path[PATH_MAX] = { 0, }; Evas_Object *layout = NULL; layout = elm_layout_add(data->win); @@ -819,9 +865,11 @@ int mp_widget_create(WidgetData* data, int w, int h) snprintf(edj_path, PATH_MAX, "%s%s", res_path, EDJE_FILE); free(res_path); - Eina_Bool fileSet = elm_layout_file_set(layout, edj_path, "mp_widget_main"); + Eina_Bool fileSet = + elm_layout_file_set(layout, edj_path, "mp_widget_main"); DEBUG_TRACE("Widget Layout File Set: %d", fileSet); - evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); if ((elm_config_scale_get() - 1.7) < 0.0001) { h = 304; @@ -841,11 +889,16 @@ int mp_widget_create(WidgetData* data, int w, int h) widget_list = eina_list_append(widget_list, data); DEBUG_TRACE("Number of widgets: %d", eina_list_count(widget_list)); - elm_object_domain_translatable_part_text_set(layout, "noitems_title", "music-player", "IDS_MUSIC_BODY_MUSIC"); - elm_object_domain_translatable_part_text_set(layout, "noitems_subtitle", "music-player", "IDS_MUSIC_SK3_ADD_TRACKS"); + elm_object_domain_translatable_part_text_set(layout, "noitems_title", + "music-player", + "IDS_MUSIC_BODY_MUSIC"); + elm_object_domain_translatable_part_text_set(layout, + "noitems_subtitle", + "music-player", + "IDS_MUSIC_SK3_ADD_TRACKS"); char *path = app_get_data_path(); DEBUG_TRACE("Path is: %s", path); - char playing_status[1024] = {0}; + char playing_status[1024] = { 0 }; if (path == NULL) { return -1; } @@ -854,24 +907,30 @@ int mp_widget_create(WidgetData* data, int w, int h) mp_widget_read_ini_file(playing_status, data); if (data->em == NULL) { - data->em = ecore_file_monitor_add(playing_status, __mp_change_multiple_widgets, NULL); + data->em = + ecore_file_monitor_add(playing_status, + __mp_change_multiple_widgets, NULL); } elm_object_signal_callback_add(layout, "mouse,down,1", - "noitems_subtitle", mp_widget_click_on_add_tracks_cb, - (void *)data); + "noitems_subtitle", + mp_widget_click_on_add_tracks_cb, + (void *) data); + elm_object_signal_callback_add(layout, "mouse,down,1", "track_image", + mp_widget_click_on_track_image_cb, + (void *) data); elm_object_signal_callback_add(layout, "mouse,down,1", - "track_image", mp_widget_click_on_track_image_cb, - (void *)data); + "track_play_image", + mp_widget_click_on_play_cb, + (void *) data); elm_object_signal_callback_add(layout, "mouse,down,1", - "track_play_image", mp_widget_click_on_play_cb, - (void *)data); + "track_prev_image", + mp_widget_click_on_previous_cb, + (void *) data); elm_object_signal_callback_add(layout, "mouse,down,1", - "track_prev_image", mp_widget_click_on_previous_cb, - (void *)data); - elm_object_signal_callback_add(layout, "mouse,down,1", - "track_next_image", mp_widget_click_on_next_cb, - (void *)data); + "track_next_image", + mp_widget_click_on_next_cb, + (void *) data); return 0; diff --git a/widget/src/mp-widget-main.c b/widget/src/mp-widget-main.c index 6ba9f34..af36b54 100644 --- a/widget/src/mp-widget-main.c +++ b/widget/src/mp-widget-main.c @@ -36,7 +36,8 @@ void *getWidgetData(widget_context_h context) return data; } -int widget_Create(widget_context_h context, bundle *content, int w, int h, void *data) +int widget_Create(widget_context_h context, bundle * content, int w, int h, + void *data) { Evas_Object *win = NULL; int ret = widget_app_get_elm_win(context, &win); @@ -53,8 +54,8 @@ int widget_Create(widget_context_h context, bundle *content, int w, int h, void return WIDGET_ERROR_OUT_OF_MEMORY; } - char edje_path[1024] ={0}; - char * path = app_get_resource_path(); + char edje_path[1024] = { 0 }; + char *path = app_get_resource_path(); snprintf(edje_path, 1024, "%s%s", path, "locale"); bindtextdomain("music-player", edje_path); free(path); @@ -76,19 +77,21 @@ int widget_Create(widget_context_h context, bundle *content, int w, int h, void return WIDGET_ERROR_NONE; } -int widget_Destroy(widget_context_h context, widget_app_destroy_type_e reason, bundle *content, void *data) +int widget_Destroy(widget_context_h context, + widget_app_destroy_type_e reason, bundle * content, + void *data) { DEBUG_TRACE("Widget Destroy"); WidgetData *widget_data = NULL; - widget_data = (WidgetData *)getWidgetData(context); + widget_data = (WidgetData *) getWidgetData(context); if (!widget_data) { return WIDGET_ERROR_INVALID_PARAMETER; } widget_app_context_set_tag(context, NULL); if (widget_data->file_path) { - free((char *)widget_data->file_path); + free((char *) widget_data->file_path); widget_data->file_path = NULL; } @@ -121,7 +124,7 @@ int widget_Resize(widget_context_h context, int w, int h, void *data) DEBUG_TRACE("Widget Resize"); WidgetData *widget_data = NULL; - widget_data = (WidgetData *)getWidgetData(context); + widget_data = (WidgetData *) getWidgetData(context); if (!widget_data) { return WIDGET_ERROR_INVALID_PARAMETER; } @@ -131,7 +134,8 @@ int widget_Resize(widget_context_h context, int w, int h, void *data) return WIDGET_ERROR_NONE; } -int widget_Update(widget_context_h context, bundle *content, int force, void *data) +int widget_Update(widget_context_h context, bundle * content, int force, + void *data) { DEBUG_TRACE("Widget Update"); return WIDGET_ERROR_NONE; @@ -158,10 +162,12 @@ widget_class_h app_create(void *data) app_event_handler_h lang_changed_handler; app_event_handler_h region_changed_handler; - widget_app_add_event_handler(&lang_changed_handler, APP_EVENT_LANGUAGE_CHANGED, - &app_language_changed, data); - widget_app_add_event_handler(®ion_changed_handler, APP_EVENT_REGION_FORMAT_CHANGED, - &app_region_changed, data); + widget_app_add_event_handler(&lang_changed_handler, + APP_EVENT_LANGUAGE_CHANGED, + &app_language_changed, data); + widget_app_add_event_handler(®ion_changed_handler, + APP_EVENT_REGION_FORMAT_CHANGED, + &app_region_changed, data); widget_instance_lifecycle_callback_s ops; ops.create = widget_Create; @@ -185,7 +191,7 @@ int main(int argc, char *argv[]) { int result = WIDGET_ERROR_NONE; - widget_app_lifecycle_callback_s ops = {0,}; + widget_app_lifecycle_callback_s ops = { 0, }; ops.create = app_create; ops.terminate = app_terminate;