efl_loop: declare this class function to the object

we pass the object as first argument, so everything is just like object
function, thus we can declare it like this.

ref T7597
This commit is contained in:
Marcel Hollerbach 2019-02-20 13:12:37 +01:00
parent 5284ac36ca
commit 5ee81f7720
2 changed files with 6 additions and 9 deletions

View 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;
}

View 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.]]