edje: Remove part_object_get from EO
authorJean-Philippe Andre <jp.andre@samsung.com>
Fri, 26 May 2017 01:41:52 +0000 (10:41 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Mon, 29 May 2017 01:49:17 +0000 (10:49 +0900)
Ooooh. This one might be controversial, as some apps definitely
use the function. But it is so easily abused. For our EO API
we are trying to not expose any internal object, as this prevents
us from making changes to the internal behaviour and structure.
All the features that this API provided should be limited to
read-only access to the internal object. In order to replace
this, we will have to return an Efl.Part object that implements
all those APIs: geometry_get, visibility_get, etc...

src/lib/edje/Edje_Legacy.h
src/lib/edje/edje_object.eo
src/lib/edje/edje_util.c

index f122bb7..26a871f 100644 (file)
@@ -150,6 +150,32 @@ EAPI Edje_Load_Error edje_object_load_error_get(const Evas_Object *obj);
 EAPI const char              *edje_load_error_str        (Edje_Load_Error error);
 
 /**
+ * @brief Gets a handle to the Evas object implementing a given Edje part, in
+ * an Edje object.
+ *
+ * This function gets a pointer of the Evas object corresponding to a given
+ * part in the obj object's group.
+ *
+ * You should  never modify the state of the returned object (with @ref
+ * evas_object_move() or @ref evas_object_hide() for example), because it's
+ * meant to be managed by Edje, solely. You are safe to query information about
+ * its current state (with evas_object_visible_get() or @ref
+ * evas_object_color_get() for example), though.
+ *
+ * @note If the type of Edje part is GROUP, SWALLOW or EXTERNAL, returned
+ * handle by this function will indicate nothing or transparent rectangle for
+ * events. Use $.part_swallow_get() in that case.
+ *
+ * @param[in] part The Edje part's name
+ *
+ * @return A pointer to the Evas object implementing the given part, @c null on
+ * failure (e.g. the given part doesn't exist)
+ *
+ * @ingroup Edje_Object
+ */
+EAPI const Efl_Canvas_Object *edje_object_part_object_get(const Edje_Object *obj, const char * part);
+
+/**
  * @ingroup Edje_Object_Communication_Interface_Message
  *
  * @{
index 64a27d8..c6105ab 100644 (file)
@@ -823,31 +823,6 @@ class Edje.Object (Efl.Canvas.Group.Clipped, Efl.File, Efl.Container, Efl.Part,
                                       group]]
          }
       }
-      @property part_object {
-         get {
-            [[Gets a handle to the Evas object implementing a given Edje
-              part, in an Edje object.
-
-              This function gets a pointer of the Evas object corresponding to a
-              given part in the obj object's group.
-
-              You should  never modify the state of the returned object (with
-              \@ref evas_object_move() or \@ref evas_object_hide() for example),
-              because it's meant to be managed by Edje, solely. You are safe to
-              query information about its current state (with
-              evas_object_visible_get() or \@ref evas_object_color_get() for
-              example), though.
-
-              Note: If the type of Edje part is GROUP, SWALLOW or EXTERNAL,
-              returned handle by this function will indicate nothing or transparent
-              rectangle for events. Use $.part_swallow_get() in that case.]]
-            return: const(Efl.Canvas.Object); [[A pointer to the Evas object implementing the given part,
-                                                $null on failure (e.g. the given part doesn't exist)]]
-         }
-         keys {
-            part: string; [[The Edje part's name]]
-         }
-      }
       @property part_state {
          get {
             [[Returns the state of the Edje part.]]
index 2925b35..8740fea 100644 (file)
@@ -1803,11 +1803,14 @@ _edje_object_part_exists(Eo *obj EINA_UNUSED, Edje *ed, const char *part)
    return EINA_TRUE;
 }
 
-EOLIAN const Evas_Object *
-_edje_object_part_object_get(Eo *obj EINA_UNUSED, Edje *ed, const char *part)
+/* Legacy API: exposes internal object. Easy to abuse. */
+EAPI const Evas_Object *
+edje_object_part_object_get(const Eo *obj, const char *part)
 {
    Edje_Real_Part *rp;
+   Edje *ed;
 
+   ed = _edje_fetch(obj);
    if ((!ed) || (!part)) return NULL;
 
    /* Need to recalc before providing the object. */