efl_ui : rename model connect and factory connect to bind property and factory.

As we discussed in T7469 with V40,

efl_ui_model_connect
efl_ui_factory_model_connect

need to be renamed to

efl_ui_bind_property
efl_ui_bind_factory

for this work,
Efl.Ui.Model.Connect interface is changed as Efl.Ui.Bind,
and bind_property and bind_factory both method is supported by this interface.

bind_factory need Efl.Ui.Factory,
and Efl.Ui.Factory inheritted Efl.Ui.Bind,
so I little bit concerned about circular referencing, but so far, it works well.

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D7529
This commit is contained in:
SangHyeon Jade Lee 2019-01-31 11:59:19 +00:00 committed by Cedric BAIL
parent 9277586fd8
commit 053146598c
29 changed files with 162 additions and 139 deletions

View File

@ -64,8 +64,9 @@ efl_eolian_files = \
lib/efl/interfaces/efl_ui_range_display.eo \
lib/efl/interfaces/efl_ui_range_interactive.eo \
lib/efl/interfaces/efl_ui_view.eo \
lib/efl/interfaces/efl_ui_model_connect.eo \
lib/efl/interfaces/efl_ui_property_bind.eo \
lib/efl/interfaces/efl_ui_factory.eo \
lib/efl/interfaces/efl_ui_factory_bind.eo \
lib/efl/interfaces/efl_screen.eo \
lib/efl/interfaces/efl_io_closer.eo \
lib/efl/interfaces/efl_io_positioner.eo \

View File

@ -64,7 +64,7 @@ elementary/label_example_03.c \
elementary/layout_example_01.c \
elementary/layout_example_02.c \
elementary/layout_example_03.c \
elementary/layout_model_connect.c \
elementary/layout_property_bind.c \
elementary/list_example_01.c \
elementary/list_example_02.c \
elementary/list_example_03.c \
@ -283,7 +283,7 @@ elementary/label_example_03 \
elementary/layout_example_01 \
elementary/layout_example_02 \
elementary/layout_example_03 \
elementary/layout_model_connect \
elementary/layout_property_bind \
elementary/list_example_01 \
elementary/list_example_02 \
elementary/list_example_03 \

View File

@ -58,7 +58,7 @@
/layout_example_01
/layout_example_02
/layout_example_03
/layout_model_connect
/layout_property_bind
/list_example_01
/list_example_02
/list_example_03

View File

@ -87,9 +87,9 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
);
factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win);
efl_ui_model_connect(factory, "signal/efl,state,%v", "odd_style");
efl_ui_model_connect(factory, "signal/efl,state,%{selected;unselected}", "selected");
efl_ui_model_connect(factory, "efl.text", "name");
efl_ui_property_bind(factory, "signal/efl,state,%v", "odd_style");
efl_ui_property_bind(factory, "signal/efl,state,%{selected;unselected}", "selected");
efl_ui_property_bind(factory, "efl.text", "name");
efl_ui_layout_factory_theme_config(factory, "list_item", NULL, "default");
li = efl_add(EFL_UI_LIST_VIEW_CLASS, win

View File

@ -33,7 +33,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
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_property_bind(factory, "efl.text", "filename");
efl_ui_layout_factory_theme_config(factory, "list_item", NULL, "default");
li = efl_add(EFL_UI_LIST_VIEW_CLASS, win);
@ -45,8 +45,8 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
imgf = efl_add(EFL_UI_IMAGE_FACTORY_CLASS, win);
efl_ui_model_connect(imgf, "", "path"); //connect to "path" property
efl_ui_factory_model_connect(factory, "efl.icon", imgf);
efl_ui_property_bind(imgf, "", "path"); //connect to "path" property
efl_ui_factory_bind(factory, "efl.icon", imgf);
elm_win_resize_object_add(win, li);

View File

@ -150,8 +150,8 @@ _realized_1_cb(void *data EINA_UNUSED, const Efl_Event *event)
evas_object_size_hint_weight_set(ie->layout, EVAS_HINT_EXPAND, 0);
evas_object_size_hint_align_set(ie->layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
efl_ui_model_connect(ie->layout, "efl.text", "name");
efl_ui_model_connect(ie->layout, "signal/efl,state,%v", "odd_style");
efl_ui_property_bind(ie->layout, "efl.text", "name");
efl_ui_property_bind(ie->layout, "signal/efl,state,%v", "odd_style");
}
static void
@ -163,7 +163,7 @@ _realized_2_cb(void *data EINA_UNUSED, const Efl_Event *event)
elm_object_focus_allow_set(ie->layout, EINA_TRUE);
evas_object_size_hint_weight_set(ie->layout, EVAS_HINT_EXPAND, 0);
evas_object_size_hint_align_set(ie->layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
efl_ui_model_connect(ie->layout, "efl.text", "occupation");
efl_ui_property_bind(ie->layout, "efl.text", "occupation");
}
static Efl_Model*
@ -222,7 +222,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
priv->model = _make_model();
factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win);
efl_ui_model_connect(factory, "efl.text", "filename");
efl_ui_property_bind(factory, "efl.text", "filename");
efl_ui_layout_factory_theme_config(factory, "list_item", NULL, "default");
priv->list1 = efl_add(EFL_UI_LIST_VIEW_CLASS, win, efl_ui_view_model_set(efl_added, priv->model));
@ -233,8 +233,8 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
efl_ui_list_view_layout_factory_set(priv->list1, factory);
factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win);
efl_ui_model_connect(factory, "efl.text", "filename");
efl_ui_model_connect(factory, "signal/efl,state,%v", "selected");
efl_ui_property_bind(factory, "efl.text", "filename");
efl_ui_property_bind(factory, "signal/efl,state,%v", "selected");
efl_ui_layout_factory_theme_config(factory, "list_item", NULL, "default");
priv->list2 = efl_add(EFL_UI_LIST_VIEW_CLASS, win, efl_ui_view_model_set(efl_added, priv->model));
efl_event_callback_add(priv->list2, EFL_UI_LIST_VIEW_EVENT_ITEM_REALIZED, _realized_2_cb, priv->list2);

View File

@ -149,8 +149,9 @@ typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command;
#include "interfaces/efl_canvas_scene.eo.h"
#include "interfaces/efl_canvas_pointer.eo.h"
#include "interfaces/efl_ui_view.eo.h"
#include "interfaces/efl_ui_model_connect.eo.h"
#include "interfaces/efl_ui_property_bind.eo.h"
#include "interfaces/efl_ui_factory.eo.h"
#include "interfaces/efl_ui_factory_bind.eo.h"
#include "interfaces/efl_ui_format.eo.h"
#include "interfaces/efl_cached_item.eo.h"

View File

@ -70,8 +70,9 @@
#include "interfaces/efl_ui_range_interactive.eo.c"
#include "interfaces/efl_ui_autorepeat.eo.c"
#include "interfaces/efl_ui_view.eo.c"
#include "interfaces/efl_ui_model_connect.eo.c"
#include "interfaces/efl_ui_property_bind.eo.c"
#include "interfaces/efl_ui_factory.eo.c"
#include "interfaces/efl_ui_factory_bind.eo.c"
#include "interfaces/efl_ui_draggable.eo.c"
#include "interfaces/efl_ui_clickable.eo.c"

View File

@ -4,7 +4,7 @@ struct Efl.Ui.Factory_Item_Created_Event {
item: Efl.Gfx.Entity; [[The item that was just created.]]
}
interface Efl.Ui.Factory extends Efl.Ui.Model.Connect
interface Efl.Ui.Factory extends Efl.Ui.Property_Bind, Efl.Ui.Factory_Bind
{
[[Efl UI factory interface]]
methods {
@ -22,13 +22,6 @@ interface Efl.Ui.Factory extends Efl.Ui.Model.Connect
ui_view: Efl.Gfx.Entity; [[Efl canvas]]
}
}
model_connect {
[[Connect factory to a model]]
params {
name: string; [[Model name]]
factory: Efl.Ui.Factory; [[Efl factory]]
}
}
}
events {
created: Efl.Ui.Factory_Item_Created_Event; [[Event triggered when an item has been successfully created.]]

View File

@ -0,0 +1,19 @@
interface Efl.Ui.Factory_Bind
{
[[Efl UI Property interface.
view object can have @Efl.Model and need to set cotent with those model stored data.
the interface can help binding the factory to create object with model property data.
see @Efl.Model
see @Efl.Ui.Factory]]
methods {
factory_bind {
[[bind the factory with the given key string. when the data is ready or changed,
factory create the object and bind the data to the key action and process promised work.
Note: the input @Efl.Ui.Factory need to be @Efl.Ui.Property_Bind.property_bind at least once.]]
params {
key: string; [[Key string for bind model property data]]
factory: Efl.Ui.Factory; [[@Efl.Ui.Factory for create and bind model property data]]
}
}
}
}

View File

@ -1,13 +0,0 @@
interface Efl.Ui.Model.Connect
{
[[Efl UI model connect interface]]
methods {
connect {
[[Connect property]]
params {
name: string; [[Model name]]
property: string; [[Property name]]
}
}
}
}

View File

@ -0,0 +1,18 @@
interface Efl.Ui.Property_Bind
{
[[Efl UI Property_Bind interface.
view object can have @Efl.Model to manage the data,
the interface can help loading and tracking child data from the model property.
see @Efl.Model
see @Efl.Ui.Factory]]
methods {
property_bind {
[[bind property data with the given key string. when the data is ready or changed,
bind the data to the key action and process promised work.]]
params {
key: string; [[key string for bind model property data]]
property: string; [[Model property name]]
}
}
}
}

View File

@ -90,8 +90,9 @@ pub_eo_files = [
'efl_ui_range_display.eo',
'efl_ui_range_interactive.eo',
'efl_ui_view.eo',
'efl_ui_model_connect.eo',
'efl_ui_property_bind.eo',
'efl_ui_factory.eo',
'efl_ui_factory_bind.eo',
'efl_ui_multi_selectable.eo',
'efl_screen.eo',
'efl_io_closer.eo',

View File

@ -325,12 +325,12 @@ _efl_ui_caching_factory_efl_object_parent_set(Eo *obj, Efl_Ui_Caching_Factory_Da
}
static void
_efl_ui_caching_factory_efl_ui_model_connect_connect(Eo *obj, Efl_Ui_Caching_Factory_Data *pd,
const char *name, const char *property)
_efl_ui_caching_factory_efl_ui_property_bind_property_bind(Eo *obj, Efl_Ui_Caching_Factory_Data *pd,
const char *key, const char *property)
{
if (!strcmp(name, "style"))
if (!strcmp(key, "style"))
eina_stringshare_replace(&pd->style, property);
efl_ui_model_connect(efl_super(obj, EFL_UI_CACHING_FACTORY_CLASS), name, property);
efl_ui_property_bind(efl_super(obj, EFL_UI_CACHING_FACTORY_CLASS), key, property);
}
#include "efl_ui_caching_factory.eo.c"

View File

@ -36,7 +36,7 @@ class Efl.Ui.Caching_Factory extends Efl.Ui.Widget_Factory
implements {
Efl.Ui.Factory.create;
Efl.Ui.Factory.release;
Efl.Ui.Model.Connect.connect;
Efl.Ui.Property_Bind.property_bind;
Efl.Ui.Widget_Factory.item_class { get; set; }
Efl.Object.invalidate;
Efl.Object.parent { set; }

View File

@ -1952,20 +1952,20 @@ _efl_ui_image_efl_ui_view_model_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Data
}
EOLIAN static void
_efl_ui_image_efl_ui_model_connect_connect(Eo *obj, Efl_Ui_Image_Data *pd, const char *name, const char *property)
_efl_ui_image_efl_ui_property_bind_property_bind(Eo *obj, Efl_Ui_Image_Data *pd, const char *key, const char *property)
{
if (strcmp(name, "filename") == 0)
if (strcmp(key, "filename") == 0)
{
pd->property.icon = EINA_FALSE;
eina_stringshare_replace(&pd->property.file, property);
}
else if (strcmp(name, "icon") == 0)
else if (strcmp(key, "icon") == 0)
{
pd->property.icon = EINA_TRUE;
eina_stringshare_replace(&pd->property.file, property);
eina_stringshare_replace(&pd->property.key, NULL);
}
else if (strcmp(name, "key") == 0)
else if (strcmp(key, "key") == 0)
{
eina_stringshare_replace(&pd->property.key, property);
}

View File

@ -22,7 +22,7 @@ class Efl.Ui.Image extends Efl.Ui.Widget implements Efl.Ui.Clickable, Efl.Ui.Dra
Efl.File, Efl.Gfx.Image, Efl.Gfx.Image_Load_Controller, Efl.Player, Efl.Gfx.View,
Efl.Access.Component, Efl.Access.Widget.Action, Efl.Gfx.Color,
Efl.Orientation,
Efl.Ui.View, Efl.Ui.Model.Connect, Efl.Layout.Calc,
Efl.Ui.View, Efl.Ui.Property_Bind, Efl.Layout.Calc,
Efl.Layout.Group, Efl.Layout.Signal
{
[[ Efl UI image class]]
@ -118,7 +118,7 @@ class Efl.Ui.Image extends Efl.Ui.Widget implements Efl.Ui.Clickable, Efl.Ui.Dra
Efl.Canvas.Object.clip { set; }
Efl.Canvas.Group.group_member_add;
Efl.Ui.Draggable.drag_target { get; set; }
Efl.Ui.Model.Connect.connect;
Efl.Ui.Property_Bind.property_bind;
Efl.Ui.View.model { get; set; }
Efl.Ui.Widget.theme_apply;
Efl.Ui.Widget.widget_event;

View File

@ -34,14 +34,14 @@ _efl_ui_image_factory_efl_object_destructor(Eo *obj EINA_UNUSED, Efl_Ui_Image_Fa
}
static Eina_Value
_efl_ui_image_factory_connect(Eo *obj EINA_UNUSED, void *data, const Eina_Value value)
_efl_ui_image_factory_bind(Eo *obj EINA_UNUSED, void *data, const Eina_Value value)
{
Efl_Gfx_Entity *entity = NULL;
Efl_Ui_Image_Factory_Data *pd = data;
eina_value_pget(&value, &entity);
efl_ui_model_connect(entity, "filename", pd->property);
efl_ui_property_bind(entity, "filename", pd->property);
return value;
}
@ -58,12 +58,12 @@ _efl_ui_image_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Image_Factory_Data *
return efl_future_then(obj, f,
.success_type = EINA_VALUE_TYPE_OBJECT,
.success = _efl_ui_image_factory_connect,
.success = _efl_ui_image_factory_bind,
.data = pd);
}
EOLIAN static void
_efl_ui_image_factory_efl_ui_model_connect_connect(Eo *obj EINA_UNUSED, Efl_Ui_Image_Factory_Data *pd, const char *name EINA_UNUSED, const char *property)
_efl_ui_image_factory_efl_ui_property_bind_property_bind(Eo *obj EINA_UNUSED, Efl_Ui_Image_Factory_Data *pd, const char *key EINA_UNUSED, const char *property)
{
eina_stringshare_replace(&pd->property, property);
}

View File

@ -5,6 +5,6 @@ class Efl.Ui.Image_Factory extends Efl.Ui.Caching_Factory
Efl.Object.constructor;
Efl.Object.destructor;
Efl.Ui.Factory.create;
Efl.Ui.Model.Connect.connect;
Efl.Ui.Property_Bind.property_bind;
}
}

View File

@ -76,7 +76,7 @@ struct _Efl_Ui_Layout_Factory_Tracking
{
Efl_Ui_Factory *factory;
Eina_Future *in_flight;
Eina_Stringshare *name;
Eina_Stringshare *key;
};
@ -2085,7 +2085,7 @@ struct _Efl_Ui_Layout_Factory_Request
Efl_Ui_Layout_Factory_Tracking *tracking;
Efl_Ui_Layout_Data *pd;
Efl_Ui_Factory *factory;
const char *name;
const char *key;
};
static Eina_Value
@ -2098,11 +2098,11 @@ _content_created(Eo *obj, void *data, const Eina_Value value)
eina_value_get(&value, &content);
// Recycle old content
old_content = elm_layout_content_get(obj, request->name);
old_content = elm_layout_content_get(obj, request->key);
if (old_content) efl_ui_factory_release(request->factory, old_content);
// Set new content
elm_layout_content_set(obj, request->name, content);
elm_layout_content_set(obj, request->key, content);
return value;
}
@ -2113,13 +2113,13 @@ _clean_request(Eo *obj EINA_UNUSED, void *data, const Eina_Future *dead_future E
Efl_Ui_Layout_Factory_Request *request = data;
request->tracking->in_flight = NULL;
eina_stringshare_del(request->name);
eina_stringshare_del(request->key);
efl_unref(request->factory);
free(request);
}
static void
_efl_ui_layout_view_model_content_update(Efl_Ui_Layout_Data *pd, Efl_Ui_Layout_Factory_Tracking *tracking, const char *name)
_efl_ui_layout_view_model_content_update(Efl_Ui_Layout_Data *pd, Efl_Ui_Layout_Factory_Tracking *tracking, const char *key)
{
Efl_Ui_Layout_Factory_Request *request = calloc(1, sizeof (Efl_Ui_Layout_Factory_Request));
Eina_Future *f;
@ -2128,7 +2128,7 @@ _efl_ui_layout_view_model_content_update(Efl_Ui_Layout_Data *pd, Efl_Ui_Layout_F
if (tracking->in_flight) eina_future_cancel(tracking->in_flight);
request->name = eina_stringshare_ref(name);
request->key = eina_stringshare_ref(key);
request->pd = pd;
request->factory = efl_ref(tracking->factory);
request->tracking = tracking;
@ -2205,7 +2205,7 @@ _efl_ui_layout_factory_free(Efl_Ui_Layout_Factory_Tracking *tracking)
{
if (tracking->in_flight) eina_future_cancel(tracking->in_flight);
efl_unref(tracking->factory);
eina_stringshare_del(tracking->name);
eina_stringshare_del(tracking->key);
free(tracking);
}
@ -2222,7 +2222,7 @@ _efl_ui_layout_connect_hash(Efl_Ui_Layout_Data *pd)
EOLIAN static void
_efl_ui_layout_efl_ui_view_model_set(Eo *obj, Efl_Ui_Layout_Data *pd, Efl_Model *model)
{
Eina_Stringshare *name;
Eina_Stringshare *key;
Eina_Hash_Tuple *tuple;
Eina_Iterator *it;
@ -2241,9 +2241,9 @@ _efl_ui_layout_efl_ui_view_model_set(Eo *obj, Efl_Ui_Layout_Data *pd, Efl_Model
// Reset to empty state
it = eina_hash_iterator_key_new(pd->connect.properties);
EINA_ITERATOR_FOREACH(it, name)
EINA_ITERATOR_FOREACH(it, key)
{
efl_text_set(efl_part(obj, name), NULL);
efl_text_set(efl_part(obj, key), NULL);
}
eina_iterator_free(it);
@ -2253,15 +2253,15 @@ _efl_ui_layout_efl_ui_view_model_set(Eo *obj, Efl_Ui_Layout_Data *pd, Efl_Model
Efl_Ui_Layout_Factory_Tracking *factory;
Efl_Gfx_Entity *content;
name = tuple->key;
key = tuple->key;
factory = tuple->data;
// Cancel in flight creation request
if (factory->in_flight) eina_future_cancel(factory->in_flight);
// Cleanup content
content = elm_layout_content_get(obj, name);
elm_layout_content_set(obj, name, NULL);
content = elm_layout_content_get(obj, key);
elm_layout_content_set(obj, key, NULL);
// And recycle it
efl_ui_factory_release(factory->factory, content);
@ -2279,30 +2279,30 @@ _efl_ui_layout_efl_ui_view_model_get(const Eo *obj EINA_UNUSED, Efl_Ui_Layout_Da
}
EOLIAN static void
_efl_ui_layout_efl_ui_model_connect_connect(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *pd, const char *name, const char *property)
_efl_ui_layout_efl_ui_property_bind_property_bind(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *pd, const char *key, const char *property)
{
EINA_SAFETY_ON_NULL_RETURN(name);
EINA_SAFETY_ON_NULL_RETURN(key);
Eina_Stringshare *sprop;
Eina_Hash *hash = NULL;
char *data = NULL;
if (!_elm_layout_part_aliasing_eval(obj, &name, EINA_TRUE))
if (!_elm_layout_part_aliasing_eval(obj, &key, EINA_TRUE))
return;
_efl_ui_layout_connect_hash(pd);
sprop = eina_stringshare_add(property);
// FIXME: prevent double connect of name to multiple property ?
if (strncmp(SIGNAL_PREFIX, name, sizeof(SIGNAL_PREFIX) - 1) == 0)
// FIXME: prevent double connect of key to multiple property ?
if (strncmp(SIGNAL_PREFIX, key, sizeof(SIGNAL_PREFIX) - 1) == 0)
{
hash = pd->connect.signals;
data = strdup(name + sizeof(SIGNAL_PREFIX) - 1);
data = strdup(key + sizeof(SIGNAL_PREFIX) - 1);
}
else
{
hash = pd->connect.properties;
data = strdup(name);
data = strdup(key);
}
if (!sprop)
@ -2328,30 +2328,30 @@ _efl_ui_layout_efl_ui_model_connect_connect(Eo *obj EINA_UNUSED, Efl_Ui_Layout_D
}
EOLIAN static void
_efl_ui_layout_efl_ui_factory_model_connect(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *pd,
const char *name, Efl_Ui_Factory *factory)
_efl_ui_layout_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *pd,
const char *key, Efl_Ui_Factory *factory)
{
EINA_SAFETY_ON_NULL_RETURN(name);
EINA_SAFETY_ON_NULL_RETURN(key);
Efl_Ui_Layout_Factory_Tracking *tracking;
Eina_Stringshare *ss_name;
Eina_Stringshare *ss_key;
if (!_elm_layout_part_aliasing_eval(obj, &name, EINA_TRUE))
if (!_elm_layout_part_aliasing_eval(obj, &key, EINA_TRUE))
return;
if (!pd->connect.factories)
pd->connect.factories = eina_hash_stringshared_new(EINA_FREE_CB(_efl_ui_layout_factory_free));
ss_name = eina_stringshare_add(name);
ss_key = eina_stringshare_add(key);
// First undo the old one if there is one
tracking = eina_hash_find(pd->connect.factories, ss_name);
tracking = eina_hash_find(pd->connect.factories, ss_key);
if (tracking)
{
Efl_Gfx_Entity *old;
// Unset and recycle
old = elm_layout_content_get(obj, ss_name);
elm_layout_content_set(obj, ss_name, NULL);
old = elm_layout_content_get(obj, ss_key);
elm_layout_content_set(obj, ss_key, NULL);
if (old) efl_ui_factory_release(tracking->factory, old);
// Stop in flight request
@ -2365,15 +2365,15 @@ _efl_ui_layout_efl_ui_factory_model_connect(Eo *obj EINA_UNUSED, Efl_Ui_Layout_D
tracking = calloc(1, sizeof (Efl_Ui_Layout_Factory_Tracking));
if (!tracking) return ;
tracking->name = ss_name;
tracking->key = ss_key;
eina_hash_add(pd->connect.factories, ss_name, tracking);
eina_hash_add(pd->connect.factories, ss_key, tracking);
}
// And update content with the new factory
tracking->factory = efl_ref(factory);
_efl_ui_layout_view_model_content_update(pd, tracking, ss_name);
_efl_ui_layout_view_model_content_update(pd, tracking, ss_key);
}
EOLIAN static Eo *

View File

@ -1,7 +1,7 @@
import efl_ui;
class Efl.Ui.Layout extends Efl.Ui.Widget implements Efl.Container, Efl.File,
Efl.Ui.View, Efl.Ui.Model.Connect, Efl.Ui.Factory,
Efl.Ui.View, Efl.Ui.Property_Bind, Efl.Ui.Factory_Bind,
Efl.Layout.Calc, Efl.Layout.Signal,
Efl.Layout.Group
{
@ -76,8 +76,8 @@ class Efl.Ui.Layout extends Efl.Ui.Widget implements Efl.Container, Efl.File,
Efl.Container.content_iterate;
Efl.Part.part_get;
Efl.Ui.View.model { get; set; }
Efl.Ui.Model.Connect.connect;
Efl.Ui.Factory.model_connect;
Efl.Ui.Property_Bind.property_bind;
Efl.Ui.Factory_Bind.factory_bind;
}
events {
theme,changed: void; [[Called when theme changed]]

View File

@ -10,33 +10,35 @@
typedef struct _Efl_Ui_Layout_Factory_Data
{
Eina_Hash *connects;
Eina_Hash *factory_connects;
struct {
Eina_Hash *properties;
Eina_Hash *factories;
} bind;
Eina_Stringshare *klass;
Eina_Stringshare *group;
Eina_Stringshare *style;
} Efl_Ui_Layout_Factory_Data;
Eina_Bool
_model_connect(const Eina_Hash *hash EINA_UNUSED, const void *key, void *data, void *fdata)
_property_bind(const Eina_Hash *hash EINA_UNUSED, const void *key, void *data, void *fdata)
{
Eo *layout = fdata;
Eina_Stringshare *name = key;
Eina_Stringshare *ss_key = key;
Eina_Stringshare *property = data;
efl_ui_model_connect(layout, name, property);
efl_ui_property_bind(layout, ss_key, property);
return EINA_TRUE;
}
Eina_Bool
_factory_model_connect(const Eina_Hash *hash EINA_UNUSED, const void *key, void *data, void *fdata)
_factory_bind(const Eina_Hash *hash EINA_UNUSED, const void *key, void *data, void *fdata)
{
Eo *layout = fdata;
Eina_Stringshare *name = key;
Eina_Stringshare *ss_key = key;
Efl_Ui_Factory *factory = data;
efl_ui_factory_model_connect(layout, name, factory);
efl_ui_factory_bind(layout, ss_key, factory);
return EINA_TRUE;
}
@ -47,8 +49,8 @@ _efl_ui_layout_factory_efl_object_constructor(Eo *obj, Efl_Ui_Layout_Factory_Dat
efl_ui_widget_factory_item_class_set(obj, EFL_UI_LAYOUT_CLASS);
pd->connects = eina_hash_stringshared_new(EINA_FREE_CB(eina_stringshare_del));
pd->factory_connects = eina_hash_stringshared_new(EINA_FREE_CB(efl_unref));
pd->bind.properties = eina_hash_stringshared_new(EINA_FREE_CB(eina_stringshare_del));
pd->bind.factories = eina_hash_stringshared_new(EINA_FREE_CB(efl_unref));
return obj;
}
@ -60,14 +62,14 @@ _efl_ui_layout_factory_efl_object_destructor(Eo *obj, Efl_Ui_Layout_Factory_Data
eina_stringshare_del(pd->group);
eina_stringshare_del(pd->style);
eina_hash_free(pd->connects);
eina_hash_free(pd->factory_connects);
eina_hash_free(pd->bind.properties);
eina_hash_free( pd->bind.factories);
efl_destructor(efl_super(obj, MY_CLASS));
}
static Eina_Value
_efl_ui_layout_factory_connect(Eo *obj EINA_UNUSED, void *data, const Eina_Value value)
_efl_ui_layout_factory_bind(Eo *obj EINA_UNUSED, void *data, const Eina_Value value)
{
Efl_Ui_Layout_Factory_Data *pd = data;
Efl_Gfx_Entity *layout;
@ -76,8 +78,8 @@ _efl_ui_layout_factory_connect(Eo *obj EINA_UNUSED, void *data, const Eina_Value
efl_ui_layout_theme_set(layout, pd->klass, pd->group, pd->style);
eina_hash_foreach(pd->connects, _model_connect, layout);
eina_hash_foreach(pd->factory_connects, _factory_model_connect, layout);
eina_hash_foreach(pd->bind.properties, _property_bind, layout);
eina_hash_foreach(pd->bind.factories, _factory_bind, layout);
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, 0);
evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
@ -95,52 +97,52 @@ _efl_ui_layout_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Layout_Factory_Data
return efl_future_then(obj, f,
.success_type = EINA_VALUE_TYPE_OBJECT,
.success = _efl_ui_layout_factory_connect,
.success = _efl_ui_layout_factory_bind,
.data = pd);
}
EOLIAN static void
_efl_ui_layout_factory_efl_ui_factory_model_connect(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Factory_Data *pd
, const char *name, Efl_Ui_Factory *factory)
_efl_ui_layout_factory_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Factory_Data *pd,
const char *key, Efl_Ui_Factory *factory)
{
Eina_Stringshare *ss_name;
Eina_Stringshare *ss_key;
Efl_Ui_Factory *f_old;
ss_name = eina_stringshare_add(name);
ss_key = eina_stringshare_add(key);
if (factory == NULL)
{
eina_hash_del(pd->factory_connects, ss_name, NULL);
eina_hash_del(pd->bind.factories, ss_key, NULL);
return;
}
f_old = eina_hash_set(pd->factory_connects, ss_name, efl_ref(factory));
f_old = eina_hash_set(pd->bind.factories, ss_key, efl_ref(factory));
if (f_old)
{
efl_unref(f_old);
eina_stringshare_del(ss_name);
eina_stringshare_del(ss_key);
}
}
EOLIAN static void
_efl_ui_layout_factory_efl_ui_model_connect_connect(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Factory_Data *pd
, const char *name, const char *property)
_efl_ui_layout_factory_efl_ui_property_bind_property_bind(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Factory_Data *pd,
const char *key, const char *property)
{
Eina_Stringshare *ss_name, *ss_prop, *ss_old;
ss_name = eina_stringshare_add(name);
Eina_Stringshare *ss_key, *ss_prop, *ss_old;
ss_key = eina_stringshare_add(key);
if (property == NULL)
{
eina_hash_del(pd->connects, ss_name, NULL);
eina_stringshare_del(ss_name);
eina_hash_del(pd->bind.properties, ss_key, NULL);
eina_stringshare_del(ss_key);
return;
}
ss_prop = eina_stringshare_add(property);
ss_old = eina_hash_set(pd->connects, ss_name, ss_prop);
ss_old = eina_hash_set(pd->bind.properties, ss_key, ss_prop);
if (ss_old)
{
eina_stringshare_del(ss_old);
eina_stringshare_del(ss_name);
eina_stringshare_del(ss_key);
}
}

View File

@ -16,7 +16,7 @@ class Efl.Ui.Layout_Factory extends Efl.Ui.Caching_Factory
Efl.Object.constructor;
Efl.Object.destructor;
Efl.Ui.Factory.create;
Efl.Ui.Factory.model_connect;
Efl.Ui.Model.Connect.connect;
Efl.Ui.Property_Bind.property_bind;
Efl.Ui.Factory_Bind.factory_bind;
}
}

View File

@ -116,16 +116,16 @@ _efl_ui_widget_factory_efl_ui_factory_release(Eo *obj EINA_UNUSED,
}
static void
_efl_ui_widget_factory_efl_ui_model_connect_connect(Eo *obj, Efl_Ui_Widget_Factory_Data *pd,
const char *name, const char *property)
_efl_ui_widget_factory_efl_ui_property_bind_property_bind(Eo *obj, Efl_Ui_Widget_Factory_Data *pd,
const char *target, const char *property)
{
if (!strcmp(name, "style"))
if (!strcmp(target, "style"))
{
eina_stringshare_replace(&pd->style, property);
return ;
}
efl_ui_model_connect(efl_super(obj, EFL_UI_WIDGET_FACTORY_CLASS), name, property);
efl_ui_property_bind(efl_super(obj, EFL_UI_WIDGET_FACTORY_CLASS), target, property);
}
#include "efl_ui_widget_factory.eo.c"

View File

@ -3,7 +3,7 @@ class Efl.Ui.Widget_Factory extends Efl.Loop_Consumer implements Efl.Ui.Factory
[[Efl Ui Factory that provides @Efl.Ui.Widget.
This factory is designed to build @Efl.Ui.Widget and optionally set their
@Efl.Ui.Widget.style if it was connected with @Efl.Ui.Model.Connect.connect "$style".
@Efl.Ui.Widget.style if it was connected with @Efl.Ui.Property_Bind.property_bind "$style".
]]
methods {
@ -20,7 +20,7 @@ class Efl.Ui.Widget_Factory extends Efl.Loop_Consumer implements Efl.Ui.Factory
implements {
Efl.Ui.Factory.create;
Efl.Ui.Factory.release;
Efl.Ui.Model.Connect.connect;
Efl.Ui.Property_Bind.property_bind;
}
constructors {
.item_class @optional;

View File

@ -78,7 +78,7 @@ _FILE_CHOSEN_fwd(void *data, const Efl_Event *event)
ELM_FILESELECTOR_ENTRY_DATA_GET(fs, sd);
efl_ui_view_model_set(sd->entry, model);
efl_ui_model_connect(sd->entry, "default", "path");
efl_ui_property_bind(sd->entry, "default", "path");
path = efl_model_property_get(model, "path");
file = eina_value_to_string(path);
@ -422,7 +422,7 @@ _elm_fileselector_entry_efl_ui_view_model_set(Eo *obj EINA_UNUSED, Elm_Fileselec
{
efl_ui_view_model_set(sd->button, model);
efl_ui_view_model_set(sd->entry, model);
efl_ui_model_connect(sd->entry, "default", "path");
efl_ui_property_bind(sd->entry, "default", "path");
}
EINA_DEPRECATED EAPI const char *

View File

@ -47,11 +47,11 @@ _link_dying(void* data, Efl_Event const* event)
static Eina_Bool
_elm_view_widget_add(Elm_View_Form_Data *priv, const char *property, Evas_Object *link)
{
if (!efl_isa(link, EFL_UI_MODEL_CONNECT_INTERFACE)) return EINA_FALSE;
if (!efl_isa(link, EFL_UI_PROPERTY_BIND_INTERFACE)) return EINA_FALSE;
if (!property) property = "default";
efl_ui_view_model_set(link, priv->model);
efl_ui_model_connect(link, "default", property);
efl_ui_property_bind(link, "default", property);
efl_event_callback_add(link, EFL_EVENT_DEL, _link_dying, priv);
priv->links = eina_list_append(priv->links, link);

View File

@ -18,7 +18,7 @@ _propagated_cb(void *data EINA_UNUSED,
return v;
}
EFL_START_TEST(efl_ui_layout_test_model_connect)
EFL_START_TEST(efl_ui_layout_test_property_bind)
{
char buf[PATH_MAX];
Evas_Object *win, *ly;
@ -26,7 +26,7 @@ EFL_START_TEST(efl_ui_layout_test_model_connect)
Eina_Value v;
Eina_Future *f;
const char *part_text;
const char text_value[] = "A random string for elm_layout_model_connect test";
const char text_value[] = "A random string for elm_layout_property_bind test";
win = win_add(NULL, "layout", EFL_UI_WIN_BASIC);
@ -41,7 +41,7 @@ EFL_START_TEST(efl_ui_layout_test_model_connect)
f = efl_model_property_set(model, "text_property", &v);
eina_future_then(f, _propagated_cb, NULL, NULL);
efl_ui_model_connect(ly, "text", "text_property");
efl_ui_property_bind(ly, "text", "text_property");
efl_ui_view_model_set(ly, model);
ecore_main_loop_begin();
@ -92,7 +92,7 @@ EFL_END_TEST
void efl_ui_test_layout(TCase *tc)
{
tcase_add_test(tc, efl_ui_layout_test_model_connect);
tcase_add_test(tc, efl_ui_layout_test_property_bind);
tcase_add_test(tc, efl_ui_layout_test_layout_api_size_min);
tcase_add_test(tc, efl_ui_layout_test_layout_api_update_hints);
tcase_add_test(tc, efl_ui_layout_test_layout_force);