* NOTE: for now this as 2 limitations
* -you will lost your #define in the edc source
*/
-EAPI int ///@return 1 on success, 0 on failure
+EAPI Eina_Bool ///@return 1 on success, 0 on failure
edje_edit_save(
Evas_Object *obj ///< The edje object to save
);
*
* Same limitations as edje_edit_save
*/
-EAPI int ///@return 1 on success, 0 on failure
+EAPI Eina_Bool ///@return 1 on success, 0 on failure
edje_edit_save_all(
Evas_Object *obj ///< The edje object to save
);
return 1;
}
-static int
+static Eina_Bool
_edje_edit_collection_save(Eet_File *eetf, Edje_Part_Collection *epc)
{
char buf[256];
if (eet_data_write(eetf, _edje_edd_edje_part_collection, buf, epc, 1) <= 0)
{
ERR("Error. unable to write \"%s\" part entry", buf);
- return 0;
+ return EINA_FALSE;
}
- return 1;
+ return EINA_TRUE;
}
static int
return 1;
}
-static Eina_Bool
-_edje_edit_coll_hash_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata)
-{
- _edje_edit_collection_save((Eet_File *)fdata, (Edje_Part_Collection *)data);
- return 1;
-}
-
-int
+Eina_Bool
_edje_edit_internal_save(Evas_Object *obj, int current_only)
{
Edje_File *ef;
Eet_File *eetf;
- GET_ED_OR_RETURN(0);
+ GET_ED_OR_RETURN(EINA_FALSE);
ef = ed->file;
- if (!ef) return 0;
+ if (!ef) return EINA_FALSE;
INF("*********** Saving file ******************");
INF("** path: %s", ef->path);
{
ERR("Error. unable to open \"%s\" for writing output",
ef->path);
- return 0;
+ return EINA_FALSE;
}
/* Set compiler name */
if (!_edje_edit_edje_file_save(eetf, ef))
{
eet_close(eetf);
- return 0;
+ return EINA_FALSE;
}
if (current_only)
if (!_edje_edit_collection_save(eetf, ed->collection))
{
eet_close(eetf);
- return 0;
+ return EINA_FALSE;
}
}
}
{
Eina_List *l;
Edje_Part_Collection *edc;
+ Eina_Iterator *it;
+
+ INF("** Writing all collections");
+
+ it = eina_hash_iterator_data_new(ef->collection_hash);
+ while (eina_iterator_next(it, (void **)&edc))
+ {
+ INF("** Writing hash Edje_Part_Collection* ed->collection "
+ "[id: %d]", edc->id);
+ if(!_edje_edit_collection_save(eetf, edc))
+ {
+ eet_close(eetf);
+ return EINA_FALSE;
+ }
+ }
+ eina_iterator_free(it);
- eina_hash_foreach(ef->collection_hash, _edje_edit_coll_hash_cb, eetf);
EINA_LIST_FOREACH(ef->collection_cache, l, edc)
- _edje_edit_collection_save(eetf, edc);
+ {
+ INF("** Writing cache Edje_Part_Collection* ed->collection "
+ "[id: %d]", edc->id);
+ if(!_edje_edit_collection_save(eetf, edc))
+ {
+ eet_close(eetf);
+ return EINA_FALSE;
+ }
+ }
}
_edje_edit_source_save(eetf, obj);
eet_close(eetf);
INF("*********** Saving DONE ******************");
- return 1;
+ return EINA_TRUE;
}
-EAPI int
+EAPI Eina_Bool
edje_edit_save(Evas_Object *obj)
{
return _edje_edit_internal_save(obj, 1);
}
-EAPI int
+EAPI Eina_Bool
edje_edit_save_all(Evas_Object *obj)
{
return _edje_edit_internal_save(obj, 0);