summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-05-26 10:41:52 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-05-29 10:49:17 +0900
commit7c3e732f8c567cbc0905711b5f10aa465a5b6170 (patch)
tree6e4be6af85d79289ece5278dc91da4286ca291f6
parent76ef772d0a26463ba240718183195d61002587bf (diff)
edje: Remove part_object_get from EO
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...
-rw-r--r--src/lib/edje/Edje_Legacy.h26
-rw-r--r--src/lib/edje/edje_object.eo25
-rw-r--r--src/lib/edje/edje_util.c7
3 files changed, 31 insertions, 27 deletions
diff --git a/src/lib/edje/Edje_Legacy.h b/src/lib/edje/Edje_Legacy.h
index f122bb7272..26a871fe40 100644
--- a/src/lib/edje/Edje_Legacy.h
+++ b/src/lib/edje/Edje_Legacy.h
@@ -150,6 +150,32 @@ EAPI Edje_Load_Error edje_object_load_error_get(const Evas_Object *obj);
150EAPI const char *edje_load_error_str (Edje_Load_Error error); 150EAPI const char *edje_load_error_str (Edje_Load_Error error);
151 151
152/** 152/**
153 * @brief Gets a handle to the Evas object implementing a given Edje part, in
154 * an Edje object.
155 *
156 * This function gets a pointer of the Evas object corresponding to a given
157 * part in the obj object's group.
158 *
159 * You should never modify the state of the returned object (with @ref
160 * evas_object_move() or @ref evas_object_hide() for example), because it's
161 * meant to be managed by Edje, solely. You are safe to query information about
162 * its current state (with evas_object_visible_get() or @ref
163 * evas_object_color_get() for example), though.
164 *
165 * @note If the type of Edje part is GROUP, SWALLOW or EXTERNAL, returned
166 * handle by this function will indicate nothing or transparent rectangle for
167 * events. Use $.part_swallow_get() in that case.
168 *
169 * @param[in] part The Edje part's name
170 *
171 * @return A pointer to the Evas object implementing the given part, @c null on
172 * failure (e.g. the given part doesn't exist)
173 *
174 * @ingroup Edje_Object
175 */
176EAPI const Efl_Canvas_Object *edje_object_part_object_get(const Edje_Object *obj, const char * part);
177
178/**
153 * @ingroup Edje_Object_Communication_Interface_Message 179 * @ingroup Edje_Object_Communication_Interface_Message
154 * 180 *
155 * @{ 181 * @{
diff --git a/src/lib/edje/edje_object.eo b/src/lib/edje/edje_object.eo
index 64a27d8d1d..c6105ab6fd 100644
--- a/src/lib/edje/edje_object.eo
+++ b/src/lib/edje/edje_object.eo
@@ -823,31 +823,6 @@ class Edje.Object (Efl.Canvas.Group.Clipped, Efl.File, Efl.Container, Efl.Part,
823 group]] 823 group]]
824 } 824 }
825 } 825 }
826 @property part_object {
827 get {
828 [[Gets a handle to the Evas object implementing a given Edje
829 part, in an Edje object.
830
831 This function gets a pointer of the Evas object corresponding to a
832 given part in the obj object's group.
833
834 You should never modify the state of the returned object (with
835 \@ref evas_object_move() or \@ref evas_object_hide() for example),
836 because it's meant to be managed by Edje, solely. You are safe to
837 query information about its current state (with
838 evas_object_visible_get() or \@ref evas_object_color_get() for
839 example), though.
840
841 Note: If the type of Edje part is GROUP, SWALLOW or EXTERNAL,
842 returned handle by this function will indicate nothing or transparent
843 rectangle for events. Use $.part_swallow_get() in that case.]]
844 return: const(Efl.Canvas.Object); [[A pointer to the Evas object implementing the given part,
845 $null on failure (e.g. the given part doesn't exist)]]
846 }
847 keys {
848 part: string; [[The Edje part's name]]
849 }
850 }
851 @property part_state { 826 @property part_state {
852 get { 827 get {
853 [[Returns the state of the Edje part.]] 828 [[Returns the state of the Edje part.]]
diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c
index 2925b35d07..8740fea09e 100644
--- a/src/lib/edje/edje_util.c
+++ b/src/lib/edje/edje_util.c
@@ -1803,11 +1803,14 @@ _edje_object_part_exists(Eo *obj EINA_UNUSED, Edje *ed, const char *part)
1803 return EINA_TRUE; 1803 return EINA_TRUE;
1804} 1804}
1805 1805
1806EOLIAN const Evas_Object * 1806/* Legacy API: exposes internal object. Easy to abuse. */
1807_edje_object_part_object_get(Eo *obj EINA_UNUSED, Edje *ed, const char *part) 1807EAPI const Evas_Object *
1808edje_object_part_object_get(const Eo *obj, const char *part)
1808{ 1809{
1809 Edje_Real_Part *rp; 1810 Edje_Real_Part *rp;
1811 Edje *ed;
1810 1812
1813 ed = _edje_fetch(obj);
1811 if ((!ed) || (!part)) return NULL; 1814 if ((!ed) || (!part)) return NULL;
1812 1815
1813 /* Need to recalc before providing the object. */ 1816 /* Need to recalc before providing the object. */