elementary: return an error when unimplemented function on Efl.Ui.Widget_Factory.

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D10130
This commit is contained in:
Cedric Bail 2019-09-25 16:52:18 +00:00
parent 78ee2ca6b0
commit 267f8fcfa8
6 changed files with 24 additions and 9 deletions

View File

@ -112,8 +112,7 @@ public class BindableFactoryPart<T>
/// <summary>Binds the given factory to this part.</summary> /// <summary>Binds the given factory to this part.</summary>
public Eina.Error BindFactory(Efl.Ui.IFactory factory) public Eina.Error BindFactory(Efl.Ui.IFactory factory)
{ {
this.Binder.BindFactory(this.PartName, factory); return this.Binder.BindFactory(this.PartName, factory);
return Eina.Error.NO_ERROR;
} }
} }

View File

@ -14,6 +14,7 @@ interface @beta Efl.Ui.Factory_Bind
key: string; [[Key string for bind model property data]] key: string; [[Key string for bind model property data]]
factory: Efl.Ui.Factory; [[@Efl.Ui.Factory for create and bind model property data]] factory: Efl.Ui.Factory; [[@Efl.Ui.Factory for create and bind model property data]]
} }
return: Eina.Error; [[0 when it succeed, an error code otherwise.]]
} }
} }
} }

View File

@ -2527,16 +2527,16 @@ _efl_ui_layout_base_efl_ui_property_bind_property_bind(Eo *obj, Efl_Ui_Layout_Da
return 0; return 0;
} }
EOLIAN static void EOLIAN static Eina_Error
_efl_ui_layout_base_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *pd, _efl_ui_layout_base_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *pd,
const char *key, Efl_Ui_Factory *factory) const char *key, Efl_Ui_Factory *factory)
{ {
EINA_SAFETY_ON_NULL_RETURN(key); EINA_SAFETY_ON_NULL_RETURN_VAL(key, EFL_PROPERTY_ERROR_INVALID_KEY);
Efl_Ui_Layout_Factory_Tracking *tracking; Efl_Ui_Layout_Factory_Tracking *tracking;
Eina_Stringshare *ss_key; Eina_Stringshare *ss_key;
if (!_elm_layout_part_aliasing_eval(obj, &key, EINA_TRUE)) if (!_elm_layout_part_aliasing_eval(obj, &key, EINA_TRUE))
return; return EFL_PROPERTY_ERROR_INVALID_KEY;
// Check if there is a model and register it // Check if there is a model and register it
_efl_ui_layout_base_model_watch(obj, pd); _efl_ui_layout_base_model_watch(obj, pd);
@ -2566,7 +2566,7 @@ _efl_ui_layout_base_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, Efl_Ui
else else
{ {
tracking = calloc(1, sizeof (Efl_Ui_Layout_Factory_Tracking)); tracking = calloc(1, sizeof (Efl_Ui_Layout_Factory_Tracking));
if (!tracking) return ; if (!tracking) return ENOMEM;
tracking->key = ss_key; tracking->key = ss_key;
@ -2577,6 +2577,8 @@ _efl_ui_layout_base_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, Efl_Ui
tracking->factory = efl_ref(factory); tracking->factory = efl_ref(factory);
_efl_ui_layout_view_model_content_update(pd, tracking, ss_key); _efl_ui_layout_view_model_content_update(pd, tracking, ss_key);
return EINA_ERROR_NO_ERROR;
} }
EOLIAN void EOLIAN void

View File

@ -88,7 +88,7 @@ _efl_ui_layout_factory_efl_object_destructor(Eo *obj, Efl_Ui_Layout_Factory_Data
efl_destructor(efl_super(obj, MY_CLASS)); efl_destructor(efl_super(obj, MY_CLASS));
} }
EOLIAN static void EOLIAN static Eina_Error
_efl_ui_layout_factory_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Factory_Data *pd, _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) const char *key, Efl_Ui_Factory *factory)
{ {
@ -99,7 +99,7 @@ _efl_ui_layout_factory_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, Efl
if (factory == NULL) if (factory == NULL)
{ {
eina_hash_del(pd->bind.factories, ss_key, NULL); eina_hash_del(pd->bind.factories, ss_key, NULL);
return; return EINA_ERROR_NO_ERROR;
} }
f_old = eina_hash_set(pd->bind.factories, ss_key, efl_ref(factory)); f_old = eina_hash_set(pd->bind.factories, ss_key, efl_ref(factory));
@ -108,6 +108,8 @@ _efl_ui_layout_factory_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, Efl
efl_unref(f_old); efl_unref(f_old);
eina_stringshare_del(ss_key); eina_stringshare_del(ss_key);
} }
return EINA_ERROR_NO_ERROR;
} }
EOLIAN static Eina_Error EOLIAN static Eina_Error

View File

@ -413,7 +413,7 @@ _efl_ui_property_bind_part_efl_ui_property_bind_property_bind(Eo *obj EINA_UNUSE
if (!key) if (!key)
{ {
eina_stringshare_replace(&pd->pd->default_property, property); eina_stringshare_replace(&pd->pd->default_property, property);
return; return 0;
} }
if (!pd->pd->parts) if (!pd->pd->parts)
@ -443,5 +443,15 @@ _efl_ui_property_bind_part_efl_ui_property_bind_property_bind(Eo *obj EINA_UNUSE
return 0; return 0;
} }
static Eina_Error
_efl_ui_widget_factory_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED,
Efl_Ui_Widget_Factory_Data *pd EINA_UNUSED,
const char *key EINA_UNUSED,
Efl_Ui_Factory *factory EINA_UNUSED)
{
ERR("Efl.Ui.Widget_Factory doesn't support efl.ui.factory_bind.\n");
return EINA_ERROR_NOT_IMPLEMENTED;
}
#include "efl_ui_property_bind_part.eo.c" #include "efl_ui_property_bind_part.eo.c"
#include "efl_ui_widget_factory.eo.c" #include "efl_ui_widget_factory.eo.c"

View File

@ -21,6 +21,7 @@ class @beta Efl.Ui.Widget_Factory extends Efl.Loop_Consumer implements Efl.Ui.Fa
Efl.Ui.Factory.create; Efl.Ui.Factory.create;
Efl.Ui.Factory.release; Efl.Ui.Factory.release;
Efl.Ui.Property_Bind.property_bind; Efl.Ui.Property_Bind.property_bind;
Efl.Ui.Factory_Bind.factory_bind;
Efl.Part.part_get; Efl.Part.part_get;
Efl.Object.finalize; Efl.Object.finalize;
} }