discomfitor pushed a commit to branch master.

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

commit a03bcd34afa2f7e90a89e1fdf4e55b835898afdd
Author: Mike Blumenkrantz <zm...@osg.samsung.com>
Date:   Mon Feb 12 15:04:15 2018 -0500

    efl_vg: use efl.object's name property instead of implementing a new one
---
 src/lib/evas/canvas/efl_vg.eo         | 23 +----------------------
 src/lib/evas/canvas/evas_vg_node.c    | 34 ++++++++++++++--------------------
 src/lib/evas/canvas/evas_vg_private.h |  2 --
 src/static_libs/vg_common/vg_common.c |  4 ++--
 4 files changed, 17 insertions(+), 46 deletions(-)

diff --git a/src/lib/evas/canvas/efl_vg.eo b/src/lib/evas/canvas/efl_vg.eo
index 5d41ac229c..030cdac48a 100644
--- a/src/lib/evas/canvas/efl_vg.eo
+++ b/src/lib/evas/canvas/efl_vg.eo
@@ -6,28 +6,6 @@ abstract Efl.VG (Efl.Object, Efl.Gfx, Efl.Gfx.Color, 
Efl.Gfx.Stack, Efl.Duplicat
    eo_prefix: efl_vg;
    legacy_prefix: evas_vg_node;
    methods {
-      @property name {
-         set {
-            [[Set an unique name from the parent's point of view. $null means
-              no name.
-
-              @since 1.16
-            ]]
-         }
-         get {
-            [[Get an unique name from the parent's point of view.
-
-              $null means no name. When setting a parent after a name has
-              already been defined, it might be forced back to $null if the 
parent
-              already has a node of that name.
-
-              @since 1.16
-            ]]
-         }
-         values {
-            name: string; [[Node name]]
-         }
-      }
       @property transformation {
          set {
             [[Sets the transformation matrix to be used for this node object.
@@ -105,6 +83,7 @@ abstract Efl.VG (Efl.Object, Efl.Gfx, Efl.Gfx.Color, 
Efl.Gfx.Stack, Efl.Duplicat
       }
    }
    implements {
+      Efl.Object.name { set; }
       Efl.Object.parent { set; }
       Efl.Object.constructor;
       Efl.Object.destructor;
diff --git a/src/lib/evas/canvas/evas_vg_node.c 
b/src/lib/evas/canvas/evas_vg_node.c
index e5883e465a..8cd5add2b3 100644
--- a/src/lib/evas/canvas/evas_vg_node.c
+++ b/src/lib/evas/canvas/evas_vg_node.c
@@ -283,46 +283,41 @@ _efl_vg_efl_object_destructor(Eo *obj, Efl_VG_Data *pd)
 }
 
 static void
-_efl_vg_name_insert(Eo *obj, Efl_VG_Data *pd, Efl_VG_Container_Data *cd)
+_efl_vg_name_insert(Eo *obj, Efl_VG_Container_Data *cd)
 {
    Eo *set;
+   const char *name = efl_name_get(efl_super(obj, MY_CLASS));
 
-   if (!pd->name) return ;
+   if (!name) return ;
 
-   set = eina_hash_find(cd->names, pd->name);
+   set = eina_hash_find(cd->names, name);
    if (set == obj) return ;
 
    if (set)
      {
-        eina_stringshare_del(pd->name);
-        pd->name = NULL;
+        efl_name_set(efl_super(obj, MY_CLASS), NULL);
      }
    else
      {
-        eina_hash_direct_add(cd->names, pd->name, obj);
+        eina_hash_direct_add(cd->names, name, obj);
      }
 }
 
 static void
-_efl_vg_name_set(Eo *obj, Efl_VG_Data *pd, const char *name)
+_efl_vg_efl_object_name_set(Eo *obj, Efl_VG_Data *pd EINA_UNUSED, const char 
*name)
 {
    Efl_VG_Container_Data *cd = NULL;
    Eo *parent = NULL;
+   const char *pname = efl_name_get(obj);
 
    if (_efl_vg_parent_checked_get(obj, &parent, &cd))
      {
-        if (pd->name) eina_hash_del(cd->names, pd->name, obj);
+        if (pname) eina_hash_del(cd->names, pname, obj);
      }
 
-   eina_stringshare_replace(&pd->name, name);
+   efl_name_set(efl_super(obj, MY_CLASS), name);
 
-   if (cd) _efl_vg_name_insert(obj, pd, cd);
-}
-
-static const char *
-_efl_vg_name_get(Eo *obj EINA_UNUSED, Efl_VG_Data *pd)
-{
-   return pd->name;
+   if (cd) _efl_vg_name_insert(obj, cd);
 }
 
 static void
@@ -360,7 +355,7 @@ _efl_vg_efl_object_parent_set(Eo *obj,
      {
         old_cd->children = eina_list_remove(old_cd->children, obj);
 
-        if (pd->name) eina_hash_del(old_cd->names, pd->name, obj);
+        eina_hash_del(old_cd->names, efl_name_get(efl_super(obj, MY_CLASS)), 
obj);
      }
 
    efl_parent_set(efl_super(obj, MY_CLASS), parent);
@@ -368,7 +363,7 @@ _efl_vg_efl_object_parent_set(Eo *obj,
      {
         cd->children = eina_list_append(cd->children, obj);
 
-        _efl_vg_name_insert(obj, pd, cd);
+        _efl_vg_name_insert(obj, cd);
      }
 
    _efl_vg_changed(old_parent);
@@ -724,8 +719,7 @@ _efl_vg_efl_duplicate_duplicate(const Eo *obj, Efl_VG_Data 
*pd)
    cn = efl_add(efl_class_get(obj), NULL);
    cd = efl_data_scope_get(cn, MY_CLASS);
    EINA_SAFETY_ON_NULL_RETURN_VAL(cd, NULL);
-   if (pd->name)
-     cd->name = eina_stringshare_ref(pd->name);
+   efl_name_set(efl_super(cn, MY_CLASS), efl_name_get(efl_super(obj, 
MY_CLASS)));
    if (pd->m)
      {
         cd->m = malloc(sizeof (Eina_Matrix3)) ;
diff --git a/src/lib/evas/canvas/evas_vg_private.h 
b/src/lib/evas/canvas/evas_vg_private.h
index e2f393fec2..de3ca45009 100644
--- a/src/lib/evas/canvas/evas_vg_private.h
+++ b/src/lib/evas/canvas/evas_vg_private.h
@@ -56,8 +56,6 @@ struct _Efl_Canvas_Vg_Data
 
 struct _Efl_VG_Data
 {
-   const char *name;
-
    Eina_Matrix3 *m;
    Efl_VG_Interpolation *intp;
 
diff --git a/src/static_libs/vg_common/vg_common.c 
b/src/static_libs/vg_common/vg_common.c
index 7f54e355e9..fbc4c45095 100644
--- a/src/static_libs/vg_common/vg_common.c
+++ b/src/static_libs/vg_common/vg_common.c
@@ -669,7 +669,7 @@ _apply_vg_property(Svg_Node *node, Efl_VG *vg, Vg_File_Data 
*vg_data)
 
    // update the vg name
    if (node->id)
-     evas_vg_node_name_set(vg, node->id);
+     efl_name_set(vg, node->id);
 
    // apply the transformation
    if (node->transform)
@@ -927,7 +927,7 @@ _apply_svg_property(Svg_Node *node, Efl_VG *vg)
         eina_matrix3_copy(node->transform, matrix);
      }
 
-   if ((id = evas_vg_node_name_get(vg)))
+   if ((id = efl_name_get(vg)))
      {
         node->id = eina_stringshare_add(id);
      }

-- 


Reply via email to