efl: add an event for the View to know if someone did bound a property.

Reviewed-by: Vitor Sousa da Silva <vitorsousa@expertisesolutions.com.br>
Differential Revision: https://phab.enlightenment.org/D7945
This commit is contained in:
Cedric BAIL 2019-02-12 16:47:31 -08:00
parent 4e1c26d047
commit 98e5a71974
7 changed files with 26 additions and 8 deletions

View File

@ -1953,6 +1953,8 @@ _efl_ui_image_efl_ui_view_model_set(Eo *obj, Efl_Ui_Image_Data *pd, Efl_Model *m
EOLIAN static Eina_Error
_efl_ui_image_efl_ui_property_bind_property_bind(Eo *obj, Efl_Ui_Image_Data *pd, const char *key, const char *property)
{
Eina_Stringshare *sk;
if (strcmp(key, "filename") == 0)
{
pd->property.icon = EINA_FALSE;
@ -1974,6 +1976,11 @@ _efl_ui_image_efl_ui_property_bind_property_bind(Eo *obj, Efl_Ui_Image_Data *pd,
}
_update_viewmodel(obj, pd);
sk = eina_stringshare_add(key);
efl_event_callback_call(obj, EFL_UI_PROPERTY_BIND_EVENT_PROPERTY_BOUND, (void*) sk);
eina_stringshare_del(sk);
return 0;
}

View File

@ -2275,6 +2275,7 @@ _efl_ui_layout_base_efl_ui_property_bind_property_bind(Eo *obj, Efl_Ui_Layout_Da
{
EINA_SAFETY_ON_NULL_RETURN_VAL(key, EFL_PROPERTY_ERROR_INVALID_KEY);
Eina_Stringshare *sprop;
Eina_Stringshare *sk;
Eina_Hash *hash = NULL;
char *data = NULL;
Efl_Model *model;
@ -2323,6 +2324,10 @@ _efl_ui_layout_base_efl_ui_property_bind_property_bind(Eo *obj, Efl_Ui_Layout_Da
_efl_ui_layout_view_model_property_update(pd, data, sprop);
}
sk = eina_stringshare_add(key);
efl_event_callback_call(obj, EFL_UI_PROPERTY_BIND_EVENT_PROPERTY_BOUND, (void*) sk);
eina_stringshare_del(sk);
if (!sprop)
free(data);

View File

@ -133,18 +133,16 @@ _efl_ui_layout_factory_efl_ui_property_bind_property_bind(Eo *obj EINA_UNUSED, E
if (property == NULL)
{
eina_hash_del(pd->bind.properties, ss_key, NULL);
eina_stringshare_del(ss_key);
return 0;
goto end;
}
ss_prop = eina_stringshare_add(property);
ss_old = eina_hash_set(pd->bind.properties, ss_key, ss_prop);
if (ss_old)
{
eina_stringshare_del(ss_old);
eina_stringshare_del(ss_key);
}
if (ss_old) eina_stringshare_del(ss_old);
end:
efl_event_callback_call(obj, EFL_UI_PROPERTY_BIND_EVENT_PROPERTY_BOUND, (void*) ss_key);
eina_stringshare_del(ss_key);
return 0;
}

View File

@ -6069,6 +6069,7 @@ _efl_ui_widget_efl_ui_property_bind_property_bind(Eo *obj, Efl_Ui_Widget_Data *p
_efl_ui_property_bind_get(pd, prop);
efl_event_callback_call(obj, EFL_UI_PROPERTY_BIND_EVENT_PROPERTY_BOUND, (void*) prop->key);
return 0;
}

View File

@ -115,13 +115,16 @@ _efl_ui_widget_factory_efl_ui_factory_release(Eo *obj EINA_UNUSED,
efl_del(ui_view);
}
Eina_Stringshare *_property_style_ss = NULL;
static Eina_Error
_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(target, "style"))
if (_property_style_ss == target || !strcmp(target, _property_style_ss))
{
eina_stringshare_replace(&pd->style, property);
efl_event_callback_call(obj, EFL_UI_PROPERTY_BIND_EVENT_PROPERTY_BOUND, (void*) _property_style_ss);
return 0;
}

View File

@ -809,6 +809,7 @@ elm_quicklaunch_init(int argc EINA_UNUSED,
}
if (!_elm_data_dir) _elm_data_dir = eina_stringshare_add("/");
if (!_elm_lib_dir) _elm_lib_dir = eina_stringshare_add("/");
if (!_property_style_ss) _property_style_ss = eina_stringshare_add("style");
eina_log_timing(_elm_log_dom, EINA_LOG_STATE_STOP, EINA_LOG_STATE_INIT);
@ -925,6 +926,7 @@ elm_quicklaunch_shutdown(void)
pfx = NULL;
ELM_SAFE_FREE(_elm_data_dir, eina_stringshare_del);
ELM_SAFE_FREE(_elm_lib_dir, eina_stringshare_del);
ELM_SAFE_FREE(_property_style_ss, eina_stringshare_del);
ELM_SAFE_FREE(_elm_appname, free);
ELM_SAFE_FREE(_elm_exit_handler, ecore_event_handler_del);

View File

@ -899,6 +899,8 @@ extern const char SIG_WIDGET_ACCESS_CHANGED[];
extern const char SIG_LAYOUT_FOCUSED[];
extern const char SIG_LAYOUT_UNFOCUSED[];
extern Eina_Stringshare *_property_style_ss;
extern Eina_Bool _config_profile_lock;
# ifdef HAVE_ELEMENTARY_WL2