2004-10-29 10:56:12 -07:00
|
|
|
/*
|
|
|
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
|
|
|
*/
|
|
|
|
|
2003-06-23 19:33:04 -07:00
|
|
|
#include "Edje.h"
|
|
|
|
#include "edje_private.h"
|
|
|
|
|
2003-07-19 19:08:47 -07:00
|
|
|
static void _edje_collection_free_part_description_free(Edje_Part_Description *desc);
|
2005-05-23 22:42:36 -07:00
|
|
|
static Evas_Bool _edje_file_collection_hash_foreach(Evas_Hash *hash, const char *key, void *data, void *fdata);
|
2004-03-26 01:10:05 -08:00
|
|
|
#ifdef EDJE_PROGRAM_CACHE
|
2003-07-19 19:08:47 -07:00
|
|
|
static int _edje_collection_free_prog_cache_matches_free_cb(Evas_Hash *hash, const char *key, void *data, void *fdata);
|
2004-03-26 01:10:05 -08:00
|
|
|
#endif
|
2003-07-19 19:08:47 -07:00
|
|
|
|
2007-03-16 14:37:57 -07:00
|
|
|
static Evas_List *_edje_swallows_collect(Edje *ed);
|
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/************************** API Routines **************************/
|
|
|
|
|
|
|
|
/* FIXDOC: Verify/expand doc */
|
2007-04-14 20:19:35 -07:00
|
|
|
/** Sets the EET file and group to load @a obj from
|
2004-06-05 21:42:17 -07:00
|
|
|
* @param obj A valid Evas_Object handle
|
2005-03-22 11:29:06 -08:00
|
|
|
* @param file The path to the EET file
|
|
|
|
* @param part The group name in the Edje
|
2004-06-05 21:42:17 -07:00
|
|
|
* @return 0 on Error\n
|
|
|
|
* 1 on Success and sets EDJE_LOAD_ERROR_NONE
|
|
|
|
*
|
2007-04-14 20:19:35 -07:00
|
|
|
* Edje uses EET files, conventionally ending in .edj, to store object
|
|
|
|
* descriptions. A single file contains multiple named groups. This function
|
|
|
|
* specifies the file and group name to load @a obj from.
|
2004-06-05 21:42:17 -07:00
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI int
|
2003-07-08 03:08:15 -07:00
|
|
|
edje_object_file_set(Evas_Object *obj, const char *file, const char *part)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
|
|
|
Edje *ed;
|
2004-04-01 07:32:17 -08:00
|
|
|
int n;
|
2007-03-16 14:37:57 -07:00
|
|
|
Evas_List *old_swallows;
|
2003-06-23 19:33:04 -07:00
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
2003-09-29 13:43:37 -07:00
|
|
|
if (!ed) return 0;
|
2003-06-23 19:33:04 -07:00
|
|
|
if (!file) file = "";
|
|
|
|
if (!part) part = "";
|
|
|
|
if (((ed->path) && (!strcmp(file, ed->path))) &&
|
|
|
|
(ed->part) && (!strcmp(part, ed->part)))
|
2003-10-19 23:10:09 -07:00
|
|
|
return 1;
|
2007-03-16 14:37:57 -07:00
|
|
|
|
|
|
|
old_swallows = _edje_swallows_collect(ed);
|
|
|
|
|
2003-06-23 19:33:04 -07:00
|
|
|
_edje_file_del(ed);
|
2003-08-03 00:00:03 -07:00
|
|
|
|
2005-11-30 01:56:15 -08:00
|
|
|
if (ed->path) evas_stringshare_del(ed->path);
|
|
|
|
if (ed->part) evas_stringshare_del(ed->part);
|
|
|
|
ed->path = evas_stringshare_add(file);
|
|
|
|
ed->part = evas_stringshare_add(part);
|
2003-08-03 00:00:03 -07:00
|
|
|
|
2003-10-19 23:10:09 -07:00
|
|
|
ed->load_error = EDJE_LOAD_ERROR_NONE;
|
2003-06-23 19:33:04 -07:00
|
|
|
_edje_file_add(ed);
|
2006-03-27 23:45:54 -08:00
|
|
|
|
|
|
|
_edje_textblock_styles_add(ed);
|
|
|
|
_edje_textblock_style_all_update(ed);
|
|
|
|
|
2003-06-23 19:33:04 -07:00
|
|
|
if (ed->collection)
|
|
|
|
{
|
|
|
|
Evas_List *l;
|
2003-07-27 06:16:51 -07:00
|
|
|
int errors = 0;
|
2005-11-28 01:54:06 -08:00
|
|
|
|
2007-01-22 04:44:57 -08:00
|
|
|
/* colorclass stuff */
|
2003-07-27 06:16:51 -07:00
|
|
|
for (l = ed->collection->parts; (l && ! errors); l = l->next)
|
|
|
|
{
|
|
|
|
Edje_Part *ep;
|
|
|
|
Evas_List *hist = NULL;
|
2007-01-22 04:44:57 -08:00
|
|
|
|
2003-11-03 22:15:19 -08:00
|
|
|
/* Register any color classes in this parts descriptions. */
|
2003-07-27 06:16:51 -07:00
|
|
|
ep = l->data;
|
2006-03-27 23:45:54 -08:00
|
|
|
if ((ep->default_desc) && (ep->default_desc->color_class))
|
|
|
|
_edje_color_class_member_add(ed, ep->default_desc->color_class);
|
2003-11-03 22:15:19 -08:00
|
|
|
for (hist = ep->other_desc; hist; hist = hist->next)
|
|
|
|
{
|
|
|
|
Edje_Part_Description *desc;
|
|
|
|
|
|
|
|
desc = hist->data;
|
|
|
|
if (desc->color_class) _edje_color_class_member_add(ed, desc->color_class);
|
|
|
|
}
|
2003-07-27 06:16:51 -07:00
|
|
|
}
|
|
|
|
/* build real parts */
|
2004-04-01 07:32:17 -08:00
|
|
|
for (n = 0, l = ed->collection->parts; l; l = l->next, n++)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
|
|
|
Edje_Part *ep;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ep = l->data;
|
|
|
|
rp = calloc(1, sizeof(Edje_Real_Part));
|
2005-10-16 13:36:20 -07:00
|
|
|
if (!rp)
|
|
|
|
{
|
|
|
|
ed->load_error = EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
|
|
|
|
return 0;
|
|
|
|
}
|
2003-07-07 00:55:18 -07:00
|
|
|
rp->part = ep;
|
2003-06-23 19:33:04 -07:00
|
|
|
ed->parts = evas_list_append(ed->parts, rp);
|
2004-10-12 20:43:42 -07:00
|
|
|
rp->param1.description = ep->default_desc;
|
|
|
|
rp->chosen_description = rp->param1.description;
|
2003-07-27 06:16:51 -07:00
|
|
|
if (!rp->param1.description)
|
|
|
|
{
|
2003-08-05 15:56:29 -07:00
|
|
|
printf("EDJE ERROR: no default part description!\n");
|
2003-07-27 06:16:51 -07:00
|
|
|
}
|
2003-06-23 19:33:04 -07:00
|
|
|
if (ep->type == EDJE_PART_TYPE_RECTANGLE)
|
|
|
|
rp->object = evas_object_rectangle_add(ed->evas);
|
|
|
|
else if (ep->type == EDJE_PART_TYPE_IMAGE)
|
|
|
|
rp->object = evas_object_image_add(ed->evas);
|
|
|
|
else if (ep->type == EDJE_PART_TYPE_TEXT)
|
2004-01-22 18:13:42 -08:00
|
|
|
{
|
2006-03-27 23:45:54 -08:00
|
|
|
_edje_text_part_on_add(ed, rp);
|
2004-01-22 18:13:42 -08:00
|
|
|
rp->object = evas_object_text_add(ed->evas);
|
|
|
|
evas_object_text_font_source_set(rp->object, ed->path);
|
|
|
|
}
|
2004-07-14 02:59:29 -07:00
|
|
|
else if (ep->type == EDJE_PART_TYPE_SWALLOW)
|
|
|
|
{
|
|
|
|
rp->object = evas_object_rectangle_add(ed->evas);
|
|
|
|
evas_object_color_set(rp->object, 0, 0, 0, 0);
|
|
|
|
evas_object_pass_events_set(rp->object, 1);
|
|
|
|
}
|
2005-09-12 02:43:49 -07:00
|
|
|
else if (ep->type == EDJE_PART_TYPE_TEXTBLOCK)
|
2005-10-27 19:56:27 -07:00
|
|
|
rp->object = evas_object_textblock_add(ed->evas);
|
2006-08-02 03:52:44 -07:00
|
|
|
else if (ep->type == EDJE_PART_TYPE_GRADIENT)
|
|
|
|
rp->object = evas_object_gradient_add(ed->evas);
|
2003-07-15 01:26:06 -07:00
|
|
|
else
|
|
|
|
{
|
2003-08-05 15:56:29 -07:00
|
|
|
printf("EDJE ERROR: wrong part type %i!\n", ep->type);
|
2003-07-15 01:26:06 -07:00
|
|
|
}
|
2004-07-14 02:59:29 -07:00
|
|
|
if (rp->object)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2004-07-14 02:59:29 -07:00
|
|
|
evas_object_smart_member_add(rp->object, ed->obj);
|
2004-10-19 23:25:43 -07:00
|
|
|
evas_object_layer_set(rp->object, evas_object_layer_get(ed->obj));
|
2004-07-14 02:59:29 -07:00
|
|
|
if (ep->type != EDJE_PART_TYPE_SWALLOW)
|
|
|
|
{
|
|
|
|
if (ep->mouse_events)
|
|
|
|
{
|
2007-04-04 05:51:51 -07:00
|
|
|
_edje_callbacks_add(rp->object, ed, rp);
|
2004-07-14 02:59:29 -07:00
|
|
|
if (ep->repeat_events)
|
|
|
|
evas_object_repeat_events_set(rp->object, 1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
evas_object_pass_events_set(rp->object, 1);
|
|
|
|
}
|
2004-09-04 02:45:59 -07:00
|
|
|
if (rp->part->clip_to_id < 0)
|
|
|
|
evas_object_clip_set(rp->object, ed->clipper);
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
2004-03-16 00:38:51 -08:00
|
|
|
rp->drag.step.x = ep->dragable.step_x;
|
|
|
|
rp->drag.step.y = ep->dragable.step_y;
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
2004-04-01 07:32:17 -08:00
|
|
|
if (n > 0)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2007-01-22 04:44:57 -08:00
|
|
|
/* FIXME: keeping a table AND a list is just bad - nuke list */
|
2004-04-01 07:32:17 -08:00
|
|
|
ed->table_parts = malloc(sizeof(Edje_Real_Part *) * n);
|
|
|
|
ed->table_parts_size = n;
|
|
|
|
/* FIXME: check malloc return */
|
|
|
|
n = 0;
|
|
|
|
for (l = ed->parts; l; l = l->next)
|
2003-06-24 19:29:25 -07:00
|
|
|
{
|
2004-04-01 07:32:17 -08:00
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
rp = l->data;
|
|
|
|
ed->table_parts[n] = rp;
|
|
|
|
n++;
|
|
|
|
if (rp->param1.description->rel1.id_x >= 0)
|
|
|
|
rp->param1.rel1_to_x = evas_list_nth(ed->parts, rp->param1.description->rel1.id_x);
|
|
|
|
if (rp->param1.description->rel1.id_y >= 0)
|
|
|
|
rp->param1.rel1_to_y = evas_list_nth(ed->parts, rp->param1.description->rel1.id_y);
|
|
|
|
if (rp->param1.description->rel2.id_x >= 0)
|
|
|
|
rp->param1.rel2_to_x = evas_list_nth(ed->parts, rp->param1.description->rel2.id_x);
|
|
|
|
if (rp->param1.description->rel2.id_y >= 0)
|
|
|
|
rp->param1.rel2_to_y = evas_list_nth(ed->parts, rp->param1.description->rel2.id_y);
|
|
|
|
_edje_text_part_on_add_clippers(ed, rp);
|
|
|
|
if (rp->part->clip_to_id >= 0)
|
2003-06-26 07:04:31 -07:00
|
|
|
{
|
2004-04-01 07:32:17 -08:00
|
|
|
rp->clip_to = evas_list_nth(ed->parts, rp->part->clip_to_id);
|
|
|
|
if (rp->clip_to)
|
|
|
|
{
|
|
|
|
evas_object_pass_events_set(rp->clip_to->object, 1);
|
|
|
|
evas_object_clip_set(rp->object, rp->clip_to->object);
|
|
|
|
}
|
2003-06-26 07:04:31 -07:00
|
|
|
}
|
2004-04-01 07:32:17 -08:00
|
|
|
if (rp->part->dragable.confine_id >= 0)
|
|
|
|
rp->confine_to = evas_list_nth(ed->parts, rp->part->dragable.confine_id);
|
|
|
|
|
2005-07-26 06:59:03 -07:00
|
|
|
/* replay events for dragable */
|
|
|
|
if (rp->part->dragable.events_id >= 0)
|
|
|
|
{
|
|
|
|
rp->events_to =
|
|
|
|
evas_list_nth(ed->parts,
|
|
|
|
rp->part->dragable.events_id);
|
|
|
|
/* events_to may be used only with dragable */
|
|
|
|
if (!rp->events_to->part->dragable.x &&
|
|
|
|
!rp->events_to->part->dragable.y)
|
|
|
|
rp->events_to = NULL;
|
|
|
|
}
|
|
|
|
|
2004-04-01 07:32:17 -08:00
|
|
|
rp->swallow_params.min.w = 0;
|
|
|
|
rp->swallow_params.min.w = 0;
|
|
|
|
rp->swallow_params.max.w = -1;
|
|
|
|
rp->swallow_params.max.h = -1;
|
2004-10-12 20:43:42 -07:00
|
|
|
|
|
|
|
if (ed->file->feature_ver < 1)
|
|
|
|
{
|
|
|
|
rp->param1.description->text.id_source = -1;
|
|
|
|
rp->param1.description->text.id_text_source = -1;
|
|
|
|
}
|
|
|
|
if (rp->param1.description->text.id_source >= 0)
|
|
|
|
rp->text.source = evas_list_nth(ed->parts, rp->param1.description->text.id_source);
|
|
|
|
if (rp->param1.description->text.id_text_source >= 0)
|
|
|
|
rp->text.text_source = evas_list_nth(ed->parts, rp->param1.description->text.id_text_source);
|
2004-04-01 07:32:17 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
n = evas_list_count(ed->collection->programs);
|
|
|
|
if (n > 0)
|
|
|
|
{
|
2007-01-22 04:44:57 -08:00
|
|
|
/* FIXME: keeping a table AND a list is just bad - nuke list */
|
2004-04-01 07:32:17 -08:00
|
|
|
ed->table_programs = malloc(sizeof(Edje_Program *) * n);
|
|
|
|
ed->table_programs_size = n;
|
|
|
|
/* FIXME: check malloc return */
|
|
|
|
n = 0;
|
|
|
|
for (l = ed->collection->programs; l; l = l->next)
|
|
|
|
{
|
|
|
|
Edje_Program *pr;
|
|
|
|
|
|
|
|
pr = l->data;
|
|
|
|
ed->table_programs[n] = pr;
|
|
|
|
n++;
|
2003-06-24 19:29:25 -07:00
|
|
|
}
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
2003-08-25 17:16:49 -07:00
|
|
|
_edje_ref(ed);
|
|
|
|
_edje_block(ed);
|
2003-06-23 19:33:04 -07:00
|
|
|
_edje_freeze(ed);
|
2004-03-26 01:10:05 -08:00
|
|
|
if (ed->collection->script) _edje_embryo_script_init(ed);
|
2004-03-30 02:30:35 -08:00
|
|
|
_edje_var_init(ed);
|
2003-08-25 17:16:49 -07:00
|
|
|
for (l = ed->parts; l; l = l->next)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
rp = l->data;
|
|
|
|
evas_object_show(rp->object);
|
|
|
|
if (_edje_block_break(ed)) break;
|
2003-08-31 19:53:08 -07:00
|
|
|
if (rp->part->dragable.x < 0) rp->drag.val.x = 1.0;
|
|
|
|
if (rp->part->dragable.y < 0) rp->drag.val.x = 1.0;
|
2004-11-19 20:43:37 -08:00
|
|
|
_edje_dragable_pos_set(ed, rp, rp->drag.val.x, rp->drag.val.y);
|
2003-08-25 17:16:49 -07:00
|
|
|
}
|
|
|
|
ed->dirty = 1;
|
2004-07-14 02:59:29 -07:00
|
|
|
if ((evas_object_clipees_get(ed->clipper)) &&
|
|
|
|
(evas_object_visible_get(obj)))
|
2003-06-23 19:33:04 -07:00
|
|
|
evas_object_show(ed->clipper);
|
2007-03-16 14:37:57 -07:00
|
|
|
|
|
|
|
/* reswallow any swallows that existed before setting the file */
|
|
|
|
if (old_swallows)
|
|
|
|
{
|
|
|
|
while (old_swallows)
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
Evas_Object *swallow;
|
|
|
|
|
|
|
|
name = old_swallows->data;
|
|
|
|
old_swallows = evas_list_remove_list(old_swallows, old_swallows);
|
|
|
|
|
|
|
|
swallow = old_swallows->data;
|
|
|
|
old_swallows = evas_list_remove_list(old_swallows, old_swallows);
|
|
|
|
|
|
|
|
edje_object_part_swallow(obj, name, swallow);
|
|
|
|
evas_stringshare_del(name);
|
|
|
|
}
|
|
|
|
}
|
2006-01-10 19:19:46 -08:00
|
|
|
|
2003-08-25 17:16:49 -07:00
|
|
|
_edje_recalc(ed);
|
|
|
|
_edje_thaw(ed);
|
|
|
|
_edje_unblock(ed);
|
|
|
|
_edje_unref(ed);
|
2003-10-19 23:10:09 -07:00
|
|
|
ed->load_error = EDJE_LOAD_ERROR_NONE;
|
2005-11-23 06:00:39 -08:00
|
|
|
_edje_emit(ed, "load", NULL);
|
2003-09-29 13:43:37 -07:00
|
|
|
return 1;
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
2003-10-19 23:10:09 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
ed->load_error = EDJE_LOAD_ERROR_NONE;
|
|
|
|
return 1;
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/* FIXDOC: Verify/expand doc. */
|
2007-04-14 20:19:35 -07:00
|
|
|
/** Get the file and group name that @a obj was loaded from
|
2004-06-05 21:42:17 -07:00
|
|
|
* @param obj A valid Evas_Object handle
|
2007-04-14 20:19:35 -07:00
|
|
|
* @param file A pointer to store a pointer to the filename in
|
|
|
|
* @param part A pointer to store a pointer to the group name in
|
2004-06-05 21:42:17 -07:00
|
|
|
*
|
2005-03-22 11:29:06 -08:00
|
|
|
* This gets the EET file location and group for the given Evas_Object.
|
2007-04-14 20:19:35 -07:00
|
|
|
* If @a obj is either not an edje file, or has not had its file/group set
|
|
|
|
* using edje_object_file_set(), then both @a file and @a part will be set
|
|
|
|
* to NULL.
|
|
|
|
*
|
|
|
|
* It is valid to pass in NULL for either @a file or @a part if you are not
|
|
|
|
* interested in one of the values.
|
2004-06-05 21:42:17 -07:00
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2003-07-08 03:08:15 -07:00
|
|
|
edje_object_file_get(Evas_Object *obj, const char **file, const char **part)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if (!ed)
|
|
|
|
{
|
|
|
|
if (file) *file = NULL;
|
|
|
|
if (part) *part = NULL;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (file) *file = ed->path;
|
|
|
|
if (part) *part = ed->part;
|
|
|
|
}
|
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/* FIXDOC: Verify. return error? */
|
|
|
|
/** Gets the Edje load error
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
*
|
|
|
|
* @return The Edje load error:\n
|
|
|
|
* 0: No Error\n
|
|
|
|
* 1: Generic Error\n
|
|
|
|
* 2: Does not Exist\n
|
|
|
|
* 3: Permission Denied\n
|
|
|
|
* 4: Resource Allocation Failed\n
|
|
|
|
* 5: Corrupt File\n
|
|
|
|
* 6: Unknown Format\n
|
|
|
|
* 7: Incompatible File
|
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI int
|
2003-10-19 23:10:09 -07:00
|
|
|
edje_object_load_error_get(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if (!ed) return EDJE_LOAD_ERROR_NONE;
|
|
|
|
return ed->load_error;
|
|
|
|
}
|
|
|
|
|
2007-04-14 20:19:35 -07:00
|
|
|
/** Get a list of groups in an edje file
|
|
|
|
* @param file The path to the edje file
|
|
|
|
*
|
|
|
|
* @return The Evas_List of group names (char *)
|
2004-06-05 21:42:17 -07:00
|
|
|
*
|
2007-04-14 20:19:35 -07:00
|
|
|
* Note: the list must be freed using edje_file_collection_list_free()
|
|
|
|
* when you are done with it.
|
2004-06-05 21:42:17 -07:00
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI Evas_List *
|
2003-07-27 06:16:51 -07:00
|
|
|
edje_file_collection_list(const char *file)
|
|
|
|
{
|
|
|
|
Evas_List *lst = NULL;
|
2005-10-05 01:38:04 -07:00
|
|
|
Edje_File *edf;
|
2005-10-22 17:15:45 -07:00
|
|
|
int error_ret = 0;
|
2005-05-23 10:48:53 -07:00
|
|
|
|
2005-10-05 01:38:04 -07:00
|
|
|
if ((!file) || (!*file)) return NULL;
|
2006-03-18 20:22:35 -08:00
|
|
|
edf = _edje_cache_file_coll_open(file, NULL, &error_ret, NULL);
|
2005-10-22 17:15:45 -07:00
|
|
|
if (edf != NULL)
|
2003-07-27 06:16:51 -07:00
|
|
|
{
|
2005-10-22 17:15:45 -07:00
|
|
|
if (edf->collection_dir)
|
2003-07-27 06:16:51 -07:00
|
|
|
{
|
2005-10-22 17:15:45 -07:00
|
|
|
Evas_List *l;
|
|
|
|
|
|
|
|
for (l = edf->collection_dir->entries; l; l = l->next)
|
|
|
|
{
|
|
|
|
Edje_Part_Collection_Directory_Entry *ce;
|
2003-07-27 06:16:51 -07:00
|
|
|
|
2005-10-22 17:15:45 -07:00
|
|
|
ce = l->data;
|
2005-11-30 07:36:34 -08:00
|
|
|
lst = evas_list_append(lst, evas_stringshare_add(ce->entry));
|
2005-10-22 17:15:45 -07:00
|
|
|
}
|
2003-07-27 06:16:51 -07:00
|
|
|
}
|
2005-10-22 17:15:45 -07:00
|
|
|
_edje_cache_file_unref(edf);
|
2003-07-27 06:16:51 -07:00
|
|
|
}
|
|
|
|
return lst;
|
|
|
|
}
|
|
|
|
|
2007-04-14 20:19:35 -07:00
|
|
|
/** Free file collection list
|
|
|
|
* @param lst The Evas_List of groups
|
2004-06-05 21:42:17 -07:00
|
|
|
*
|
2007-04-14 20:19:35 -07:00
|
|
|
* Frees the list returned by edje_file_collection_list().
|
2004-06-05 21:42:17 -07:00
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2003-07-27 06:16:51 -07:00
|
|
|
edje_file_collection_list_free(Evas_List *lst)
|
|
|
|
{
|
|
|
|
while (lst)
|
|
|
|
{
|
2005-11-30 07:36:34 -08:00
|
|
|
if (lst->data) evas_stringshare_del(lst->data);
|
2003-07-27 06:16:51 -07:00
|
|
|
lst = evas_list_remove(lst, lst->data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-01 22:10:17 -07:00
|
|
|
/** Determine whether a group matching glob exists in an edje file.
|
|
|
|
* @param file The file path
|
|
|
|
* @param glob A glob to match on
|
|
|
|
*
|
|
|
|
* @return 1 if a match is found, 0 otherwise
|
|
|
|
*/
|
|
|
|
EAPI int
|
|
|
|
edje_file_group_exists(const char *file, const char *glob)
|
|
|
|
{
|
|
|
|
Edje_File *edf;
|
|
|
|
int error_ret = 0;
|
|
|
|
|
2006-09-06 00:11:03 -07:00
|
|
|
if ((!file) || (!*file)) return 0;
|
2006-09-01 22:10:17 -07:00
|
|
|
edf = _edje_cache_file_coll_open(file, NULL, &error_ret, NULL);
|
|
|
|
if (edf != NULL)
|
|
|
|
{
|
|
|
|
if (edf->collection_dir)
|
|
|
|
{
|
|
|
|
Evas_List *l;
|
|
|
|
|
|
|
|
for (l = edf->collection_dir->entries; l; l = l->next)
|
|
|
|
{
|
|
|
|
Edje_Part_Collection_Directory_Entry *ce;
|
|
|
|
|
|
|
|
ce = l->data;
|
|
|
|
if (_edje_glob_match(ce->entry, glob)) return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_edje_cache_file_unref(edf);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-04-14 20:19:35 -07:00
|
|
|
/** Get data from the file level data block of an edje file
|
|
|
|
* @param file The path to the .edj file
|
2004-06-05 21:42:17 -07:00
|
|
|
* @param key The data key
|
2007-04-14 20:19:35 -07:00
|
|
|
* @return The string value of the data
|
|
|
|
*
|
|
|
|
* If an edje file is built from the following edc:
|
|
|
|
*
|
|
|
|
* data {
|
|
|
|
* item: "key1" "value1";
|
|
|
|
* item: "key2" "value2";
|
|
|
|
* }
|
|
|
|
* collections { ... }
|
|
|
|
*
|
|
|
|
* Then, edje_file_data_get("key1") will return "value1"
|
2004-06-05 21:42:17 -07:00
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI char *
|
2003-08-05 07:33:35 -07:00
|
|
|
edje_file_data_get(const char *file, const char *key)
|
|
|
|
{
|
2005-10-05 01:38:04 -07:00
|
|
|
Edje_File *edf;
|
2003-08-05 07:33:35 -07:00
|
|
|
char *str = NULL;
|
2005-10-22 17:15:45 -07:00
|
|
|
int error_ret = 0;
|
2003-08-05 07:33:35 -07:00
|
|
|
|
2007-03-06 04:03:34 -08:00
|
|
|
if (key)
|
2003-08-05 07:33:35 -07:00
|
|
|
{
|
2007-03-06 04:03:34 -08:00
|
|
|
edf = _edje_cache_file_coll_open(file, NULL, &error_ret, NULL);
|
|
|
|
if ((edf != NULL) && (edf->data_cache != NULL))
|
2003-08-05 07:33:35 -07:00
|
|
|
{
|
2007-03-06 04:03:34 -08:00
|
|
|
str = evas_hash_find(edf->data_cache, key);
|
|
|
|
if (str) str = strdup(str);
|
|
|
|
_edje_cache_file_unref(edf);
|
2003-08-05 07:33:35 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
2003-06-23 19:33:04 -07:00
|
|
|
void
|
|
|
|
_edje_file_add(Edje *ed)
|
|
|
|
{
|
2005-10-05 01:38:04 -07:00
|
|
|
if (_edje_edd_edje_file == NULL) return;
|
|
|
|
ed->file = _edje_cache_file_coll_open(ed->path, ed->part,
|
|
|
|
&(ed->load_error),
|
|
|
|
&(ed->collection));
|
2006-01-10 19:19:46 -08:00
|
|
|
|
2005-04-03 04:43:00 -07:00
|
|
|
if (!ed->collection)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2005-10-05 01:38:04 -07:00
|
|
|
if (ed->file)
|
2003-06-26 07:04:31 -07:00
|
|
|
{
|
2005-10-05 01:38:04 -07:00
|
|
|
_edje_cache_file_unref(ed->file);
|
2003-06-26 07:04:31 -07:00
|
|
|
ed->file = NULL;
|
|
|
|
}
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-16 14:37:57 -07:00
|
|
|
static Evas_List *
|
|
|
|
_edje_swallows_collect(Edje *ed)
|
|
|
|
{
|
|
|
|
Evas_List *swallows = NULL;
|
|
|
|
Evas_List *l;
|
|
|
|
if (!ed->file || !ed->parts) return NULL;
|
|
|
|
|
|
|
|
for (l = ed->parts; l; l = l->next)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
rp = l->data;
|
|
|
|
if (!rp->swallowed_object) continue;
|
|
|
|
swallows = evas_list_append(swallows, evas_stringshare_add(rp->part->name));
|
|
|
|
swallows = evas_list_append(swallows, rp->swallowed_object);
|
|
|
|
}
|
|
|
|
return swallows;
|
|
|
|
}
|
|
|
|
|
2003-06-23 19:33:04 -07:00
|
|
|
void
|
|
|
|
_edje_file_del(Edje *ed)
|
|
|
|
{
|
2004-06-30 20:46:05 -07:00
|
|
|
_edje_message_del(ed);
|
2003-08-25 17:16:49 -07:00
|
|
|
_edje_block_violate(ed);
|
2004-03-30 02:30:35 -08:00
|
|
|
_edje_var_shutdown(ed);
|
2005-05-25 01:07:34 -07:00
|
|
|
if (!((ed->file) && (ed->collection))) return;
|
2005-04-03 04:43:00 -07:00
|
|
|
if ((ed->file) && (ed->collection))
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2005-04-03 04:43:00 -07:00
|
|
|
Evas_List *l;
|
2006-03-27 23:45:54 -08:00
|
|
|
|
|
|
|
_edje_textblock_styles_del(ed);
|
2005-04-03 04:43:00 -07:00
|
|
|
for (l = ed->collection->parts; l; l = l->next)
|
2003-08-03 00:00:03 -07:00
|
|
|
{
|
2005-04-03 04:43:00 -07:00
|
|
|
Edje_Part *ep;
|
|
|
|
|
|
|
|
ep = l->data;
|
|
|
|
_edje_text_part_on_del(ed, ep);
|
|
|
|
_edje_color_class_on_del(ed, ep);
|
2003-08-03 00:00:03 -07:00
|
|
|
}
|
2005-10-05 01:38:04 -07:00
|
|
|
_edje_cache_coll_unref(ed->file, ed->collection);
|
2003-06-23 19:33:04 -07:00
|
|
|
ed->collection = NULL;
|
|
|
|
}
|
|
|
|
if (ed->file)
|
|
|
|
{
|
2005-10-05 01:38:04 -07:00
|
|
|
_edje_cache_file_unref(ed->file);
|
2003-06-23 19:33:04 -07:00
|
|
|
ed->file = NULL;
|
|
|
|
}
|
|
|
|
if (ed->parts)
|
|
|
|
{
|
|
|
|
while (ed->parts)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *rp;
|
2003-11-24 23:22:19 -08:00
|
|
|
|
2003-06-23 19:33:04 -07:00
|
|
|
rp = ed->parts->data;
|
2003-07-29 19:58:22 -07:00
|
|
|
ed->parts = evas_list_remove(ed->parts, rp);
|
2004-12-02 01:21:22 -08:00
|
|
|
if (rp->object)
|
|
|
|
{
|
|
|
|
_edje_text_real_part_on_del(ed, rp);
|
2007-04-04 05:51:51 -07:00
|
|
|
_edje_callbacks_del(rp->object);
|
2004-12-02 01:21:22 -08:00
|
|
|
evas_object_del(rp->object);
|
|
|
|
}
|
2003-07-20 05:37:49 -07:00
|
|
|
if (rp->swallowed_object)
|
|
|
|
{
|
2004-05-17 23:06:57 -07:00
|
|
|
evas_object_smart_member_del(rp->swallowed_object);
|
2003-07-20 05:37:49 -07:00
|
|
|
evas_object_event_callback_del(rp->swallowed_object,
|
|
|
|
EVAS_CALLBACK_FREE,
|
|
|
|
_edje_object_part_swallow_free_cb);
|
2004-05-17 23:06:57 -07:00
|
|
|
evas_object_clip_unset(rp->swallowed_object);
|
2007-04-05 05:49:48 -07:00
|
|
|
evas_object_data_del(rp->swallowed_object, "\377 edje.swallowing_part");
|
2007-04-04 05:51:51 -07:00
|
|
|
if (rp->part->mouse_events)
|
|
|
|
_edje_callbacks_del(rp->swallowed_object);
|
2004-05-17 23:06:57 -07:00
|
|
|
rp->swallowed_object = NULL;
|
2004-05-17 21:21:22 -07:00
|
|
|
/* I think it would be better swallowed objects dont get deleted */
|
|
|
|
/* evas_object_del(rp->swallowed_object);*/
|
2003-07-20 05:37:49 -07:00
|
|
|
}
|
2005-11-30 07:36:34 -08:00
|
|
|
if (rp->text.text) evas_stringshare_del(rp->text.text);
|
|
|
|
if (rp->text.font) evas_stringshare_del(rp->text.font);
|
2005-11-30 01:56:15 -08:00
|
|
|
if (rp->text.cache.in_str) evas_stringshare_del(rp->text.cache.in_str);
|
|
|
|
if (rp->text.cache.out_str) evas_stringshare_del(rp->text.cache.out_str);
|
2004-10-29 10:56:12 -07:00
|
|
|
|
|
|
|
if (rp->custom.description)
|
|
|
|
{
|
|
|
|
_edje_collection_free_part_description_free(rp->custom.description);
|
|
|
|
}
|
|
|
|
|
2003-06-23 19:33:04 -07:00
|
|
|
free(rp);
|
|
|
|
}
|
|
|
|
ed->parts = NULL;
|
|
|
|
}
|
|
|
|
if (ed->actions)
|
|
|
|
{
|
2003-06-26 07:04:31 -07:00
|
|
|
while (ed->actions)
|
|
|
|
{
|
|
|
|
Edje_Running_Program *runp;
|
|
|
|
|
|
|
|
_edje_anim_count--;
|
|
|
|
runp = ed->actions->data;
|
|
|
|
ed->actions = evas_list_remove(ed->actions, runp);
|
|
|
|
free(runp);
|
|
|
|
}
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
2003-08-25 17:16:49 -07:00
|
|
|
_edje_animators = evas_list_remove(_edje_animators, ed);
|
2003-06-27 21:20:41 -07:00
|
|
|
if (ed->pending_actions)
|
|
|
|
{
|
|
|
|
while (ed->pending_actions)
|
|
|
|
{
|
|
|
|
Edje_Pending_Program *pp;
|
|
|
|
|
|
|
|
pp = ed->pending_actions->data;
|
|
|
|
ed->pending_actions = evas_list_remove(ed->pending_actions, pp);
|
|
|
|
ecore_timer_del(pp->timer);
|
|
|
|
free(pp);
|
|
|
|
}
|
|
|
|
}
|
2004-04-01 07:32:17 -08:00
|
|
|
if (ed->table_parts) free(ed->table_parts);
|
|
|
|
ed->table_parts = NULL;
|
|
|
|
ed->table_parts_size = 0;
|
|
|
|
if (ed->table_programs) free(ed->table_programs);
|
|
|
|
ed->table_programs = NULL;
|
|
|
|
ed->table_programs_size = 0;
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
2007-03-06 04:03:34 -08:00
|
|
|
/**
|
|
|
|
* Used to free the cached data values that are stored in the data_cache
|
|
|
|
* hash table.
|
|
|
|
*/
|
|
|
|
static Evas_Bool data_cache_free(Evas_Hash *hash, const char *key,
|
|
|
|
void *data, void *fdata)
|
|
|
|
{
|
|
|
|
evas_stringshare_del(data);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-06-23 19:33:04 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_edje_file_free(Edje_File *edf)
|
|
|
|
{
|
2004-08-29 22:39:24 -07:00
|
|
|
if (edf->font_dir)
|
|
|
|
{
|
|
|
|
while (edf->font_dir->entries)
|
|
|
|
{
|
|
|
|
Edje_Font_Directory_Entry *fe;
|
|
|
|
|
|
|
|
fe = edf->font_dir->entries->data;
|
2007-04-04 06:25:55 -07:00
|
|
|
edf->font_dir->entries =
|
2006-08-08 02:53:51 -07:00
|
|
|
evas_list_remove_list(edf->font_dir->entries, edf->font_dir->entries);
|
2007-04-04 06:25:55 -07:00
|
|
|
edf->font_hash = evas_hash_del(edf->font_hash, fe->entry, NULL);
|
|
|
|
if (fe->path) evas_stringshare_del(fe->path);
|
2004-08-29 22:39:24 -07:00
|
|
|
free(fe);
|
|
|
|
}
|
|
|
|
free(edf->font_dir);
|
|
|
|
}
|
2003-07-07 00:55:18 -07:00
|
|
|
if (edf->image_dir)
|
|
|
|
{
|
|
|
|
while (edf->image_dir->entries)
|
|
|
|
{
|
|
|
|
Edje_Image_Directory_Entry *ie;
|
|
|
|
|
|
|
|
ie = edf->image_dir->entries->data;
|
2003-07-29 19:58:22 -07:00
|
|
|
edf->image_dir->entries =
|
2006-08-08 02:53:51 -07:00
|
|
|
evas_list_remove_list(edf->image_dir->entries, edf->image_dir->entries);
|
2005-11-30 07:36:34 -08:00
|
|
|
if (ie->entry) evas_stringshare_del(ie->entry);
|
2003-07-07 00:55:18 -07:00
|
|
|
free(ie);
|
|
|
|
}
|
|
|
|
free(edf->image_dir);
|
|
|
|
}
|
|
|
|
if (edf->collection_dir)
|
|
|
|
{
|
|
|
|
while (edf->collection_dir->entries)
|
|
|
|
{
|
|
|
|
Edje_Part_Collection_Directory_Entry *ce;
|
|
|
|
|
|
|
|
ce = edf->collection_dir->entries->data;
|
2003-07-29 19:58:22 -07:00
|
|
|
edf->collection_dir->entries =
|
2006-08-08 02:53:51 -07:00
|
|
|
evas_list_remove_list(edf->collection_dir->entries, edf->collection_dir->entries);
|
2005-11-30 07:36:34 -08:00
|
|
|
if (ce->entry) evas_stringshare_del(ce->entry);
|
2003-07-07 00:55:18 -07:00
|
|
|
free(ce);
|
|
|
|
}
|
|
|
|
free(edf->collection_dir);
|
|
|
|
}
|
2006-08-04 01:40:03 -07:00
|
|
|
if (edf->spectrum_dir)
|
|
|
|
{
|
|
|
|
while (edf->spectrum_dir->entries)
|
|
|
|
{
|
|
|
|
Edje_Spectrum_Directory_Entry *se;
|
|
|
|
|
|
|
|
se = edf->spectrum_dir->entries->data;
|
|
|
|
edf->spectrum_dir->entries =
|
2006-10-09 08:00:45 -07:00
|
|
|
evas_list_remove_list(edf->spectrum_dir->entries, edf->spectrum_dir->entries);
|
2006-08-04 01:40:03 -07:00
|
|
|
while (se->color_list)
|
2006-10-09 08:00:45 -07:00
|
|
|
{
|
|
|
|
free(se->color_list->data);
|
|
|
|
se->color_list = evas_list_remove_list(se->color_list, se->color_list);
|
|
|
|
}
|
2006-08-04 01:40:03 -07:00
|
|
|
if (se->entry) evas_stringshare_del(se->entry);
|
|
|
|
if (se->filename) evas_stringshare_del(se->filename);
|
|
|
|
free(se);
|
|
|
|
}
|
|
|
|
free(edf->spectrum_dir);
|
|
|
|
}
|
2006-01-10 19:19:46 -08:00
|
|
|
while (edf->data)
|
2004-06-30 20:46:05 -07:00
|
|
|
{
|
2006-01-10 19:19:46 -08:00
|
|
|
Edje_Data *edt;
|
|
|
|
|
|
|
|
edt = edf->data->data;
|
|
|
|
edf->data = evas_list_remove(edf->data, edt);
|
|
|
|
if (edt->key) evas_stringshare_del(edt->key);
|
|
|
|
if (edt->value) evas_stringshare_del(edt->value);
|
|
|
|
free(edt);
|
2004-06-30 20:46:05 -07:00
|
|
|
}
|
2007-03-06 04:03:34 -08:00
|
|
|
if (edf->data_cache)
|
|
|
|
{
|
|
|
|
evas_hash_foreach(edf->data_cache, data_cache_free, NULL);
|
|
|
|
evas_hash_free(edf->data_cache);
|
|
|
|
edf->data_cache = NULL;
|
|
|
|
}
|
|
|
|
|
2006-08-08 02:53:51 -07:00
|
|
|
while (edf->color_classes)
|
2006-01-10 19:19:46 -08:00
|
|
|
{
|
|
|
|
Edje_Color_Class *ecc;
|
|
|
|
|
|
|
|
ecc = edf->color_classes->data;
|
2006-08-08 02:53:51 -07:00
|
|
|
edf->color_classes = evas_list_remove_list(edf->color_classes, edf->color_classes);
|
2006-01-10 19:19:46 -08:00
|
|
|
if (ecc->name) evas_stringshare_del(ecc->name);
|
|
|
|
free(ecc);
|
|
|
|
}
|
|
|
|
|
2005-04-03 04:43:00 -07:00
|
|
|
/* FIXME: free collection_hash and collection_cache */
|
|
|
|
if (edf->collection_hash)
|
|
|
|
{
|
2005-05-23 22:42:36 -07:00
|
|
|
printf("EDJE ERROR:\n"
|
|
|
|
"\n"
|
|
|
|
"Naughty Programmer - spank spank!\n"
|
|
|
|
"\n"
|
|
|
|
"This program as probably called edje_shutdown() with active Edje objects\n"
|
|
|
|
"still around.\n This can cause problems as both Evas and Edje retain\n"
|
|
|
|
"references to the objects. you should shut down all canvases and objects\n"
|
|
|
|
"before calling edje_shutdown().\n"
|
|
|
|
"The following errors are the edje object files and parts that are still\n"
|
|
|
|
"hanging around, with their reference counts\n");
|
|
|
|
evas_hash_foreach(edf->collection_hash, _edje_file_collection_hash_foreach, edf);
|
2005-04-03 04:43:00 -07:00
|
|
|
evas_hash_free(edf->collection_hash);
|
|
|
|
}
|
2005-11-30 01:56:15 -08:00
|
|
|
if (edf->path) evas_stringshare_del(edf->path);
|
2005-11-30 07:36:34 -08:00
|
|
|
if (edf->compiler) evas_stringshare_del(edf->compiler);
|
2005-11-02 00:13:56 -08:00
|
|
|
if (edf->collection_cache) _edje_cache_coll_flush(edf);
|
2005-10-05 01:38:04 -07:00
|
|
|
_edje_textblock_style_cleanup(edf);
|
2003-07-07 00:55:18 -07:00
|
|
|
free(edf);
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
|
|
|
|
2005-04-03 04:43:00 -07:00
|
|
|
void
|
|
|
|
_edje_collection_free(Edje_File *edf, Edje_Part_Collection *ec)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2003-07-19 19:08:47 -07:00
|
|
|
while (ec->programs)
|
|
|
|
{
|
|
|
|
Edje_Program *pr;
|
2003-11-24 23:22:19 -08:00
|
|
|
|
2003-07-19 19:08:47 -07:00
|
|
|
pr = ec->programs->data;
|
2006-10-09 08:00:45 -07:00
|
|
|
ec->programs = evas_list_remove_list(ec->programs, ec->programs);
|
2005-11-30 07:36:34 -08:00
|
|
|
if (pr->name) evas_stringshare_del(pr->name);
|
|
|
|
if (pr->signal) evas_stringshare_del(pr->signal);
|
|
|
|
if (pr->source) evas_stringshare_del(pr->source);
|
|
|
|
if (pr->state) evas_stringshare_del(pr->state);
|
|
|
|
if (pr->state2) evas_stringshare_del(pr->state2);
|
2003-07-19 19:08:47 -07:00
|
|
|
while (pr->targets)
|
|
|
|
{
|
|
|
|
Edje_Program_Target *prt;
|
|
|
|
|
|
|
|
prt = pr->targets->data;
|
2006-10-09 08:00:45 -07:00
|
|
|
pr->targets = evas_list_remove_list(pr->targets, pr->targets);
|
2003-07-19 19:08:47 -07:00
|
|
|
free(prt);
|
|
|
|
}
|
2004-03-07 18:43:48 -08:00
|
|
|
while (pr->after)
|
|
|
|
{
|
|
|
|
Edje_Program_After *pa;
|
|
|
|
|
|
|
|
pa = pr->after->data;
|
2006-10-09 08:00:45 -07:00
|
|
|
pr->after = evas_list_remove_list(pr->after, pr->after);
|
2005-11-30 07:36:34 -08:00
|
|
|
free(pa);
|
2004-03-07 18:43:48 -08:00
|
|
|
}
|
2003-07-19 19:08:47 -07:00
|
|
|
free(pr);
|
|
|
|
}
|
|
|
|
while (ec->parts)
|
|
|
|
{
|
|
|
|
Edje_Part *ep;
|
2003-11-24 23:22:19 -08:00
|
|
|
|
2003-07-19 19:08:47 -07:00
|
|
|
ep = ec->parts->data;
|
|
|
|
ec->parts = evas_list_remove(ec->parts, ep);
|
2005-11-30 07:36:34 -08:00
|
|
|
if (ep->name) evas_stringshare_del(ep->name);
|
2003-11-24 23:22:19 -08:00
|
|
|
if (ep->default_desc)
|
|
|
|
{
|
|
|
|
_edje_collection_free_part_description_free(ep->default_desc);
|
|
|
|
ep->default_desc = NULL;
|
|
|
|
}
|
2003-07-19 19:08:47 -07:00
|
|
|
while (ep->other_desc)
|
|
|
|
{
|
|
|
|
Edje_Part_Description *desc;
|
|
|
|
|
|
|
|
desc = ep->other_desc->data;
|
|
|
|
ep->other_desc = evas_list_remove(ep->other_desc, desc);
|
|
|
|
_edje_collection_free_part_description_free(desc);
|
|
|
|
}
|
2003-07-29 19:58:22 -07:00
|
|
|
free(ep);
|
2003-07-19 19:08:47 -07:00
|
|
|
}
|
2004-06-30 20:46:05 -07:00
|
|
|
if (ec->data)
|
|
|
|
{
|
|
|
|
while (ec->data)
|
|
|
|
{
|
|
|
|
Edje_Data *edt;
|
|
|
|
|
|
|
|
edt = ec->data->data;
|
|
|
|
ec->data = evas_list_remove(ec->data, edt);
|
2005-11-30 07:36:34 -08:00
|
|
|
if (edt->key) evas_stringshare_del(edt->key);
|
|
|
|
if (edt->value) evas_stringshare_del(edt->value);
|
2004-06-30 20:46:05 -07:00
|
|
|
free(edt);
|
|
|
|
}
|
|
|
|
}
|
2005-11-30 01:56:15 -08:00
|
|
|
if (ec->part) evas_stringshare_del(ec->part);
|
2004-03-26 01:10:05 -08:00
|
|
|
#ifdef EDJE_PROGRAM_CACHE
|
2003-07-19 19:08:47 -07:00
|
|
|
if (ec->prog_cache.no_matches) evas_hash_free(ec->prog_cache.no_matches);
|
|
|
|
if (ec->prog_cache.matches)
|
|
|
|
{
|
2003-07-29 19:58:22 -07:00
|
|
|
evas_hash_foreach(ec->prog_cache.matches,
|
|
|
|
_edje_collection_free_prog_cache_matches_free_cb,
|
|
|
|
NULL);
|
2003-07-19 19:08:47 -07:00
|
|
|
evas_hash_free(ec->prog_cache.matches);
|
|
|
|
}
|
2004-03-26 01:10:05 -08:00
|
|
|
#endif
|
2005-04-27 01:11:58 -07:00
|
|
|
if (ec->script) embryo_program_free(ec->script);
|
2003-07-19 19:08:47 -07:00
|
|
|
free(ec);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_edje_collection_free_part_description_free(Edje_Part_Description *desc)
|
|
|
|
{
|
2005-11-30 07:36:34 -08:00
|
|
|
if (desc->state.name) evas_stringshare_del(desc->state.name);
|
2003-07-19 19:08:47 -07:00
|
|
|
while (desc->image.tween_list)
|
|
|
|
{
|
|
|
|
Edje_Part_Image_Id *pi;
|
|
|
|
|
|
|
|
pi = desc->image.tween_list->data;
|
|
|
|
desc->image.tween_list = evas_list_remove(desc->image.tween_list, pi);
|
|
|
|
free(pi);
|
|
|
|
}
|
2005-11-30 07:36:34 -08:00
|
|
|
if (desc->color_class) evas_stringshare_del(desc->color_class);
|
|
|
|
if (desc->text.text) evas_stringshare_del(desc->text.text);
|
|
|
|
if (desc->text.text_class) evas_stringshare_del(desc->text.text_class);
|
|
|
|
if (desc->text.style) evas_stringshare_del(desc->text.style);
|
|
|
|
if (desc->text.font) evas_stringshare_del(desc->text.font);
|
2006-08-04 02:00:35 -07:00
|
|
|
if (desc->gradient.type) evas_stringshare_del(desc->gradient.type);
|
|
|
|
if (desc->gradient.params) evas_stringshare_del(desc->gradient.params);
|
2003-07-19 19:08:47 -07:00
|
|
|
free(desc);
|
|
|
|
}
|
|
|
|
|
2005-05-23 22:42:36 -07:00
|
|
|
static Evas_Bool
|
|
|
|
_edje_file_collection_hash_foreach(Evas_Hash *hash, const char *key, void *data, void *fdata)
|
|
|
|
{
|
|
|
|
Edje_File *edf;
|
|
|
|
Edje_Part_Collection *coll;
|
|
|
|
|
|
|
|
edf = fdata;
|
|
|
|
coll = data;
|
|
|
|
printf("EEK: EDJE FILE: \"%s\" ref(%i) PART: \"%s\" ref(%i) \n",
|
|
|
|
edf->path, edf->references,
|
|
|
|
coll->part, coll->references);
|
|
|
|
_edje_collection_free(edf, coll);
|
2005-05-24 10:02:00 -07:00
|
|
|
|
|
|
|
return 1;
|
2005-05-23 22:42:36 -07:00
|
|
|
}
|
|
|
|
|
2004-03-26 01:10:05 -08:00
|
|
|
#ifdef EDJE_PROGRAM_CACHE
|
2003-07-19 19:08:47 -07:00
|
|
|
static int
|
|
|
|
_edje_collection_free_prog_cache_matches_free_cb(Evas_Hash *hash, const char *key, void *data, void *fdata)
|
|
|
|
{
|
|
|
|
evas_list_free((Evas_List *)data);
|
|
|
|
return 1;
|
2003-10-18 19:11:06 -07:00
|
|
|
hash = NULL;
|
|
|
|
fdata = NULL;
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
2004-03-26 01:10:05 -08:00
|
|
|
#endif
|