summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSangHyeon Jade Lee <sh10233.lee@samsung.com>2019-09-04 11:07:37 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-09-04 11:07:37 -0400
commit4e379f5db4861301b77bf945f7365cb0faa04feb (patch)
tree50a12adf37d0b44eaf253a9dac24e2e1a8c82e75
parent8b49bdb830b8c7b921712ed467f89aa8d6e6ca3f (diff)
Efl_Ui: Move elementary and change namespace Ui for ui related models
Summary: Select and View is ui characteristic features, so Efl_Select_Model and Efl_View_Model move to elementary from ecore seems more natural. namespace also should changed to Efl.Ui as it's right place. Test Plan: run the test while building it Reviewers: cedric, felipealmeida, bu5hm4n, zmike, lauromoura Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9820
-rw-r--r--src/examples/elementary/efl_ui_list_view_example_1.c4
-rw-r--r--src/lib/ecore/Ecore_Eo.h2
-rw-r--r--src/lib/ecore/ecore_internal.h70
-rw-r--r--src/lib/ecore/efl_boolean_model.c2
-rw-r--r--src/lib/ecore/efl_composite_model.c2
-rw-r--r--src/lib/ecore/efl_composite_model_private.h74
-rw-r--r--src/lib/ecore/efl_container_model.c1
-rw-r--r--src/lib/ecore/efl_filter_model.c2
-rw-r--r--src/lib/ecore/meson.build5
-rw-r--r--src/lib/elementary/Efl_Ui.h2
-rw-r--r--src/lib/elementary/efl_ui_select_model.c (renamed from src/lib/ecore/efl_select_model.c)69
-rw-r--r--src/lib/elementary/efl_ui_select_model.eo (renamed from src/lib/ecore/efl_select_model.eo)4
-rw-r--r--src/lib/elementary/efl_ui_view_model.c (renamed from src/lib/ecore/efl_view_model.c)274
-rw-r--r--src/lib/elementary/efl_ui_view_model.eo (renamed from src/lib/ecore/efl_view_model.eo)20
-rw-r--r--src/lib/elementary/meson.build6
-rw-r--r--src/tests/efl/efl_suite.c1
-rw-r--r--src/tests/efl/efl_suite.h1
-rw-r--r--src/tests/efl/efl_test_composite_model.c98
-rw-r--r--src/tests/efl/meson.build1
-rw-r--r--src/tests/elementary/efl_ui_suite.c2
-rw-r--r--src/tests/elementary/efl_ui_suite.h2
-rw-r--r--src/tests/elementary/efl_ui_test_select_model.c130
-rw-r--r--src/tests/elementary/efl_ui_test_view_model.c (renamed from src/tests/efl/efl_test_view_model.c)29
-rw-r--r--src/tests/elementary/meson.build2
24 files changed, 410 insertions, 393 deletions
diff --git a/src/examples/elementary/efl_ui_list_view_example_1.c b/src/examples/elementary/efl_ui_list_view_example_1.c
index c0b377b128..757082aa9d 100644
--- a/src/examples/elementary/efl_ui_list_view_example_1.c
+++ b/src/examples/elementary/efl_ui_list_view_example_1.c
@@ -74,7 +74,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
74 Efl_Ui_Factory *factory; 74 Efl_Ui_Factory *factory;
75 Evas_Object *win, *li; 75 Evas_Object *win, *li;
76 Eo *model; 76 Eo *model;
77 Efl_Select_Model *selmodel; 77 Efl_Ui_Select_Model *selmodel;
78 78
79 win = elm_win_util_standard_add("list_view", "List_View"); 79 win = elm_win_util_standard_add("list_view", "List_View");
80 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); 80 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)
82 elm_win_autodel_set(win, EINA_TRUE); 82 elm_win_autodel_set(win, EINA_TRUE);
83 83
84 model = _make_model(win); 84 model = _make_model(win);
85 selmodel = efl_add(EFL_SELECT_MODEL_CLASS, efl_main_loop_get() 85 selmodel = efl_add(EFL_UI_SELECT_MODEL_CLASS, efl_main_loop_get()
86 , efl_ui_view_model_set(efl_added, model) 86 , efl_ui_view_model_set(efl_added, model)
87 ); 87 );
88 88
diff --git a/src/lib/ecore/Ecore_Eo.h b/src/lib/ecore/Ecore_Eo.h
index 22c9e38f3c..02b44f3482 100644
--- a/src/lib/ecore/Ecore_Eo.h
+++ b/src/lib/ecore/Ecore_Eo.h
@@ -125,9 +125,7 @@ EAPI Eo *efl_main_loop_get(void);
125#include "efl_container_model.eo.h" 125#include "efl_container_model.eo.h"
126#include "efl_composite_model.eo.h" 126#include "efl_composite_model.eo.h"
127#include "efl_boolean_model.eo.h" 127#include "efl_boolean_model.eo.h"
128#include "efl_select_model.eo.h"
129#include "efl_filter_model.eo.h" 128#include "efl_filter_model.eo.h"
130#include "efl_view_model.eo.h"
131 129
132/** 130/**
133 * @} 131 * @}
diff --git a/src/lib/ecore/ecore_internal.h b/src/lib/ecore/ecore_internal.h
index 8a54487aba..32a9472188 100644
--- a/src/lib/ecore/ecore_internal.h
+++ b/src/lib/ecore/ecore_internal.h
@@ -59,6 +59,76 @@ efl_model_list_value_get(Eina_List *childrens,
59 return v; 59 return v;
60} 60}
61 61
62#define EFL_COMPOSITE_MODEL_CHILD_INDEX "child.index"
63
64#define EFL_COMPOSITE_MODEL_PROPERTIES(name, dyn, sta, ...) \
65 EFL_COMPOSITE_MODEL_PROPERTIES_SUPER(name, NULL, NULL, (dyn), sta, ##__VA_ARGS__)
66
67#define EFL_COMPOSITE_MODEL_PROPERTIES_SUPER(name, obj, klass, dyn, ...) \
68 Eina_Iterator *name; \
69 do \
70 { \
71 static const char *static_props__[] = { \
72 __VA_ARGS__ \
73 }; \
74 name = _efl_composite_model_properties_mix( \
75 ((obj) ? efl_model_properties_get(efl_super((obj), (klass))) : NULL), \
76 (dyn), \
77 EINA_C_ARRAY_ITERATOR_NEW(static_props__)); \
78 } \
79 while (0)
80
81
82static inline Eina_Iterator *
83_efl_composite_model_properties_mix(Eina_Iterator *super, Eina_Iterator *dyn, Eina_Iterator *sta)
84{
85 Eina_Iterator *its[3];
86 int i = 0;
87
88 if (sta) its[i++] = sta;
89 if (dyn) its[i++] = dyn;
90 if (super) its[i++] = super;
91
92 switch (i)
93 {
94 case 1: return its[0];
95 case 2: return eina_multi_iterator_new(its[0], its[1]);
96 case 3: return eina_multi_iterator_new(its[0], its[1], its[2]);
97 default: return NULL;
98 };
99}
100
101#define EFL_COMPOSITE_LOOKUP_RETURN(Remember, Parent, View, Base) \
102 Efl_Model *Remember; \
103 char buf[1024]; \
104 \
105 snprintf(buf, sizeof (buf), Base"-%p", Parent); \
106 Remember = efl_key_wref_get(View, buf); \
107 if (Remember) \
108 { \
109 efl_ref(Remember); \
110 return Remember; \
111 }
112
113#define EFL_COMPOSITE_REMEMBER_RETURN(Remember, View) \
114 efl_key_wref_set(View, buf, Remember); \
115 return Remember;
116
117
118static inline Efl_Model *
119_efl_composite_lookup(const Efl_Class *self, Eo *parent, Efl_Model *view, unsigned int index)
120{
121 EFL_COMPOSITE_LOOKUP_RETURN(remember, parent, view, "_efl.composite_model");
122
123 remember = efl_add_ref(self, parent,
124 efl_ui_view_model_set(efl_added, view),
125 efl_composite_model_index_set(efl_added, index),
126 efl_loop_model_volatile_make(efl_added));
127 if (!remember) return NULL;
128
129 EFL_COMPOSITE_REMEMBER_RETURN(remember, view);
130}
131
62#undef EAPI 132#undef EAPI
63#define EAPI 133#define EAPI
64 134
diff --git a/src/lib/ecore/efl_boolean_model.c b/src/lib/ecore/efl_boolean_model.c
index 03e0cee346..2e09930fb0 100644
--- a/src/lib/ecore/efl_boolean_model.c
+++ b/src/lib/ecore/efl_boolean_model.c
@@ -4,7 +4,7 @@
4 4
5#include <Efl_Core.h> 5#include <Efl_Core.h>
6 6
7#include "efl_composite_model_private.h" 7#include "ecore_internal.h"
8 8
9typedef struct _Efl_Boolean_Model_Data Efl_Boolean_Model_Data; 9typedef struct _Efl_Boolean_Model_Data Efl_Boolean_Model_Data;
10typedef struct _Efl_Boolean_Model_Value Efl_Boolean_Model_Value; 10typedef struct _Efl_Boolean_Model_Value Efl_Boolean_Model_Value;
diff --git a/src/lib/ecore/efl_composite_model.c b/src/lib/ecore/efl_composite_model.c
index 17883e8cb5..26322357d2 100644
--- a/src/lib/ecore/efl_composite_model.c
+++ b/src/lib/ecore/efl_composite_model.c
@@ -7,8 +7,6 @@
7#include <Ecore.h> 7#include <Ecore.h>
8 8
9#include "ecore_private.h" 9#include "ecore_private.h"
10
11#include "efl_composite_model_private.h"
12#include "efl_composite_model.eo.h" 10#include "efl_composite_model.eo.h"
13 11
14typedef struct _Efl_Composite_Model_Data Efl_Composite_Model_Data; 12typedef struct _Efl_Composite_Model_Data Efl_Composite_Model_Data;
diff --git a/src/lib/ecore/efl_composite_model_private.h b/src/lib/ecore/efl_composite_model_private.h
deleted file mode 100644
index 67862f968c..0000000000
--- a/src/lib/ecore/efl_composite_model_private.h
+++ /dev/null
@@ -1,74 +0,0 @@
1#ifndef EFL_COMPOSITE_MODEL_PRIVATE_H_
2# define EFL_COMPOSITE_MODEL_PRIVATE_H_
3
4#define EFL_COMPOSITE_MODEL_CHILD_INDEX "child.index"
5
6#define EFL_COMPOSITE_MODEL_PROPERTIES(name, dyn, sta, ...) \
7 EFL_COMPOSITE_MODEL_PROPERTIES_SUPER(name, NULL, NULL, (dyn), sta, ##__VA_ARGS__)
8
9#define EFL_COMPOSITE_MODEL_PROPERTIES_SUPER(name, obj, klass, dyn, ...) \
10 Eina_Iterator *name; \
11 do \
12 { \
13 static const char *static_props__[] = { \
14 __VA_ARGS__ \
15 }; \
16 name = _efl_composite_model_properties_mix( \
17 ((obj) ? efl_model_properties_get(efl_super((obj), (klass))) : NULL), \
18 (dyn), \
19 EINA_C_ARRAY_ITERATOR_NEW(static_props__)); \
20 } \
21 while (0)
22
23
24static inline Eina_Iterator *
25_efl_composite_model_properties_mix(Eina_Iterator *super, Eina_Iterator *dyn, Eina_Iterator *sta)
26{
27 Eina_Iterator *its[3];
28 int i = 0;
29
30 if (sta) its[i++] = sta;
31 if (dyn) its[i++] = dyn;
32 if (super) its[i++] = super;
33
34 switch (i)
35 {
36 case 1: return its[0];
37 case 2: return eina_multi_iterator_new(its[0], its[1]);
38 case 3: return eina_multi_iterator_new(its[0], its[1], its[2]);
39 default: return NULL;
40 };
41}
42
43#define EFL_COMPOSITE_LOOKUP_RETURN(Remember, Parent, View, Base) \
44 Efl_Model *Remember; \
45 char buf[1024]; \
46 \
47 snprintf(buf, sizeof (buf), Base"-%p", Parent); \
48 Remember = efl_key_wref_get(View, buf); \
49 if (Remember) \
50 { \
51 efl_ref(Remember); \
52 return Remember; \
53 }
54
55#define EFL_COMPOSITE_REMEMBER_RETURN(Remember, View) \
56 efl_key_wref_set(View, buf, Remember); \
57 return Remember;
58
59
60static inline Efl_Model *
61_efl_composite_lookup(const Efl_Class *self, Eo *parent, Efl_Model *view, unsigned int index)
62{
63 EFL_COMPOSITE_LOOKUP_RETURN(remember, parent, view, "_efl.composite_model");
64
65 remember = efl_add_ref(self, parent,
66 efl_ui_view_model_set(efl_added, view),
67 efl_composite_model_index_set(efl_added, index),
68 efl_loop_model_volatile_make(efl_added));
69 if (!remember) return NULL;
70
71 EFL_COMPOSITE_REMEMBER_RETURN(remember, view);
72}
73
74#endif
diff --git a/src/lib/ecore/efl_container_model.c b/src/lib/ecore/efl_container_model.c
index 08c1b65d7b..b8f40eedc2 100644
--- a/src/lib/ecore/efl_container_model.c
+++ b/src/lib/ecore/efl_container_model.c
@@ -8,7 +8,6 @@
8#include <Ecore.h> 8#include <Ecore.h>
9 9
10#include "ecore_internal.h" 10#include "ecore_internal.h"
11#include "efl_composite_model_private.h"
12 11
13typedef struct _Efl_Container_Property_Data Efl_Container_Property_Data; 12typedef struct _Efl_Container_Property_Data Efl_Container_Property_Data;
14typedef struct _Efl_Container_Model_Data Efl_Container_Model_Data; 13typedef struct _Efl_Container_Model_Data Efl_Container_Model_Data;
diff --git a/src/lib/ecore/efl_filter_model.c b/src/lib/ecore/efl_filter_model.c
index 7626f5dbbb..a382b7bd92 100644
--- a/src/lib/ecore/efl_filter_model.c
+++ b/src/lib/ecore/efl_filter_model.c
@@ -4,7 +4,7 @@
4 4
5#include <Efl_Core.h> 5#include <Efl_Core.h>
6 6
7#include "efl_composite_model_private.h" 7#include "ecore_internal.h"
8 8
9typedef struct _Efl_Filter_Model_Mapping Efl_Filter_Model_Mapping; 9typedef struct _Efl_Filter_Model_Mapping Efl_Filter_Model_Mapping;
10struct _Efl_Filter_Model_Mapping 10struct _Efl_Filter_Model_Mapping
diff --git a/src/lib/ecore/meson.build b/src/lib/ecore/meson.build
index c8859439b2..eb8be6c33f 100644
--- a/src/lib/ecore/meson.build
+++ b/src/lib/ecore/meson.build
@@ -59,9 +59,7 @@ pub_eo_files = [
59 'efl_generic_model.eo', 59 'efl_generic_model.eo',
60 'efl_container_model.eo', 60 'efl_container_model.eo',
61 'efl_boolean_model.eo', 61 'efl_boolean_model.eo',
62 'efl_select_model.eo',
63 'efl_composite_model.eo', 62 'efl_composite_model.eo',
64 'efl_view_model.eo',
65 'efl_core_env.eo', 63 'efl_core_env.eo',
66 'efl_core_proc_env.eo', 64 'efl_core_proc_env.eo',
67 'efl_core_command_line.eo', 65 'efl_core_command_line.eo',
@@ -141,11 +139,8 @@ ecore_src = [
141 'efl_container_model.c', 139 'efl_container_model.c',
142 'efl_composite_model.c', 140 'efl_composite_model.c',
143 'efl_boolean_model.c', 141 'efl_boolean_model.c',
144 'efl_select_model.c',
145 'efl_composite_model_private.h',
146 'efl_model_accessor_view.c', 142 'efl_model_accessor_view.c',
147 'efl_model_accessor_view_private.h', 143 'efl_model_accessor_view_private.h',
148 'efl_view_model.c',
149 'efl_filter_model.c', 144 'efl_filter_model.c',
150 'efl_linear_interpolator.c', 145 'efl_linear_interpolator.c',
151 'efl_accelerate_interpolator.c', 146 'efl_accelerate_interpolator.c',
diff --git a/src/lib/elementary/Efl_Ui.h b/src/lib/elementary/Efl_Ui.h
index a8f6d0c27d..9db87890f9 100644
--- a/src/lib/elementary/Efl_Ui.h
+++ b/src/lib/elementary/Efl_Ui.h
@@ -276,6 +276,8 @@ typedef Eo Efl_Ui_Spotlight_Indicator;
276# include <efl_ui_tab_bar.eo.h> 276# include <efl_ui_tab_bar.eo.h>
277# include <efl_ui_tab_page.eo.h> 277# include <efl_ui_tab_page.eo.h>
278# include <efl_ui_tab_pager.eo.h> 278# include <efl_ui_tab_pager.eo.h>
279# include <efl_ui_select_model.eo.h>
280# include <efl_ui_view_model.eo.h>
279/** 281/**
280 * Initialize Elementary 282 * Initialize Elementary
281 * 283 *
diff --git a/src/lib/ecore/efl_select_model.c b/src/lib/elementary/efl_ui_select_model.c
index a8e267e816..e862b569e0 100644
--- a/src/lib/ecore/efl_select_model.c
+++ b/src/lib/elementary/efl_ui_select_model.c
@@ -2,20 +2,17 @@
2# include <config.h> 2# include <config.h>
3#endif 3#endif
4 4
5#include "Eina.h" 5#include <Elementary.h>
6#include "Efl.h" 6#include "elm_priv.h"
7#include <Ecore.h>
8#include "Eo.h"
9 7
10#include "efl_select_model.eo.h" 8#include "efl_ui_select_model.eo.h"
11#include "efl_model_accessor_view_private.h" 9#include "ecore_internal.h"
12#include "efl_composite_model_private.h"
13 10
14typedef struct _Efl_Select_Model_Data Efl_Select_Model_Data; 11typedef struct _Efl_Ui_Select_Model_Data Efl_Ui_Select_Model_Data;
15 12
16struct _Efl_Select_Model_Data 13struct _Efl_Ui_Select_Model_Data
17{ 14{
18 Efl_Select_Model_Data *parent; 15 Efl_Ui_Select_Model_Data *parent;
19 unsigned long last; 16 unsigned long last;
20 17
21 Eina_Bool single_selection : 1; 18 Eina_Bool single_selection : 1;
@@ -23,20 +20,20 @@ struct _Efl_Select_Model_Data
23}; 20};
24 21
25static Eo* 22static Eo*
26_efl_select_model_efl_object_constructor(Eo *obj, 23_efl_ui_select_model_efl_object_constructor(Eo *obj,
27 Efl_Select_Model_Data *pd EINA_UNUSED) 24 Efl_Ui_Select_Model_Data *pd EINA_UNUSED)
28{ 25{
29 Eo *parent; 26 Eo *parent;
30 27
31 obj = efl_constructor(efl_super(obj, EFL_SELECT_MODEL_CLASS)); 28 obj = efl_constructor(efl_super(obj, EFL_UI_SELECT_MODEL_CLASS));
32 29
33 efl_boolean_model_boolean_add(obj, "selected", EINA_FALSE); 30 efl_boolean_model_boolean_add(obj, "selected", EINA_FALSE);
34 31
35 pd->last = -1; 32 pd->last = -1;
36 33
37 parent = efl_parent_get(obj); 34 parent = efl_parent_get(obj);
38 if (efl_isa(parent, EFL_SELECT_MODEL_CLASS)) 35 if (efl_isa(parent, EFL_UI_SELECT_MODEL_CLASS))
39 pd->parent = efl_data_scope_get(parent, EFL_SELECT_MODEL_CLASS); 36 pd->parent = efl_data_scope_get(parent, EFL_UI_SELECT_MODEL_CLASS);
40 37
41 return obj; 38 return obj;
42} 39}
@@ -44,7 +41,7 @@ _efl_select_model_efl_object_constructor(Eo *obj,
44static Eina_Value 41static Eina_Value
45_commit_change(Eo *child, void *data EINA_UNUSED, const Eina_Value v) 42_commit_change(Eo *child, void *data EINA_UNUSED, const Eina_Value v)
46{ 43{
47 Efl_Select_Model_Data *pd; 44 Efl_Ui_Select_Model_Data *pd;
48 Eina_Value *selected = NULL; 45 Eina_Value *selected = NULL;
49 Eina_Bool selflag = EINA_FALSE; 46 Eina_Bool selflag = EINA_FALSE;
50 47
@@ -53,7 +50,7 @@ _commit_change(Eo *child, void *data EINA_UNUSED, const Eina_Value v)
53 50
54 selected = efl_model_property_get(child, "selected"); 51 selected = efl_model_property_get(child, "selected");
55 52
56 pd = efl_data_scope_get(efl_parent_get(child), EFL_SELECT_MODEL_CLASS); 53 pd = efl_data_scope_get(efl_parent_get(child), EFL_UI_SELECT_MODEL_CLASS);
57 if (!pd) goto on_error; 54 if (!pd) goto on_error;
58 55
59 eina_value_bool_get(selected, &selflag); 56 eina_value_bool_get(selected, &selflag);
@@ -62,7 +59,7 @@ _commit_change(Eo *child, void *data EINA_UNUSED, const Eina_Value v)
62 // select case 59 // select case
63 pd->none = EINA_FALSE; 60 pd->none = EINA_FALSE;
64 pd->last = efl_composite_model_index_get(child); 61 pd->last = efl_composite_model_index_get(child);
65 efl_event_callback_call(child, EFL_SELECT_MODEL_EVENT_SELECTED, child); 62 efl_event_callback_call(child, EFL_UI_SELECT_MODEL_EVENT_SELECTED, child);
66 } 63 }
67 else 64 else
68 { 65 {
@@ -75,7 +72,7 @@ _commit_change(Eo *child, void *data EINA_UNUSED, const Eina_Value v)
75 pd->last = 0; 72 pd->last = 0;
76 pd->none = EINA_TRUE; 73 pd->none = EINA_TRUE;
77 } 74 }
78 efl_event_callback_call(child, EFL_SELECT_MODEL_EVENT_UNSELECTED, child); 75 efl_event_callback_call(child, EFL_UI_SELECT_MODEL_EVENT_UNSELECTED, child);
79 } 76 }
80 77
81 on_error: 78 on_error:
@@ -222,7 +219,7 @@ _untangle_error(void *data, Eina_Error err)
222 // where we could end up here. 219 // where we could end up here.
223 Eina_Error *error = calloc(1, sizeof (Eina_Error)); 220 Eina_Error *error = calloc(1, sizeof (Eina_Error));
224 221
225 f = efl_model_property_set(efl_super(child, EFL_SELECT_MODEL_CLASS), 222 f = efl_model_property_set(efl_super(child, EFL_UI_SELECT_MODEL_CLASS),
226 "selected", eina_value_bool_new(EINA_FALSE)); 223 "selected", eina_value_bool_new(EINA_FALSE));
227 // Once this is done, we need to repropagate the error 224 // Once this is done, we need to repropagate the error
228 *error = err; 225 *error = err;
@@ -241,19 +238,19 @@ _untangle_free(void *data,
241} 238}
242 239
243static Eina_Iterator * 240static Eina_Iterator *
244_efl_select_model_efl_model_properties_get(const Eo *obj, 241_efl_ui_select_model_efl_model_properties_get(const Eo *obj,
245 Efl_Select_Model_Data *pd EINA_UNUSED) 242 Efl_Ui_Select_Model_Data *pd EINA_UNUSED)
246{ 243{
247 EFL_COMPOSITE_MODEL_PROPERTIES_SUPER(props, 244 EFL_COMPOSITE_MODEL_PROPERTIES_SUPER(props,
248 obj, EFL_SELECT_MODEL_CLASS, 245 obj, EFL_UI_SELECT_MODEL_CLASS,
249 NULL, 246 NULL,
250 "self.selected", "child.selected", "single_selection"); 247 "self.selected", "child.selected", "single_selection");
251 return props; 248 return props;
252} 249}
253 250
254static Eina_Future * 251static Eina_Future *
255_efl_select_model_efl_model_property_set(Eo *obj, 252_efl_ui_select_model_efl_model_property_set(Eo *obj,
256 Efl_Select_Model_Data *pd, 253 Efl_Ui_Select_Model_Data *pd,
257 const char *property, Eina_Value *value) 254 const char *property, Eina_Value *value)
258{ 255{
259 Eina_Value vf = EINA_VALUE_EMPTY; 256 Eina_Value vf = EINA_VALUE_EMPTY;
@@ -296,7 +293,7 @@ _efl_select_model_efl_model_property_set(Eo *obj,
296 Eina_Value *prev; 293 Eina_Value *prev;
297 Eina_Future *chain; 294 Eina_Future *chain;
298 295
299 prev = efl_model_property_get(efl_super(obj, EFL_SELECT_MODEL_CLASS), "selected"); 296 prev = efl_model_property_get(efl_super(obj, EFL_UI_SELECT_MODEL_CLASS), "selected");
300 success = eina_value_bool_get(prev, &prevflag); 297 success = eina_value_bool_get(prev, &prevflag);
301 success &= eina_value_bool_convert(value, &newflag); 298 success &= eina_value_bool_convert(value, &newflag);
302 299
@@ -309,7 +306,7 @@ _efl_select_model_efl_model_property_set(Eo *obj,
309 single_selection = pd->parent->single_selection; 306 single_selection = pd->parent->single_selection;
310 307
311 // First store the new value in the boolean model we inherit from 308 // First store the new value in the boolean model we inherit from
312 chain = efl_model_property_set(efl_super(obj, EFL_SELECT_MODEL_CLASS), 309 chain = efl_model_property_set(efl_super(obj, EFL_UI_SELECT_MODEL_CLASS),
313 "selected", value); 310 "selected", value);
314 311
315 // Now act ! 312 // Now act !
@@ -357,12 +354,12 @@ _efl_select_model_efl_model_property_set(Eo *obj,
357 .free = _clear_child); 354 .free = _clear_child);
358 } 355 }
359 356
360 return efl_model_property_set(efl_super(obj, EFL_SELECT_MODEL_CLASS), 357 return efl_model_property_set(efl_super(obj, EFL_UI_SELECT_MODEL_CLASS),
361 property, value); 358 property, value);
362} 359}
363 360
364static Eina_Value * 361static Eina_Value *
365_efl_select_model_efl_model_property_get(const Eo *obj, Efl_Select_Model_Data *pd, const char *property) 362_efl_ui_select_model_efl_model_property_get(const Eo *obj, Efl_Ui_Select_Model_Data *pd, const char *property)
366{ 363{
367 if (eina_streq("single_selection", property)) 364 if (eina_streq("single_selection", property))
368 return eina_value_bool_new(pd->single_selection); 365 return eina_value_bool_new(pd->single_selection);
@@ -377,34 +374,34 @@ _efl_select_model_efl_model_property_get(const Eo *obj, Efl_Select_Model_Data *p
377 // Redirect to are we ourself selected 374 // Redirect to are we ourself selected
378 if (pd->parent && eina_streq("self.selected", property)) 375 if (pd->parent && eina_streq("self.selected", property))
379 { 376 {
380 return efl_model_property_get(efl_super(obj, EFL_SELECT_MODEL_CLASS), "selected"); 377 return efl_model_property_get(efl_super(obj, EFL_UI_SELECT_MODEL_CLASS), "selected");
381 } 378 }
382 379
383 return efl_model_property_get(efl_super(obj, EFL_SELECT_MODEL_CLASS), property); 380 return efl_model_property_get(efl_super(obj, EFL_UI_SELECT_MODEL_CLASS), property);
384} 381}
385 382
386static void 383static void
387_efl_select_model_single_selection_set(Eo *obj EINA_UNUSED, Efl_Select_Model_Data *pd, Eina_Bool enable) 384_efl_ui_select_model_single_selection_set(Eo *obj EINA_UNUSED, Efl_Ui_Select_Model_Data *pd, Eina_Bool enable)
388{ 385{
389 pd->single_selection = enable; 386 pd->single_selection = enable;
390} 387}
391 388
392static Eina_Bool 389static Eina_Bool
393_efl_select_model_single_selection_get(const Eo *obj EINA_UNUSED, Efl_Select_Model_Data *pd) 390_efl_ui_select_model_single_selection_get(const Eo *obj EINA_UNUSED, Efl_Ui_Select_Model_Data *pd)
394{ 391{
395 return pd->single_selection; 392 return pd->single_selection;
396} 393}
397 394
398static Eina_Iterator * 395static Eina_Iterator *
399_efl_select_model_selected_get(Eo *obj, Efl_Select_Model_Data *pd EINA_UNUSED) 396_efl_ui_select_model_selected_get(Eo *obj, Efl_Ui_Select_Model_Data *pd EINA_UNUSED)
400{ 397{
401 return efl_boolean_model_boolean_iterator_get(obj, "selected", EINA_TRUE); 398 return efl_boolean_model_boolean_iterator_get(obj, "selected", EINA_TRUE);
402} 399}
403 400
404static Eina_Iterator * 401static Eina_Iterator *
405_efl_select_model_unselected_get(Eo *obj, Efl_Select_Model_Data *pd EINA_UNUSED) 402_efl_ui_select_model_unselected_get(Eo *obj, Efl_Ui_Select_Model_Data *pd EINA_UNUSED)
406{ 403{
407 return efl_boolean_model_boolean_iterator_get(obj, "selected", EINA_FALSE); 404 return efl_boolean_model_boolean_iterator_get(obj, "selected", EINA_FALSE);
408} 405}
409 406
410#include "efl_select_model.eo.c" 407#include "efl_ui_select_model.eo.c"
diff --git a/src/lib/ecore/efl_select_model.eo b/src/lib/elementary/efl_ui_select_model.eo
index ea1fd52015..7e6a76c33b 100644
--- a/src/lib/ecore/efl_select_model.eo
+++ b/src/lib/elementary/efl_ui_select_model.eo
@@ -1,6 +1,6 @@
1class @beta Efl.Select_Model extends Efl.Boolean_Model 1class @beta Efl.Ui.Select_Model extends Efl.Boolean_Model
2{ 2{
3 [[Efl select model class]] 3 [[Efl ui select model class]]
4 methods { 4 methods {
5 selected_get { 5 selected_get {
6 [[Get an iterator of all the selected child of this model. 6 [[Get an iterator of all the selected child of this model.
diff --git a/src/lib/ecore/efl_view_model.c b/src/lib/elementary/efl_ui_view_model.c
index a19050e9be..0580ff7d41 100644
--- a/src/lib/ecore/efl_view_model.c
+++ b/src/lib/elementary/efl_ui_view_model.c
@@ -2,31 +2,27 @@
2# include <config.h> 2# include <config.h>
3#endif 3#endif
4 4
5#include <Efl.h> 5#include <Elementary.h>
6#include <Eina.h> 6#include "elm_priv.h"
7#include <Eo.h>
8#include <Ecore.h>
9 7
10#include "ecore_internal.h" 8#include "ecore_internal.h"
11 9
12#include "efl_composite_model_private.h" 10typedef struct _Efl_Ui_View_Model_Data Efl_Ui_View_Model_Data;
11typedef struct _Efl_Ui_View_Model_Bind Efl_Ui_View_Model_Bind;
12typedef struct _Efl_Ui_View_Model_Text Efl_Ui_View_Model_Text;
13typedef struct _Efl_Ui_View_Model_Logic Efl_Ui_View_Model_Logic;
14typedef struct _Efl_Ui_View_Model_Property_Ref Efl_Ui_View_Model_Property_Ref;
13 15
14typedef struct _Efl_View_Model_Data Efl_View_Model_Data; 16struct _Efl_Ui_View_Model_Data
15typedef struct _Efl_View_Model_Bind Efl_View_Model_Bind;
16typedef struct _Efl_View_Model_Text Efl_View_Model_Text;
17typedef struct _Efl_View_Model_Logic Efl_View_Model_Logic;
18typedef struct _Efl_View_Model_Property_Ref Efl_View_Model_Property_Ref;
19
20struct _Efl_View_Model_Data
21{ 17{
22 // FIXME: If parent is set, always access parent... recursively? 18 // FIXME: If parent is set, always access parent... recursively?
23 Efl_View_Model_Data *parent; 19 Efl_Ui_View_Model_Data *parent;
24 20
25 Eina_Hash *bound; // Stringhash of Efl_View_Model_Bind 21 Eina_Hash *bound; // Stringhash of Efl_Ui_View_Model_Bind
26 Eina_Hash *logics; // Stringhash of Efl_View_Model_Logic 22 Eina_Hash *logics; // Stringhash of Efl_Ui_View_Model_Logic
27 Eina_Hash *texts; // Stringhash of Efl_View_Model_Text 23 Eina_Hash *texts; // Stringhash of Efl_Ui_View_Model_Text
28 24
29 Eina_Hash *deduplication; // Stringhash of Efl_View_Model_Property_Ref 25 Eina_Hash *deduplication; // Stringhash of Efl_Ui_View_Model_Property_Ref
30 26
31 struct { 27 struct {
32 Eina_Bool property_changed : 1; 28 Eina_Bool property_changed : 1;
@@ -37,7 +33,7 @@ struct _Efl_View_Model_Data
37 Eina_Bool children_bind : 1; // Define if child object should be automatically binded 33 Eina_Bool children_bind : 1; // Define if child object should be automatically binded
38}; 34};
39 35
40struct _Efl_View_Model_Text 36struct _Efl_Ui_View_Model_Text
41{ 37{
42 Eina_Stringshare *name; 38 Eina_Stringshare *name;
43 Eina_Stringshare *definition; 39 Eina_Stringshare *definition;
@@ -46,21 +42,21 @@ struct _Efl_View_Model_Text
46 Efl_Model *self; 42 Efl_Model *self;
47}; 43};
48 44
49struct _Efl_View_Model_Bind 45struct _Efl_Ui_View_Model_Bind
50{ 46{
51 Eina_Stringshare *source; 47 Eina_Stringshare *source;
52 Eina_List *destinations; 48 Eina_List *destinations;
53}; 49};
54 50
55struct _Efl_View_Model_Logic 51struct _Efl_Ui_View_Model_Logic
56{ 52{
57 struct { 53 struct {
58 EflViewModelPropertyGet fct; 54 EflUiViewModelPropertyGet fct;
59 Eina_Free_Cb free_cb; 55 Eina_Free_Cb free_cb;
60 void *data; 56 void *data;
61 } get; 57 } get;
62 struct { 58 struct {
63 EflViewModelPropertySet fct; 59 EflUiViewModelPropertySet fct;
64 Eina_Free_Cb free_cb; 60 Eina_Free_Cb free_cb;
65 void *data; 61 void *data;
66 } set; 62 } set;
@@ -70,7 +66,7 @@ struct _Efl_View_Model_Logic
70 Eina_Stringshare *property; 66 Eina_Stringshare *property;
71}; 67};
72 68
73struct _Efl_View_Model_Property_Ref 69struct _Efl_Ui_View_Model_Property_Ref
74{ 70{
75 EINA_REFCOUNT; 71 EINA_REFCOUNT;
76 Eina_Stringshare *property; 72 Eina_Stringshare *property;
@@ -79,21 +75,21 @@ struct _Efl_View_Model_Property_Ref
79static void 75static void
80_ref_free(void *data) 76_ref_free(void *data)
81{ 77{
82 Efl_View_Model_Property_Ref *r = data; 78 Efl_Ui_View_Model_Property_Ref *r = data;
83 79
84 eina_stringshare_del(r->property); 80 eina_stringshare_del(r->property);
85 free(r); 81 free(r);
86} 82}
87 83
88static void 84static void
89_ref_add(Efl_View_Model_Data *pd, Eina_Stringshare *property) 85_ref_add(Efl_Ui_View_Model_Data *pd, Eina_Stringshare *property)
90{ 86{
91 Efl_View_Model_Property_Ref *r; 87 Efl_Ui_View_Model_Property_Ref *r;
92 88
93 r = eina_hash_find(pd->deduplication, property); 89 r = eina_hash_find(pd->deduplication, property);
94 if (!r) 90 if (!r)
95 { 91 {
96 r = calloc(1, sizeof (Efl_View_Model_Property_Ref)); 92 r = calloc(1, sizeof (Efl_Ui_View_Model_Property_Ref));
97 if (!r) return ; 93 if (!r) return ;
98 r->property = eina_stringshare_ref(property); 94 r->property = eina_stringshare_ref(property);
99 95
@@ -104,9 +100,9 @@ _ref_add(Efl_View_Model_Data *pd, Eina_Stringshare *property)
104} 100}
105 101
106static void 102static void
107_ref_del(Efl_View_Model_Data *pd, Eina_Stringshare *property) 103_ref_del(Efl_Ui_View_Model_Data *pd, Eina_Stringshare *property)
108{ 104{
109 Efl_View_Model_Property_Ref *r; 105 Efl_Ui_View_Model_Property_Ref *r;
110 106
111 r = eina_hash_find(pd->deduplication, property); 107 r = eina_hash_find(pd->deduplication, property);
112 if (!r) return ; 108 if (!r) return ;
@@ -118,14 +114,14 @@ _ref_del(Efl_View_Model_Data *pd, Eina_Stringshare *property)
118static void 114static void
119_logic_free(void *data) 115_logic_free(void *data)
120{ 116{
121 Efl_View_Model_Logic *logic = data; 117 Efl_Ui_View_Model_Logic *logic = data;
122 Eina_Stringshare *source; 118 Eina_Stringshare *source;
123 119
124 if (logic->get.free_cb) logic->get.free_cb(logic->get.data); 120 if (logic->get.free_cb) logic->get.free_cb(logic->get.data);
125 if (logic->set.free_cb) logic->set.free_cb(logic->set.data); 121 if (logic->set.free_cb) logic->set.free_cb(logic->set.data);
126 EINA_LIST_FREE(logic->sources, source) 122 EINA_LIST_FREE(logic->sources, source)
127 { 123 {
128 efl_view_model_property_unbind(logic->object, source, logic->property); 124 efl_ui_view_model_property_unbind(logic->object, source, logic->property);
129 eina_stringshare_del(source); 125 eina_stringshare_del(source);
130 } 126 }
131 eina_stringshare_del(logic->property); 127 eina_stringshare_del(logic->property);
@@ -133,16 +129,16 @@ _logic_free(void *data)
133} 129}
134 130
135static Eina_Value * 131static Eina_Value *
136_efl_view_model_property_dummy_get(void *data EINA_UNUSED, 132_efl_ui_view_model_property_dummy_get(void *data EINA_UNUSED,
137 const Efl_View_Model *view_model EINA_UNUSED, 133 const Efl_Ui_View_Model *view_model EINA_UNUSED,
138 Eina_Stringshare *property EINA_UNUSED) 134 Eina_Stringshare *property EINA_UNUSED)
139{ 135{
140 return eina_value_error_new(EFL_MODEL_ERROR_NOT_SUPPORTED); 136 return eina_value_error_new(EFL_MODEL_ERROR_NOT_SUPPORTED);
141} 137}
142 138
143static Eina_Future * 139static Eina_Future *
144_efl_view_model_property_dummy_set(void *data EINA_UNUSED, 140_efl_ui_view_model_property_dummy_set(void *data EINA_UNUSED,
145 Efl_View_Model *view_model, 141 Efl_Ui_View_Model *view_model,
146 Eina_Stringshare *property EINA_UNUSED, 142 Eina_Stringshare *property EINA_UNUSED,
147 Eina_Value *value EINA_UNUSED) 143 Eina_Value *value EINA_UNUSED)
148{ 144{
@@ -150,13 +146,13 @@ _efl_view_model_property_dummy_set(void *data EINA_UNUSED,
150} 146}
151 147
152static Eina_Error 148static Eina_Error
153_efl_view_model_property_logic_add(Eo *obj, Efl_View_Model_Data *pd, 149_efl_ui_view_model_property_logic_add(Eo *obj, Efl_Ui_View_Model_Data *pd,
154 const char *property, 150 const char *property,
155 void *get_data, EflViewModelPropertyGet get, Eina_Free_Cb get_free_cb, 151 void *get_data, EflUiViewModelPropertyGet get, Eina_Free_Cb get_free_cb,
156 void *set_data, EflViewModelPropertySet set, Eina_Free_Cb set_free_cb, 152 void *set_data, EflUiViewModelPropertySet set, Eina_Free_Cb set_free_cb,
157 Eina_Iterator *bound) 153 Eina_Iterator *bound)
158{ 154{
159 Efl_View_Model_Logic *logic; 155 Efl_Ui_View_Model_Logic *logic;
160 Eina_Stringshare *prop; 156 Eina_Stringshare *prop;
161 const char *source; 157 const char *source;
162 158
@@ -168,15 +164,15 @@ _efl_view_model_property_logic_add(Eo *obj, Efl_View_Model_Data *pd,
168 return EFL_MODEL_ERROR_INCORRECT_VALUE; 164 return EFL_MODEL_ERROR_INCORRECT_VALUE;
169 } 165 }
170 166
171 logic = calloc(1, sizeof (Efl_View_Model_Logic)); 167 logic = calloc(1, sizeof (Efl_Ui_View_Model_Logic));
172 if (!logic) return ENOMEM; 168 if (!logic) return ENOMEM;
173 169
174 logic->object = obj; 170 logic->object = obj;
175 logic->property = prop; 171 logic->property = prop;
176 logic->get.fct = get ? get : _efl_view_model_property_dummy_get; 172 logic->get.fct = get ? get : _efl_ui_view_model_property_dummy_get;
177 logic->get.free_cb = get_free_cb; 173 logic->get.free_cb = get_free_cb;
178 logic->get.data = get_data; 174 logic->get.data = get_data;
179 logic->set.fct = set ? set : _efl_view_model_property_dummy_set; 175 logic->set.fct = set ? set : _efl_ui_view_model_property_dummy_set;
180 logic->set.free_cb = set_free_cb; 176 logic->set.free_cb = set_free_cb;
181 logic->set.data = set_data; 177 logic->set.data = set_data;
182 178
@@ -185,17 +181,17 @@ _efl_view_model_property_logic_add(Eo *obj, Efl_View_Model_Data *pd,
185 EINA_ITERATOR_FOREACH(bound, source) 181 EINA_ITERATOR_FOREACH(bound, source)
186 { 182 {
187 logic->sources = eina_list_append(logic->sources, eina_stringshare_add(source)); 183 logic->sources = eina_list_append(logic->sources, eina_stringshare_add(source));
188 efl_view_model_property_bind(obj, source, property); 184 efl_ui_view_model_property_bind(obj, source, property);
189 } 185 }
190 186
191 return 0; 187 return 0;
192} 188}
193 189
194static Eina_Error 190static Eina_Error
195_efl_view_model_property_logic_del(Eo *obj EINA_UNUSED, Efl_View_Model_Data *pd, 191_efl_ui_view_model_property_logic_del(Eo *obj EINA_UNUSED, Efl_Ui_View_Model_Data *pd,
196 const char *property) 192 const char *property)
197{ 193{
198 Efl_View_Model_Logic *logic; 194 Efl_Ui_View_Model_Logic *logic;
199 195
200 logic = eina_hash_find(pd->logics, property); 196 logic = eina_hash_find(pd->logics, property);
201 if (!logic) return EFL_MODEL_ERROR_INCORRECT_VALUE; 197 if (!logic) return EFL_MODEL_ERROR_INCORRECT_VALUE;
@@ -235,13 +231,13 @@ _lookup_next_token(const char *definition,
235} 231}
236 232
237static Eina_Error 233static Eina_Error
238_efl_view_model_property_string_add(Eo *obj, Efl_View_Model_Data *pd, 234_efl_ui_view_model_property_string_add(Eo *obj, Efl_Ui_View_Model_Data *pd,
239 const char *name, 235 const char *name,
240 const char *definition, 236 const char *definition,
241 const char *not_ready, 237 const char *not_ready,
242 const char *on_error) 238 const char *on_error)
243{ 239{
244 Efl_View_Model_Text *text; 240 Efl_Ui_View_Model_Text *text;
245 Eina_Stringshare *sn; 241 Eina_Stringshare *sn;
246 Eina_Slstr *st = NULL; 242 Eina_Slstr *st = NULL;
247 Eina_Slstr *sp = NULL; 243 Eina_Slstr *sp = NULL;
@@ -255,9 +251,9 @@ _efl_view_model_property_string_add(Eo *obj, Efl_View_Model_Data *pd,
255 251
256 // Lookup if there is an existing property defined and undo it first 252 // Lookup if there is an existing property defined and undo it first
257 text = eina_hash_find(pd->texts, sn); 253 text = eina_hash_find(pd->texts, sn);
258 if (text) efl_view_model_property_string_del(obj, sn); 254 if (text) efl_ui_view_model_property_string_del(obj, sn);
259 255
260 text = calloc(1, sizeof (Efl_View_Model_Text)); 256 text = calloc(1, sizeof (Efl_Ui_View_Model_Text));
261 if (!text) goto on_error; 257 if (!text) goto on_error;
262 258
263 err = EFL_MODEL_ERROR_INCORRECT_VALUE; 259 err = EFL_MODEL_ERROR_INCORRECT_VALUE;
@@ -272,21 +268,21 @@ _efl_view_model_property_string_add(Eo *obj, Efl_View_Model_Data *pd,
272 lookup; 268 lookup;
273 definition += lookup, lookup = _lookup_next_token(definition, &st, &sp)) 269 definition += lookup, lookup = _lookup_next_token(definition, &st, &sp))
274 { 270 {
275 if (sp) efl_view_model_property_bind(obj, sp, name); 271 if (sp) efl_ui_view_model_property_bind(obj, sp, name);
276 } 272 }
277 273
278 for (lookup = _lookup_next_token(not_ready, &st, &sp); 274 for (lookup = _lookup_next_token(not_ready, &st, &sp);
279 lookup; 275 lookup;
280 not_ready += lookup, lookup = _lookup_next_token(not_ready, &st, &sp)) 276 not_ready += lookup, lookup = _lookup_next_token(not_ready, &st, &sp))
281 { 277 {
282 if (sp) efl_view_model_property_bind(obj, sp, name); 278 if (sp) efl_ui_view_model_property_bind(obj, sp, name);
283 } 279 }
284 280
285 for (lookup = _lookup_next_token(on_error, &st, &sp); 281 for (lookup = _lookup_next_token(on_error, &st, &sp);
286 lookup; 282 lookup;
287 on_error += lookup, lookup = _lookup_next_token(on_error, &st, &sp)) 283 on_error += lookup, lookup = _lookup_next_token(on_error, &st, &sp))
288 { 284 {
289 if (sp) efl_view_model_property_bind(obj, sp, name); 285 if (sp) efl_ui_view_model_property_bind(obj, sp, name);
290 } 286 }
291 287
292 eina_hash_direct_add(pd->texts, text->name, text); 288 eina_hash_direct_add(pd->texts, text->name, text);
@@ -302,7 +298,7 @@ _efl_view_model_property_string_add(Eo *obj, Efl_View_Model_Data *pd,
302static void 298static void
303_text_free(void *data) 299_text_free(void *data)
304{ 300{
305 Efl_View_Model_Text *text = data; 301 Efl_Ui_View_Model_Text *text = data;
306 Eina_Stringshare *st; 302 Eina_Stringshare *st;
307 Eina_Stringshare *sp; 303 Eina_Stringshare *sp;
308 int lookup; 304 int lookup;
@@ -313,7 +309,7 @@ _text_free(void *data)
313 lookup; 309 lookup;
314 tmp += lookup, lookup = _lookup_next_token(tmp, &st, &sp)) 310 tmp += lookup, lookup = _lookup_next_token(tmp, &st, &sp))
315 { 311 {
316 if (sp) efl_view_model_property_unbind(text->self, sp, text->name); 312 if (sp) efl_ui_view_model_property_unbind(text->self, sp, text->name);
317 } 313 }
318 314
319 tmp = text->not_ready; 315 tmp = text->not_ready;
@@ -321,7 +317,7 @@ _text_free(void *data)
321 lookup; 317 lookup;
322 tmp += lookup, lookup = _lookup_next_token(tmp, &st, &sp)) 318 tmp += lookup, lookup = _lookup_next_token(tmp, &st, &sp))
323 { 319 {
324 if (sp) efl_view_model_property_unbind(text->self, sp, text->name); 320 if (sp) efl_ui_view_model_property_unbind(text->self, sp, text->name);
325 } 321 }
326 322
327 tmp = text->on_error; 323 tmp = text->on_error;
@@ -329,7 +325,7 @@ _text_free(void *data)
329 lookup; 325 lookup;
330 tmp += lookup, lookup = _lookup_next_token(tmp, &st, &sp)) 326 tmp += lookup, lookup = _lookup_next_token(tmp, &st, &sp))
331 { 327 {
332 if (sp) efl_view_model_property_unbind(text->self, sp, text->name); 328 if (sp) efl_ui_view_model_property_unbind(text->self, sp, text->name);
333 } 329 }
334 330
335 eina_stringshare_del(text->name); 331 eina_stringshare_del(text->name);
@@ -339,11 +335,11 @@ _text_free(void *data)
339} 335}
340 336
341static Eina_Error 337static Eina_Error
342_efl_view_model_property_string_del(Eo *obj EINA_UNUSED, 338_efl_ui_view_model_property_string_del(Eo *obj EINA_UNUSED,
343 Efl_View_Model_Data *pd, 339 Efl_Ui_View_Model_Data *pd,
344 const char *name) 340 const char *name)
345{ 341{
346 Efl_View_Model_Text *text; 342 Efl_Ui_View_Model_Text *text;
347 Eina_Stringshare *sn; 343 Eina_Stringshare *sn;
348 Eina_Error err = EFL_MODEL_ERROR_INCORRECT_VALUE; 344 Eina_Error err = EFL_MODEL_ERROR_INCORRECT_VALUE;
349 345
@@ -361,10 +357,10 @@ _efl_view_model_property_string_del(Eo *obj EINA_UNUSED,
361} 357}
362 358
363static void 359static void
364_efl_view_model_property_bind(Eo *obj EINA_UNUSED, Efl_View_Model_Data *pd, 360_efl_ui_view_model_property_bind(Eo *obj EINA_UNUSED, Efl_Ui_View_Model_Data *pd,
365 const char *source, const char *destination) 361 const char *source, const char *destination)
366{ 362{
367 Efl_View_Model_Bind *bind; 363 Efl_Ui_View_Model_Bind *bind;
368 Eina_Stringshare *src; 364 Eina_Stringshare *src;
369 Eina_Stringshare *dst; 365 Eina_Stringshare *dst;
370 366
@@ -374,7 +370,7 @@ _efl_view_model_property_bind(Eo *obj EINA_UNUSED, Efl_View_Model_Data *pd,
374 bind = eina_hash_find(pd->bound, src); 370 bind = eina_hash_find(pd->bound, src);
375 if (!bind) 371 if (!bind)
376 { 372 {
377 bind = calloc(1, sizeof (Efl_View_Model_Bind)); 373 bind = calloc(1, sizeof (Efl_Ui_View_Model_Bind));
378 if (!bind) goto on_error; 374 if (!bind) goto on_error;
379 bind->source = eina_stringshare_ref(src); 375 bind->source = eina_stringshare_ref(src);
380 376
@@ -390,10 +386,10 @@ _efl_view_model_property_bind(Eo *obj EINA_UNUSED, Efl_View_Model_Data *pd,
390} 386}
391 387
392static void 388static void
393_efl_view_model_property_unbind(Eo *obj EINA_UNUSED, Efl_View_Model_Data *pd, 389_efl_ui_view_model_property_unbind(Eo *obj EINA_UNUSED, Efl_Ui_View_Model_Data *pd,
394 const char *source, const char *destination) 390 const char *source, const char *destination)
395{ 391{
396 Efl_View_Model_Bind *bind; 392 Efl_Ui_View_Model_Bind *bind;
397 Eina_Stringshare *src; 393 Eina_Stringshare *src;
398 Eina_Stringshare *dst; 394 Eina_Stringshare *dst;
399 Eina_Stringshare *cmp; 395 Eina_Stringshare *cmp;
@@ -426,7 +422,7 @@ _efl_view_model_property_unbind(Eo *obj EINA_UNUSED, Efl_View_Model_Data *pd,
426static void 422static void
427_bind_free(void *data) 423_bind_free(void *data)
428{ 424{
429 Efl_View_Model_Bind *bind = data; 425 Efl_Ui_View_Model_Bind *bind = data;
430 Eina_Stringshare *dst; 426 Eina_Stringshare *dst;
431 427
432 eina_stringshare_del(bind->source); 428 eina_stringshare_del(bind->source);
@@ -438,11 +434,11 @@ _bind_free(void *data)
438} 434}
439 435
440static void 436static void
441_efl_view_model_property_bind_lookup(Eina_Array *changed_properties, 437_efl_ui_view_model_property_bind_lookup(Eina_Array *changed_properties,
442 Efl_View_Model_Data *pd, 438 Efl_Ui_View_Model_Data *pd,
443 Eina_Stringshare *src) 439 Eina_Stringshare *src)
444{ 440{
445 Efl_View_Model_Bind *bind; 441 Efl_Ui_View_Model_Bind *bind;
446 442
447 if (!pd) return ; 443 if (!pd) return ;
448 bind = eina_hash_find(pd->bound, src); 444 bind = eina_hash_find(pd->bound, src);
@@ -463,16 +459,16 @@ _efl_view_model_property_bind_lookup(Eina_Array *changed_properties,
463 if (dup == dest) continue ; 459 if (dup == dest) continue ;
464 460
465 eina_array_push(changed_properties, dest); 461 eina_array_push(changed_properties, dest);
466 _efl_view_model_property_bind_lookup(changed_properties, pd, dest); 462 _efl_ui_view_model_property_bind_lookup(changed_properties, pd, dest);
467 } 463 }
468 } 464 }
469 _efl_view_model_property_bind_lookup(changed_properties, pd->parent, src); 465 _efl_ui_view_model_property_bind_lookup(changed_properties, pd->parent, src);
470} 466}
471 467
472static void 468static void
473_efl_view_model_property_changed(void *data, const Efl_Event *event) 469_efl_ui_view_model_property_changed(void *data, const Efl_Event *event)
474{ 470{
475 Efl_View_Model_Data *pd = data; 471 Efl_Ui_View_Model_Data *pd = data;
476 Efl_Model_Property_Event *ev = event->info; 472 Efl_Model_Property_Event *ev = event->info;
477 Efl_Model_Property_Event nev = { 0 }; 473 Efl_Model_Property_Event nev = { 0 };
478 const char *property; 474 const char *property;
@@ -493,7 +489,7 @@ _efl_view_model_property_changed(void *data, const Efl_Event *event)
493 eina_array_push(nev.changed_properties, property); 489 eina_array_push(nev.changed_properties, property);
494 490
495 src = eina_stringshare_ref(property); 491 src = eina_stringshare_ref(property);
496 _efl_view_model_property_bind_lookup(nev.changed_properties, pd, src); 492 _efl_ui_view_model_property_bind_lookup(nev.changed_properties, pd, src);
497 } 493 }
498 494
499 efl_event_callback_call(event->object, EFL_MODEL_EVENT_PROPERTIES_CHANGED, &nev); 495 efl_event_callback_call(event->object, EFL_MODEL_EVENT_PROPERTIES_CHANGED, &nev);
@@ -504,7 +500,7 @@ _efl_view_model_property_changed(void *data, const Efl_Event *event)
504} 500}
505 501
506static void 502static void
507_efl_view_model_children_bind_set(Eo *obj EINA_UNUSED, Efl_View_Model_Data *pd, Eina_Bool enable) 503_efl_ui_view_model_children_bind_set(Eo *obj EINA_UNUSED, Efl_Ui_View_Model_Data *pd, Eina_Bool enable)
508{ 504{
509 if (pd->finalized) return; 505 if (pd->finalized) return;
510 506
@@ -512,41 +508,41 @@ _efl_view_model_children_bind_set(Eo *obj EINA_UNUSED, Efl_View_Model_Data *pd,
512} 508}
513 509
514static Eina_Bool 510static Eina_Bool
515_efl_view_model_children_bind_get(const Eo *obj EINA_UNUSED, Efl_View_Model_Data *pd) 511_efl_ui_view_model_children_bind_get(const Eo *obj EINA_UNUSED, Efl_Ui_View_Model_Data *pd)
516{ 512{
517 return pd->children_bind; 513 return pd->children_bind;
518} 514}
519 515
520static void 516static void
521_efl_view_model_parent_data(Efl_View_Model *child, Efl_View_Model_Data *ppd) 517_efl_ui_view_model_parent_data(Efl_Ui_View_Model *child, Efl_Ui_View_Model_Data *ppd)
522{ 518{
523 Efl_View_Model_Data *cpd; 519 Efl_Ui_View_Model_Data *cpd;
524 520
525 cpd = efl_data_scope_get(child, EFL_VIEW_MODEL_CLASS); 521 cpd = efl_data_scope_get(child, EFL_UI_VIEW_MODEL_CLASS);
526 cpd->parent = ppd; 522 cpd->parent = ppd;
527 cpd->propagating = ppd->propagating; 523 cpd->propagating = ppd->propagating;
528} 524}
529 525
530static Efl_View_Model * 526static Efl_Ui_View_Model *
531_efl_view_model_child_lookup(Efl_View_Model_Data *pd, Efl_Object *parent, Efl_Model *view) 527_efl_ui_view_model_child_lookup(Efl_Ui_View_Model_Data *pd, Efl_Object *parent, Efl_Model *view)
532{ 528{
533 EFL_COMPOSITE_LOOKUP_RETURN(co, parent, view, "_efl.view_model"); 529 EFL_COMPOSITE_LOOKUP_RETURN(co, parent, view, "_efl.ui.view_model");
534 530
535 co = efl_add(EFL_VIEW_MODEL_CLASS, parent, 531 co = efl_add(EFL_UI_VIEW_MODEL_CLASS, parent,
536 efl_ui_view_model_set(efl_added, view), 532 efl_ui_view_model_set(efl_added, view),
537 _efl_view_model_parent_data(efl_added, pd)); 533 _efl_ui_view_model_parent_data(efl_added, pd));
538 if (!co) return NULL; 534 if (!co) return NULL;
539 535
540 EFL_COMPOSITE_REMEMBER_RETURN(co, view); 536 EFL_COMPOSITE_REMEMBER_RETURN(co, view);
541} 537}
542 538
543static void 539static void
544_efl_view_model_child_added(void *data, const Efl_Event *event) 540_efl_ui_view_model_child_added(void *data, const Efl_Event *event)
545{ 541{
546 Efl_Model_Children_Event *ev = event->info; 542 Efl_Model_Children_Event *ev = event->info;
547 Efl_Model_Children_Event nevt = { 0 }; 543 Efl_Model_Children_Event nevt = { 0 };
548 Efl_View_Model_Data *pd = data; 544 Efl_Ui_View_Model_Data *pd = data;
549 Efl_View_Model *co; 545 Efl_Ui_View_Model *co;
550 546
551 if (pd->propagating.child_added) return ; 547 if (pd->propagating.child_added) return ;
552 if (!pd->children_bind) return; 548 if (!pd->children_bind) return;
@@ -557,7 +553,7 @@ _efl_view_model_child_added(void *data, const Efl_Event *event)
557 // Our strategy is to rebuild a new Child_Add and cancel the current one. 553 // Our strategy is to rebuild a new Child_Add and cancel the current one.
558 efl_event_callback_stop(event->object); 554 efl_event_callback_stop(event->object);
559 555
560 co = _efl_view_model_child_lookup(pd, event->object, ev->child); 556 co = _efl_ui_view_model_child_lookup(pd, event->object, ev->child);
561 if (!co) return; 557 if (!co) return;
562 558
563 nevt.index = ev->index; 559 nevt.index = ev->index;
@@ -569,12 +565,12 @@ _efl_view_model_child_added(void *data, const Efl_Event *event)
569} 565}
570 566
571static void 567static void
572_efl_view_model_child_removed(void *data, const Efl_Event *event) 568_efl_ui_view_model_child_removed(void *data, const Efl_Event *event)
573{ 569{
574 Efl_Model_Children_Event *ev = event->info; 570 Efl_Model_Children_Event *ev = event->info;
575 Efl_Model_Children_Event nevt = { 0 }; 571 Efl_Model_Children_Event nevt = { 0 };
576 Efl_View_Model_Data *pd = data; 572 Efl_Ui_View_Model_Data *pd = data;
577 Efl_View_Model *co; 573 Efl_Ui_View_Model *co;
578 574
579 if (pd->propagating.child_removed) return ; 575 if (pd->propagating.child_removed) return ;
580 if (!pd->children_bind) return; 576 if (!pd->children_bind) return;
@@ -585,7 +581,7 @@ _efl_view_model_child_removed(void *data, const Efl_Event *event)
585 // Our strategy is to rebuild a new Child_Add and cancel the current one. 581 // Our strategy is to rebuild a new Child_Add and cancel the current one.
586 efl_event_callback_stop(event->object); 582 efl_event_callback_stop(event->object);
587 583
588 co = _efl_view_model_child_lookup(pd, event->object, ev->child); 584 co = _efl_ui_view_model_child_lookup(pd, event->object, ev->child);
589 if (!co) return; 585 if (!co) return;
590 586
591 nevt.index = ev->index; 587 nevt.index = ev->index;
@@ -599,15 +595,15 @@ _efl_view_model_child_removed(void *data, const Efl_Event *event)
599 pd->propagating.child_removed = EINA_FALSE; 595 pd->propagating.child_removed = EINA_FALSE;
600} 596}
601 597
602EFL_CALLBACKS_ARRAY_DEFINE(efl_view_model_intercept, 598EFL_CALLBACKS_ARRAY_DEFINE(efl_ui_view_model_intercept,
603 { EFL_MODEL_EVENT_PROPERTIES_CHANGED, _efl_view_model_property_changed }, 599 { EFL_MODEL_EVENT_PROPERTIES_CHANGED, _efl_ui_view_model_property_changed },
604 { EFL_MODEL_EVENT_CHILD_ADDED, _efl_view_model_child_added }, 600 { EFL_MODEL_EVENT_CHILD_ADDED, _efl_ui_view_model_child_added },
605 { EFL_MODEL_EVENT_CHILD_REMOVED, _efl_view_model_child_removed }) 601 { EFL_MODEL_EVENT_CHILD_REMOVED, _efl_ui_view_model_child_removed })
606 602
607static Efl_Object * 603static Efl_Object *
608_efl_view_model_efl_object_constructor(Eo *obj, Efl_View_Model_Data *pd) 604_efl_ui_view_model_efl_object_constructor(Eo *obj, Efl_Ui_View_Model_Data *pd)
609{ 605{
610 obj = efl_constructor(efl_super(obj, EFL_VIEW_MODEL_CLASS)); 606 obj = efl_constructor(efl_super(obj, EFL_UI_VIEW_MODEL_CLASS));
611 607
612 pd->children_bind = EINA_TRUE; 608 pd->children_bind = EINA_TRUE;
613 pd->bound = eina_hash_stringshared_new(_bind_free); 609 pd->bound = eina_hash_stringshared_new(_bind_free);
@@ -615,23 +611,23 @@ _efl_view_model_efl_object_constructor(Eo *obj, Efl_View_Model_Data *pd)
615 pd->deduplication = eina_hash_stringshared_new(_ref_free); 611 pd->deduplication = eina_hash_stringshared_new(_ref_free);
616 pd->texts = eina_hash_stringshared_new(_text_free); 612 pd->texts = eina_hash_stringshared_new(_text_free);
617 613
618 efl_event_callback_array_priority_add(obj, efl_view_model_intercept(), EFL_CALLBACK_PRIORITY_BEFORE, pd); 614 efl_event_callback_array_priority_add(obj, efl_ui_view_model_intercept(), EFL_CALLBACK_PRIORITY_BEFORE, pd);
619 615
620 return obj; 616 return obj;
621} 617}
622 618
623static Efl_Object * 619static Efl_Object *
624_efl_view_model_efl_object_finalize(Eo *obj, Efl_View_Model_Data *pd) 620_efl_ui_view_model_efl_object_finalize(Eo *obj, Efl_Ui_View_Model_Data *pd)
625{ 621{
626 pd->finalized = EINA_TRUE; 622 pd->finalized = EINA_TRUE;
627 623
628 return efl_finalize(efl_super(obj, EFL_VIEW_MODEL_CLASS)); 624 return efl_finalize(efl_super(obj, EFL_UI_VIEW_MODEL_CLASS));
629} 625}
630 626
631static void 627static void
632_efl_view_model_efl_object_destructor(Eo *obj, Efl_View_Model_Data *pd) 628_efl_ui_view_model_efl_object_destructor(Eo *obj, Efl_Ui_View_Model_Data *pd)
633{ 629{
634 efl_event_callback_array_del(obj, efl_view_model_intercept(), pd); 630 efl_event_callback_array_del(obj, efl_ui_view_model_intercept(), pd);
635 631
636 eina_hash_free(pd->bound); 632 eina_hash_free(pd->bound);
637 pd->bound = NULL; 633 pd->bound = NULL;
@@ -645,30 +641,30 @@ _efl_view_model_efl_object_destructor(Eo *obj, Efl_View_Model_Data *pd)
645 eina_hash_free(pd->deduplication); 641 eina_hash_free(pd->deduplication);
646 pd->deduplication = NULL; 642 pd->deduplication = NULL;
647 643
648 efl_destructor(efl_super(obj, EFL_VIEW_MODEL_CLASS)); 644 efl_destructor(efl_super(obj, EFL_UI_VIEW_MODEL_CLASS));
649} 645}
650 646
651static Efl_View_Model_Logic * 647static Efl_Ui_View_Model_Logic *
652_efl_view_model_property_logic_lookup(Efl_View_Model_Data *pd, Eina_Stringshare *property) 648_efl_ui_view_model_property_logic_lookup(Efl_Ui_View_Model_Data *pd, Eina_Stringshare *property)
653{ 649{
654 Efl_View_Model_Logic *logic; 650 Efl_Ui_View_Model_Logic *logic;
655 651
656 if (!pd) return NULL; 652 if (!pd) return NULL;
657 logic = eina_hash_find(pd->logics, property); 653 logic = eina_hash_find(pd->logics, property);
658 if (!logic) return _efl_view_model_property_logic_lookup(pd->parent, property); 654 if (!logic) return _efl_ui_view_model_property_logic_lookup(pd->parent, property);
659 return logic; 655 return logic;
660} 656}
661 657
662static Eina_Future * 658static Eina_Future *
663_efl_view_model_efl_model_property_set(Eo *obj, Efl_View_Model_Data *pd, 659_efl_ui_view_model_efl_model_property_set(Eo *obj, Efl_Ui_View_Model_Data *pd,
664 const char *property, Eina_Value *value) 660 const char *property, Eina_Value *value)
665{ 661{
666 Efl_View_Model_Logic *logic; 662 Efl_Ui_View_Model_Logic *logic;
667 Eina_Stringshare *prop; 663 Eina_Stringshare *prop;
668 Eina_Future *f; 664 Eina_Future *f;
669 665
670 prop = eina_stringshare_add(property); 666 prop = eina_stringshare_add(property);
671 logic = _efl_view_model_property_logic_lookup(pd, prop); 667 logic = _efl_ui_view_model_property_logic_lookup(pd, prop);
672 if (logic) 668 if (logic)
673 f = logic->set.fct(logic->get.data, obj, prop, value); 669 f = logic->set.fct(logic->get.data, obj, prop, value);
674 else 670 else
@@ -676,7 +672,7 @@ _efl_view_model_efl_model_property_set(Eo *obj, Efl_View_Model_Data *pd,
676 if (eina_hash_find(pd->texts, prop)) 672 if (eina_hash_find(pd->texts, prop))
677 f = efl_loop_future_rejected(obj, EFL_MODEL_ERROR_READ_ONLY); 673 f = efl_loop_future_rejected(obj, EFL_MODEL_ERROR_READ_ONLY);
678 else 674 else
679 f = efl_model_property_set(efl_super(obj, EFL_VIEW_MODEL_CLASS), property, value); 675 f = efl_model_property_set(efl_super(obj, EFL_UI_VIEW_MODEL_CLASS), property, value);
680 } 676 }
681 677
682 eina_stringshare_del(prop); 678 eina_stringshare_del(prop);
@@ -684,7 +680,7 @@ _efl_view_model_efl_model_property_set(Eo *obj, Efl_View_Model_Data *pd,
684} 680}
685 681
686static Eina_Value * 682static Eina_Value *
687_efl_view_model_text_generate(const Eo *obj, 683_efl_ui_view_model_text_generate(const Eo *obj,
688 Eina_Strbuf *out, 684 Eina_Strbuf *out,
689 Eina_Stringshare *pattern, 685 Eina_Stringshare *pattern,
690 Eina_Bool stop_on_error) 686 Eina_Bool stop_on_error)
@@ -726,9 +722,9 @@ _efl_view_model_text_generate(const Eo *obj,
726} 722}
727 723
728static Eina_Value * 724static Eina_Value *
729_efl_view_model_text_property_get(const Eo *obj, Efl_View_Model_Data *pd, Eina_Stringshare *prop) 725_efl_ui_view_model_text_property_get(const Eo *obj, Efl_Ui_View_Model_Data *pd, Eina_Stringshare *prop)
730{ 726{
731 Efl_View_Model_Text *lookup; 727 Efl_Ui_View_Model_Text *lookup;
732 Eina_Strbuf *buf; 728 Eina_Strbuf *buf;
733 Eina_Value *r; 729 Eina_Value *r;
734 Eina_Error err = 0; 730 Eina_Error err = 0;
@@ -737,11 +733,11 @@ _efl_view_model_text_property_get(const Eo *obj, Efl_View_Model_Data *pd, Eina_S
737 lookup = eina_hash_find(pd->texts, prop); 733 lookup = eina_hash_find(pd->texts, prop);
738 // Lookup for property definition in the parent, but property value will be fetched on 734 // Lookup for property definition in the parent, but property value will be fetched on
739 // the child object doing the request. 735 // the child object doing the request.
740 if (!lookup) return _efl_view_model_text_property_get(obj, pd->parent, prop); 736 if (!lookup) return _efl_ui_view_model_text_property_get(obj, pd->parent, prop);
741 737
742 buf = eina_strbuf_new(); 738 buf = eina_strbuf_new();
743 739
744 r = _efl_view_model_text_generate(obj, buf, 740 r = _efl_ui_view_model_text_generate(obj, buf,
745 lookup->definition, 741 lookup->definition,
746 !!(lookup->on_error || lookup->not_ready)); 742 !!(lookup->on_error || lookup->not_ready));
747 if (eina_value_type_get(r) != EINA_VALUE_TYPE_ERROR) 743 if (eina_value_type_get(r) != EINA_VALUE_TYPE_ERROR)
@@ -751,7 +747,7 @@ _efl_view_model_text_property_get(const Eo *obj, Efl_View_Model_Data *pd, Eina_S
751 eina_strbuf_reset(buf); 747 eina_strbuf_reset(buf);
752 eina_value_free(r); 748 eina_value_free(r);
753 749
754 r = _efl_view_model_text_generate(obj, buf, lookup->not_ready, !!lookup->on_error); 750 r = _efl_ui_view_model_text_generate(obj, buf, lookup->not_ready, !!lookup->on_error);
755 if (eina_value_type_get(r) != EINA_VALUE_TYPE_ERROR) 751 if (eina_value_type_get(r) != EINA_VALUE_TYPE_ERROR)
756 goto done; 752 goto done;
757 } 753 }
@@ -760,7 +756,7 @@ _efl_view_model_text_property_get(const Eo *obj, Efl_View_Model_Data *pd, Eina_S
760 eina_strbuf_reset(buf); 756 eina_strbuf_reset(buf);
761 eina_value_free(r); 757 eina_value_free(r);
762 758
763 r = _efl_view_model_text_generate(obj, buf, lookup->on_error, 0); 759 r = _efl_ui_view_model_text_generate(obj, buf, lookup->on_error, 0);
764 } 760 }
765 761
766 done: 762 done:
@@ -770,21 +766,21 @@ _efl_view_model_text_property_get(const Eo *obj, Efl_View_Model_Data *pd, Eina_S
770} 766}
771 767
772static Eina_Value * 768static Eina_Value *
773_efl_view_model_efl_model_property_get(const Eo *obj, Efl_View_Model_Data *pd, 769_efl_ui_view_model_efl_model_property_get(const Eo *obj, Efl_Ui_View_Model_Data *pd,
774 const char *property) 770 const char *property)
775{ 771{
776 Efl_View_Model_Logic *logic; 772 Efl_Ui_View_Model_Logic *logic;
777 Eina_Stringshare *prop; 773 Eina_Stringshare *prop;
778 Eina_Value *r; 774 Eina_Value *r;
779 775
780 prop = eina_stringshare_add(property); 776 prop = eina_stringshare_add(property);
781 logic = _efl_view_model_property_logic_lookup(pd, prop); 777 logic = _efl_ui_view_model_property_logic_lookup(pd, prop);
782 if (logic) 778 if (logic)
783 r = logic->get.fct(logic->get.data, obj, prop); 779 r = logic->get.fct(logic->get.data, obj, prop);
784 else 780 else
785 { 781 {
786 r = _efl_view_model_text_property_get(obj, pd, prop); 782 r = _efl_ui_view_model_text_property_get(obj, pd, prop);
787 if (!r) r = efl_model_property_get(efl_super(obj, EFL_VIEW_MODEL_CLASS), property); 783 if (!r) r = efl_model_property_get(efl_super(obj, EFL_UI_VIEW_MODEL_CLASS), property);
788 } 784 }
789 785
790 eina_stringshare_del(prop); 786 eina_stringshare_del(prop);
@@ -792,25 +788,25 @@ _efl_view_model_efl_model_property_get(const Eo *obj, Efl_View_Model_Data *pd,
792} 788}
793 789
794static Eina_Iterator * 790static Eina_Iterator *
795_efl_view_model_efl_model_properties_get(const Eo *obj, Efl_View_Model_Data *pd) 791_efl_ui_view_model_efl_model_properties_get(const Eo *obj, Efl_Ui_View_Model_Data *pd)
796{ 792{
797 EFL_COMPOSITE_MODEL_PROPERTIES_SUPER(props, obj, EFL_VIEW_MODEL_CLASS, 793 EFL_COMPOSITE_MODEL_PROPERTIES_SUPER(props, obj, EFL_UI_VIEW_MODEL_CLASS,
798 eina_hash_iterator_key_new(pd->deduplication)); 794 eina_hash_iterator_key_new(pd->deduplication));
799 795
800 return props; 796 return props;
801} 797}
802 798
803typedef struct _Efl_View_Model_Slice_Request Efl_View_Model_Slice_Request; 799typedef struct _Efl_Ui_View_Model_Slice_Request Efl_Ui_View_Model_Slice_Request;
804struct _Efl_View_Model_Slice_Request 800struct _Efl_Ui_View_Model_Slice_Request
805{ 801{
806 Efl_View_Model_Data *pd; 802 Efl_Ui_View_Model_Data *pd;
807 unsigned int start; 803 unsigned int start;
808}; 804};
809 805
810static Eina_Value 806static Eina_Value
811_efl_view_model_slice_then(Eo *o, void *data, const Eina_Value v) 807_efl_ui_view_model_slice_then(Eo *o, void *data, const Eina_Value v)
812{ 808{
813 Efl_View_Model_Slice_Request *req = data; 809 Efl_Ui_View_Model_Slice_Request *req = data;
814 Eo *target; 810 Eo *target;
815 Eina_Value r = EINA_VALUE_EMPTY; 811 Eina_Value r = EINA_VALUE_EMPTY;
816 unsigned int i, len; 812 unsigned int i, len;
@@ -821,7 +817,7 @@ _efl_view_model_slice_then(Eo *o, void *data, const Eina_Value v)
821 { 817 {
822 Eo *composite; 818 Eo *composite;
823 819
824 composite = _efl_view_model_child_lookup(req->pd, o, target); 820 composite = _efl_ui_view_model_child_lookup(req->pd, o, target);
825 eina_value_array_append(&r, composite); 821 eina_value_array_append(&r, composite);
826 } 822 }
827 823
@@ -829,21 +825,21 @@ _efl_view_model_slice_then(Eo *o, void *data, const Eina_Value v)
829} 825}
830 826
831static void 827static void
832_efl_view_model_slice_clean(Eo *o EINA_UNUSED, void *data, const Eina_Future *dead_future EINA_UNUSED) 828_efl_ui_view_model_slice_clean(Eo *o EINA_UNUSED, void *data, const Eina_Future *dead_future EINA_UNUSED)
833{ 829{
834 free(data); 830 free(data);
835} 831}
836 832
837static Eina_Future * 833static Eina_Future *
838_efl_view_model_efl_model_children_slice_get(Eo *obj, Efl_View_Model_Data *pd, 834_efl_ui_view_model_efl_model_children_slice_get(Eo *obj, Efl_Ui_View_Model_Data *pd,
839 unsigned int start, unsigned int count) 835 unsigned int start, unsigned int count)
840{ 836{
841 Efl_View_Model_Slice_Request *req; 837 Efl_Ui_View_Model_Slice_Request *req;
842 Eina_Future *f; 838 Eina_Future *f;
843 839
844 f = efl_model_children_slice_get(efl_super(obj, EFL_VIEW_MODEL_CLASS), start, count); 840 f = efl_model_children_slice_get(efl_super(obj, EFL_UI_VIEW_MODEL_CLASS), start, count);
845 841
846 req = malloc(sizeof (Efl_View_Model_Slice_Request)); 842 req = malloc(sizeof (Efl_Ui_View_Model_Slice_Request));
847 if (!req) 843 if (!req)
848 { 844 {
849 eina_future_cancel(f); 845 eina_future_cancel(f);
@@ -854,9 +850,9 @@ _efl_view_model_efl_model_children_slice_get(Eo *obj, Efl_View_Model_Data *pd,
854 req->start = start; 850 req->start = start;
855 851
856 return efl_future_then(obj, f, .success_type = EINA_VALUE_TYPE_ARRAY, 852 return efl_future_then(obj, f, .success_type = EINA_VALUE_TYPE_ARRAY,
857 .success = _efl_view_model_slice_then, 853 .success = _efl_ui_view_model_slice_then,
858 .free = _efl_view_model_slice_clean, 854 .free = _efl_ui_view_model_slice_clean,
859 .data = req); 855 .data = req);
860} 856}
861 857
862#include "efl_view_model.eo.c" 858#include "efl_ui_view_model.eo.c"
diff --git a/src/lib/ecore/efl_view_model.eo b/src/lib/elementary/efl_ui_view_model.eo
index 2b6f8684ad..83a3e781b0 100644
--- a/src/lib/ecore/efl_view_model.eo
+++ b/src/lib/elementary/efl_ui_view_model.eo
@@ -1,23 +1,23 @@
1function @beta EflViewModelPropertyGet { 1function @beta EflUiViewModelPropertyGet {
2 [[Function called when a property is get.]] 2 [[Function called when a property is get.]]
3 params { 3 params {
4 @in view_model: const(Efl.View_Model); [[The ViewModel object the @.property.get is issued on.]] 4 @in view_model: const(Efl.Ui.View_Model); [[The ViewModel object the @.property.get is issued on.]]
5 @in property: stringshare; [[The property name the @.property.get is issued on.]] 5 @in property: stringshare; [[The property name the @.property.get is issued on.]]
6 } 6 }
7 return: any_value_ptr; [[The property value.]] 7 return: any_value_ptr; [[The property value.]]
8}; 8};
9 9
10function @beta EflViewModelPropertySet { 10function @beta EflUiViewModelPropertySet {
11 [[Function called when a property is set.]] 11 [[Function called when a property is set.]]
12 params { 12 params {
13 @in view_model: Efl.View_Model; [[The ViewModel object the @.property.set is issued on.]] 13 @in view_model: Efl.Ui.View_Model; [[The ViewModel object the @.property.set is issued on.]]
14 @in property: stringshare; [[The property name the @.property.set is issued on.]] 14 @in property: stringshare; [[The property name the @.property.set is issued on.]]
15 @in value: any_value_ptr @owned; [[The new value to set.]] 15 @in value: any_value_ptr @owned; [[The new value to set.]]
16 } 16 }
17 return: future<any_value_ptr>; [[The value that was finally set.]] 17 return: future<any_value_ptr>; [[The value that was finally set.]]
18}; 18};
19 19
20class @beta Efl.View_Model extends Efl.Composite_Model 20class @beta Efl.Ui.View_Model extends Efl.Composite_Model
21{ 21{
22 [[Efl model providing helpers for custom properties used when linking a model to a view and you need to 22 [[Efl model providing helpers for custom properties used when linking a model to a view and you need to
23 generate/adapt values for display. 23 generate/adapt values for display.
@@ -70,9 +70,9 @@ class @beta Efl.View_Model extends Efl.Composite_Model
70 ]] 70 ]]
71 params { 71 params {
72 property: string; [[The property to bind on to.]] 72 property: string; [[The property to bind on to.]]
73 get: EflViewModelPropertyGet; [[Define the get callback called when the @Efl.Model.property.get is called 73 get: EflUiViewModelPropertyGet; [[Define the get callback called when the @Efl.Model.property.get is called
74 with the above property name.]] 74 with the above property name.]]
75 set: EflViewModelPropertySet; [[Define the set callback called when the @Efl.Model.property.set is called 75 set: EflUiViewModelPropertySet; [[Define the set callback called when the @Efl.Model.property.set is called
76 with the above property name.]] 76 with the above property name.]]
77 binded: iterator<string>; [[Iterator of property name to bind with this defined property see 77 binded: iterator<string>; [[Iterator of property name to bind with this defined property see
78 @.property_bind.]] 78 @.property_bind.]]
@@ -100,7 +100,7 @@ class @beta Efl.View_Model extends Efl.Composite_Model
100 ]] 100 ]]
101 params { 101 params {
102 @in source: string; [[Property name in the composited model.]] 102 @in source: string; [[Property name in the composited model.]]
103 @in destination: string; [[Property name in the @Efl.View_Model]] 103 @in destination: string; [[Property name in the @Efl.Ui.View_Model]]
104 } 104 }
105 } 105 }
106 property_unbind { 106 property_unbind {
@@ -110,7 +110,7 @@ class @beta Efl.View_Model extends Efl.Composite_Model
110 ]] 110 ]]
111 params { 111 params {
112 @in source: string; [[Property name in the composited model.]] 112 @in source: string; [[Property name in the composited model.]]
113 @in destination: string; [[Property name in the @Efl.View_Model]] 113 @in destination: string; [[Property name in the @Efl.Ui.View_Model]]
114 } 114 }
115 } 115 }
116 @property children_bind { 116 @property children_bind {
@@ -139,6 +139,6 @@ class @beta Efl.View_Model extends Efl.Composite_Model
139 Efl.Model.property { set; get; } 139 Efl.Model.property { set; get; }
140 } 140 }
141 constructors { 141 constructors {
142 Efl.View_Model.children_bind @optional; 142 Efl.Ui.View_Model.children_bind @optional;
143 } 143 }
144} 144}
diff --git a/src/lib/elementary/meson.build b/src/lib/elementary/meson.build
index 080e9e2ea2..a848f693dc 100644
--- a/src/lib/elementary/meson.build
+++ b/src/lib/elementary/meson.build
@@ -182,6 +182,8 @@ pub_eo_files = [
182 'efl_ui_single_selectable.eo', 182 'efl_ui_single_selectable.eo',
183 'efl_ui_position_manager_data_access_v1.eo', 183 'efl_ui_position_manager_data_access_v1.eo',
184 'efl_ui_tab_bar_default_item.eo', 184 'efl_ui_tab_bar_default_item.eo',
185 'efl_ui_select_model.eo',
186 'efl_ui_view_model.eo',
185] 187]
186 188
187foreach eo_file : pub_eo_files 189foreach eo_file : pub_eo_files
@@ -939,7 +941,9 @@ elementary_src = [
939 'efl_ui_position_manager_entity.c', 941 'efl_ui_position_manager_entity.c',
940 'efl_ui_position_manager_list.c', 942 'efl_ui_position_manager_list.c',
941 'efl_ui_position_manager_grid.c', 943 'efl_ui_position_manager_grid.c',
942 'efl_ui_tab_bar_default_item.c' 944 'efl_ui_tab_bar_default_item.c',
945 'efl_ui_select_model.c',
946 'efl_ui_view_model.c',
943] 947]
944 948
945elementary_deps = [emile, eo, efl, edje, ethumb, ethumb_client, emotion, ecore_imf, ecore_con, eldbus, efreet, efreet_mime, efreet_trash, eio, atspi, dl, intl] 949elementary_deps = [emile, eo, efl, edje, ethumb, ethumb_client, emotion, ecore_imf, ecore_con, eldbus, efreet, efreet_mime, efreet_trash, eio, atspi, dl, intl]
diff --git a/src/tests/efl/efl_suite.c b/src/tests/efl/efl_suite.c
index 4385b82f72..d5a444b3bf 100644
--- a/src/tests/efl/efl_suite.c
+++ b/src/tests/efl/efl_suite.c
@@ -27,7 +27,6 @@
27 27
28static const Efl_Test_Case etc[] = { 28static const Efl_Test_Case etc[] = {
29 { "Efl_Container_Model", efl_test_case_container_model }, 29 { "Efl_Container_Model", efl_test_case_container_model },
30 { "Efl_View_Model", efl_test_case_view_model },
31 { "Efl_Boolean_Model", efl_test_case_boolean_model }, 30 { "Efl_Boolean_Model", efl_test_case_boolean_model },
32 { NULL, NULL } 31 { NULL, NULL }
33}; 32};
diff --git a/src/tests/efl/efl_suite.h b/src/tests/efl/efl_suite.h
index 4a670deab9..2d4cc7af21 100644
--- a/src/tests/efl/efl_suite.h
+++ b/src/tests/efl/efl_suite.h
@@ -22,7 +22,6 @@
22#include <check.h> 22#include <check.h>
23#include "../efl_check.h" 23#include "../efl_check.h"
24void efl_test_case_container_model(TCase *tc); 24void efl_test_case_container_model(TCase *tc);
25void efl_test_case_view_model(TCase *tc);
26void efl_test_case_boolean_model(TCase *tc); 25void efl_test_case_boolean_model(TCase *tc);
27 26
28#endif /* EFL_SUITE_H_ */ 27#endif /* EFL_SUITE_H_ */
diff --git a/src/tests/efl/efl_test_composite_model.c b/src/tests/efl/efl_test_composite_model.c
index b3c9ebdc33..9538a1173f 100644
--- a/src/tests/efl/efl_test_composite_model.c
+++ b/src/tests/efl/efl_test_composite_model.c
@@ -70,47 +70,6 @@ _children_slice_get_then(void *data EINA_UNUSED,
70 return v; 70 return v;
71} 71}
72 72
73static Eina_Value
74_selection_children_slice_get_then(void *data EINA_UNUSED,
75 const Eina_Value v,
76 const Eina_Future *dead_future EINA_UNUSED)
77{
78 unsigned int i, len;
79 Efl_Model *child = NULL;
80
81 fail_if(eina_value_type_get(&v) != EINA_VALUE_TYPE_ARRAY);
82
83 EINA_VALUE_ARRAY_FOREACH(&v, len, i, child)
84 {
85 Eina_Value *p_int = NULL;
86 Eina_Value *p_bool = NULL;
87 Eina_Value *p_index = NULL;
88 int v_int = 0;
89 unsigned int index = 0;
90 Eina_Bool v_bool = EINA_FALSE;
91
92 p_bool = efl_model_property_get(child, "selected");
93 p_int = efl_model_property_get(child, "test_p_int");
94 p_index = efl_model_property_get(child, "child.index");
95
96 eina_value_get(p_bool, &v_bool);
97 eina_value_get(p_int, &v_int);
98 fail_if(!eina_value_uint_convert(p_index, &index));
99
100 fail_if(v_bool != base_selections[i]);
101 fail_if(v_int != base_ints[i]);
102 ck_assert_int_eq(i, index);
103
104 eina_value_free(p_bool);
105 eina_value_free(p_int);
106 eina_value_free(p_index);
107 }
108
109 ecore_main_loop_quit();
110
111 return v;
112}
113
114EFL_START_TEST(efl_test_boolean_model) 73EFL_START_TEST(efl_test_boolean_model)
115{ 74{
116 Efl_Generic_Model *base_model, *child; 75 Efl_Generic_Model *base_model, *child;
@@ -145,62 +104,6 @@ EFL_START_TEST(efl_test_boolean_model)
145} 104}
146EFL_END_TEST 105EFL_END_TEST
147 106
148static Eina_Value
149_wait_propagate(void *data EINA_UNUSED,
150 const Eina_Value v,
151 const Eina_Future *dead_future EINA_UNUSED)
152{
153 ecore_main_loop_quit();
154 return v;
155}
156
157EFL_START_TEST(efl_test_select_model)
158{
159 Efl_Generic_Model *base_model, *child;
160 int i;
161 Eina_Value v = { 0 };
162 Efl_Select_Model *model;
163 Eina_Future *future;
164 Eina_Iterator *it;
165 uint64_t *index;
166
167 eina_value_setup(&v, EINA_VALUE_TYPE_INT);
168
169 base_model = efl_add_ref(EFL_GENERIC_MODEL_CLASS, efl_main_loop_get());
170 ck_assert(!!base_model);
171
172 for (i = 0; i < child_number; ++i)
173 {
174 child = efl_model_child_add(base_model);
175 ck_assert(!!child);
176 ck_assert(eina_value_set(&v, base_ints[i]));
177 efl_model_property_set(child, "test_p_int", &v);
178 }
179
180 model = efl_add_ref(EFL_SELECT_MODEL_CLASS, efl_main_loop_get(),
181 efl_ui_view_model_set(efl_added, base_model));
182 ck_assert(!!model);
183 future = efl_model_property_set(model, "child.selected", eina_value_int_new(2));
184 eina_future_then(future, _wait_propagate, NULL, NULL);
185 ecore_main_loop_begin();
186
187 future = efl_model_children_slice_get(model, 0, efl_model_children_count_get(model));
188 eina_future_then(future, _selection_children_slice_get_then, NULL, NULL);
189
190 ecore_main_loop_begin();
191
192 it = efl_select_model_selected_get(model);
193 EINA_ITERATOR_FOREACH(it, index)
194 fail_if(*index != 2);
195 eina_iterator_free(it);
196
197 it = efl_select_model_unselected_get(model);
198 EINA_ITERATOR_FOREACH(it, index)
199 fail_if(*index == 2);
200 eina_iterator_free(it);
201}
202EFL_END_TEST
203
204typedef struct _Efl_Filter_Model_Wait Efl_Filter_Model_Wait; 107typedef struct _Efl_Filter_Model_Wait Efl_Filter_Model_Wait;
205struct _Efl_Filter_Model_Wait 108struct _Efl_Filter_Model_Wait
206{ 109{
@@ -465,6 +368,5 @@ void
465efl_test_case_boolean_model(TCase *tc) 368efl_test_case_boolean_model(TCase *tc)
466{ 369{
467 tcase_add_test(tc, efl_test_boolean_model); 370 tcase_add_test(tc, efl_test_boolean_model);
468 tcase_add_test(tc, efl_test_select_model);
469 tcase_add_test(tc, efl_test_filter_model); 371 tcase_add_test(tc, efl_test_filter_model);
470} 372}
diff --git a/src/tests/efl/meson.build b/src/tests/efl/meson.build
index 6bd1353804..aba64ac2f3 100644
--- a/src/tests/efl/meson.build
+++ b/src/tests/efl/meson.build
@@ -3,7 +3,6 @@ efl_suite_src = [
3 'efl_suite.h', 3 'efl_suite.h',
4 'efl_test_composite_model.c', 4 'efl_test_composite_model.c',
5 'efl_test_container_model.c', 5 'efl_test_container_model.c',
6 'efl_test_view_model.c'
7] 6]
8 7
9efl_suite_bin = executable('efl_suite', 8efl_suite_bin = executable('efl_suite',
diff --git a/src/tests/elementary/efl_ui_suite.c b/src/tests/elementary/efl_ui_suite.c
index 07f3c40b06..b893f253c1 100644
--- a/src/tests/elementary/efl_ui_suite.c
+++ b/src/tests/elementary/efl_ui_suite.c
@@ -38,6 +38,8 @@ static const Efl_Test_Case etc[] = {
38 { "efl_ui_collection", efl_ui_test_item_container }, 38 { "efl_ui_collection", efl_ui_test_item_container },
39 { "efl_ui_grid_container", efl_ui_test_grid_container }, 39 { "efl_ui_grid_container", efl_ui_test_grid_container },
40 { "efl_ui_list_container", efl_ui_test_list_container }, 40 { "efl_ui_list_container", efl_ui_test_list_container },
41 { "efl_ui_select_model", efl_ui_test_select_model },
42 { "efl_ui_view_model", efl_ui_test_view_model },
41 { NULL, NULL } 43 { NULL, NULL }
42}; 44};
43 45
diff --git a/src/tests/elementary/efl_ui_suite.h b/src/tests/elementary/efl_ui_suite.h
index 0ddf9bd62f..00294a9a71 100644
--- a/src/tests/elementary/efl_ui_suite.h
+++ b/src/tests/elementary/efl_ui_suite.h
@@ -49,6 +49,8 @@ void efl_ui_test_grid_container(TCase *tc);
49void efl_ui_test_config(TCase *tc); 49void efl_ui_test_config(TCase *tc);
50void efl_ui_test_popup(TCase *tc); 50void efl_ui_test_popup(TCase *tc);
51void efl_ui_test_scroller(TCase *tc); 51void efl_ui_test_scroller(TCase *tc);
52void efl_ui_test_select_model(TCase *tc);
53void efl_ui_test_view_model(TCase *tc);
52 54
53void loop_timer_interval_set(Eo *obj, double in); 55void loop_timer_interval_set(Eo *obj, double in);
54 56
diff --git a/src/tests/elementary/efl_ui_test_select_model.c b/src/tests/elementary/efl_ui_test_select_model.c
new file mode 100644
index 0000000000..e11155c0aa
--- /dev/null
+++ b/src/tests/elementary/efl_ui_test_select_model.c
@@ -0,0 +1,130 @@
1/* EFL - EFL library
2 * Copyright (C) 2013 Cedric Bail
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library;
16 * if not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifdef HAVE_CONFIG_H
20# include "config.h"
21#endif
22
23#include "efl_ui_suite.h"
24
25static const int child_number = 3;
26static const int base_ints[] = { 41, 42, 43 };
27static const Eina_Bool base_selections[] = { EINA_FALSE, EINA_FALSE, EINA_TRUE };
28
29static Eina_Value
30_selection_children_slice_get_then(void *data EINA_UNUSED,
31 const Eina_Value v,
32 const Eina_Future *dead_future EINA_UNUSED)
33{
34 unsigned int i, len;
35 Efl_Model *child = NULL;
36
37 fail_if(eina_value_type_get(&v) != EINA_VALUE_TYPE_ARRAY);
38
39 EINA_VALUE_ARRAY_FOREACH(&v, len, i, child)
40 {
41 Eina_Value *p_int = NULL;
42 Eina_Value *p_bool = NULL;
43 Eina_Value *p_index = NULL;
44 int v_int = 0;
45 unsigned int index = 0;
46 Eina_Bool v_bool = EINA_FALSE;
47
48 p_bool = efl_model_property_get(child, "selected");
49 p_int = efl_model_property_get(child, "test_p_int");
50 p_index = efl_model_property_get(child, "child.index");
51
52 eina_value_get(p_bool, &v_bool);
53 eina_value_get(p_int, &v_int);
54 fail_if(!eina_value_uint_convert(p_index, &index));
55
56 fail_if(v_bool != base_selections[i]);
57 fail_if(v_int != base_ints[i]);
58 ck_assert_int_eq(i, index);
59
60 eina_value_free(p_bool);
61 eina_value_free(p_int);
62 eina_value_free(p_index);
63 }
64
65 ecore_main_loop_quit();
66
67 return v;
68}
69
70static Eina_Value
71_wait_propagate(void *data EINA_UNUSED,
72 const Eina_Value v,
73 const Eina_Future *dead_future EINA_UNUSED)
74{
75 ecore_main_loop_quit();
76 return v;
77}
78
79EFL_START_TEST(efl_test_select_model)
80{
81 Efl_Generic_Model *base_model, *child;
82 int i;
83 Eina_Value v = { 0 };
84 Efl_Ui_Select_Model *model;
85 Eina_Future *future;
86 Eina_Iterator *it;
87 uint64_t *index;
88
89 eina_value_setup(&v, EINA_VALUE_TYPE_INT);
90
91 base_model = efl_add_ref(EFL_GENERIC_MODEL_CLASS, efl_main_loop_get());
92 ck_assert(!!base_model);
93
94 for (i = 0; i < child_number; ++i)
95 {
96 child = efl_model_child_add(base_model);
97 ck_assert(!!child);
98 ck_assert(eina_value_set(&v, base_ints[i]));
99 efl_model_property_set(child, "test_p_int", &v);
100 }
101
102 model = efl_add_ref(EFL_UI_SELECT_MODEL_CLASS, efl_main_loop_get(),
103 efl_ui_view_model_set(efl_added, base_model));
104 ck_assert(!!model);
105 future = efl_model_property_set(model, "child.selected", eina_value_int_new(2));
106 eina_future_then(future, _wait_propagate, NULL, NULL);
107 ecore_main_loop_begin();
108
109 future = efl_model_children_slice_get(model, 0, efl_model_children_count_get(model));
110 eina_future_then(future, _selection_children_slice_get_then, NULL, NULL);
111
112 ecore_main_loop_begin();
113
114 it = efl_ui_select_model_selected_get(model);
115 EINA_ITERATOR_FOREACH(it, index)
116 fail_if(*index != 2);
117 eina_iterator_free(it);
118
119 it = efl_ui_select_model_unselected_get(model);
120 EINA_ITERATOR_FOREACH(it, index)
121 fail_if(*index == 2);
122 eina_iterator_free(it);
123}
124EFL_END_TEST
125
126void
127efl_ui_test_select_model(TCase *tc)
128{
129 tcase_add_test(tc, efl_test_select_model);
130}
diff --git a/src/tests/efl/efl_test_view_model.c b/src/tests/elementary/efl_ui_test_view_model.c
index 13e0a13027..b282ea1252 100644
--- a/src/tests/efl/efl_test_view_model.c
+++ b/src/tests/elementary/efl_ui_test_view_model.c
@@ -20,10 +20,7 @@
20# include "config.h" 20# include "config.h"
21#endif 21#endif
22 22
23#include "efl_suite.h" 23#include "efl_ui_suite.h"
24
25#include <Efl.h>
26#include <Ecore.h>
27 24
28static const int child_number = 3; 25static const int child_number = 3;
29static const int base_ints[] = { 41, 42, 43 }; 26static const int base_ints[] = { 41, 42, 43 };
@@ -31,7 +28,7 @@ static const char *_efl_test_view_model_label_format = "Index %i.";
31static const char *dependences[] = { "test_p_int" }; 28static const char *dependences[] = { "test_p_int" };
32 29
33static Eina_Value * 30static Eina_Value *
34_efl_test_view_model_label_get(void *data, const Efl_View_Model *mv, Eina_Stringshare *property) 31_efl_test_view_model_label_get(void *data, const Efl_Ui_View_Model *mv, Eina_Stringshare *property)
35{ 32{
36 Eina_Strbuf *buf; 33 Eina_Strbuf *buf;
37 Eina_Value *r; 34 Eina_Value *r;
@@ -54,7 +51,7 @@ _efl_test_view_model_label_get(void *data, const Efl_View_Model *mv, Eina_String
54} 51}
55 52
56static Eina_Future * 53static Eina_Future *
57_efl_test_view_model_label_set(void *data EINA_UNUSED, Efl_View_Model *mv, Eina_Stringshare *property EINA_UNUSED, Eina_Value *value EINA_UNUSED) 54_efl_test_view_model_label_set(void *data EINA_UNUSED, Efl_Ui_View_Model *mv, Eina_Stringshare *property EINA_UNUSED, Eina_Value *value EINA_UNUSED)
58{ 55{
59 return efl_loop_future_rejected(mv, EFL_MODEL_ERROR_READ_ONLY); 56 return efl_loop_future_rejected(mv, EFL_MODEL_ERROR_READ_ONLY);
60} 57}
@@ -66,7 +63,7 @@ _efl_test_view_model_label_clean(void *data)
66} 63}
67 64
68static Eina_Value * 65static Eina_Value *
69_efl_test_view_model_color_get(void *data EINA_UNUSED, const Efl_View_Model *mv, Eina_Stringshare *property) 66_efl_test_view_model_color_get(void *data EINA_UNUSED, const Efl_Ui_View_Model *mv, Eina_Stringshare *property)
70{ 67{
71 Eina_Strbuf *buf; 68 Eina_Strbuf *buf;
72 Eina_Value *r; 69 Eina_Value *r;
@@ -88,7 +85,7 @@ _efl_test_view_model_color_get(void *data EINA_UNUSED, const Efl_View_Model *mv,
88} 85}
89 86
90static Eina_Future * 87static Eina_Future *
91_efl_test_view_model_color_set(void *data EINA_UNUSED, Efl_View_Model *mv, Eina_Stringshare *property EINA_UNUSED, Eina_Value *value EINA_UNUSED) 88_efl_test_view_model_color_set(void *data EINA_UNUSED, Efl_Ui_View_Model *mv, Eina_Stringshare *property EINA_UNUSED, Eina_Value *value EINA_UNUSED)
92{ 89{
93 return efl_loop_future_rejected(mv, EFL_MODEL_ERROR_READ_ONLY); 90 return efl_loop_future_rejected(mv, EFL_MODEL_ERROR_READ_ONLY);
94} 91}
@@ -318,36 +315,36 @@ EFL_START_TEST(efl_test_view_model)
318 efl_model_property_set(child, "test_p_int", &v); 315 efl_model_property_set(child, "test_p_int", &v);
319 } 316 }
320 317
321 mv = efl_add_ref(EFL_VIEW_MODEL_CLASS, efl_main_loop_get(), 318 mv = efl_add_ref(EFL_UI_VIEW_MODEL_CLASS, efl_main_loop_get(),
322 efl_ui_view_model_set(efl_added, base_model)); 319 efl_ui_view_model_set(efl_added, base_model));
323 ck_assert(!!mv); 320 ck_assert(!!mv);
324 321
325 efl_view_model_property_logic_add(mv, "label", 322 efl_ui_view_model_property_logic_add(mv, "label",
326 (void*) _efl_test_view_model_label_format, _efl_test_view_model_label_get, _efl_test_view_model_label_clean, 323 (void*) _efl_test_view_model_label_format, _efl_test_view_model_label_get, _efl_test_view_model_label_clean,
327 (void*) _efl_test_view_model_label_format, _efl_test_view_model_label_set, _efl_test_view_model_label_clean, 324 (void*) _efl_test_view_model_label_format, _efl_test_view_model_label_set, _efl_test_view_model_label_clean,
328 EINA_C_ARRAY_ITERATOR_NEW(dependences)); 325 EINA_C_ARRAY_ITERATOR_NEW(dependences));
329 326
330 efl_view_model_property_logic_add(mv, "color", 327 efl_ui_view_model_property_logic_add(mv, "color",
331 NULL, _efl_test_view_model_color_get, _efl_test_view_model_color_clean, 328 NULL, _efl_test_view_model_color_get, _efl_test_view_model_color_clean,
332 NULL, _efl_test_view_model_color_set, _efl_test_view_model_color_clean, 329 NULL, _efl_test_view_model_color_set, _efl_test_view_model_color_clean,
333 EINA_C_ARRAY_ITERATOR_NEW(dependences)); 330 EINA_C_ARRAY_ITERATOR_NEW(dependences));
334 331
335 efl_view_model_property_logic_add(mv, "deadend", 332 efl_ui_view_model_property_logic_add(mv, "deadend",
336 NULL, NULL, NULL, 333 NULL, NULL, NULL,
337 NULL, NULL, NULL, 334 NULL, NULL, NULL,
338 NULL); 335 NULL);
339 336
340 efl_view_model_property_string_add(mv, "output", 337 efl_ui_view_model_property_string_add(mv, "output",
341 "${label} has ${color} for index ${index}", 338 "${label} has ${color} for index ${index}",
342 "${index} not ready", 339 "${index} not ready",
343 "${index} in error"); 340 "${index} in error");
344 341
345 efl_view_model_property_string_add(mv, "broken", 342 efl_ui_view_model_property_string_add(mv, "broken",
346 "${nope} has ${color} for index ${index}", 343 "${nope} has ${color} for index ${index}",
347 "${index} not ready", 344 "${index} not ready",
348 "${index} in error with '${nope}'"); 345 "${index} in error with '${nope}'");
349 346
350 efl_view_model_property_string_add(mv, "weird", "${} % { } has ${", NULL, NULL); 347 efl_ui_view_model_property_string_add(mv, "weird", "${} % { } has ${", NULL, NULL);
351 348
352 f = efl_model_children_slice_get(mv, 0, efl_model_children_count_get(mv)); 349 f = efl_model_children_slice_get(mv, 0, efl_model_children_count_get(mv));
353 f = efl_future_then(mv, f, .success_type = EINA_VALUE_TYPE_ARRAY, 350 f = efl_future_then(mv, f, .success_type = EINA_VALUE_TYPE_ARRAY,
@@ -367,7 +364,7 @@ EFL_START_TEST(efl_test_view_model)
367EFL_END_TEST 364EFL_END_TEST
368 365
369void 366void
370efl_test_case_view_model(TCase *tc) 367efl_ui_test_view_model(TCase *tc)
371{ 368{
372 tcase_add_test(tc, efl_test_view_model); 369 tcase_add_test(tc, efl_test_view_model);
373} 370}
diff --git a/src/tests/elementary/meson.build b/src/tests/elementary/meson.build
index 5204c6473a..161a389967 100644
--- a/src/tests/elementary/meson.build
+++ b/src/tests/elementary/meson.build
@@ -154,6 +154,8 @@ efl_ui_suite_src = [
154 'efl_ui_test_position_manager_common.c', 154 'efl_ui_test_position_manager_common.c',
155 'efl_ui_test_popup.c', 155 'efl_ui_test_popup.c',
156 'efl_ui_test_scroller.c', 156 'efl_ui_test_scroller.c',
157 'efl_ui_test_select_model.c',
158 'efl_ui_test_view_model.c',
157] 159]
158 160
159efl_ui_suite = executable('efl_ui_suite', 161efl_ui_suite = executable('efl_ui_suite',