forked from enlightenment/efl
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:
parent
5284ac36ca
commit
5ee81f7720
|
@ -29,22 +29,20 @@ struct _Efl_Loop_Promise_Simple_Data
|
||||||
GENERIC_ALLOC_SIZE_DECLARE(Efl_Loop_Promise_Simple_Data);
|
GENERIC_ALLOC_SIZE_DECLARE(Efl_Loop_Promise_Simple_Data);
|
||||||
|
|
||||||
EOLIAN static Efl_Loop_Message_Handler *
|
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;
|
Message_Handler mh = { 0 }, *mh2;
|
||||||
Efl_Loop_Data *ld = efl_data_scope_get(loop, EFL_LOOP_CLASS);
|
|
||||||
unsigned int i, n;
|
unsigned int i, n;
|
||||||
|
|
||||||
if (!ld) return NULL;
|
n = eina_inarray_count(pd->message_handlers);
|
||||||
n = eina_inarray_count(ld->message_handlers);
|
|
||||||
for (i = 0; i < n; i++)
|
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;
|
if (mh2->klass == klass) return mh2->handler;
|
||||||
}
|
}
|
||||||
mh.klass = klass;
|
mh.klass = klass;
|
||||||
mh.handler = efl_add(klass, loop);
|
mh.handler = efl_add(klass, obj);
|
||||||
eina_inarray_push(ld->message_handlers, &mh);
|
eina_inarray_push(pd->message_handlers, &mh);
|
||||||
return mh.handler;
|
return mh.handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,13 +98,12 @@ class @beta Efl.Loop extends Efl.Task
|
||||||
}
|
}
|
||||||
return: bool; [[$true if successfully unregistered, $false otherwise.]]
|
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
|
[[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
|
the Efl.Loop object, so you can listen to this message type by
|
||||||
listening to message events on the handler as well as send
|
listening to message events on the handler as well as send
|
||||||
objects as events.]]
|
objects as events.]]
|
||||||
params {
|
params {
|
||||||
@in loop: Efl.Loop; [[The loop to get the object from.]]
|
|
||||||
@in klass: const(Efl.Class); [[The class of the message object.]]
|
@in klass: const(Efl.Class); [[The class of the message object.]]
|
||||||
}
|
}
|
||||||
return: Efl.Loop_Message_Handler; [[The message handler to use.]]
|
return: Efl.Loop_Message_Handler; [[The message handler to use.]]
|
||||||
|
|
Loading…
Reference in New Issue