efl_loop: declare this class function to the object
authorMarcel Hollerbach <mail@marcel-hollerbach.de>
Wed, 20 Feb 2019 12:12:37 +0000 (13:12 +0100)
committerWonki Kim <wonki_.kim@samsung.com>
Fri, 8 Mar 2019 11:49:34 +0000 (20:49 +0900)
we pass the object as first argument, so everything is just like object
function, thus we can declare it like this.

ref T7597

src/lib/ecore/efl_loop.c
src/lib/ecore/efl_loop.eo

index 1096c62..9c7dcfd 100644 (file)
@@ -29,22 +29,20 @@ struct _Efl_Loop_Promise_Simple_Data
 GENERIC_ALLOC_SIZE_DECLARE(Efl_Loop_Promise_Simple_Data);
 
 EOLIAN static Efl_Loop_Message_Handler *
-_efl_loop_message_handler_get(Efl_Loop *loop, const Efl_Class *klass)
+_efl_loop_message_handler_get(Eo *obj, Efl_Loop_Data *pd EINA_UNUSED, const Efl_Class *klass)
 {
    Message_Handler mh = { 0 }, *mh2;
-   Efl_Loop_Data *ld = efl_data_scope_get(loop, EFL_LOOP_CLASS);
    unsigned int i, n;
 
-   if (!ld) return NULL;
-   n = eina_inarray_count(ld->message_handlers);
+   n = eina_inarray_count(pd->message_handlers);
    for (i = 0; i < n; i++)
      {
-        mh2 = eina_inarray_nth(ld->message_handlers, i);
+        mh2 = eina_inarray_nth(pd->message_handlers, i);
         if (mh2->klass == klass) return mh2->handler;
      }
    mh.klass = klass;
-   mh.handler = efl_add(klass, loop);
-   eina_inarray_push(ld->message_handlers, &mh);
+   mh.handler = efl_add(klass, obj);
+   eina_inarray_push(pd->message_handlers, &mh);
    return mh.handler;
 }
 
index 737c641..4516c4c 100644 (file)
@@ -98,13 +98,12 @@ class @beta Efl.Loop extends Efl.Task
          }
          return: bool; [[$true if successfully unregistered, $false otherwise.]]
       }
-      message_handler_get @class {
+      message_handler_get {
          [[Get a message handler object that is created by and owned by
            the Efl.Loop object, so you can listen to this message type by
            listening to message events on the handler as well as send
            objects as events.]]
          params {
-            @in loop: Efl.Loop; [[The loop to get the object from.]]
             @in klass: const(Efl.Class); [[The class of the message object.]]
          }
          return: Efl.Loop_Message_Handler; [[The message handler to use.]]