Edje_Edit: ability to insert "after" program into specific position
authorVitalii Vorobiov <vi.vorobiov@samsung.com>
Thu, 18 Feb 2016 17:10:24 +0000 (17:10 +0000)
committerVitalii Vorobiov <vi.vorobiov@samsung.com>
Thu, 18 Feb 2016 17:10:24 +0000 (17:10 +0000)
API looks like this:
> edje_edit_program_after_insert_at

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

index dc40eee..08b2132 100644 (file)
@@ -6026,6 +6026,20 @@ EAPI Eina_List * edje_edit_program_afters_get(Evas_Object *obj, const char *prog
  */
 EAPI Eina_Bool edje_edit_program_after_add(Evas_Object *obj, const char *prog, const char *after);
 
+/** Add a new program name into specific place in list of 'afters' in the given program.
+ *
+ * All the programs listed in 'afters' will be executed after program execution.
+ *
+ * @param obj Object being edited.
+ * @param prog The name of the program that contains the list of afters
+ * @param after The name of another program to add to the afters list
+ * @param place Specific place for after to be inserted into. Note that if place is greater than total number of afters then it would append to the end of list
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
+ */
+EAPI Eina_Bool
+edje_edit_program_after_insert_at(Evas_Object *obj, const char *prog, const char *after, int place);
+
 /** Delete the given program from the list of 'afters' of the program.
  *
  * @param obj Object being edited.
index baf0a20..2c6e46a 100644 (file)
@@ -9958,6 +9958,37 @@ edje_edit_program_after_add(Evas_Object *obj, const char *prog, const char *afte
 }
 
 EAPI Eina_Bool
+edje_edit_program_after_insert_at(Evas_Object *obj, const char *prog, const char *after, int place)
+{
+   Edje_Program *af;
+   Edje_Program_After *a;
+   Eina_List *l;
+
+   GET_EPR_OR_RETURN(EINA_FALSE);
+
+   if (place < 0)
+     return EINA_FALSE;
+
+   af = _edje_program_get_byname(obj, after);
+   if (!af) return EINA_FALSE;
+
+   a = _alloc(sizeof(Edje_Program_After));
+   if (!a) return EINA_FALSE;
+
+   a->id = af->id;
+
+   if (place >= eina_list_count(epr->after))
+     epr->after = eina_list_append(epr->after, a);
+   else
+     {
+        l = eina_list_nth_list(epr->after, place);
+        epr->after = eina_list_prepend_relative_list(epr->after, a, l);
+     }
+
+   return EINA_TRUE;
+}
+
+EAPI Eina_Bool
 edje_edit_program_after_del(Evas_Object *obj, const char *prog, const char *after)
 {
    Edje_Program *af;