edje: return Eina_Bool values in setters for dragable confine and event params in...
authorm.biliavskyi <m.biliavskyi@samsung.com>
Tue, 29 Oct 2013 01:23:42 +0000 (10:23 +0900)
committerCedric Bail <cedric.bail@samsung.com>
Tue, 29 Oct 2013 01:24:31 +0000 (10:24 +0900)
Many Edje_Edit API can fail and don't return any error information. This patch start returning
Eina_Bool for setters on dragable confine and event params to catch those error.

Reviewers: cedric

Reviewed By: cedric

CC: seoz
Differential Revision: https://phab.enlightenment.org/D274

Signed-off-by: Cedric Bail <cedric.bail@samsung.com>
src/lib/edje/Edje_Edit.h
src/lib/edje/edje_edit.c

index 131744b..40626db 100644 (file)
@@ -1103,8 +1103,10 @@ EAPI const char * edje_edit_part_drag_confine_get(Evas_Object *obj, const char *
  * @param obj Object being edited.
  * @param part Part to set the name that is used as 'confine' for the given draggies.
  * @param confine The name of the confine part or NULL to unset confine.
+ *
+ * @return EINA_TRUE if successful, EINA_FALSE otherwise.
  */
-EAPI void edje_edit_part_drag_confine_set(Evas_Object *obj, const char *part, const char *confine);
+EAPI Eina_Bool edje_edit_part_drag_confine_set(Evas_Object *obj, const char *part, const char *confine);
 
 /** Get the name of the part that is used as the receiver of the drag event.
  *
@@ -1120,8 +1122,10 @@ EAPI const char * edje_edit_part_drag_event_get(Evas_Object *obj, const char *pa
  * @param obj Object being edited.
  * @param part Part to set the name that will receive events from the given draggies.
  * @param event The name of the part that will receive events, or NULL to unset.
+ *
+ * @return EINA_TRUE if successful, EINA_FALSE otherwise.
  */
-EAPI void edje_edit_part_drag_event_set(Evas_Object *obj, const char *part, const char *event);
+EAPI Eina_Bool edje_edit_part_drag_event_set(Evas_Object *obj, const char *part, const char *event);
 
 
 //@}
index e44c076..1999f49 100644 (file)
@@ -2592,20 +2592,25 @@ FUNC_PART_DRAG_INT(count, y);
      p = ed->table_parts[rp->part->dragable.Id##_id];                  \
      return eina_stringshare_add(p->part->name);                       \
   }                                                                    \
-  EAPI void                                                            \
+  EAPI Eina_Bool                                                       \
   edje_edit_part_drag_##Id##_set(Evas_Object *obj, const char *part, const char *e) \
   {                                                                    \
      Edje_Real_Part *e_part;                                           \
                                                                        \
-     GET_RP_OR_RETURN();                                               \
-     if (!e)                                                           \
+     eina_error_set(0);                                                        \
+     if ((!obj) || (!part))                                             \
+       return EINA_FALSE;                                               \
+                                                                       \
+     GET_RP_OR_RETURN(EINA_FALSE);                                     \
+     if (!e)                                                           \
        {                                                               \
          rp->part->dragable.Id##_id = -1;                              \
-         return;                                                       \
+         return EINA_TRUE;                                             \
        }                                                               \
-                                                                       \
      e_part = _edje_real_part_get(ed, e);                              \
+     if (!e_part) return EINA_FALSE;                                    \
      rp->part->dragable.Id##_id = e_part->part->id;                    \
+     return EINA_TRUE;                                                  \
   }
 
 FUNC_PART_DRAG_ID(confine);