Fixing {font,image}_del's ret when file not exist
authorsachiel <sachiel@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 24 Aug 2010 14:35:37 +0000 (14:35 +0000)
committersachiel <sachiel@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 24 Aug 2010 14:35:37 +0000 (14:35 +0000)
When a file not exist, now, we're returning EINA_FALSE.
It's according with eina_hash_del()'s behavior.

By Fabiano Fidencio

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@51614 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/Edje_Edit.h
src/lib/edje_edit.c

index 7b6f6a0..0c2a961 100644 (file)
@@ -2288,7 +2288,8 @@ EAPI Eina_Bool edje_edit_font_add(Evas_Object *obj, const char *path, const char
  * @param obj Object being edited.
  * @param alias The font alias
  *
- * @return EINA_TRUE if font deleted, EINA_FALSE otherwise.
+ * @return EINA_TRUE if succesful, EINA_FALSE otherwise (including the
+ * case when the alias is not valid).
  */
 EAPI Eina_Bool edje_edit_font_del(Evas_Object *obj, const char* alias);
 
@@ -2358,7 +2359,8 @@ EAPI Eina_Bool edje_edit_image_add(Evas_Object *obj, const char *path);
  * @param obj Object being edited.
  * @param name The name of the image file to include in the edje.
  *
- * @return EINA_TRUE if succesful, EINA_FALSE otherwise.
+ * @return EINA_TRUE if succesful, EINA_FALSE otherwise (including the
+ * case when the name is not valid).
  */
 EAPI Eina_Bool edje_edit_image_del(Evas_Object *obj, const char *name);
 
index b7dea3d..0aaedb9 100644 (file)
@@ -4024,7 +4024,7 @@ edje_edit_font_del(Evas_Object *obj, const char* alias)
    if (!fnt)
      {
        WRN("Unable to find font entry part \"%s\"", alias);
-       return EINA_TRUE;
+       return EINA_FALSE;
      }
 
    /* Erase font to edje file */
@@ -4226,6 +4226,8 @@ edje_edit_image_del(Evas_Object *obj, const char* name)
 
    /* Create Image_Directory if not exist */
    if (!ed->file->image_dir)
+      goto invalid_image;
+
      return EINA_TRUE;
 
    for (i = 0; i < ed->file->image_dir->entries_count; ++i)
@@ -4238,10 +4240,7 @@ edje_edit_image_del(Evas_Object *obj, const char* name)
      }
 
    if (i == ed->file->image_dir->entries_count)
-     {
-       WRN("Unable to find image entry part \"%s\"", name);
-       return EINA_TRUE;
-     }
+      goto invalid_image;
 
    {
       char entry[PATH_MAX];
@@ -4278,6 +4277,10 @@ edje_edit_image_del(Evas_Object *obj, const char* name)
    de->entry = NULL;
 
    return EINA_TRUE;
+
+invalid_image:
+   WRN("Unable to find image entry part \"%s\"", name);
+   return EINA_FALSE;
 }
 
 EAPI Eina_Bool