cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=267f8fcfa82af22c20c79687eb1aed5d5c513ab8

commit 267f8fcfa82af22c20c79687eb1aed5d5c513ab8
Author: Cedric Bail <[email protected]>
Date:   Wed Sep 25 16:52:18 2019 +0000

    elementary: return an error when unimplemented function on 
Efl.Ui.Widget_Factory.
    
    Reviewed-by: Cedric BAIL <[email protected]>
    Differential Revision: https://phab.enlightenment.org/D10130
---
 src/bindings/mono/efl_mono/Bind.cs            |  3 +--
 src/lib/efl/interfaces/efl_ui_factory_bind.eo |  1 +
 src/lib/elementary/efl_ui_layout.c            | 10 ++++++----
 src/lib/elementary/efl_ui_layout_factory.c    |  6 ++++--
 src/lib/elementary/efl_ui_widget_factory.c    | 12 +++++++++++-
 src/lib/elementary/efl_ui_widget_factory.eo   |  1 +
 6 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/src/bindings/mono/efl_mono/Bind.cs 
b/src/bindings/mono/efl_mono/Bind.cs
index 14c45d9dd0..c31186cbb7 100644
--- a/src/bindings/mono/efl_mono/Bind.cs
+++ b/src/bindings/mono/efl_mono/Bind.cs
@@ -112,8 +112,7 @@ public class BindableFactoryPart<T>
     /// <summary>Binds the given factory to this part.</summary>
     public Eina.Error BindFactory(Efl.Ui.IFactory factory)
     {
-        this.Binder.BindFactory(this.PartName, factory);
-        return Eina.Error.NO_ERROR;
+        return this.Binder.BindFactory(this.PartName, factory);
     }
 }
 
diff --git a/src/lib/efl/interfaces/efl_ui_factory_bind.eo 
b/src/lib/efl/interfaces/efl_ui_factory_bind.eo
index d26832453f..740c627b82 100644
--- a/src/lib/efl/interfaces/efl_ui_factory_bind.eo
+++ b/src/lib/efl/interfaces/efl_ui_factory_bind.eo
@@ -14,6 +14,7 @@ interface @beta Efl.Ui.Factory_Bind
             key: string; [[Key string for 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.]]
       }
    }
 }
diff --git a/src/lib/elementary/efl_ui_layout.c 
b/src/lib/elementary/efl_ui_layout.c
index c4310f01c1..1797d8a45f 100644
--- a/src/lib/elementary/efl_ui_layout.c
+++ b/src/lib/elementary/efl_ui_layout.c
@@ -2527,16 +2527,16 @@ 
_efl_ui_layout_base_efl_ui_property_bind_property_bind(Eo *obj, Efl_Ui_Layout_Da
    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,
                                                 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;
    Eina_Stringshare *ss_key;
 
    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
    _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
      {
         tracking = calloc(1, sizeof (Efl_Ui_Layout_Factory_Tracking));
-        if (!tracking) return ;
+        if (!tracking) return ENOMEM;
 
         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);
 
    _efl_ui_layout_view_model_content_update(pd, tracking, ss_key);
+
+   return EINA_ERROR_NO_ERROR;
 }
 
 EOLIAN void
diff --git a/src/lib/elementary/efl_ui_layout_factory.c 
b/src/lib/elementary/efl_ui_layout_factory.c
index cfc2749dd3..b6032e70e9 100644
--- a/src/lib/elementary/efl_ui_layout_factory.c
+++ b/src/lib/elementary/efl_ui_layout_factory.c
@@ -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));
 }
 
-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,
                                                         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)
      {
         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));
@@ -108,6 +108,8 @@ _efl_ui_layout_factory_efl_ui_factory_bind_factory_bind(Eo 
*obj EINA_UNUSED, Efl
         efl_unref(f_old);
         eina_stringshare_del(ss_key);
      }
+
+   return EINA_ERROR_NO_ERROR;
 }
 
 EOLIAN static Eina_Error
diff --git a/src/lib/elementary/efl_ui_widget_factory.c 
b/src/lib/elementary/efl_ui_widget_factory.c
index 54b1b8dc09..13160af8e1 100644
--- a/src/lib/elementary/efl_ui_widget_factory.c
+++ b/src/lib/elementary/efl_ui_widget_factory.c
@@ -413,7 +413,7 @@ 
_efl_ui_property_bind_part_efl_ui_property_bind_property_bind(Eo *obj EINA_UNUSE
    if (!key)
      {
         eina_stringshare_replace(&pd->pd->default_property, property);
-        return;
+        return 0;
      }
 
    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;
 }
 
+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_widget_factory.eo.c"
diff --git a/src/lib/elementary/efl_ui_widget_factory.eo 
b/src/lib/elementary/efl_ui_widget_factory.eo
index 82ce7292bd..7cdfab2887 100644
--- a/src/lib/elementary/efl_ui_widget_factory.eo
+++ b/src/lib/elementary/efl_ui_widget_factory.eo
@@ -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.release;
       Efl.Ui.Property_Bind.property_bind;
+      Efl.Ui.Factory_Bind.factory_bind;
       Efl.Part.part_get;
       Efl.Object.finalize;
    }

-- 


Reply via email to