efl_model : rename all efl_model based classes.
Summary: As the result of discussion in T7458, we need to rename all efl_model based classes with efl_XXX_Model sequence. I've run few vote for this, see V42, V43 few classes are totally renamed as our consideration of misnaming. | Efl.Model_Loop | Efl.Loop_Model | | Efl.Model_Item | Efl.Generic_Model | | Efl.Model_Container | Efl.Container_Model | | Efl.Model_Container_Item | Efl.Container_Model_Item | | Efl.Model_Composite | Efl.Composite_Model | | Efl.Model_Composite_Boolean | Efl.Boolean_Model | | Efl.Model_Composite_Boolean_Chlidren | Efl.Boolean_Model_Item | | Efl.Model_Composite_Selection | Efl.Select_Model | | Efl.Model_Composite_Selection_Chlidren | Efl.Select_Model_Item | | Efl.Model_View | Efl.View_Model | | Eio.Model | Efl.Io.Model | | Efl.Ui.Model_State | Efl.Ui.State_Model | | Efl.Ui.Model_Size | Efl.Ui.Size_Model | | Efl.Ui.Model_Exact | Efl.Ui.Exact_Model | | Efl.Ui.Model_Average | Efl.Ui.Average_Model | | Efl.Ui.Model_Homogeneous | Efl.Ui.Homogeneous_Model | I worried about Efl.Io.Model changes, cause it is widely used, but as I tested, there is no issue found yet. Eldbus.Model also may can changed Efl.Dbus.Model, but I cannot found any class who using Efl.Dbus namespace, so I left it future work. Test Plan: Run the Make Test, it works well except Efl test about selection. there are class inheritance problem exist in select_model, I reported it and will fix it in another patch. Reviewers: cedric, felipealmeida, woohyun, Hermet Reviewed By: cedric Subscribers: lauromoura Tags: #efl, #do_not_merge Differential Revision: https://phab.enlightenment.org/D7533
This commit is contained in:
parent
c713bb90d3
commit
5525c89a3d
|
@ -42,14 +42,14 @@ ecore_eolian_files_public = \
|
|||
lib/ecore/efl_bounce_interpolator.eo \
|
||||
lib/ecore/efl_spring_interpolator.eo \
|
||||
lib/ecore/efl_cubic_bezier_interpolator.eo \
|
||||
lib/ecore/efl_model_loop.eo \
|
||||
lib/ecore/efl_model_item.eo \
|
||||
lib/ecore/efl_model_container.eo \
|
||||
lib/ecore/efl_model_container_item.eo \
|
||||
lib/ecore/efl_model_composite_boolean.eo \
|
||||
lib/ecore/efl_model_composite_selection.eo \
|
||||
lib/ecore/efl_model_composite.eo \
|
||||
lib/ecore/efl_model_view.eo
|
||||
lib/ecore/efl_loop_model.eo \
|
||||
lib/ecore/efl_generic_model.eo \
|
||||
lib/ecore/efl_container_model.eo \
|
||||
lib/ecore/efl_container_model_item.eo \
|
||||
lib/ecore/efl_boolean_model.eo \
|
||||
lib/ecore/efl_select_model.eo \
|
||||
lib/ecore/efl_composite_model.eo \
|
||||
lib/ecore/efl_view_model.eo
|
||||
|
||||
ecore_eolian_files = \
|
||||
$(ecore_eolian_files_legacy) \
|
||||
|
@ -118,18 +118,18 @@ lib/ecore/efl_io_stderr.c \
|
|||
lib/ecore/efl_io_file.c \
|
||||
lib/ecore/efl_io_copier.c \
|
||||
lib/ecore/efl_io_buffered_stream.c \
|
||||
lib/ecore/efl_model_loop.c \
|
||||
lib/ecore/efl_model_item.c \
|
||||
lib/ecore/efl_model_container.c \
|
||||
lib/ecore/efl_model_container_item.c \
|
||||
lib/ecore/efl_model_container_private.h \
|
||||
lib/ecore/efl_model_composite.c \
|
||||
lib/ecore/efl_model_composite_boolean.c \
|
||||
lib/ecore/efl_model_composite_selection.c \
|
||||
lib/ecore/efl_model_composite_private.h \
|
||||
lib/ecore/efl_loop_model.c \
|
||||
lib/ecore/efl_generic_model.c \
|
||||
lib/ecore/efl_container_model.c \
|
||||
lib/ecore/efl_container_model_item.c \
|
||||
lib/ecore/efl_container_model_private.h \
|
||||
lib/ecore/efl_composite_model.c \
|
||||
lib/ecore/efl_boolean_model.c \
|
||||
lib/ecore/efl_select_model.c \
|
||||
lib/ecore/efl_composite_model_private.h \
|
||||
lib/ecore/efl_model_accessor_view.c \
|
||||
lib/ecore/efl_model_accessor_view_private.h \
|
||||
lib/ecore/efl_model_view.c \
|
||||
lib/ecore/efl_view_model.c \
|
||||
lib/ecore/efl_linear_interpolator.c \
|
||||
lib/ecore/efl_accelerate_interpolator.c \
|
||||
lib/ecore/efl_decelerate_interpolator.c \
|
||||
|
|
|
@ -203,9 +203,9 @@ TESTS += tests/efl/efl_suite
|
|||
|
||||
tests_efl_efl_suite_SOURCES = \
|
||||
tests/efl/efl_suite.c \
|
||||
tests/efl/efl_test_model_container.c \
|
||||
tests/efl/efl_test_model_composite.c \
|
||||
tests/efl/efl_test_model_view.c \
|
||||
tests/efl/efl_test_container_model.c \
|
||||
tests/efl/efl_test_composite_model.c \
|
||||
tests/efl/efl_test_view_model.c \
|
||||
tests/efl/efl_suite.h
|
||||
|
||||
tests_efl_efl_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
### Library
|
||||
|
||||
eio_eolian_files = \
|
||||
lib/eio/eio_model.eo \
|
||||
lib/eio/efl_io_model.eo \
|
||||
lib/eio/efl_io_manager.eo \
|
||||
lib/eio/eio_sentry.eo
|
||||
|
||||
|
@ -38,8 +38,8 @@ lib/eio/eio_monitor.c \
|
|||
lib/eio/eio_monitor_poll.c \
|
||||
lib/eio/eio_single.c \
|
||||
lib/eio/eio_xattr.c \
|
||||
lib/eio/eio_model.c \
|
||||
lib/eio/eio_model_private.h \
|
||||
lib/eio/efl_io_model.c \
|
||||
lib/eio/efl_io_model_private.h \
|
||||
lib/eio/eio_private.h \
|
||||
lib/eio/eio_sentry_private.h
|
||||
|
||||
|
@ -74,8 +74,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/efl_io_model_test_file.c \
|
||||
tests/eio/efl_io_model_test_monitor_add.c \
|
||||
tests/eio/eio_test_monitor.c \
|
||||
tests/eio/eio_test_sentry.c \
|
||||
tests/eio/eio_test_file.c \
|
||||
|
|
|
@ -169,17 +169,17 @@ elm_private_eolian_files = \
|
|||
lib/elementary/efl_ui_focus_parent_provider.eo \
|
||||
lib/elementary/efl_ui_focus_parent_provider_standard.eo \
|
||||
lib/elementary/efl_ui_focus_parent_provider_gen.eo \
|
||||
lib/elementary/efl_ui_model_state.eo \
|
||||
lib/elementary/efl_ui_state_model.eo \
|
||||
tests/elementary/focus_test.eo \
|
||||
tests/elementary/focus_test_sub_main.eo \
|
||||
lib/elementary/efl_ui_selection_manager.eo \
|
||||
lib/elementary/efl_datetime_manager.eo \
|
||||
lib/elementary/efl_ui_list_view_relayout.eo \
|
||||
lib/elementary/efl_ui_list_view_precise_layouter.eo \
|
||||
lib/elementary/efl_ui_model_size.eo \
|
||||
lib/elementary/efl_ui_model_homogeneous.eo \
|
||||
lib/elementary/efl_ui_model_exact.eo \
|
||||
lib/elementary/efl_ui_model_average.eo \
|
||||
lib/elementary/efl_ui_size_model.eo \
|
||||
lib/elementary/efl_ui_homogeneous_model.eo \
|
||||
lib/elementary/efl_ui_exact_model.eo \
|
||||
lib/elementary/efl_ui_average_model.eo \
|
||||
$(NULL)
|
||||
|
||||
# Legacy classes - not part of public EO API
|
||||
|
@ -890,10 +890,10 @@ lib_elementary_libelementary_la_SOURCES = \
|
|||
lib/elementary/efl_ui_widget_focus_manager.c \
|
||||
lib/elementary/efl_ui_caching_factory.c \
|
||||
lib/elementary/efl_ui_widget_factory.c \
|
||||
lib/elementary/efl_ui_model_size.c \
|
||||
lib/elementary/efl_ui_model_homogeneous.c \
|
||||
lib/elementary/efl_ui_model_exact.c \
|
||||
lib/elementary/efl_ui_model_average.c \
|
||||
lib/elementary/efl_ui_size_model.c \
|
||||
lib/elementary/efl_ui_homogeneous_model.c \
|
||||
lib/elementary/efl_ui_exact_model.c \
|
||||
lib/elementary/efl_ui_average_model.c \
|
||||
$(NULL)
|
||||
|
||||
|
||||
|
|
|
@ -45,11 +45,11 @@ static Efl_Model*
|
|||
_make_model(Evas_Object *win)
|
||||
{
|
||||
Eina_Value vtext;
|
||||
Efl_Model_Item *model, *child;
|
||||
Efl_Generic_Model *model, *child;
|
||||
unsigned int i, s;
|
||||
char buf[256];
|
||||
|
||||
model = efl_add(EFL_MODEL_ITEM_CLASS, win);
|
||||
model = efl_add(EFL_GENERIC_MODEL_CLASS, win);
|
||||
eina_value_setup(&vtext, EINA_VALUE_TYPE_STRING);
|
||||
|
||||
for (i = 0; i < (NUM_ITEMS); i++)
|
||||
|
@ -74,7 +74,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
|||
Efl_Ui_Factory *factory;
|
||||
Evas_Object *win, *li;
|
||||
Eo *model;
|
||||
Efl_Model_Composite_Selection *selmodel;
|
||||
Efl_Select_Model *selmodel;
|
||||
|
||||
win = elm_win_util_standard_add("list_view", "List_View");
|
||||
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
|
||||
|
@ -82,7 +82,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
|||
elm_win_autodel_set(win, EINA_TRUE);
|
||||
|
||||
model = _make_model(win);
|
||||
selmodel = efl_add(EFL_MODEL_COMPOSITE_SELECTION_CLASS, efl_main_loop_get()
|
||||
selmodel = efl_add(EFL_SELECT_MODEL_CLASS, efl_main_loop_get()
|
||||
, efl_ui_view_model_set(efl_added, model)
|
||||
);
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
|||
if (argv[1] != NULL) dirname = argv[1];
|
||||
else dirname = EFL_MODEL_TEST_FILENAME_PATH;
|
||||
|
||||
model = efl_add(EIO_MODEL_CLASS, win, eio_model_path_set(efl_added, dirname));
|
||||
model = efl_add(EFL_IO_MODEL_CLASS, win, efl_io_model_path_set(efl_added, dirname));
|
||||
factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win);
|
||||
efl_ui_model_connect(factory, "efl.text", "filename");
|
||||
efl_ui_layout_factory_theme_config(factory, "list_item", NULL, "default");
|
||||
|
|
|
@ -70,7 +70,7 @@ _bt_add_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_
|
|||
{
|
||||
Priv_Data *priv = (Priv_Data*)data;
|
||||
Eina_Value vtext, value;
|
||||
Efl_Model_Item *child;
|
||||
Efl_Generic_Model *child;
|
||||
|
||||
eina_value_setup(&vtext, EINA_VALUE_TYPE_STRING);
|
||||
eina_value_setup(&value, EINA_VALUE_TYPE_UCHAR);
|
||||
|
@ -170,10 +170,10 @@ static Efl_Model*
|
|||
_make_model()
|
||||
{
|
||||
Eina_Value vtext, value;
|
||||
Efl_Model_Item *model, *child;
|
||||
Efl_Generic_Model *model, *child;
|
||||
unsigned int i, len;
|
||||
|
||||
model = efl_add(EFL_MODEL_ITEM_CLASS, efl_main_loop_get());
|
||||
model = efl_add(EFL_GENERIC_MODEL_CLASS, efl_main_loop_get());
|
||||
eina_value_setup(&vtext, EINA_VALUE_TYPE_STRING);
|
||||
eina_value_setup(&value, EINA_VALUE_TYPE_UCHAR);
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <Elementary.h>
|
||||
#include <Efl.h>
|
||||
#include <Eio.h>
|
||||
#include <eio_model.eo.h>
|
||||
#include <efl_io_model.eo.h>
|
||||
#include <stdio.h>
|
||||
#include <Eio.h>
|
||||
#include <elm_view_form.h>
|
||||
|
@ -38,7 +38,7 @@ _cleanup_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
|
|||
}
|
||||
|
||||
static int
|
||||
_filter_cb(void *data EINA_UNUSED, Eio_Model *model, Eina_File_Direct_Info *info)
|
||||
_filter_cb(void *data EINA_UNUSED, Efl_Io_Model *model, Eina_File_Direct_Info *info)
|
||||
{
|
||||
if (info->type == EINA_FILE_DIR && info->path[info->name_start] != '.') return 1;
|
||||
|
||||
|
@ -124,8 +124,8 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
|||
else dirname = EFL_MODEL_TEST_FILENAME_PATH;
|
||||
|
||||
//treemodel
|
||||
priv.treemodel = efl_add(EIO_MODEL_CLASS, win, eio_model_path_set(efl_added, dirname));
|
||||
eio_model_children_filter_set(priv.treemodel, NULL, _filter_cb, NULL);
|
||||
priv.treemodel = efl_add(EFL_IO_MODEL_CLASS, win, efl_io_model_path_set(efl_added, dirname));
|
||||
efl_io_model_children_filter_set(priv.treemodel, NULL, _filter_cb, NULL);
|
||||
|
||||
//treeview
|
||||
genlist = elm_genlist_add(win);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <Elementary.h>
|
||||
#include <Efl.h>
|
||||
#include <Eio.h>
|
||||
#include <eio_model.eo.h>
|
||||
#include <efl_io_model.eo.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define EFL_MODEL_TEST_FILENAME_PATH "/tmp"
|
||||
|
@ -54,7 +54,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
|||
evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_show(genlist);
|
||||
|
||||
priv.filemodel = efl_add(EIO_MODEL_CLASS, win, eio_model_path_set(efl_added, dirname));
|
||||
priv.filemodel = efl_add(EFL_IO_MODEL_CLASS, win, efl_io_model_path_set(efl_added, dirname));
|
||||
priv.fileview = efl_add(ELM_VIEW_LIST_CLASS, win, elm_view_list_genlist_set(efl_added, genlist, ELM_GENLIST_ITEM_TREE, "double_label"));
|
||||
elm_view_list_model_set(priv.fileview, priv.filemodel);
|
||||
evas_object_event_callback_add(win, EVAS_CALLBACK_DEL, _cleanup_cb, &priv);
|
||||
|
|
|
@ -111,7 +111,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
|||
if (argv[1] != NULL) dirname = argv[1];
|
||||
else dirname = EFL_MODEL_TEST_FILENAME_PATH;
|
||||
|
||||
priv->model = efl_add(EIO_MODEL_CLASS, win, eio_model_path_set(efl_added, dirname));
|
||||
priv->model = efl_add(EFL_IO_MODEL_CLASS, win, efl_io_model_path_set(efl_added, dirname));
|
||||
|
||||
genlist = elm_genlist_add(win);
|
||||
priv->fileview = efl_add(ELM_VIEW_LIST_CLASS, win, elm_view_list_genlist_set(efl_added, genlist, ELM_GENLIST_ITEM_NONE, NULL));
|
||||
|
|
|
@ -109,14 +109,14 @@ EAPI Eo *efl_main_loop_get(void);
|
|||
* @{
|
||||
*/
|
||||
|
||||
#include "efl_model_loop.eo.h"
|
||||
#include "efl_model_item.eo.h"
|
||||
#include "efl_model_container.eo.h"
|
||||
#include "efl_model_container_item.eo.h"
|
||||
#include "efl_model_composite.eo.h"
|
||||
#include "efl_model_composite_boolean.eo.h"
|
||||
#include "efl_model_composite_selection.eo.h"
|
||||
#include "efl_model_view.eo.h"
|
||||
#include "efl_loop_model.eo.h"
|
||||
#include "efl_generic_model.eo.h"
|
||||
#include "efl_container_model.eo.h"
|
||||
#include "efl_container_model_item.eo.h"
|
||||
#include "efl_composite_model.eo.h"
|
||||
#include "efl_boolean_model.eo.h"
|
||||
#include "efl_select_model.eo.h"
|
||||
#include "efl_view_model.eo.h"
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
|
@ -4,18 +4,18 @@
|
|||
|
||||
#include <Efl_Core.h>
|
||||
|
||||
#include "efl_model_composite_private.h"
|
||||
#include "efl_composite_model_private.h"
|
||||
|
||||
typedef struct _Efl_Model_Composite_Boolean_Data Efl_Model_Composite_Boolean_Data;
|
||||
typedef struct _Efl_Model_Composite_Boolean_Value Efl_Model_Composite_Boolean_Value;
|
||||
typedef struct _Efl_Boolean_Model_Data Efl_Boolean_Model_Data;
|
||||
typedef struct _Efl_Boolean_Model_Value Efl_Boolean_Model_Value;
|
||||
|
||||
struct _Efl_Model_Composite_Boolean_Data
|
||||
struct _Efl_Boolean_Model_Data
|
||||
{
|
||||
Efl_Model_Composite_Boolean_Data *parent;
|
||||
Efl_Boolean_Model_Data *parent;
|
||||
Eina_Hash *values;
|
||||
};
|
||||
|
||||
struct _Efl_Model_Composite_Boolean_Value
|
||||
struct _Efl_Boolean_Model_Value
|
||||
{
|
||||
Eina_Stringshare *property;
|
||||
|
||||
|
@ -29,41 +29,41 @@ struct _Efl_Model_Composite_Boolean_Value
|
|||
};
|
||||
|
||||
static Eina_Iterator *
|
||||
_efl_model_composite_boolean_efl_model_properties_get(const Eo *obj,
|
||||
Efl_Model_Composite_Boolean_Data *pd)
|
||||
_efl_boolean_model_efl_model_properties_get(const Eo *obj,
|
||||
Efl_Boolean_Model_Data *pd)
|
||||
{
|
||||
EFL_MODEL_COMPOSITE_PROPERTIES_SUPER(props,
|
||||
obj, EFL_MODEL_COMPOSITE_BOOLEAN_CLASS,
|
||||
EFL_COMPOSITE_MODEL_PROPERTIES_SUPER(props,
|
||||
obj, EFL_BOOLEAN_MODEL_CLASS,
|
||||
eina_hash_iterator_key_new(pd->parent->values));
|
||||
return props;
|
||||
}
|
||||
|
||||
static Eina_Value *
|
||||
_efl_model_composite_boolean_efl_model_property_get(const Eo *obj,
|
||||
Efl_Model_Composite_Boolean_Data *pd,
|
||||
const char *property)
|
||||
_efl_boolean_model_efl_model_property_get(const Eo *obj,
|
||||
Efl_Boolean_Model_Data *pd,
|
||||
const char *property)
|
||||
{
|
||||
Efl_Model_Composite_Boolean_Value *v;
|
||||
Efl_Boolean_Model_Value *v;
|
||||
Eina_Stringshare *s;
|
||||
Eina_Bool flag;
|
||||
unsigned int index;
|
||||
|
||||
if (property == NULL) return NULL;
|
||||
|
||||
// If we do not have a parent set that his a COMPOSITE_BOOLEAN, then we should just forward up the call
|
||||
// If we do not have a parent set that his a BOOLEAN, then we should just forward up the call
|
||||
if (!pd->parent)
|
||||
return efl_model_property_get(efl_super(obj, EFL_MODEL_COMPOSITE_BOOLEAN_CLASS), property);
|
||||
return efl_model_property_get(efl_super(obj, EFL_BOOLEAN_MODEL_CLASS), property);
|
||||
|
||||
// Check if this is requesting a defined boolean property
|
||||
// Property are defined and their value are stored on the parent COMPOSITE_BOOLEAN
|
||||
// Property are defined and their value are stored on the parent BOOLEAN
|
||||
s = eina_stringshare_add(property);
|
||||
v = eina_hash_find(pd->parent->values, s);
|
||||
eina_stringshare_del(s);
|
||||
|
||||
if (!v) // Not a property handle by this object, forward
|
||||
return efl_model_property_get(efl_super(obj, EFL_MODEL_COMPOSITE_BOOLEAN_CLASS), property);
|
||||
return efl_model_property_get(efl_super(obj, EFL_BOOLEAN_MODEL_CLASS), property);
|
||||
|
||||
index = efl_model_composite_index_get(obj);
|
||||
index = efl_composite_model_index_get(obj);
|
||||
|
||||
// As an optimization we do optimistically allocate the boolean array
|
||||
// Better would be to have a sparse boolean array
|
||||
|
@ -76,11 +76,11 @@ _efl_model_composite_boolean_efl_model_property_get(const Eo *obj,
|
|||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_model_composite_boolean_efl_model_property_set(Eo *obj,
|
||||
Efl_Model_Composite_Boolean_Data *pd,
|
||||
const char *property, Eina_Value *value)
|
||||
_efl_boolean_model_efl_model_property_set(Eo *obj,
|
||||
Efl_Boolean_Model_Data *pd,
|
||||
const char *property, Eina_Value *value)
|
||||
{
|
||||
Efl_Model_Composite_Boolean_Value *v;
|
||||
Efl_Boolean_Model_Value *v;
|
||||
Eina_Stringshare *s;
|
||||
Eina_Bool flag;
|
||||
unsigned int index;
|
||||
|
@ -89,25 +89,25 @@ _efl_model_composite_boolean_efl_model_property_set(Eo *obj,
|
|||
return efl_loop_future_rejected(obj,
|
||||
EFL_MODEL_ERROR_UNKNOWN);
|
||||
|
||||
// If we do not have a parent set that his a COMPOSITE_BOOLEAN, then we should just forward up the call
|
||||
// If we do not have a parent set that his a BOOLEAN, then we should just forward up the call
|
||||
if (!pd->parent)
|
||||
return efl_model_property_set(efl_super(obj, EFL_MODEL_COMPOSITE_BOOLEAN_CLASS),
|
||||
return efl_model_property_set(efl_super(obj, EFL_BOOLEAN_MODEL_CLASS),
|
||||
property, value);
|
||||
|
||||
// Check if this is requesting a defined boolean property
|
||||
// Property are defined and their value are stored on the parent COMPOSITE_BOOLEAN
|
||||
// Property are defined and their value are stored on the parent BOOLEAN
|
||||
s = eina_stringshare_add(property);
|
||||
v = eina_hash_find(pd->parent->values, s);
|
||||
eina_stringshare_del(s);
|
||||
|
||||
if (!v)
|
||||
return efl_model_property_set(efl_super(obj, EFL_MODEL_COMPOSITE_BOOLEAN_CLASS),
|
||||
return efl_model_property_set(efl_super(obj, EFL_BOOLEAN_MODEL_CLASS),
|
||||
property, value);
|
||||
|
||||
if (!eina_value_bool_convert(value, &flag))
|
||||
return efl_loop_future_rejected(obj, EFL_MODEL_ERROR_UNKNOWN);
|
||||
|
||||
index = efl_model_composite_index_get(obj);
|
||||
index = efl_composite_model_index_get(obj);
|
||||
|
||||
// We are optimistically allocating the boolean buffer now.
|
||||
// Aligning it on 64bits
|
||||
|
@ -139,7 +139,7 @@ _efl_model_composite_boolean_efl_model_property_set(Eo *obj,
|
|||
static void
|
||||
_boolean_value_free(void *data)
|
||||
{
|
||||
Efl_Model_Composite_Boolean_Value *value = data;
|
||||
Efl_Boolean_Model_Value *value = data;
|
||||
|
||||
eina_stringshare_del(value->property);
|
||||
value->property = NULL;
|
||||
|
@ -152,41 +152,41 @@ _boolean_value_free(void *data)
|
|||
}
|
||||
|
||||
static Eo *
|
||||
_efl_model_composite_boolean_efl_object_constructor(Eo *obj, Efl_Model_Composite_Boolean_Data *pd)
|
||||
_efl_boolean_model_efl_object_constructor(Eo *obj, Efl_Boolean_Model_Data *pd)
|
||||
{
|
||||
Eo *parent;
|
||||
obj = efl_constructor(efl_super(obj, EFL_MODEL_COMPOSITE_BOOLEAN_CLASS));
|
||||
obj = efl_constructor(efl_super(obj, EFL_BOOLEAN_MODEL_CLASS));
|
||||
|
||||
if (!obj) return NULL;
|
||||
|
||||
pd->values = eina_hash_stringshared_new(_boolean_value_free);
|
||||
// Only add a reference to the parent if it is actually a COMPOSITE_BOOLEAN_CLASS
|
||||
// Only add a reference to the parent if it is actually a BOOLEAN_MODEL_CLASS
|
||||
// The root typically doesn't have any boolean property, only its child do
|
||||
parent = efl_parent_get(obj);
|
||||
if (efl_isa(parent, EFL_MODEL_COMPOSITE_BOOLEAN_CLASS))
|
||||
pd->parent = efl_data_scope_get(parent, EFL_MODEL_COMPOSITE_BOOLEAN_CLASS);
|
||||
if (efl_isa(parent, EFL_BOOLEAN_MODEL_CLASS))
|
||||
pd->parent = efl_data_scope_get(parent, EFL_BOOLEAN_MODEL_CLASS);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_model_composite_boolean_efl_object_destructor(Eo *obj, Efl_Model_Composite_Boolean_Data *pd)
|
||||
_efl_boolean_model_efl_object_destructor(Eo *obj, Efl_Boolean_Model_Data *pd)
|
||||
{
|
||||
eina_hash_free(pd->values);
|
||||
|
||||
efl_destructor(efl_super(obj, EFL_MODEL_COMPOSITE_BOOLEAN_CLASS));
|
||||
efl_destructor(efl_super(obj, EFL_BOOLEAN_MODEL_CLASS));
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_model_composite_boolean_boolean_add(Eo *obj EINA_UNUSED,
|
||||
Efl_Model_Composite_Boolean_Data *pd,
|
||||
const char *name, Eina_Bool default_value)
|
||||
_efl_boolean_model_boolean_add(Eo *obj EINA_UNUSED,
|
||||
Efl_Boolean_Model_Data *pd,
|
||||
const char *name, Eina_Bool default_value)
|
||||
{
|
||||
Efl_Model_Composite_Boolean_Value *value;
|
||||
Efl_Boolean_Model_Value *value;
|
||||
|
||||
if (!name) return ;
|
||||
|
||||
value = calloc(1, sizeof (Efl_Model_Composite_Boolean_Value));
|
||||
value = calloc(1, sizeof (Efl_Boolean_Model_Value));
|
||||
if (!value) return ;
|
||||
|
||||
value->property = eina_stringshare_add(name);
|
||||
|
@ -196,9 +196,9 @@ _efl_model_composite_boolean_boolean_add(Eo *obj EINA_UNUSED,
|
|||
}
|
||||
|
||||
static void
|
||||
_efl_model_composite_boolean_boolean_del(Eo *obj EINA_UNUSED,
|
||||
Efl_Model_Composite_Boolean_Data *pd,
|
||||
const char *name)
|
||||
_efl_boolean_model_boolean_del(Eo *obj EINA_UNUSED,
|
||||
Efl_Boolean_Model_Data *pd,
|
||||
const char *name)
|
||||
{
|
||||
Eina_Stringshare *s;
|
||||
|
||||
|
@ -207,4 +207,4 @@ _efl_model_composite_boolean_boolean_del(Eo *obj EINA_UNUSED,
|
|||
eina_stringshare_del(s);
|
||||
}
|
||||
|
||||
#include "efl_model_composite_boolean.eo.c"
|
||||
#include "efl_boolean_model.eo.c"
|
|
@ -1,6 +1,6 @@
|
|||
class Efl.Model_Composite_Boolean extends Efl.Model_Composite
|
||||
class Efl.Boolean_Model extends Efl.Composite_Model
|
||||
{
|
||||
[[Efl model composite boolean class]]
|
||||
[[Efl boolean model class]]
|
||||
methods {
|
||||
boolean_add {
|
||||
[[Add a new named boolean property with a defined default value.]]
|
|
@ -8,13 +8,13 @@
|
|||
|
||||
#include "ecore_private.h"
|
||||
|
||||
#include "efl_model_composite.eo.h"
|
||||
#include "efl_composite_model.eo.h"
|
||||
|
||||
#define _CHILD_INDEX "child.index"
|
||||
|
||||
typedef struct _Efl_Model_Composite_Data Efl_Model_Composite_Data;
|
||||
typedef struct _Efl_Composite_Model_Data Efl_Composite_Model_Data;
|
||||
|
||||
struct _Efl_Model_Composite_Data
|
||||
struct _Efl_Composite_Model_Data
|
||||
{
|
||||
Efl_Model *source;
|
||||
|
||||
|
@ -25,7 +25,7 @@ struct _Efl_Model_Composite_Data
|
|||
};
|
||||
|
||||
static void
|
||||
_efl_model_composite_efl_object_destructor(Eo *obj, Efl_Model_Composite_Data *pd)
|
||||
_efl_composite_model_efl_object_destructor(Eo *obj, Efl_Composite_Model_Data *pd)
|
||||
{
|
||||
if (pd->source)
|
||||
{
|
||||
|
@ -38,11 +38,11 @@ _efl_model_composite_efl_object_destructor(Eo *obj, Efl_Model_Composite_Data *pd
|
|||
pd->source = NULL;
|
||||
}
|
||||
|
||||
efl_destructor(efl_super(obj, EFL_MODEL_COMPOSITE_CLASS));
|
||||
efl_destructor(efl_super(obj, EFL_COMPOSITE_MODEL_CLASS));
|
||||
}
|
||||
|
||||
static Efl_Object *
|
||||
_efl_model_composite_efl_object_finalize(Eo *obj, Efl_Model_Composite_Data *pd)
|
||||
_efl_composite_model_efl_object_finalize(Eo *obj, Efl_Composite_Model_Data *pd)
|
||||
{
|
||||
if (pd->source == NULL)
|
||||
{
|
||||
|
@ -54,7 +54,7 @@ _efl_model_composite_efl_object_finalize(Eo *obj, Efl_Model_Composite_Data *pd)
|
|||
}
|
||||
|
||||
static void
|
||||
_efl_model_composite_index_set(Eo *obj EINA_UNUSED, Efl_Model_Composite_Data *pd, unsigned int index)
|
||||
_efl_composite_model_index_set(Eo *obj EINA_UNUSED, Efl_Composite_Model_Data *pd, unsigned int index)
|
||||
{
|
||||
if (pd->set_index || !pd->source)
|
||||
return ;
|
||||
|
@ -63,7 +63,7 @@ _efl_model_composite_index_set(Eo *obj EINA_UNUSED, Efl_Model_Composite_Data *pd
|
|||
}
|
||||
|
||||
static unsigned int
|
||||
_efl_model_composite_index_get(const Eo *obj, Efl_Model_Composite_Data *pd)
|
||||
_efl_composite_model_index_get(const Eo *obj, Efl_Composite_Model_Data *pd)
|
||||
{
|
||||
Eina_Value *fetch = NULL;
|
||||
unsigned int r = 0xFFFFFFFF;
|
||||
|
@ -82,7 +82,7 @@ _efl_model_composite_index_get(const Eo *obj, Efl_Model_Composite_Data *pd)
|
|||
}
|
||||
|
||||
static void
|
||||
_efl_model_composite_efl_ui_view_model_set(Eo *obj EINA_UNUSED, Efl_Model_Composite_Data *pd, Efl_Model *model)
|
||||
_efl_composite_model_efl_ui_view_model_set(Eo *obj EINA_UNUSED, Efl_Composite_Model_Data *pd, Efl_Model *model)
|
||||
{
|
||||
Eina_Iterator *properties;
|
||||
const char *property;
|
||||
|
@ -114,13 +114,13 @@ _efl_model_composite_efl_ui_view_model_set(Eo *obj EINA_UNUSED, Efl_Model_Compos
|
|||
}
|
||||
|
||||
static Efl_Model *
|
||||
_efl_model_composite_efl_ui_view_model_get(const Eo *obj EINA_UNUSED, Efl_Model_Composite_Data *pd)
|
||||
_efl_composite_model_efl_ui_view_model_get(const Eo *obj EINA_UNUSED, Efl_Composite_Model_Data *pd)
|
||||
{
|
||||
return pd->source;
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_model_composite_efl_model_property_set(Eo *obj, Efl_Model_Composite_Data *pd,
|
||||
_efl_composite_model_efl_model_property_set(Eo *obj, Efl_Composite_Model_Data *pd,
|
||||
const char *property, Eina_Value *value)
|
||||
{
|
||||
if (pd->need_index && !strcmp(property, _CHILD_INDEX))
|
||||
|
@ -136,7 +136,7 @@ _efl_model_composite_efl_model_property_set(Eo *obj, Efl_Model_Composite_Data *p
|
|||
}
|
||||
|
||||
static Eina_Value *
|
||||
_efl_model_composite_efl_model_property_get(const Eo *obj EINA_UNUSED, Efl_Model_Composite_Data *pd,
|
||||
_efl_composite_model_efl_model_property_get(const Eo *obj EINA_UNUSED, Efl_Composite_Model_Data *pd,
|
||||
const char *property)
|
||||
{
|
||||
if (pd->need_index && !strcmp(property, _CHILD_INDEX))
|
||||
|
@ -149,7 +149,7 @@ _efl_model_composite_efl_model_property_get(const Eo *obj EINA_UNUSED, Efl_Model
|
|||
}
|
||||
|
||||
static Eina_Iterator *
|
||||
_efl_model_composite_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Model_Composite_Data *pd)
|
||||
_efl_composite_model_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Composite_Model_Data *pd)
|
||||
{
|
||||
if (pd->need_index)
|
||||
{
|
||||
|
@ -164,13 +164,13 @@ _efl_model_composite_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Mod
|
|||
}
|
||||
|
||||
static unsigned int
|
||||
_efl_model_composite_efl_model_children_count_get(const Eo *obj EINA_UNUSED, Efl_Model_Composite_Data *pd)
|
||||
_efl_composite_model_efl_model_children_count_get(const Eo *obj EINA_UNUSED, Efl_Composite_Model_Data *pd)
|
||||
{
|
||||
return efl_model_children_count_get(pd->source);
|
||||
}
|
||||
|
||||
typedef struct _Efl_Model_Composite_Slice_Request Efl_Model_Composite_Slice_Request;
|
||||
struct _Efl_Model_Composite_Slice_Request
|
||||
typedef struct _Efl_Composite_Model_Slice_Request Efl_Composite_Model_Slice_Request;
|
||||
struct _Efl_Composite_Model_Slice_Request
|
||||
{
|
||||
const Efl_Class *self;
|
||||
Eo *parent;
|
||||
|
@ -178,9 +178,9 @@ struct _Efl_Model_Composite_Slice_Request
|
|||
};
|
||||
|
||||
static Eina_Value
|
||||
_efl_model_composite_then(Eo *o EINA_UNUSED, void *data, const Eina_Value v)
|
||||
_efl_composite_model_then(Eo *o EINA_UNUSED, void *data, const Eina_Value v)
|
||||
{
|
||||
Efl_Model_Composite_Slice_Request *req = data;
|
||||
Efl_Composite_Model_Slice_Request *req = data;
|
||||
unsigned int i, len;
|
||||
Eina_Value r = EINA_VALUE_EMPTY;
|
||||
Eo *target = NULL;
|
||||
|
@ -195,7 +195,7 @@ _efl_model_composite_then(Eo *o EINA_UNUSED, void *data, const Eina_Value v)
|
|||
// can know if it needs to retain the information regarding its index.
|
||||
composite = efl_add(req->self, req->parent,
|
||||
efl_ui_view_model_set(efl_added, target),
|
||||
efl_model_composite_index_set(efl_added, req->start + i));
|
||||
efl_composite_model_index_set(efl_added, req->start + i));
|
||||
|
||||
eina_value_array_append(&r, composite);
|
||||
}
|
||||
|
@ -204,27 +204,27 @@ _efl_model_composite_then(Eo *o EINA_UNUSED, void *data, const Eina_Value v)
|
|||
}
|
||||
|
||||
static void
|
||||
_efl_model_composite_clean(Eo *o EINA_UNUSED, void *data, const Eina_Future *dead_future EINA_UNUSED)
|
||||
_efl_composite_model_clean(Eo *o EINA_UNUSED, void *data, const Eina_Future *dead_future EINA_UNUSED)
|
||||
{
|
||||
Efl_Model_Composite_Slice_Request *req = data;
|
||||
Efl_Composite_Model_Slice_Request *req = data;
|
||||
|
||||
efl_unref(req->parent);
|
||||
free(data);
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_model_composite_efl_model_children_slice_get(Eo *obj,
|
||||
Efl_Model_Composite_Data *pd,
|
||||
_efl_composite_model_efl_model_children_slice_get(Eo *obj,
|
||||
Efl_Composite_Model_Data *pd,
|
||||
unsigned int start,
|
||||
unsigned int count)
|
||||
{
|
||||
Efl_Model_Composite_Slice_Request *req;
|
||||
Efl_Composite_Model_Slice_Request *req;
|
||||
Eina_Future *f;
|
||||
|
||||
f = efl_model_children_slice_get(pd->source, start, count);
|
||||
if (!f) return NULL;
|
||||
|
||||
req = malloc(sizeof (Efl_Model_Composite_Slice_Request));
|
||||
req = malloc(sizeof (Efl_Composite_Model_Slice_Request));
|
||||
if (!req) return efl_loop_future_rejected(obj, ENOMEM);
|
||||
|
||||
req->self = efl_class_get(obj);
|
||||
|
@ -232,24 +232,24 @@ _efl_model_composite_efl_model_children_slice_get(Eo *obj,
|
|||
req->start = start;
|
||||
|
||||
return efl_future_then(obj, f, .success_type = EINA_VALUE_TYPE_ARRAY,
|
||||
.success = _efl_model_composite_then,
|
||||
.free = _efl_model_composite_clean,
|
||||
.success = _efl_composite_model_then,
|
||||
.free = _efl_composite_model_clean,
|
||||
.data = req);
|
||||
}
|
||||
|
||||
static Efl_Object *
|
||||
_efl_model_composite_efl_model_child_add(Eo *obj EINA_UNUSED,
|
||||
Efl_Model_Composite_Data *pd)
|
||||
_efl_composite_model_efl_model_child_add(Eo *obj EINA_UNUSED,
|
||||
Efl_Composite_Model_Data *pd)
|
||||
{
|
||||
return efl_model_child_add(pd->source);
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_model_composite_efl_model_child_del(Eo *obj EINA_UNUSED,
|
||||
Efl_Model_Composite_Data *pd,
|
||||
_efl_composite_model_efl_model_child_del(Eo *obj EINA_UNUSED,
|
||||
Efl_Composite_Model_Data *pd,
|
||||
Efl_Object *child)
|
||||
{
|
||||
efl_model_child_del(pd->source, child);
|
||||
}
|
||||
|
||||
#include "efl_model_composite.eo.c"
|
||||
#include "efl_composite_model.eo.c"
|
|
@ -1,4 +1,4 @@
|
|||
class Efl.Model_Composite extends Efl.Model_Loop implements Efl.Ui.View
|
||||
class Efl.Composite_Model extends Efl.Loop_Model implements Efl.Ui.View
|
||||
{
|
||||
[[Efl model for all composite class which provide a unified API to set source of data.
|
||||
|
|
@ -1,15 +1,15 @@
|
|||
|
||||
#define EFL_MODEL_COMPOSITE_PROPERTIES(name, dyn, sta, ...) \
|
||||
EFL_MODEL_COMPOSITE_PROPERTIES_SUPER(name, NULL, NULL, (dyn), sta, ##__VA_ARGS__)
|
||||
#define EFL_COMPOSITE_MODEL_PROPERTIES(name, dyn, sta, ...) \
|
||||
EFL_COMPOSITE_MODEL_PROPERTIES_SUPER(name, NULL, NULL, (dyn), sta, ##__VA_ARGS__)
|
||||
|
||||
#define EFL_MODEL_COMPOSITE_PROPERTIES_SUPER(name, obj, klass, dyn, ...) \
|
||||
#define EFL_COMPOSITE_MODEL_PROPERTIES_SUPER(name, obj, klass, dyn, ...) \
|
||||
Eina_Iterator *name; \
|
||||
do \
|
||||
{ \
|
||||
static const char *static_props__[] = { \
|
||||
__VA_ARGS__ \
|
||||
}; \
|
||||
name = _efl_model_composite_properties_mix( \
|
||||
name = _efl_composite_model_properties_mix( \
|
||||
((obj) ? efl_model_properties_get(efl_super((obj), (klass))) : NULL), \
|
||||
(dyn), \
|
||||
EINA_C_ARRAY_ITERATOR_NEW(static_props__)); \
|
||||
|
@ -18,7 +18,7 @@
|
|||
|
||||
|
||||
static inline Eina_Iterator *
|
||||
_efl_model_composite_properties_mix(Eina_Iterator *super, Eina_Iterator *dyn, Eina_Iterator *sta)
|
||||
_efl_composite_model_properties_mix(Eina_Iterator *super, Eina_Iterator *dyn, Eina_Iterator *sta)
|
||||
{
|
||||
Eina_Iterator *its[3];
|
||||
int i = 0;
|
|
@ -9,9 +9,9 @@
|
|||
|
||||
#include "ecore_internal.h"
|
||||
|
||||
#include "efl_model_container_private.h"
|
||||
#include "efl_container_model_private.h"
|
||||
|
||||
#define MY_CLASS EFL_MODEL_CONTAINER_CLASS
|
||||
#define MY_CLASS EFL_CONTAINER_MODEL_CLASS
|
||||
|
||||
void *
|
||||
_value_copy_alloc(void *v, const Eina_Value_Type *type)
|
||||
|
@ -65,8 +65,8 @@ _property_data_free_cb(void *data)
|
|||
}
|
||||
|
||||
static Efl_Object *
|
||||
_efl_model_container_efl_object_constructor(Eo *obj,
|
||||
Efl_Model_Container_Data *sd)
|
||||
_efl_container_model_efl_object_constructor(Eo *obj,
|
||||
Efl_Container_Model_Data *sd)
|
||||
{
|
||||
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
||||
if (!obj)
|
||||
|
@ -79,8 +79,8 @@ _efl_model_container_efl_object_constructor(Eo *obj,
|
|||
}
|
||||
|
||||
static void
|
||||
_efl_model_container_efl_object_destructor(Eo *obj,
|
||||
Efl_Model_Container_Data *sd)
|
||||
_efl_container_model_efl_object_destructor(Eo *obj,
|
||||
Efl_Container_Model_Data *sd)
|
||||
{
|
||||
Eina_Stringshare *key;
|
||||
Eina_Iterator *it;
|
||||
|
@ -98,8 +98,8 @@ _efl_model_container_efl_object_destructor(Eo *obj,
|
|||
}
|
||||
|
||||
static const Eina_Value_Type *
|
||||
_efl_model_container_child_property_value_type_get(Eo *obj EINA_UNUSED,
|
||||
Efl_Model_Container_Data *sd,
|
||||
_efl_container_model_child_property_value_type_get(Eo *obj EINA_UNUSED,
|
||||
Efl_Container_Model_Data *sd,
|
||||
const char *property)
|
||||
{
|
||||
Child_Property_Data *cpd;
|
||||
|
@ -114,8 +114,8 @@ _efl_model_container_child_property_value_type_get(Eo *obj EINA_UNUSED,
|
|||
}
|
||||
|
||||
static Eina_Iterator *
|
||||
_efl_model_container_child_property_values_get(Eo *obj EINA_UNUSED,
|
||||
Efl_Model_Container_Data *sd,
|
||||
_efl_container_model_child_property_values_get(Eo *obj EINA_UNUSED,
|
||||
Efl_Container_Model_Data *sd,
|
||||
const char *property)
|
||||
{
|
||||
Child_Property_Data *cpd;
|
||||
|
@ -130,8 +130,8 @@ _efl_model_container_child_property_values_get(Eo *obj EINA_UNUSED,
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_efl_model_container_child_property_add(Eo *obj,
|
||||
Efl_Model_Container_Data *sd,
|
||||
_efl_container_model_child_property_add(Eo *obj,
|
||||
Efl_Container_Model_Data *sd,
|
||||
const char *name,
|
||||
const Eina_Value_Type *type,
|
||||
Eina_Iterator *values)
|
||||
|
@ -198,8 +198,8 @@ _efl_model_container_child_property_add(Eo *obj,
|
|||
Efl_Model_Children_Event cevt = { 0 };
|
||||
Efl_Model *child;
|
||||
|
||||
child = efl_add(EFL_MODEL_CONTAINER_ITEM_CLASS, obj,
|
||||
efl_model_container_item_define(efl_added, sd, i));
|
||||
child = efl_add(EFL_CONTAINER_MODEL_ITEM_CLASS, obj,
|
||||
efl_container_model_item_define(efl_added, sd, i));
|
||||
sd->childrens = eina_list_append(sd->childrens, child);
|
||||
|
||||
cevt.index = i;
|
||||
|
@ -222,14 +222,14 @@ _efl_model_container_child_property_add(Eo *obj,
|
|||
}
|
||||
|
||||
static Eina_Iterator *
|
||||
_efl_model_container_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Model_Container_Data *sd)
|
||||
_efl_container_model_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Container_Model_Data *sd)
|
||||
{
|
||||
return eina_hash_iterator_key_new(sd->properties);
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_model_container_efl_model_property_set(Eo *obj,
|
||||
Efl_Model_Container_Data *pd EINA_UNUSED,
|
||||
_efl_container_model_efl_model_property_set(Eo *obj,
|
||||
Efl_Container_Model_Data *pd EINA_UNUSED,
|
||||
const char *property EINA_UNUSED,
|
||||
Eina_Value *value EINA_UNUSED)
|
||||
{
|
||||
|
@ -238,16 +238,16 @@ _efl_model_container_efl_model_property_set(Eo *obj,
|
|||
}
|
||||
|
||||
static Eina_Value *
|
||||
_efl_model_container_efl_model_property_get(const Eo *obj EINA_UNUSED,
|
||||
Efl_Model_Container_Data *pd EINA_UNUSED,
|
||||
_efl_container_model_efl_model_property_get(const Eo *obj EINA_UNUSED,
|
||||
Efl_Container_Model_Data *pd EINA_UNUSED,
|
||||
const char *property EINA_UNUSED)
|
||||
{
|
||||
return eina_value_error_new(EFL_MODEL_ERROR_NOT_FOUND);
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_model_container_efl_model_children_slice_get(Eo *obj,
|
||||
Efl_Model_Container_Data *sd,
|
||||
_efl_container_model_efl_model_children_slice_get(Eo *obj,
|
||||
Efl_Container_Model_Data *sd,
|
||||
unsigned int start,
|
||||
unsigned int count)
|
||||
{
|
||||
|
@ -258,13 +258,13 @@ _efl_model_container_efl_model_children_slice_get(Eo *obj,
|
|||
}
|
||||
|
||||
static unsigned int
|
||||
_efl_model_container_efl_model_children_count_get(const Eo *obj EINA_UNUSED, Efl_Model_Container_Data *sd)
|
||||
_efl_container_model_efl_model_children_count_get(const Eo *obj EINA_UNUSED, Efl_Container_Model_Data *sd)
|
||||
{
|
||||
return eina_list_count(sd->childrens);
|
||||
}
|
||||
|
||||
static Eo *
|
||||
_efl_model_container_efl_model_child_add(Eo *obj EINA_UNUSED, Efl_Model_Container_Data *sd EINA_UNUSED)
|
||||
_efl_container_model_efl_model_child_add(Eo *obj EINA_UNUSED, Efl_Container_Model_Data *sd EINA_UNUSED)
|
||||
{
|
||||
EINA_LOG_WARN("child_add not supported by Efl.Model.Container");
|
||||
eina_error_set(EFL_MODEL_ERROR_NOT_SUPPORTED);
|
||||
|
@ -273,10 +273,10 @@ _efl_model_container_efl_model_child_add(Eo *obj EINA_UNUSED, Efl_Model_Containe
|
|||
}
|
||||
|
||||
static void
|
||||
_efl_model_container_efl_model_child_del(Eo *obj EINA_UNUSED, Efl_Model_Container_Data *sd EINA_UNUSED, Eo *child EINA_UNUSED)
|
||||
_efl_container_model_efl_model_child_del(Eo *obj EINA_UNUSED, Efl_Container_Model_Data *sd EINA_UNUSED, Eo *child EINA_UNUSED)
|
||||
{
|
||||
EINA_LOG_WARN("child_del not supported by Efl.Model.Container");
|
||||
eina_error_set(EFL_MODEL_ERROR_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
#include "efl_model_container.eo.c"
|
||||
#include "efl_container_model.eo.c"
|
|
@ -1,12 +1,12 @@
|
|||
import eina_types;
|
||||
|
||||
class Efl.Model_Container extends Efl.Model_Loop
|
||||
class Efl.Container_Model extends Efl.Loop_Model
|
||||
{
|
||||
[[
|
||||
Class used to create data models from Eina containers.
|
||||
|
||||
Each container supplied represents a series of property values, each item
|
||||
being the property value for a child object (@Efl.Model_Container_Item).
|
||||
being the property value for a child object (@Efl.Container_Model_Item).
|
||||
|
||||
The data in the given containers are copied and stored internally.
|
||||
|
|
@ -5,19 +5,19 @@
|
|||
#include <Efl.h>
|
||||
#include <Ecore.h>
|
||||
|
||||
#include "efl_model_container_private.h"
|
||||
#include "efl_container_model_private.h"
|
||||
|
||||
#define MY_CLASS EFL_MODEL_CONTAINER_ITEM_CLASS
|
||||
#define MY_CLASS EFL_CONTAINER_MODEL_ITEM_CLASS
|
||||
|
||||
static void
|
||||
_efl_model_container_item_define(Eo *obj EINA_UNUSED, Efl_Model_Container_Item_Data *sd, void *parent_data, unsigned int index)
|
||||
_efl_container_model_item_define(Eo *obj EINA_UNUSED, Efl_Container_Model_Item_Data *sd, void *parent_data, unsigned int index)
|
||||
{
|
||||
sd->parent_data = parent_data;
|
||||
sd->index = index;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_model_container_item_efl_object_invalidate(Eo *obj, Efl_Model_Container_Item_Data *sd)
|
||||
_efl_container_model_item_efl_object_invalidate(Eo *obj, Efl_Container_Model_Item_Data *sd)
|
||||
{
|
||||
efl_invalidate(efl_super(obj, MY_CLASS));
|
||||
|
||||
|
@ -26,14 +26,14 @@ _efl_model_container_item_efl_object_invalidate(Eo *obj, Efl_Model_Container_Ite
|
|||
}
|
||||
|
||||
static Eina_Iterator *
|
||||
_efl_model_container_item_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Model_Container_Item_Data *sd)
|
||||
_efl_container_model_item_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Container_Model_Item_Data *sd)
|
||||
{
|
||||
// FIXME: Not to sure here, shouldn't we extend a child of the parent actually ?
|
||||
return efl_model_properties_get(sd->parent_data->obj);
|
||||
}
|
||||
|
||||
static Efl_Object *
|
||||
_efl_model_container_item_efl_object_finalize(Eo *obj, Efl_Model_Container_Item_Data *pd)
|
||||
_efl_container_model_item_efl_object_finalize(Eo *obj, Efl_Container_Model_Item_Data *pd)
|
||||
{
|
||||
if (!pd->parent_data)
|
||||
return NULL;
|
||||
|
@ -42,8 +42,8 @@ _efl_model_container_item_efl_object_finalize(Eo *obj, Efl_Model_Container_Item_
|
|||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_model_container_item_efl_model_property_set(Eo *obj,
|
||||
Efl_Model_Container_Item_Data *sd,
|
||||
_efl_container_model_item_efl_model_property_set(Eo *obj,
|
||||
Efl_Container_Model_Item_Data *sd,
|
||||
const char *property, Eina_Value *value)
|
||||
{
|
||||
Eina_Stringshare *name;
|
||||
|
@ -91,8 +91,8 @@ _efl_model_container_item_efl_model_property_set(Eo *obj,
|
|||
}
|
||||
|
||||
static Eina_Value *
|
||||
_efl_model_container_item_efl_model_property_get(const Eo *obj EINA_UNUSED,
|
||||
Efl_Model_Container_Item_Data *sd,
|
||||
_efl_container_model_item_efl_model_property_get(const Eo *obj EINA_UNUSED,
|
||||
Efl_Container_Model_Item_Data *sd,
|
||||
const char *property)
|
||||
{
|
||||
Eina_Stringshare *name;
|
||||
|
@ -127,8 +127,8 @@ _efl_model_container_item_efl_model_property_get(const Eo *obj EINA_UNUSED,
|
|||
}
|
||||
|
||||
EOLIAN static Eina_Future *
|
||||
_efl_model_container_item_efl_model_children_slice_get(Eo *obj,
|
||||
Efl_Model_Container_Item_Data *sd EINA_UNUSED,
|
||||
_efl_container_model_item_efl_model_children_slice_get(Eo *obj,
|
||||
Efl_Container_Model_Item_Data *sd EINA_UNUSED,
|
||||
unsigned int start EINA_UNUSED,
|
||||
unsigned int count EINA_UNUSED)
|
||||
{
|
||||
|
@ -136,15 +136,15 @@ _efl_model_container_item_efl_model_children_slice_get(Eo *obj,
|
|||
}
|
||||
|
||||
EOLIAN static unsigned int
|
||||
_efl_model_container_item_efl_model_children_count_get(const Eo *obj EINA_UNUSED,
|
||||
Efl_Model_Container_Item_Data *sd EINA_UNUSED)
|
||||
_efl_container_model_item_efl_model_children_count_get(const Eo *obj EINA_UNUSED,
|
||||
Efl_Container_Model_Item_Data *sd EINA_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
EOLIAN static Eo *
|
||||
_efl_model_container_item_efl_model_child_add(Eo *obj EINA_UNUSED,
|
||||
Efl_Model_Container_Item_Data *sd EINA_UNUSED)
|
||||
_efl_container_model_item_efl_model_child_add(Eo *obj EINA_UNUSED,
|
||||
Efl_Container_Model_Item_Data *sd EINA_UNUSED)
|
||||
{
|
||||
EINA_LOG_WARN("child_add not supported by Efl.Model.Container.Item");
|
||||
eina_error_set(EFL_MODEL_ERROR_NOT_SUPPORTED);
|
||||
|
@ -153,12 +153,12 @@ _efl_model_container_item_efl_model_child_add(Eo *obj EINA_UNUSED,
|
|||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_model_container_item_efl_model_child_del(Eo *obj EINA_UNUSED,
|
||||
Efl_Model_Container_Item_Data *sd EINA_UNUSED,
|
||||
_efl_container_model_item_efl_model_child_del(Eo *obj EINA_UNUSED,
|
||||
Efl_Container_Model_Item_Data *sd EINA_UNUSED,
|
||||
Eo *child EINA_UNUSED)
|
||||
{
|
||||
EINA_LOG_WARN("child_del not supported by Efl.Model.Container.Item");
|
||||
eina_error_set(EFL_MODEL_ERROR_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
#include "efl_model_container_item.eo.c"
|
||||
#include "efl_container_model_item.eo.c"
|
|
@ -1,19 +1,19 @@
|
|||
class Efl.Model_Container_Item extends Efl.Object implements Efl.Model
|
||||
class Efl.Container_Model_Item extends Efl.Object implements Efl.Model
|
||||
{
|
||||
[[
|
||||
Used as a child of @Efl.Model_Container.
|
||||
Used as a child of @Efl.Container_Model.
|
||||
|
||||
Provides the @Efl.Model API for elements of @Efl.Model_Container.
|
||||
Provides the @Efl.Model API for elements of @Efl.Container_Model.
|
||||
Should not be used in another context, so do not manually create objects
|
||||
of this class.
|
||||
]]
|
||||
methods {
|
||||
define {
|
||||
[[Defines @Efl.Model_Container_Item internal data.]]
|
||||
[[Defines @Efl.Container_Model_Item internal data.]]
|
||||
params {
|
||||
parent_data: void_ptr; [[Pointer to the private data of the
|
||||
@Efl.Model_Container parent object.]]
|
||||
index: uint; [[Index of this item within the @Efl.Model_Container
|
||||
@Efl.Container_Model parent object.]]
|
||||
index: uint; [[Index of this item within the @Efl.Container_Model
|
||||
children.]]
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef EFL_MODEL_CONTAINER_PRIVATE_H__
|
||||
#define EFL_MODEL_CONTAINER_PRIVATE_H__
|
||||
#ifndef EFL_CONTAINER_MODEL_PRIVATE_H__
|
||||
#define EFL_CONTAINER_MODEL_PRIVATE_H__
|
||||
|
||||
typedef struct _Child_Property_Data Child_Property_Data;
|
||||
struct _Child_Property_Data
|
||||
|
@ -8,8 +8,8 @@ struct _Child_Property_Data
|
|||
Eina_Array *values;
|
||||
};
|
||||
|
||||
typedef struct _Efl_Model_Container_Data Efl_Model_Container_Data;
|
||||
struct _Efl_Model_Container_Data
|
||||
typedef struct _Efl_Container_Model_Data Efl_Container_Model_Data;
|
||||
struct _Efl_Container_Model_Data
|
||||
{
|
||||
Eo *obj;
|
||||
|
||||
|
@ -19,10 +19,10 @@ struct _Efl_Model_Container_Data
|
|||
};
|
||||
|
||||
|
||||
typedef struct _Efl_Model_Container_Item_Data Efl_Model_Container_Item_Data;
|
||||
struct _Efl_Model_Container_Item_Data
|
||||
typedef struct _Efl_Container_Model_Item_Data Efl_Container_Model_Item_Data;
|
||||
struct _Efl_Container_Model_Item_Data
|
||||
{
|
||||
Efl_Model_Container_Data *parent_data;
|
||||
Efl_Container_Model_Data *parent_data;
|
||||
unsigned int index;
|
||||
};
|
||||
|
|
@ -7,10 +7,10 @@
|
|||
|
||||
#include "ecore_internal.h"
|
||||
|
||||
#define MY_CLASS EFL_MODEL_ITEM_CLASS
|
||||
#define MY_CLASS EFL_GENERIC_MODEL_CLASS
|
||||
|
||||
typedef struct _Efl_Model_Item_Data Efl_Model_Item_Data;
|
||||
struct _Efl_Model_Item_Data
|
||||
typedef struct _Efl_Generic_Model_Data Efl_Generic_Model_Data;
|
||||
struct _Efl_Generic_Model_Data
|
||||
{
|
||||
Eina_Hash *properties;
|
||||
Eina_List *childrens;
|
||||
|
@ -30,7 +30,7 @@ _stringshared_keys_free(const Eina_Hash *hash EINA_UNUSED, const void *key, void
|
|||
}
|
||||
|
||||
static Efl_Object *
|
||||
_efl_model_item_efl_object_constructor(Eo *obj, Efl_Model_Item_Data *sd)
|
||||
_efl_generic_model_efl_object_constructor(Eo *obj, Efl_Generic_Model_Data *sd)
|
||||
{
|
||||
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
||||
if (!obj)
|
||||
|
@ -42,7 +42,7 @@ _efl_model_item_efl_object_constructor(Eo *obj, Efl_Model_Item_Data *sd)
|
|||
}
|
||||
|
||||
static void
|
||||
_efl_model_item_efl_object_destructor(Eo *obj, Efl_Model_Item_Data *sd)
|
||||
_efl_generic_model_efl_object_destructor(Eo *obj, Efl_Generic_Model_Data *sd)
|
||||
{
|
||||
eina_list_free(sd->childrens);
|
||||
eina_hash_foreach(sd->properties, _stringshared_keys_free, NULL);
|
||||
|
@ -52,13 +52,13 @@ _efl_model_item_efl_object_destructor(Eo *obj, Efl_Model_Item_Data *sd)
|
|||
}
|
||||
|
||||
static Eina_Iterator *
|
||||
_efl_model_item_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Model_Item_Data *pd)
|
||||
_efl_generic_model_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Generic_Model_Data *pd)
|
||||
{
|
||||
return eina_hash_iterator_key_new(pd->properties);
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_model_item_efl_model_property_set(Eo *obj, Efl_Model_Item_Data *pd, const char *property, Eina_Value *value)
|
||||
_efl_generic_model_efl_model_property_set(Eo *obj, Efl_Generic_Model_Data *pd, const char *property, Eina_Value *value)
|
||||
{
|
||||
Eina_Stringshare *prop;
|
||||
Eina_Value *exist;
|
||||
|
@ -110,9 +110,9 @@ _efl_model_item_efl_model_property_set(Eo *obj, Efl_Model_Item_Data *pd, const c
|
|||
}
|
||||
|
||||
static Eina_Value *
|
||||
_efl_model_item_efl_model_property_get(const Eo *obj EINA_UNUSED,
|
||||
Efl_Model_Item_Data *pd,
|
||||
const char *property)
|
||||
_efl_generic_model_efl_model_property_get(const Eo *obj EINA_UNUSED,
|
||||
Efl_Generic_Model_Data *pd,
|
||||
const char *property)
|
||||
{
|
||||
Eina_Stringshare *prop;
|
||||
Eina_Value *value;
|
||||
|
@ -128,7 +128,7 @@ _efl_model_item_efl_model_property_get(const Eo *obj EINA_UNUSED,
|
|||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_model_item_efl_model_children_slice_get(Eo *obj, Efl_Model_Item_Data *pd, unsigned int start, unsigned int count)
|
||||
_efl_generic_model_efl_model_children_slice_get(Eo *obj, Efl_Generic_Model_Data *pd, unsigned int start, unsigned int count)
|
||||
{
|
||||
Eina_Value v;
|
||||
|
||||
|
@ -137,21 +137,21 @@ _efl_model_item_efl_model_children_slice_get(Eo *obj, Efl_Model_Item_Data *pd, u
|
|||
}
|
||||
|
||||
static unsigned int
|
||||
_efl_model_item_efl_model_children_count_get(const Eo *obj EINA_UNUSED, Efl_Model_Item_Data *pd)
|
||||
_efl_generic_model_efl_model_children_count_get(const Eo *obj EINA_UNUSED, Efl_Generic_Model_Data *pd)
|
||||
{
|
||||
return eina_list_count(pd->childrens);
|
||||
}
|
||||
|
||||
static Eo *
|
||||
_efl_model_item_efl_model_child_add(Eo *obj, Efl_Model_Item_Data *sd)
|
||||
_efl_generic_model_efl_model_child_add(Eo *obj, Efl_Generic_Model_Data *sd)
|
||||
{
|
||||
Efl_Model_Children_Event cevt;
|
||||
Efl_Model *child;
|
||||
|
||||
child = efl_add(EFL_MODEL_ITEM_CLASS, obj);
|
||||
child = efl_add(EFL_GENERIC_MODEL_CLASS, obj);
|
||||
if (!child)
|
||||
{
|
||||
EINA_LOG_ERR("Could not allocate Efl.Model.Item");
|
||||
EINA_LOG_ERR("Could not allocate Efl.Generic_Model");
|
||||
eina_error_set(EFL_MODEL_ERROR_UNKNOWN);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ _efl_model_item_efl_model_child_add(Eo *obj, Efl_Model_Item_Data *sd)
|
|||
}
|
||||
|
||||
static void
|
||||
_efl_model_item_efl_model_child_del(Eo *obj, Efl_Model_Item_Data *sd, Eo *child)
|
||||
_efl_generic_model_efl_model_child_del(Eo *obj, Efl_Generic_Model_Data *sd, Eo *child)
|
||||
{
|
||||
Efl_Model *data;
|
||||
Eina_List *l;
|
||||
|
@ -194,4 +194,4 @@ _efl_model_item_efl_model_child_del(Eo *obj, Efl_Model_Item_Data *sd, Eo *child)
|
|||
}
|
||||
}
|
||||
|
||||
#include "efl_model_item.eo.c"
|
||||
#include "efl_generic_model.eo.c"
|
|
@ -1,4 +1,4 @@
|
|||
class Efl.Model_Item extends Efl.Model_Loop
|
||||
class Efl.Generic_Model extends Efl.Loop_Model
|
||||
{
|
||||
[[
|
||||
Generic model that allows any property to be manually set.
|
|
@ -7,11 +7,11 @@
|
|||
#include <Ecore.h>
|
||||
#include "Eo.h"
|
||||
|
||||
#include "efl_model_loop.eo.h"
|
||||
#include "efl_loop_model.eo.h"
|
||||
|
||||
typedef struct _Efl_Model_Loop_Watcher_Data Efl_Model_Loop_Watcher_Data;
|
||||
typedef struct _Efl_Loop_Model_Watcher_Data Efl_Loop_Model_Watcher_Data;
|
||||
|
||||
struct _Efl_Model_Loop_Watcher_Data
|
||||
struct _Efl_Loop_Model_Watcher_Data
|
||||
{
|
||||
const char *property;
|
||||
Eina_Promise *p;
|
||||
|
@ -21,7 +21,7 @@ struct _Efl_Model_Loop_Watcher_Data
|
|||
static void _propagate_future(void *data, const Efl_Event *event);
|
||||
|
||||
static void
|
||||
_efl_model_loop_wathcer_free(Efl_Model_Loop_Watcher_Data *wd)
|
||||
_efl_loop_model_wathcer_free(Efl_Loop_Model_Watcher_Data *wd)
|
||||
{
|
||||
efl_event_callback_del(wd->obj, EFL_MODEL_EVENT_PROPERTIES_CHANGED,
|
||||
_propagate_future, wd);
|
||||
|
@ -36,7 +36,7 @@ _propagate_future(void *data, const Efl_Event *event)
|
|||
const char *property;
|
||||
unsigned int i;
|
||||
Eina_Array_Iterator it;
|
||||
Efl_Model_Loop_Watcher_Data *wd = data;
|
||||
Efl_Loop_Model_Watcher_Data *wd = data;
|
||||
|
||||
EINA_ARRAY_ITER_NEXT(ev->changed_properties, i, property, it)
|
||||
if (property == wd->property || !strcmp(property, wd->property))
|
||||
|
@ -60,7 +60,7 @@ _propagate_future(void *data, const Efl_Event *event)
|
|||
}
|
||||
|
||||
eina_value_free(v);
|
||||
_efl_model_loop_wathcer_free(wd);
|
||||
_efl_loop_model_wathcer_free(wd);
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
@ -68,11 +68,11 @@ _propagate_future(void *data, const Efl_Event *event)
|
|||
static void
|
||||
_event_cancel(void *data, const Eina_Promise *dead_ptr EINA_UNUSED)
|
||||
{
|
||||
_efl_model_loop_wathcer_free(data);
|
||||
_efl_loop_model_wathcer_free(data);
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_model_loop_efl_model_property_ready_get(Eo *obj, void *pd EINA_UNUSED, const char *property)
|
||||
_efl_loop_model_efl_model_property_ready_get(Eo *obj, void *pd EINA_UNUSED, const char *property)
|
||||
{
|
||||
Eina_Value *value = efl_model_property_get(obj, property);
|
||||
Eina_Future *f;
|
||||
|
@ -86,7 +86,7 @@ _efl_model_loop_efl_model_property_ready_get(Eo *obj, void *pd EINA_UNUSED, cons
|
|||
|
||||
if (err == EAGAIN)
|
||||
{
|
||||
Efl_Model_Loop_Watcher_Data *wd = calloc(1, sizeof (Efl_Model_Loop_Watcher_Data));
|
||||
Efl_Loop_Model_Watcher_Data *wd = calloc(1, sizeof (Efl_Loop_Model_Watcher_Data));
|
||||
|
||||
wd->obj = obj;
|
||||
wd->property = eina_stringshare_add(property);
|
||||
|
@ -106,4 +106,4 @@ _efl_model_loop_efl_model_property_ready_get(Eo *obj, void *pd EINA_UNUSED, cons
|
|||
return efl_future_then(obj, f);
|
||||
}
|
||||
|
||||
#include "efl_model_loop.eo.c"
|
||||
#include "efl_loop_model.eo.c"
|
|
@ -1,4 +1,4 @@
|
|||
abstract Efl.Model_Loop extends Efl.Loop_Consumer implements Efl.Model
|
||||
abstract Efl.Loop_Model extends Efl.Loop_Consumer implements Efl.Model
|
||||
{
|
||||
data: null;
|
||||
implements {
|
|
@ -7,15 +7,15 @@
|
|||
#include <Ecore.h>
|
||||
#include "Eo.h"
|
||||
|
||||
#include "efl_model_composite_selection.eo.h"
|
||||
#include "efl_select_model.eo.h"
|
||||
#include "efl_model_accessor_view_private.h"
|
||||
#include "efl_model_composite_private.h"
|
||||
#include "efl_composite_model_private.h"
|
||||
|
||||
typedef struct _Efl_Model_Composite_Selection_Data Efl_Model_Composite_Selection_Data;
|
||||
typedef struct _Efl_Select_Model_Data Efl_Select_Model_Data;
|
||||
|
||||
struct _Efl_Model_Composite_Selection_Data
|
||||
struct _Efl_Select_Model_Data
|
||||
{
|
||||
Efl_Model_Composite_Selection_Data *parent;
|
||||
Efl_Select_Model_Data *parent;
|
||||
unsigned long last;
|
||||
|
||||
Eina_Bool exclusive : 1;
|
||||
|
@ -23,20 +23,20 @@ struct _Efl_Model_Composite_Selection_Data
|
|||
};
|
||||
|
||||
static Eo*
|
||||
_efl_model_composite_selection_efl_object_constructor(Eo *obj,
|
||||
Efl_Model_Composite_Selection_Data *pd)
|
||||
_efl_select_model_efl_object_constructor(Eo *obj,
|
||||
Efl_Select_Model_Data *pd EINA_UNUSED)
|
||||
{
|
||||
Eo *parent;
|
||||
|
||||
obj = efl_constructor(efl_super(obj, EFL_MODEL_COMPOSITE_SELECTION_CLASS));
|
||||
obj = efl_constructor(efl_super(obj, EFL_SELECT_MODEL_CLASS));
|
||||
|
||||
efl_model_composite_boolean_add(obj, "selected", EINA_FALSE);
|
||||
efl_boolean_model_boolean_add(obj, "selected", EINA_FALSE);
|
||||
|
||||
pd->last = -1;
|
||||
|
||||
parent = efl_parent_get(obj);
|
||||
if (efl_isa(parent, EFL_MODEL_COMPOSITE_SELECTION_CLASS))
|
||||
pd->parent = efl_data_scope_get(parent, EFL_MODEL_COMPOSITE_SELECTION_CLASS);
|
||||
if (efl_isa(parent, EFL_SELECT_MODEL_CLASS))
|
||||
pd->parent = efl_data_scope_get(parent, EFL_SELECT_MODEL_CLASS);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ _efl_model_composite_selection_efl_object_constructor(Eo *obj,
|
|||
static Eina_Value
|
||||
_commit_change(Eo *child, void *data EINA_UNUSED, const Eina_Value v)
|
||||
{
|
||||
Efl_Model_Composite_Selection_Data *pd;
|
||||
Efl_Select_Model_Data *pd;
|
||||
Eina_Value *selected = NULL;
|
||||
Eina_Bool selflag = EINA_FALSE;
|
||||
|
||||
|
@ -53,7 +53,7 @@ _commit_change(Eo *child, void *data EINA_UNUSED, const Eina_Value v)
|
|||
|
||||
selected = efl_model_property_get(child, "selected");
|
||||
|
||||
pd = efl_data_scope_get(efl_parent_get(child), EFL_MODEL_COMPOSITE_SELECTION_CLASS);
|
||||
pd = efl_data_scope_get(efl_parent_get(child), EFL_SELECT_MODEL_CLASS);
|
||||
if (!pd) goto on_error;
|
||||
|
||||
eina_value_bool_get(selected, &selflag);
|
||||
|
@ -61,21 +61,21 @@ _commit_change(Eo *child, void *data EINA_UNUSED, const Eina_Value v)
|
|||
{
|
||||
// select case
|
||||
pd->none = EINA_FALSE;
|
||||
pd->last = efl_model_composite_index_get(child);
|
||||
efl_event_callback_call(child, EFL_MODEL_COMPOSITE_SELECTION_EVENT_SELECTED, child);
|
||||
pd->last = efl_composite_model_index_get(child);
|
||||
efl_event_callback_call(child, EFL_SELECT_MODEL_EVENT_SELECTED, child);
|
||||
}
|
||||
else
|
||||
{
|
||||
// unselect case
|
||||
unsigned long last;
|
||||
|
||||
last = efl_model_composite_index_get(child);
|
||||
last = efl_composite_model_index_get(child);
|
||||
if (pd->last == last)
|
||||
{
|
||||
pd->last = 0;
|
||||
pd->none = EINA_TRUE;
|
||||
}
|
||||
efl_event_callback_call(child, EFL_MODEL_COMPOSITE_SELECTION_EVENT_UNSELECTED, child);
|
||||
efl_event_callback_call(child, EFL_SELECT_MODEL_EVENT_UNSELECTED, child);
|
||||
}
|
||||
|
||||
on_error:
|
||||
|
@ -220,7 +220,7 @@ _untangle_error(void *data, Eina_Error err)
|
|||
// where we could end up here.
|
||||
Eina_Error *error = calloc(1, sizeof (Eina_Error));
|
||||
|
||||
f = efl_model_property_set(efl_super(child, EFL_MODEL_COMPOSITE_SELECTION_CLASS),
|
||||
f = efl_model_property_set(efl_super(child, EFL_SELECT_MODEL_CLASS),
|
||||
"selected", eina_value_bool_new(EINA_FALSE));
|
||||
// Once this is done, we need to repropagate the error
|
||||
*error = err;
|
||||
|
@ -230,19 +230,19 @@ _untangle_error(void *data, Eina_Error err)
|
|||
}
|
||||
|
||||
static Eina_Iterator *
|
||||
_efl_model_composite_selection_efl_model_properties_get(const Eo *obj,
|
||||
Efl_Model_Composite_Selection_Data *pd EINA_UNUSED)
|
||||
_efl_select_model_efl_model_properties_get(const Eo *obj,
|
||||
Efl_Select_Model_Data *pd EINA_UNUSED)
|
||||
{
|
||||
EFL_MODEL_COMPOSITE_PROPERTIES_SUPER(props,
|
||||
obj, EFL_MODEL_COMPOSITE_SELECTION_CLASS,
|
||||
EFL_COMPOSITE_MODEL_PROPERTIES_SUPER(props,
|
||||
obj, EFL_SELECT_MODEL_CLASS,
|
||||
NULL,
|
||||
"self.selected", "child.selected", "exclusive");
|
||||
return props;
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_model_composite_selection_efl_model_property_set(Eo *obj,
|
||||
Efl_Model_Composite_Selection_Data *pd,
|
||||
_efl_select_model_efl_model_property_set(Eo *obj,
|
||||
Efl_Select_Model_Data *pd,
|
||||
const char *property, Eina_Value *value)
|
||||
{
|
||||
Eina_Value vf = EINA_VALUE_EMPTY;
|
||||
|
@ -284,7 +284,7 @@ _efl_model_composite_selection_efl_model_property_set(Eo *obj,
|
|||
Eina_Value *prev;
|
||||
Eina_Future *chain;
|
||||
|
||||
prev = efl_model_property_get(efl_super(obj, EFL_MODEL_COMPOSITE_SELECTION_CLASS), "selected");
|
||||
prev = efl_model_property_get(efl_super(obj, EFL_SELECT_MODEL_CLASS), "selected");
|
||||
success = eina_value_bool_get(prev, &prevflag);
|
||||
success &= eina_value_bool_convert(value, &newflag);
|
||||
|
||||
|
@ -297,7 +297,7 @@ _efl_model_composite_selection_efl_model_property_set(Eo *obj,
|
|||
exclusive = pd->parent->exclusive;
|
||||
|
||||
// First store the new value in the boolean model we inherit from
|
||||
chain = efl_model_property_set(efl_super(obj, EFL_MODEL_COMPOSITE_SELECTION_CLASS),
|
||||
chain = efl_model_property_set(efl_super(obj, EFL_SELECT_MODEL_CLASS),
|
||||
"selected", value);
|
||||
|
||||
// Now act !
|
||||
|
@ -310,7 +310,7 @@ _efl_model_composite_selection_efl_model_property_set(Eo *obj,
|
|||
{
|
||||
unsigned int i;
|
||||
|
||||
i = efl_model_composite_index_get(obj);
|
||||
i = efl_composite_model_index_get(obj);
|
||||
if (pd->parent->last == i && !newflag)
|
||||
pd->parent->none = EINA_TRUE;
|
||||
}
|
||||
|
@ -340,12 +340,12 @@ _efl_model_composite_selection_efl_model_property_set(Eo *obj,
|
|||
return efl_future_then(obj, chain, .success = _commit_change);
|
||||
}
|
||||
|
||||
return efl_model_property_set(efl_super(obj, EFL_MODEL_COMPOSITE_SELECTION_CLASS),
|
||||
return efl_model_property_set(efl_super(obj, EFL_SELECT_MODEL_CLASS),
|
||||
property, value);
|
||||
}
|
||||
|
||||
static Eina_Value *
|
||||
_efl_model_composite_selection_efl_model_property_get(const Eo *obj, Efl_Model_Composite_Selection_Data *pd, const char *property)
|
||||
_efl_select_model_efl_model_property_get(const Eo *obj, Efl_Select_Model_Data *pd, const char *property)
|
||||
{
|
||||
if (!strcmp("exclusive", property))
|
||||
return eina_value_bool_new(pd->exclusive);
|
||||
|
@ -360,10 +360,10 @@ _efl_model_composite_selection_efl_model_property_get(const Eo *obj, Efl_Model_C
|
|||
// Redirect to are we ourself selected
|
||||
if (pd->parent && !strcmp("self.selected", property))
|
||||
{
|
||||
return efl_model_property_get(efl_super(obj, EFL_MODEL_COMPOSITE_SELECTION_CLASS), "selected");
|
||||
return efl_model_property_get(efl_super(obj, EFL_SELECT_MODEL_CLASS), "selected");
|
||||
}
|
||||
|
||||
return efl_model_property_get(efl_super(obj, EFL_MODEL_COMPOSITE_SELECTION_CLASS), property);
|
||||
return efl_model_property_get(efl_super(obj, EFL_SELECT_MODEL_CLASS), property);
|
||||
}
|
||||
|
||||
#include "efl_model_composite_selection.eo.c"
|
||||
#include "efl_select_model.eo.c"
|
|
@ -1,6 +1,6 @@
|
|||
class Efl.Model_Composite_Selection extends Efl.Model_Composite_Boolean
|
||||
class Efl.Select_Model extends Efl.Boolean_Model
|
||||
{
|
||||
[[Efl model composite selection class]]
|
||||
[[Efl select model class]]
|
||||
implements {
|
||||
Efl.Object.constructor;
|
||||
Efl.Model.property { get; set; }
|
|
@ -9,22 +9,22 @@
|
|||
|
||||
#include "ecore_internal.h"
|
||||
|
||||
#include "efl_model_composite_private.h"
|
||||
#include "efl_composite_model_private.h"
|
||||
|
||||
typedef struct _Efl_Model_View_Data Efl_Model_View_Data;
|
||||
typedef struct _Efl_Model_View_Bind Efl_Model_View_Bind;
|
||||
typedef struct _Efl_Model_View_Logic Efl_Model_View_Logic;
|
||||
typedef struct _Efl_Model_View_Property_Ref Efl_Model_View_Property_Ref;
|
||||
typedef struct _Efl_View_Model_Data Efl_View_Model_Data;
|
||||
typedef struct _Efl_View_Model_Bind Efl_View_Model_Bind;
|
||||
typedef struct _Efl_View_Model_Logic Efl_View_Model_Logic;
|
||||
typedef struct _Efl_View_Model_Property_Ref Efl_View_Model_Property_Ref;
|
||||
|
||||
struct _Efl_Model_View_Data
|
||||
struct _Efl_View_Model_Data
|
||||
{
|
||||
// FIXME: If parent is set, always access parent... recursively?
|
||||
Efl_Model_View_Data *parent;
|
||||
Efl_View_Model_Data *parent;
|
||||
|
||||
Eina_Hash *bound; // Stringhash of Efl_Model_View_Bind
|
||||
Eina_Hash *logics; // Stringhash of Efl_Model_View_Logic
|
||||
Eina_Hash *bound; // Stringhash of Efl_View_Model_Bind
|
||||
Eina_Hash *logics; // Stringhash of Efl_View_Model_Logic
|
||||
|
||||
Eina_Hash *deduplication; // Stringhash of Efl_Model_View_Property_Ref
|
||||
Eina_Hash *deduplication; // Stringhash of Efl_View_Model_Property_Ref
|
||||
|
||||
struct {
|
||||
Eina_Bool property_changed : 1;
|
||||
|
@ -35,21 +35,21 @@ struct _Efl_Model_View_Data
|
|||
Eina_Bool children_bind : 1; // Define if child object should be automatically binded
|
||||
};
|
||||
|
||||
struct _Efl_Model_View_Bind
|
||||
struct _Efl_View_Model_Bind
|
||||
{
|
||||
Eina_Stringshare *source;
|
||||
Eina_List *destinations;
|
||||
};
|
||||
|
||||
struct _Efl_Model_View_Logic
|
||||
struct _Efl_View_Model_Logic
|
||||
{
|
||||
struct {
|
||||
EflModelViewPropertyGet fct;
|
||||
EflViewModelPropertyGet fct;
|
||||
Eina_Free_Cb free_cb;
|
||||
void *data;
|
||||
} get;
|
||||
struct {
|
||||
EflModelViewPropertySet fct;
|
||||
EflViewModelPropertySet fct;
|
||||
Eina_Free_Cb free_cb;
|
||||
void *data;
|
||||
} set;
|
||||
|
@ -59,7 +59,7 @@ struct _Efl_Model_View_Logic
|
|||
Eina_Stringshare *property;
|
||||
};
|
||||
|
||||
struct _Efl_Model_View_Property_Ref
|
||||
struct _Efl_View_Model_Property_Ref
|
||||
{
|
||||
EINA_REFCOUNT;
|
||||
Eina_Stringshare *property;
|
||||
|
@ -68,21 +68,21 @@ struct _Efl_Model_View_Property_Ref
|
|||
static void
|
||||
_ref_free(void *data)
|
||||
{
|
||||
Efl_Model_View_Property_Ref *r = data;
|
||||
Efl_View_Model_Property_Ref *r = data;
|
||||
|
||||
eina_stringshare_del(r->property);
|
||||
free(r);
|
||||
}
|
||||
|
||||
static void
|
||||
_ref_add(Efl_Model_View_Data *pd, Eina_Stringshare *property)
|
||||
_ref_add(Efl_View_Model_Data *pd, Eina_Stringshare *property)
|
||||
{
|
||||
Efl_Model_View_Property_Ref *r;
|
||||
Efl_View_Model_Property_Ref *r;
|
||||
|
||||
r = eina_hash_find(pd->deduplication, property);
|
||||
if (!r)
|
||||
{
|
||||
r = calloc(1, sizeof (Efl_Model_View_Property_Ref));
|
||||
r = calloc(1, sizeof (Efl_View_Model_Property_Ref));
|
||||
if (!r) return ;
|
||||
r->property = eina_stringshare_ref(property);
|
||||
|
||||
|
@ -93,9 +93,9 @@ _ref_add(Efl_Model_View_Data *pd, Eina_Stringshare *property)
|
|||
}
|
||||
|
||||
static void
|
||||
_ref_del(Efl_Model_View_Data *pd, Eina_Stringshare *property)
|
||||
_ref_del(Efl_View_Model_Data *pd, Eina_Stringshare *property)
|
||||
{
|
||||
Efl_Model_View_Property_Ref *r;
|
||||
Efl_View_Model_Property_Ref *r;
|
||||
|
||||
r = eina_hash_find(pd->deduplication, property);
|
||||
if (!r) return ;
|
||||
|
@ -107,14 +107,14 @@ _ref_del(Efl_Model_View_Data *pd, Eina_Stringshare *property)
|
|||
static void
|
||||
_logic_free(void *data)
|
||||
{
|
||||
Efl_Model_View_Logic *logic = data;
|
||||
Efl_View_Model_Logic *logic = data;
|
||||
Eina_Stringshare *source;
|
||||
|
||||
if (logic->get.free_cb) logic->get.free_cb(logic->get.data);
|
||||
if (logic->set.free_cb) logic->set.free_cb(logic->set.data);
|
||||
EINA_LIST_FREE(logic->sources, source)
|
||||
{
|
||||
efl_model_view_property_unbind(logic->object, source, logic->property);
|
||||
efl_view_model_property_unbind(logic->object, source, logic->property);
|
||||
eina_stringshare_del(source);
|
||||
}
|
||||
eina_stringshare_del(logic->property);
|
||||
|
@ -122,30 +122,30 @@ _logic_free(void *data)
|
|||
}
|
||||
|
||||
static Eina_Value *
|
||||
_efl_model_view_property_dummy_get(void *data EINA_UNUSED,
|
||||
const Efl_Model_View *model_view EINA_UNUSED,
|
||||
_efl_view_model_property_dummy_get(void *data EINA_UNUSED,
|
||||
const Efl_View_Model *view_model EINA_UNUSED,
|
||||
Eina_Stringshare *property EINA_UNUSED)
|
||||
{
|
||||
return eina_value_error_new(EFL_MODEL_ERROR_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_model_view_property_dummy_set(void *data EINA_UNUSED,
|
||||
Efl_Model_View *model_view,
|
||||
_efl_view_model_property_dummy_set(void *data EINA_UNUSED,
|
||||
Efl_View_Model *view_model,
|
||||
Eina_Stringshare *property EINA_UNUSED,
|
||||
Eina_Value *value EINA_UNUSED)
|
||||
{
|
||||
return efl_loop_future_rejected(model_view, EFL_MODEL_ERROR_READ_ONLY);
|
||||
return efl_loop_future_rejected(view_model, EFL_MODEL_ERROR_READ_ONLY);
|
||||
}
|
||||
|
||||
static Eina_Error
|
||||
_efl_model_view_property_logic_add(Eo *obj, Efl_Model_View_Data *pd,
|
||||
_efl_view_model_property_logic_add(Eo *obj, Efl_View_Model_Data *pd,
|
||||
const char *property,
|
||||
void *get_data, EflModelViewPropertyGet get, Eina_Free_Cb get_free_cb,
|
||||
void *set_data, EflModelViewPropertySet set, Eina_Free_Cb set_free_cb,
|
||||
void *get_data, EflViewModelPropertyGet get, Eina_Free_Cb get_free_cb,
|
||||
void *set_data, EflViewModelPropertySet set, Eina_Free_Cb set_free_cb,
|
||||
Eina_Iterator *bound)
|
||||
{
|
||||
Efl_Model_View_Logic *logic;
|
||||
Efl_View_Model_Logic *logic;
|
||||
Eina_Stringshare *prop;
|
||||
const char *source;
|
||||
|
||||
|
@ -157,15 +157,15 @@ _efl_model_view_property_logic_add(Eo *obj, Efl_Model_View_Data *pd,
|
|||
return EFL_MODEL_ERROR_INCORRECT_VALUE;
|
||||
}
|
||||
|
||||
logic = calloc(1, sizeof (Efl_Model_View_Logic));
|
||||
logic = calloc(1, sizeof (Efl_View_Model_Logic));
|
||||
if (!logic) return ENOMEM;
|
||||
|
||||
logic->object = obj;
|
||||
logic->property = prop;
|
||||
logic->get.fct = get ? get : _efl_model_view_property_dummy_get;
|
||||
logic->get.fct = get ? get : _efl_view_model_property_dummy_get;
|
||||
logic->get.free_cb = get_free_cb;
|
||||
logic->get.data = get_data;
|
||||
logic->set.fct = set ? set : _efl_model_view_property_dummy_set;
|
||||
logic->set.fct = set ? set : _efl_view_model_property_dummy_set;
|
||||
logic->set.free_cb = set_free_cb;
|
||||
logic->set.data = set_data;
|
||||
|
||||
|
@ -174,17 +174,17 @@ _efl_model_view_property_logic_add(Eo *obj, Efl_Model_View_Data *pd,
|
|||
EINA_ITERATOR_FOREACH(bound, source)
|
||||
{
|
||||
logic->sources = eina_list_append(logic->sources, eina_stringshare_add(source));
|
||||
efl_model_view_property_bind(obj, source, property);
|
||||
efl_view_model_property_bind(obj, source, property);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Eina_Error
|
||||
_efl_model_view_property_logic_del(Eo *obj EINA_UNUSED, Efl_Model_View_Data *pd,
|
||||
_efl_view_model_property_logic_del(Eo *obj EINA_UNUSED, Efl_View_Model_Data *pd,
|
||||
const char *property)
|
||||
{
|
||||
Efl_Model_View_Logic *logic;
|
||||
Efl_View_Model_Logic *logic;
|
||||
|
||||
logic = eina_hash_find(pd->logics, property);
|
||||
if (!logic) return EFL_MODEL_ERROR_INCORRECT_VALUE;
|
||||
|
@ -193,10 +193,10 @@ _efl_model_view_property_logic_del(Eo *obj EINA_UNUSED, Efl_Model_View_Data *pd,
|
|||
}
|
||||
|
||||
static void
|
||||
_efl_model_view_property_bind(Eo *obj EINA_UNUSED, Efl_Model_View_Data *pd,
|
||||
_efl_view_model_property_bind(Eo *obj EINA_UNUSED, Efl_View_Model_Data *pd,
|
||||
const char *source, const char *destination)
|
||||
{
|
||||
Efl_Model_View_Bind *bind;
|
||||
Efl_View_Model_Bind *bind;
|
||||
Eina_Stringshare *src;
|
||||
Eina_Stringshare *dst;
|
||||
|
||||
|
@ -206,7 +206,7 @@ _efl_model_view_property_bind(Eo *obj EINA_UNUSED, Efl_Model_View_Data *pd,
|
|||
bind = eina_hash_find(pd->bound, src);
|
||||
if (!bind)
|
||||
{
|
||||
bind = calloc(1, sizeof (Efl_Model_View_Bind));
|
||||
bind = calloc(1, sizeof (Efl_View_Model_Bind));
|
||||
if (!bind) goto on_error;
|
||||
bind->source = eina_stringshare_ref(src);
|
||||
|
||||
|
@ -222,10 +222,10 @@ _efl_model_view_property_bind(Eo *obj EINA_UNUSED, Efl_Model_View_Data *pd,
|
|||
}
|
||||
|
||||
static void
|
||||
_efl_model_view_property_unbind(Eo *obj EINA_UNUSED, Efl_Model_View_Data *pd,
|
||||
_efl_view_model_property_unbind(Eo *obj EINA_UNUSED, Efl_View_Model_Data *pd,
|
||||
const char *source, const char *destination)
|
||||
{
|
||||
Efl_Model_View_Bind *bind;
|
||||
Efl_View_Model_Bind *bind;
|
||||
Eina_Stringshare *src;
|
||||
Eina_Stringshare *dst;
|
||||
Eina_Stringshare *cmp;
|
||||
|
@ -258,7 +258,7 @@ _efl_model_view_property_unbind(Eo *obj EINA_UNUSED, Efl_Model_View_Data *pd,
|
|||
static void
|
||||
_bind_free(void *data)
|
||||
{
|
||||
Efl_Model_View_Bind *bind = data;
|
||||
Efl_View_Model_Bind *bind = data;
|
||||
Eina_Stringshare *dst;
|
||||
|
||||
eina_stringshare_del(bind->source);
|
||||
|
@ -269,20 +269,20 @@ _bind_free(void *data)
|
|||
free(bind);
|
||||
}
|
||||
|
||||
static Efl_Model_View_Bind *
|
||||
_efl_model_view_property_bind_lookup(Efl_Model_View_Data *pd, Eina_Stringshare *src)
|
||||
static Efl_View_Model_Bind *
|
||||
_efl_view_model_property_bind_lookup(Efl_View_Model_Data *pd, Eina_Stringshare *src)
|
||||
{
|
||||
Efl_Model_View_Bind *bind;
|
||||
Efl_View_Model_Bind *bind;
|
||||
|
||||
bind = eina_hash_find(pd->bound, src);
|
||||
if (!bind && pd->parent) return _efl_model_view_property_bind_lookup(pd->parent, src);
|
||||
if (!bind && pd->parent) return _efl_view_model_property_bind_lookup(pd->parent, src);
|
||||
return bind;
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_model_view_property_changed(void *data, const Efl_Event *event)
|
||||
_efl_view_model_property_changed(void *data, const Efl_Event *event)
|
||||
{
|
||||
Efl_Model_View_Data *pd = data;
|
||||
Efl_View_Model_Data *pd = data;
|
||||
Efl_Model_Property_Event *ev = event->info;
|
||||
Efl_Model_Property_Event nev = { 0 };
|
||||
const char *property;
|
||||
|
@ -300,12 +300,12 @@ _efl_model_view_property_changed(void *data, const Efl_Event *event)
|
|||
|
||||
EINA_ARRAY_ITER_NEXT(ev->changed_properties, i, property, iterator)
|
||||
{
|
||||
Efl_Model_View_Bind *bind;
|
||||
Efl_View_Model_Bind *bind;
|
||||
|
||||
eina_array_push(nev.changed_properties, property);
|
||||
|
||||
src = eina_stringshare_add(property);
|
||||
bind = _efl_model_view_property_bind_lookup(pd, src);
|
||||
bind = _efl_view_model_property_bind_lookup(pd, src);
|
||||
if (bind)
|
||||
{
|
||||
Eina_Stringshare *dest;
|
||||
|
@ -324,7 +324,7 @@ _efl_model_view_property_changed(void *data, const Efl_Event *event)
|
|||
}
|
||||
|
||||
static void
|
||||
_efl_model_view_children_bind_set(Eo *obj EINA_UNUSED, Efl_Model_View_Data *pd, Eina_Bool enable)
|
||||
_efl_view_model_children_bind_set(Eo *obj EINA_UNUSED, Efl_View_Model_Data *pd, Eina_Bool enable)
|
||||
{
|
||||
if (pd->finalized) return;
|
||||
|
||||
|
@ -332,46 +332,46 @@ _efl_model_view_children_bind_set(Eo *obj EINA_UNUSED, Efl_Model_View_Data *pd,
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_efl_model_view_children_bind_get(const Eo *obj EINA_UNUSED, Efl_Model_View_Data *pd)
|
||||
_efl_view_model_children_bind_get(const Eo *obj EINA_UNUSED, Efl_View_Model_Data *pd)
|
||||
{
|
||||
return pd->children_bind;
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_model_view_parent_data(Efl_Model_View *child, Efl_Model_View_Data *ppd)
|
||||
_efl_view_model_parent_data(Efl_View_Model *child, Efl_View_Model_Data *ppd)
|
||||
{
|
||||
Efl_Model_View_Data *cpd;
|
||||
Efl_View_Model_Data *cpd;
|
||||
|
||||
cpd = efl_data_scope_get(child, EFL_MODEL_VIEW_CLASS);
|
||||
cpd = efl_data_scope_get(child, EFL_VIEW_MODEL_CLASS);
|
||||
cpd->parent = ppd;
|
||||
cpd->propagating = ppd->propagating;
|
||||
}
|
||||
|
||||
static Efl_Model_View *
|
||||
_efl_model_view_child_lookup(Efl_Model_View_Data *pd, Efl_Object *parent, Efl_Model *view)
|
||||
static Efl_View_Model *
|
||||
_efl_view_model_child_lookup(Efl_View_Model_Data *pd, Efl_Object *parent, Efl_Model *view)
|
||||
{
|
||||
Efl_Model_View *co;
|
||||
Efl_View_Model *co;
|
||||
|
||||
co = efl_key_wref_get(view, "_efl.model_view");
|
||||
co = efl_key_wref_get(view, "_efl.view_model");
|
||||
if (co) return co;
|
||||
|
||||
co = efl_add(EFL_MODEL_VIEW_CLASS, parent,
|
||||
co = efl_add(EFL_VIEW_MODEL_CLASS, parent,
|
||||
efl_ui_view_model_set(efl_added, view),
|
||||
_efl_model_view_parent_data(efl_added, pd));
|
||||
_efl_view_model_parent_data(efl_added, pd));
|
||||
if (!co) return NULL;
|
||||
|
||||
efl_key_wref_set(view, "_efl.model_view", co);
|
||||
efl_key_wref_set(view, "_efl.view_model", co);
|
||||
|
||||
return co;
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_model_view_child_added(void *data, const Efl_Event *event)
|
||||
_efl_view_model_child_added(void *data, const Efl_Event *event)
|
||||
{
|
||||
Efl_Model_Children_Event *ev = event->info;
|
||||
Efl_Model_Children_Event nevt = { 0 };
|
||||
Efl_Model_View_Data *pd = data;
|
||||
Efl_Model_View *co;
|
||||
Efl_View_Model_Data *pd = data;
|
||||
Efl_View_Model *co;
|
||||
|
||||
if (pd->propagating.child_added) return ;
|
||||
if (!pd->children_bind) return;
|
||||
|
@ -382,7 +382,7 @@ _efl_model_view_child_added(void *data, const Efl_Event *event)
|
|||
// Our strategy is to rebuild a new Child_Add and cancel the current one.
|
||||
efl_event_callback_stop(event->object);
|
||||
|
||||
co = _efl_model_view_child_lookup(pd, event->object, ev->child);
|
||||
co = _efl_view_model_child_lookup(pd, event->object, ev->child);
|
||||
if (!co) return;
|
||||
|
||||
nevt.index = ev->index;
|
||||
|
@ -394,12 +394,12 @@ _efl_model_view_child_added(void *data, const Efl_Event *event)
|
|||
}
|
||||
|
||||
static void
|
||||
_efl_model_view_child_removed(void *data, const Efl_Event *event)
|
||||
_efl_view_model_child_removed(void *data, const Efl_Event *event)
|
||||
{
|
||||
Efl_Model_Children_Event *ev = event->info;
|
||||
Efl_Model_Children_Event nevt = { 0 };
|
||||
Efl_Model_View_Data *pd = data;
|
||||
Efl_Model_View *co;
|
||||
Efl_View_Model_Data *pd = data;
|
||||
Efl_View_Model *co;
|
||||
|
||||
if (pd->propagating.child_removed) return ;
|
||||
if (!pd->children_bind) return;
|
||||
|
@ -410,7 +410,7 @@ _efl_model_view_child_removed(void *data, const Efl_Event *event)
|
|||
// Our strategy is to rebuild a new Child_Add and cancel the current one.
|
||||
efl_event_callback_stop(event->object);
|
||||
|
||||
co = _efl_model_view_child_lookup(pd, event->object, ev->child);
|
||||
co = _efl_view_model_child_lookup(pd, event->object, ev->child);
|
||||
if (!co) return;
|
||||
|
||||
nevt.index = ev->index;
|
||||
|
@ -418,44 +418,44 @@ _efl_model_view_child_removed(void *data, const Efl_Event *event)
|
|||
|
||||
efl_event_callback_call(event->object, EFL_MODEL_EVENT_CHILD_REMOVED, &nevt);
|
||||
|
||||
// The object is being destroyed, there is no point in us keeping the ModelView proxy alive.
|
||||
// The object is being destroyed, there is no point in us keeping the ViewModel proxy alive.
|
||||
efl_del(co);
|
||||
|
||||
pd->propagating.child_removed = EINA_FALSE;
|
||||
}
|
||||
|
||||
EFL_CALLBACKS_ARRAY_DEFINE(efl_model_view_intercept,
|
||||
{ EFL_MODEL_EVENT_PROPERTIES_CHANGED, _efl_model_view_property_changed },
|
||||
{ EFL_MODEL_EVENT_CHILD_ADDED, _efl_model_view_child_added },
|
||||
{ EFL_MODEL_EVENT_CHILD_REMOVED, _efl_model_view_child_removed })
|
||||
EFL_CALLBACKS_ARRAY_DEFINE(efl_view_model_intercept,
|
||||
{ EFL_MODEL_EVENT_PROPERTIES_CHANGED, _efl_view_model_property_changed },
|
||||
{ EFL_MODEL_EVENT_CHILD_ADDED, _efl_view_model_child_added },
|
||||
{ EFL_MODEL_EVENT_CHILD_REMOVED, _efl_view_model_child_removed })
|
||||
|
||||
static Efl_Object *
|
||||
_efl_model_view_efl_object_constructor(Eo *obj, Efl_Model_View_Data *pd)
|
||||
_efl_view_model_efl_object_constructor(Eo *obj, Efl_View_Model_Data *pd)
|
||||
{
|
||||
obj = efl_constructor(efl_super(obj, EFL_MODEL_VIEW_CLASS));
|
||||
obj = efl_constructor(efl_super(obj, EFL_VIEW_MODEL_CLASS));
|
||||
|
||||
pd->children_bind = EINA_TRUE;
|
||||
pd->bound = eina_hash_stringshared_new(_bind_free);
|
||||
pd->logics = eina_hash_stringshared_new(_logic_free);
|
||||
pd->deduplication = eina_hash_stringshared_new(_ref_free);
|
||||
|
||||
efl_event_callback_array_priority_add(obj, efl_model_view_intercept(), EFL_CALLBACK_PRIORITY_BEFORE, pd);
|
||||
efl_event_callback_array_priority_add(obj, efl_view_model_intercept(), EFL_CALLBACK_PRIORITY_BEFORE, pd);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
static Efl_Object *
|
||||
_efl_model_view_efl_object_finalize(Eo *obj, Efl_Model_View_Data *pd)
|
||||
_efl_view_model_efl_object_finalize(Eo *obj, Efl_View_Model_Data *pd)
|
||||
{
|
||||
pd->finalized = EINA_TRUE;
|
||||
|
||||
return efl_finalize(efl_super(obj, EFL_MODEL_VIEW_CLASS));
|
||||
return efl_finalize(efl_super(obj, EFL_VIEW_MODEL_CLASS));
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_model_view_efl_object_destructor(Eo *obj, Efl_Model_View_Data *pd)
|
||||
_efl_view_model_efl_object_destructor(Eo *obj, Efl_View_Model_Data *pd)
|
||||
{
|
||||
efl_event_callback_array_del(obj, efl_model_view_intercept(), pd);
|
||||
efl_event_callback_array_del(obj, efl_view_model_intercept(), pd);
|
||||
|
||||
eina_hash_free(pd->bound);
|
||||
pd->bound = NULL;
|
||||
|
@ -463,78 +463,78 @@ _efl_model_view_efl_object_destructor(Eo *obj, Efl_Model_View_Data *pd)
|
|||
eina_hash_free(pd->logics);
|
||||
pd->logics = NULL;
|
||||
|
||||
efl_destructor(efl_super(obj, EFL_MODEL_VIEW_CLASS));
|
||||
efl_destructor(efl_super(obj, EFL_VIEW_MODEL_CLASS));
|
||||
}
|
||||
|
||||
static Efl_Model_View_Logic *
|
||||
_efl_model_view_property_logic_lookup(Efl_Model_View_Data *pd, Eina_Stringshare *property)
|
||||
static Efl_View_Model_Logic *
|
||||
_efl_view_model_property_logic_lookup(Efl_View_Model_Data *pd, Eina_Stringshare *property)
|
||||
{
|
||||
Efl_Model_View_Logic *logic;
|
||||
Efl_View_Model_Logic *logic;
|
||||
|
||||
if (!pd) return NULL;
|
||||
logic = eina_hash_find(pd->logics, property);
|
||||
if (!logic) return _efl_model_view_property_logic_lookup(pd->parent, property);
|
||||
if (!logic) return _efl_view_model_property_logic_lookup(pd->parent, property);
|
||||
return logic;
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_model_view_efl_model_property_set(Eo *obj, Efl_Model_View_Data *pd,
|
||||
_efl_view_model_efl_model_property_set(Eo *obj, Efl_View_Model_Data *pd,
|
||||
const char *property, Eina_Value *value)
|
||||
{
|
||||
Efl_Model_View_Logic *logic;
|
||||
Efl_View_Model_Logic *logic;
|
||||
Eina_Stringshare *prop;
|
||||
Eina_Future *f;
|
||||
|
||||
prop = eina_stringshare_add(property);
|
||||
logic = _efl_model_view_property_logic_lookup(pd, prop);
|
||||
logic = _efl_view_model_property_logic_lookup(pd, prop);
|
||||
if (logic)
|
||||
f = logic->set.fct(logic->get.data, obj, prop, value);
|
||||
else
|
||||
f = efl_model_property_set(efl_super(obj, EFL_MODEL_VIEW_CLASS), property, value);
|
||||
f = efl_model_property_set(efl_super(obj, EFL_VIEW_MODEL_CLASS), property, value);
|
||||
|
||||
eina_stringshare_del(prop);
|
||||
return f;
|
||||
}
|
||||
|
||||
static Eina_Value *
|
||||
_efl_model_view_efl_model_property_get(const Eo *obj, Efl_Model_View_Data *pd,
|
||||
_efl_view_model_efl_model_property_get(const Eo *obj, Efl_View_Model_Data *pd,
|
||||
const char *property)
|
||||
{
|
||||
Efl_Model_View_Logic *logic;
|
||||
Efl_View_Model_Logic *logic;
|
||||
Eina_Stringshare *prop;
|
||||
Eina_Value *r;
|
||||
|
||||
prop = eina_stringshare_add(property);
|
||||
logic = _efl_model_view_property_logic_lookup(pd, prop);
|
||||
logic = _efl_view_model_property_logic_lookup(pd, prop);
|
||||
if (logic)
|
||||
r = logic->get.fct(logic->get.data, obj, prop);
|
||||
else
|
||||
r = efl_model_property_get(efl_super(obj, EFL_MODEL_VIEW_CLASS), property);
|
||||
r = efl_model_property_get(efl_super(obj, EFL_VIEW_MODEL_CLASS), property);
|
||||
|
||||
eina_stringshare_del(prop);
|
||||
return r;
|
||||
}
|
||||
|
||||
static Eina_Iterator *
|
||||
_efl_model_view_efl_model_properties_get(const Eo *obj, Efl_Model_View_Data *pd)
|
||||
_efl_view_model_efl_model_properties_get(const Eo *obj, Efl_View_Model_Data *pd)
|
||||
{
|
||||
EFL_MODEL_COMPOSITE_PROPERTIES_SUPER(props, obj, EFL_MODEL_VIEW_CLASS,
|
||||
EFL_COMPOSITE_MODEL_PROPERTIES_SUPER(props, obj, EFL_VIEW_MODEL_CLASS,
|
||||
eina_hash_iterator_key_new(pd->deduplication));
|
||||
|
||||
return props;
|
||||
}
|
||||
|
||||
typedef struct _Efl_Model_View_Slice_Request Efl_Model_View_Slice_Request;
|
||||
struct _Efl_Model_View_Slice_Request
|
||||
typedef struct _Efl_View_Model_Slice_Request Efl_View_Model_Slice_Request;
|
||||
struct _Efl_View_Model_Slice_Request
|
||||
{
|
||||
Efl_Model_View_Data *pd;
|
||||
Efl_View_Model_Data *pd;
|
||||
unsigned int start;
|
||||
};
|
||||
|
||||
static Eina_Value
|
||||
_efl_model_view_slice_then(Eo *o, void *data, const Eina_Value v)
|
||||
_efl_view_model_slice_then(Eo *o, void *data, const Eina_Value v)
|
||||
{
|
||||
Efl_Model_View_Slice_Request *req = data;
|
||||
Efl_View_Model_Slice_Request *req = data;
|
||||
Eo *target;
|
||||
Eina_Value r = EINA_VALUE_EMPTY;
|
||||
unsigned int i, len;
|
||||
|
@ -545,7 +545,7 @@ _efl_model_view_slice_then(Eo *o, void *data, const Eina_Value v)
|
|||
{
|
||||
Eo *composite;
|
||||
|
||||
composite = _efl_model_view_child_lookup(req->pd, o, target);
|
||||
composite = _efl_view_model_child_lookup(req->pd, o, target);
|
||||
eina_value_array_append(&r, composite);
|
||||
}
|
||||
|
||||
|
@ -553,21 +553,21 @@ _efl_model_view_slice_then(Eo *o, void *data, const Eina_Value v)
|
|||
}
|
||||
|
||||
static void
|
||||
_efl_model_view_slice_clean(Eo *o EINA_UNUSED, void *data, const Eina_Future *dead_future EINA_UNUSED)
|
||||
_efl_view_model_slice_clean(Eo *o EINA_UNUSED, void *data, const Eina_Future *dead_future EINA_UNUSED)
|
||||
{
|
||||
free(data);
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_model_view_efl_model_children_slice_get(Eo *obj, Efl_Model_View_Data *pd,
|
||||
_efl_view_model_efl_model_children_slice_get(Eo *obj, Efl_View_Model_Data *pd,
|
||||
unsigned int start, unsigned int count)
|
||||
{
|
||||
Efl_Model_View_Slice_Request *req;
|
||||
Efl_View_Model_Slice_Request *req;
|
||||
Eina_Future *f;
|
||||
|
||||
f = efl_model_children_slice_get(efl_super(obj, EFL_MODEL_VIEW_CLASS), start, count);
|
||||
f = efl_model_children_slice_get(efl_super(obj, EFL_VIEW_MODEL_CLASS), start, count);
|
||||
|
||||
req = malloc(sizeof (Efl_Model_View_Slice_Request));
|
||||
req = malloc(sizeof (Efl_View_Model_Slice_Request));
|
||||
if (!req)
|
||||
{
|
||||
eina_future_cancel(f);
|
||||
|
@ -578,9 +578,9 @@ _efl_model_view_efl_model_children_slice_get(Eo *obj, Efl_Model_View_Data *pd,
|
|||
req->start = start;
|
||||
|
||||
return efl_future_then(obj, f, .success_type = EINA_VALUE_TYPE_ARRAY,
|
||||
.success = _efl_model_view_slice_then,
|
||||
.free = _efl_model_view_slice_clean,
|
||||
.success = _efl_view_model_slice_then,
|
||||
.free = _efl_view_model_slice_clean,
|
||||
.data = req);
|
||||
}
|
||||
|
||||
#include "efl_model_view.eo.c"
|
||||
#include "efl_view_model.eo.c"
|
|
@ -1,23 +1,23 @@
|
|||
function EflModelViewPropertyGet {
|
||||
function EflViewModelPropertyGet {
|
||||
[[Function called when a property is get.]]
|
||||
params {
|
||||
@in model_view: const(Efl.Model_View); [[The ModelView object the @.property.get is issued on.]]
|
||||
@in view_model: const(Efl.View_Model); [[The ViewModel object the @.property.get is issued on.]]
|
||||
@in property: stringshare; [[The property name the @.property.get is issued on.]]
|
||||
}
|
||||
return: any_value_ptr; [[The property value.]]
|
||||
};
|
||||
|
||||
function EflModelViewPropertySet {
|
||||
function EflViewModelPropertySet {
|
||||
[[Function called when a property is set.]]
|
||||
params {
|
||||
@in model_view: Efl.Model_View; [[The ModelView object the @.property.set is issued on.]]
|
||||
@in view_model: Efl.View_Model; [[The ViewModel object the @.property.set is issued on.]]
|
||||
@in property: stringshare; [[The property name the @.property.set is issued on.]]
|
||||
@in value: any_value_ptr @owned; [[The new value to set.]]
|
||||
}
|
||||
return: future<any_value_ptr>; [[The value that was finally set.]]
|
||||
};
|
||||
|
||||
class Efl.Model_View extends Efl.Model_Composite
|
||||
class Efl.View_Model extends Efl.Composite_Model
|
||||
{
|
||||
[[Efl model providing helpers for custom properties used when linking a model to a view and you need to generate/adapt values for display.
|
||||
|
||||
|
@ -34,8 +34,8 @@ class Efl.Model_View extends Efl.Model_Composite
|
|||
]]
|
||||
params {
|
||||
property: string; [[The property to bind on to.]]
|
||||
get: EflModelViewPropertyGet; [[Define the get callback called when the @Efl.Model.property.get is called with the above property name.]]
|
||||
set: EflModelViewPropertySet; [[Define the set callback called when the @Efl.Model.property.set is called with the above property name.]]
|
||||
get: EflViewModelPropertyGet; [[Define the get callback called when the @Efl.Model.property.get is called with the above property name.]]
|
||||
set: EflViewModelPropertySet; [[Define the set callback called when the @Efl.Model.property.set is called with the above property name.]]
|
||||
binded: iterator<string>; [[Iterator of property name to bind with this defined property see @.property_bind.]]
|
||||
}
|
||||
return: Eina.Error;
|
||||
|
@ -60,7 +60,7 @@ class Efl.Model_View extends Efl.Model_Composite
|
|||
]]
|
||||
params {
|
||||
@in source: string; [[Property name in the composited model.]]
|
||||
@in destination: string; [[Property name in the @Efl.Model_View]]
|
||||
@in destination: string; [[Property name in the @Efl.View_Model]]
|
||||
}
|
||||
}
|
||||
property_unbind {
|
||||
|
@ -70,12 +70,12 @@ class Efl.Model_View extends Efl.Model_Composite
|
|||
]]
|
||||
params {
|
||||
@in source: string; [[Property name in the composited model.]]
|
||||
@in destination: string; [[Property name in the @Efl.Model_View]]
|
||||
@in destination: string; [[Property name in the @Efl.View_Model]]
|
||||
}
|
||||
}
|
||||
@property children_bind {
|
||||
[[Define if we will intercept all childrens object reference and
|
||||
bind them through the ModelView with the same property logic as this
|
||||
bind them through the ViewModel with the same property logic as this
|
||||
one. Be careful of recursivity.
|
||||
|
||||
This can only be applied at construction time.]]
|
||||
|
@ -99,6 +99,6 @@ class Efl.Model_View extends Efl.Model_Composite
|
|||
Efl.Model.property { set; get; }
|
||||
}
|
||||
constructors {
|
||||
Efl.Model_View.children_bind;
|
||||
Efl.View_Model.children_bind;
|
||||
}
|
||||
}
|
|
@ -67,14 +67,14 @@ pub_eo_files = [
|
|||
'efl_cubic_bezier_interpolator.eo',
|
||||
'efl_loop_message_future_handler.eo',
|
||||
'efl_loop_message_future.eo',
|
||||
'efl_model_loop.eo',
|
||||
'efl_model_item.eo',
|
||||
'efl_model_container.eo',
|
||||
'efl_model_container_item.eo',
|
||||
'efl_model_composite_boolean.eo',
|
||||
'efl_model_composite_selection.eo',
|
||||
'efl_model_composite.eo',
|
||||
'efl_model_view.eo'
|
||||
'efl_loop_model.eo',
|
||||
'efl_generic_model.eo',
|
||||
'efl_container_model.eo',
|
||||
'efl_container_model_item.eo',
|
||||
'efl_boolean_model.eo',
|
||||
'efl_select_model.eo',
|
||||
'efl_composite_model.eo',
|
||||
'efl_view_model.eo'
|
||||
]
|
||||
|
||||
foreach eo_file : pub_eo_files
|
||||
|
@ -144,18 +144,18 @@ ecore_src = [
|
|||
'efl_io_file.c',
|
||||
'efl_io_copier.c',
|
||||
'efl_io_buffered_stream.c',
|
||||
'efl_model_loop.c',
|
||||
'efl_model_item.c',
|
||||
'efl_model_container.c',
|
||||
'efl_model_container_item.c',
|
||||
'efl_model_container_private.h',
|
||||
'efl_model_composite.c',
|
||||
'efl_model_composite_boolean.c',
|
||||
'efl_model_composite_selection.c',
|
||||
'efl_model_composite_private.h',
|
||||
'efl_loop_model.c',
|
||||
'efl_generic_model.c',
|
||||
'efl_container_model.c',
|
||||
'efl_container_model_item.c',
|
||||
'efl_container_model_private.h',
|
||||
'efl_composite_model.c',
|
||||
'efl_boolean_model.c',
|
||||
'efl_select_model.c',
|
||||
'efl_composite_model_private.h',
|
||||
'efl_model_accessor_view.c',
|
||||
'efl_model_accessor_view_private.h',
|
||||
'efl_model_view.c',
|
||||
'efl_view_model.c',
|
||||
'efl_linear_interpolator.c',
|
||||
'efl_accelerate_interpolator.c',
|
||||
'efl_decelerate_interpolator.c',
|
||||
|
|
|
@ -7,7 +7,7 @@ extern "C" {
|
|||
|
||||
#include "efl_io_manager.eo.h"
|
||||
#include "eio_sentry.eo.h"
|
||||
#include "eio_model.eo.h"
|
||||
#include "efl_io_model.eo.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -15,22 +15,22 @@
|
|||
#include "Eio.h"
|
||||
|
||||
#include "eio_private.h"
|
||||
#include "eio_model_private.h"
|
||||
#include "efl_io_model_private.h"
|
||||
|
||||
#define MY_CLASS EIO_MODEL_CLASS
|
||||
#define MY_CLASS_NAME "Eio_Model"
|
||||
#define MY_CLASS EFL_IO_MODEL_CLASS
|
||||
#define MY_CLASS_NAME "Efl_Io_Model"
|
||||
|
||||
static void _eio_model_info_free(Eio_Model_Info *info, Eina_Bool model);
|
||||
static void _eio_model_efl_model_monitor_add(Eio_Model_Data *priv);
|
||||
static void _efl_io_model_info_free(Efl_Io_Model_Info *info, Eina_Bool model);
|
||||
static void _efl_io_model_efl_model_monitor_add(Efl_Io_Model_Data *priv);
|
||||
|
||||
EINA_VALUE_STRUCT_DESC_DEFINE(_eina_file_direct_info_desc,
|
||||
NULL,
|
||||
sizeof (Eio_Model_Info),
|
||||
EINA_VALUE_STRUCT_MEMBER(EINA_VALUE_TYPE_ULONG, Eio_Model_Info, path_length),
|
||||
EINA_VALUE_STRUCT_MEMBER(EINA_VALUE_TYPE_ULONG, Eio_Model_Info, name_length),
|
||||
EINA_VALUE_STRUCT_MEMBER(EINA_VALUE_TYPE_ULONG, Eio_Model_Info, name_start),
|
||||
EINA_VALUE_STRUCT_MEMBER(EINA_VALUE_TYPE_UINT, Eio_Model_Info, type),
|
||||
EINA_VALUE_STRUCT_MEMBER(EINA_VALUE_TYPE_STRINGSHARE, Eio_Model_Info, path));
|
||||
sizeof (Efl_Io_Model_Info),
|
||||
EINA_VALUE_STRUCT_MEMBER(EINA_VALUE_TYPE_ULONG, Efl_Io_Model_Info, path_length),
|
||||
EINA_VALUE_STRUCT_MEMBER(EINA_VALUE_TYPE_ULONG, Efl_Io_Model_Info, name_length),
|
||||
EINA_VALUE_STRUCT_MEMBER(EINA_VALUE_TYPE_ULONG, Efl_Io_Model_Info, name_start),
|
||||
EINA_VALUE_STRUCT_MEMBER(EINA_VALUE_TYPE_UINT, Efl_Io_Model_Info, type),
|
||||
EINA_VALUE_STRUCT_MEMBER(EINA_VALUE_TYPE_STRINGSHARE, Efl_Io_Model_Info, path));
|
||||
/**
|
||||
* Callbacks
|
||||
* Property
|
||||
|
@ -38,7 +38,7 @@ EINA_VALUE_STRUCT_DESC_DEFINE(_eina_file_direct_info_desc,
|
|||
static void
|
||||
_eio_move_done_cb(void *data, Eio_File *handler)
|
||||
{
|
||||
Eio_Model_Data *pd = ecore_thread_local_data_find(handler->thread, ".pd");
|
||||
Efl_Io_Model_Data *pd = ecore_thread_local_data_find(handler->thread, ".pd");
|
||||
Eina_Promise *p = data;
|
||||
|
||||
// FIXME: generate events
|
||||
|
@ -50,7 +50,7 @@ _eio_move_done_cb(void *data, Eio_File *handler)
|
|||
static void
|
||||
_eio_file_error_cb(void *data, Eio_File *handler, int error)
|
||||
{
|
||||
Eio_Model_Data *pd = ecore_thread_local_data_find(handler->thread, ".pd");
|
||||
Efl_Io_Model_Data *pd = ecore_thread_local_data_find(handler->thread, ".pd");
|
||||
Eina_Promise *p = data;
|
||||
|
||||
eina_promise_reject(p, error);
|
||||
|
@ -65,10 +65,10 @@ static Eina_Bool
|
|||
_efl_model_evt_added_ecore_cb(void *data, int type, void *event)
|
||||
{
|
||||
Eio_Monitor_Event *ev = event;
|
||||
Eio_Model *obj;
|
||||
Eio_Model_Data *pd = data;
|
||||
Efl_Io_Model *obj;
|
||||
Efl_Io_Model_Data *pd = data;
|
||||
Efl_Model_Children_Event cevt;
|
||||
Eio_Model_Info *mi;
|
||||
Efl_Io_Model_Info *mi;
|
||||
Eina_List *l;
|
||||
Eina_Stringshare *spath = NULL;
|
||||
char *path = NULL;
|
||||
|
@ -92,7 +92,7 @@ _efl_model_evt_added_ecore_cb(void *data, int type, void *event)
|
|||
goto end;
|
||||
}
|
||||
|
||||
mi = calloc(1, sizeof (Eio_Model_Info));
|
||||
mi = calloc(1, sizeof (Efl_Io_Model_Info));
|
||||
if (!mi) goto end;
|
||||
|
||||
mi->path_length = eina_stringshare_strlen(spath);
|
||||
|
@ -138,11 +138,11 @@ _efl_model_evt_added_ecore_cb(void *data, int type, void *event)
|
|||
static Eina_Bool
|
||||
_efl_model_evt_deleted_ecore_cb(void *data, int type, void *event)
|
||||
{
|
||||
Eio_Model_Info *mi;
|
||||
Efl_Io_Model_Info *mi;
|
||||
Eina_List *l;
|
||||
Eio_Monitor_Event *ev = event;
|
||||
Eio_Model *obj;
|
||||
Eio_Model_Data *pd = data;
|
||||
Efl_Io_Model *obj;
|
||||
Efl_Io_Model_Data *pd = data;
|
||||
Eina_Stringshare *spath = NULL;
|
||||
Efl_Model_Children_Event cevt = { 0 };
|
||||
unsigned int i = 0;
|
||||
|
@ -179,7 +179,7 @@ _efl_model_evt_deleted_ecore_cb(void *data, int type, void *event)
|
|||
// This should trigger the object child destruction if it exist
|
||||
// resulting in the potential destruction of the child, after
|
||||
// this point mi and info might be freed.
|
||||
_eio_model_info_free(mi, EINA_FALSE);
|
||||
_efl_io_model_info_free(mi, EINA_FALSE);
|
||||
|
||||
end:
|
||||
eina_stringshare_del(spath);
|
||||
|
@ -192,9 +192,9 @@ _efl_model_evt_deleted_ecore_cb(void *data, int type, void *event)
|
|||
* Child Del
|
||||
*/
|
||||
static void
|
||||
_eio_del_cleanup(Eio_Model *obj)
|
||||
_eio_del_cleanup(Efl_Io_Model *obj)
|
||||
{
|
||||
Eio_Model_Data *pd = efl_data_scope_get(obj, EIO_MODEL_CLASS);
|
||||
Efl_Io_Model_Data *pd = efl_data_scope_get(obj, EFL_IO_MODEL_CLASS);
|
||||
|
||||
pd->request.del = NULL;
|
||||
efl_unref(obj);
|
||||
|
@ -203,7 +203,7 @@ _eio_del_cleanup(Eio_Model *obj)
|
|||
static void
|
||||
_eio_done_unlink_cb(void *data, Eio_File *handler EINA_UNUSED)
|
||||
{
|
||||
Eio_Model *child = data;
|
||||
Efl_Io_Model *child = data;
|
||||
|
||||
_eio_del_cleanup(child);
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ _eio_done_unlink_cb(void *data, Eio_File *handler EINA_UNUSED)
|
|||
static void
|
||||
_eio_error_unlink_cb(void *data, Eio_File *handler EINA_UNUSED, int error)
|
||||
{
|
||||
Eio_Model *child = data;
|
||||
Efl_Io_Model *child = data;
|
||||
|
||||
ERR("%d: %s.", error, strerror(error));
|
||||
|
||||
|
@ -219,7 +219,7 @@ _eio_error_unlink_cb(void *data, Eio_File *handler EINA_UNUSED, int error)
|
|||
}
|
||||
|
||||
static void
|
||||
_eio_model_info_free(Eio_Model_Info *info, Eina_Bool model)
|
||||
_efl_io_model_info_free(Efl_Io_Model_Info *info, Eina_Bool model)
|
||||
{
|
||||
if (!info) return ;
|
||||
|
||||
|
@ -246,7 +246,7 @@ _eio_model_info_free(Eio_Model_Info *info, Eina_Bool model)
|
|||
}
|
||||
|
||||
static Eina_File_Type
|
||||
_eio_model_info_type_get(const Eina_File_Direct_Info *info, const Eina_Stat *st)
|
||||
_efl_io_model_info_type_get(const Eina_File_Direct_Info *info, const Eina_Stat *st)
|
||||
{
|
||||
if (info && info->type != EINA_FILE_UNKNOWN)
|
||||
return info->type;
|
||||
|
@ -273,13 +273,13 @@ _eio_model_info_type_get(const Eina_File_Direct_Info *info, const Eina_Stat *st)
|
|||
}
|
||||
|
||||
static void
|
||||
_eio_model_info_build(const Eio_Model *model, Eio_Model_Data *pd)
|
||||
_efl_io_model_info_build(const Efl_Io_Model *model, Efl_Io_Model_Data *pd)
|
||||
{
|
||||
char *path;
|
||||
|
||||
if (pd->info) goto end;
|
||||
|
||||
pd->info = calloc(1, sizeof (Eio_Model_Info));
|
||||
pd->info = calloc(1, sizeof (Efl_Io_Model_Info));
|
||||
if (!pd->info) return ;
|
||||
|
||||
pd->info->path_length = eina_stringshare_strlen(pd->path);
|
||||
|
@ -290,7 +290,7 @@ _eio_model_info_build(const Eio_Model *model, Eio_Model_Data *pd)
|
|||
pd->info->name_length = pd->info->path_length - pd->info->name_start;
|
||||
free(path);
|
||||
|
||||
pd->info->type = _eio_model_info_type_get(NULL, pd->st);
|
||||
pd->info->type = _efl_io_model_info_type_get(NULL, pd->st);
|
||||
|
||||
efl_model_properties_changed(model, "direct_info");
|
||||
|
||||
|
@ -301,8 +301,8 @@ _eio_model_info_build(const Eio_Model *model, Eio_Model_Data *pd)
|
|||
static void
|
||||
_eio_build_st_done(void *data, Eio_File *handler EINA_UNUSED, const Eina_Stat *stat)
|
||||
{
|
||||
Eio_Model *model = data;
|
||||
Eio_Model_Data *pd = efl_data_scope_get(model, EIO_MODEL_CLASS);
|
||||
Efl_Io_Model *model = data;
|
||||
Efl_Io_Model_Data *pd = efl_data_scope_get(model, EFL_IO_MODEL_CLASS);
|
||||
|
||||
if (!pd) return ;
|
||||
pd->request.stat = NULL;
|
||||
|
@ -312,16 +312,16 @@ _eio_build_st_done(void *data, Eio_File *handler EINA_UNUSED, const Eina_Stat *s
|
|||
|
||||
memcpy(pd->st, stat, sizeof (Eina_Stat));
|
||||
|
||||
if (!pd->info) _eio_model_info_build(model, pd);
|
||||
if (!pd->info) _efl_io_model_info_build(model, pd);
|
||||
if (pd->info->type == EINA_FILE_UNKNOWN)
|
||||
pd->info->type = _eio_model_info_type_get(NULL, stat);
|
||||
pd->info->type = _efl_io_model_info_type_get(NULL, stat);
|
||||
|
||||
efl_model_properties_changed(model, "mtime", "atime", "ctime", "is_dir", "is_lnk", "size", "stat");
|
||||
|
||||
if (eio_file_is_dir(pd->st))
|
||||
{
|
||||
// Now that we know we are a directory, we should whatch it
|
||||
_eio_model_efl_model_monitor_add(pd);
|
||||
_efl_io_model_efl_model_monitor_add(pd);
|
||||
|
||||
// And start listing its child
|
||||
efl_model_children_count_get(model);
|
||||
|
@ -333,8 +333,8 @@ _eio_build_st_done(void *data, Eio_File *handler EINA_UNUSED, const Eina_Stat *s
|
|||
static void
|
||||
_eio_build_st_done_clobber(void *data, Eio_File *handler, const Eina_Stat *stat)
|
||||
{
|
||||
Eio_Model *model = data;
|
||||
Eio_Model *parent;
|
||||
Efl_Io_Model *model = data;
|
||||
Efl_Io_Model *parent;
|
||||
|
||||
efl_ref(model);
|
||||
_eio_build_st_done(data, handler, stat);
|
||||
|
@ -346,8 +346,8 @@ _eio_build_st_done_clobber(void *data, Eio_File *handler, const Eina_Stat *stat)
|
|||
static void
|
||||
_eio_build_st_error(void *data, Eio_File *handler EINA_UNUSED, int error)
|
||||
{
|
||||
Eio_Model *model = data;
|
||||
Eio_Model_Data *pd = efl_data_scope_get(model, EIO_MODEL_CLASS);
|
||||
Efl_Io_Model *model = data;
|
||||
Efl_Io_Model_Data *pd = efl_data_scope_get(model, EFL_IO_MODEL_CLASS);
|
||||
|
||||
pd->request.stat = NULL;
|
||||
pd->error = error;
|
||||
|
@ -360,8 +360,8 @@ _eio_build_st_error(void *data, Eio_File *handler EINA_UNUSED, int error)
|
|||
static void
|
||||
_eio_build_st_error_clobber(void *data, Eio_File *handler, int error)
|
||||
{
|
||||
Eio_Model *model = data;
|
||||
Eio_Model *parent;
|
||||
Efl_Io_Model *model = data;
|
||||
Efl_Io_Model *parent;
|
||||
|
||||
efl_ref(model);
|
||||
_eio_build_st_error(data, handler, error);
|
||||
|
@ -371,7 +371,7 @@ _eio_build_st_error_clobber(void *data, Eio_File *handler, int error)
|
|||
}
|
||||
|
||||
static void
|
||||
_eio_build_st(const Eio_Model *model, Eio_Model_Data *pd)
|
||||
_eio_build_st(const Efl_Io_Model *model, Efl_Io_Model_Data *pd)
|
||||
{
|
||||
if (pd->st) return ;
|
||||
if (pd->request.stat) return ;
|
||||
|
@ -381,7 +381,7 @@ _eio_build_st(const Eio_Model *model, Eio_Model_Data *pd)
|
|||
}
|
||||
|
||||
static void
|
||||
_eio_build_st_then_clobber(const Eio_Model *model, Eio_Model_Data *pd)
|
||||
_eio_build_st_then_clobber(const Efl_Io_Model *model, Efl_Io_Model_Data *pd)
|
||||
{
|
||||
if (pd->st) return ;
|
||||
if (pd->request.stat) return ;
|
||||
|
@ -415,7 +415,7 @@ _cancel_request(Eo *model EINA_UNUSED, void *data, Eina_Error error)
|
|||
}
|
||||
|
||||
static Eina_Future *
|
||||
_build_delay(Eio_Model *model)
|
||||
_build_delay(Efl_Io_Model *model)
|
||||
{
|
||||
Eina_Promise *p;
|
||||
|
||||
|
@ -437,7 +437,7 @@ _build_delay(Eio_Model *model)
|
|||
}
|
||||
|
||||
static void
|
||||
_eio_build_mime_clean(Eio_Model_Data *pd)
|
||||
_eio_build_mime_clean(Efl_Io_Model_Data *pd)
|
||||
{
|
||||
efl_wref_del(pd->loop, &pd->loop);
|
||||
pd->loop = NULL;
|
||||
|
@ -447,8 +447,8 @@ _eio_build_mime_clean(Eio_Model_Data *pd)
|
|||
static Eina_Value
|
||||
_eio_build_mime_now(void *data, const Eina_Value v, const Eina_Future *dead_future EINA_UNUSED)
|
||||
{
|
||||
Eio_Model *model = data;
|
||||
Eio_Model_Data *pd = efl_data_scope_get(model, EIO_MODEL_CLASS);
|
||||
Efl_Io_Model *model = data;
|
||||
Efl_Io_Model_Data *pd = efl_data_scope_get(model, EFL_IO_MODEL_CLASS);
|
||||
|
||||
if (v.type == EINA_VALUE_TYPE_ERROR) goto on_error;
|
||||
if (!pd->loop) goto on_error;
|
||||
|
@ -476,7 +476,7 @@ _eio_build_mime_now(void *data, const Eina_Value v, const Eina_Future *dead_futu
|
|||
}
|
||||
|
||||
static void
|
||||
_eio_build_mime(const Efl_Object *model, Eio_Model_Data *pd)
|
||||
_eio_build_mime(const Efl_Object *model, Efl_Io_Model_Data *pd)
|
||||
{
|
||||
Eina_Future *f;
|
||||
|
||||
|
@ -491,24 +491,24 @@ _eio_build_mime(const Efl_Object *model, Eio_Model_Data *pd)
|
|||
}
|
||||
|
||||
static Eina_Value *
|
||||
_property_filename_cb(const Eo *obj, Eio_Model_Data *pd)
|
||||
_property_filename_cb(const Eo *obj, Efl_Io_Model_Data *pd)
|
||||
{
|
||||
_eio_model_info_build(obj, pd);
|
||||
_efl_io_model_info_build(obj, pd);
|
||||
if (pd->info)
|
||||
return eina_value_string_new(pd->info->path + pd->info->name_start);
|
||||
return eina_value_error_new(EAGAIN);
|
||||
}
|
||||
|
||||
static Eina_Value *
|
||||
_property_path_cb(const Eo *obj EINA_UNUSED, Eio_Model_Data *pd)
|
||||
_property_path_cb(const Eo *obj EINA_UNUSED, Efl_Io_Model_Data *pd)
|
||||
{
|
||||
return eina_value_string_new(pd->path);
|
||||
}
|
||||
|
||||
static Eina_Value *
|
||||
_property_direct_info_cb(const Eo *obj, Eio_Model_Data *pd)
|
||||
_property_direct_info_cb(const Eo *obj, Efl_Io_Model_Data *pd)
|
||||
{
|
||||
_eio_model_info_build(obj, pd);
|
||||
_efl_io_model_info_build(obj, pd);
|
||||
|
||||
if (pd->info)
|
||||
{
|
||||
|
@ -531,7 +531,7 @@ _property_direct_info_cb(const Eo *obj, Eio_Model_Data *pd)
|
|||
|
||||
#define TIMECB(Prop) \
|
||||
static Eina_Value * \
|
||||
_property_##Prop##_cb(const Eo *obj, Eio_Model_Data *pd) \
|
||||
_property_##Prop##_cb(const Eo *obj, Efl_Io_Model_Data *pd) \
|
||||
{ \
|
||||
if (pd->st) \
|
||||
return eina_value_time_new(pd->st->Prop); \
|
||||
|
@ -547,7 +547,7 @@ TIMECB(atime);
|
|||
TIMECB(ctime);
|
||||
|
||||
static Eina_Value *
|
||||
_property_is_dir_cb(const Eo *obj, Eio_Model_Data *pd)
|
||||
_property_is_dir_cb(const Eo *obj, Efl_Io_Model_Data *pd)
|
||||
{
|
||||
if (pd->st)
|
||||
return eina_value_bool_new(eio_file_is_dir(pd->st));
|
||||
|
@ -559,7 +559,7 @@ _property_is_dir_cb(const Eo *obj, Eio_Model_Data *pd)
|
|||
}
|
||||
|
||||
static Eina_Value *
|
||||
_property_is_lnk_cb(const Eo *obj, Eio_Model_Data *pd)
|
||||
_property_is_lnk_cb(const Eo *obj, Efl_Io_Model_Data *pd)
|
||||
{
|
||||
if (pd->st)
|
||||
return eina_value_bool_new(eio_file_is_lnk(pd->st));
|
||||
|
@ -571,7 +571,7 @@ _property_is_lnk_cb(const Eo *obj, Eio_Model_Data *pd)
|
|||
}
|
||||
|
||||
static Eina_Value *
|
||||
_property_size_cb(const Eo *obj, Eio_Model_Data *pd)
|
||||
_property_size_cb(const Eo *obj, Efl_Io_Model_Data *pd)
|
||||
{
|
||||
if (pd->st)
|
||||
return eina_value_ulong_new(pd->st->size);
|
||||
|
@ -583,7 +583,7 @@ _property_size_cb(const Eo *obj, Eio_Model_Data *pd)
|
|||
}
|
||||
|
||||
static Eina_Value *
|
||||
_property_stat_cb(const Eo *obj, Eio_Model_Data *pd)
|
||||
_property_stat_cb(const Eo *obj, Efl_Io_Model_Data *pd)
|
||||
{
|
||||
if (pd->st)
|
||||
{
|
||||
|
@ -607,7 +607,7 @@ _property_stat_cb(const Eo *obj, Eio_Model_Data *pd)
|
|||
}
|
||||
|
||||
static Eina_Value *
|
||||
_property_mime_type_cb(const Eo *obj, Eio_Model_Data *pd)
|
||||
_property_mime_type_cb(const Eo *obj, Efl_Io_Model_Data *pd)
|
||||
{
|
||||
if (pd->mime_type)
|
||||
return eina_value_string_new(pd->mime_type);
|
||||
|
@ -621,7 +621,7 @@ _property_mime_type_cb(const Eo *obj, Eio_Model_Data *pd)
|
|||
|
||||
static struct {
|
||||
const char *name;
|
||||
Eina_Value *(*cb)(const Eo *obj, Eio_Model_Data *pd);
|
||||
Eina_Value *(*cb)(const Eo *obj, Efl_Io_Model_Data *pd);
|
||||
} properties[] = {
|
||||
PP(filename), PP(path),
|
||||
PP(direct_info),
|
||||
|
@ -634,14 +634,14 @@ static struct {
|
|||
* Interfaces impl.
|
||||
*/
|
||||
static Eina_Iterator *
|
||||
_eio_model_efl_model_properties_get(const Eo *obj EINA_UNUSED,
|
||||
Eio_Model_Data *pd EINA_UNUSED)
|
||||
_efl_io_model_efl_model_properties_get(const Eo *obj EINA_UNUSED,
|
||||
Efl_Io_Model_Data *pd EINA_UNUSED)
|
||||
{
|
||||
return EINA_C_ARRAY_ITERATOR_NEW(properties);
|
||||
}
|
||||
|
||||
static Eina_Value *
|
||||
_eio_model_efl_model_property_get(const Eo *obj, Eio_Model_Data *pd, const char *property)
|
||||
_efl_io_model_efl_model_property_get(const Eo *obj, Efl_Io_Model_Data *pd, const char *property)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
|
@ -655,13 +655,13 @@ _eio_model_efl_model_property_get(const Eo *obj, Eio_Model_Data *pd, const char
|
|||
|
||||
ERR("Could not find property '%s'.", property);
|
||||
// Unknow value request
|
||||
return efl_model_property_get(efl_super(obj, EIO_MODEL_CLASS), property);
|
||||
return efl_model_property_get(efl_super(obj, EFL_IO_MODEL_CLASS), property);
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_eio_model_efl_model_property_set(Eo *obj,
|
||||
Eio_Model_Data *pd,
|
||||
const char *property, Eina_Value *value)
|
||||
_efl_io_model_efl_model_property_set(Eo *obj,
|
||||
Efl_Io_Model_Data *pd,
|
||||
const char *property, Eina_Value *value)
|
||||
{
|
||||
const char *path;
|
||||
Eina_Future *f;
|
||||
|
@ -710,21 +710,21 @@ _eio_model_efl_model_property_set(Eo *obj,
|
|||
}
|
||||
|
||||
static void
|
||||
_eio_model_children_list(void *data, Eina_Array *entries)
|
||||
_efl_io_model_children_list(void *data, Eina_Array *entries)
|
||||
{
|
||||
Eina_File_Direct_Info *info;
|
||||
Efl_Model *obj = data;
|
||||
Eio_Model_Data *pd;
|
||||
Efl_Io_Model_Data *pd;
|
||||
Efl_Model_Children_Event cevt = { 0 };
|
||||
Eina_Array_Iterator iterator;
|
||||
unsigned int i;
|
||||
|
||||
pd = efl_data_scope_get(obj, EIO_MODEL_CLASS);
|
||||
pd = efl_data_scope_get(obj, EFL_IO_MODEL_CLASS);
|
||||
if (!pd) return ;
|
||||
|
||||
EINA_ARRAY_ITER_NEXT(entries, i, info, iterator)
|
||||
{
|
||||
Eio_Model_Info *mi;
|
||||
Efl_Io_Model_Info *mi;
|
||||
|
||||
if (pd->filter.cb)
|
||||
{
|
||||
|
@ -732,7 +732,7 @@ _eio_model_children_list(void *data, Eina_Array *entries)
|
|||
continue ;
|
||||
}
|
||||
|
||||
mi = calloc(1, sizeof (Eio_Model_Info));
|
||||
mi = calloc(1, sizeof (Efl_Io_Model_Info));
|
||||
if (!mi) continue ;
|
||||
|
||||
mi->path_length = info->path_length;
|
||||
|
@ -740,7 +740,7 @@ _eio_model_children_list(void *data, Eina_Array *entries)
|
|||
|
||||
mi->name_start = info->name_start;
|
||||
mi->name_length = info->name_length;
|
||||
mi->type = _eio_model_info_type_get(info, NULL);
|
||||
mi->type = _efl_io_model_info_type_get(info, NULL);
|
||||
mi->parent_ref = EINA_TRUE;
|
||||
|
||||
cevt.index = eina_list_count(pd->files);
|
||||
|
@ -755,17 +755,17 @@ _eio_model_children_list(void *data, Eina_Array *entries)
|
|||
}
|
||||
|
||||
static Eina_Value
|
||||
_eio_model_children_list_on(void *data, const Eina_Value v,
|
||||
const Eina_Future *dead EINA_UNUSED)
|
||||
_efl_io_model_children_list_on(void *data, const Eina_Value v,
|
||||
const Eina_Future *dead EINA_UNUSED)
|
||||
{
|
||||
Eio_Model_Data *pd = data;
|
||||
Efl_Io_Model_Data *pd = data;
|
||||
|
||||
pd->request.listing = NULL;
|
||||
pd->listed = EINA_TRUE;
|
||||
|
||||
// Now that we have listed the content of the directory,
|
||||
// we can whatch over it
|
||||
_eio_model_efl_model_monitor_add(pd);
|
||||
_efl_io_model_efl_model_monitor_add(pd);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
@ -774,7 +774,7 @@ _eio_model_children_list_on(void *data, const Eina_Value v,
|
|||
* Children Count Get
|
||||
*/
|
||||
static unsigned int
|
||||
_eio_model_efl_model_children_count_get(const Eo *obj, Eio_Model_Data *pd)
|
||||
_efl_io_model_efl_model_children_count_get(const Eo *obj, Efl_Io_Model_Data *pd)
|
||||
{
|
||||
// If we have no information on the object, let's build it.
|
||||
if (efl_invalidated_get(obj))
|
||||
|
@ -800,8 +800,8 @@ _eio_model_efl_model_children_count_get(const Eo *obj, Eio_Model_Data *pd)
|
|||
}
|
||||
|
||||
f = efl_io_manager_direct_ls(iom, pd->path, EINA_FALSE,
|
||||
(void*) obj, _eio_model_children_list, NULL);
|
||||
f = eina_future_then(f, _eio_model_children_list_on, pd, NULL);
|
||||
(void*) obj, _efl_io_model_children_list, NULL);
|
||||
f = eina_future_then(f, _efl_io_model_children_list_on, pd, NULL);
|
||||
pd->request.listing = efl_future_then(obj, f);
|
||||
}
|
||||
|
||||
|
@ -809,7 +809,7 @@ _eio_model_efl_model_children_count_get(const Eo *obj, Eio_Model_Data *pd)
|
|||
}
|
||||
|
||||
static void
|
||||
_eio_model_efl_model_monitor_add(Eio_Model_Data *priv)
|
||||
_efl_io_model_efl_model_monitor_add(Efl_Io_Model_Data *priv)
|
||||
{
|
||||
if (!priv->monitor)
|
||||
{
|
||||
|
@ -828,7 +828,7 @@ _eio_model_efl_model_monitor_add(Eio_Model_Data *priv)
|
|||
}
|
||||
|
||||
static void
|
||||
_eio_model_efl_model_monitor_del(Eio_Model_Data *priv)
|
||||
_efl_io_model_efl_model_monitor_del(Efl_Io_Model_Data *priv)
|
||||
{
|
||||
if (priv->monitor)
|
||||
{
|
||||
|
@ -849,8 +849,8 @@ _eio_model_efl_model_monitor_del(Eio_Model_Data *priv)
|
|||
* Children Load
|
||||
*/
|
||||
static void
|
||||
_eio_model_children_filter_set(Eo *obj EINA_UNUSED, Eio_Model_Data *pd,
|
||||
void *filter_data, EflIoFilter filter, Eina_Free_Cb filter_free_cb)
|
||||
_efl_io_model_children_filter_set(Eo *obj EINA_UNUSED, Efl_Io_Model_Data *pd,
|
||||
void *filter_data, EflIoFilter filter, Eina_Free_Cb filter_free_cb)
|
||||
{
|
||||
pd->filter.data = filter_data;
|
||||
pd->filter.cb = filter;
|
||||
|
@ -861,7 +861,7 @@ _eio_model_children_filter_set(Eo *obj EINA_UNUSED, Eio_Model_Data *pd,
|
|||
* Child Add
|
||||
*/
|
||||
static Eo *
|
||||
_eio_model_efl_model_child_add(Eo *obj EINA_UNUSED, Eio_Model_Data *priv EINA_UNUSED)
|
||||
_efl_io_model_efl_model_child_add(Eo *obj EINA_UNUSED, Efl_Io_Model_Data *priv EINA_UNUSED)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
@ -870,11 +870,11 @@ _eio_model_efl_model_child_add(Eo *obj EINA_UNUSED, Eio_Model_Data *priv EINA_UN
|
|||
* Child Remove
|
||||
*/
|
||||
static void
|
||||
_eio_model_efl_model_child_del(Eo *obj EINA_UNUSED,
|
||||
Eio_Model_Data *priv EINA_UNUSED,
|
||||
Eo *child)
|
||||
_efl_io_model_efl_model_child_del(Eo *obj EINA_UNUSED,
|
||||
Efl_Io_Model_Data *priv EINA_UNUSED,
|
||||
Eo *child)
|
||||
{
|
||||
Eio_Model_Data *child_pd;
|
||||
Efl_Io_Model_Data *child_pd;
|
||||
Eina_File_Type type;
|
||||
|
||||
child_pd = efl_data_scope_get(child, MY_CLASS);
|
||||
|
@ -917,8 +917,8 @@ _eio_model_efl_model_child_del(Eo *obj EINA_UNUSED,
|
|||
* Children Slice Get
|
||||
*/
|
||||
static Eina_Future *
|
||||
_eio_model_efl_model_children_slice_get(Eo *obj, Eio_Model_Data *pd,
|
||||
unsigned int start, unsigned int count)
|
||||
_efl_io_model_efl_model_children_slice_get(Eo *obj, Efl_Io_Model_Data *pd,
|
||||
unsigned int start, unsigned int count)
|
||||
{
|
||||
Eina_Future_Scheduler *scheduler = NULL;
|
||||
Eina_Value array = EINA_VALUE_EMPTY;
|
||||
|
@ -944,15 +944,15 @@ _eio_model_efl_model_children_slice_get(Eo *obj, Eio_Model_Data *pd,
|
|||
|
||||
while (count > 0)
|
||||
{
|
||||
Eio_Model_Info *info = eina_list_data_get(ls);
|
||||
Eio_Model_Data *child_data = NULL;
|
||||
Efl_Io_Model_Info *info = eina_list_data_get(ls);
|
||||
Efl_Io_Model_Data *child_data = NULL;
|
||||
|
||||
info->child_ref = EINA_TRUE;
|
||||
|
||||
if (info->object == NULL)
|
||||
// Little trick here, setting internal data before finalize
|
||||
info->object = efl_add(EIO_MODEL_CLASS, obj,
|
||||
child_data = efl_data_scope_get(efl_added, EIO_MODEL_CLASS),
|
||||
info->object = efl_add(EFL_IO_MODEL_CLASS, obj,
|
||||
child_data = efl_data_scope_get(efl_added, EFL_IO_MODEL_CLASS),
|
||||
child_data->info = info,
|
||||
child_data->path = eina_stringshare_ref(info->path),
|
||||
child_data->parent = ls,
|
||||
|
@ -973,7 +973,7 @@ _eio_model_efl_model_children_slice_get(Eo *obj, Eio_Model_Data *pd,
|
|||
* Class definitions
|
||||
*/
|
||||
static Efl_Object *
|
||||
_eio_model_efl_object_finalize(Eo *obj, Eio_Model_Data *pd)
|
||||
_efl_io_model_efl_object_finalize(Eo *obj, Efl_Io_Model_Data *pd)
|
||||
{
|
||||
if (!pd->path) return NULL;
|
||||
if (!efl_provider_find(obj, EFL_LOOP_CLASS))
|
||||
|
@ -999,7 +999,7 @@ _eio_model_efl_object_finalize(Eo *obj, Eio_Model_Data *pd)
|
|||
}
|
||||
|
||||
static void
|
||||
_eio_model_path_set(Eo *obj EINA_UNUSED, Eio_Model_Data *priv, const char *path)
|
||||
_efl_io_model_path_set(Eo *obj EINA_UNUSED, Efl_Io_Model_Data *priv, const char *path)
|
||||
{
|
||||
char *sanitized = eina_file_path_sanitize(path);
|
||||
priv->path = eina_stringshare_add(sanitized);
|
||||
|
@ -1007,21 +1007,21 @@ _eio_model_path_set(Eo *obj EINA_UNUSED, Eio_Model_Data *priv, const char *path)
|
|||
}
|
||||
|
||||
static const char *
|
||||
_eio_model_path_get(const Eo *obj EINA_UNUSED, Eio_Model_Data *priv)
|
||||
_efl_io_model_path_get(const Eo *obj EINA_UNUSED, Efl_Io_Model_Data *priv)
|
||||
{
|
||||
return priv->path;
|
||||
}
|
||||
|
||||
static void
|
||||
_eio_model_efl_object_destructor(Eo *obj , Eio_Model_Data *priv)
|
||||
_efl_io_model_efl_object_destructor(Eo *obj , Efl_Io_Model_Data *priv)
|
||||
{
|
||||
Eio_Model_Info *info;
|
||||
Efl_Io_Model_Info *info;
|
||||
|
||||
_eio_model_info_free(priv->info, EINA_TRUE);
|
||||
_efl_io_model_info_free(priv->info, EINA_TRUE);
|
||||
priv->info = NULL;
|
||||
|
||||
EINA_LIST_FREE(priv->files, info)
|
||||
_eio_model_info_free(info, EINA_FALSE);
|
||||
_efl_io_model_info_free(info, EINA_FALSE);
|
||||
|
||||
eina_stringshare_del(priv->path);
|
||||
|
||||
|
@ -1029,9 +1029,9 @@ _eio_model_efl_object_destructor(Eo *obj , Eio_Model_Data *priv)
|
|||
}
|
||||
|
||||
static void
|
||||
_eio_model_efl_object_invalidate(Eo *obj , Eio_Model_Data *priv)
|
||||
_efl_io_model_efl_object_invalidate(Eo *obj , Efl_Io_Model_Data *priv)
|
||||
{
|
||||
_eio_model_efl_model_monitor_del(priv);
|
||||
_efl_io_model_efl_model_monitor_del(priv);
|
||||
|
||||
// Unlink the object from the parent
|
||||
if (priv->info) priv->info->object = NULL;
|
||||
|
@ -1060,7 +1060,7 @@ _eio_model_efl_object_invalidate(Eo *obj , Eio_Model_Data *priv)
|
|||
}
|
||||
}
|
||||
|
||||
efl_invalidate(efl_super(obj, EIO_MODEL_CLASS));
|
||||
efl_invalidate(efl_super(obj, EFL_IO_MODEL_CLASS));
|
||||
}
|
||||
|
||||
#include "eio_model.eo.c"
|
||||
#include "efl_io_model.eo.c"
|
|
@ -3,15 +3,15 @@ import eina_types;
|
|||
function EflIoFilter {
|
||||
[[EflIoFilter function]]
|
||||
params {
|
||||
@in model: Eio.Model;
|
||||
@in model: Efl.Io.Model;
|
||||
@in entry: ptr(Eina.File_Direct_Info);
|
||||
}
|
||||
return: int;
|
||||
};
|
||||
|
||||
class Eio.Model extends Efl.Model_Loop
|
||||
class Efl.Io.Model extends Efl.Loop_Model
|
||||
{
|
||||
[[Eio model class]]
|
||||
[[Efl Io model class]]
|
||||
|
||||
methods {
|
||||
children_filter_set {
|
|
@ -1,13 +1,13 @@
|
|||
#ifndef _EIO_MODEL_PRIVATE_H
|
||||
#define _EIO_MODEL_PRIVATE_H
|
||||
#ifndef _EFL_IO_MODEL_PRIVATE_H
|
||||
#define _EFL_IO_MODEL_PRIVATE_H
|
||||
|
||||
#define PROP_LIST_SIZE 8
|
||||
|
||||
typedef struct _Eio_Model_Data Eio_Model_Data;
|
||||
typedef struct _Eio_Model_Info Eio_Model_Info;
|
||||
typedef struct _Efl_Io_Model_Data Efl_Io_Model_Data;
|
||||
typedef struct _Efl_Io_Model_Info Efl_Io_Model_Info;
|
||||
|
||||
typedef struct _Eio_Model_Monitor_Data Eio_Model_Monitor_Data;
|
||||
struct _Eio_Model_Monitor_Data
|
||||
typedef struct _Efl_Io_Model_Monitor_Data Efl_Io_Model_Monitor_Data;
|
||||
struct _Efl_Io_Model_Monitor_Data
|
||||
{
|
||||
Ecore_Event_Handler *ecore_child_add_handler[3];
|
||||
Ecore_Event_Handler *ecore_child_del_handler[3];
|
||||
|
@ -18,7 +18,7 @@ struct _Eio_Model_Monitor_Data
|
|||
// FIXME: Would be more efficient to introduce an Eina_Path that assemble
|
||||
// an array of stringshare instead of using one mega stringshare directly.
|
||||
|
||||
struct _Eio_Model_Info
|
||||
struct _Efl_Io_Model_Info
|
||||
{
|
||||
Eina_Stringshare *path;
|
||||
Eo *object;
|
||||
|
@ -33,14 +33,14 @@ struct _Eio_Model_Info
|
|||
Eina_Bool child_ref : 1;
|
||||
};
|
||||
|
||||
struct _Eio_Model_Data
|
||||
struct _Efl_Io_Model_Data
|
||||
{
|
||||
Efl_Loop *loop;
|
||||
Eio_Model *self;
|
||||
Efl_Io_Model *self;
|
||||
|
||||
Eina_Stringshare *path;
|
||||
|
||||
Eio_Model_Info *info;
|
||||
Efl_Io_Model_Info *info;
|
||||
Eina_Stat *st;
|
||||
const char *mime_type;
|
||||
|
||||
|
@ -58,12 +58,12 @@ struct _Eio_Model_Data
|
|||
void *data;
|
||||
} filter;
|
||||
|
||||
Eio_Model_Monitor_Data mon;
|
||||
Efl_Io_Model_Monitor_Data mon;
|
||||
|
||||
Eio_Monitor *monitor; // Notification stuff
|
||||
// FIXME: would be interesting to figure a more efficient structure for holding files
|
||||
Eina_List *parent;
|
||||
Eina_List *files; // Eio_Model_Info
|
||||
Eina_List *files; // Efl_Io_Model_Info
|
||||
|
||||
Eina_Error error;
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
pub_eo_file_target = []
|
||||
|
||||
pub_eo_files = [
|
||||
'eio_model.eo',
|
||||
'efl_io_model.eo',
|
||||
'efl_io_manager.eo',
|
||||
'eio_sentry.eo'
|
||||
]
|
||||
|
@ -44,8 +44,8 @@ eio_src = [
|
|||
'eio_monitor_poll.c',
|
||||
'eio_single.c',
|
||||
'eio_xattr.c',
|
||||
'eio_model.c',
|
||||
'eio_model_private.h',
|
||||
'efl_io_model.c',
|
||||
'efl_io_model_private.h',
|
||||
'eio_private.h',
|
||||
'eio_sentry_private.h'
|
||||
]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import eldbus_types;
|
||||
|
||||
class Eldbus.Model extends Efl.Model_Loop {
|
||||
class Eldbus.Model extends Efl.Loop_Model {
|
||||
methods {
|
||||
connect {
|
||||
[[Define connection parameters.
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
// it only compute the average size of an item and answer for that property alone.
|
||||
|
||||
// FIXME: handle child being removed
|
||||
typedef struct _Efl_Ui_Model_Average_Data Efl_Ui_Model_Average_Data;
|
||||
struct _Efl_Ui_Model_Average_Data
|
||||
typedef struct _Efl_Ui_Average_Model_Data Efl_Ui_Average_Model_Data;
|
||||
struct _Efl_Ui_Average_Model_Data
|
||||
{
|
||||
Efl_Ui_Model_Average_Data *parent;
|
||||
Efl_Ui_Average_Model_Data *parent;
|
||||
|
||||
struct {
|
||||
unsigned long long width;
|
||||
|
@ -25,8 +25,8 @@ struct _Efl_Ui_Model_Average_Data
|
|||
Eina_Bool hseen : 1;
|
||||
};
|
||||
|
||||
typedef struct _Efl_Ui_Model_Average_Update Efl_Ui_Model_Average_Update;
|
||||
struct _Efl_Ui_Model_Average_Update
|
||||
typedef struct _Efl_Ui_Average_Model_Update Efl_Ui_Average_Model_Update;
|
||||
struct _Efl_Ui_Average_Model_Update
|
||||
{
|
||||
unsigned long long *total;
|
||||
unsigned long long *seen;
|
||||
|
@ -34,9 +34,9 @@ struct _Efl_Ui_Model_Average_Update
|
|||
};
|
||||
|
||||
static Eina_Value
|
||||
_efl_ui_model_average_update(Eo *obj EINA_UNUSED, void *data, const Eina_Value v)
|
||||
_efl_ui_average_model_update(Eo *obj EINA_UNUSED, void *data, const Eina_Value v)
|
||||
{
|
||||
Efl_Ui_Model_Average_Update *request = data;
|
||||
Efl_Ui_Average_Model_Update *request = data;
|
||||
unsigned int now;
|
||||
|
||||
if (!eina_value_uint_convert(&v, &now))
|
||||
|
@ -50,21 +50,21 @@ _efl_ui_model_average_update(Eo *obj EINA_UNUSED, void *data, const Eina_Value v
|
|||
}
|
||||
|
||||
static void
|
||||
_efl_ui_model_average_clean(Eo *obj EINA_UNUSED, void *data, const Eina_Future *dead_future EINA_UNUSED)
|
||||
_efl_ui_average_model_clean(Eo *obj EINA_UNUSED, void *data, const Eina_Future *dead_future EINA_UNUSED)
|
||||
{
|
||||
free(data);
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_ui_model_average_prepare(Eo *obj,
|
||||
_efl_ui_average_model_prepare(Eo *obj,
|
||||
unsigned long long *total, unsigned long long *seen,
|
||||
const char *property, Eina_Value *value)
|
||||
{
|
||||
Efl_Ui_Model_Average_Update *update;
|
||||
Efl_Ui_Average_Model_Update *update;
|
||||
Eina_Value *previous;
|
||||
Eina_Future *f;
|
||||
|
||||
update = calloc(1, sizeof (Efl_Ui_Model_Average_Update));
|
||||
update = calloc(1, sizeof (Efl_Ui_Average_Model_Update));
|
||||
if (!update) return efl_loop_future_rejected(obj, ENOMEM);
|
||||
|
||||
previous = efl_model_property_get(obj, property);
|
||||
|
@ -85,11 +85,11 @@ _efl_ui_model_average_prepare(Eo *obj,
|
|||
update->seen = seen;
|
||||
|
||||
// We have to make the change after we fetch the old value, otherwise, well, no old value left
|
||||
f = efl_model_property_set(efl_super(obj, EFL_UI_MODEL_AVERAGE_CLASS), property, value);
|
||||
f = efl_model_property_set(efl_super(obj, EFL_UI_AVERAGE_MODEL_CLASS), property, value);
|
||||
|
||||
return efl_future_then(obj, f,
|
||||
.success = _efl_ui_model_average_update,
|
||||
.free = _efl_ui_model_average_clean,
|
||||
.success = _efl_ui_average_model_update,
|
||||
.free = _efl_ui_average_model_clean,
|
||||
.data = update);
|
||||
on_error:
|
||||
eina_value_free(previous);
|
||||
|
@ -98,7 +98,7 @@ _efl_ui_model_average_prepare(Eo *obj,
|
|||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_ui_model_average_efl_model_property_set(Eo *obj, Efl_Ui_Model_Average_Data *pd, const char *property, Eina_Value *value)
|
||||
_efl_ui_average_model_efl_model_property_set(Eo *obj, Efl_Ui_Average_Model_Data *pd, const char *property, Eina_Value *value)
|
||||
{
|
||||
Eina_Future *f = NULL;
|
||||
|
||||
|
@ -107,14 +107,14 @@ _efl_ui_model_average_efl_model_property_set(Eo *obj, Efl_Ui_Model_Average_Data
|
|||
// In vertical list mode we do not need to compute the average width size
|
||||
/* if (!strcmp(property, _efl_model_property_selfw)) */
|
||||
/* { */
|
||||
/* f = _efl_ui_model_average_prepare(obj, &pd->parent->total.width, */
|
||||
/* f = _efl_ui_average_model_prepare(obj, &pd->parent->total.width, */
|
||||
/* pd->wseen ? NULL : &pd->parent->total.wseen, */
|
||||
/* property, value, EINA_TRUE); */
|
||||
/* pd->wseen = EINA_TRUE; */
|
||||
/* } */
|
||||
if (!strcmp(property, _efl_model_property_selfh))
|
||||
{
|
||||
f = _efl_ui_model_average_prepare(obj, &pd->parent->total.height,
|
||||
f = _efl_ui_average_model_prepare(obj, &pd->parent->total.height,
|
||||
pd->hseen ? NULL : &pd->parent->total.hseen,
|
||||
property, value);
|
||||
pd->hseen = EINA_TRUE;
|
||||
|
@ -122,13 +122,13 @@ _efl_ui_model_average_efl_model_property_set(Eo *obj, Efl_Ui_Model_Average_Data
|
|||
|
||||
end:
|
||||
if (!f)
|
||||
f = efl_model_property_set(efl_super(obj, EFL_UI_MODEL_AVERAGE_CLASS), property, value);
|
||||
f = efl_model_property_set(efl_super(obj, EFL_UI_AVERAGE_MODEL_CLASS), property, value);
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
static inline Eina_Value *
|
||||
_efl_ui_model_average_compute(const Eo *obj, Eina_Value *r, unsigned long long total, unsigned long long seen)
|
||||
_efl_ui_average_model_compute(const Eo *obj, Eina_Value *r, unsigned long long total, unsigned long long seen)
|
||||
{
|
||||
unsigned int count;
|
||||
|
||||
|
@ -143,12 +143,12 @@ _efl_ui_model_average_compute(const Eo *obj, Eina_Value *r, unsigned long long t
|
|||
}
|
||||
|
||||
static Eina_Value *
|
||||
_efl_ui_model_average_efl_model_property_get(const Eo *obj, Efl_Ui_Model_Average_Data *pd, const char *property)
|
||||
_efl_ui_average_model_efl_model_property_get(const Eo *obj, Efl_Ui_Average_Model_Data *pd, const char *property)
|
||||
{
|
||||
const Eina_Value_Type *t;
|
||||
Eina_Value *r;
|
||||
|
||||
r = efl_model_property_get(efl_super(obj, EFL_UI_MODEL_AVERAGE_CLASS), property);
|
||||
r = efl_model_property_get(efl_super(obj, EFL_UI_AVERAGE_MODEL_CLASS), property);
|
||||
if (!r) return r;
|
||||
|
||||
// We are checking that the parent class was able to provide an answer to the request for property "Total.Width"
|
||||
|
@ -158,24 +158,24 @@ _efl_ui_model_average_efl_model_property_get(const Eo *obj, Efl_Ui_Model_Average
|
|||
if (t == EINA_VALUE_TYPE_UINT)
|
||||
{
|
||||
if (!strcmp(property, _efl_model_property_totalh))
|
||||
r = _efl_ui_model_average_compute(obj, r, pd->total.height, pd->total.hseen);
|
||||
r = _efl_ui_average_model_compute(obj, r, pd->total.height, pd->total.hseen);
|
||||
// We do not need to average the width in vertical list mode as this is done by the parent class
|
||||
/* if (!strcmp(property, _efl_model_property_totalw)) */
|
||||
/* r = _efl_ui_model_average_compute(obj, r, pd->total.width, pd->total.wseen); */
|
||||
/* r = _efl_ui_average_model_compute(obj, r, pd->total.width, pd->total.wseen); */
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static Efl_Object *
|
||||
_efl_ui_model_average_efl_object_constructor(Eo *obj, Efl_Ui_Model_Average_Data *pd)
|
||||
_efl_ui_average_model_efl_object_constructor(Eo *obj, Efl_Ui_Average_Model_Data *pd)
|
||||
{
|
||||
Eo *parent = efl_parent_get(obj);
|
||||
|
||||
if (parent && efl_isa(parent, EFL_UI_MODEL_AVERAGE_CLASS))
|
||||
pd->parent = efl_data_scope_get(efl_parent_get(obj), EFL_UI_MODEL_AVERAGE_CLASS);
|
||||
if (parent && efl_isa(parent, EFL_UI_AVERAGE_MODEL_CLASS))
|
||||
pd->parent = efl_data_scope_get(efl_parent_get(obj), EFL_UI_AVERAGE_MODEL_CLASS);
|
||||
|
||||
return efl_constructor(efl_super(obj, EFL_UI_MODEL_AVERAGE_CLASS));
|
||||
return efl_constructor(efl_super(obj, EFL_UI_AVERAGE_MODEL_CLASS));
|
||||
}
|
||||
|
||||
#include "efl_ui_model_average.eo.c"
|
||||
#include "efl_ui_average_model.eo.c"
|
|
@ -1,14 +1,14 @@
|
|||
class Efl.Ui.Model_Average extends Efl.Ui.Model_Exact
|
||||
class Efl.Ui.Average_Model extends Efl.Ui.Exact_Model
|
||||
{
|
||||
[[Class to be used to store object item size for List/Grid View.
|
||||
|
||||
This model provide the same feature as @Efl.Ui.Model_Exact except for the
|
||||
This model provide the same feature as @Efl.Ui.Exact_Model except for the
|
||||
@Efl.Model.property "$total.width" and "$total.height" which reflect an
|
||||
estimated value of the total size by using the currently know size from its
|
||||
children as an average size for all its children. As more children fill
|
||||
"$self.width" and "$self.height", this model will figure out a more precise
|
||||
answer. Once all children size is known, the result will be exact and the same
|
||||
as @Efl.Ui.Model_Exact.
|
||||
as @Efl.Ui.Exact_Model.
|
||||
|
||||
This model only supporting vertical list at this point.]]
|
||||
|
||||
|
@ -16,4 +16,4 @@ class Efl.Ui.Model_Average extends Efl.Ui.Model_Exact
|
|||
Efl.Object.constructor;
|
||||
Efl.Model.property { set; get; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,15 +10,15 @@
|
|||
// That cache could get dropped when the application is entering the 'pause'
|
||||
// state.
|
||||
|
||||
#define EFL_UI_MODEL_EXACT_CONTENT 1024
|
||||
#define EFL_UI_MODEL_EXACT_CONTENT_LENGTH (EFL_UI_MODEL_EXACT_CONTENT * sizeof (unsigned int))
|
||||
#define EFL_UI_EXACT_MODEL_CONTENT 1024
|
||||
#define EFL_UI_EXACT_MODEL_CONTENT_LENGTH (EFL_UI_EXACT_MODEL_CONTENT * sizeof (unsigned int))
|
||||
|
||||
// For now only vertical logic is implemented. Horizontal list and grid are not supported.
|
||||
|
||||
typedef struct _Efl_Ui_Model_Exact_Data Efl_Ui_Model_Exact_Data;
|
||||
struct _Efl_Ui_Model_Exact_Data
|
||||
typedef struct _Efl_Ui_Exact_Model_Data Efl_Ui_Exact_Model_Data;
|
||||
struct _Efl_Ui_Exact_Model_Data
|
||||
{
|
||||
Efl_Ui_Model_Exact_Data *parent;
|
||||
Efl_Ui_Exact_Model_Data *parent;
|
||||
|
||||
struct {
|
||||
Eina_List *width;
|
||||
|
@ -44,18 +44,18 @@ struct _Efl_Ui_Model_Exact_Data
|
|||
};
|
||||
|
||||
static Efl_Object *
|
||||
_efl_ui_model_exact_efl_object_constructor(Eo *obj, Efl_Ui_Model_Exact_Data *pd)
|
||||
_efl_ui_exact_model_efl_object_constructor(Eo *obj, Efl_Ui_Exact_Model_Data *pd)
|
||||
{
|
||||
Eo *parent = efl_parent_get(obj);
|
||||
|
||||
if (parent && efl_isa(parent, EFL_UI_MODEL_EXACT_CLASS))
|
||||
pd->parent = efl_data_scope_get(efl_parent_get(obj), EFL_UI_MODEL_EXACT_CLASS);
|
||||
if (parent && efl_isa(parent, EFL_UI_EXACT_MODEL_CLASS))
|
||||
pd->parent = efl_data_scope_get(efl_parent_get(obj), EFL_UI_EXACT_MODEL_CLASS);
|
||||
|
||||
return efl_constructor(efl_super(obj, EFL_UI_MODEL_EXACT_CLASS));
|
||||
return efl_constructor(efl_super(obj, EFL_UI_EXACT_MODEL_CLASS));
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
_efl_ui_model_exact_list_find(unsigned int list_index, Eina_List *start, Eina_List **l)
|
||||
_efl_ui_exact_model_list_find(unsigned int list_index, Eina_List *start, Eina_List **l)
|
||||
{
|
||||
Eina_Binbuf *tbuf;
|
||||
|
||||
|
@ -69,17 +69,17 @@ _efl_ui_model_exact_list_find(unsigned int list_index, Eina_List *start, Eina_Li
|
|||
}
|
||||
|
||||
static Eina_List *
|
||||
_efl_ui_model_exact_slot_compress(unsigned int index, Eina_List *compressed, unsigned int *buffer)
|
||||
_efl_ui_exact_model_slot_compress(unsigned int index, Eina_List *compressed, unsigned int *buffer)
|
||||
{
|
||||
unsigned int list_index = index / EFL_UI_MODEL_EXACT_CONTENT;
|
||||
unsigned int list_index = index / EFL_UI_EXACT_MODEL_CONTENT;
|
||||
static Eina_Binbuf *z = NULL;
|
||||
Eina_Binbuf *cbuf;
|
||||
Eina_Binbuf *tbuf;
|
||||
Eina_List *l = NULL;
|
||||
|
||||
_efl_ui_model_exact_list_find(list_index, compressed, &l);
|
||||
_efl_ui_exact_model_list_find(list_index, compressed, &l);
|
||||
|
||||
tbuf = eina_binbuf_manage_new((unsigned char *) buffer, EFL_UI_MODEL_EXACT_CONTENT_LENGTH, EINA_TRUE);
|
||||
tbuf = eina_binbuf_manage_new((unsigned char *) buffer, EFL_UI_EXACT_MODEL_CONTENT_LENGTH, EINA_TRUE);
|
||||
cbuf = emile_compress(tbuf, EMILE_LZ4, EMILE_COMPRESSOR_FAST);
|
||||
eina_binbuf_free(tbuf);
|
||||
|
||||
|
@ -93,10 +93,10 @@ _efl_ui_model_exact_slot_compress(unsigned int index, Eina_List *compressed, uns
|
|||
{
|
||||
unsigned char *zmem;
|
||||
|
||||
zmem = calloc(EFL_UI_MODEL_EXACT_CONTENT, sizeof (unsigned int));
|
||||
zmem = calloc(EFL_UI_EXACT_MODEL_CONTENT, sizeof (unsigned int));
|
||||
if (!zmem) return compressed;
|
||||
|
||||
tbuf = eina_binbuf_manage_new(zmem, EFL_UI_MODEL_EXACT_CONTENT_LENGTH, EINA_TRUE);
|
||||
tbuf = eina_binbuf_manage_new(zmem, EFL_UI_EXACT_MODEL_CONTENT_LENGTH, EINA_TRUE);
|
||||
if (!tbuf) return compressed;
|
||||
|
||||
z = emile_compress(tbuf, EMILE_LZ4, EMILE_COMPRESSOR_FAST);
|
||||
|
@ -120,26 +120,26 @@ _efl_ui_model_exact_slot_compress(unsigned int index, Eina_List *compressed, uns
|
|||
}
|
||||
|
||||
static unsigned int *
|
||||
_efl_ui_model_exact_buffer_expand(unsigned int list_index, unsigned int *buffer, Eina_List *list)
|
||||
_efl_ui_exact_model_buffer_expand(unsigned int list_index, unsigned int *buffer, Eina_List *list)
|
||||
{
|
||||
unsigned int found;
|
||||
Eina_Binbuf *tmp;
|
||||
Eina_List *l = NULL;
|
||||
|
||||
if (!buffer) buffer = malloc(EFL_UI_MODEL_EXACT_CONTENT_LENGTH);
|
||||
if (!buffer) buffer = malloc(EFL_UI_EXACT_MODEL_CONTENT_LENGTH);
|
||||
|
||||
found = _efl_ui_model_exact_list_find(list_index, list, &l);
|
||||
found = _efl_ui_exact_model_list_find(list_index, list, &l);
|
||||
|
||||
// Check if the data is in the list
|
||||
if (!found)
|
||||
{
|
||||
// Not found -> everything is assumed to be zero
|
||||
memset(buffer, 0, EFL_UI_MODEL_EXACT_CONTENT_LENGTH);
|
||||
memset(buffer, 0, EFL_UI_EXACT_MODEL_CONTENT_LENGTH);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
// Found -> expand in buffer
|
||||
tmp = eina_binbuf_manage_new((unsigned char*) buffer, EFL_UI_MODEL_EXACT_CONTENT_LENGTH, EINA_TRUE);
|
||||
tmp = eina_binbuf_manage_new((unsigned char*) buffer, EFL_UI_EXACT_MODEL_CONTENT_LENGTH, EINA_TRUE);
|
||||
emile_expand(eina_list_data_get(l), tmp, EMILE_LZ4);
|
||||
eina_binbuf_free(tmp);
|
||||
|
||||
|
@ -147,7 +147,7 @@ _efl_ui_model_exact_buffer_expand(unsigned int list_index, unsigned int *buffer,
|
|||
}
|
||||
|
||||
static unsigned char
|
||||
_efl_ui_model_exact_slot_find(Efl_Ui_Model_Exact_Data *pd, unsigned int index,
|
||||
_efl_ui_exact_model_slot_find(Efl_Ui_Exact_Model_Data *pd, unsigned int index,
|
||||
Eina_Bool width_get, Eina_Bool height_get)
|
||||
{
|
||||
unsigned char lookup;
|
||||
|
@ -159,7 +159,7 @@ _efl_ui_model_exact_slot_find(Efl_Ui_Model_Exact_Data *pd, unsigned int index,
|
|||
if (!pd->parent->slot[lookup].defined)
|
||||
continue;
|
||||
if (pd->parent->slot[lookup].start_offset <= index &&
|
||||
index < pd->parent->slot[lookup].start_offset + EFL_UI_MODEL_EXACT_CONTENT)
|
||||
index < pd->parent->slot[lookup].start_offset + EFL_UI_EXACT_MODEL_CONTENT)
|
||||
found = lookup;
|
||||
// Reduce usage to find unused slot.
|
||||
if (pd->parent->slot[lookup].usage > 0)
|
||||
|
@ -189,12 +189,12 @@ _efl_ui_model_exact_slot_find(Efl_Ui_Model_Exact_Data *pd, unsigned int index,
|
|||
{
|
||||
if (pd->parent->slot[found].width &&
|
||||
pd->parent->slot[found].decompressed.width)
|
||||
pd->parent->compressed.width = _efl_ui_model_exact_slot_compress(index,
|
||||
pd->parent->compressed.width = _efl_ui_exact_model_slot_compress(index,
|
||||
pd->parent->compressed.width,
|
||||
pd->parent->slot[found].width);
|
||||
if (pd->parent->slot[found].height &&
|
||||
pd->parent->slot[found].decompressed.height)
|
||||
pd->parent->compressed.height = _efl_ui_model_exact_slot_compress(index,
|
||||
pd->parent->compressed.height = _efl_ui_exact_model_slot_compress(index,
|
||||
pd->parent->compressed.height,
|
||||
pd->parent->slot[found].height);
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ _efl_ui_model_exact_slot_find(Efl_Ui_Model_Exact_Data *pd, unsigned int index,
|
|||
pd->parent->slot[found].defined = EINA_TRUE;
|
||||
pd->parent->slot[found].decompressed.width = EINA_FALSE;
|
||||
pd->parent->slot[found].decompressed.height = EINA_FALSE;
|
||||
pd->parent->slot[found].start_offset = index / EFL_UI_MODEL_EXACT_CONTENT;
|
||||
pd->parent->slot[found].start_offset = index / EFL_UI_EXACT_MODEL_CONTENT;
|
||||
}
|
||||
|
||||
// Increase usage of the returnd slot for now
|
||||
|
@ -211,14 +211,14 @@ _efl_ui_model_exact_slot_find(Efl_Ui_Model_Exact_Data *pd, unsigned int index,
|
|||
// Unpack the data if requested
|
||||
if (width_get && !pd->parent->slot[found].decompressed.width)
|
||||
{
|
||||
pd->parent->slot[found].width = _efl_ui_model_exact_buffer_expand(pd->parent->slot[found].start_offset,
|
||||
pd->parent->slot[found].width = _efl_ui_exact_model_buffer_expand(pd->parent->slot[found].start_offset,
|
||||
pd->parent->slot[found].width,
|
||||
pd->parent->compressed.width);
|
||||
pd->parent->slot[found].decompressed.width = EINA_TRUE;
|
||||
}
|
||||
if (height_get && !pd->parent->slot[found].decompressed.height)
|
||||
{
|
||||
pd->parent->slot[found].height = _efl_ui_model_exact_buffer_expand(pd->parent->slot[found].start_offset,
|
||||
pd->parent->slot[found].height = _efl_ui_exact_model_buffer_expand(pd->parent->slot[found].start_offset,
|
||||
pd->parent->slot[found].height,
|
||||
pd->parent->compressed.height);
|
||||
pd->parent->slot[found].decompressed.height = EINA_TRUE;
|
||||
|
@ -228,7 +228,7 @@ _efl_ui_model_exact_slot_find(Efl_Ui_Model_Exact_Data *pd, unsigned int index,
|
|||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_ui_model_exact_efl_model_property_set(Eo *obj, Efl_Ui_Model_Exact_Data *pd,
|
||||
_efl_ui_exact_model_efl_model_property_set(Eo *obj, Efl_Ui_Exact_Model_Data *pd,
|
||||
const char *property, Eina_Value *value)
|
||||
{
|
||||
if (pd->parent)
|
||||
|
@ -238,14 +238,14 @@ _efl_ui_model_exact_efl_model_property_set(Eo *obj, Efl_Ui_Model_Exact_Data *pd,
|
|||
unsigned int index;
|
||||
unsigned char found;
|
||||
|
||||
index = efl_model_composite_index_get(obj);
|
||||
found = _efl_ui_model_exact_slot_find(pd, index, EINA_TRUE, EINA_FALSE);
|
||||
if (!eina_value_uint_convert(value, &pd->parent->slot[found].width[index % EFL_UI_MODEL_EXACT_CONTENT]))
|
||||
index = efl_composite_model_index_get(obj);
|
||||
found = _efl_ui_exact_model_slot_find(pd, index, EINA_TRUE, EINA_FALSE);
|
||||
if (!eina_value_uint_convert(value, &pd->parent->slot[found].width[index % EFL_UI_EXACT_MODEL_CONTENT]))
|
||||
return efl_loop_future_rejected(obj, EFL_MODEL_ERROR_INCORRECT_VALUE);
|
||||
// We succeeded so let's update the max total size width (As we only handle vertical list case at the moment)
|
||||
if (pd->parent->total_size.width < pd->parent->slot[found].width[index % EFL_UI_MODEL_EXACT_CONTENT])
|
||||
pd->parent->total_size.width = pd->parent->slot[found].width[index % EFL_UI_MODEL_EXACT_CONTENT];
|
||||
return efl_loop_future_resolved(obj, eina_value_uint_init(pd->parent->slot[found].width[index % EFL_UI_MODEL_EXACT_CONTENT]));
|
||||
if (pd->parent->total_size.width < pd->parent->slot[found].width[index % EFL_UI_EXACT_MODEL_CONTENT])
|
||||
pd->parent->total_size.width = pd->parent->slot[found].width[index % EFL_UI_EXACT_MODEL_CONTENT];
|
||||
return efl_loop_future_resolved(obj, eina_value_uint_init(pd->parent->slot[found].width[index % EFL_UI_EXACT_MODEL_CONTENT]));
|
||||
}
|
||||
if (!strcmp(property, _efl_model_property_selfh))
|
||||
{
|
||||
|
@ -253,14 +253,14 @@ _efl_ui_model_exact_efl_model_property_set(Eo *obj, Efl_Ui_Model_Exact_Data *pd,
|
|||
unsigned int index;
|
||||
unsigned char found;
|
||||
|
||||
index = efl_model_composite_index_get(obj);
|
||||
found = _efl_ui_model_exact_slot_find(pd, index, EINA_FALSE, EINA_TRUE);
|
||||
old_value = pd->parent->slot[found].height[index % EFL_UI_MODEL_EXACT_CONTENT];
|
||||
if (!eina_value_uint_convert(value, &pd->parent->slot[found].height[index % EFL_UI_MODEL_EXACT_CONTENT]))
|
||||
index = efl_composite_model_index_get(obj);
|
||||
found = _efl_ui_exact_model_slot_find(pd, index, EINA_FALSE, EINA_TRUE);
|
||||
old_value = pd->parent->slot[found].height[index % EFL_UI_EXACT_MODEL_CONTENT];
|
||||
if (!eina_value_uint_convert(value, &pd->parent->slot[found].height[index % EFL_UI_EXACT_MODEL_CONTENT]))
|
||||
return efl_loop_future_rejected(obj, EFL_MODEL_ERROR_INCORRECT_VALUE);
|
||||
// We succeeded so let's update the total size
|
||||
pd->parent->total_size.height += pd->parent->slot[found].height[index % EFL_UI_MODEL_EXACT_CONTENT] - old_value;
|
||||
return efl_loop_future_resolved(obj, eina_value_uint_init(pd->parent->slot[found].height[index % EFL_UI_MODEL_EXACT_CONTENT]));
|
||||
pd->parent->total_size.height += pd->parent->slot[found].height[index % EFL_UI_EXACT_MODEL_CONTENT] - old_value;
|
||||
return efl_loop_future_resolved(obj, eina_value_uint_init(pd->parent->slot[found].height[index % EFL_UI_EXACT_MODEL_CONTENT]));
|
||||
}
|
||||
// The following property are calculated by the model and so READ_ONLY
|
||||
if (!strcmp(property, _efl_model_property_totalh))
|
||||
|
@ -286,11 +286,11 @@ _efl_ui_model_exact_efl_model_property_set(Eo *obj, Efl_Ui_Model_Exact_Data *pd,
|
|||
return efl_loop_future_rejected(obj, EFL_MODEL_ERROR_READ_ONLY);
|
||||
}
|
||||
|
||||
return efl_model_property_set(efl_super(obj, EFL_UI_MODEL_EXACT_CLASS), property, value);
|
||||
return efl_model_property_set(efl_super(obj, EFL_UI_EXACT_MODEL_CLASS), property, value);
|
||||
}
|
||||
|
||||
static Eina_Value *
|
||||
_efl_ui_model_exact_efl_model_property_get(const Eo *obj, Efl_Ui_Model_Exact_Data *pd,
|
||||
_efl_ui_exact_model_efl_model_property_get(const Eo *obj, Efl_Ui_Exact_Model_Data *pd,
|
||||
const char *property)
|
||||
{
|
||||
if (pd->parent)
|
||||
|
@ -300,18 +300,18 @@ _efl_ui_model_exact_efl_model_property_get(const Eo *obj, Efl_Ui_Model_Exact_Dat
|
|||
unsigned int index;
|
||||
unsigned char found;
|
||||
|
||||
index = efl_model_composite_index_get(obj);
|
||||
found = _efl_ui_model_exact_slot_find(pd, index, EINA_TRUE, EINA_FALSE);
|
||||
return eina_value_uint_new(pd->parent->slot[found].width[index % EFL_UI_MODEL_EXACT_CONTENT]);
|
||||
index = efl_composite_model_index_get(obj);
|
||||
found = _efl_ui_exact_model_slot_find(pd, index, EINA_TRUE, EINA_FALSE);
|
||||
return eina_value_uint_new(pd->parent->slot[found].width[index % EFL_UI_EXACT_MODEL_CONTENT]);
|
||||
}
|
||||
if (!strcmp(property, _efl_model_property_selfh))
|
||||
{
|
||||
unsigned int index;
|
||||
unsigned char found;
|
||||
|
||||
index = efl_model_composite_index_get(obj);
|
||||
found = _efl_ui_model_exact_slot_find(pd, index, EINA_FALSE, EINA_TRUE);
|
||||
return eina_value_uint_new(pd->parent->slot[found].height[index % EFL_UI_MODEL_EXACT_CONTENT]);
|
||||
index = efl_composite_model_index_get(obj);
|
||||
found = _efl_ui_exact_model_slot_find(pd, index, EINA_FALSE, EINA_TRUE);
|
||||
return eina_value_uint_new(pd->parent->slot[found].height[index % EFL_UI_EXACT_MODEL_CONTENT]);
|
||||
}
|
||||
}
|
||||
if (!strcmp(property, _efl_model_property_totalh))
|
||||
|
@ -332,7 +332,7 @@ _efl_ui_model_exact_efl_model_property_get(const Eo *obj, Efl_Ui_Model_Exact_Dat
|
|||
// The exact model can not guess a general item size if asked.
|
||||
return eina_value_error_new(EAGAIN);
|
||||
}
|
||||
return efl_model_property_get(efl_super(obj, EFL_UI_MODEL_EXACT_CLASS), property);
|
||||
return efl_model_property_get(efl_super(obj, EFL_UI_EXACT_MODEL_CLASS), property);
|
||||
}
|
||||
|
||||
#include "efl_ui_model_exact.eo.c"
|
||||
#include "efl_ui_exact_model.eo.c"
|
|
@ -1,4 +1,4 @@
|
|||
class Efl.Ui.Model_Exact extends Efl.Ui.Model_Size
|
||||
class Efl.Ui.Exact_Model extends Efl.Ui.Size_Model
|
||||
{
|
||||
[[Class to be used to store object item size for List/Grid View.
|
||||
|
||||
|
@ -14,4 +14,4 @@ class Efl.Ui.Model_Exact extends Efl.Ui.Model_Size
|
|||
Efl.Object.constructor;
|
||||
Efl.Model.property { set; get; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,10 +7,10 @@
|
|||
|
||||
// For now only vertical logic is implemented. Horizontal list and grid are not supported.
|
||||
|
||||
typedef struct _Efl_Ui_Model_Homogeneous_Data Efl_Ui_Model_Homogeneous_Data;
|
||||
struct _Efl_Ui_Model_Homogeneous_Data
|
||||
typedef struct _Efl_Ui_Homogeneous_Model_Data Efl_Ui_Homogeneous_Model_Data;
|
||||
struct _Efl_Ui_Homogeneous_Model_Data
|
||||
{
|
||||
Efl_Ui_Model_Homogeneous_Data *parent;
|
||||
Efl_Ui_Homogeneous_Model_Data *parent;
|
||||
|
||||
struct {
|
||||
unsigned int width;
|
||||
|
@ -24,7 +24,7 @@ struct _Efl_Ui_Model_Homogeneous_Data
|
|||
};
|
||||
|
||||
static Eina_Future *
|
||||
_efl_ui_model_homogeneous_property_set(Eo *obj, Eina_Value *value,
|
||||
_efl_ui_homogeneous_model_property_set(Eo *obj, Eina_Value *value,
|
||||
Eina_Bool *defined, unsigned int *r)
|
||||
{
|
||||
Eina_Future *f;
|
||||
|
@ -40,18 +40,18 @@ _efl_ui_model_homogeneous_property_set(Eo *obj, Eina_Value *value,
|
|||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_ui_model_homogeneous_efl_model_property_set(Eo *obj,
|
||||
Efl_Ui_Model_Homogeneous_Data *pd,
|
||||
_efl_ui_homogeneous_model_efl_model_property_set(Eo *obj,
|
||||
Efl_Ui_Homogeneous_Model_Data *pd,
|
||||
const char *property, Eina_Value *value)
|
||||
{
|
||||
if (pd->parent)
|
||||
{
|
||||
if (!strcmp(property, _efl_model_property_selfw))
|
||||
return _efl_ui_model_homogeneous_property_set(obj, value,
|
||||
return _efl_ui_homogeneous_model_property_set(obj, value,
|
||||
&pd->parent->item.defined.width,
|
||||
&pd->parent->item.width);
|
||||
if (!strcmp(property, _efl_model_property_selfh))
|
||||
return _efl_ui_model_homogeneous_property_set(obj, value,
|
||||
return _efl_ui_homogeneous_model_property_set(obj, value,
|
||||
&pd->parent->item.defined.height,
|
||||
&pd->parent->item.height);
|
||||
if (!strcmp(property, _efl_model_property_totalw) ||
|
||||
|
@ -60,24 +60,24 @@ _efl_ui_model_homogeneous_efl_model_property_set(Eo *obj,
|
|||
}
|
||||
if (!strcmp(property, _efl_model_property_itemw))
|
||||
{
|
||||
return _efl_ui_model_homogeneous_property_set(obj, value,
|
||||
return _efl_ui_homogeneous_model_property_set(obj, value,
|
||||
&pd->item.defined.width,
|
||||
&pd->item.width);
|
||||
}
|
||||
if (!strcmp(property, _efl_model_property_itemh))
|
||||
{
|
||||
return _efl_ui_model_homogeneous_property_set(obj, value,
|
||||
return _efl_ui_homogeneous_model_property_set(obj, value,
|
||||
&pd->item.defined.height,
|
||||
&pd->item.height);
|
||||
}
|
||||
|
||||
return efl_model_property_set(efl_super(obj, EFL_UI_MODEL_HOMOGENEOUS_CLASS),
|
||||
return efl_model_property_set(efl_super(obj, EFL_UI_HOMOGENEOUS_MODEL_CLASS),
|
||||
property, value);
|
||||
}
|
||||
|
||||
static Eina_Value *
|
||||
_efl_ui_model_homogeneous_efl_model_property_get(const Eo *obj,
|
||||
Efl_Ui_Model_Homogeneous_Data *pd,
|
||||
_efl_ui_homogeneous_model_efl_model_property_get(const Eo *obj,
|
||||
Efl_Ui_Homogeneous_Model_Data *pd,
|
||||
const char *property)
|
||||
{
|
||||
if (pd->parent)
|
||||
|
@ -122,21 +122,21 @@ _efl_ui_model_homogeneous_efl_model_property_get(const Eo *obj,
|
|||
goto not_ready;
|
||||
}
|
||||
|
||||
return efl_model_property_get(efl_super(obj, EFL_UI_MODEL_HOMOGENEOUS_CLASS), property);
|
||||
return efl_model_property_get(efl_super(obj, EFL_UI_HOMOGENEOUS_MODEL_CLASS), property);
|
||||
|
||||
not_ready:
|
||||
return eina_value_error_new(EAGAIN);
|
||||
}
|
||||
|
||||
static Efl_Object *
|
||||
_efl_ui_model_homogeneous_efl_object_constructor(Eo *obj, Efl_Ui_Model_Homogeneous_Data *pd)
|
||||
_efl_ui_homogeneous_model_efl_object_constructor(Eo *obj, Efl_Ui_Homogeneous_Model_Data *pd)
|
||||
{
|
||||
Eo *parent = efl_parent_get(obj);
|
||||
|
||||
if (parent && efl_isa(parent, EFL_UI_MODEL_HOMOGENEOUS_CLASS))
|
||||
pd->parent = efl_data_scope_get(efl_parent_get(obj), EFL_UI_MODEL_HOMOGENEOUS_CLASS);
|
||||
if (parent && efl_isa(parent, EFL_UI_HOMOGENEOUS_MODEL_CLASS))
|
||||
pd->parent = efl_data_scope_get(efl_parent_get(obj), EFL_UI_HOMOGENEOUS_MODEL_CLASS);
|
||||
|
||||
return efl_constructor(efl_super(obj, EFL_UI_MODEL_HOMOGENEOUS_CLASS));
|
||||
return efl_constructor(efl_super(obj, EFL_UI_HOMOGENEOUS_MODEL_CLASS));
|
||||
}
|
||||
|
||||
#include "efl_ui_model_homogeneous.eo.c"
|
||||
#include "efl_ui_homogeneous_model.eo.c"
|
|
@ -1,11 +1,11 @@
|
|||
class Efl.Ui.Model_Homogeneous extends Efl.Ui.Model_Size
|
||||
class Efl.Ui.Homogeneous_Model extends Efl.Ui.Size_Model
|
||||
{
|
||||
[[Class to be used to store object item size for List/Grid View.
|
||||
|
||||
This model provides the properties "$item.width" and "$item.height" which have the
|
||||
same value for all siblings of this object. The first sibling that defines "$self.width"
|
||||
and "$self.height" set them for all other siblings and also set "$item.width" and
|
||||
"$item.height" for the parent (See @Efl.Ui.Model_Size).
|
||||
"$item.height" for the parent (See @Efl.Ui.Size_Model).
|
||||
|
||||
Subsequent attempts to set "$self.width" or "$self.height" will fail with a
|
||||
Read Only error code.
|
|
@ -13,7 +13,7 @@ const char *_efl_model_property_totalw = "total.width";
|
|||
const char *_efl_model_property_totalh = "total.height";
|
||||
|
||||
static Eina_Iterator *
|
||||
_efl_ui_model_size_properties_child(void)
|
||||
_efl_ui_size_model_properties_child(void)
|
||||
{
|
||||
const char *properties[] = {
|
||||
_efl_model_property_itemw, _efl_model_property_itemh, _efl_model_property_selfh, _efl_model_property_selfw
|
||||
|
@ -22,7 +22,7 @@ _efl_ui_model_size_properties_child(void)
|
|||
}
|
||||
|
||||
static Eina_Iterator *
|
||||
_efl_ui_model_size_properties_root(void)
|
||||
_efl_ui_size_model_properties_root(void)
|
||||
{
|
||||
const char *properties[] = {
|
||||
_efl_model_property_itemw, _efl_model_property_itemh
|
||||
|
@ -31,18 +31,18 @@ _efl_ui_model_size_properties_root(void)
|
|||
}
|
||||
|
||||
static Eina_Iterator *
|
||||
_efl_ui_model_size_efl_model_properties_get(const Eo *obj, void *pd EINA_UNUSED)
|
||||
_efl_ui_size_model_efl_model_properties_get(const Eo *obj, void *pd EINA_UNUSED)
|
||||
{
|
||||
Eina_Iterator *super;
|
||||
Eina_Iterator *prop;
|
||||
|
||||
super = efl_model_properties_get(efl_super(obj, EFL_UI_MODEL_SIZE_CLASS));
|
||||
if (efl_isa(efl_parent_get(obj), EFL_UI_MODEL_SIZE_CLASS))
|
||||
prop = _efl_ui_model_size_properties_child();
|
||||
super = efl_model_properties_get(efl_super(obj, EFL_UI_SIZE_MODEL_CLASS));
|
||||
if (efl_isa(efl_parent_get(obj), EFL_UI_SIZE_MODEL_CLASS))
|
||||
prop = _efl_ui_size_model_properties_child();
|
||||
else
|
||||
prop = _efl_ui_model_size_properties_root();
|
||||
prop = _efl_ui_size_model_properties_root();
|
||||
|
||||
return eina_multi_iterator_new(super, prop);
|
||||
}
|
||||
|
||||
#include "efl_ui_model_size.eo.c"
|
||||
#include "efl_ui_size_model.eo.c"
|
|
@ -1,4 +1,4 @@
|
|||
class Efl.Ui.Model_Size extends Efl.Model_Composite
|
||||
class Efl.Ui.Size_Model extends Efl.Composite_Model
|
||||
{
|
||||
[[Class to be used to store object item size for List/Grid View.
|
||||
|
||||
|
@ -8,7 +8,7 @@ class Efl.Ui.Model_Size extends Efl.Model_Composite
|
|||
view of the @Efl.Ui.View that use it. It only apply on children and not on the
|
||||
top root object.
|
||||
- "$item.width" and "$item.height" define all the children size and is available
|
||||
only on @Efl.Ui.Model_Size that do have children.
|
||||
only on @Efl.Ui.Size_Model that do have children.
|
||||
- "$total.width" and "$total.height" define the accumulated size used by all the children.
|
||||
Only vertical list accumulation logic is implemented at this point.]]
|
||||
|
||||
|
@ -16,4 +16,4 @@ class Efl.Ui.Model_Size extends Efl.Model_Composite
|
|||
implements {
|
||||
Efl.Model.properties { get; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
class Efl.Ui.Model_State extends Efl.Model_Composite_Boolean
|
||||
class Efl.Ui.State_Model extends Efl.Boolean_Model
|
||||
{
|
||||
[[Efl model handling visibility, enable and selected state]]
|
||||
implements {
|
|
@ -901,7 +901,7 @@ _process_model(Elm_Fileselector_Data *sd, Efl_Model *child)
|
|||
// Is this item selected
|
||||
if (sd->target)
|
||||
{
|
||||
const char *target_path = eio_model_path_get(sd->target);
|
||||
const char *target_path = efl_io_model_path_get(sd->target);
|
||||
|
||||
if (!strcmp(it_data->path, target_path))
|
||||
{
|
||||
|
@ -1314,9 +1314,9 @@ _on_dir_up(void *data, const Efl_Event *event EINA_UNUSED)
|
|||
parent = efl_parent_get(sd->model);
|
||||
if (!parent) return;
|
||||
|
||||
if (!efl_isa(parent, EIO_MODEL_CLASS))
|
||||
if (!efl_isa(parent, EFL_IO_MODEL_CLASS))
|
||||
{
|
||||
const char *path = eio_model_path_get(sd->model);
|
||||
const char *path = efl_io_model_path_get(sd->model);
|
||||
char dir[PATH_MAX] = "";
|
||||
char *r;
|
||||
|
||||
|
@ -1970,7 +1970,7 @@ _from_legacy_event_call(Elm_Fileselector *fs, Elm_Fileselector_Data *sd, const E
|
|||
{
|
||||
const Efl_Class *model_cls = NULL;
|
||||
if (!sd->model)
|
||||
model_cls = EIO_MODEL_CLASS;
|
||||
model_cls = EFL_IO_MODEL_CLASS;
|
||||
else
|
||||
model_cls = efl_class_get(sd->model);
|
||||
|
||||
|
@ -2184,8 +2184,8 @@ elm_fileselector_path_set(Evas_Object *obj,
|
|||
void
|
||||
_elm_fileselector_path_set_internal(Evas_Object *obj, const char *_path)
|
||||
{
|
||||
Eio_Model *model = efl_add_ref(EIO_MODEL_CLASS, obj, eio_model_path_set(efl_added, _path),
|
||||
efl_event_callback_array_add(efl_added, noref_death(), NULL));
|
||||
Efl_Io_Model *model = efl_add_ref(EFL_IO_MODEL_CLASS, obj, efl_io_model_path_set(efl_added, _path),
|
||||
efl_event_callback_array_add(efl_added, noref_death(), NULL));
|
||||
if (!model)
|
||||
{
|
||||
ERR("Efl.Model allocation error");
|
||||
|
@ -2387,7 +2387,7 @@ _elm_fileselector_selected_get_internal(const Evas_Object *obj)
|
|||
if (!sd->path) return NULL;
|
||||
if (sd->target)
|
||||
{
|
||||
return eio_model_path_get(sd->target);
|
||||
return efl_io_model_path_get(sd->target);
|
||||
}
|
||||
|
||||
Elm_Fileselector_Item_Data *it_data = _selected_item_data_get(sd);
|
||||
|
@ -2463,10 +2463,10 @@ _properties_ready(void *data, const Efl_Event *ev)
|
|||
if (!is_dir)
|
||||
{
|
||||
Efl_Model *parent;
|
||||
const char *path = eio_model_path_get(ev->object);
|
||||
const char *path = efl_io_model_path_get(ev->object);
|
||||
char *dir = ecore_file_dir_get(path);
|
||||
|
||||
parent = efl_add_ref(EIO_MODEL_CLASS, obj, eio_model_path_set(efl_added, dir),
|
||||
parent = efl_add_ref(EFL_IO_MODEL_CLASS, obj, efl_io_model_path_set(efl_added, dir),
|
||||
efl_event_callback_array_add(efl_added, noref_death(), NULL));
|
||||
if (!parent)
|
||||
{
|
||||
|
@ -2503,7 +2503,7 @@ _elm_fileselector_selected_set_internal(Evas_Object *obj, const char *path)
|
|||
|
||||
if (stat(path, &st)) return EINA_FALSE;
|
||||
|
||||
pd->target = efl_add_ref(EIO_MODEL_CLASS, obj, eio_model_path_set(efl_added, path),
|
||||
pd->target = efl_add_ref(EFL_IO_MODEL_CLASS, obj, efl_io_model_path_set(efl_added, path),
|
||||
efl_event_callback_array_add(efl_added, noref_death(), NULL));
|
||||
if (!pd->target)
|
||||
{
|
||||
|
@ -2540,7 +2540,7 @@ _elm_fileselector_elm_interface_fileselector_selected_model_set(Eo *obj, Elm_Fil
|
|||
Eina_Value *value = NULL;
|
||||
Eina_Bool dir = EINA_FALSE;
|
||||
|
||||
if (!efl_isa(model, EIO_MODEL_CLASS)) return EINA_FALSE;
|
||||
if (!efl_isa(model, EFL_IO_MODEL_CLASS)) return EINA_FALSE;
|
||||
|
||||
efl_event_callback_del(pd->target, EFL_MODEL_EVENT_PROPERTIES_CHANGED, _properties_ready, obj);
|
||||
efl_replace(&pd->target, model);
|
||||
|
@ -2556,7 +2556,7 @@ _elm_fileselector_elm_interface_fileselector_selected_model_set(Eo *obj, Elm_Fil
|
|||
eina_value_error_get(value, &err);
|
||||
if (err != EAGAIN)
|
||||
{
|
||||
ERR("Unexpected error '%s' when setting path '%s'.", eina_value_to_string(value), eio_model_path_get(pd->target));
|
||||
ERR("Unexpected error '%s' when setting path '%s'.", eina_value_to_string(value), efl_io_model_path_get(pd->target));
|
||||
goto clean_up;
|
||||
}
|
||||
|
||||
|
@ -2576,10 +2576,10 @@ _elm_fileselector_elm_interface_fileselector_selected_model_set(Eo *obj, Elm_Fil
|
|||
if (!dir)
|
||||
{
|
||||
Efl_Model *parent;
|
||||
const char *path = eio_model_path_get(pd->target);
|
||||
const char *path = efl_io_model_path_get(pd->target);
|
||||
char *d = ecore_file_dir_get(path);
|
||||
|
||||
parent = efl_add_ref(EIO_MODEL_CLASS, obj, eio_model_path_set(efl_added, d),
|
||||
parent = efl_add_ref(EFL_IO_MODEL_CLASS, obj, efl_io_model_path_set(efl_added, d),
|
||||
efl_event_callback_array_add(efl_added, noref_death(), NULL));
|
||||
if (!parent)
|
||||
{
|
||||
|
|
|
@ -224,8 +224,8 @@ _elm_fileselector_button_efl_canvas_group_group_add(Eo *obj, Elm_Fileselector_Bu
|
|||
if (path) priv->fsd.path = eina_stringshare_add(path);
|
||||
else priv->fsd.path = eina_stringshare_add("/");
|
||||
|
||||
priv->fsd.model = efl_add_ref(EIO_MODEL_CLASS, obj,
|
||||
eio_model_path_set(efl_added, priv->fsd.path),
|
||||
priv->fsd.model = efl_add_ref(EFL_IO_MODEL_CLASS, obj,
|
||||
efl_io_model_path_set(efl_added, priv->fsd.path),
|
||||
efl_event_callback_array_add(efl_added, noref_death(), NULL));
|
||||
|
||||
priv->fsd.expandable = _elm_config->fileselector_expand_enable;
|
||||
|
@ -326,7 +326,7 @@ _elm_fileselector_button_path_set_internal(Evas_Object *obj, const char *path)
|
|||
{
|
||||
ELM_FILESELECTOR_BUTTON_DATA_GET_OR_RETURN(obj, sd);
|
||||
|
||||
Efl_Model *model = efl_add(EIO_MODEL_CLASS, obj, eio_model_path_set(efl_added, path));
|
||||
Efl_Model *model = efl_add(EFL_IO_MODEL_CLASS, obj, efl_io_model_path_set(efl_added, path));
|
||||
if (!model)
|
||||
{
|
||||
ERR("Efl.Model allocation error");
|
||||
|
|
|
@ -146,7 +146,7 @@ interface Elm.Interface.Fileselector extends Efl.Ui.View
|
|||
[[Get the currently selected item's model, in the given file the given file selector widget]]
|
||||
}
|
||||
values {
|
||||
model: Eio.Model; [[Model to be set, NULL reset it.]]
|
||||
model: Efl.Io.Model; [[Model to be set, NULL reset it.]]
|
||||
}
|
||||
}
|
||||
custom_filter_append {
|
||||
|
|
|
@ -69,10 +69,10 @@
|
|||
# include "elm_widget_item_static_focus.eo.h"
|
||||
# include "efl_ui_selection_manager.eo.h"
|
||||
# include "efl_datetime_manager.eo.h"
|
||||
# include "efl_ui_model_size.eo.h"
|
||||
# include "efl_ui_model_homogeneous.eo.h"
|
||||
# include "efl_ui_model_exact.eo.h"
|
||||
# include "efl_ui_model_average.eo.h"
|
||||
# include "efl_ui_size_model.eo.h"
|
||||
# include "efl_ui_homogeneous_model.eo.h"
|
||||
# include "efl_ui_exact_model.eo.h"
|
||||
# include "efl_ui_average_model.eo.h"
|
||||
|
||||
extern const char *_efl_model_property_itemw;
|
||||
extern const char *_efl_model_property_itemh;
|
||||
|
|
|
@ -332,15 +332,15 @@ priv_eo_files = [
|
|||
'efl_ui_focus_parent_provider.eo',
|
||||
'efl_ui_focus_parent_provider_standard.eo',
|
||||
'efl_ui_focus_parent_provider_gen.eo',
|
||||
'efl_ui_model_state.eo',
|
||||
'efl_ui_state_model.eo',
|
||||
'efl_ui_selection_manager.eo',
|
||||
'efl_datetime_manager.eo',
|
||||
'efl_ui_list_view_precise_layouter.eo',
|
||||
'efl_ui_list_view_relayout.eo',
|
||||
'efl_ui_model_size.eo',
|
||||
'efl_ui_model_homogeneous.eo',
|
||||
'efl_ui_model_exact.eo',
|
||||
'efl_ui_model_average.eo',
|
||||
'efl_ui_size_model.eo',
|
||||
'efl_ui_homogeneous_model.eo',
|
||||
'efl_ui_exact_model.eo',
|
||||
'efl_ui_average_model.eo',
|
||||
]
|
||||
|
||||
priv_eo_file_target = []
|
||||
|
@ -909,10 +909,10 @@ elementary_src = [
|
|||
'efl_ui_widget_focus_manager.c',
|
||||
'efl_ui_caching_factory.c',
|
||||
'efl_ui_widget_factory.c',
|
||||
'efl_ui_model_size.c',
|
||||
'efl_ui_model_homogeneous.c',
|
||||
'efl_ui_model_exact.c',
|
||||
'efl_ui_model_average.c',
|
||||
'efl_ui_size_model.c',
|
||||
'efl_ui_homogeneous_model.c',
|
||||
'efl_ui_exact_model.c',
|
||||
'efl_ui_average_model.c'
|
||||
]
|
||||
|
||||
elementary_deps = [emile, eo, efl, edje, ethumb, ethumb_client, emotion, ecore_imf, ecore_con, eldbus, efreet, efreet_mime, efreet_trash, eio, atspi, dl, intl]
|
||||
|
|
|
@ -26,9 +26,9 @@
|
|||
#include "../efl_check.h"
|
||||
|
||||
static const Efl_Test_Case etc[] = {
|
||||
{ "Efl_Model_Container", efl_test_case_model_container },
|
||||
{ "Efl_Model_View", efl_test_case_model_view },
|
||||
{ "Efl_Model_Composite_Boolean", efl_test_case_model_composite_boolean },
|
||||
{ "Efl_Container_Model", efl_test_case_container_model },
|
||||
{ "Efl_View_Model", efl_test_case_view_model },
|
||||
{ "Efl_Boolean_Model", efl_test_case_boolean_model },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
|
||||
#include <check.h>
|
||||
#include "../efl_check.h"
|
||||
void efl_test_case_model_container(TCase *tc);
|
||||
void efl_test_case_model_view(TCase *tc);
|
||||
void efl_test_case_model_composite_boolean(TCase *tc);
|
||||
void efl_test_case_container_model(TCase *tc);
|
||||
void efl_test_case_view_model(TCase *tc);
|
||||
void efl_test_case_boolean_model(TCase *tc);
|
||||
|
||||
#endif /* EFL_SUITE_H_ */
|
||||
|
|
|
@ -103,17 +103,17 @@ _selection_children_slice_get_then(void *data EINA_UNUSED,
|
|||
return v;
|
||||
}
|
||||
|
||||
EFL_START_TEST(efl_test_model_composite_boolean)
|
||||
EFL_START_TEST(efl_test_boolean_model)
|
||||
{
|
||||
Efl_Model_Item *base_model, *child;
|
||||
Efl_Generic_Model *base_model, *child;
|
||||
int i;
|
||||
Eina_Value v;
|
||||
Efl_Model_Composite_Boolean *model;
|
||||
Efl_Boolean_Model *model;
|
||||
Eina_Future *future;
|
||||
|
||||
eina_value_setup(&v, EINA_VALUE_TYPE_INT);
|
||||
|
||||
base_model = efl_add_ref(EFL_MODEL_ITEM_CLASS, efl_main_loop_get());
|
||||
base_model = efl_add_ref(EFL_GENERIC_MODEL_CLASS, efl_main_loop_get());
|
||||
ck_assert(!!base_model);
|
||||
|
||||
for (i = 0; i < child_number; ++i)
|
||||
|
@ -124,10 +124,10 @@ EFL_START_TEST(efl_test_model_composite_boolean)
|
|||
efl_model_property_set(child, "test_p_int", &v);
|
||||
}
|
||||
|
||||
model = efl_add_ref(EFL_MODEL_COMPOSITE_BOOLEAN_CLASS, efl_main_loop_get(),
|
||||
model = efl_add_ref(EFL_BOOLEAN_MODEL_CLASS, efl_main_loop_get(),
|
||||
efl_ui_view_model_set(efl_added, base_model),
|
||||
efl_model_composite_boolean_add(efl_added, "test_p_true", EINA_TRUE),
|
||||
efl_model_composite_boolean_add(efl_added, "test_p_false", EINA_FALSE));
|
||||
efl_boolean_model_boolean_add(efl_added, "test_p_true", EINA_TRUE),
|
||||
efl_boolean_model_boolean_add(efl_added, "test_p_false", EINA_FALSE));
|
||||
ck_assert(!!model);
|
||||
|
||||
future = efl_model_children_slice_get(model, 0, efl_model_children_count_get(model));
|
||||
|
@ -146,17 +146,17 @@ _wait_propagate(void *data EINA_UNUSED,
|
|||
return v;
|
||||
}
|
||||
|
||||
EFL_START_TEST(efl_test_model_composite_selection)
|
||||
EFL_START_TEST(efl_test_select_model)
|
||||
{
|
||||
Efl_Model_Item *base_model, *child;
|
||||
Efl_Generic_Model *base_model, *child;
|
||||
int i;
|
||||
Eina_Value v;
|
||||
Efl_Model_Composite_Selection *model;
|
||||
Efl_Select_Model *model;
|
||||
Eina_Future *future;
|
||||
|
||||
eina_value_setup(&v, EINA_VALUE_TYPE_INT);
|
||||
|
||||
base_model = efl_add_ref(EFL_MODEL_ITEM_CLASS, efl_main_loop_get());
|
||||
base_model = efl_add_ref(EFL_GENERIC_MODEL_CLASS, efl_main_loop_get());
|
||||
ck_assert(!!base_model);
|
||||
|
||||
for (i = 0; i < child_number; ++i)
|
||||
|
@ -167,7 +167,7 @@ EFL_START_TEST(efl_test_model_composite_selection)
|
|||
efl_model_property_set(child, "test_p_int", &v);
|
||||
}
|
||||
|
||||
model = efl_add_ref(EFL_MODEL_COMPOSITE_SELECTION_CLASS, efl_main_loop_get(),
|
||||
model = efl_add_ref(EFL_SELECT_MODEL_CLASS, efl_main_loop_get(),
|
||||
efl_ui_view_model_set(efl_added, base_model));
|
||||
ck_assert(!!model);
|
||||
future = efl_model_property_set(model, "child.selected", eina_value_int_new(2));
|
||||
|
@ -182,8 +182,8 @@ EFL_START_TEST(efl_test_model_composite_selection)
|
|||
EFL_END_TEST
|
||||
|
||||
void
|
||||
efl_test_case_model_composite_boolean(TCase *tc)
|
||||
efl_test_case_boolean_model(TCase *tc)
|
||||
{
|
||||
tcase_add_test(tc, efl_test_model_composite_boolean);
|
||||
tcase_add_test(tc, efl_test_model_composite_selection);
|
||||
tcase_add_test(tc, efl_test_boolean_model);
|
||||
tcase_add_test(tc, efl_test_select_model);
|
||||
}
|
|
@ -72,9 +72,9 @@ _children_slice_future_then(void *data EINA_UNUSED,
|
|||
return v;
|
||||
}
|
||||
|
||||
EFL_START_TEST(efl_test_model_container_values)
|
||||
EFL_START_TEST(efl_test_container_model_values)
|
||||
{
|
||||
Efl_Model_Container* model;
|
||||
Efl_Container_Model* model;
|
||||
Eina_Future *future;
|
||||
int **cmp_int;
|
||||
const char **cmp_str;
|
||||
|
@ -89,12 +89,12 @@ EFL_START_TEST(efl_test_model_container_values)
|
|||
cmp_str[i] = strdup(base_str[i]);
|
||||
}
|
||||
|
||||
model = efl_add_ref(EFL_MODEL_CONTAINER_CLASS, NULL);
|
||||
model = efl_add_ref(EFL_CONTAINER_MODEL_CLASS, NULL);
|
||||
|
||||
efl_model_container_child_property_add(model, "test_p_int", EINA_VALUE_TYPE_INT,
|
||||
efl_container_model_child_property_add(model, "test_p_int", EINA_VALUE_TYPE_INT,
|
||||
eina_carray_iterator_new((void**)cmp_int));
|
||||
|
||||
efl_model_container_child_property_add(model, "test_p_str", EINA_VALUE_TYPE_STRING,
|
||||
efl_container_model_child_property_add(model, "test_p_str", EINA_VALUE_TYPE_STRING,
|
||||
eina_carray_iterator_new((void**)cmp_str));
|
||||
|
||||
for (i = 0; i < 7; ++i)
|
||||
|
@ -115,7 +115,7 @@ EFL_END_TEST
|
|||
|
||||
|
||||
void
|
||||
efl_test_case_model_container(TCase *tc)
|
||||
efl_test_case_container_model(TCase *tc)
|
||||
{
|
||||
tcase_add_test(tc, efl_test_model_container_values);
|
||||
tcase_add_test(tc, efl_test_container_model_values);
|
||||
}
|
|
@ -27,11 +27,11 @@
|
|||
|
||||
static const int child_number = 3;
|
||||
static const int base_ints[] = { 41, 42, 43 };
|
||||
static const char *_efl_test_model_view_label_format = "Index %i.";
|
||||
static const char *_efl_test_view_model_label_format = "Index %i.";
|
||||
static const char *dependences[] = { "test_p_int" };
|
||||
|
||||
static Eina_Value *
|
||||
_efl_test_model_view_label_get(void *data, const Efl_Model_View *mv, Eina_Stringshare *property)
|
||||
_efl_test_view_model_label_get(void *data, const Efl_View_Model *mv, Eina_Stringshare *property)
|
||||
{
|
||||
Eina_Strbuf *buf;
|
||||
Eina_Value *r;
|
||||
|
@ -54,19 +54,19 @@ _efl_test_model_view_label_get(void *data, const Efl_Model_View *mv, Eina_String
|
|||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_test_model_view_label_set(void *data EINA_UNUSED, Efl_Model_View *mv, Eina_Stringshare *property EINA_UNUSED, Eina_Value *value EINA_UNUSED)
|
||||
_efl_test_view_model_label_set(void *data EINA_UNUSED, Efl_View_Model *mv, Eina_Stringshare *property EINA_UNUSED, Eina_Value *value EINA_UNUSED)
|
||||
{
|
||||
return efl_loop_future_rejected(mv, EFL_MODEL_ERROR_READ_ONLY);
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_test_model_view_label_clean(void *data)
|
||||
_efl_test_view_model_label_clean(void *data)
|
||||
{
|
||||
ck_assert_ptr_eq(data, _efl_test_model_view_label_format);
|
||||
ck_assert_ptr_eq(data, _efl_test_view_model_label_format);
|
||||
}
|
||||
|
||||
static Eina_Value *
|
||||
_efl_test_model_view_color_get(void *data EINA_UNUSED, const Efl_Model_View *mv, Eina_Stringshare *property)
|
||||
_efl_test_view_model_color_get(void *data EINA_UNUSED, const Efl_View_Model *mv, Eina_Stringshare *property)
|
||||
{
|
||||
Eina_Strbuf *buf;
|
||||
Eina_Value *r;
|
||||
|
@ -88,13 +88,13 @@ _efl_test_model_view_color_get(void *data EINA_UNUSED, const Efl_Model_View *mv,
|
|||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_test_model_view_color_set(void *data EINA_UNUSED, Efl_Model_View *mv, Eina_Stringshare *property EINA_UNUSED, Eina_Value *value EINA_UNUSED)
|
||||
_efl_test_view_model_color_set(void *data EINA_UNUSED, Efl_View_Model *mv, Eina_Stringshare *property EINA_UNUSED, Eina_Value *value EINA_UNUSED)
|
||||
{
|
||||
return efl_loop_future_rejected(mv, EFL_MODEL_ERROR_READ_ONLY);
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_test_model_view_color_clean(void *data EINA_UNUSED)
|
||||
_efl_test_view_model_color_clean(void *data EINA_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ _properties_changed(void *data, const Efl_Event *event)
|
|||
}
|
||||
|
||||
static Eina_Value
|
||||
_efl_test_model_view_child_get(Eo *obj EINA_UNUSED,
|
||||
_efl_test_view_model_child_get(Eo *obj EINA_UNUSED,
|
||||
void *data EINA_UNUSED,
|
||||
const Eina_Value v)
|
||||
{
|
||||
|
@ -212,7 +212,7 @@ _efl_test_model_view_child_get(Eo *obj EINA_UNUSED,
|
|||
}
|
||||
|
||||
static Eina_Value
|
||||
_efl_test_model_view_child_fetch(Eo *mv,
|
||||
_efl_test_view_model_child_fetch(Eo *mv,
|
||||
void *data EINA_UNUSED,
|
||||
const Eina_Value v EINA_UNUSED)
|
||||
{
|
||||
|
@ -223,7 +223,7 @@ _efl_test_model_view_child_fetch(Eo *mv,
|
|||
}
|
||||
|
||||
static Eina_Value
|
||||
_efl_test_model_view_child_updated_get(Eo *obj EINA_UNUSED,
|
||||
_efl_test_view_model_child_updated_get(Eo *obj EINA_UNUSED,
|
||||
void *data EINA_UNUSED,
|
||||
const Eina_Value v)
|
||||
{
|
||||
|
@ -258,7 +258,7 @@ _efl_test_model_view_child_updated_get(Eo *obj EINA_UNUSED,
|
|||
}
|
||||
|
||||
static Eina_Value
|
||||
_efl_test_model_view_tests_end(Eo *obj,
|
||||
_efl_test_view_model_tests_end(Eo *obj,
|
||||
void *data EINA_UNUSED,
|
||||
const Eina_Value v)
|
||||
{
|
||||
|
@ -266,14 +266,14 @@ _efl_test_model_view_tests_end(Eo *obj,
|
|||
return v;
|
||||
}
|
||||
|
||||
EFL_START_TEST(efl_test_model_view)
|
||||
EFL_START_TEST(efl_test_view_model)
|
||||
{
|
||||
Efl_Model_Item *base_model, *child, *mv;
|
||||
Efl_Generic_Model *base_model, *child, *mv;
|
||||
Eina_Future *f;
|
||||
int i;
|
||||
Eina_Value v;
|
||||
|
||||
base_model = efl_add_ref(EFL_MODEL_ITEM_CLASS, efl_main_loop_get());
|
||||
base_model = efl_add_ref(EFL_GENERIC_MODEL_CLASS, efl_main_loop_get());
|
||||
ck_assert(!!base_model);
|
||||
|
||||
for (i = 0; i < child_number; ++i)
|
||||
|
@ -284,33 +284,33 @@ EFL_START_TEST(efl_test_model_view)
|
|||
efl_model_property_set(child, "test_p_int", &v);
|
||||
}
|
||||
|
||||
mv = efl_add_ref(EFL_MODEL_VIEW_CLASS, efl_main_loop_get(),
|
||||
mv = efl_add_ref(EFL_VIEW_MODEL_CLASS, efl_main_loop_get(),
|
||||
efl_ui_view_model_set(efl_added, base_model));
|
||||
ck_assert(!!mv);
|
||||
|
||||
efl_model_view_property_logic_add(mv, "label",
|
||||
(void*) _efl_test_model_view_label_format, _efl_test_model_view_label_get, _efl_test_model_view_label_clean,
|
||||
(void*) _efl_test_model_view_label_format, _efl_test_model_view_label_set, _efl_test_model_view_label_clean,
|
||||
efl_view_model_property_logic_add(mv, "label",
|
||||
(void*) _efl_test_view_model_label_format, _efl_test_view_model_label_get, _efl_test_view_model_label_clean,
|
||||
(void*) _efl_test_view_model_label_format, _efl_test_view_model_label_set, _efl_test_view_model_label_clean,
|
||||
EINA_C_ARRAY_ITERATOR_NEW(dependences));
|
||||
|
||||
efl_model_view_property_logic_add(mv, "color",
|
||||
NULL, _efl_test_model_view_color_get, _efl_test_model_view_color_clean,
|
||||
NULL, _efl_test_model_view_color_set, _efl_test_model_view_color_clean,
|
||||
efl_view_model_property_logic_add(mv, "color",
|
||||
NULL, _efl_test_view_model_color_get, _efl_test_view_model_color_clean,
|
||||
NULL, _efl_test_view_model_color_set, _efl_test_view_model_color_clean,
|
||||
EINA_C_ARRAY_ITERATOR_NEW(dependences));
|
||||
|
||||
efl_model_view_property_logic_add(mv, "deadend",
|
||||
efl_view_model_property_logic_add(mv, "deadend",
|
||||
NULL, NULL, NULL,
|
||||
NULL, NULL, NULL,
|
||||
NULL);
|
||||
|
||||
f = efl_model_children_slice_get(mv, 0, efl_model_children_count_get(mv));
|
||||
f = efl_future_then(mv, f, .success_type = EINA_VALUE_TYPE_ARRAY,
|
||||
.success = _efl_test_model_view_child_get);
|
||||
f = efl_future_then(mv, f, .success = _efl_test_model_view_child_fetch);
|
||||
.success = _efl_test_view_model_child_get);
|
||||
f = efl_future_then(mv, f, .success = _efl_test_view_model_child_fetch);
|
||||
f = efl_future_then(mv, f, .success_type = EINA_VALUE_TYPE_ARRAY,
|
||||
.success = _efl_test_model_view_child_updated_get);
|
||||
.success = _efl_test_view_model_child_updated_get);
|
||||
f = efl_future_then(mv, f, .success_type = EINA_VALUE_TYPE_INT,
|
||||
.success = _efl_test_model_view_tests_end);
|
||||
.success = _efl_test_view_model_tests_end);
|
||||
|
||||
// And run !
|
||||
ecore_main_loop_begin();
|
||||
|
@ -321,7 +321,7 @@ EFL_START_TEST(efl_test_model_view)
|
|||
EFL_END_TEST
|
||||
|
||||
void
|
||||
efl_test_case_model_view(TCase *tc)
|
||||
efl_test_case_view_model(TCase *tc)
|
||||
{
|
||||
tcase_add_test(tc, efl_test_model_view);
|
||||
tcase_add_test(tc, efl_test_view_model);
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
efl_suite_src = [
|
||||
'efl_suite.c',
|
||||
'efl_suite.h',
|
||||
'efl_test_model_composite.c',
|
||||
'efl_test_model_container.c',
|
||||
'efl_test_model_view.c'
|
||||
'efl_test_composite_model.c',
|
||||
'efl_test_container_model.c',
|
||||
'efl_test_view_model.c'
|
||||
]
|
||||
|
||||
efl_suite_bin = executable('efl_suite',
|
||||
|
|
|
@ -158,7 +158,7 @@ EFL_CALLBACKS_ARRAY_DEFINE(model,
|
|||
{ EFL_MODEL_EVENT_PROPERTIES_CHANGED, _property_changed },
|
||||
{ EFL_MODEL_EVENT_CHILD_ADDED, _child_added })
|
||||
|
||||
EFL_START_TEST(eio_model_test_test_file)
|
||||
EFL_START_TEST(efl_io_model_test_test_file)
|
||||
{
|
||||
Eo *filemodel = NULL;
|
||||
Eina_Value *result;
|
||||
|
@ -166,8 +166,8 @@ EFL_START_TEST(eio_model_test_test_file)
|
|||
|
||||
memset(&reqs, 0, sizeof(struct reqs_t));
|
||||
|
||||
filemodel = efl_add(EIO_MODEL_CLASS, efl_main_loop_get(),
|
||||
eio_model_path_set(efl_added, EFL_MODEL_TEST_FILENAME_PATH));
|
||||
filemodel = efl_add(EFL_IO_MODEL_CLASS, efl_main_loop_get(),
|
||||
efl_io_model_path_set(efl_added, EFL_MODEL_TEST_FILENAME_PATH));
|
||||
fail_if(!filemodel, "ERROR: Cannot init model!\n");
|
||||
|
||||
handler = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, exit_func, NULL);
|
||||
|
@ -196,7 +196,7 @@ EFL_START_TEST(eio_model_test_test_file)
|
|||
EFL_END_TEST
|
||||
|
||||
void
|
||||
eio_model_test_file(TCase *tc)
|
||||
efl_io_model_test_file(TCase *tc)
|
||||
{
|
||||
tcase_add_test(tc, eio_model_test_test_file);
|
||||
tcase_add_test(tc, efl_io_model_test_test_file);
|
||||
}
|
|
@ -92,15 +92,15 @@ _children_added_cb(void *d EINA_UNUSED, const Efl_Event* event)
|
|||
eina_future_then(future, _children_get, event->object, NULL);
|
||||
}
|
||||
|
||||
EFL_START_TEST(eio_model_test_test_monitor_add)
|
||||
EFL_START_TEST(efl_io_model_test_test_monitor_add)
|
||||
{
|
||||
Eo *filemodel = NULL;
|
||||
|
||||
tmpdir = eina_environment_tmp_get();
|
||||
|
||||
filemodel = efl_add(EIO_MODEL_CLASS,
|
||||
filemodel = efl_add(EFL_IO_MODEL_CLASS,
|
||||
efl_main_loop_get(),
|
||||
eio_model_path_set(efl_added, tmpdir));
|
||||
efl_io_model_path_set(efl_added, tmpdir));
|
||||
fail_if(!filemodel, "ERROR: Cannot init model!\n");
|
||||
|
||||
efl_event_callback_add(filemodel, EFL_MODEL_EVENT_CHILD_ADDED, &_children_added_cb, filemodel);
|
||||
|
@ -115,7 +115,7 @@ EFL_START_TEST(eio_model_test_test_monitor_add)
|
|||
EFL_END_TEST
|
||||
|
||||
void
|
||||
eio_model_test_monitor_add(TCase *tc)
|
||||
efl_io_model_test_monitor_add(TCase *tc)
|
||||
{
|
||||
tcase_add_test(tc, eio_model_test_test_monitor_add);
|
||||
tcase_add_test(tc, efl_io_model_test_test_monitor_add);
|
||||
}
|
|
@ -24,8 +24,8 @@ static const Efl_Test_Case etc[] = {
|
|||
{"Eio", eio_test_init},
|
||||
{"Eio_Monitor", eio_test_monitor},
|
||||
{"Eio_Sentry", eio_test_sentry},
|
||||
{"Eio Model", eio_model_test_file},
|
||||
{"Eio Model Monitor", eio_model_test_monitor_add},
|
||||
{"Efl Io Model", efl_io_model_test_file},
|
||||
{"Efl Io Model Monitor", efl_io_model_test_monitor_add},
|
||||
{"Eio File", eio_test_file},
|
||||
{"Eio Job", eio_test_job},
|
||||
#ifdef XATTR_TEST_DIR
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
#include "../efl_check.h"
|
||||
void eio_test_monitor(TCase *tc);
|
||||
void eio_test_sentry(TCase *tc);
|
||||
void eio_model_test_file(TCase *tc);
|
||||
void eio_model_test_monitor_add(TCase *tc);
|
||||
void efl_io_model_test_file(TCase *tc);
|
||||
void efl_io_model_test_monitor_add(TCase *tc);
|
||||
void eio_test_file(TCase *tc);
|
||||
void eio_test_job(TCase *tc);
|
||||
void eio_test_job_xattr(TCase *tc);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
eio_suite_src = [
|
||||
'eio_suite.c',
|
||||
'eio_model_test_file.c',
|
||||
'eio_model_test_monitor_add.c',
|
||||
'efl_io_model_test_file.c',
|
||||
'efl_io_model_test_monitor_add.c',
|
||||
'eio_test_monitor.c',
|
||||
'eio_test_sentry.c',
|
||||
'eio_test_file.c',
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
#endif
|
||||
|
||||
#include "efl_ui_suite.h"
|
||||
#include "efl_ui_model_homogeneous.eo.h"
|
||||
#include "efl_ui_model_exact.eo.h"
|
||||
#include "efl_ui_model_average.eo.h"
|
||||
#include "efl_ui_homogeneous_model.eo.h"
|
||||
#include "efl_ui_exact_model.eo.h"
|
||||
#include "efl_ui_average_model.eo.h"
|
||||
|
||||
static const int child_number = 3;
|
||||
static const int base_ints[] = { 41, 42, 43 };
|
||||
|
@ -14,13 +14,13 @@ static int expected_average[] = { 0, 0, 0 };
|
|||
static Efl_Model *
|
||||
_generate_base_model(void)
|
||||
{
|
||||
Efl_Model_Item *base_model, *child;
|
||||
Efl_Generic_Model *base_model, *child;
|
||||
Eina_Value v;
|
||||
int i;
|
||||
|
||||
eina_value_setup(&v, EINA_VALUE_TYPE_INT);
|
||||
|
||||
base_model = efl_add_ref(EFL_MODEL_ITEM_CLASS, efl_main_loop_get());
|
||||
base_model = efl_add_ref(EFL_GENERIC_MODEL_CLASS, efl_main_loop_get());
|
||||
ck_assert(!!base_model);
|
||||
for (i = 0; i < child_number; ++i)
|
||||
{
|
||||
|
@ -148,16 +148,16 @@ _children_homogeneous_slice_get_then(Efl_Model *model, void *data EINA_UNUSED, c
|
|||
return eina_future_as_value(f);
|
||||
}
|
||||
|
||||
EFL_START_TEST(efl_ui_model_homogeneous_test)
|
||||
EFL_START_TEST(efl_ui_homogeneous_model_test)
|
||||
{
|
||||
Efl_Model_Item *base_model, *model;
|
||||
Efl_Generic_Model *base_model, *model;
|
||||
Eina_Value *ret__;
|
||||
Eina_Future *future;
|
||||
int real__;
|
||||
|
||||
base_model = _generate_base_model();
|
||||
|
||||
model = efl_add_ref(EFL_UI_MODEL_HOMOGENEOUS_CLASS, efl_main_loop_get(),
|
||||
model = efl_add_ref(EFL_UI_HOMOGENEOUS_MODEL_CLASS, efl_main_loop_get(),
|
||||
efl_ui_view_model_set(efl_added, base_model));
|
||||
ck_assert(!!model);
|
||||
|
||||
|
@ -219,16 +219,16 @@ _children_exact_slice_get_then(Efl_Model *model, void *data EINA_UNUSED, const E
|
|||
return eina_future_as_value(f);
|
||||
}
|
||||
|
||||
EFL_START_TEST(efl_ui_model_exact_test)
|
||||
EFL_START_TEST(efl_ui_exact_model_test)
|
||||
{
|
||||
Efl_Model_Item *base_model, *model;
|
||||
Efl_Generic_Model *base_model, *model;
|
||||
Eina_Future *future;
|
||||
Eina_Value *ret__;
|
||||
int real__;
|
||||
|
||||
base_model = _generate_base_model();
|
||||
|
||||
model = efl_add_ref(EFL_UI_MODEL_EXACT_CLASS, efl_main_loop_get(),
|
||||
model = efl_add_ref(EFL_UI_EXACT_MODEL_CLASS, efl_main_loop_get(),
|
||||
efl_ui_view_model_set(efl_added, base_model));
|
||||
ck_assert(!!model);
|
||||
|
||||
|
@ -307,16 +307,16 @@ _children_average_slice_get_then(Efl_Model *model, void *data EINA_UNUSED, const
|
|||
return eina_future_as_value(f);
|
||||
}
|
||||
|
||||
EFL_START_TEST(efl_ui_model_average_test)
|
||||
EFL_START_TEST(efl_ui_average_model_test)
|
||||
{
|
||||
Efl_Model_Item *base_model, *model;
|
||||
Efl_Generic_Model *base_model, *model;
|
||||
Eina_Future *future;
|
||||
Eina_Value *ret__;
|
||||
int real__;
|
||||
|
||||
base_model = _generate_base_model();
|
||||
|
||||
model = efl_add_ref(EFL_UI_MODEL_AVERAGE_CLASS, efl_main_loop_get(),
|
||||
model = efl_add_ref(EFL_UI_AVERAGE_MODEL_CLASS, efl_main_loop_get(),
|
||||
efl_ui_view_model_set(efl_added, base_model));
|
||||
ck_assert(!!model);
|
||||
|
||||
|
@ -345,7 +345,7 @@ efl_ui_model(TCase *tc)
|
|||
expected_average[1] = ((base_ints[0] * 3 + base_ints[1] * 3) * 3) / 2;
|
||||
expected_average[2] = base_ints[0] * 3 + base_ints[1] * 3 + base_ints[2] * 3;
|
||||
|
||||
tcase_add_test(tc, efl_ui_model_homogeneous_test);
|
||||
tcase_add_test(tc, efl_ui_model_average_test);
|
||||
tcase_add_test(tc, efl_ui_model_exact_test);
|
||||
tcase_add_test(tc, efl_ui_homogeneous_model_test);
|
||||
tcase_add_test(tc, efl_ui_average_model_test);
|
||||
tcase_add_test(tc, efl_ui_exact_model_test);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ EFL_START_TEST(efl_ui_layout_test_model_connect)
|
|||
{
|
||||
char buf[PATH_MAX];
|
||||
Evas_Object *win, *ly;
|
||||
Efl_Model_Item *model;
|
||||
Efl_Generic_Model *model;
|
||||
Eina_Value v;
|
||||
Eina_Future *f;
|
||||
const char *part_text;
|
||||
|
@ -35,7 +35,7 @@ EFL_START_TEST(efl_ui_layout_test_model_connect)
|
|||
efl_file_set(ly, buf, "layout");
|
||||
efl_gfx_entity_visible_set(ly, EINA_TRUE);
|
||||
|
||||
model = efl_add(EFL_MODEL_ITEM_CLASS, win);
|
||||
model = efl_add(EFL_GENERIC_MODEL_CLASS, win);
|
||||
ck_assert(!!eina_value_setup(&v, EINA_VALUE_TYPE_STRING));
|
||||
ck_assert(!!eina_value_set(&v, text_value));
|
||||
f = efl_model_property_set(model, "text_property", &v);
|
||||
|
|
Loading…
Reference in New Issue