rimmed pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=b612fe2485402407603aafc8c3ec6f1e5db71649

commit b612fe2485402407603aafc8c3ec6f1e5db71649
Author: Vyacheslav Reutskiy <v.reuts...@samsung.com>
Date:   Fri Jun 3 12:26:57 2016 +0300

    edje_edit: add API for set/get part item
---
 src/lib/edje/Edje_Edit.h | 25 +++++++++++++++++++++++
 src/lib/edje/edje_edit.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 78 insertions(+)

diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h
index 1135703..06052f8 100644
--- a/src/lib/edje/Edje_Edit.h
+++ b/src/lib/edje/Edje_Edit.h
@@ -2782,6 +2782,31 @@ EAPI Eina_Bool edje_edit_part_item_del(Evas_Object *obj, 
const char *part, const
 EAPI Eina_Bool
 edje_edit_part_item_index_del(Evas_Object *obj, const char *part, unsigned int 
index);
 
+/** Set name for item from table or box items.
+ *
+ * @param obj Object being edited.
+ * @param part Part to change item's source. This part should have BOX or 
TABLE type.
+ * @param index Index of item
+ * @param name New item name.
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
+ * @since 1.18
+ */
+EAPI Eina_Bool
+edje_edit_part_item_index_name_set(Evas_Object *obj, const char *part, 
unsigned int index, const char *name);
+
+/** Get name for item from table or box items.
+ *
+ * @param obj Object being edited.
+ * @param part Part to return item's source. This part should have BOX or 
TABLE type.
+ * @param index Index of item.
+ *
+ * @return name of the given item.
+ * @since 1.18
+ */
+EAPI const char *
+edje_edit_part_item_index_name_get(Evas_Object *obj, const char *part, 
unsigned int index);
+
 /** Set source for item from table or box items.
  *
  * @param obj Object being edited.
diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index 2e98460..a231ed0 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -5236,6 +5236,59 @@ edje_edit_part_item_index_del(Evas_Object *obj, const 
char *part, unsigned int i
    return EINA_TRUE;
 }
 
+EAPI Eina_Bool
+edje_edit_part_item_index_name_set(Evas_Object *obj, const char *part, 
unsigned int index, const char *name)
+{
+   Edje_Part *ep;
+   unsigned int i;
+
+   GET_RP_OR_RETURN(EINA_FALSE);
+
+   /* There is only Box and Table is allowed. */
+   if ((rp->part->type != EDJE_PART_TYPE_BOX) &&
+       (rp->part->type != EDJE_PART_TYPE_TABLE))
+     return EINA_FALSE;
+   if (rp->part->items_count < index)
+     return EINA_FALSE;
+
+   ep = rp->part;
+
+   if (!ed->file) return EINA_FALSE;
+
+   /* check if a part with given name is exists. */
+   for (i = 0; i < ep->items_count; ++i)
+     {
+        if (ep->items[i]->name && (!strcmp(ep->items[i]->name, name)))
+          return EINA_FALSE;
+     }
+
+   eina_stringshare_del(ep->items[index]->name);
+   ep->items[index]->name = eina_stringshare_add(name);
+
+   return EINA_TRUE;
+}
+
+EAPI const char *
+edje_edit_part_item_index_name_get(Evas_Object *obj, const char *part, 
unsigned int index)
+{
+   Edje_Part *ep;
+
+   GET_RP_OR_RETURN(NULL);
+
+   /* There is only Box and Table is allowed. */
+   if ((rp->part->type != EDJE_PART_TYPE_BOX) &&
+       (rp->part->type != EDJE_PART_TYPE_TABLE))
+     return NULL;
+   if (rp->part->items_count < index)
+     return EINA_FALSE;
+
+   ep = rp->part;
+
+   if (!ed->file) return NULL;
+
+   return eina_stringshare_add(ep->items[index]->name);
+}
+
 /* deprecated */
 EAPI Eina_Bool
 edje_edit_part_item_source_set(Evas_Object *obj, const char *part, const char 
*item_name, const char *source_group)

-- 


Reply via email to