Commit 8be68f76 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

media_library_controller: Allow get_content callback to be overriden

parent 489f1fd9
......@@ -117,7 +117,7 @@ media_library_controller_content_changed_cb(void* p_data)
ctrl->p_content = NULL;
}
media_library* p_ml = (media_library*)application_get_media_library( ctrl->p_app );
ctrl->pf_media_library_get_content(p_ml, &media_library_controller_content_update_cb, ctrl);
ctrl->pf_media_library_get_content(p_ml, &media_library_controller_content_update_cb, ctrl->p_user_data);
}
void
......@@ -126,6 +126,13 @@ media_library_controller_refresh(media_library_controller* p_ctrl)
ecore_main_loop_thread_safe_call_async(&media_library_controller_content_changed_cb, p_ctrl);
}
void
media_library_controller_set_content_callback(media_library_controller* p_ctrl, pf_media_library_get_content_cb cb, void* p_user_data)
{
p_ctrl->pf_media_library_get_content = cb;
p_ctrl->p_user_data = p_user_data;
}
media_library_controller*
media_library_controller_create(application* p_app, list_view* p_list_view )
{
......@@ -134,6 +141,8 @@ media_library_controller_create(application* p_app, list_view* p_list_view )
return NULL;
ctrl->p_app = p_app;
ctrl->p_list_view = p_list_view;
/* Default the user data to ourselves. This is when the callbacks are our defaults ones */
ctrl->p_user_data = ctrl;
/* Populate it */
media_library* p_ml = (media_library*)application_get_media_library(p_app);
......
......@@ -39,4 +39,7 @@ media_library_controller_destroy(media_library_controller *);
void
media_library_controller_refresh( media_library_controller* p_ctrl );
void
media_library_controller_set_content_callback(media_library_controller* p_ctrl, void(*cb)(media_library* p_ml, media_library_list_cb cb, void* p_user_data), void* p_user_data);
#endif /* MEDIA_LIBRARY_CONTROLLER_H_ */
......@@ -42,6 +42,7 @@ struct media_library_controller
application* p_app;
list_view* p_list_view;
Eina_List* p_content;
void* p_user_data;
/**
* Callbacks & settings
......
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