# Sound Player
ADD_SUBDIRECTORY(sound-player)
+# Music ug for appcontrol
+ADD_SUBDIRECTORY(ug-music-player-efl)
#define MP_REQ_TYPE "request_type"
//ug-music-player request type
-#define UG_MP_ITEM_TYPE_KEY "request_type"
-#define UG_MP_ITEM_ALBUM_VAL "SC_Album"
-#define UG_MP_ITEM_ARTIST_VAL "SC_Artist"
-#define UG_MP_ITEM_PLAYLIST_VAL "SC_Playlist"
+#define UG_MP_REQ_SELECT_SINGLE "Select"
+#define UG_MP_REQ_SELECT_MULTI "MultipleSelect"
//for shorcut
%description -n %{PKG_PREFIX}.sound-player
Description: sound player application
-#Requires: %{name} = %{version}-%{release}
+%package -n ug-music-player-efl
+Summary: music-player UG
+Group: TO_BE/FILLED_IN
+
+%description -n ug-music-player-efl
+Description: music-player UG
+
%prep
mkdir -p %{SP_DATA_PREFIX}/data
chown -R 5000:5000 %{SP_DATA_PREFIX}/data
+mkdir -p /usr/ug/bin/
+ln -sf /usr/bin/ug-client /usr/ug/bin/music-player-efl
+
/usr/bin/vconftool set -t int memory/music/state 0 -i -g 5000
/usr/bin/vconftool set -t string memory/music/album_art "" -i -g 5000
%{DESKTOP_DIR}/icons/default/small/%{SP_PKG_NAME}.png
%{SP_PREFIX}/bin/sound-player
+%files -n ug-music-player-efl
+%manifest ug-music-player-efl.manifest
+%{DESKTOP_DIR}/packages/ug-music-player-efl.xml
+%defattr(-,root,root,-)
+%{UG_PREFIX}/lib/libug-music-player-efl.so
+%{UG_PREFIX}/lib/libug-music-player-efl.so.0.1.0
+%{UG_PREFIX}/res/edje/ug-music-player-efl/ug-music-player-efl.edj
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_" />
+ </request>
+</manifest>
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(PROJECT_NAME ug-music-player-efl)
+PROJECT(${PROJECT_NAME} C CXX)
+
+SET(SRCS
+ src/ug-mp-efl.c
+ src/ug-mp-track-list.c
+ src/ug-mp-group-list.c
+ src/ug-mp-library-view.c
+ src/ug-mp-common.c
+ src/ug-mp-widget.c
+ ${CMAKE_SOURCE_DIR}/src/common/mp-media-info.c
+)
+
+INCLUDE_DIRECTORIES(
+ ${CMAKE_CURRENT_SOURCE_DIR}/include
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/include
+)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs REQUIRED
+ elementary
+ ui-gadget-1
+ dlog
+ vconf
+ )
+
+FOREACH(flag ${pkgs_CFLAGS})
+ SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} -fvisibility=hidden -Wall")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS}")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS}")
+SET(CMAKE_LDFLAGS "-Wl,-zdefs" )
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION 0.1.0)
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
+
+# set extra defines
+SET(IMAGES_DIR "${UG_PREFIX}/res/images/ug-music-player-efl")
+SET(UG_EDJ_NAME "${UG_PREFIX}/res/edje/ug-music-player-efl/layout/ug-music-player-efl.edj")
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DIMAGES_DIR=\"${IMAGES_DIR}\"")
+ADD_DEFINITIONS("-DUG_EDJ_NAME=\"${UG_EDJ_NAME}\"")
+ADD_CUSTOM_TARGET(ug-music-player-efl.edj
+ COMMAND edje_cc -id ${CMAKE_CURRENT_SOURCE_DIR}/images
+ ${CMAKE_CURRENT_SOURCE_DIR}/layout/ug-music-player-efl.edc ${CMAKE_BINARY_DIR}/layout/ug-music-player-efl.edj
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/layout/ug-music-player-efl.edc
+)
+ADD_DEPENDENCIES(${PROJECT_NAME} ug-music-player-efl.edj)
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${UG_PREFIX}/lib)
+message(UG_PREFIX ${UG_PREFIX})
+INSTALL(FILES ${CMAKE_BINARY_DIR}/layout/ug-music-player-efl.edj DESTINATION ${UG_PREFIX}/res/edje/${PROJECT_NAME})
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ug-music-player-efl.xml DESTINATION ${DESKTOP_DIR}/packages)
+
--- /dev/null
+
+collections {
+
+}
--- /dev/null
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __UG_MP_COMMON_H__
+#define __UG_MP_COMMON_H__
+
+#include "ug-mp-efl.h"
+
+bool ug_mp_check_image_valid(Evas *evas, const char *path);
+char *ug_mp_artist_text_get(void *data, Evas_Object *obj, const char *part);
+char *ug_mp_album_text_get(void *data, Evas_Object *obj, const char *part);
+char * ug_mp_playlist_text_get(void *data, Evas_Object *obj, const char *part);
+Evas_Object * ug_mp_group_content_get(void *data, Evas_Object *obj, const char *part);
+void ug_mp_quit_cb(void *data, Evas_Object * obj, void *event_info);
+
+#endif
--- /dev/null
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __UG_MP_DATA_H__
+#define __UG_MP_DATA_H__
+
+typedef struct _ug_mp_list_data *ug_mp_data;
+
+typedef enum
+{
+ MP_DATA_ARTIST,
+ MP_DATA_ALBUM,
+ MP_DATA_PLAYLIST,
+}mp_data_e;
+
+int ug_mp_data_count(mp_data_e type, char *filter_text);
+int ug_mp_data_create(mp_data_e type, char *filter_text, ug_mp_data *data);
+int ug_mp_data_destory(ug_mp_data data);
+
+int ug_mp_data_get_main_text(
+
+#endif
+
--- /dev/null
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __UG_MP_DEBUG_H_
+#define __UG_MP_DEBUG_H_
+
+
+#include <stdio.h>
+#include <unistd.h>
+#include "assert.h"
+#include <linux/unistd.h>
+
+#define ENABLE_CHECK_START_END_FUNCTION // support enter leave debug message
+
+#define ENABLE_LOG_SYSTEM
+
+#ifdef ENABLE_LOG_SYSTEM
+
+#define USE_DLOG_SYSTEM
+
+#define gettid() syscall(__NR_gettid)
+
+#ifdef USE_DLOG_SYSTEM
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif //LOG_TAG
+
+#define LOG_TAG "UG_MUSIC_PLAYER"
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#define LOG_COLOR_RESET "\033[0m"
+#define LOG_COLOR_RED "\033[31m"
+#define LOG_COLOR_YELLOW "\033[33m"
+#define LOG_COLOR_GREEN "\033[32m"
+#define LOG_COLOR_BLUE "\033[36m"
+
+#define DEBUG_TRACE(fmt, arg...) LOGD_IF(TRUE, LOG_COLOR_GREEN"[TID:%d] "fmt""LOG_COLOR_RESET, gettid(), ##arg)
+#define INFO_TRACE(fmt, arg...) LOGI_IF(TRUE, LOG_COLOR_GREEN"[TID:%d] "fmt""LOG_COLOR_RESET, gettid(), ##arg)
+#define WARN_TRACE(fmt, arg...) LOGW_IF(TRUE, LOG_COLOR_YELLOW"[TID:%d] "fmt""LOG_COLOR_RESET, gettid(), ##arg)
+#define ERROR_TRACE(fmt, arg...) LOGE_IF(TRUE, LOG_COLOR_RED"[TID:%d] "fmt""LOG_COLOR_RESET, gettid(), ##arg)
+
+#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)
+#endif //USE_DLOG_SYSTEM
+
+#define DEBUG_TRACE_FUNC() DEBUG_TRACE("")
+
+#else //ENABLE_LOG_SYSTEM
+#define DEBUG_TRACE(fmt, arg...)
+#define INFO_TRACE(fmt, arg...)
+#define WARN_TRACE(fmt, arg...)
+#define ERROR_TRACE(fmt, arg...)
+#endif //ENABLE_LOG_SYSTEM
+
+#ifdef ENABLE_CHECK_START_END_FUNCTION
+#define startfunc DEBUG_TRACE("+- START -------------------------");
+#define endfunc DEBUG_TRACE("+- END --------------------------");
+#define exceptionfunc ERROR_TRACE("### CRITICAL ERROR ###");
+#else
+#define startfunc
+#define endfunc
+#define exceptionfunc
+#endif
+
+#define mp_ret_if(expr) do { \
+ if(expr) { \
+ WARN_TRACE("");\
+ return; \
+ } \
+} while (0)
+#define mp_retv_if(expr, val) do { \
+ if(expr) { \
+ WARN_TRACE("");\
+ return (val); \
+ } \
+} while (0)
+
+#define mp_retm_if(expr, fmt, arg...) do { \
+ if(expr) { \
+ WARN_TRACE(fmt, ##arg); \
+ return; \
+ } \
+} while (0)
+
+#define mp_retvm_if(expr, val, fmt, arg...) do { \
+ if(expr) { \
+ WARN_TRACE(fmt, ##arg); \
+ return (val); \
+ } \
+} while (0)
+
+#define CHECK_EXCEP(expr) do { \
+ 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 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)) { \
+ ERROR_TRACE("CRITICAL ERROR ## CHECK BELOW ITEM");\
+ assert(FALSE); \
+ } \
+} while (0)
+
+
+#endif // __UG_MP_DEBUG_H_
--- /dev/null
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __msUG_efl_H__
+#define __msUG_efl_H__
+
+#include <Elementary.h>
+#include <glib.h>
+#include <libintl.h>
+#include <ui-gadget.h>
+#include <ui-gadget-module.h>
+#include "ug-mp-debug.h"
+#include "mp-common-defs.h"
+#include "ug-mp-text.h"
+#include "ug-mp-widget.h"
+
+#define ICON_SIZE 64*elm_config_scale_get()
+#define DEFAULT_THUMBNAIL RESDIR"/images/music_player/34_thumb_07.png"
+
+#define PKGNAME "ug-music-player-efl"
+#define DOMAIN_NAME "music-player"
+#define LOCALE_DIR PREFIX"/res/locale"
+
+#define _EDJ(o) elm_layout_edje_get(o)
+#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("sys_string", str)
+
+#define IF_FREE(p) ({if(p){free(p);p=NULL;}})
+
+#define UG_MP_OPERATION_PICK "http://tizen.org/appcontrol/operation/pick"
+#define UG_MP_SELECT_MODE_KEY "http://tizen.org/appcontrol/data/selection_mode"
+#define UG_MP_SELECT_MULTIPLE "multiple"
+#define UG_MP_OUTPUT_KEY "http://tizen.org/appcontrol/data/selected"
+
+typedef enum{
+ UG_MP_SELECT_SINGLE,
+ UG_MP_SELECT_MULTI,
+}ug_type;
+
+struct ug_data
+{
+ Evas_Object *base_layout;
+ Evas_Object *navi_bar;
+
+ ug_type select_type;
+
+ ui_gadget_h ug;
+};
+
+#endif /* __msUG_efl_H__ */
--- /dev/null
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __UG_MP_GROUP_LIST_H__
+#define __UG_MP_GROUP_LIST_H__
+
+#include "ug-mp-efl.h"
+#include "mp-media-info.h"
+
+Evas_Object *ug_mp_group_list_create(Evas_Object *parent, struct ug_data *ugd);
+int ug_mp_group_list_set_data(Evas_Object *list, int group_type, const char *type_str);
+int ug_mp_group_list_update(Evas_Object *list);
+
+#endif
--- /dev/null
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ #ifndef __UG_MP_LIBRARY_VIEW_H__
+#define __UG_MP_LIBRARY_VIEW_H__
+
+#include "ug-mp-efl.h"
+
+void ug_mp_library_view_create(struct ug_data *ugd);
+
+#endif
+
--- /dev/null
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define UG_MP_TEXT_SEARCH "Search"
+#define UG_MP_TEXT_CANCEL "Cancel"
+
+#define UG_MP_TEXT_SELECT_ARTIST "Select artist"
+#define UG_MP_TEXT_SELECT_ALBUM "Select album"
+#define UG_MP_TEXT_SELECT_PLAYLIST "Select playlist"
+
+#define UG_MP_TEXT_NO_SONGS "IDS_MUSIC_HEADER_NO_SONGS"
+#define UG_MP_TEXT_NO_PLAYLIST "IDS_MUSIC_BODY_NO_PLAYLISTS"
+#define UG_MP_TEXT_NO_ALBUM "IDS_MUSIC_BODY_NO_ALBUMS"
+#define UG_MP_TEXT_NO_ARTIST "IDS_MUSIC_BODY_NO_ARTISTS"
+
+#define UG_MP_TEXT_ALL "IDS_MUSIC_ITAB4_ALL"
+#define UG_MP_TEXT_PLAYLISTS "IDS_MUSIC_BODY_PLAYLISTS"
+#define UG_MP_TEXT_ALBUMS "IDS_MUSIC_TAB4_ALBUMS"
+#define UG_MP_TEXT_ARTISTS "IDS_MUSIC_TAB4_ARTISTS"
+
+#define UG_MP_TEXT_SELECT "IDS_COM_SK_SELECT"
+
+
--- /dev/null
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __UG_MP_TRACK_LIST_H__
+#define __UG_MP_TRACK_LIST_H__
+
+#include "ug-mp-efl.h"
+#include "mp-media-info.h"
+
+Evas_Object *ug_mp_track_list_create(Evas_Object *parent, struct ug_data *ugd, Elm_Object_Item *navi_it);
+int ug_mp_track_list_set_data(Evas_Object *list, int track_type, const char *type_str, int playlist_id);
+int ug_mp_track_list_update(Evas_Object *list);
+
+#endif
+
--- /dev/null
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __UG_MP_WIDGET_H__
+#define __UG_MP_WIDGET_H__
+
+#include <Elementary.h>
+
+typedef enum {
+ NO_CONTENT_SONG,
+ NO_CONTENT_PLAYLIST,
+ NO_CONTENT_ALBUM,
+ NO_CONTENT_ARTIST,
+} NoContentType_e;
+
+Evas_Object *ug_mp_widget_no_content_add(Evas_Object *parent, NoContentType_e type);
+
+#endif /* __UG_MP_WIDGET_H__ */
+
--- /dev/null
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ug-mp-common.h"
+#include "mp-media-info.h"
+
+bool ug_mp_check_image_valid(Evas *evas, const char *path)
+{
+ if(!path) return false;
+ MP_CHECK_FALSE(evas);
+
+ if (!ecore_file_exists(path)) {
+ ERROR_TRACE("file not exitst");
+ return false;
+ }
+
+ Evas_Object *image = NULL;
+ int width = 0;
+ int height = 0;
+
+ image = evas_object_image_add(evas);
+ MP_CHECK_FALSE(image);
+ evas_object_image_file_set(image, path, NULL);
+ evas_object_image_size_get(image, &width, &height);
+ evas_object_del(image);
+
+ if (width <= 0 || height <= 0) {
+ DEBUG_TRACE("Cannot load file : %s", path);
+ return false;
+ }
+
+ return true;
+}
+
+char *ug_mp_artist_text_get(void *data, Evas_Object *obj, const char *part)
+{
+ char *text = NULL;
+ if (strcmp(part, "elm.text.1") == 0) {
+ mp_media_info_group_get_main_info(data, &text);
+ return g_strdup(text);
+ }else if(strcmp(part, "elm.text.2") == 0) {
+ int count;
+ mp_media_info_group_get_main_info(data, &text);
+ mp_media_info_list_count(MP_TRACK_BY_ARTIST, text, NULL, NULL, 0, &count);
+ text = g_strdup_printf("(%d)", count);
+ return text;
+ }
+ return NULL;
+}
+
+char *ug_mp_album_text_get(void *data, Evas_Object *obj, const char *part)
+{
+ char *text = NULL;
+
+ int ret = 0;
+ if (strcmp(part, "elm.text.1") == 0) {
+ ret = mp_media_info_group_get_main_info(data, &text);
+ MP_CHECK_NULL(ret==0);
+ return g_strdup(text);
+ }else if (strcmp(part, "elm.text.2") == 0) {
+ ret = mp_media_info_group_get_sub_info(data, &text);
+ MP_CHECK_NULL(ret==0);
+ return g_strdup(text);
+ }else if(strcmp(part, "elm.text.3") == 0) {
+ int count;
+ ret = mp_media_info_group_get_main_info(data, &text);
+ MP_CHECK_NULL(ret==0);
+ 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;
+ }
+ return NULL;
+}
+
+char * ug_mp_playlist_text_get(void *data, Evas_Object *obj, const char *part)
+{
+ char *text = NULL;
+ if (strcmp(part, "elm.text.1") == 0) {
+ mp_media_info_group_get_main_info(data, &text);
+ return g_strdup(GET_STR(text));
+ }else if(strcmp(part, "elm.text.2") == 0) {
+ int id = 0;
+ int count = 0;
+ mp_media_info_group_get_playlist_id(data, &id);
+ if(id == MP_SYS_PLST_MOST_PLAYED)
+ 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);
+ else if(id == MP_SYS_PLST_RECENTELY_PLAYED)
+ 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);
+ else
+ mp_media_info_list_count(MP_TRACK_BY_PLAYLIST, NULL, NULL, NULL, id, &count);
+ text = g_strdup_printf("(%d)", count);
+ return text;
+ }
+ return NULL;
+}
+
+Evas_Object * ug_mp_group_content_get(void *data, Evas_Object *obj, const char *part)
+{
+ Evas_Object *content = NULL;
+ char *thumbpath = NULL;
+
+ content = elm_bg_add(obj);
+ elm_bg_load_size_set(content, ICON_SIZE, ICON_SIZE);
+
+ mp_media_info_group_get_thumbnail_path(data, &thumbpath);
+
+ if(ug_mp_check_image_valid( evas_object_evas_get(obj), thumbpath))
+ elm_bg_file_set(content, thumbpath, NULL);
+ else
+ elm_bg_file_set(content, DEFAULT_THUMBNAIL, NULL);
+ return content;
+}
+
+void
+ug_mp_quit_cb(void *data, Evas_Object * obj, void *event_info)
+{
+ struct ug_data *ugd = data;
+ MP_CHECK(data);
+ DEBUG_TRACE("");
+ ug_destroy_me(ugd->ug);
+}
+
--- /dev/null
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef UG_MODULE_API
+#define UG_MODULE_API __attribute__ ((visibility("default")))
+#endif
+
+#include <Elementary.h>
+#include <ui-gadget-module.h>
+#include <vconf.h>
+#include <stdbool.h>
+#include <glib.h>
+
+#include "ug-mp-efl.h"
+#include "ug-mp-library-view.h"
+#include "mp-media-info.h"
+
+static void
+_parse_service(struct ug_data *ugd, service_h service)
+{
+ char *operation = NULL;
+ service_get_operation(service, &operation);
+ DEBUG_TRACE("operation: %s", operation);
+
+ if(!g_strcmp0(operation, UG_MP_OPERATION_PICK))
+ {
+ char *value = NULL;
+ service_get_extra_data(service, UG_MP_SELECT_MODE_KEY, &value);
+ if(!g_strcmp0(value, UG_MP_SELECT_MULTIPLE))
+ {
+ ugd->select_type = UG_MP_SELECT_MULTI;
+ goto END;
+ }
+ IF_FREE(value);
+ }
+
+ END:
+ IF_FREE(operation);
+
+}
+
+static Evas_Object *
+_ug_mp_create_fullview(Evas_Object * parent, struct ug_data *ugd)
+{
+ Evas_Object *base_layout;
+
+ base_layout = elm_layout_add(parent);
+
+ mp_retv_if(base_layout == NULL, NULL);
+
+ elm_layout_theme_set(base_layout, "layout", "application", "default");
+
+ return base_layout;
+}
+
+static Evas_Object *
+_ug_mp_create_navigation_layout(Evas_Object * parent)
+{
+ Evas_Object *navi_bar;
+
+ mp_retv_if(parent == NULL, NULL);
+
+ navi_bar = elm_naviframe_add(parent);
+ evas_object_show(navi_bar);
+
+ return navi_bar;
+}
+
+static Evas_Object *
+_ug_mp_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);
+ elm_object_style_set(bg, "group_list");
+ evas_object_show(bg);
+ return bg;
+}
+
+static void
+ug_mp_on_key_event(ui_gadget_h ug, enum ug_key_event event, service_h service, void *priv)
+{
+ if (!ug)
+ return;
+
+ struct ug_data *ugd = (struct ug_data *)priv;
+ if (!ugd)
+ {
+ DEBUG_TRACE("ugd is null...");
+ return;
+ }
+ switch (event)
+ {
+ case UG_KEY_EVENT_END:
+ ug_destroy_me(ug);
+ break;
+ default:
+ break;
+ }
+}
+
+static void *
+ug_mp_create(ui_gadget_h ug, enum ug_mode mode, service_h service, void *priv)
+{
+ DEBUG_TRACE("");
+
+ Evas_Object *parent = NULL;
+ struct ug_data *ugd = NULL;
+
+ ugd = (struct ug_data *)priv;
+ ugd->ug = ug;
+ mp_retvm_if((!ug || !priv), NULL, "handle or ui_gadget pointer is NULL, check it !!");
+
+ mp_media_info_connect();
+
+ _parse_service(ugd, service);
+
+ bindtextdomain(DOMAIN_NAME, LOCALE_DIR);
+
+ parent = (Evas_Object *) ug_get_parent_layout(ug);
+ mp_retvm_if(parent == NULL, NULL, "parent layout is NULL");
+
+ elm_win_conformant_set(parent, EINA_TRUE);
+
+ if (mode == UG_MODE_FULLVIEW)
+ {
+ DEBUG_TRACE("UG_MODE_FULLVIEW");
+
+ ugd->base_layout = _ug_mp_create_fullview(parent, ugd);
+
+ if (ugd->base_layout)
+ {
+ Evas_Object *bg = _ug_mp_crete_bg(ugd->base_layout);
+ mp_retvm_if(bg == NULL, NULL, "bg layout is NULL");
+ elm_win_resize_object_add(parent, bg);
+
+ elm_object_part_content_set(ugd->base_layout, "elm.swallow.bg", bg);
+ ugd->navi_bar = _ug_mp_create_navigation_layout(ugd->base_layout);
+ elm_object_part_content_set(ugd->base_layout, "elm.swallow.content", ugd->navi_bar);
+ }
+ ug_mp_library_view_create(ugd);
+ }
+ else
+ ERROR_TRACE("Not supported ug mode : %d", mode);
+
+ return ugd->base_layout;
+}
+
+static void
+ug_mp_start(ui_gadget_h ug, service_h service, void *priv)
+{
+ DEBUG_TRACE("");
+}
+
+static void
+ug_mp_pause(ui_gadget_h ug, service_h service, void *priv)
+{
+ DEBUG_TRACE("");
+}
+
+static void
+ug_mp_resume(ui_gadget_h ug, service_h service, void *priv)
+{
+ DEBUG_TRACE("");
+}
+
+static void
+ug_mp_destroy(ui_gadget_h ug, service_h service, void *priv)
+{
+ DEBUG_TRACE("");
+ struct ug_data *ugd;
+
+ mp_media_info_disconnect();
+
+ if (!ug || !priv)
+ return;
+
+ ugd = priv;
+
+ if (ugd->base_layout)
+ {
+ evas_object_del(ugd->base_layout);
+ ugd->base_layout = NULL;
+ }
+}
+
+static void
+ug_mp_message(ui_gadget_h ug, service_h msg, service_h service, void *priv)
+{
+ DEBUG_TRACE("");
+}
+
+static void
+ug_mp_event(ui_gadget_h ug, enum ug_event event, service_h service, void *priv)
+{
+ DEBUG_TRACE("event: %d", event);
+ switch (event)
+ {
+ case UG_EVENT_LOW_MEMORY:
+ break;
+ case UG_EVENT_LOW_BATTERY:
+ break;
+ case UG_EVENT_LANG_CHANGE:
+ break;
+ case UG_EVENT_ROTATE_PORTRAIT:
+ break;
+ case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
+ break;
+ case UG_EVENT_ROTATE_LANDSCAPE:
+ break;
+ case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
+ break;
+ default:
+ break;
+ }
+}
+
+UG_MODULE_API int
+UG_MODULE_INIT(struct ug_module_ops *ops)
+{
+ DEBUG_TRACE("");
+ struct ug_data *ugd;
+
+ if (!ops)
+ return -1;
+
+ ugd = calloc(1, sizeof(struct ug_data));
+ if (!ugd)
+ return -1;
+
+ ops->create = ug_mp_create;
+ ops->start = ug_mp_start;
+ ops->pause = ug_mp_pause;
+ ops->resume = ug_mp_resume;
+ ops->destroy = ug_mp_destroy;
+ ops->message = ug_mp_message;
+ ops->key_event = ug_mp_on_key_event;
+ ops->event = ug_mp_event;
+ ops->priv = ugd;
+ ops->opt = UG_OPT_INDICATOR_PORTRAIT_ONLY;
+
+ return 0;
+}
+
+UG_MODULE_API void
+UG_MODULE_EXIT(struct ug_module_ops *ops)
+{
+ DEBUG_TRACE("");
+ struct ug_data *ugd;
+
+ if (!ops)
+ return;
+
+ ugd = ops->priv;
+
+ if (ugd)
+ free(ugd);
+}
+
--- /dev/null
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ug-mp-group-list.h"
+#include "mp-media-info.h"
+#include "ug-mp-common.h"
+#include "ug-mp-track-list.h"
+
+typedef struct{
+ struct ug_data *ugd;
+
+ Evas_Object *no_content;
+ Evas_Object *genlist;
+
+ Elm_Genlist_Item_Class itc;
+
+ mp_group_type_e type;
+ char *type_str;
+ int playlist_id;
+
+ mp_media_list_h group_list;
+}group_list_data_t;
+
+#define GET_LIST_DATA(obj) evas_object_data_get(obj, "list_data")
+
+static Evas_Object *
+_ug_mp_create_genlist(Evas_Object *parent)
+{
+ Evas_Object *genlist = NULL;
+ MP_CHECK_NULL(parent);
+
+ genlist = elm_genlist_add(parent);
+ elm_genlist_select_mode_set(genlist, ELM_OBJECT_SELECT_MODE_ALWAYS);
+
+ return genlist;
+}
+
+#if 0
+#define TIME_FORMAT_LEN 15
+static void
+_format_duration(char *time, int ms)
+{
+ int sec = (ms + 500) / 1000;
+ int min = sec / 60;
+
+ if(min >= 60)
+ {
+ int hour = min / 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);
+}
+#endif
+
+static void _gl_sel_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ startfunc;
+ group_list_data_t *ld = data;
+ char *name = NULL;
+ int track_type = MP_GROUP_BY_ALBUM;
+ int playlist_id = 0;
+
+ elm_genlist_item_selected_set(event_info, EINA_FALSE);
+ MP_CHECK(ld);
+
+ mp_media_info_h media = elm_object_item_data_get(event_info);
+ MP_CHECK(media);
+ mp_media_info_group_get_main_info(media, &name);
+ DEBUG_TRACE("group_type: ld->type: %d, path: %s", ld->type, name);
+
+ if(ld->type == MP_GROUP_BY_PLAYLIST)
+ {
+ track_type = MP_TRACK_BY_PLAYLIST;
+ mp_media_info_group_get_playlist_id(media, &playlist_id);
+ }
+ else if(ld->type == MP_GROUP_BY_ARTIST)
+ track_type = MP_TRACK_BY_ARTIST;
+
+ Evas_Object *track_list = ug_mp_track_list_create(obj, ld->ugd, NULL);
+ ug_mp_track_list_set_data(track_list, track_type, name, playlist_id);
+ ug_mp_track_list_update(track_list);
+
+ elm_naviframe_item_push(ld->ugd->navi_bar, name, NULL, NULL, track_list, NULL);
+
+}
+
+static void
+_layout_del_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
+{
+ startfunc;
+ group_list_data_t *ld = data;
+ MP_CHECK(ld);
+
+ IF_FREE(ld->type_str);
+
+ free(ld);
+}
+
+static void
+_ug_mp_itc_init(int type, group_list_data_t *ld)
+{
+ MP_CHECK(ld);
+
+ ld->itc.func.content_get = ug_mp_group_content_get;
+ switch(type)
+ {
+ case MP_GROUP_BY_ALBUM:
+ ld->itc.item_style = "3text.1icon.2";
+ ld->itc.func.text_get = ug_mp_album_text_get;
+ ld->type = MP_GROUP_BY_ALBUM;
+ break;
+ case MP_GROUP_BY_ARTIST:
+ ld->itc.item_style = "2text.1icon";
+ ld->itc.func.text_get = ug_mp_artist_text_get;
+ ld->type = MP_GROUP_BY_ARTIST;
+ break;
+ case MP_GROUP_BY_PLAYLIST:
+ ld->itc.item_style = "2text.1icon";
+ ld->itc.func.text_get = ug_mp_playlist_text_get;
+ ld->type = MP_GROUP_BY_PLAYLIST;
+ break;
+ default:
+ ERROR_TRACE("Invalid vd->type: %d", type);
+ break;
+ }
+}
+
+
+Evas_Object *ug_mp_group_list_create(Evas_Object *parent, struct ug_data *ugd)
+{
+ startfunc;
+ Evas_Object *layout ;
+ group_list_data_t *ld = NULL;
+
+ MP_CHECK_NULL(parent);
+ MP_CHECK_NULL(ugd);
+
+ layout = elm_layout_add(parent);
+ elm_layout_theme_set(layout, "layout", "application", "default");
+ MP_CHECK_NULL(layout);
+
+ ld = calloc(1, sizeof(group_list_data_t));
+ MP_CHECK_NULL(ld);
+
+ ld->ugd = ugd;
+
+ evas_object_data_set(layout, "list_data", ld);
+ evas_object_event_callback_add(layout, EVAS_CALLBACK_FREE, _layout_del_cb, ld);
+
+ return layout;
+}
+
+int ug_mp_group_list_update(Evas_Object *list)
+{
+ startfunc;
+ Evas_Object *content;
+
+ int count = 0;
+ group_list_data_t *ld = GET_LIST_DATA(list);
+ MP_CHECK_VAL(ld, -1);
+
+ if(ld->group_list)
+ {
+ mp_media_info_group_list_destroy(ld->group_list);
+ ld->group_list = NULL;
+ }
+
+ content = elm_layout_content_get(list, "elm.swallow.content");
+ evas_object_del(content);
+
+ mp_media_info_group_list_count(ld->type, ld->type_str, NULL, &count);
+ if(count)
+ {
+ content = _ug_mp_create_genlist(list);
+ 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);
+ elm_genlist_item_append(content, &ld->itc, media, NULL, ELM_GENLIST_ITEM_NONE, _gl_sel_cb, ld);
+ }
+ }
+ else {
+ NoContentType_e type = NO_CONTENT_SONG;
+ if (ld->type == MP_GROUP_BY_PLAYLIST)
+ type = NO_CONTENT_PLAYLIST;
+ else if (ld->type == MP_GROUP_BY_ARTIST)
+ type = NO_CONTENT_ARTIST;
+ else if (ld->type == MP_GROUP_BY_ALBUM)
+ type = NO_CONTENT_ALBUM;
+
+ content = ug_mp_widget_no_content_add(list, type);
+ }
+
+ elm_layout_content_set(list, "elm.swallow.content", content);
+
+ return 0;
+}
+
+int ug_mp_group_list_set_data(Evas_Object *list, int group_type, const char *type_str)
+{
+ startfunc;
+ group_list_data_t *ld = GET_LIST_DATA(list);
+ MP_CHECK_VAL(ld, -1);
+
+ ld->type = group_type;
+ ld->type_str = g_strdup(type_str);
+
+ _ug_mp_itc_init(group_type, ld);
+
+ return 0;
+}
+
+
--- /dev/null
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "ug-mp-library-view.h"
+#include "ug-mp-track-list.h"
+#include "ug-mp-group-list.h"
+#include "ug-mp-common.h"
+
+typedef struct{
+ struct ug_data *ugd;
+
+ Evas_Object *toolbar;
+ Evas_Object *list;
+
+}lib_view_data_t;
+
+enum{
+ TAB_ALL,
+ TAB_PLAYLIST,
+ TAB_ALBUM,
+ TAB_ARTIST,
+ TAB_MAX,
+};
+
+static Elm_Object_Item *g_tab_item[TAB_MAX];
+static Evas_Object *g_ly;
+static Elm_Object_Item *g_navi_it;
+
+static void _all_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ startfunc;
+ struct ug_data *ugd = data;
+ Evas_Object *sub_view;
+
+ MP_CHECK(ugd);
+
+ sub_view = elm_object_part_content_unset(g_ly, "elm.swallow.content");
+ evas_object_del(sub_view);
+
+ sub_view = ug_mp_track_list_create(g_ly, ugd, g_navi_it);
+ ug_mp_track_list_update(sub_view);
+
+ elm_object_part_content_set(g_ly, "elm.swallow.content", sub_view);
+ evas_object_show(sub_view);
+}
+
+static void _playlist_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ startfunc;
+ struct ug_data *ugd = data;
+ Evas_Object *sub_view;
+
+ MP_CHECK(ugd);
+
+ sub_view = elm_object_part_content_unset(g_ly, "elm.swallow.content");
+ evas_object_del(sub_view);
+
+ sub_view = ug_mp_group_list_create(g_ly, ugd);
+ ug_mp_group_list_set_data(sub_view, MP_GROUP_BY_PLAYLIST, NULL);
+ ug_mp_group_list_update(sub_view);
+
+ elm_object_part_content_set(g_ly, "elm.swallow.content", sub_view);
+ evas_object_show(sub_view);
+}
+
+static void _artist_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ startfunc;
+ struct ug_data *ugd = data;
+ Evas_Object *sub_view;
+
+ MP_CHECK(ugd);
+
+ sub_view = elm_object_part_content_unset(g_ly, "elm.swallow.content");
+ evas_object_del(sub_view);
+
+ sub_view = ug_mp_group_list_create(g_ly, ugd);
+ ug_mp_group_list_set_data(sub_view, MP_GROUP_BY_ARTIST, NULL);
+ ug_mp_group_list_update(sub_view);
+
+ elm_object_part_content_set(g_ly, "elm.swallow.content", sub_view);
+ evas_object_show(sub_view);
+}
+
+static void _album_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ startfunc;
+ struct ug_data *ugd = data;
+ Evas_Object *sub_view;
+
+ MP_CHECK(ugd);
+
+ sub_view = elm_object_part_content_unset(g_ly, "elm.swallow.content");
+ evas_object_del(sub_view);
+
+ sub_view = ug_mp_group_list_create(g_ly, ugd);
+ ug_mp_group_list_set_data(sub_view, MP_GROUP_BY_ALBUM, NULL);
+ ug_mp_group_list_update(sub_view);
+
+ elm_object_part_content_set(g_ly, "elm.swallow.content", sub_view);
+ evas_object_show(sub_view);
+}
+
+
+static Evas_Object *_create_tabbar(Evas_Object *parent, struct ug_data *ugd)
+{
+ Evas_Object *obj;
+
+ /* create toolbar */
+ obj = elm_toolbar_add(parent);
+ if(obj == NULL) return NULL;
+ elm_toolbar_shrink_mode_set(obj, ELM_TOOLBAR_SHRINK_EXPAND);
+ elm_toolbar_reorder_mode_set(obj, EINA_FALSE);
+ elm_toolbar_transverse_expanded_set(obj, EINA_TRUE);
+
+ elm_object_signal_emit(parent, "elm,state,default,tabbar", "elm");
+ elm_object_style_set(obj, "tabbar");
+
+ g_tab_item[TAB_ALL] = elm_toolbar_item_append(obj, NULL, GET_STR(UG_MP_TEXT_ALL), _all_cb, ugd);
+ g_tab_item[TAB_PLAYLIST] = elm_toolbar_item_append(obj, NULL, GET_STR(UG_MP_TEXT_PLAYLISTS), _playlist_cb, ugd);
+ g_tab_item[TAB_ALBUM] = elm_toolbar_item_append(obj, NULL, GET_STR(UG_MP_TEXT_ALBUMS), _album_cb, ugd);
+ g_tab_item[TAB_ARTIST] = elm_toolbar_item_append(obj, NULL, GET_STR(UG_MP_TEXT_ARTISTS), _artist_cb, ugd);
+
+ elm_toolbar_select_mode_set(obj, ELM_OBJECT_SELECT_MODE_ALWAYS);
+ elm_toolbar_item_selected_set(g_tab_item[TAB_ALL], EINA_TRUE);
+
+ return obj;
+}
+
+void
+ug_mp_library_view_create(struct ug_data *ugd)
+{
+ startfunc;
+
+ Evas_Object *tabbar;
+
+ {
+ g_ly = elm_layout_add(ugd->navi_bar);
+ elm_layout_theme_set(g_ly, "layout", "tabbar", "default");
+
+ Evas_Object *btn = elm_button_add(ugd->navi_bar);
+ elm_object_style_set(btn, "naviframe/back_btn/default");
+
+ evas_object_smart_callback_add(btn, "clicked", ug_mp_quit_cb, ugd);
+
+ g_navi_it = elm_naviframe_item_push(ugd->navi_bar, NULL, btn, NULL, g_ly, NULL);
+ elm_naviframe_item_title_visible_set(g_navi_it, EINA_FALSE);
+
+ tabbar = _create_tabbar(g_ly, ugd);
+ elm_object_part_content_set(g_ly, "elm.swallow.tabbar", tabbar);
+
+ }
+}
+
--- /dev/null
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ug-mp-track-list.h"
+#include "mp-media-info.h"
+#include "ug-mp-common.h"
+
+typedef struct{
+ struct ug_data *ugd;
+
+ Evas_Object *no_content;
+ Evas_Object *genlist;
+ Evas_Object *btn_done;
+
+ Elm_Genlist_Item_Class itc;
+
+ mp_track_type_e t_type;
+ char *type_str;
+ int playlist_id;
+ bool multiple;
+
+ mp_media_list_h track_list;
+
+ Ecore_Timer *destroy_idler;
+}track_list_data_t;
+
+typedef struct
+{
+ //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 *
+_ug_mp_create_genlist(Evas_Object *parent)
+{
+ Evas_Object *genlist = NULL;
+ MP_CHECK_NULL(parent);
+
+ genlist = elm_genlist_add(parent);
+ elm_genlist_select_mode_set(genlist, ELM_OBJECT_SELECT_MODE_ALWAYS);
+
+ return genlist;
+}
+#if 0
+#define TIME_FORMAT_LEN 15
+static void
+_format_duration(char *time, int ms)
+{
+ int sec = (ms + 500) / 1000;
+ int min = sec / 60;
+
+ if(min >= 60)
+ {
+ int hour = min / 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);
+}
+#endif
+static Evas_Object *_gl_content_get(void *data, Evas_Object *obj, const char *part)
+{
+ Evas_Object *content = NULL;
+ char *thumbpath = NULL;
+
+ list_item_data_t *it_data = data;
+ MP_CHECK(it_data);
+
+ mp_media_info_h media = it_data->media;
+
+ if (!strcmp(part, "elm.icon"))
+ {
+ content = elm_bg_add(obj);
+ elm_bg_load_size_set(content, ICON_SIZE, ICON_SIZE);
+
+ mp_media_info_get_thumbnail_path(media, &thumbpath);
+
+ if(ug_mp_check_image_valid( evas_object_evas_get(obj), thumbpath))
+ elm_bg_file_set(content, thumbpath, NULL);
+ else
+ elm_bg_file_set(content, DEFAULT_THUMBNAIL, NULL);
+ }
+
+ if (elm_genlist_decorate_mode_get(obj) )
+ { // if edit mode
+ if (!strcmp(part, "elm.edit.icon.1"))
+ { // swallow checkbox or radio button
+ content = elm_check_add(obj);
+ elm_check_state_pointer_set(content, &it_data->checked);
+ return content;
+ }
+ }
+
+ return content;
+}
+
+static char *_gl_text_get(void *data, Evas_Object *obj, const char *part)
+{
+ char *text = NULL;
+
+ list_item_data_t *it_data = data;
+ MP_CHECK(it_data);
+
+ mp_media_info_h media = it_data->media;
+
+ int ret = 0;
+ if (strcmp(part, "elm.text.1") == 0) {
+ ret = mp_media_info_get_title(media, &text);
+ MP_CHECK_NULL(ret==0);
+ return g_strdup(text);
+ }else if (strcmp(part, "elm.text.2") == 0) {
+ ret = mp_media_info_get_artist(media, &text);
+ MP_CHECK_NULL(ret==0);
+ return g_strdup(text);
+ }/*else if(strcmp(part, "elm.text.3") == 0) {
+ int dur;
+ char time[TIME_FORMAT_LEN+1] = "";
+ ret = mp_media_info_get_duration(media, &dur);
+ MP_CHECK_NULL(ret==0);
+ _format_duration(time, dur);
+ time[TIME_FORMAT_LEN] = '\0';
+ return g_strdup(time);
+ }*/
+ return NULL;
+}
+
+static void _gl_del(void *data, Evas_Object *obj)
+{
+ list_item_data_t *it_data = data;
+ IF_FREE(it_data);
+}
+
+static Eina_Bool
+_destory_idler_cb(void *data)
+{
+ track_list_data_t *ld = data;
+ MP_CHECK_FALSE(ld);
+ ld->destroy_idler = NULL;
+ ug_destroy_me(ld->ugd->ug);
+ return EINA_FALSE;
+}
+
+static unsigned int
+_get_select_count(Evas_Object *genlist)
+{
+ unsigned int count = 0;
+ Elm_Object_Item *item;
+ list_item_data_t *data = NULL;
+
+ item = mp_list_first_item_get(genlist);
+ while(item)
+ {
+ data = elm_object_item_data_get(item);
+ item = mp_list_item_next_get(item);
+ if(data && data->checked)
+ {
+ count++;
+ }
+ }
+ return count;
+}
+
+static void _gl_sel_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ startfunc;
+ track_list_data_t *ld = data;
+ char *path = NULL;
+
+ elm_genlist_item_selected_set(event_info, EINA_FALSE);
+ MP_CHECK(ld);
+ MP_CHECK(!ld->destroy_idler);
+
+ list_item_data_t *it_data = elm_object_item_data_get(event_info);
+ MP_CHECK(it_data);
+
+ if (elm_genlist_decorate_mode_get(obj) )
+ {
+ it_data->checked = !it_data->checked;
+ elm_genlist_item_fields_update(event_info, "elm.edit.icon.1", ELM_GENLIST_ITEM_FIELD_CONTENT);
+ /*
+ if(_get_select_count(obj))
+ elm_object_disabled_set(ld->btn_done, false);
+ else
+ elm_object_disabled_set(ld->btn_done, true);*/
+ return;
+ }
+
+ mp_media_info_h media = it_data->media;
+ MP_CHECK(media);
+ mp_media_info_get_file_path(media, &path);
+ DEBUG_TRACE("path: %s", path);
+
+ service_h service = NULL;
+ service_create(&service);
+ service_add_extra_data(service, "uri", path);
+ service_add_extra_data(service, UG_MP_OUTPUT_KEY, path);
+
+ ug_send_result(ld->ugd->ug, service);
+ ld->destroy_idler = ecore_timer_add(0.1, _destory_idler_cb, ld);
+
+ service_destroy(service);
+}
+
+static void
+_layout_del_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
+{
+ startfunc;
+ track_list_data_t *ld = data;
+ MP_CHECK(ld);
+
+ IF_FREE(ld->type_str);
+
+ free(ld);
+}
+
+static void _done_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ startfunc;
+ char *fmt = ";%s";
+ GString *path = NULL;
+ track_list_data_t *ld = data;
+ Elm_Object_Item *item;
+ MP_CHECK(ld);
+
+ item = mp_list_first_item_get(ld->genlist);
+ while(item)
+ {
+ list_item_data_t *it_data = elm_object_item_data_get(item);
+ item = mp_list_item_next_get(item);
+ if(it_data && it_data->checked)
+ {
+ char *tmp = NULL;
+ mp_media_info_h media = it_data->media;
+ MP_CHECK(media);
+ mp_media_info_get_file_path(media, &tmp);
+ DEBUG_TRACE("path: %s", tmp);
+ if (path == NULL)
+ path = g_string_new(tmp);
+ else
+ g_string_append_printf(path, fmt, tmp);
+ }
+ }
+
+ MP_CHECK(path);
+
+ service_h service = NULL;
+ service_create(&service);
+ service_add_extra_data(service, "uri", path->str);
+ service_add_extra_data(service, UG_MP_OUTPUT_KEY, path->str);
+
+ ug_send_result(ld->ugd->ug, service);
+ ld->destroy_idler = ecore_timer_add(0.1, _destory_idler_cb, ld);
+
+ service_destroy(service);
+
+ g_string_free(path, TRUE);
+
+}
+
+Evas_Object *ug_mp_track_list_create(Evas_Object *parent, struct ug_data *ugd, Elm_Object_Item *navi_it)
+{
+ startfunc;
+ Evas_Object *layout ;
+ track_list_data_t *ld = NULL;
+
+ MP_CHECK_NULL(parent);
+ MP_CHECK_NULL(ugd);
+
+ layout = elm_layout_add(parent);
+ elm_layout_theme_set(layout, "layout", "application", "default");
+ MP_CHECK_NULL(layout);
+
+ ld = calloc(1, sizeof(track_list_data_t));
+ MP_CHECK_NULL(ld);
+
+ ld->ugd = ugd;
+ if(ugd->select_type == UG_MP_SELECT_MULTI)
+ ld->multiple = true;
+
+ evas_object_data_set(layout, "list_data", 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";
+ ld->itc.func.text_get = _gl_text_get;
+ ld->itc.func.del = _gl_del;
+ ld->itc.decorate_all_item_style = "edit_default";
+
+ if(ugd->select_type == UG_MP_SELECT_MULTI)
+ {
+ Evas_Object *btn = elm_button_add(ugd->navi_bar);
+ elm_object_style_set(btn, "naviframe/toolbar/default");
+ elm_object_text_set(btn, GET_SYS_STR("IDS_COM_POP_DONE"));
+ evas_object_smart_callback_add(btn, "clicked", _done_cb, ld);
+ elm_object_item_part_content_set(navi_it, "toolbar_button1", btn);
+ //elm_object_disabled_set(btn, true);
+ ld->btn_done = btn;
+ }
+ return layout;
+}
+
+int ug_mp_track_list_update(Evas_Object *list)
+{
+ startfunc;
+ Evas_Object *content;
+
+ int count = 0;
+ track_list_data_t *ld = GET_LIST_DATA(list);
+ MP_CHECK_VAL(ld, -1);
+
+ if(ld->track_list)
+ {
+ mp_media_info_list_destroy(ld->track_list);
+ ld->track_list = NULL;
+ }
+
+ content = elm_layout_content_get(list, "elm.swallow.content");
+ evas_object_del(content);
+
+ mp_media_info_list_count(ld->t_type, ld->type_str, NULL, NULL, ld->playlist_id, &count);
+ if(count)
+ {
+ ld->genlist = content = _ug_mp_create_genlist(list);
+ mp_media_info_list_create(&ld->track_list, ld->t_type, ld->type_str, NULL, NULL, ld->playlist_id, 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);
+ list_item_data_t *data = calloc(1, sizeof(list_item_data_t));
+ data->media = media;
+
+ elm_genlist_item_append(content, &ld->itc, data, NULL, ELM_GENLIST_ITEM_NONE, _gl_sel_cb, ld);
+ }
+
+ if(ld->multiple)
+ elm_genlist_decorate_mode_set(content, true);
+ }
+ else
+ content = ug_mp_widget_no_content_add(list, NO_CONTENT_SONG);
+
+ elm_layout_content_set(list, "elm.swallow.content", content);
+
+ return 0;
+}
+
+int ug_mp_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);
+ MP_CHECK_VAL(ld, -1);
+
+ ld->t_type = track_type;
+ IF_FREE(ld->type_str);
+ ld->type_str = g_strdup(type_str);
+ ld->playlist_id = playlist_id;
+
+ return 0;
+}
+
+
--- /dev/null
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ug-mp-efl.h"
+
+Evas_Object *
+ug_mp_widget_no_content_add(Evas_Object *parent, NoContentType_e type)
+{
+ MP_CHECK_NULL(parent);
+ Evas_Object *nocontents = NULL;
+ nocontents = elm_layout_add(parent);
+ elm_layout_theme_set(nocontents, "layout", "nocontents", "multimedia");
+
+ const char *ids;
+ if (type == NO_CONTENT_PLAYLIST)
+ ids = UG_MP_TEXT_NO_PLAYLIST;
+ else if (type == NO_CONTENT_ALBUM)
+ ids = UG_MP_TEXT_ALBUMS;
+ else if (type == NO_CONTENT_ARTIST)
+ ids = UG_MP_TEXT_ARTISTS;
+ else
+ ids = UG_MP_TEXT_NO_SONGS;
+
+ elm_object_text_set(nocontents, GET_STR(ids));
+ elm_object_focus_allow_set(nocontents, EINA_TRUE);
+
+ return nocontents;
+}
+
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="ug-music-player-efl" version="0.1" install-location="internal-only">
+ <label>music-player-efl</label>
+ <author email="hm2007.kim" href="www.samsung.com">Hyungmin Kim</author>
+ <description>Music player shortcut ug</description>
+ <ui-application appid="music-player-efl" exec="/usr/ug/bin/music-player-efl" nodisplay="true" multiple="true" type="capp" taskmanage="false">
+ <icon>music-player-efl.png</icon>
+ <label>Music Player Appcontrol</label>
+ <label xml:lang="en-us">Music Player Appcontrol</label>
+ <application-service>
+ <operation name="http://tizen.org/appcontrol/operation/pick" />
+ <mime name="audio/*" />
+ </application-service>
+ </ui-application>
+</manifest>