diff options
author | Xavi Artigas <xavierartigas@yahoo.es> | 2019-01-17 13:59:56 -0500 |
---|---|---|
committer | Mike Blumenkrantz <zmike@samsung.com> | 2019-01-17 13:59:57 -0500 |
commit | 1534f50be0cbbc00c50bf75c8ef7afba49455741 (patch) | |
tree | a6b40bb44b47767d75b68b88b23982bc9bf0b4af | |
parent | 57ceb9b8ea8ac6f0502d473317e4c1e7017c4186 (diff) | |
download | efl-1534f50be0cbbc00c50bf75c8ef7afba49455741.tar.gz |
Make Efl.Ui.Closer an interface instead of mixin
Summary:
It is a mixin only because of the setter method for the "closed" property,
otherwise, it would be a pure interface.
Nobody is setting that property, so let's just remove the setter (leaving only
the getter) and make this class an interface.
This should clear the scenario for languages currently having issues with
mixins (like C#).
Related to T7601.
Test Plan: Nothing changes. Make check and examples still work.
Reviewers: zmike, bu5hm4n, cedric
Reviewed By: cedric
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D7570
-rw-r--r-- | src/lib/ecore/efl_io_buffered_stream.c | 2 | ||||
-rw-r--r-- | src/lib/ecore/efl_io_copier.c | 28 | ||||
-rw-r--r-- | src/lib/efl/interfaces/efl_io_closer.c | 9 | ||||
-rw-r--r-- | src/lib/efl/interfaces/efl_io_closer.eo | 20 |
4 files changed, 22 insertions, 37 deletions
diff --git a/src/lib/ecore/efl_io_buffered_stream.c b/src/lib/ecore/efl_io_buffered_stream.c index a02b6bbb3e..53b1edaf1d 100644 --- a/src/lib/ecore/efl_io_buffered_stream.c +++ b/src/lib/ecore/efl_io_buffered_stream.c @@ -351,7 +351,7 @@ _efl_io_buffered_stream_inner_io_set(Eo *o, Efl_Io_Buffered_Stream_Data *pd, Efl EINA_SAFETY_ON_NULL_RETURN(io); EINA_SAFETY_ON_TRUE_RETURN(pd->inner_io != NULL); - pd->is_closer = efl_isa(io, EFL_IO_CLOSER_MIXIN); + pd->is_closer = efl_isa(io, EFL_IO_CLOSER_INTERFACE); is_reader = efl_isa(io, EFL_IO_READER_INTERFACE); is_writer = efl_isa(io, EFL_IO_WRITER_INTERFACE); diff --git a/src/lib/ecore/efl_io_copier.c b/src/lib/ecore/efl_io_copier.c index a03168807c..dbedfcf959 100644 --- a/src/lib/ecore/efl_io_copier.c +++ b/src/lib/ecore/efl_io_copier.c @@ -55,7 +55,7 @@ static void _efl_io_copier_read(Eo *o, Efl_Io_Copier_Data *pd); efl_ref_count(pd->source), \ efl_io_reader_can_read_get(pd->source), \ efl_io_reader_eos_get(pd->source), \ - efl_isa(pd->source, EFL_IO_CLOSER_MIXIN) ? \ + efl_isa(pd->source, EFL_IO_CLOSER_INTERFACE) ? \ efl_io_closer_closed_get(pd->source) : 0); \ if (!pd->destination) \ DBG("destination=NULL"); \ @@ -65,7 +65,7 @@ static void _efl_io_copier_read(Eo *o, Efl_Io_Copier_Data *pd); efl_class_name_get(efl_class_get(pd->destination)), \ efl_ref_count(pd->destination), \ efl_io_writer_can_write_get(pd->destination), \ - efl_isa(pd->destination, EFL_IO_CLOSER_MIXIN) ? \ + efl_isa(pd->destination, EFL_IO_CLOSER_INTERFACE) ? \ efl_io_closer_closed_get(pd->destination) : 0); \ } \ } \ @@ -418,7 +418,7 @@ _efl_io_copier_source_set(Eo *o, Efl_Io_Copier_Data *pd, Efl_Io_Reader *source) _efl_io_copier_source_resized, o); pd->progress.total = 0; } - if (efl_isa(pd->source, EFL_IO_CLOSER_MIXIN)) + if (efl_isa(pd->source, EFL_IO_CLOSER_INTERFACE)) { efl_event_callback_del(pd->source, EFL_IO_CLOSER_EVENT_CLOSED, _efl_io_copier_source_closed, o); @@ -441,7 +441,7 @@ _efl_io_copier_source_set(Eo *o, Efl_Io_Copier_Data *pd, Efl_Io_Reader *source) _efl_io_copier_source_size_apply(o, pd); } - if (efl_isa(pd->source, EFL_IO_CLOSER_MIXIN)) + if (efl_isa(pd->source, EFL_IO_CLOSER_INTERFACE)) { efl_io_closer_close_on_exec_set(pd->source, efl_io_closer_close_on_exec_get(o)); efl_io_closer_close_on_invalidate_set(pd->source, efl_io_closer_close_on_invalidate_get(o)); @@ -505,7 +505,7 @@ _efl_io_copier_destination_set(Eo *o, Efl_Io_Copier_Data *pd, Efl_Io_Writer *des if (pd->destination) { efl_event_callback_array_del(pd->destination, destination_cbs(), o); - if (efl_isa(pd->destination, EFL_IO_CLOSER_MIXIN)) + if (efl_isa(pd->destination, EFL_IO_CLOSER_INTERFACE)) { efl_event_callback_del(pd->destination, EFL_IO_CLOSER_EVENT_CLOSED, _efl_io_copier_destination_closed, o); @@ -520,7 +520,7 @@ _efl_io_copier_destination_set(Eo *o, Efl_Io_Copier_Data *pd, Efl_Io_Writer *des pd->destination = efl_ref(destination); efl_event_callback_array_add(pd->destination, destination_cbs(), o); - if (efl_isa(pd->destination, EFL_IO_CLOSER_MIXIN)) + if (efl_isa(pd->destination, EFL_IO_CLOSER_INTERFACE)) { efl_io_closer_close_on_exec_set(pd->destination, efl_io_closer_close_on_exec_get(o)); efl_io_closer_close_on_invalidate_set(pd->destination, efl_io_closer_close_on_invalidate_get(o)); @@ -656,7 +656,7 @@ _efl_io_copier_efl_io_closer_close(Eo *o, Efl_Io_Copier_Data *pd) pd->progress.total = 0; } efl_event_callback_array_del(pd->source, source_cbs(), o); - if (efl_isa(pd->source, EFL_IO_CLOSER_MIXIN) && + if (efl_isa(pd->source, EFL_IO_CLOSER_INTERFACE) && !efl_io_closer_closed_get(pd->source)) { efl_event_callback_del(pd->source, EFL_IO_CLOSER_EVENT_CLOSED, @@ -668,7 +668,7 @@ _efl_io_copier_efl_io_closer_close(Eo *o, Efl_Io_Copier_Data *pd) if (pd->destination) { efl_event_callback_array_del(pd->destination, destination_cbs(), o); - if (efl_isa(pd->destination, EFL_IO_CLOSER_MIXIN) && + if (efl_isa(pd->destination, EFL_IO_CLOSER_INTERFACE) && !efl_io_closer_closed_get(pd->destination)) { efl_event_callback_del(pd->destination, EFL_IO_CLOSER_EVENT_CLOSED, @@ -793,10 +793,10 @@ _efl_io_copier_done_get(const Eo *o, Efl_Io_Copier_Data *pd) pd->source, pd->source ? efl_class_name_get(pd->source) : "", pd->source ? efl_io_reader_eos_get(pd->source) : 1, - pd->source ? (efl_isa(pd->source, EFL_IO_CLOSER_MIXIN) ? efl_io_closer_closed_get(pd->source) : 0) : 1, + pd->source ? (efl_isa(pd->source, EFL_IO_CLOSER_INTERFACE) ? efl_io_closer_closed_get(pd->source) : 0) : 1, pd->destination, pd->destination ? efl_class_name_get(pd->destination) : "", - pd->destination ? (efl_isa(pd->destination, EFL_IO_CLOSER_MIXIN) ? efl_io_closer_closed_get(pd->destination) : 0) : 1); + pd->destination ? (efl_isa(pd->destination, EFL_IO_CLOSER_INTERFACE) ? efl_io_closer_closed_get(pd->destination) : 0) : 1); return pd->done; } @@ -896,10 +896,10 @@ _efl_io_copier_efl_io_closer_close_on_exec_set(Eo *o EINA_UNUSED, Efl_Io_Copier_ if (pd->close_on_exec == close_on_exec) return EINA_TRUE; pd->close_on_exec = close_on_exec; - if (pd->source && efl_isa(pd->source, EFL_IO_CLOSER_MIXIN)) + if (pd->source && efl_isa(pd->source, EFL_IO_CLOSER_INTERFACE)) efl_io_closer_close_on_exec_set(pd->source, close_on_exec); - if (pd->destination && efl_isa(pd->destination, EFL_IO_CLOSER_MIXIN)) + if (pd->destination && efl_isa(pd->destination, EFL_IO_CLOSER_INTERFACE)) efl_io_closer_close_on_exec_set(pd->destination, close_on_exec); return EINA_TRUE; @@ -917,10 +917,10 @@ _efl_io_copier_efl_io_closer_close_on_invalidate_set(Eo *o EINA_UNUSED, Efl_Io_C if (pd->close_on_invalidate == close_on_invalidate) return; pd->close_on_invalidate = close_on_invalidate; - if (pd->source && efl_isa(pd->source, EFL_IO_CLOSER_MIXIN)) + if (pd->source && efl_isa(pd->source, EFL_IO_CLOSER_INTERFACE)) efl_io_closer_close_on_invalidate_set(pd->source, close_on_invalidate); - if (pd->destination && efl_isa(pd->destination, EFL_IO_CLOSER_MIXIN)) + if (pd->destination && efl_isa(pd->destination, EFL_IO_CLOSER_INTERFACE)) efl_io_closer_close_on_invalidate_set(pd->destination, close_on_invalidate); } diff --git a/src/lib/efl/interfaces/efl_io_closer.c b/src/lib/efl/interfaces/efl_io_closer.c index 55b27f7b4d..1e93faf645 100644 --- a/src/lib/efl/interfaces/efl_io_closer.c +++ b/src/lib/efl/interfaces/efl_io_closer.c @@ -1,13 +1,4 @@ #include "config.h" #include "Efl.h" -EOLIAN static Eina_Bool -_efl_io_closer_closed_set(Eo *obj, void *pd EINA_UNUSED, Eina_Bool is_closed) -{ - if (is_closed) - return efl_io_closer_close(obj) == 0; - - return EINA_FALSE; -} - #include "interfaces/efl_io_closer.eo.c" diff --git a/src/lib/efl/interfaces/efl_io_closer.eo b/src/lib/efl/interfaces/efl_io_closer.eo index b7a6684fb6..2ba4323085 100644 --- a/src/lib/efl/interfaces/efl_io_closer.eo +++ b/src/lib/efl/interfaces/efl_io_closer.eo @@ -1,6 +1,6 @@ import eina_types; -mixin Efl.Io.Closer { +interface Efl.Io.Closer { [[Generic interface for objects that can close themselves. This interface allows external objects to transparently close an @@ -12,10 +12,8 @@ mixin Efl.Io.Closer { @since 1.19 ]] - data: null; - methods { - close @pure_virtual { + close { [[Closes the Input/Output object. This operation will be executed immediately and may or @@ -32,11 +30,7 @@ mixin Efl.Io.Closer { @property closed { [[If true will notify object was closed.]] - get @pure_virtual { } - set { - [[If true, calls close()]] - return: bool; [[$true if could close, $false if already closed or errors.]] - } + get { } values { is_closed: bool; [[$true if closed, $false otherwise]] } @@ -49,8 +43,8 @@ mixin Efl.Io.Closer { so they are not inherited by the processes (children or self) doing exec(). ]] - get @pure_virtual { } - set @pure_virtual { + get { } + set { [[If $true, will close on exec() call.]] return: bool; [[$true if could set, $false if not supported or failed.]] } @@ -65,8 +59,8 @@ mixin Efl.Io.Closer { If the object was disconnected from its parent (including the main loop) without close, this property will state whenever it should be closed or not. ]] - get @pure_virtual { } - set @pure_virtual { } + get { } + set { } values { close_on_invalidate: bool; [[$true if close on invalidate, $false otherwise]] } |