efl: Property_Bind should actually tell us if it succeeded or failed by returning an Eina.Error.
Reviewed-by: Marcel Hollerbach <marcel-hollerbach@t-online.de> Reviewed-by: Xavi Artigas <xavierartigas@yahoo.es> Differential Revision: https://phab.enlightenment.org/D7939
This commit is contained in:
parent
3cf418ab82
commit
d0b70ef4e7
|
@ -12,6 +12,8 @@ EAPI extern Eina_Error EFL_MODEL_ERROR_INCORRECT_VALUE;
|
|||
EAPI extern Eina_Error EFL_MODEL_ERROR_PERMISSION_DENIED;
|
||||
EAPI extern Eina_Error EFL_MODEL_ERROR_INVALID_OBJECT; /**< @since 1.19 */
|
||||
|
||||
EAPI extern Eina_Error EFL_PROPERTY_ERROR_INVALID_KEY; /**< Returned when the given key during a efl_ui_property_bind does not exist on the object. */
|
||||
|
||||
EAPI extern Eina_Error EFL_FACTORY_ERROR_NOT_SUPPORTED; /**< Returned error when factory got a request that it can't fullfil due to a set of unsupported parameters @since 1.22 */
|
||||
|
||||
#include "interfaces/efl_model.eo.h"
|
||||
|
|
|
@ -15,6 +15,7 @@ EAPI Eina_Error EFL_MODEL_ERROR_INCORRECT_VALUE = 0;
|
|||
EAPI Eina_Error EFL_MODEL_ERROR_INVALID_OBJECT = 0;
|
||||
|
||||
EAPI Eina_Error EFL_FACTORY_ERROR_NOT_SUPPORTED = 0;
|
||||
EAPI Eina_Error EFL_PROPERTY_ERROR_INVALID_KEY = 0;
|
||||
|
||||
static const char EFL_MODEL_ERROR_UNKNOWN_STR[] = "Unknown Error";
|
||||
static const char EFL_MODEL_ERROR_NOT_SUPPORTED_STR[] = "Operation not supported";
|
||||
|
@ -27,6 +28,9 @@ static const char EFL_MODEL_ERROR_INVALID_OBJECT_STR[] = "Object is invalid";
|
|||
|
||||
static const char EFL_FACTORY_ERROR_NOT_SUPPORTED_STR[] = "Operation not supported";
|
||||
|
||||
static const char EFL_PROPERTY_ERROR_INVALID_KEY_STR[] = "Incorrect key provided";
|
||||
|
||||
|
||||
EAPI int
|
||||
efl_model_init(void)
|
||||
{
|
||||
|
@ -44,6 +48,10 @@ efl_model_init(void)
|
|||
#define _ERROR(Name) EFL_FACTORY_ERROR_##Name = eina_error_msg_static_register(EFL_FACTORY_ERROR_##Name##_STR);
|
||||
_ERROR(NOT_SUPPORTED);
|
||||
|
||||
#undef _ERROR
|
||||
#define _ERROR(Name) EFL_PROPERTY_ERROR_##Name = eina_error_msg_static_register(EFL_PROPERTY_ERROR_##Name##_STR);
|
||||
_ERROR(INVALID_KEY);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import eina_types;
|
||||
|
||||
interface @beta Efl.Ui.Property_Bind
|
||||
{
|
||||
[[Efl UI Property_Bind interface.
|
||||
|
@ -13,6 +15,7 @@ interface @beta Efl.Ui.Property_Bind
|
|||
key: string; [[key string for bind model property data]]
|
||||
property: string; [[Model property name]]
|
||||
}
|
||||
return: Eina.Error; [[0 when it succeed, an error code otherwise.]]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -324,13 +324,14 @@ _efl_ui_caching_factory_efl_object_parent_set(Eo *obj, Efl_Ui_Caching_Factory_Da
|
|||
if (a) efl_event_callback_add(a, EFL_APP_EVENT_PAUSE, _efl_ui_caching_factory_pause, pd);
|
||||
}
|
||||
|
||||
static void
|
||||
static Eina_Error
|
||||
_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(key, "style"))
|
||||
eina_stringshare_replace(&pd->style, property);
|
||||
efl_ui_property_bind(efl_super(obj, EFL_UI_CACHING_FACTORY_CLASS), key, property);
|
||||
|
||||
return efl_ui_property_bind(efl_super(obj, EFL_UI_CACHING_FACTORY_CLASS), key, property);
|
||||
}
|
||||
|
||||
#include "efl_ui_caching_factory.eo.c"
|
||||
|
|
|
@ -1949,7 +1949,7 @@ _efl_ui_image_efl_ui_view_model_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Data
|
|||
return pd->property.model;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
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)
|
||||
{
|
||||
if (strcmp(key, "filename") == 0)
|
||||
|
@ -1967,9 +1967,10 @@ _efl_ui_image_efl_ui_property_bind_property_bind(Eo *obj, Efl_Ui_Image_Data *pd,
|
|||
{
|
||||
eina_stringshare_replace(&pd->property.key, property);
|
||||
}
|
||||
else return;
|
||||
else return EINA_FALSE;
|
||||
|
||||
_update_viewmodel(obj, pd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
|
|
@ -62,10 +62,11 @@ _efl_ui_image_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Image_Factory_Data *
|
|||
.data = pd);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
EOLIAN static Eina_Error
|
||||
_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);
|
||||
eina_stringshare_replace(&pd->property, property);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include "efl_ui_image_factory.eo.c"
|
||||
|
|
|
@ -2267,16 +2267,16 @@ _efl_ui_layout_base_efl_ui_view_model_get(const Eo *obj EINA_UNUSED, Efl_Ui_Layo
|
|||
return pd->connect.model;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
EOLIAN static Eina_Error
|
||||
_efl_ui_layout_base_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(key);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(key, EFL_PROPERTY_ERROR_INVALID_KEY);
|
||||
Eina_Stringshare *sprop;
|
||||
Eina_Hash *hash = NULL;
|
||||
char *data = NULL;
|
||||
|
||||
if (!_elm_layout_part_aliasing_eval(obj, &key, EINA_TRUE))
|
||||
return;
|
||||
return EFL_PROPERTY_ERROR_INVALID_KEY;
|
||||
|
||||
_efl_ui_layout_connect_hash(pd);
|
||||
|
||||
|
@ -2314,6 +2314,8 @@ _efl_ui_layout_base_efl_ui_property_bind_property_bind(Eo *obj EINA_UNUSED, Efl_
|
|||
|
||||
if (!sprop)
|
||||
free(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
|
|
|
@ -123,7 +123,7 @@ _efl_ui_layout_factory_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, Efl
|
|||
}
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
EOLIAN static Eina_Error
|
||||
_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)
|
||||
{
|
||||
|
@ -134,7 +134,7 @@ _efl_ui_layout_factory_efl_ui_property_bind_property_bind(Eo *obj EINA_UNUSED, E
|
|||
{
|
||||
eina_hash_del(pd->bind.properties, ss_key, NULL);
|
||||
eina_stringshare_del(ss_key);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ss_prop = eina_stringshare_add(property);
|
||||
|
@ -145,6 +145,7 @@ _efl_ui_layout_factory_efl_ui_property_bind_property_bind(Eo *obj EINA_UNUSED, E
|
|||
eina_stringshare_del(ss_key);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
|
|
|
@ -115,17 +115,17 @@ _efl_ui_widget_factory_efl_ui_factory_release(Eo *obj EINA_UNUSED,
|
|||
efl_del(ui_view);
|
||||
}
|
||||
|
||||
static void
|
||||
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"))
|
||||
{
|
||||
eina_stringshare_replace(&pd->style, property);
|
||||
return ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
efl_ui_property_bind(efl_super(obj, EFL_UI_WIDGET_FACTORY_CLASS), target, property);
|
||||
return efl_ui_property_bind(efl_super(obj, EFL_UI_WIDGET_FACTORY_CLASS), target, property);
|
||||
}
|
||||
|
||||
#include "efl_ui_widget_factory.eo.c"
|
||||
|
|
Loading…
Reference in New Issue