ecore: add an efl.loop_user class.

This commit is contained in:
Cedric BAIL 2016-05-05 16:18:18 -07:00
parent e282ab61d7
commit 05424556b0
4 changed files with 51 additions and 3 deletions

View File

@ -2,15 +2,16 @@
### Library
ecore_eolian_files_legacy = \
lib/ecore/efl_timer.eo \
lib/ecore/ecore_poller.eo \
lib/ecore/ecore_exe.eo \
lib/ecore/ecore_animator.eo
ecore_eolian_files = \
$(ecore_eolian_files_legacy) \
lib/ecore/efl_loop.eo \
lib/ecore/ecore_parent.eo
lib/ecore/efl_loop_user.eo \
lib/ecore/efl_timer.eo \
lib/ecore/ecore_parent.eo \
$(ecore_eolian_files_legacy)
ecore_eolian_type_files = \
lib/ecore/ecore_types.eot
@ -58,6 +59,7 @@ lib/ecore/ecore_idle_exiter.c \
lib/ecore/ecore_idler.c \
lib/ecore/ecore_job.c \
lib/ecore/ecore_main.c \
lib/ecore/efl_loop_user.c \
lib/ecore/ecore_pipe.c \
lib/ecore/ecore_poller.c \
lib/ecore/ecore_time.c \

View File

@ -62,6 +62,8 @@ extern "C" {
#include "efl_loop.eo.h"
#include "efl_loop_user.eo.h"
/* We ue the factory pattern here, so you shouldn't call eo_add directly. */
EAPI Eo *ecore_main_loop_get(void);

View File

@ -0,0 +1,29 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <Ecore.h>
#include "ecore_private.h"
typedef struct _Efl_Loop_User_Data Efl_Loop_User_Data;
struct _Efl_Loop_User_Data
{
};
static Efl_Loop *
_efl_loop_user_loop_get(Eo *obj, Efl_Loop_User_Data *pd EINA_UNUSED)
{
return eo_provider_find(obj, EFL_LOOP_CLASS);
}
static void
_efl_loop_user_eo_base_parent_set(Eo *obj, Efl_Loop_User_Data *pd EINA_UNUSED, Eo_Base *parent)
{
if (parent != NULL && eo_provider_find(parent, EFL_LOOP_CLASS) == NULL)
return ;
eo_parent_set(eo_super(obj, EFL_LOOP_USER_CLASS), parent);
}
#include "efl_loop_user.eo.c"

View File

@ -0,0 +1,15 @@
class Efl.Loop_User (Eo.Base)
{
[[An Efl.Loop_User is a class that require one of the parent to provide
an Efl.Loop interface when doing provider_find. It will enforce this by
only allowing parent that provide such interface or NULL.]]
legacy_prefix: null;
methods {
loop_get {
return: Efl.Loop *;
}
}
implements {
Eo.Base.parent.set;
}
}