Commit 7bdb1b2b authored by Ludovic Fauvet's avatar Ludovic Fauvet

directory: start (video) playback from the directory browser

parent 5e4739e4
......@@ -279,7 +279,7 @@ intf_create_view(interface *intf, int view_type)
view = create_audio_view(intf, nf_content);
break;
case VIEW_FILES:
view = create_directory_view(application_get_media_path(intf->p_app, MEDIA_DIRECTORY), nf_content);
view = create_directory_view(intf, application_get_media_path(intf->p_app, MEDIA_DIRECTORY), nf_content);
break;
case VIEW_SETTINGS:
view = create_setting_view(nf_content);
......
......@@ -32,10 +32,12 @@
#include <dirent.h>
#include "directory_view.h"
#include "ui/interface.h"
#include "ui/utils.h"
typedef struct directory_data {
Evas_Object *parent;
interface *p_intf;
char *file_path;
bool isFile;
} directory_data_s;
......@@ -45,14 +47,15 @@ list_selected_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
{
directory_data_s *dd = data;
if (dd->isFile){
/* TODO */
LOGD("Supposed to start playback here");
if (dd->isFile)
{
/* Start the playback of the given file */
intf_create_video_player(dd->p_intf, dd->file_path);
}
else
{
/* Continue to browse media folder */
create_directory_view(dd->file_path, dd->parent);
create_directory_view(dd->p_intf, dd->file_path, dd->parent);
}
}
......@@ -94,7 +97,7 @@ static int compare_sort_items(const void *data1, const void *data2)
}
Evas_Object*
create_directory_view(const char* path, Evas_Object *parent)
create_directory_view(interface *intf, const char* path, Evas_Object *parent)
{
char *cpath;
directory_data_s *dd;
......@@ -134,7 +137,7 @@ create_directory_view(const char* path, Evas_Object *parent)
/* Try to open the parent directory */
sprintf(tmppath, "%s/..", path);
return create_directory_view(tmppath, parent);
return create_directory_view(intf, tmppath, parent);
}
/* Create the box container */
......@@ -154,6 +157,7 @@ create_directory_view(const char* path, Evas_Object *parent)
dd = malloc(sizeof(*dd));
dd->parent = parent;
dd->isFile = false;
dd->p_intf = intf;
asprintf(&dd->file_path, "%s/..", cpath);
Elm_Object_Item *item = elm_list_item_append(file_list, "..", NULL, NULL, list_selected_cb, dd);
elm_object_item_del_cb_set(item, free_list_item_data);
......@@ -185,6 +189,7 @@ create_directory_view(const char* path, Evas_Object *parent)
dd = malloc(sizeof(*dd));
/* Put the list parent in the directory_data struct for callbacks */
dd->parent = parent;
dd->p_intf = intf;
dd->isFile = isFile;
dd->file_path = strdup(tmppath);
......
......@@ -27,7 +27,9 @@
#ifndef VIDEO_VIEW_H_
#define VIDEO_VIEW_H_
#include "ui/interface.h"
Evas_Object*
create_directory_view(const char* path, Evas_Object *parent);
create_directory_view(interface *intf, const char* path, Evas_Object *parent);
#endif /* VIDEO_VIEW_H_ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment