summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXavi Artigas <xavierartigas@yahoo.es>2019-01-17 13:59:56 -0500
committerMike Blumenkrantz <zmike@samsung.com>2019-01-17 13:59:57 -0500
commit1534f50be0cbbc00c50bf75c8ef7afba49455741 (patch)
treea6b40bb44b47767d75b68b88b23982bc9bf0b4af /src
parent57ceb9b8ea8ac6f0502d473317e4c1e7017c4186 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/lib/ecore/efl_io_buffered_stream.c2
-rw-r--r--src/lib/ecore/efl_io_copier.c28
-rw-r--r--src/lib/efl/interfaces/efl_io_closer.c9
-rw-r--r--src/lib/efl/interfaces/efl_io_closer.eo20
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
351 EINA_SAFETY_ON_NULL_RETURN(io); 351 EINA_SAFETY_ON_NULL_RETURN(io);
352 EINA_SAFETY_ON_TRUE_RETURN(pd->inner_io != NULL); 352 EINA_SAFETY_ON_TRUE_RETURN(pd->inner_io != NULL);
353 353
354 pd->is_closer = efl_isa(io, EFL_IO_CLOSER_MIXIN); 354 pd->is_closer = efl_isa(io, EFL_IO_CLOSER_INTERFACE);
355 is_reader = efl_isa(io, EFL_IO_READER_INTERFACE); 355 is_reader = efl_isa(io, EFL_IO_READER_INTERFACE);
356 is_writer = efl_isa(io, EFL_IO_WRITER_INTERFACE); 356 is_writer = efl_isa(io, EFL_IO_WRITER_INTERFACE);
357 357
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);
55 efl_ref_count(pd->source), \ 55 efl_ref_count(pd->source), \
56 efl_io_reader_can_read_get(pd->source), \ 56 efl_io_reader_can_read_get(pd->source), \
57 efl_io_reader_eos_get(pd->source), \ 57 efl_io_reader_eos_get(pd->source), \
58 efl_isa(pd->source, EFL_IO_CLOSER_MIXIN) ? \ 58 efl_isa(pd->source, EFL_IO_CLOSER_INTERFACE) ? \
59 efl_io_closer_closed_get(pd->source) : 0); \ 59 efl_io_closer_closed_get(pd->source) : 0); \
60 if (!pd->destination) \ 60 if (!pd->destination) \
61 DBG("destination=NULL"); \ 61 DBG("destination=NULL"); \
@@ -65,7 +65,7 @@ static void _efl_io_copier_read(Eo *o, Efl_Io_Copier_Data *pd);
65 efl_class_name_get(efl_class_get(pd->destination)), \ 65 efl_class_name_get(efl_class_get(pd->destination)), \
66 efl_ref_count(pd->destination), \ 66 efl_ref_count(pd->destination), \
67 efl_io_writer_can_write_get(pd->destination), \ 67 efl_io_writer_can_write_get(pd->destination), \
68 efl_isa(pd->destination, EFL_IO_CLOSER_MIXIN) ? \ 68 efl_isa(pd->destination, EFL_IO_CLOSER_INTERFACE) ? \
69 efl_io_closer_closed_get(pd->destination) : 0); \ 69 efl_io_closer_closed_get(pd->destination) : 0); \
70 } \ 70 } \
71 } \ 71 } \
@@ -418,7 +418,7 @@ _efl_io_copier_source_set(Eo *o, Efl_Io_Copier_Data *pd, Efl_Io_Reader *source)
418 _efl_io_copier_source_resized, o); 418 _efl_io_copier_source_resized, o);
419 pd->progress.total = 0; 419 pd->progress.total = 0;
420 } 420 }
421 if (efl_isa(pd->source, EFL_IO_CLOSER_MIXIN)) 421 if (efl_isa(pd->source, EFL_IO_CLOSER_INTERFACE))
422 { 422 {
423 efl_event_callback_del(pd->source, EFL_IO_CLOSER_EVENT_CLOSED, 423 efl_event_callback_del(pd->source, EFL_IO_CLOSER_EVENT_CLOSED,
424 _efl_io_copier_source_closed, o); 424 _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)
441 _efl_io_copier_source_size_apply(o, pd); 441 _efl_io_copier_source_size_apply(o, pd);
442 } 442 }
443 443
444 if (efl_isa(pd->source, EFL_IO_CLOSER_MIXIN)) 444 if (efl_isa(pd->source, EFL_IO_CLOSER_INTERFACE))
445 { 445 {
446 efl_io_closer_close_on_exec_set(pd->source, efl_io_closer_close_on_exec_get(o)); 446 efl_io_closer_close_on_exec_set(pd->source, efl_io_closer_close_on_exec_get(o));
447 efl_io_closer_close_on_invalidate_set(pd->source, efl_io_closer_close_on_invalidate_get(o)); 447 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
505 if (pd->destination) 505 if (pd->destination)
506 { 506 {
507 efl_event_callback_array_del(pd->destination, destination_cbs(), o); 507 efl_event_callback_array_del(pd->destination, destination_cbs(), o);
508 if (efl_isa(pd->destination, EFL_IO_CLOSER_MIXIN)) 508 if (efl_isa(pd->destination, EFL_IO_CLOSER_INTERFACE))
509 { 509 {
510 efl_event_callback_del(pd->destination, EFL_IO_CLOSER_EVENT_CLOSED, 510 efl_event_callback_del(pd->destination, EFL_IO_CLOSER_EVENT_CLOSED,
511 _efl_io_copier_destination_closed, o); 511 _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
520 pd->destination = efl_ref(destination); 520 pd->destination = efl_ref(destination);
521 efl_event_callback_array_add(pd->destination, destination_cbs(), o); 521 efl_event_callback_array_add(pd->destination, destination_cbs(), o);
522 522
523 if (efl_isa(pd->destination, EFL_IO_CLOSER_MIXIN)) 523 if (efl_isa(pd->destination, EFL_IO_CLOSER_INTERFACE))
524 { 524 {
525 efl_io_closer_close_on_exec_set(pd->destination, efl_io_closer_close_on_exec_get(o)); 525 efl_io_closer_close_on_exec_set(pd->destination, efl_io_closer_close_on_exec_get(o));
526 efl_io_closer_close_on_invalidate_set(pd->destination, efl_io_closer_close_on_invalidate_get(o)); 526 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)
656 pd->progress.total = 0; 656 pd->progress.total = 0;
657 } 657 }
658 efl_event_callback_array_del(pd->source, source_cbs(), o); 658 efl_event_callback_array_del(pd->source, source_cbs(), o);
659 if (efl_isa(pd->source, EFL_IO_CLOSER_MIXIN) && 659 if (efl_isa(pd->source, EFL_IO_CLOSER_INTERFACE) &&
660 !efl_io_closer_closed_get(pd->source)) 660 !efl_io_closer_closed_get(pd->source))
661 { 661 {
662 efl_event_callback_del(pd->source, EFL_IO_CLOSER_EVENT_CLOSED, 662 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)
668 if (pd->destination) 668 if (pd->destination)
669 { 669 {
670 efl_event_callback_array_del(pd->destination, destination_cbs(), o); 670 efl_event_callback_array_del(pd->destination, destination_cbs(), o);
671 if (efl_isa(pd->destination, EFL_IO_CLOSER_MIXIN) && 671 if (efl_isa(pd->destination, EFL_IO_CLOSER_INTERFACE) &&
672 !efl_io_closer_closed_get(pd->destination)) 672 !efl_io_closer_closed_get(pd->destination))
673 { 673 {
674 efl_event_callback_del(pd->destination, EFL_IO_CLOSER_EVENT_CLOSED, 674 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)
793 pd->source, 793 pd->source,
794 pd->source ? efl_class_name_get(pd->source) : "", 794 pd->source ? efl_class_name_get(pd->source) : "",
795 pd->source ? efl_io_reader_eos_get(pd->source) : 1, 795 pd->source ? efl_io_reader_eos_get(pd->source) : 1,
796 pd->source ? (efl_isa(pd->source, EFL_IO_CLOSER_MIXIN) ? efl_io_closer_closed_get(pd->source) : 0) : 1, 796 pd->source ? (efl_isa(pd->source, EFL_IO_CLOSER_INTERFACE) ? efl_io_closer_closed_get(pd->source) : 0) : 1,
797 pd->destination, 797 pd->destination,
798 pd->destination ? efl_class_name_get(pd->destination) : "", 798 pd->destination ? efl_class_name_get(pd->destination) : "",
799 pd->destination ? (efl_isa(pd->destination, EFL_IO_CLOSER_MIXIN) ? efl_io_closer_closed_get(pd->destination) : 0) : 1); 799 pd->destination ? (efl_isa(pd->destination, EFL_IO_CLOSER_INTERFACE) ? efl_io_closer_closed_get(pd->destination) : 0) : 1);
800 800
801 return pd->done; 801 return pd->done;
802} 802}
@@ -896,10 +896,10 @@ _efl_io_copier_efl_io_closer_close_on_exec_set(Eo *o EINA_UNUSED, Efl_Io_Copier_
896 if (pd->close_on_exec == close_on_exec) return EINA_TRUE; 896 if (pd->close_on_exec == close_on_exec) return EINA_TRUE;
897 pd->close_on_exec = close_on_exec; 897 pd->close_on_exec = close_on_exec;
898 898
899 if (pd->source && efl_isa(pd->source, EFL_IO_CLOSER_MIXIN)) 899 if (pd->source && efl_isa(pd->source, EFL_IO_CLOSER_INTERFACE))
900 efl_io_closer_close_on_exec_set(pd->source, close_on_exec); 900 efl_io_closer_close_on_exec_set(pd->source, close_on_exec);
901 901
902 if (pd->destination && efl_isa(pd->destination, EFL_IO_CLOSER_MIXIN)) 902 if (pd->destination && efl_isa(pd->destination, EFL_IO_CLOSER_INTERFACE))
903 efl_io_closer_close_on_exec_set(pd->destination, close_on_exec); 903 efl_io_closer_close_on_exec_set(pd->destination, close_on_exec);
904 904
905 return EINA_TRUE; 905 return EINA_TRUE;
@@ -917,10 +917,10 @@ _efl_io_copier_efl_io_closer_close_on_invalidate_set(Eo *o EINA_UNUSED, Efl_Io_C
917 if (pd->close_on_invalidate == close_on_invalidate) return; 917 if (pd->close_on_invalidate == close_on_invalidate) return;
918 pd->close_on_invalidate = close_on_invalidate; 918 pd->close_on_invalidate = close_on_invalidate;
919 919
920 if (pd->source && efl_isa(pd->source, EFL_IO_CLOSER_MIXIN)) 920 if (pd->source && efl_isa(pd->source, EFL_IO_CLOSER_INTERFACE))
921 efl_io_closer_close_on_invalidate_set(pd->source, close_on_invalidate); 921 efl_io_closer_close_on_invalidate_set(pd->source, close_on_invalidate);
922 922
923 if (pd->destination && efl_isa(pd->destination, EFL_IO_CLOSER_MIXIN)) 923 if (pd->destination && efl_isa(pd->destination, EFL_IO_CLOSER_INTERFACE))
924 efl_io_closer_close_on_invalidate_set(pd->destination, close_on_invalidate); 924 efl_io_closer_close_on_invalidate_set(pd->destination, close_on_invalidate);
925} 925}
926 926
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 @@
1#include "config.h" 1#include "config.h"
2#include "Efl.h" 2#include "Efl.h"
3 3
4EOLIAN static Eina_Bool
5_efl_io_closer_closed_set(Eo *obj, void *pd EINA_UNUSED, Eina_Bool is_closed)
6{
7 if (is_closed)
8 return efl_io_closer_close(obj) == 0;
9
10 return EINA_FALSE;
11}
12
13#include "interfaces/efl_io_closer.eo.c" 4#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 @@
1import eina_types; 1import eina_types;
2 2
3mixin Efl.Io.Closer { 3interface Efl.Io.Closer {
4 [[Generic interface for objects that can close themselves. 4 [[Generic interface for objects that can close themselves.
5 5
6 This interface allows external objects to transparently close an 6 This interface allows external objects to transparently close an
@@ -12,10 +12,8 @@ mixin Efl.Io.Closer {
12 @since 1.19 12 @since 1.19
13 ]] 13 ]]
14 14
15 data: null;
16
17 methods { 15 methods {
18 close @pure_virtual { 16 close {
19 [[Closes the Input/Output object. 17 [[Closes the Input/Output object.
20 18
21 This operation will be executed immediately and may or 19 This operation will be executed immediately and may or
@@ -32,11 +30,7 @@ mixin Efl.Io.Closer {
32 30
33 @property closed { 31 @property closed {
34 [[If true will notify object was closed.]] 32 [[If true will notify object was closed.]]
35 get @pure_virtual { } 33 get { }
36 set {
37 [[If true, calls close()]]
38 return: bool; [[$true if could close, $false if already closed or errors.]]
39 }
40 values { 34 values {
41 is_closed: bool; [[$true if closed, $false otherwise]] 35 is_closed: bool; [[$true if closed, $false otherwise]]
42 } 36 }
@@ -49,8 +43,8 @@ mixin Efl.Io.Closer {
49 so they are not inherited by the processes (children or 43 so they are not inherited by the processes (children or
50 self) doing exec(). 44 self) doing exec().
51 ]] 45 ]]
52 get @pure_virtual { } 46 get { }
53 set @pure_virtual { 47 set {
54 [[If $true, will close on exec() call.]] 48 [[If $true, will close on exec() call.]]
55 return: bool; [[$true if could set, $false if not supported or failed.]] 49 return: bool; [[$true if could set, $false if not supported or failed.]]
56 } 50 }
@@ -65,8 +59,8 @@ mixin Efl.Io.Closer {
65 If the object was disconnected from its parent (including the main loop) without close, 59 If the object was disconnected from its parent (including the main loop) without close,
66 this property will state whenever it should be closed or not. 60 this property will state whenever it should be closed or not.
67 ]] 61 ]]
68 get @pure_virtual { } 62 get { }
69 set @pure_virtual { } 63 set { }
70 values { 64 values {
71 close_on_invalidate: bool; [[$true if close on invalidate, $false otherwise]] 65 close_on_invalidate: bool; [[$true if close on invalidate, $false otherwise]]
72 } 66 }