From 3a468f7ad377fd5a5910a1f3c747a4ac58e82f51 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Thu, 19 Jun 2014 15:24:40 +0100 Subject: [PATCH] Efl interface file: Start using the new interface. --- src/Makefile.am | 1 + src/lib/edje/Edje_Eo.h | 2 + src/lib/edje/Edje_Legacy.h | 55 ++++++++++++++++++++ src/lib/edje/edje_edit.c | 4 +- src/lib/edje/edje_edit.eo | 2 +- src/lib/edje/edje_load.c | 2 +- src/lib/edje/edje_object.eo | 55 ++------------------ src/lib/edje/edje_smart.c | 19 ++++++- src/lib/efl/interfaces/efl_interface_file.eo | 2 +- 9 files changed, 83 insertions(+), 59 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index aa7c5efdb2..6c5e02b3d4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -6,6 +6,7 @@ EOLIAN_FLAGS = \ -I$(srcdir)/lib/eo \ -I$(srcdir)/lib/evas/canvas \ -I$(srcdir)/lib/edje \ + -I$(srcdir)/lib/efl/interfaces \ -I$(srcdir)/lib/ecore_audio ELUA_GEN_FLAGS = diff --git a/src/lib/edje/Edje_Eo.h b/src/lib/edje/Edje_Eo.h index cee58c6733..c303ea8fba 100644 --- a/src/lib/edje/Edje_Eo.h +++ b/src/lib/edje/Edje_Eo.h @@ -1,2 +1,4 @@ +#include + #include "edje_object.eo.h" #include "edje_edit.eo.h" diff --git a/src/lib/edje/Edje_Legacy.h b/src/lib/edje/Edje_Legacy.h index cb8268f1f6..0525120763 100644 --- a/src/lib/edje/Edje_Legacy.h +++ b/src/lib/edje/Edje_Legacy.h @@ -157,5 +157,60 @@ EAPI void edje_extern_object_max_size_set (Evas_Object *obj, Evas_Coord */ EAPI void edje_extern_object_aspect_set (Evas_Object *obj, Edje_Aspect_Control aspect, Evas_Coord aw, Evas_Coord ah); +/** + * + * @brief Sets the @b EDJ file (and group within it) to load an Edje + * object's contents from + * + * @return @c EINA_TRUE, on success or @c EINA_FALSE, on errors (check + * edje_object_load_error_get() after this call to get errors causes) + * + * Edje expects EDJ files, which are theming objects' descriptions and + * resources packed together in an EET file, to read Edje object + * definitions from. They usually are created with the @c .edj + * extension. EDJ files, in turn, are assembled from @b textual object + * description files, where one describes Edje objects declaratively + * -- the EDC files (see @ref edcref "the syntax" for those files). + * + * Those description files were designed so that many Edje object + * definitions -- also called @b groups (or collections) -- could be + * packed together in the same EDJ file, so that a whole + * application's theme could be packed in one file only. This is the + * reason for the @p group argument. + * + * Use this function after you instantiate a new Edje object, so that + * you can "give him life", telling where to get its contents from. + * + * @see edje_object_add() + * @see edje_object_file_get() + * @see edje_object_mmap_set() + * + * @param[in] file The path to the EDJ file to load @p from + * @param[in] group The name of the group, in @p file, which implements an +Edje object + */ +EAPI Eina_Bool edje_object_file_set(Eo *obj, const char *file, const char *group); + +/** + * + * @brief Get the file and group name that a given Edje object is bound to + * + * This gets the EDJ file's path, with the respective group set for + * the given Edje object. If @a obj is either not an Edje file, or has + * not had its file/group set previously, by edje_object_file_set(), + * then both @p file and @p group will be set to @c NULL, indicating + * an error. + * + * @see edje_object_file_set() + * + * @note Use @c NULL pointers on the file/group components you're not + * interested in: they'll be ignored by the function. + * + * @param[out] file The path to the EDJ file to load @p from + * @param[out] group The name of the group, in @p file, which implements an +Edje object + */ +EAPI void edje_object_file_get(const Eo *obj, const char **file, const char **group); + #include "edje_object.eo.legacy.h" #include "edje_edit.eo.legacy.h" diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index 5a3ce447e7..cf1f695956 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c @@ -169,7 +169,7 @@ _edje_edit_program_script_free(Program_Script *ps) } EOLIAN static Eina_Bool -_edje_edit_edje_object_file_set(Eo *obj, Edje_Edit *eed, const char *file, const char *group) +_edje_edit_efl_interface_file_file_set(Eo *obj, Edje_Edit *eed, const char *file, const char *group) { Eina_Bool ret; Eet_File *ef; @@ -195,7 +195,7 @@ _edje_edit_edje_object_file_set(Eo *obj, Edje_Edit *eed, const char *file, const * groups). */ Eina_Bool int_ret = EINA_FALSE; - eo_do_super(obj, MY_CLASS, int_ret = edje_obj_file_set(file, group)); + eo_do_super(obj, MY_CLASS, int_ret = efl_interface_file_set(file, group)); if (!int_ret) return ret; diff --git a/src/lib/edje/edje_edit.eo b/src/lib/edje/edje_edit.eo index 287d828401..81a1a88da8 100644 --- a/src/lib/edje/edje_edit.eo +++ b/src/lib/edje/edje_edit.eo @@ -5,6 +5,6 @@ class Edje.Edit (Edje.Object) Eo.Base.constructor; Eo.Base.destructor; Evas.Object_Smart.del; - Edje.Object.file.set; + Efl.Interface.File.file.set; } } diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c index 1b80d39733..0d92a5b41e 100644 --- a/src/lib/edje/edje_load.c +++ b/src/lib/edje/edje_load.c @@ -73,7 +73,7 @@ static int _sort_defined_boxes(const void *a, const void *b); /************************** API Routines **************************/ EOLIAN void -_edje_object_file_get(Eo *obj EINA_UNUSED, Edje *ed, const char **file, const char **group) +_edje_object_efl_interface_file_file_get(Eo *obj EINA_UNUSED, Edje *ed, const char **file, const char **group) { if (file) *file = ed->path; if (group) *group = ed->group; diff --git a/src/lib/edje/edje_object.eo b/src/lib/edje/edje_object.eo index 31449b50dd..9e2c4f3c93 100644 --- a/src/lib/edje/edje_object.eo +++ b/src/lib/edje/edje_object.eo @@ -1,4 +1,4 @@ -class Edje.Object (Evas.Smart_Clipped) +class Edje.Object (Evas.Smart_Clipped, Efl.Interface.File) { legacy_prefix: edje_object; eo_prefix: edje_obj; @@ -134,57 +134,6 @@ class Edje.Object (Evas.Smart_Clipped) Edje_Perspective *ps; /*@ The perspective object that will be used. */ } } - file { - set { - /*@ - @brief Sets the @b EDJ file (and group within it) to load an Edje - object's contents from - - @return @c EINA_TRUE, on success or @c EINA_FALSE, on errors (check - edje_object_load_error_get() after this call to get errors causes) - - Edje expects EDJ files, which are theming objects' descriptions and - resources packed together in an EET file, to read Edje object - definitions from. They usually are created with the @c .edj - extension. EDJ files, in turn, are assembled from @b textual object - description files, where one describes Edje objects declaratively - -- the EDC files (see @ref edcref "the syntax" for those files). - - Those description files were designed so that many Edje object - definitions -- also called @b groups (or collections) -- could be - packed together in the same EDJ file, so that a whole - application's theme could be packed in one file only. This is the - reason for the @p group argument. - - Use this function after you instantiate a new Edje object, so that - you can "give him life", telling where to get its contents from. - - @see edje_object_add() - @see edje_object_file_get() - @see edje_object_mmap_set() */ - return: bool; - } - get { - /*@ - @brief Get the file and group name that a given Edje object is bound to - - This gets the EDJ file's path, with the respective group set for - the given Edje object. If @a obj is either not an Edje file, or has - not had its file/group set previously, by edje_object_file_set(), - then both @p file and @p group will be set to @c NULL, indicating - an error. - - @see edje_object_file_set() - - @note Use @c NULL pointers on the file/group components you're not - interested in: they'll be ignored by the function. */ - } - values { - const(char)* file; /*@ The path to the EDJ file to load @p from */ - const(char)* group; /*@ The name of the group, in @p file, which implements an - Edje object */ - } - } scale { set { /*@ @@ -2399,5 +2348,7 @@ class Edje.Object (Evas.Smart_Clipped) Evas.Object_Smart.add; Evas.Object_Smart.del; Evas.Object_Smart.resize; + Efl.Interface.File.file.set; + Efl.Interface.File.file.get; } } diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c index a6887ff397..e7d60b7215 100644 --- a/src/lib/edje/edje_smart.c +++ b/src/lib/edje/edje_smart.c @@ -48,7 +48,7 @@ _edje_object_eo_base_dbg_info_get(Eo *eo_obj, Edje *_pd EINA_UNUSED, Eo_Dbg_Info Eo_Dbg_Info *group = EO_DBG_INFO_LIST_APPEND(root, MY_CLASS_NAME); const char *file, *edje_group; - eo_do(eo_obj, edje_obj_file_get(&file, &edje_group)); + eo_do(eo_obj, efl_interface_file_get(&file, &edje_group)); EO_DBG_INFO_APPEND(group, "File", EINA_VALUE_TYPE_STRING, file); EO_DBG_INFO_APPEND(group, "Group", EINA_VALUE_TYPE_STRING, edje_group); @@ -332,7 +332,7 @@ _edje_object_evas_object_smart_calculate(Eo *obj EINA_UNUSED, Edje *ed) } EOLIAN static Eina_Bool -_edje_object_file_set(Eo *obj, Edje *_pd EINA_UNUSED, const char *file, const char *group) +_edje_object_efl_interface_file_file_set(Eo *obj, Edje *_pd EINA_UNUSED, const char *file, const char *group) { Eina_Bool ret; Eina_File *f = NULL; @@ -383,4 +383,19 @@ _edje_object_mmap_set(Eo *obj, Edje *_pd EINA_UNUSED, const Eina_File *f, const return ret; } +EAPI Eina_Bool +edje_object_file_set(Eo *obj, const char *file, const char *group) +{ + Eina_Bool ret = 0; + eo_do((Eo *) obj, ret = efl_interface_file_set(file, group)); + return ret; +} + +EAPI void +edje_object_file_get(const Eo *obj, const char **file, const char **group) +{ + eo_do((Eo *) obj, efl_interface_file_get(file, group)); +} + #include "edje_object.eo.c" + diff --git a/src/lib/efl/interfaces/efl_interface_file.eo b/src/lib/efl/interfaces/efl_interface_file.eo index b5faf0096f..0ae47ce039 100644 --- a/src/lib/efl/interfaces/efl_interface_file.eo +++ b/src/lib/efl/interfaces/efl_interface_file.eo @@ -1,4 +1,4 @@ -interface Efl_Interface_File { +interface Efl.Interface.File { legacy_prefix: null; properties { file {