diff --git a/Makefile.am b/Makefile.am index 14b8572bb1..6278e421b9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -143,7 +143,6 @@ pc/ecore-evas.pc \ pc/ecore-avahi.pc \ pc/ector.pc \ pc/embryo.pc \ -pc/emodel.pc \ pc/eio.pc \ pc/eldbus.pc \ pc/efreet.pc \ @@ -164,7 +163,6 @@ pc/eolian-cxx.pc \ pc/edje-cxx.pc \ pc/eet-cxx.pc \ pc/eo-cxx.pc \ -pc/emodel-cxx.pc \ pc/eio-cxx.pc endif diff --git a/configure.ac b/configure.ac index da6abf853a..a8948f9a53 100644 --- a/configure.ac +++ b/configure.ac @@ -3944,14 +3944,6 @@ EFL_EVAL_PKGS([ECORE_EVAS]) EFL_LIB_END([Ecore_Evas]) #### End of Ecore_Evas -#### Emodel -EFL_LIB_START([Emodel]) -EFL_ADD_LIBS([EMODEL], []) -EFL_INTERNAL_DEPEND_PKG([EMODEL], [eo]) -EFL_INTERNAL_DEPEND_PKG([EMODEL], [eina]) -EFL_LIB_END([Emodel]) -#### End of Emodel - #### Eio EFL_LIB_START([Eio]) @@ -3965,7 +3957,6 @@ EFL_LIB_START([Eio]) EFL_PLATFORM_DEPEND([EIO], [evil]) ### Checks for libraries -EFL_INTERNAL_DEPEND_PKG([EIO], [emodel]) EFL_INTERNAL_DEPEND_PKG([EIO], [ecore]) EFL_INTERNAL_DEPEND_PKG([EIO], [eet]) EFL_INTERNAL_DEPEND_PKG([EIO], [eo]) @@ -4543,8 +4534,6 @@ pc/eolian.pc pc/eolian-cxx.pc pc/efl.pc pc/efl-cxx.pc -pc/emodel.pc -pc/emodel-cxx.pc pc/evas-fb.pc pc/evas-opengl-x11.pc pc/evas-opengl-sdl.pc diff --git a/src/Makefile.am b/src/Makefile.am index 8462c3a589..5041799c65 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -11,7 +11,6 @@ EOLIAN_FLAGS = -I$(srcdir)\ -I$(srcdir)/lib/ecore_audio \ -I$(srcdir)/lib/ecore \ -I$(srcdir)/lib/ecore_con \ - -I$(srcdir)/lib/emodel \ -I$(srcdir)/lib/eio DIST_SUBDIRS = @@ -67,7 +66,6 @@ include Makefile_Eeze.am include Makefile_EPhysics.am include Makefile_Edje.am include Makefile_Emotion.am -include Makefile_Emodel.am include Makefile_Ethumb.am include Makefile_Ethumb_Client.am @@ -80,7 +78,6 @@ include Makefile_Eo_Cxx.am include Makefile_Efl_Cxx.am include Makefile_Edje_Cxx.am include Makefile_Evas_Cxx.am -include Makefile_Emodel_Cxx.am include Makefile_Eio_Cxx.am include Makefile_Elua.am diff --git a/src/Makefile_Efl.am b/src/Makefile_Efl.am index b65dafc406..5a14d7e028 100644 --- a/src/Makefile_Efl.am +++ b/src/Makefile_Efl.am @@ -12,7 +12,8 @@ efl_eolian_files = \ lib/efl/interfaces/efl_gfx_shape.eo \ lib/efl/interfaces/efl_gfx_gradient_base.eo \ lib/efl/interfaces/efl_gfx_gradient_linear.eo \ - lib/efl/interfaces/efl_gfx_gradient_radial.eo + lib/efl/interfaces/efl_gfx_gradient_radial.eo \ + lib/efl/interfaces/efl_model_base.eo efl_eolian_files_h = $(efl_eolian_files:%.eo=%.eo.h) efl_eolian_files_c = $(efl_eolian_files:%.eo=%.eo.c) @@ -28,6 +29,7 @@ CLEANFILES += \ EXTRA_DIST += \ lib/efl/Efl_Config.h \ lib/efl/Efl.h \ + lib/efl/Efl_Model_Common.h \ $(efl_eolian_files) efleolianfilesdir = $(datadir)/eolian/include/efl-@VMAJ@ diff --git a/src/Makefile_Eio.am b/src/Makefile_Eio.am index 52ac3c51f6..03f1d1389a 100644 --- a/src/Makefile_Eio.am +++ b/src/Makefile_Eio.am @@ -46,9 +46,9 @@ endif endif endif -lib_eio_libeio_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl @EIO_CFLAGS@ @EMODEL_CFLAGS@ -lib_eio_libeio_la_LIBADD = @EIO_LIBS@ @EMODEL_LIBS@ -lib_eio_libeio_la_DEPENDENCIES = @EIO_INTERNAL_LIBS@ @EMODEL_INTERNAL_LIBS@ +lib_eio_libeio_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl @EIO_CFLAGS@ @EFL_CFLAGS@ +lib_eio_libeio_la_LIBADD = @EIO_LIBS@ @EFL_LIBS@ +lib_eio_libeio_la_DEPENDENCIES = @EIO_INTERNAL_LIBS@ @EFL_INTERNAL_LIBS@ lib_eio_libeio_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@ if HAVE_NOTIFY_COCOA lib_eio_libeio_la_LDFLAGS += -framework CoreServices @@ -61,6 +61,8 @@ TESTS += tests/eio/eio_suite tests_eio_eio_suite_SOURCES = \ tests/eio/eio_suite.c \ +tests/eio/eio_model_test_file.c \ +tests/eio/eio_model_test_monitor_add.c \ tests/eio/eio_test_monitor.c tests_eio_eio_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ @@ -68,12 +70,13 @@ tests_eio_eio_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ -DTESTS_BUILD_DIR=\"$(top_builddir)/src/tests/eio\" \ @CHECK_CFLAGS@ \ @ECORE_FILE_CFLAGS@ \ -@EIO_CFLAGS@ +@EIO_CFLAGS@ @EFL_CFLAGS@ tests_eio_eio_suite_LDADD = \ @CHECK_LIBS@ \ @USE_ECORE_FILE_LIBS@ \ @USE_EIO_LIBS@ +@USE_EFL_LIBS@ tests_eio_eio_suite_DEPENDENCIES = \ @USE_EIO_INTERNAL_LIBS@ diff --git a/src/Makefile_Emodel.am b/src/Makefile_Emodel.am deleted file mode 100644 index 4585af429f..0000000000 --- a/src/Makefile_Emodel.am +++ /dev/null @@ -1,78 +0,0 @@ - -### Library - -EMODEL_EOS = lib/emodel/emodel.eo - -EMODEL_EOS_H = $(EMODEL_EOS:%.eo=%.eo.h) -EMODEL_EOS_C = $(EMODEL_EOS:%.eo=%.eo.c) - -BUILT_SOURCES += $(EMODEL_EOS_C) $(EMODEL_EOS_H) - -dist_installed_emodelmainheaders_DATA = \ -lib/emodel/Emodel.h \ -lib/emodel/Emodel_Common.h - -nodist_installed_emodelmainheaders_DATA = $(EMODEL_EOS_H) - -emodeleolianfilesdir = $(datadir)/eolian/include/emodel-@VMAJ@ -emodeleolianfiles_DATA = $(EMODEL_EOS) - -lib_LTLIBRARIES += lib/emodel/libemodel.la -EXTRA_DIST += $(emodeleolianfiles_DATA) - -installed_emodelmainheadersdir = $(includedir)/emodel-@VMAJ@ - -lib_emodel_libemodel_la_SOURCES = \ -lib/emodel/emodel.c - -lib_emodel_libemodel_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ --I$(top_builddir)/src/lib/emodel \ --I$(top_srcdir)/src/lib/emodel \ --I$(top_builddir)/src/lib/eo \ --I$(top_srcdir)/src/lib/eo \ --I$(top_builddir)/src/lib/ecore \ --I$(top_srcdir)/src/lib/ecore \ --I$(top_builddir)/src/lib/eina \ --I$(top_srcdir)/src/lib/eina \ --DPACKAGE_BIN_DIR=\"$(bindir)\" \ --DPACKAGE_LIB_DIR=\"$(libdir)\" \ --DPACKAGE_DATA_DIR=\"$(datadir)/edje\" \ --DPACKAGE_BUILD_DIR=\"`pwd`/$(top_builddir)\" \ --DPACKAGE_SRC_DIR=\"`pwd`/$(top_srcdir)\" \ -@EMODEL_CFLAGS@ -lib_emodel_libemodel_la_LIBADD = @EMODEL_LIBS@ -lib_emodel_libemodel_la_DEPENDENCIES = @EMODEL_INTERNAL_LIBS@ @EINA_INTERNAL_LIBS@ @EO_INTERNAL_LIBS@ @ECORE_INTERNAL_LIBS@ - -if EFL_ENABLE_TESTS -EXTRA_DIST += $(emodeleolianfiles_DATA) - -check_PROGRAMS += tests/emodel/emodel_suite -TESTS += tests/emodel/emodel_suite - -tests_emodel_emodel_suite_SOURCES = \ -tests/emodel/emodel_suite.c \ -tests/emodel/emodel_test_file.c \ -tests/emodel/emodel_test_monitor_add.c - -tests_emodel_emodel_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ --I$(top_builddir)/src/lib/emodel \ --I$(top_srcdir)/src/lib/emodel \ --I$(top_builddir)/src/lib/ecore \ --I$(top_srcdir)/src/lib/ecore \ --I$(top_builddir)/src/lib/eio \ --I$(top_srcdir)/src/lib/eio \ --I$(top_builddir)/src/lib/eina \ --I$(top_srcdir)/src/lib/eina \ --DTESTS_WD=\"`pwd`\" \ --DTESTS_SRC_DIR=\"$(top_srcdir)/src/tests/emodel\" \ --DPACKAGE_BUILD_DIR=\"`pwd`/$(top_builddir)/src/tests/emodel\" \ --DTESTS_BUILD_DIR=PACKAGE_BUILD_DIR \ -@CHECK_CFLAGS@ \ -@EINA_CFLAGS@ \ -@EMODEL_CFLAGS@ \ -@EO_CFLAGS@ \ -@EIO_CFLAGS@ -tests_emodel_emodel_suite_LDADD = @CHECK_LIBS@ @USE_EMODEL_LIBS@ @USE_EINA_LIBS@ @USE_EO_LIBS@ @USE_EIO_LIBS@ @USE_ECORE_LIBS@ -tests_emodel_emodel_suite_DEPENDENCIES = @USE_EMODEL_INTERNAL_LIBS@ @USE_EINA_INTERNAL_LIBS@ @USE_EO_INTERNAL_LIBS@ @USE_EIO_INTERNAL_LIBS@ @USE_ECORE_INTERNAL_LIBS@ - -endif diff --git a/src/Makefile_Emodel_Cxx.am b/src/Makefile_Emodel_Cxx.am deleted file mode 100644 index f6984b48a9..0000000000 --- a/src/Makefile_Emodel_Cxx.am +++ /dev/null @@ -1,22 +0,0 @@ -if HAVE_CXX11 - -### Generated headers - -generated_emodel_cxx_bindings = lib/emodel/emodel.eo.hh - -lib/emodel/Emodel.hh: $(generated_emodel_cxx_bindings) - @echo @ECHO_E@ "#ifndef EFL_CXX_EMODEL_HH\n#define EFL_CXX_EMODEL_HH\n" > $(top_builddir)/src/lib/emodel/Emodel.hh - @echo @ECHO_E@ "#ifdef EFL_BETA_API_SUPPORT" >> $(top_builddir)/src/lib/emodel/Emodel.hh - @for i in $(generated_emodel_cxx_bindings); do echo "#include <$$(basename $$i)>" >> $(top_builddir)/src/lib/emodel/Emodel.hh; done - @echo @ECHO_E@ "#endif\n\n#endif\n" >> $(top_builddir)/src/lib/emodel/Emodel.hh - -generated_emodel_cxx_all = \ - $(generated_emodel_cxx_bindings) \ - lib/emodel/Emodel.hh - -CLEANFILES += $(generated_emodel_cxx_all) - -installed_emodelcxxmainheadersdir = $(includedir)/emodel-cxx-@VMAJ@/ -nodist_installed_emodelcxxmainheaders_DATA = $(generated_emodel_cxx_all) - -endif diff --git a/src/lib/efl/Efl.h b/src/lib/efl/Efl.h index 5a0b3eb949..2de76807d2 100644 --- a/src/lib/efl/Efl.h +++ b/src/lib/efl/Efl.h @@ -139,6 +139,8 @@ typedef enum _Efl_Gfx_Fill_Spread #ifdef EFL_BETA_API_SUPPORT +#include + /* Interfaces */ #include "interfaces/efl_control.eo.h" #include "interfaces/efl_file.eo.h" @@ -146,6 +148,7 @@ typedef enum _Efl_Gfx_Fill_Spread #include "interfaces/efl_player.eo.h" #include "interfaces/efl_text.eo.h" #include "interfaces/efl_text_properties.eo.h" +#include "interfaces/efl_model_base.eo.h" EAPI extern const Eo_Event_Description _EFL_GFX_CHANGED; EAPI extern const Eo_Event_Description _EFL_GFX_PATH_CHANGED; diff --git a/src/lib/efl/Efl_Model_Common.h b/src/lib/efl/Efl_Model_Common.h new file mode 100644 index 0000000000..bd9ab62e5f --- /dev/null +++ b/src/lib/efl/Efl_Model_Common.h @@ -0,0 +1,92 @@ +#ifndef _EFL_MODEL_COMMON_H +#define _EFL_MODEL_COMMON_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @enum _Efl_Model_Load_Status + * XXX/TODO/FIXME: Remove this enum (and possibly other data) from here + * as soon as eolian translates these data types in .eo's. + */ +enum _Efl_Model_Load_Status + { + EFL_MODEL_LOAD_STATUS_ERROR = 0, + EFL_MODEL_LOAD_STATUS_LOADING_PROPERTIES = (1 << 0), + EFL_MODEL_LOAD_STATUS_LOADING_CHILDREN = (1 << 1), + EFL_MODEL_LOAD_STATUS_LOADING = (1 << 0) | (1 << 1), + + EFL_MODEL_LOAD_STATUS_LOADED_PROPERTIES = (1 << 2), + EFL_MODEL_LOAD_STATUS_LOADED_CHILDREN = (1 << 3), + EFL_MODEL_LOAD_STATUS_LOADED = (1 << 2) | (1 << 3), + + EFL_MODEL_LOAD_STATUS_UNLOADING = (1 << 4), + EFL_MODEL_LOAD_STATUS_UNLOADED = (1 << 5) + }; +/** + * @typedef Efl_Model_Load_Status + */ +typedef enum _Efl_Model_Load_Status Efl_Model_Load_Status; + +/** + * @struct _Efl_Model_Load + * Structure to hold Efl_Model_Load_Status enum + * (and possible other data) to avoid ABI break. + */ +struct _Efl_Model_Load + { + Efl_Model_Load_Status status; + /* add more data below here if necessary */ + }; + +/** + * @typedef Efl_Model_Load + */ +typedef struct _Efl_Model_Load Efl_Model_Load; + +/** + * @struct _Efl_Model_Property_Event + */ +struct _Efl_Model_Property_Event +{ + const Eina_Array *changed_properties; /**< array of property name */ + const Eina_Array *invalidated_properties; /**< array of property name */ +}; + +/** + * @typedef Efl_Model_Property_Event + */ +typedef struct _Efl_Model_Property_Event Efl_Model_Property_Event; + +/** + * @struct _Efl_Model_Children_Event + * Every time a child id added the event + * EFL_MODEL_EVENT_CHILD_ADDED is dispatched + * passing along this structure. + */ +struct _Efl_Model_Children_Event +{ + Eo *child; /**< child, for child_add */ + /** + * index is a hint and is intended + * to provide a way for applications + * to control/know children relative + * positions through listings. + * + * NOTE: If listing is performed asynchronously + * exact order may not be guaranteed. + */ + unsigned int index; +}; + +/** + * @struct Efl_Model_Children_Event + */ +typedef struct _Efl_Model_Children_Event Efl_Model_Children_Event; + + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/lib/efl/interfaces/efl_interfaces_main.c b/src/lib/efl/interfaces/efl_interfaces_main.c index 6ae1cb3ea4..31a3aae616 100644 --- a/src/lib/efl/interfaces/efl_interfaces_main.c +++ b/src/lib/efl/interfaces/efl_interfaces_main.c @@ -25,3 +25,5 @@ EAPI const Eo_Event_Description _EFL_GFX_CHANGED = EAPI const Eo_Event_Description _EFL_GFX_PATH_CHANGED = EO_EVENT_DESCRIPTION("Graphics path changed", "The path of a shape object changed"); + +#include "interfaces/efl_model_base.eo.c" diff --git a/src/lib/emodel/emodel.eo b/src/lib/efl/interfaces/efl_model_base.eo similarity index 59% rename from src/lib/emodel/emodel.eo rename to src/lib/efl/interfaces/efl_model_base.eo index 9aba5a9ee7..75e280ebd4 100644 --- a/src/lib/emodel/emodel.eo +++ b/src/lib/efl/interfaces/efl_model_base.eo @@ -1,46 +1,47 @@ /* - * type Emodel_Load_Status: enum _Emodel_Load_Status + * type Efl_Model_Load_Status: enum _Efl_Model_Load_Status * { - * EMODEL_LOAD_STATUS_ERROR = 0, /*@ Error in Load Model * - * EMODEL_LOAD_STATUS_LOADING_PROPERTIES = (1 << 0), /*@ properties load in progress * - * EMODEL_LOAD_STATUS_LOADING_CHILDREN = (1 << 1), /*@ children load in progress * - * EMODEL_LOAD_STATUS_LOADING = (1 << 0) | (1 << 1), /*@ children and properties load in progress * + * EFL_MODEL_LOAD_STATUS_ERROR = 0, /*@ Error in Load Model * + * EFL_MODEL_LOAD_STATUS_LOADING_PROPERTIES = (1 << 0), /*@ properties load in progress * + * EFL_MODEL_LOAD_STATUS_LOADING_CHILDREN = (1 << 1), /*@ children load in progress * + * EFL_MODEL_LOAD_STATUS_LOADING = (1 << 0) | (1 << 1), /*@ children and properties load in progress * * - * EMODEL_LOAD_STATUS_LOADED_PROPERTIES = (1 << 2), /*@ Model as ready to fetch properties * - * EMODEL_LOAD_STATUS_LOADED_CHILDREN = (1 << 3), /*@ Model as ready to fetch children * - * EMODEL_LOAD_STATUS_LOADED = (1 << 2) | (1 << 3), /*@ Model as ready to fetch properties and children * + * EFL_MODEL_LOAD_STATUS_LOADED_PROPERTIES = (1 << 2), /*@ Model as ready to fetch properties * + * EFL_MODEL_LOAD_STATUS_LOADED_CHILDREN = (1 << 3), /*@ Model as ready to fetch children * + * EFL_MODEL_LOAD_STATUS_LOADED = (1 << 2) | (1 << 3), /*@ Model as ready to fetch properties and children * * - * EMODEL_LOAD_STATUS_UNLOADING = (1 << 4), /*@ Model Unload in progress * - * EMODEL_LOAD_STATUS_UNLOADED = (1 << 5) /*@ Model Unloaded * + * EFL_MODEL_LOAD_STATUS_UNLOADING = (1 << 4), /*@ Model Unload in progress * + * EFL_MODEL_LOAD_STATUS_UNLOADED = (1 << 5) /*@ Model Unloaded * * } * * - * type Emodel_Property_Event: struct _Emodel_Property_Event + * type Efl_Model_Property_Event: struct _Efl_Model_Property_Event * { * changed_properties: Eina_Array* ; /*@ List of changed properties * * invalidated_properties: Eina_Array* ; /*@ Removed properties identified by name * * } */ -interface Emodel () +interface Efl.Model.Base () { legacy_prefix: null; + eo_prefix: efl_model; properties { load_status { get { /*@ Get a load emodel current status. - @return: @c Emodel_Load_Status + @return: @c Efl_Model_Load_Status By convention this means get the current model status. - Possible values are defined Emodel_Load_Status enumerator. + Possible values are defined Efl_Model_Load_Status enumerator. - @see Emodel_Load_Status - @see emodel_load + @see Efl_Model_Load_Status + @see efl_model_load - @since 1.11 */ - return: Emodel_Load_Status; + @since 1.14 */ + return: Efl_Model_Load_Status; } } properties { @@ -48,17 +49,17 @@ interface Emodel () /*@ Get properties from model. - @return: @c Emodel_Load_Status + @return: @c Efl_Model_Load_Status properties_get is due to provide callers a way the fetch the current properties implemented/used by the model. - The event EMODEL_EVENT_PROPERTIES_CHANGE will be raised to notify listeners + The event EFL_MODEL_EVENT_PROPERTIES_CHANGE will be raised to notify listeners of any modifications in the properties. - @see EMODEL_EVENT_PROPERTIES_CHANGE - @since 1.11 */ + @see EFL_MODEL_EVENT_PROPERTIES_CHANGE + @since 1.14 */ - return: Emodel_Load_Status; + return: Efl_Model_Load_Status; } values { const(array*) properties; /*@ array of current properties */ @@ -71,40 +72,40 @@ interface Emodel () @return: @c EINA_TRUE, on success, @c EINA_FALSE in readonly property or error - The caller must ensure to call at least emodel_prop_list before being + The caller must ensure to call at least efl_model_prop_list before being able to see/set properties. This function sets a new property value into given property name. Once the operation is completed the concrete implementation should raise - EMODEL_EVENT_PROPERTIES_CHANGE event in order to notify listeners of the + EFL_MODEL_EVENT_PROPERTIES_CHANGE event in order to notify listeners of the new value of the property. If the model doesn't have the property then there are two possibilities, either raise an error or create the new property in model - @see emodel_property_get - @see EMODEL_EVENT_PROPERTIES_CHANGE - @since 1.11 */ + @see efl_model_property_get + @see EFL_MODEL_EVENT_PROPERTIES_CHANGE + @since 1.14 */ - return: Emodel_Load_Status; + return: Efl_Model_Load_Status; } get { /*@ Retrieve the value of a given property name. - @return: @c Load Status, on success, @c EMODEL_LOAD_STATUS_ERROR otherwise + @return: @c Load Status, on success, @c EFL_MODEL_LOAD_STATUS_ERROR otherwise property_get will only be available when load status is equal to - EMODEL_LOAD_STATUS_LOADED. + EFL_MODEL_LOAD_STATUS_LOADED. At this point the caller is free to get values from properties. - The event EMODEL_EVENT_PROPERTIES_CHANGE may be raised to notify + The event EFL_MODEL_EVENT_PROPERTIES_CHANGE may be raised to notify listeners of the property/value. - @see emodel_properties_get - @see EMODEL_EVENT_PROPERTIES_CHANGE + @see efl_model_properties_get + @see EFL_MODEL_EVENT_PROPERTIES_CHANGE - @since 1.11 */ - return: Emodel_Load_Status; + @since 1.14 */ + return: Efl_Model_Load_Status; } keys { const(char)* property; /*@ Property name */ @@ -118,14 +119,14 @@ interface Emodel () /*@ Get children slice OR full range. - @return: @c Emodel_Load_Status. See below for more info. + @return: @c Efl_Model_Load_Status. See below for more info. Before being able to get the children list the model status must be - on loaded status (EMODEL_LOAD_STATUS_LOADED). + on loaded status (EFL_MODEL_LOAD_STATUS_LOADED). However there may be circunstancies where the model could be in a different state, in such cases it is advisable to simply return: its current state, which will be - of course, different than @c EMODEL_LOAD_STATUS_LOADED_CHILDREN. + of course, different than @c EFL_MODEL_LOAD_STATUS_LOADED_CHILDREN. When children accessor is return:ed as NULL one should then test the current load status return:ed by @children_slice_get in order to check against an empty list or real error. @@ -154,20 +155,20 @@ interface Emodel () @code // Returns full list - eo_do(obj, emodel_children_slice_get(0, 0, &children_accessor)); + eo_do(obj, efl_model_children_slice_get(0, 0, &children_accessor)); // Returns 5 items, counting from item #5 - eo_do(obj, emodel_children_slice_get(5, 5, &children_accessor)); + eo_do(obj, efl_model_children_slice_get(5, 5, &children_accessor)); @endcode - @see emodel_children_get - @see emodel_children_count_get - @see emodel_load - @see emodel_load_status_get - @since 1.11 */ + @see efl_model_children_get + @see efl_model_children_count_get + @see efl_model_load + @see efl_model_load_status_get + @since 1.14 */ - return: Emodel_Load_Status; + return: Efl_Model_Load_Status; } keys { unsigned start; /*@ Range begin - start from here. If start and count are 0 slice is ignored.*/ @@ -184,18 +185,18 @@ interface Emodel () @return: @c EINA_TRUE, on success, @c EINA_FALSE otherwise - When emodel_load is completed emodel_coildren_count_get can be use + When efl_model_load is completed efl_model_coildren_count_get can be use to get the number of children. children_count_get can also be used before calling children_slice_get so a valid range is known. - Event EMODEL_CHILDREN_COUNT_CHANGED is emitted when count is finished. + Event EFL_MODEL_CHILDREN_COUNT_CHANGED is emitted when count is finished. - @see emodel_children_get - @see emodel_children_slice_get - @see emodel_load - @see emodel_load_status_get - @since 1.11 */ + @see efl_model_children_get + @see efl_model_children_slice_get + @see efl_model_load + @see efl_model_load_status_get + @since 1.14 */ - return: Emodel_Load_Status; + return: Efl_Model_Load_Status; } values { unsigned children_count; @@ -211,21 +212,21 @@ interface Emodel () the models properties and children with it. For example in the case of file system backed model, this means opening the relevant files and reading the data from them(creating the properties and children from it). - the model emit EMODEL_EVENT_LOAD_STATUS after end with Emodel_Load_Status + the model emit EFL_MODEL_EVENT_LOAD_STATUS after end with Efl_Model_Load_Status @warning This convention should be followed, but no guarantees of behaviour by user defined types can be given. Alternatively is possible to use properties_load to load only properties - and children_load to load only children. If emodel_load is called then + and children_load to load only children. If efl_model_load is called then calling properties_load and/or children_load is not necessary. - @see Emodel_Load_Status - @see emodel_properties_load - @see emodel_children_load - @see emodel_unload - @see emodel_load_status_get + @see Efl_Model_Load_Status + @see efl_model_properties_load + @see efl_model_children_load + @see efl_model_unload + @see efl_model_load_status_get - @since 1.11 */ + @since 1.14 */ } unload { /*@ @@ -234,42 +235,42 @@ interface Emodel () By convention this means releasing data received/read from an external source. For example of a database backed model this might mean releasing the iterator for the currently loaded data or deleting a temporary table. - the model emit EMODEL_EVENT_LOAD_STATUS after end with model load status + the model emit EFL_MODEL_EVENT_LOAD_STATUS after end with model load status @warning This convention should be followed, but no guarantees of behaviour by user defined types can be given. - @see Emodel_Load_Status - @see emodel_load - @see emodel_load_status_get + @see Efl_Model_Load_Status + @see efl_model_load + @see efl_model_load_status_get - @since 1.11 */ + @since 1.14 */ } properties_load { /*@ Properties emodel load. By convention this means loading data from an external source and populating - the models properties only. This method is a subset of emodel_load, meaning that + the models properties only. This method is a subset of efl_model_load, meaning that it won't load children, it is a hint. - For loadind both properties and children use emodel_load + For loadind both properties and children use efl_model_load instead. - @see emodel_load + @see efl_model_load - @since 1.11 */ + @since 1.14 */ } children_load { /*@ Children emodel load. By convention this means loading data from an external source and populating - the models children only. This method is a subset of emodel_load, meaning that - it won't load properties. For loadind both properties and children use emodel_load + the models children only. This method is a subset of efl_model_load, meaning that + it won't load properties. For loadind both properties and children use efl_model_load instead. - @see emodel_load + @see efl_model_load - @since 1.11 */ + @since 1.14 */ } child_add { /*@ @@ -279,13 +280,13 @@ interface Emodel () Add a new child, possibly dummy, depending on the implementation, of a internal keeping. When the child is effectively - added the event EMODEL_EVENT_CHILD_ADD is then raised and the new child + added the event EFL_MODEL_EVENT_CHILD_ADD is then raised and the new child is kept along with other children. - @see EMODEL_EVENT_CHILD_ADD + @see EFL_MODEL_EVENT_CHILD_ADD @see load_status_get - @since 1.11 */ + @since 1.14 */ return: Eo *; } @@ -293,16 +294,16 @@ interface Emodel () /*@ Remove a child. - @return: @c Emodel_Load_Status on success, @c EMODEL_LOAD_STATUS_ERROR otherwise. + @return: @c Efl_Model_Load_Status on success, @c EFL_MODEL_LOAD_STATUS_ERROR otherwise. Remove a child of a internal keeping. When the child is effectively - removed the event EMODEL_EVENT_CHILD_REMOVED is then raised to give a + removed the event EFL_MODEL_EVENT_CHILD_REMOVED is then raised to give a chance for listeners to perform any cleanup and/or update references. - @see EMODEL_EVENT_CHILD_REMOVED - @since 1.11 */ + @see EFL_MODEL_EVENT_CHILD_REMOVED + @since 1.14 */ - return: Emodel_Load_Status; + return: Efl_Model_Load_Status; params { @in Eo* child; /*@ Child to be removed */ @@ -311,8 +312,8 @@ interface Emodel () } events { - load,status: Emodel_Load_Status; /*@ Event dispatch when load status changes */ - properties,changed: Emodel_Properties_Evt; /*@ Event dispatched when properties list is available. */ + load,status: Efl_Model_Load_Status; /*@ Event dispatch when load status changes */ + properties,changed: Efl_Model_Properties_Evt; /*@ Event dispatched when properties list is available. */ child,added; /*@ Event dispatched when new child is added. */ child,removed; /*@ Event dispatched when child is removed. */ children,count,changed; /*@ Event dispatched when children count is finished. */ diff --git a/src/lib/eio/eio_model.c b/src/lib/eio/eio_model.c index 72d5bb04af..0a93658331 100644 --- a/src/lib/eio/eio_model.c +++ b/src/lib/eio/eio_model.c @@ -4,7 +4,7 @@ #include -#include +#include #include #include #include @@ -18,32 +18,32 @@ #define MY_CLASS_NAME "Eio_Model" static void _eio_prop_set_error_cb(void *, Eio_File *, int); -static void _eio_model_emodel_properties_load(Eo *, Eio_Model_Data *); -static void _eio_model_emodel_children_load(Eo *, Eio_Model_Data *); +static void _eio_model_efl_model_base_properties_load(Eo *, Eio_Model_Data *); +static void _eio_model_efl_model_base_children_load(Eo *, Eio_Model_Data *); static void -_load_set(Eio_Model_Data *priv, Emodel_Load_Status status) +_load_set(Eio_Model_Data *priv, Efl_Model_Load_Status status) { - Emodel_Load load; + Efl_Model_Load load; load.status = status; - if ((priv->load.status & (EMODEL_LOAD_STATUS_LOADED | EMODEL_LOAD_STATUS_LOADING)) && - (load.status & (EMODEL_LOAD_STATUS_LOADED | EMODEL_LOAD_STATUS_LOADING))) + if ((priv->load.status & (EFL_MODEL_LOAD_STATUS_LOADED | EFL_MODEL_LOAD_STATUS_LOADING)) && + (load.status & (EFL_MODEL_LOAD_STATUS_LOADED | EFL_MODEL_LOAD_STATUS_LOADING))) { load.status = priv->load.status | status; switch (status) { - case EMODEL_LOAD_STATUS_LOADED_PROPERTIES: - load.status &= ~EMODEL_LOAD_STATUS_LOADING_PROPERTIES; + case EFL_MODEL_LOAD_STATUS_LOADED_PROPERTIES: + load.status &= ~EFL_MODEL_LOAD_STATUS_LOADING_PROPERTIES; break; - case EMODEL_LOAD_STATUS_LOADING_PROPERTIES: - load.status &= ~EMODEL_LOAD_STATUS_LOADED_PROPERTIES; + case EFL_MODEL_LOAD_STATUS_LOADING_PROPERTIES: + load.status &= ~EFL_MODEL_LOAD_STATUS_LOADED_PROPERTIES; break; - case EMODEL_LOAD_STATUS_LOADED_CHILDREN: - load.status &= ~EMODEL_LOAD_STATUS_LOADING_CHILDREN; + case EFL_MODEL_LOAD_STATUS_LOADED_CHILDREN: + load.status &= ~EFL_MODEL_LOAD_STATUS_LOADING_CHILDREN; break; - case EMODEL_LOAD_STATUS_LOADING_CHILDREN: - load.status &= ~EMODEL_LOAD_STATUS_LOADED_CHILDREN; + case EFL_MODEL_LOAD_STATUS_LOADING_CHILDREN: + load.status &= ~EFL_MODEL_LOAD_STATUS_LOADED_CHILDREN; break; default: break; } @@ -52,7 +52,7 @@ _load_set(Eio_Model_Data *priv, Emodel_Load_Status status) if (priv->load.status != load.status) { priv->load.status = load.status; - eo_do(priv->obj, eo_event_callback_call(EMODEL_EVENT_LOAD_STATUS, &load)); + eo_do(priv->obj, eo_event_callback_call(EFL_MODEL_BASE_EVENT_LOAD_STATUS, &load)); } } @@ -63,12 +63,12 @@ _load_set(Eio_Model_Data *priv, Emodel_Load_Status status) static void _eio_stat_done_cb(void *data, Eio_File *handler EINA_UNUSED, const Eina_Stat *stat) { - Emodel_Property_Event evt; + Efl_Model_Property_Event evt; Eio_Model_Data *priv = data; EINA_SAFETY_ON_FALSE_RETURN(eo_ref_get(priv->obj)); priv->is_dir = eio_file_is_dir(stat); - memset(&evt, 0, sizeof(Emodel_Property_Event)); + memset(&evt, 0, sizeof(Efl_Model_Property_Event)); eina_value_set(priv->properties_value[EIO_MODEL_PROP_IS_DIR], eio_file_is_dir(stat)); eina_value_set(priv->properties_value[EIO_MODEL_PROP_IS_LNK], eio_file_is_lnk(stat)); @@ -76,12 +76,12 @@ _eio_stat_done_cb(void *data, Eio_File *handler EINA_UNUSED, const Eina_Stat *st eina_value_set(priv->properties_value[EIO_MODEL_PROP_SIZE], eio_file_size(stat)); evt.changed_properties = priv->properties_name; - eo_do(priv->obj, eo_event_callback_call(EMODEL_EVENT_PROPERTIES_CHANGED, &evt)); + eo_do(priv->obj, eo_event_callback_call(EFL_MODEL_BASE_EVENT_PROPERTIES_CHANGED, &evt)); - _load_set(priv, EMODEL_LOAD_STATUS_LOADED_PROPERTIES); + _load_set(priv, EFL_MODEL_LOAD_STATUS_LOADED_PROPERTIES); - if (priv->load_pending & EMODEL_LOAD_STATUS_LOADED_CHILDREN) - _eio_model_emodel_children_load(priv->obj, priv); + if (priv->load_pending & EFL_MODEL_LOAD_STATUS_LOADED_CHILDREN) + _eio_model_efl_model_base_children_load(priv->obj, priv); } static void @@ -93,13 +93,13 @@ _eio_progress_cb(void *data EINA_UNUSED, Eio_File *handler EINA_UNUSED, const Ei static void _eio_move_done_cb(void *data, Eio_File *handler EINA_UNUSED) { - Emodel_Property_Event evt; + Efl_Model_Property_Event evt; Eio_Model_Data *priv = data; Eina_Array *properties; EINA_SAFETY_ON_FALSE_RETURN(eo_ref_get(priv->obj)); - memset(&evt, 0, sizeof(Emodel_Property_Event)); + memset(&evt, 0, sizeof(Efl_Model_Property_Event)); /** * When mv is executed we update our values and @@ -113,7 +113,7 @@ _eio_move_done_cb(void *data, Eio_File *handler EINA_UNUSED) eina_array_push(properties, _eio_model_prop_names[EIO_MODEL_PROP_FILENAME]); evt.changed_properties = properties; - eo_do(priv->obj, eo_event_callback_call(EMODEL_EVENT_PROPERTIES_CHANGED, &evt)); + eo_do(priv->obj, eo_event_callback_call(EFL_MODEL_BASE_EVENT_PROPERTIES_CHANGED, &evt)); eina_array_free(properties); } @@ -141,11 +141,11 @@ _eio_prop_set_error_cb(void *data EINA_UNUSED, Eio_File *handler EINA_UNUSED, in * Ecore Events */ static Eina_Bool -_emodel_evt_added_ecore_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED) +_efl_model_evt_added_ecore_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED) { Eio_Monitor_Event *evt = (Eio_Monitor_Event*)event; Eio_Model_Data *priv = data; - Emodel_Children_Event cevt; + Efl_Model_Children_Event cevt; Eina_Value path; if (priv->children_list) @@ -159,14 +159,14 @@ _emodel_evt_added_ecore_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *e eo_do(cevt.child, eio_model_children_filter_set(priv->filter_cb, priv->filter_userdata)); eina_value_flush(&path); - eo_do(priv->obj, eo_event_callback_call(EMODEL_EVENT_CHILD_ADDED, &cevt)); + eo_do(priv->obj, eo_event_callback_call(EFL_MODEL_BASE_EVENT_CHILD_ADDED, &cevt)); } return EINA_TRUE; } static Eina_Bool -_emodel_evt_deleted_ecore_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED) +_efl_model_evt_deleted_ecore_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED) { Eio_Monitor_Event *evt = (Eio_Monitor_Event*)event; Eio_Model_Data *priv = data; @@ -185,11 +185,11 @@ _emodel_evt_deleted_ecore_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void if (cur) { - Emodel_Children_Event cevt; + Efl_Model_Children_Event cevt; cevt.index = i; cevt.child = cur->data; - eo_do(priv->obj, eo_event_callback_call(EMODEL_EVENT_CHILD_REMOVED, &cevt)); + eo_do(priv->obj, eo_event_callback_call(EFL_MODEL_BASE_EVENT_CHILD_REMOVED, &cevt)); priv->children_list = eina_list_remove_list(priv->children_list, cur); eo_unref(cevt.child); @@ -249,8 +249,8 @@ _eio_error_unlink_cb(void *data EINA_UNUSED, Eio_File *handler EINA_UNUSED, int /** * Interfaces impl. */ -static Emodel_Load_Status -_eio_model_emodel_properties_get(Eo *obj EINA_UNUSED, +static Efl_Model_Load_Status +_eio_model_efl_model_base_properties_get(Eo *obj EINA_UNUSED, Eio_Model_Data *_pd, Eina_Array * const* properties) { Eio_Model_Data *priv = _pd; @@ -266,15 +266,15 @@ _eio_model_emodel_properties_get(Eo *obj EINA_UNUSED, /** * Property Get */ -static Emodel_Load_Status -_eio_model_emodel_property_get(Eo *obj EINA_UNUSED, Eio_Model_Data *priv, const char *property, const Eina_Value **value) +static Efl_Model_Load_Status +_eio_model_efl_model_base_property_get(Eo *obj EINA_UNUSED, Eio_Model_Data *priv, const char *property, const Eina_Value **value) { unsigned int i; - EINA_SAFETY_ON_NULL_RETURN_VAL(property, EMODEL_LOAD_STATUS_ERROR); - EINA_SAFETY_ON_NULL_RETURN_VAL(priv, EMODEL_LOAD_STATUS_ERROR); + EINA_SAFETY_ON_NULL_RETURN_VAL(property, EFL_MODEL_LOAD_STATUS_ERROR); + EINA_SAFETY_ON_NULL_RETURN_VAL(priv, EFL_MODEL_LOAD_STATUS_ERROR); *value = NULL; - if (priv->load.status & EMODEL_LOAD_STATUS_LOADED_PROPERTIES) + if (priv->load.status & EFL_MODEL_LOAD_STATUS_LOADED_PROPERTIES) { for (i = 0; i < EIO_MODEL_PROP_LAST; ++i) { @@ -294,8 +294,8 @@ _eio_model_emodel_property_get(Eo *obj EINA_UNUSED, Eio_Model_Data *priv, const /** * Property Set */ -static Emodel_Load_Status -_eio_model_emodel_property_set(Eo *obj EINA_UNUSED, Eio_Model_Data *priv, const char * property, const Eina_Value *value) +static Efl_Model_Load_Status +_eio_model_efl_model_base_property_set(Eo *obj EINA_UNUSED, Eio_Model_Data *priv, const char * property, const Eina_Value *value) { char *dest; @@ -318,10 +318,10 @@ _eio_model_emodel_property_set(Eo *obj EINA_UNUSED, Eio_Model_Data *priv, const _eio_move_done_cb(priv, NULL); - if (priv->load_pending & EMODEL_LOAD_STATUS_LOADED_PROPERTIES) - _eio_model_emodel_properties_load(obj, priv); - else if (priv->load_pending & EMODEL_LOAD_STATUS_LOADED_CHILDREN) - _eio_model_emodel_children_load(obj, priv); + if (priv->load_pending & EFL_MODEL_LOAD_STATUS_LOADED_PROPERTIES) + _eio_model_efl_model_base_properties_load(obj, priv); + else if (priv->load_pending & EFL_MODEL_LOAD_STATUS_LOADED_CHILDREN) + _eio_model_efl_model_base_children_load(obj, priv); return priv->load.status; } @@ -335,8 +335,8 @@ _eio_model_emodel_property_set(Eo *obj EINA_UNUSED, Eio_Model_Data *priv, const /** * Children Count Get */ -static Emodel_Load_Status -_eio_model_emodel_children_count_get(Eo *obj EINA_UNUSED, Eio_Model_Data *priv, unsigned int *children_count) +static Efl_Model_Load_Status +_eio_model_efl_model_base_children_count_get(Eo *obj EINA_UNUSED, Eio_Model_Data *priv, unsigned int *children_count) { /**< eina_list_count returns 'unsigned int' */ *children_count = eina_list_count(priv->children_list); @@ -347,24 +347,24 @@ _eio_model_emodel_children_count_get(Eo *obj EINA_UNUSED, Eio_Model_Data *priv, * Properties Load */ static void -_eio_model_emodel_properties_load(Eo *obj EINA_UNUSED, Eio_Model_Data *priv) +_eio_model_efl_model_base_properties_load(Eo *obj EINA_UNUSED, Eio_Model_Data *priv) { if (priv->path == NULL) { - priv->load_pending |= EMODEL_LOAD_STATUS_LOADED_PROPERTIES; + priv->load_pending |= EFL_MODEL_LOAD_STATUS_LOADED_PROPERTIES; return; } - priv->load_pending &= ~EMODEL_LOAD_STATUS_LOADED_PROPERTIES; + priv->load_pending &= ~EFL_MODEL_LOAD_STATUS_LOADED_PROPERTIES; - if (!(priv->load.status & (EMODEL_LOAD_STATUS_LOADED_PROPERTIES | EMODEL_LOAD_STATUS_LOADING_PROPERTIES))) + if (!(priv->load.status & (EFL_MODEL_LOAD_STATUS_LOADED_PROPERTIES | EFL_MODEL_LOAD_STATUS_LOADING_PROPERTIES))) { - _load_set(priv, EMODEL_LOAD_STATUS_LOADING_PROPERTIES); + _load_set(priv, EFL_MODEL_LOAD_STATUS_LOADING_PROPERTIES); priv->file = eio_file_direct_stat(priv->path, _eio_stat_done_cb, _eio_error_cb, priv); } } static void -_eio_model_emodel_monitor_add(Eio_Model_Data *priv) +_eio_model_efl_model_base_monitor_add(Eio_Model_Data *priv) { if (!priv->monitor) { @@ -373,11 +373,11 @@ _eio_model_emodel_monitor_add(Eio_Model_Data *priv) for (i = 0; priv->mon.mon_event_child_add[i] != EIO_MONITOR_ERROR ; ++i) priv->mon.ecore_child_add_handler[i] = - ecore_event_handler_add(priv->mon.mon_event_child_add[i], _emodel_evt_added_ecore_cb, priv); + ecore_event_handler_add(priv->mon.mon_event_child_add[i], _efl_model_evt_added_ecore_cb, priv); for (i = 0; priv->mon.mon_event_child_del[i] != EIO_MONITOR_ERROR ; ++i) priv->mon.ecore_child_add_handler[i] = - ecore_event_handler_add(priv->mon.mon_event_child_del[i], _emodel_evt_deleted_ecore_cb, priv); + ecore_event_handler_add(priv->mon.mon_event_child_del[i], _efl_model_evt_deleted_ecore_cb, priv); } } @@ -421,9 +421,9 @@ _eio_done_children_load_cb(void *data, Eio_File *handler EINA_UNUSED) EINA_SAFETY_ON_NULL_RETURN(priv); count = eina_list_count(priv->children_list); - _load_set(priv, EMODEL_LOAD_STATUS_LOADED_CHILDREN); + _load_set(priv, EFL_MODEL_LOAD_STATUS_LOADED_CHILDREN); - eo_do(priv->obj, eo_event_callback_call(EMODEL_EVENT_CHILDREN_COUNT_CHANGED, &count)); + eo_do(priv->obj, eo_event_callback_call(EFL_MODEL_BASE_EVENT_CHILDREN_COUNT_CHANGED, &count)); } static void @@ -437,29 +437,29 @@ _eio_error_children_load_cb(void *data, Eio_File *handler EINA_UNUSED, int error EINA_LIST_FREE(priv->children_list, child) eo_unref(child); - _load_set(priv, EMODEL_LOAD_STATUS_LOADED_CHILDREN); + _load_set(priv, EFL_MODEL_LOAD_STATUS_LOADED_CHILDREN); } /** * Children Load */ static void -_eio_model_emodel_children_load(Eo *obj EINA_UNUSED, Eio_Model_Data *priv) +_eio_model_efl_model_base_children_load(Eo *obj EINA_UNUSED, Eio_Model_Data *priv) { if (priv->path == NULL) { - priv->load_pending |= EMODEL_LOAD_STATUS_LOADED_CHILDREN; + priv->load_pending |= EFL_MODEL_LOAD_STATUS_LOADED_CHILDREN; return; } - priv->load_pending &= ~EMODEL_LOAD_STATUS_LOADED_CHILDREN; + priv->load_pending &= ~EFL_MODEL_LOAD_STATUS_LOADED_CHILDREN; if (priv->children_list == NULL && priv->is_dir && - !(priv->load.status & (EMODEL_LOAD_STATUS_LOADED_CHILDREN | EMODEL_LOAD_STATUS_LOADING_CHILDREN))) + !(priv->load.status & (EFL_MODEL_LOAD_STATUS_LOADED_CHILDREN | EFL_MODEL_LOAD_STATUS_LOADING_CHILDREN))) { - _eio_model_emodel_monitor_add(priv); + _eio_model_efl_model_base_monitor_add(priv); - _load_set(priv, EMODEL_LOAD_STATUS_LOADING_CHILDREN); + _load_set(priv, EFL_MODEL_LOAD_STATUS_LOADING_CHILDREN); eio_file_direct_ls(priv->path, _eio_filter_children_load_cb, _eio_main_children_load_cb, _eio_done_children_load_cb, _eio_error_children_load_cb, priv); @@ -470,17 +470,17 @@ _eio_model_emodel_children_load(Eo *obj EINA_UNUSED, Eio_Model_Data *priv) * Load */ static void -_eio_model_emodel_load(Eo *obj, Eio_Model_Data *priv) +_eio_model_efl_model_base_load(Eo *obj, Eio_Model_Data *priv) { - priv->load_pending |= EMODEL_LOAD_STATUS_LOADED_CHILDREN; - _eio_model_emodel_properties_load(obj, priv); + priv->load_pending |= EFL_MODEL_LOAD_STATUS_LOADED_CHILDREN; + _eio_model_efl_model_base_properties_load(obj, priv); } /** * Load status get */ -static Emodel_Load_Status -_eio_model_emodel_load_status_get(Eo *obj EINA_UNUSED, Eio_Model_Data *priv) +static Efl_Model_Load_Status +_eio_model_efl_model_base_load_status_get(Eo *obj EINA_UNUSED, Eio_Model_Data *priv) { return priv->load.status; } @@ -489,9 +489,9 @@ _eio_model_emodel_load_status_get(Eo *obj EINA_UNUSED, Eio_Model_Data *priv) * Unload */ static void -_eio_model_emodel_unload(Eo *obj EINA_UNUSED, Eio_Model_Data *priv) +_eio_model_efl_model_base_unload(Eo *obj EINA_UNUSED, Eio_Model_Data *priv) { - if (!(priv->load.status & EMODEL_LOAD_STATUS_UNLOADED)) + if (!(priv->load.status & EFL_MODEL_LOAD_STATUS_UNLOADED)) { Eo *child; EINA_LIST_FREE(priv->children_list, child) @@ -499,7 +499,7 @@ _eio_model_emodel_unload(Eo *obj EINA_UNUSED, Eio_Model_Data *priv) eo_unref(child); } - _load_set(priv, EMODEL_LOAD_STATUS_UNLOADED); + _load_set(priv, EFL_MODEL_LOAD_STATUS_UNLOADED); } } @@ -514,13 +514,13 @@ _eio_model_children_filter_set(Eo *obj EINA_UNUSED, Eio_Model_Data *priv, Eio_Fi * Child Add */ static Eo * -_eio_model_emodel_child_add(Eo *obj EINA_UNUSED, Eio_Model_Data *priv EINA_UNUSED) +_eio_model_efl_model_base_child_add(Eo *obj EINA_UNUSED, Eio_Model_Data *priv EINA_UNUSED) { return eo_add(EIO_MODEL_CLASS, obj); } static void -_eio_model_emodel_child_del_stat(void* data, Eio_File* handler EINA_UNUSED, const Eina_Stat* stat) +_eio_model_efl_model_base_child_del_stat(void* data, Eio_File* handler EINA_UNUSED, const Eina_Stat* stat) { Eo* child = data; Eio_Model_Data *child_priv = eo_data_scope_get(child, MY_CLASS); @@ -539,11 +539,11 @@ _eio_model_emodel_child_del_stat(void* data, Eio_File* handler EINA_UNUSED, cons /** * Child Remove */ -static Emodel_Load_Status -_eio_model_emodel_child_del(Eo *obj EINA_UNUSED, Eio_Model_Data *priv, Eo *child) +static Efl_Model_Load_Status +_eio_model_efl_model_base_child_del(Eo *obj EINA_UNUSED, Eio_Model_Data *priv, Eo *child) { Eio_Model_Data *child_priv; - EINA_SAFETY_ON_NULL_RETURN_VAL(child, EMODEL_LOAD_STATUS_ERROR); + EINA_SAFETY_ON_NULL_RETURN_VAL(child, EFL_MODEL_LOAD_STATUS_ERROR); if (priv->children_list != NULL) { @@ -551,10 +551,10 @@ _eio_model_emodel_child_del(Eo *obj EINA_UNUSED, Eio_Model_Data *priv, Eo *child } child_priv = eo_data_scope_get(child, MY_CLASS); - EINA_SAFETY_ON_NULL_RETURN_VAL(child_priv, EMODEL_LOAD_STATUS_ERROR); + EINA_SAFETY_ON_NULL_RETURN_VAL(child_priv, EFL_MODEL_LOAD_STATUS_ERROR); eio_file_direct_stat(child_priv->path, - &_eio_model_emodel_child_del_stat, + &_eio_model_efl_model_base_child_del_stat, &_eio_error_unlink_cb, child); eo_ref(child); @@ -564,8 +564,8 @@ _eio_model_emodel_child_del(Eo *obj EINA_UNUSED, Eio_Model_Data *priv, Eo *child /** * Children Slice Get */ -static Emodel_Load_Status -_eio_model_emodel_children_slice_get(Eo *obj EINA_UNUSED, Eio_Model_Data *priv, +static Efl_Model_Load_Status +_eio_model_efl_model_base_children_slice_get(Eo *obj EINA_UNUSED, Eio_Model_Data *priv, unsigned start, unsigned count, Eina_Accessor **children_accessor) { Eo *child; @@ -576,7 +576,7 @@ _eio_model_emodel_children_slice_get(Eo *obj EINA_UNUSED, Eio_Model_Data *priv, * and parameter is set to NULL. */ - if (!(priv->load.status & EMODEL_LOAD_STATUS_LOADED_CHILDREN)) + if (!(priv->load.status & EFL_MODEL_LOAD_STATUS_LOADED_CHILDREN)) { /** * Status should be in either unloaded state or unitialized @@ -640,7 +640,7 @@ _eio_model_eo_base_constructor(Eo *obj, Eio_Model_Data *priv) priv->properties_value[EIO_MODEL_PROP_IS_LNK] = eina_value_new(EINA_VALUE_TYPE_INT); priv->properties_value[EIO_MODEL_PROP_SIZE] = eina_value_new(EINA_VALUE_TYPE_INT64); - priv->load.status = EMODEL_LOAD_STATUS_UNLOADED; + priv->load.status = EFL_MODEL_LOAD_STATUS_UNLOADED; priv->monitor = NULL; } diff --git a/src/lib/eio/eio_model.eo b/src/lib/eio/eio_model.eo index 83e4aa3b8a..67890fa1a2 100644 --- a/src/lib/eio/eio_model.eo +++ b/src/lib/eio/eio_model.eo @@ -1,4 +1,4 @@ -class Eio.Model (Eo.Base, Emodel) +class Eio.Model (Eo.Base, Efl.Model.Base) { legacy_prefix: null; methods { @@ -33,17 +33,17 @@ class Eio.Model (Eo.Base, Emodel) implements { Eo.Base.constructor; Eo.Base.destructor; - Emodel.properties.get; - Emodel.properties_load; - Emodel.property.set; - Emodel.property.get; - Emodel.load; - Emodel.load_status.get; - Emodel.unload; - Emodel.child_add; - Emodel.child_del; - Emodel.children_slice.get; - Emodel.children_count.get; - Emodel.children_load; + Efl.Model.Base.properties.get; + Efl.Model.Base.properties_load; + Efl.Model.Base.property.set; + Efl.Model.Base.property.get; + Efl.Model.Base.load; + Efl.Model.Base.load_status.get; + Efl.Model.Base.unload; + Efl.Model.Base.child_add; + Efl.Model.Base.child_del; + Efl.Model.Base.children_slice.get; + Efl.Model.Base.children_count.get; + Efl.Model.Base.children_load; } } diff --git a/src/lib/eio/eio_model.h b/src/lib/eio/eio_model.h index e0510702a7..1c46d77c45 100644 --- a/src/lib/eio/eio_model.h +++ b/src/lib/eio/eio_model.h @@ -30,7 +30,7 @@ #define _EMODEL_EIO_H #include -#include +#include #include #ifdef __cplusplus diff --git a/src/lib/eio/eio_model_private.h b/src/lib/eio/eio_model_private.h index e88cd0fd0d..0aed0d6a4a 100644 --- a/src/lib/eio/eio_model_private.h +++ b/src/lib/eio/eio_model_private.h @@ -40,7 +40,7 @@ struct _Eio_Model_Data char *path; Eina_Array *properties_name; Eina_Value *properties_value[EIO_MODEL_PROP_LAST]; - Emodel_Load load; + Efl_Model_Load load; int load_pending; Eina_List *children_list; /**< EIO data */ diff --git a/src/lib/emodel/Emodel.h b/src/lib/emodel/Emodel.h deleted file mode 100644 index 43c0b9c9b9..0000000000 --- a/src/lib/emodel/Emodel.h +++ /dev/null @@ -1,127 +0,0 @@ -/** - @brief Emodel Library Public API Calls - These routines are used for MVC (Model View Controller) Library interaction. - */ -/** - * @page emodel_main Emodel - * - * @date 2014 (created) - * @section toc Table of Contents - * - * @li @ref emodel_main_intro - * @li @ref emodel_main_intro_example - * - * @section emodel_main_intro Introduction - * - * The Emodel(model) generic object system for Emodel View Controller. - * - * @section emodel_main_work How does Emodel work? - * - * The Model notifies Views and Controllers when there is a change in its state. - * The other way around is also true and the Model can be passive and be poolled - * for update rather than generating output representations. - * - * Concrete objects can implement functionalities by overriding Emodel's API, abstracting its complexities from - * applications that can keep focus on higher level implementation. - * - * Examples of concrete implementations that can make use Emodel: - * - * Filesystem and I/O operations; - * Database management; - * GUI forms, lists and trees. - * - * Application code tends to be small in number of lines, - * more simple and code readability is improved. - * - * Emodel use EO Events. Views and Controllers must register - * in events to be able to recieve notifications about state changes in Emodel. - * Some of currently available events are: - * - * EMODEL_EVENT_LOAD_STATUS - * EMODEL_EVENT_PROPERTIES_CHANGED - * EMODEL_EVENT_CHILD_ADDED - * EMODEL_EVENT_CHILD_REMOVED - * EMODEL_EVENT_CHILDREN_COUNT_CHANGED - * - * Example code using Emodel_Eio that returns the number of files in '/tmp' directory: - * - * @code - * static Eina_Bool - * _children_count_cb(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info) - * { - * size_t *len = event_info; - * fprintf(stdout, "Children count len=%lu\n", *len); - * return EINA_TRUE; - * } - * - * int - * main(int argc, const char **argv) - * { - * size_t total; - * Eo *model; - * if(!ecore_init()) - * { - * fprintf(stderr, "ERROR: Cannot init Ecore!\n"); - * return 1; - * } - * if(!eio_init()) - * { - * fprintf(stderr, "ERROR: Cannot init Eio!\n"); - * return 1; - * } - * - * model = eo_add_custom(EIO_MODEL_CLASS, NULL, eio_model_constructor("/tmp")); - * eo_do(model, eo_event_callback_add(EMODEL_EVENT_CHILDREN_COUNT_CHANGED, _children_count_cb, NULL)); - * eo_do(model, emodel_children_count_get(&total)); - * fprintf(stdout, "total=%lu\n", total); - * - * ecore_main_loop_begin(); - * eo_unref(model); - * eio_shutdown(); - * ecore_shutdown(); - * return 0; - * } - * @endcode - * - * In previous example the concrete Emodel_Eio counts, asynchronously, the number of files in given directory, - * emodel_children_count_get() returns into 'total' pointer the last known number of children. In the meantime - * when background count is finished _children_count_cb() is invoked receiving the number of files as event_info data. - * This is achieved by registering the Model as EMODEL_EVENT_CHILDREN_COUNT_CHANGED event listener and every time - * the count (number of children) changes, the event is disptached to listeners. - * - * The principles may remain the same for different events and the logic remains. - * - * @li @ref emodel_main_intro_example - * - * @include emodel_test_file.c - * - * Recommended reading: - * - * @li @ref Eo, where you'll understand how Eo Events work. - * @li @ref Eio, where you'll find EFL Eio implementation and interfaces. - * @li @ref Emodel_Eio, the concrete EIO implementation using both Emodel and Eio. - * @li @ref Ecore, You'll get more information about I/O filesystem events. - * - * @defgroup Emodel - * - * @addtogroup Emodel - * @{ - */ - -#ifndef _EMODEL_H -#define _EMODEL_H - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#ifdef __cplusplus -} -#endif -#endif //_EMODEL_H diff --git a/src/lib/emodel/Emodel_Common.h b/src/lib/emodel/Emodel_Common.h deleted file mode 100644 index 2f2effc6d3..0000000000 --- a/src/lib/emodel/Emodel_Common.h +++ /dev/null @@ -1,92 +0,0 @@ -#ifndef _EMODEL_COMMON_H -#define _EMODEL_COMMON_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @enum _Emodel_Load_Status - * XXX/TODO/FIXME: Remove this enum (and possibly other data) from here - * as soon as eolian translates these data types in .eo's. - */ -enum _Emodel_Load_Status - { - EMODEL_LOAD_STATUS_ERROR = 0, - EMODEL_LOAD_STATUS_LOADING_PROPERTIES = (1 << 0), - EMODEL_LOAD_STATUS_LOADING_CHILDREN = (1 << 1), - EMODEL_LOAD_STATUS_LOADING = (1 << 0) | (1 << 1), - - EMODEL_LOAD_STATUS_LOADED_PROPERTIES = (1 << 2), - EMODEL_LOAD_STATUS_LOADED_CHILDREN = (1 << 3), - EMODEL_LOAD_STATUS_LOADED = (1 << 2) | (1 << 3), - - EMODEL_LOAD_STATUS_UNLOADING = (1 << 4), - EMODEL_LOAD_STATUS_UNLOADED = (1 << 5) - }; -/** - * @typedef Emodel_Load_Status - */ -typedef enum _Emodel_Load_Status Emodel_Load_Status; - -/** - * @struct _Emodel_Load - * Structure to hold Emodel_Load_Status enum - * (and possible other data) to avoid ABI break. - */ -struct _Emodel_Load - { - Emodel_Load_Status status; - /* add more data below here if necessary */ - }; - -/** - * @typedef Emodel_Load - */ -typedef struct _Emodel_Load Emodel_Load; - -/** - * @struct _Emodel_Property_Event - */ -struct _Emodel_Property_Event -{ - const Eina_Array *changed_properties; /**< array of property name */ - const Eina_Array *invalidated_properties; /**< array of property name */ -}; - -/** - * @typedef Emodel_Property_Event - */ -typedef struct _Emodel_Property_Event Emodel_Property_Event; - -/** - * @struct _Emodel_Children_Event - * Every time a child id added the event - * EMODEL_EVENT_CHILD_ADDED is dispatched - * passing along this structure. - */ -struct _Emodel_Children_Event -{ - Eo *child; /**< child, for child_add */ - /** - * index is a hint and is intended - * to provide a way for applications - * to control/know children relative - * positions through listings. - * - * NOTE: If listing is performed asynchronously - * exact order may not be guaranteed. - */ - unsigned int index; -}; - -/** - * @struct Emodel_Children_Event - */ -typedef struct _Emodel_Children_Event Emodel_Children_Event; - - -#ifdef __cplusplus -} -#endif -#endif diff --git a/src/lib/emodel/emodel.c b/src/lib/emodel/emodel.c deleted file mode 100644 index c8df075bc5..0000000000 --- a/src/lib/emodel/emodel.c +++ /dev/null @@ -1,6 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "Emodel.h" -#include "emodel.eo.c" diff --git a/src/tests/emodel/emodel_test_file.c b/src/tests/eio/eio_model_test_file.c similarity index 69% rename from src/tests/emodel/emodel_test_file.c rename to src/tests/eio/eio_model_test_file.c index e3a3b65530..af5269d033 100644 --- a/src/tests/emodel/emodel_test_file.c +++ b/src/tests/eio/eio_model_test_file.c @@ -7,14 +7,14 @@ #include #include #include -#include +#include #include #include #include -#define EMODEL_TEST_FILENAME_PATH "/tmp" -#define EMODEL_MAX_TEST_CHILDS 16 +#define EFL_MODEL_TEST_FILENAME_PATH "/tmp" +#define EFL_MODEL_MAX_TEST_CHILDS 16 /** * The following test works however @@ -65,46 +65,46 @@ static Eina_Bool static Eina_Bool _load_status_cb(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info) { - Emodel_Load *st = event_info; + Efl_Model_Load *st = event_info; printf("Load CHANGE\n"); - if (st->status & EMODEL_LOAD_STATUS_LOADED_CHILDREN) + if (st->status & EFL_MODEL_LOAD_STATUS_LOADED_CHILDREN) printf("Children is Loaded\n"); - if (st->status & EMODEL_LOAD_STATUS_LOADED_PROPERTIES) + if (st->status & EFL_MODEL_LOAD_STATUS_LOADED_PROPERTIES) printf("Properties is Loaded\n"); - if ((st->status & EMODEL_LOAD_STATUS_LOADED) == EMODEL_LOAD_STATUS_LOADED) + if ((st->status & EFL_MODEL_LOAD_STATUS_LOADED) == EFL_MODEL_LOAD_STATUS_LOADED) { Eina_Accessor *accessor; const Eina_Value *value_prop; - Emodel_Load_Status status; + Efl_Model_Load_Status status; unsigned int total; char *str; printf("Model is Loaded\n"); - eo_do(obj, status = emodel_property_get("filename", &value_prop)); + eo_do(obj, status = efl_model_property_get("filename", &value_prop)); str = eina_value_to_string(value_prop); - printf("emodel_loaded filename %s, status=%d\n", str, status); + printf("efl_model_loaded filename %s, status=%d\n", str, status); free(str); - eo_do(obj, status = emodel_property_get("size", &value_prop)); + eo_do(obj, status = efl_model_property_get("size", &value_prop)); str = eina_value_to_string(value_prop); - printf("emodel_loaded size %s, status=%d\n", str, status); + printf("efl_model_loaded size %s, status=%d\n", str, status); free(str); - eo_do(obj, status = emodel_property_get("mtime", &value_prop)); + eo_do(obj, status = efl_model_property_get("mtime", &value_prop)); str = eina_value_to_string(value_prop); - printf("emodel_loaded mtime %s, status=%d\n", str, status); + printf("efl_model_loaded mtime %s, status=%d\n", str, status); free(str); - eo_do(obj, emodel_children_count_get(&total)); - printf("emodel_test count %d\n", (int)total); + eo_do(obj, efl_model_children_count_get(&total)); + printf("efl_model_test count %d\n", (int)total); /**< get full list */ - eo_do(obj, status = emodel_children_slice_get(0 ,0 ,(Eina_Accessor **)&accessor)); + eo_do(obj, status = efl_model_children_slice_get(0 ,0 ,(Eina_Accessor **)&accessor)); eina_accessor_free(accessor); - eo_do(obj, status = emodel_children_slice_get(5 ,5 ,(Eina_Accessor **)&accessor)); + eo_do(obj, status = efl_model_children_slice_get(5 ,5 ,(Eina_Accessor **)&accessor)); eina_accessor_free(accessor); ecore_main_loop_quit(); } @@ -114,7 +114,7 @@ _load_status_cb(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *des static Eina_Bool _properties_change_cb(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info) { - const Emodel_Property_Event *evt = (Emodel_Property_Event *)event_info; + const Efl_Model_Property_Event *evt = (Efl_Model_Property_Event *)event_info; const char *prop; Eina_Array_Iterator it; unsigned int i; @@ -144,17 +144,17 @@ _children_count_cb(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Event_D fprintf(stdout, "Children count number=%d\n", *len); reqs.children = *len; - eo_do(obj, emodel_children_count_get(&total)); + eo_do(obj, efl_model_children_count_get(&total)); fprintf(stdout, "New total children count number=%d\n", *len); return EINA_TRUE; } -START_TEST(emodel_test_test_file) +START_TEST(eio_model_test_test_file) { Eo *filemodel = NULL; const Eina_Value *value_prop; - Emodel_Load_Status status; + Efl_Model_Load_Status status; #ifdef _RUN_LOCAL_TEST Eina_Value nameset_value; #endif @@ -169,25 +169,25 @@ START_TEST(emodel_test_test_file) fail_if(!ecore_init(), "ERROR: Cannot init Ecore!\n"); fail_if(!eio_init(), "ERROR: Cannot init EIO!\n"); - filemodel = eo_add(EIO_MODEL_CLASS, NULL, eio_model_path_set(EMODEL_TEST_FILENAME_PATH)); + filemodel = eo_add(EIO_MODEL_CLASS, NULL, eio_model_path_set(EFL_MODEL_TEST_FILENAME_PATH)); fail_if(!filemodel, "ERROR: Cannot init model!\n"); - eo_do(filemodel, eo_event_callback_add(EMODEL_EVENT_LOAD_STATUS, _load_status_cb, NULL)); - eo_do(filemodel, eo_event_callback_add(EMODEL_EVENT_PROPERTIES_CHANGED, _properties_change_cb, NULL)); - eo_do(filemodel, eo_event_callback_add(EMODEL_EVENT_CHILDREN_COUNT_CHANGED, _children_count_cb, NULL)); + eo_do(filemodel, eo_event_callback_add(EFL_MODEL_BASE_EVENT_LOAD_STATUS, _load_status_cb, NULL)); + eo_do(filemodel, eo_event_callback_add(EFL_MODEL_BASE_EVENT_PROPERTIES_CHANGED, _properties_change_cb, NULL)); + eo_do(filemodel, eo_event_callback_add(EFL_MODEL_BASE_EVENT_CHILDREN_COUNT_CHANGED, _children_count_cb, NULL)); - eo_do(filemodel, emodel_load()); + eo_do(filemodel, efl_model_load()); handler = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, exit_func, NULL); - eo_do(filemodel, status = emodel_property_get("filename", &value_prop)); + eo_do(filemodel, status = efl_model_property_get("filename", &value_prop)); str = eina_value_to_string(value_prop); - printf("emodel_test filename %s, load status %d\n", str, status); + printf("efl_model_test filename %s, load status %d\n", str, status); free(str); i = 0; - eo_do(filemodel, emodel_properties_get(&properties_list)); + eo_do(filemodel, efl_model_properties_get(&properties_list)); EINA_ARRAY_ITER_NEXT(properties_list, i, str, iterator) { fprintf(stdout, "Returned property list %d: %s\n", i, str); @@ -210,10 +210,10 @@ START_TEST(emodel_test_test_file) #ifdef _RUN_LOCAL_TEST eina_value_setup(&nameset_value, EINA_VALUE_TYPE_STRING); eina_value_setup(&value_prop, EINA_VALUE_TYPE_STRING); - eina_value_set(&nameset_value, "/tmp/emodel_test"); - eo_do(filemodel, emodel_property_set("path", &nameset_value)); + eina_value_set(&nameset_value, "/tmp/efl_model_test"); + eo_do(filemodel, efl_model_property_set("path", &nameset_value)); eina_value_flush(&nameset_value); - eo_do(filemodel, status = emodel_property_get("path", &value_prop)); + eo_do(filemodel, status = efl_model_property_get("path", &value_prop)); #endif sleep(1); /**< EIO is asynchrounous so I must give some time for deletions to execute */ @@ -225,8 +225,8 @@ START_TEST(emodel_test_test_file) END_TEST void -emodel_test_file(TCase *tc) +eio_model_test_file(TCase *tc) { - tcase_add_test(tc, emodel_test_test_file); + tcase_add_test(tc, eio_model_test_test_file); } diff --git a/src/tests/emodel/emodel_test_monitor_add.c b/src/tests/eio/eio_model_test_monitor_add.c similarity index 65% rename from src/tests/emodel/emodel_test_monitor_add.c rename to src/tests/eio/eio_model_test_monitor_add.c index ee8bb49021..af95ae8f75 100644 --- a/src/tests/emodel/emodel_test_monitor_add.c +++ b/src/tests/eio/eio_model_test_monitor_add.c @@ -7,28 +7,28 @@ #include #include #include -#include +#include #include #include #include -#define EMODEL_TEST_FILENAME_PATH "/tmp" +#define EFL_MODEL_TEST_FILENAME_PATH "/tmp" Eina_Bool children_added = EINA_FALSE; static Eina_Bool _load_monitor_status_cb(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info) { - Emodel_Load* st = event_info; + Efl_Model_Load* st = event_info; Eo* parent = data; const Eina_Value* value_prop = NULL; const char* str = NULL; - if (!(st->status & EMODEL_LOAD_STATUS_LOADED_PROPERTIES)) + if (!(st->status & EFL_MODEL_LOAD_STATUS_LOADED_PROPERTIES)) return EINA_TRUE; - eo_do(obj, emodel_property_get("filename", &value_prop)); + eo_do(obj, efl_model_property_get("filename", &value_prop)); fail_if(!value_prop, "ERROR: Cannot get property!\n"); str = eina_value_to_string(value_prop); @@ -37,9 +37,9 @@ _load_monitor_status_cb(void *data, Eo *obj, const Eo_Event_Description *desc EI if(strcmp(str, "test_file_monitor_add") == 0) { fprintf(stderr, "is child that we want\n"); - eo_do(obj, eo_event_callback_del(EMODEL_EVENT_LOAD_STATUS, _load_monitor_status_cb, data)); + eo_do(obj, eo_event_callback_del(EFL_MODEL_BASE_EVENT_LOAD_STATUS, _load_monitor_status_cb, data)); children_added = EINA_TRUE; - eo_do(parent, emodel_child_del(obj)); + eo_do(parent, efl_model_child_del(obj)); ecore_main_loop_quit(); } @@ -49,12 +49,12 @@ _load_monitor_status_cb(void *data, Eo *obj, const Eo_Event_Description *desc EI static Eina_Bool _children_added_cb(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info) { - Emodel_Children_Event* evt = event_info; + Efl_Model_Children_Event* evt = event_info; if (evt == NULL) return EINA_TRUE; - eo_do(evt->child, eo_event_callback_add(EMODEL_EVENT_LOAD_STATUS, _load_monitor_status_cb, obj)); - eo_do(evt->child, emodel_load()); + eo_do(evt->child, eo_event_callback_add(EFL_MODEL_BASE_EVENT_LOAD_STATUS, _load_monitor_status_cb, obj)); + eo_do(evt->child, efl_model_load()); return EINA_TRUE; } @@ -64,42 +64,42 @@ _children_count_cb(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description * { unsigned int *len = event_info; Eina_Accessor *accessor; - Emodel_Load_Status status; + Efl_Model_Load_Status status; Eo *child; unsigned int i = 0; fprintf(stderr, "Children count number=%d\n", *len); /**< get full list */ - eo_do(obj, status = emodel_children_slice_get(0 ,0 ,(Eina_Accessor **)&accessor)); + eo_do(obj, status = efl_model_children_slice_get(0 ,0 ,(Eina_Accessor **)&accessor)); if(accessor != NULL) { EINA_ACCESSOR_FOREACH(accessor, i, child) {} fprintf(stdout, "Got %d childs from Accessor. status=%d\n", i, status); } - fclose(fopen(EMODEL_TEST_FILENAME_PATH "/test_file_monitor_add", "w+")); + fclose(fopen(EFL_MODEL_TEST_FILENAME_PATH "/test_file_monitor_add", "w+")); return EINA_TRUE; } -START_TEST(emodel_test_test_monitor_add) +START_TEST(eio_model_test_test_monitor_add) { Eo *filemodel = NULL; - fprintf(stderr, "emodel_test_test_monitor_add\n"); + fprintf(stderr, "efl_model_test_test_monitor_add\n"); fail_if(!eina_init(), "ERROR: Cannot init Eina!\n"); fail_if(!ecore_init(), "ERROR: Cannot init Ecore!\n"); fail_if(!eio_init(), "ERROR: Cannot init EIO!\n"); - filemodel = eo_add(EIO_MODEL_CLASS, NULL, eio_model_path_set(EMODEL_TEST_FILENAME_PATH)); + filemodel = eo_add(EIO_MODEL_CLASS, NULL, eio_model_path_set(EFL_MODEL_TEST_FILENAME_PATH)); fail_if(!filemodel, "ERROR: Cannot init model!\n"); - eo_do(filemodel, eo_event_callback_add(EMODEL_EVENT_CHILD_ADDED, _children_added_cb, NULL)); - eo_do(filemodel, eo_event_callback_add(EMODEL_EVENT_CHILDREN_COUNT_CHANGED, _children_count_cb, NULL)); + eo_do(filemodel, eo_event_callback_add(EFL_MODEL_BASE_EVENT_CHILD_ADDED, _children_added_cb, NULL)); + eo_do(filemodel, eo_event_callback_add(EFL_MODEL_BASE_EVENT_CHILDREN_COUNT_CHANGED, _children_count_cb, NULL)); - eo_do(filemodel, emodel_load()); + eo_do(filemodel, efl_model_load()); ecore_main_loop_begin(); @@ -118,8 +118,8 @@ START_TEST(emodel_test_test_monitor_add) END_TEST void -emodel_test_monitor_add(TCase *tc) +eio_model_test_monitor_add(TCase *tc) { - tcase_add_test(tc, emodel_test_test_monitor_add); + tcase_add_test(tc, eio_model_test_test_monitor_add); } diff --git a/src/tests/eio/eio_suite.c b/src/tests/eio/eio_suite.c index 08deb05803..ecc52247b3 100644 --- a/src/tests/eio/eio_suite.c +++ b/src/tests/eio/eio_suite.c @@ -19,6 +19,8 @@ struct _Eio_Test_Case static const Eio_Test_Case etc[] = { {"Eio_Monitor", eio_test_monitor}, + {"Eio Model", eio_model_test_file}, + {"Eio Model Monitor", eio_model_test_monitor_add}, {NULL, NULL} }; diff --git a/src/tests/eio/eio_suite.h b/src/tests/eio/eio_suite.h index 2212f8eafb..d59a2ab6c0 100644 --- a/src/tests/eio/eio_suite.h +++ b/src/tests/eio/eio_suite.h @@ -4,5 +4,7 @@ #include void eio_test_monitor(TCase *tc); +void eio_model_test_file(TCase *tc); +void eio_model_test_monitor_add(TCase *tc); #endif /* _EIO_SUITE_H */ diff --git a/src/tests/emodel/emodel_suite.c b/src/tests/emodel/emodel_suite.c deleted file mode 100644 index 33b61e0e34..0000000000 --- a/src/tests/emodel/emodel_suite.c +++ /dev/null @@ -1,138 +0,0 @@ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include - -#include - -void emodel_test_file(TCase* tc); -void emodel_test_monitor_add(TCase* tc); - -typedef struct _Emodel_Test_Case Emodel_Test_Case; -struct _Emodel_Test_Case -{ - const char *test_case; - void (*build)(TCase *tc); -}; - -static const Emodel_Test_Case etc[] = { - { "File", emodel_test_file }, - { "Monitor Add", emodel_test_monitor_add }, - { NULL, NULL } -}; - -static void -_list_tests(void) -{ - const Emodel_Test_Case *itr = etc; - fputs("Available Test Cases:\n", stderr); - for (; itr->test_case; itr++) - fprintf(stderr, "\t%s\n", itr->test_case); -} - -static Eina_Bool -_use_test(int argc, const char **argv, const char *test_case) -{ - if (argc < 1) - return 1; - - for (; argc > 0; argc--, argv++) - if (strcmp(test_case, *argv) == 0) - return 1; - - return 0; -} - -Suite * -emodel_build_suite(int argc, const char **argv) -{ - TCase *tc; - Suite *s; - int i; - - s = suite_create("Emodel"); - - for (i = 0; etc[i].test_case; ++i) - { - if (!_use_test(argc, argv, etc[i].test_case)) - continue; - - tc = tcase_create(etc[i].test_case); - tcase_set_timeout(tc, 0); - - etc[i].build(tc); - suite_add_tcase(s, tc); - } - - return s; -} - -/* FIXME this is a copy from eina_test_mempool - * we should remove the duplication - */ -static Eina_Array *_modules; -static void _mempool_init(void) -{ - eina_init(); - /* force modules to be loaded in case they are not installed */ - _modules = eina_module_list_get(NULL, - PACKAGE_BUILD_DIR "/src/modules", - EINA_TRUE, - NULL, - NULL); - eina_module_list_load(_modules); -} - -static void _mempool_shutdown(void) -{ - eina_module_list_free(_modules); - if (_modules) - eina_array_free(_modules); - /* TODO delete the list */ - eina_shutdown(); -} - -int -main(int argc, char **argv) -{ - Suite *s; - SRunner *sr; - int i, failed_count; - - for (i = 1; i < argc; i++) - if ((strcmp(argv[i], "-h") == 0) || - (strcmp(argv[i], "--help") == 0)) - { - fprintf(stderr, "Usage:\n\t%s [test_case1 .. [test_caseN]]\n", - argv[0]); - _list_tests(); - return 0; - } - else if ((strcmp(argv[i], "-l") == 0) || - (strcmp(argv[i], "--list") == 0)) - { - _list_tests(); - return 0; - } - - putenv("EFL_RUN_IN_TREE=1"); - - s = emodel_build_suite(argc - 1, (const char **)argv + 1); - sr = srunner_create(s); - - srunner_set_xml(sr, TESTS_BUILD_DIR "/check-results.xml"); - - _mempool_init(); - - srunner_run_all(sr, CK_ENV); - failed_count = srunner_ntests_failed(sr); - srunner_free(sr); - - _mempool_shutdown(); - - return (failed_count == 0) ? 0 : 255; -}