cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=05424556b0974ef5695f6f6305658cb62f479f27

commit 05424556b0974ef5695f6f6305658cb62f479f27
Author: Cedric BAIL <ced...@osg.samsung.com>
Date:   Thu May 5 16:18:18 2016 -0700

    ecore: add an efl.loop_user class.
---
 src/Makefile_Ecore.am          |  8 +++++---
 src/lib/ecore/Ecore_Eo.h       |  2 ++
 src/lib/ecore/efl_loop_user.c  | 29 +++++++++++++++++++++++++++++
 src/lib/ecore/efl_loop_user.eo | 15 +++++++++++++++
 4 files changed, 51 insertions(+), 3 deletions(-)

diff --git a/src/Makefile_Ecore.am b/src/Makefile_Ecore.am
index b48d49f..371f981 100644
--- a/src/Makefile_Ecore.am
+++ b/src/Makefile_Ecore.am
@@ -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 \
diff --git a/src/lib/ecore/Ecore_Eo.h b/src/lib/ecore/Ecore_Eo.h
index 9db6e79..3106489 100644
--- a/src/lib/ecore/Ecore_Eo.h
+++ b/src/lib/ecore/Ecore_Eo.h
@@ -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);
 
diff --git a/src/lib/ecore/efl_loop_user.c b/src/lib/ecore/efl_loop_user.c
new file mode 100644
index 0000000..6aef76a
--- /dev/null
+++ b/src/lib/ecore/efl_loop_user.c
@@ -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"
diff --git a/src/lib/ecore/efl_loop_user.eo b/src/lib/ecore/efl_loop_user.eo
new file mode 100644
index 0000000..a4068a7
--- /dev/null
+++ b/src/lib/ecore/efl_loop_user.eo
@@ -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;
+   }
+}
\ No newline at end of file

-- 


Reply via email to