Commit 23df8c8b authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Use a consistent view_sys for view private data

parent 39951002
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
struct video_controller struct video_controller
{ {
application* p_app; application* p_app;
video_view* p_view; view_sys* p_view;
// This is the content as a video_list_item list. // This is the content as a video_list_item list.
Eina_List* p_content; Eina_List* p_content;
}; };
...@@ -119,7 +119,7 @@ video_controller_file_updated_cb( void* p_data, const media_item* p_new_media_it ...@@ -119,7 +119,7 @@ video_controller_file_updated_cb( void* p_data, const media_item* p_new_media_it
} }
video_controller* video_controller*
video_controller_create( application* p_app, video_view* p_view ) video_controller_create(application* p_app, view_sys* p_view )
{ {
video_controller* ctrl = calloc(1, sizeof(*ctrl)); video_controller* ctrl = calloc(1, sizeof(*ctrl));
if ( ctrl == NULL ) if ( ctrl == NULL )
......
...@@ -28,11 +28,9 @@ ...@@ -28,11 +28,9 @@
#define VIDEO_CONTROLLER_H_ #define VIDEO_CONTROLLER_H_
#include "application.h" #include "application.h"
#include "ui/interface.h"
typedef struct video_view video_view;
video_controller* video_controller*
video_controller_create( application* p_app, video_view* p_view ); video_controller_create( application* p_app, view_sys* p_view );
#endif /* VIDEO_CONTROLLER_H_ */ #endif /* VIDEO_CONTROLLER_H_ */
...@@ -45,14 +45,16 @@ intf_get_application(interface *); ...@@ -45,14 +45,16 @@ intf_get_application(interface *);
void void
intf_destroy(interface *); intf_destroy(interface *);
typedef struct view_sys view_sys;
/* Views */ /* Views */
typedef struct interface_view { typedef struct interface_view {
Evas_Object *view; /* The Evas View prepared to be stacked */ Evas_Object *view; /* The Evas View prepared to be stacked */
void *view_sys; /* The view private data */ view_sys *p_view_sys; /* The view private data */
void (*pf_start)(void *view_sys); /* CB when the view is started/resumed */ void (*pf_start)(view_sys *p_view_sys); /* CB when the view is started/resumed */
void (*pf_stop) (void *view_sys); /* CB when the view is stoped/paused */ void (*pf_stop) (view_sys *p_view_sys); /* CB when the view is stoped/paused */
bool (*pf_event)(void *view_sys, int event); /* */ bool (*pf_event)(view_sys *p_view_sys, int event); /* */
} interface_view; } interface_view;
typedef enum view_e { typedef enum view_e {
......
...@@ -47,18 +47,18 @@ typedef enum audio_view_type ...@@ -47,18 +47,18 @@ typedef enum audio_view_type
AUDIO_VIEW_MAX, AUDIO_VIEW_MAX,
} audio_view_type; } audio_view_type;
typedef struct audio_view struct view_sys
{ {
interface *p_intf; interface *p_intf;
Evas_Object *nf_toolbar; Evas_Object *nf_toolbar;
Evas_Object *audio_lists[AUDIO_VIEW_MAX]; Evas_Object *audio_lists[AUDIO_VIEW_MAX];
} audio_view; };
typedef struct audio_list_item typedef struct audio_list_item
{ {
const audio_view *p_av; const view_sys *p_av;
const Elm_Genlist_Item_Class *itc; const Elm_Genlist_Item_Class *itc;
...@@ -66,7 +66,7 @@ typedef struct audio_list_item ...@@ -66,7 +66,7 @@ typedef struct audio_list_item
} audio_list_item; } audio_list_item;
static Evas_Object* static Evas_Object*
create_audio_list(const audio_view *av); create_audio_list(const view_sys *av);
static void static void
genlist_selected_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) genlist_selected_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
...@@ -156,7 +156,7 @@ genlist_content_get_cb(void *data, Evas_Object *obj, const char *part) ...@@ -156,7 +156,7 @@ genlist_content_get_cb(void *data, Evas_Object *obj, const char *part)
} }
static audio_list_item * static audio_list_item *
genlist_audio_item_create(const audio_view *av, Evas_Object *parent_genlist, const char *psz_path, const char *psz_title, Elm_Genlist_Item_Class *itc) genlist_audio_item_create(const view_sys *av, Evas_Object *parent_genlist, const char *psz_path, const char *psz_title, Elm_Genlist_Item_Class *itc)
{ {
audio_list_item *ali = malloc(sizeof(*ali)); audio_list_item *ali = malloc(sizeof(*ali));
ali->p_av = av; ali->p_av = av;
...@@ -180,7 +180,7 @@ genlist_audio_item_create(const audio_view *av, Evas_Object *parent_genlist, con ...@@ -180,7 +180,7 @@ genlist_audio_item_create(const audio_view *av, Evas_Object *parent_genlist, con
} }
static Evas_Object* static Evas_Object*
genlist_create(const audio_view *av, Elm_Genlist_Item_Class **itc ) genlist_create(const view_sys *av, Elm_Genlist_Item_Class **itc )
{ {
Evas_Object *genlist = elm_genlist_add(av->nf_toolbar); Evas_Object *genlist = elm_genlist_add(av->nf_toolbar);
/* Set the genlist scoller mode */ /* Set the genlist scoller mode */
...@@ -200,7 +200,7 @@ genlist_create(const audio_view *av, Elm_Genlist_Item_Class **itc ) ...@@ -200,7 +200,7 @@ genlist_create(const audio_view *av, Elm_Genlist_Item_Class **itc )
} }
static Evas_Object* static Evas_Object*
create_audio_list(const audio_view *av) create_audio_list(const view_sys *av)
{ {
Elm_Genlist_Item_Class *itc; Elm_Genlist_Item_Class *itc;
Evas_Object *genlist = genlist_create(av, &itc); Evas_Object *genlist = genlist_create(av, &itc);
...@@ -256,7 +256,7 @@ create_audio_list(const audio_view *av) ...@@ -256,7 +256,7 @@ create_audio_list(const audio_view *av)
} }
static Evas_Object* static Evas_Object*
create_audio_list_type(audio_view *av, audio_view_type type ) create_audio_list_type(view_sys *av, audio_view_type type )
{ {
Evas_Object *genlist = av->audio_lists[type]; Evas_Object *genlist = av->audio_lists[type];
if(genlist == NULL) if(genlist == NULL)
...@@ -279,7 +279,7 @@ create_audio_list_type(audio_view *av, audio_view_type type ) ...@@ -279,7 +279,7 @@ create_audio_list_type(audio_view *av, audio_view_type type )
static void static void
tabbar_item_cb(void *data, Evas_Object *obj, void *event_info) tabbar_item_cb(void *data, Evas_Object *obj, void *event_info)
{ {
audio_view *av = data; view_sys *av = data;
/* Get the item selected in the toolbar */ /* Get the item selected in the toolbar */
const char *str = elm_object_item_text_get((Elm_Object_Item *)event_info); const char *str = elm_object_item_text_get((Elm_Object_Item *)event_info);
...@@ -300,7 +300,7 @@ tabbar_item_cb(void *data, Evas_Object *obj, void *event_info) ...@@ -300,7 +300,7 @@ tabbar_item_cb(void *data, Evas_Object *obj, void *event_info)
} }
static Evas_Object* static Evas_Object*
create_toolbar(audio_view *av, Evas_Object *parent) create_toolbar(view_sys *av, Evas_Object *parent)
{ {
/* Create and set the toolbar */ /* Create and set the toolbar */
Evas_Object *tabbar = elm_toolbar_add(parent); Evas_Object *tabbar = elm_toolbar_add(parent);
...@@ -333,12 +333,12 @@ create_audio_view(interface *intf, Evas_Object *parent) ...@@ -333,12 +333,12 @@ create_audio_view(interface *intf, Evas_Object *parent)
interface_view *view = calloc(1, sizeof(*view)); interface_view *view = calloc(1, sizeof(*view));
/* Setup the audio_view */ /* Setup the audio_view */
audio_view *av = calloc(1, sizeof(*av)); view_sys *audio_view_sys = calloc(1, sizeof(*audio_view_sys));
av->p_intf = intf; audio_view_sys->p_intf = intf;
for(int i = 0; i < AUDIO_VIEW_MAX; i++) for(int i = 0; i < AUDIO_VIEW_MAX; i++)
av->audio_lists[i] = NULL; audio_view_sys->audio_lists[i] = NULL;
view->view_sys = av; view->p_view_sys = audio_view_sys;
/* Content box */ /* Content box */
Evas_Object *audio_box = elm_box_add(parent); Evas_Object *audio_box = elm_box_add(parent);
...@@ -346,16 +346,16 @@ create_audio_view(interface *intf, Evas_Object *parent) ...@@ -346,16 +346,16 @@ create_audio_view(interface *intf, Evas_Object *parent)
evas_object_size_hint_align_set(audio_box, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_align_set(audio_box, EVAS_HINT_FILL, EVAS_HINT_FILL);
/* Create the toolbar in the view */ /* Create the toolbar in the view */
Evas_Object *tabbar = create_toolbar(av, audio_box); Evas_Object *tabbar = create_toolbar(audio_view_sys, audio_box);
elm_box_pack_end(audio_box, tabbar); elm_box_pack_end(audio_box, tabbar);
evas_object_show(tabbar); evas_object_show(tabbar);
/* Toolbar Naviframe */ /* Toolbar Naviframe */
av->nf_toolbar = elm_naviframe_add(audio_box); audio_view_sys->nf_toolbar = elm_naviframe_add(audio_box);
evas_object_size_hint_weight_set(av->nf_toolbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_weight_set(audio_view_sys->nf_toolbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(av->nf_toolbar, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_align_set(audio_view_sys->nf_toolbar, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(audio_box, av->nf_toolbar ); elm_box_pack_end(audio_box, audio_view_sys->nf_toolbar );
evas_object_show(av->nf_toolbar); evas_object_show(audio_view_sys->nf_toolbar);
/* Set the first item in the toolbar */ /* Set the first item in the toolbar */
elm_toolbar_item_selected_set(elm_toolbar_first_item_get(tabbar), EINA_TRUE); elm_toolbar_item_selected_set(elm_toolbar_first_item_get(tabbar), EINA_TRUE);
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include "ui/interface.h" #include "ui/interface.h"
#include "ui/audio_player.h" #include "ui/audio_player.h"
typedef struct audio_view audio_view;
interface_view * interface_view *
create_audio_view(interface *intf, Evas_Object *parent); create_audio_view(interface *intf, Evas_Object *parent);
......
...@@ -212,7 +212,8 @@ create_directory_view(interface *intf, Evas_Object *parent) ...@@ -212,7 +212,8 @@ create_directory_view(interface *intf, Evas_Object *parent)
directory_view *dv = malloc(sizeof(*dv)); directory_view *dv = malloc(sizeof(*dv));
dv->p_intf = intf; dv->p_intf = intf;
dv->p_parent = parent; dv->p_parent = parent;
view->view_sys = dv;
//view->p_view_sys = dv;
const char *psz_path = application_get_media_path(intf_get_application(intf), MEDIA_DIRECTORY); const char *psz_path = application_get_media_path(intf_get_application(intf), MEDIA_DIRECTORY);
view->view = browse(dv, psz_path); view->view = browse(dv, psz_path);
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#include <Elementary.h> #include <Elementary.h>
typedef struct video_view struct view_sys
{ {
interface *p_intf; interface *p_intf;
...@@ -46,11 +46,11 @@ typedef struct video_view ...@@ -46,11 +46,11 @@ typedef struct video_view
video_controller* p_controller; video_controller* p_controller;
Elm_Genlist_Item_Class* p_default_itc; Elm_Genlist_Item_Class* p_default_itc;
} video_view; };
typedef struct video_list_item typedef struct video_list_item
{ {
video_view *videoview; view_sys *videoview;
const Elm_Genlist_Item_Class *itc; const Elm_Genlist_Item_Class *itc;
...@@ -209,7 +209,7 @@ genlist_contracted_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void ...@@ -209,7 +209,7 @@ genlist_contracted_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
} }
video_list_item * video_list_item *
video_view_append_item(video_view *videoview, media_item* p_item) video_view_append_item(view_sys *videoview, media_item* p_item)
{ {
/* */ /* */
video_list_item *vli = calloc(1, sizeof(*vli)); video_list_item *vli = calloc(1, sizeof(*vli));
...@@ -239,7 +239,7 @@ video_view_append_item(video_view *videoview, media_item* p_item) ...@@ -239,7 +239,7 @@ video_view_append_item(video_view *videoview, media_item* p_item)
} }
void void
video_view_clear(video_view* videoview) video_view_clear(view_sys* videoview)
{ {
elm_genlist_clear(videoview->p_genlist); elm_genlist_clear(videoview->p_genlist);
} }
...@@ -248,10 +248,10 @@ interface_view* ...@@ -248,10 +248,10 @@ interface_view*
create_video_view(interface *intf, Evas_Object *parent) create_video_view(interface *intf, Evas_Object *parent)
{ {
interface_view *view = calloc(1, sizeof(*view)); interface_view *view = calloc(1, sizeof(*view));
video_view *vv = malloc(sizeof(*vv)); view_sys *vv = malloc(sizeof(*vv));
vv->p_intf = intf; vv->p_intf = intf;
vv->p_parent = parent; vv->p_parent = parent;
vv->p_controller = video_controller_create( intf_get_application(intf), vv); vv->p_controller = video_controller_create(intf_get_application(intf), vv);
/* Genlist class */ /* Genlist class */
vv->p_default_itc = elm_genlist_item_class_new(); vv->p_default_itc = elm_genlist_item_class_new();
...@@ -259,7 +259,7 @@ create_video_view(interface *intf, Evas_Object *parent) ...@@ -259,7 +259,7 @@ create_video_view(interface *intf, Evas_Object *parent)
vv->p_default_itc->item_style = "2line.top.3"; vv->p_default_itc->item_style = "2line.top.3";
vv->p_default_itc->func.text_get = genlist_text_get_cb; vv->p_default_itc->func.text_get = genlist_text_get_cb;
vv->p_default_itc->func.content_get = genlist_content_get_cb; vv->p_default_itc->func.content_get = genlist_content_get_cb;
view->view_sys = vv; view->p_view_sys = vv;
/* Set then create the Genlist object */ /* Set then create the Genlist object */
Evas_Object *genlist = vv->p_genlist = elm_genlist_add(parent); Evas_Object *genlist = vv->p_genlist = elm_genlist_add(parent);
......
...@@ -30,20 +30,19 @@ ...@@ -30,20 +30,19 @@
#include "ui/interface.h" #include "ui/interface.h"
#include <Elementary.h> #include <Elementary.h>
typedef struct video_view video_view;
typedef struct video_list_item video_list_item; typedef struct video_list_item video_list_item;
interface_view* interface_view*
create_video_view(interface *intf, Evas_Object *parent); create_video_view(interface *intf, Evas_Object *parent);
void void
video_view_update(video_view* vv, Eina_List* p_content); video_view_update(view_sys* vv, Eina_List* p_content);
video_list_item * video_list_item *
video_view_append_item(video_view *videoview, media_item* p_item); video_view_append_item(view_sys *videoview, media_item* p_item);
void void
video_view_clear(video_view* videoview); video_view_clear(view_sys* videoview);
const media_item* const media_item*
video_list_item_get_media_item(video_list_item* p_item); video_list_item_get_media_item(video_list_item* p_item);
......
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