elementary: return an error when unimplemented function on Efl.Ui.Widget_Factory.
authorCedric Bail <cedric.bail@free.fr>
Wed, 25 Sep 2019 16:52:18 +0000 (16:52 +0000)
committerJongmin Lee <jm105.lee@samsung.com>
Wed, 25 Sep 2019 21:12:44 +0000 (06:12 +0900)
Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D10130

src/bindings/mono/efl_mono/Bind.cs
src/lib/efl/interfaces/efl_ui_factory_bind.eo
src/lib/elementary/efl_ui_layout.c
src/lib/elementary/efl_ui_layout_factory.c
src/lib/elementary/efl_ui_widget_factory.c
src/lib/elementary/efl_ui_widget_factory.eo

index 14c45d9..c31186c 100644 (file)
@@ -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);
     }
 }
 
index d268324..740c627 100644 (file)
@@ -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.]]
       }
    }
 }
index 49d0c44..53a6aaa 100644 (file)
@@ -2730,16 +2730,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);
@@ -2769,7 +2769,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;
 
@@ -2780,6 +2780,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
index cfc2749..b6032e7 100644 (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));
 }
 
-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
index 54b1b8d..13160af 100644 (file)
@@ -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"
index 82ce729..7cdfab2 100644 (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.release;
       Efl.Ui.Property_Bind.property_bind;
+      Efl.Ui.Factory_Bind.factory_bind;
       Efl.Part.part_get;
       Efl.Object.finalize;
    }