forked from enlightenment/efl
parent
1bb9260fea
commit
c2ce9b7c48
|
@ -8,6 +8,14 @@
|
|||
#define EDJE_DRAG_DIR_Y 2
|
||||
#define EDJE_DRAG_DIR_XY 3
|
||||
|
||||
#define EDJE_LOAD_ERROR_NONE 0
|
||||
#define EDJE_LOAD_ERROR_GENERIC 1
|
||||
#define EDJE_LOAD_ERROR_DOES_NOT_EXIST 2
|
||||
#define EDJE_LOAD_ERROR_PERMISSION_DENIED 3
|
||||
#define EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED 4
|
||||
#define EDJE_LOAD_ERROR_CORRUPT_FILE 5
|
||||
#define EDJE_LOAD_ERROR_UNKNOWN_FORMAT 6
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -29,6 +37,7 @@ extern "C" {
|
|||
const char *edje_object_data_get (Evas_Object *obj, const char *key);
|
||||
int edje_object_file_set (Evas_Object *o, const char *file, const char *part);
|
||||
void edje_object_file_get (Evas_Object *o, const char **file, const char **part);
|
||||
int edje_object_load_error_get (Evas_Object *o);
|
||||
void edje_object_signal_callback_add (Evas_Object *o, const char *emission, const char *source, void (*func) (void *data, Evas_Object *o, const char *emission, const char *source), void *data);
|
||||
void *edje_object_signal_callback_del (Evas_Object *o, const char *emission, const char *source, void (*func) (void *data, Evas_Object *o, const char *emission, const char *source));
|
||||
void edje_object_signal_emit (Evas_Object *o, const char *emission, const char *source);
|
||||
|
|
|
@ -18,7 +18,7 @@ edje_object_file_set(Evas_Object *obj, const char *file, const char *part)
|
|||
if (!part) part = "";
|
||||
if (((ed->path) && (!strcmp(file, ed->path))) &&
|
||||
(ed->part) && (!strcmp(part, ed->part)))
|
||||
return 0;
|
||||
return 1;
|
||||
|
||||
_edje_file_del(ed);
|
||||
|
||||
|
@ -27,6 +27,7 @@ edje_object_file_set(Evas_Object *obj, const char *file, const char *part)
|
|||
if (ed->part) free(ed->part);
|
||||
ed->part = strdup(part);
|
||||
|
||||
ed->load_error = EDJE_LOAD_ERROR_NONE;
|
||||
_edje_file_add(ed);
|
||||
|
||||
if (ed->collection)
|
||||
|
@ -188,11 +189,15 @@ edje_object_file_set(Evas_Object *obj, const char *file, const char *part)
|
|||
_edje_thaw(ed);
|
||||
_edje_unblock(ed);
|
||||
_edje_unref(ed);
|
||||
ed->load_error = EDJE_LOAD_ERROR_NONE;
|
||||
return 1;
|
||||
}
|
||||
else return 0;
|
||||
|
||||
return 1;
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
ed->load_error = EDJE_LOAD_ERROR_NONE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -211,6 +216,16 @@ edje_object_file_get(Evas_Object *obj, const char **file, const char **part)
|
|||
if (part) *part = ed->part;
|
||||
}
|
||||
|
||||
int
|
||||
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;
|
||||
}
|
||||
|
||||
Evas_List *
|
||||
edje_file_collection_list(const char *file)
|
||||
{
|
||||
|
@ -320,10 +335,18 @@ _edje_file_add(Edje *ed)
|
|||
else
|
||||
{
|
||||
ef = eet_open(ed->path, EET_FILE_MODE_READ);
|
||||
if (!ef) return;
|
||||
if (!ef)
|
||||
{
|
||||
ed->load_error = EDJE_LOAD_ERROR_UNKNOWN_FORMAT;
|
||||
return;
|
||||
}
|
||||
|
||||
ed->file = eet_data_read(ef, _edje_edd_edje_file, "edje_file");
|
||||
if (!ed->file) goto out;
|
||||
if (!ed->file)
|
||||
{
|
||||
ed->load_error = EDJE_LOAD_ERROR_CORRUPT_FILE;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ed->file->references = 1;
|
||||
ed->file->path = strdup(ed->path);
|
||||
|
@ -331,6 +354,7 @@ _edje_file_add(Edje *ed)
|
|||
{
|
||||
_edje_file_free(ed->file);
|
||||
ed->file = NULL;
|
||||
ed->load_error = EDJE_LOAD_ERROR_CORRUPT_FILE;
|
||||
goto out;
|
||||
}
|
||||
_edje_file_hash = evas_hash_add(_edje_file_hash, ed->file->path, ed->file);
|
||||
|
@ -360,11 +384,19 @@ _edje_file_add(Edje *ed)
|
|||
|
||||
snprintf(buf, sizeof(buf), "collections/%i", id);
|
||||
if (!ef) ef = eet_open(ed->path, EET_FILE_MODE_READ);
|
||||
if (!ef) goto out;
|
||||
if (!ef)
|
||||
{
|
||||
ed->load_error = EDJE_LOAD_ERROR_CORRUPT_FILE;
|
||||
goto out;
|
||||
}
|
||||
ed->collection = eet_data_read(ef,
|
||||
_edje_edd_edje_part_collection,
|
||||
buf);
|
||||
if (!ed->collection) goto out;
|
||||
if (!ed->collection)
|
||||
{
|
||||
ed->load_error = EDJE_LOAD_ERROR_CORRUPT_FILE;
|
||||
goto out;
|
||||
}
|
||||
ed->collection->references = 1;
|
||||
ed->file->collection_hash = evas_hash_add(ed->file->collection_hash, ed->part, ed->collection);
|
||||
}
|
||||
|
@ -372,6 +404,7 @@ _edje_file_add(Edje *ed)
|
|||
{
|
||||
_edje_file_free(ed->file);
|
||||
ed->file = NULL;
|
||||
ed->load_error = EDJE_LOAD_ERROR_CORRUPT_FILE;
|
||||
}
|
||||
}
|
||||
out:
|
||||
|
|
|
@ -393,6 +393,7 @@ struct _Edje
|
|||
int references;
|
||||
int block;
|
||||
Evas_List *emissions;
|
||||
int load_error;
|
||||
};
|
||||
|
||||
struct _Edje_Real_Part
|
||||
|
|
Loading…
Reference in New Issue