rimmed pushed a commit to branch master.

http://git.enlightenment.org/tools/eflete.git/commit/?id=1ea092fe4d4eb655ebdf63878e70d005535e82c1

commit 1ea092fe4d4eb655ebdf63878e70d005535e82c1
Author: Andrii Kroitor <an.kroi...@samsung.com>
Date:   Mon Jan 11 15:34:35 2016 +0200

    editor: add program after API
---
 src/bin/editor/editor.h         |  7 +++++
 src/bin/editor/editor_program.c | 65 +++++++++++++++++++++++++++++++++++++++++
 src/bin/ui/property_group.c     |  1 +
 3 files changed, 73 insertions(+)

diff --git a/src/bin/editor/editor.h b/src/bin/editor/editor.h
index abe10ba..52bf7ef 100644
--- a/src/bin/editor/editor.h
+++ b/src/bin/editor/editor.h
@@ -172,6 +172,7 @@ typedef enum {
    ATTRIBUTE_PROGRAM_STATE2,
    ATTRIBUTE_PROGRAM_NAME,
    ATTRIBUTE_PROGRAM_TARGET,
+   ATTRIBUTE_PROGRAM_AFTER,
 } Attribute;
 
 void
@@ -711,5 +712,11 @@ editor_program_target_add(Evas_Object *edit_object, Change 
*change, Eina_Bool me
 Eina_Bool
 editor_program_target_del(Evas_Object *edit_object, Change *change, Eina_Bool 
merge,
                           const char *program_name, Eina_Stringshare *target);
+Eina_Bool
+editor_program_after_add(Evas_Object *edit_object, Change *change, Eina_Bool 
merge,
+                         const char *program_name, Eina_Stringshare *after);
+Eina_Bool
+editor_program_after_del(Evas_Object *edit_object, Change *change, Eina_Bool 
merge,
+                         const char *program_name, Eina_Stringshare *after);
 
 #endif /* EDITOR_H */
diff --git a/src/bin/editor/editor_program.c b/src/bin/editor/editor_program.c
index 7ea1ec5..7ea291d 100644
--- a/src/bin/editor/editor_program.c
+++ b/src/bin/editor/editor_program.c
@@ -337,3 +337,68 @@ editor_program_target_del(Evas_Object *edit_object, Change 
*change, Eina_Bool me
      evas_object_smart_callback_call(ap.win, SIGNAL_EDITOR_ATTRIBUTE_CHANGED, 
&attribute);
    return true;
 }
+
+Eina_Bool
+editor_program_after_add(Evas_Object *edit_object, Change *change, Eina_Bool 
merge,
+                         const char *program_name, Eina_Stringshare *after)
+{
+   Diff *diff;
+   Attribute attribute = ATTRIBUTE_PROGRAM_AFTER;
+   assert(edit_object != NULL);
+   assert(program_name != NULL);
+   assert(after != NULL);
+   if (change)
+     {
+        diff = mem_calloc(1, sizeof(Diff));
+        diff->redo.type = FUNCTION_TYPE_STRING_STRING;
+        diff->redo.function = editor_program_after_add;
+        diff->redo.args.type_ss.s1 = eina_stringshare_add(program_name);
+        diff->redo.args.type_ss.s2 = eina_stringshare_add(after);
+        diff->undo.type = FUNCTION_TYPE_STRING_STRING;
+        diff->undo.function = editor_program_after_del;
+        diff->undo.args.type_ss.s1 = eina_stringshare_add(program_name);
+        diff->undo.args.type_ss.s2 = eina_stringshare_add(after);
+        if (merge)
+          change_diff_merge_add(change, diff);
+        else
+          change_diff_add(change, diff);
+     }
+   if (!edje_edit_program_after_add(edit_object, program_name, after))
+     return false;
+   _editor_project_changed();
+   if (!_editor_signals_blocked)
+     evas_object_smart_callback_call(ap.win, SIGNAL_EDITOR_ATTRIBUTE_CHANGED, 
&attribute);
+   return true;
+}
+
+Eina_Bool
+editor_program_after_del(Evas_Object *edit_object, Change *change, Eina_Bool 
merge,
+                         const char *program_name, Eina_Stringshare *after)
+{
+   Diff *diff;
+   Attribute attribute = ATTRIBUTE_PROGRAM_AFTER;
+   assert(edit_object != NULL);
+   assert(program_name != NULL);
+   if (change)
+     {
+        diff = mem_calloc(1, sizeof(Diff));
+        diff->redo.type = FUNCTION_TYPE_STRING_STRING;
+        diff->redo.function = editor_program_after_del;
+        diff->redo.args.type_ss.s1 = eina_stringshare_add(program_name);
+        diff->redo.args.type_ss.s2 = eina_stringshare_add(after);
+        diff->undo.type = FUNCTION_TYPE_STRING_STRING;
+        diff->undo.function = editor_program_after_add;
+        diff->undo.args.type_ss.s1 = eina_stringshare_add(program_name);
+        diff->undo.args.type_ss.s2 = eina_stringshare_add(after);
+        if (merge)
+          change_diff_merge_add(change, diff);
+        else
+          change_diff_add(change, diff);
+     }
+   if (!edje_edit_program_after_del(edit_object, program_name, after))
+     return false;
+   _editor_project_changed();
+   if (!_editor_signals_blocked)
+     evas_object_smart_callback_call(ap.win, SIGNAL_EDITOR_ATTRIBUTE_CHANGED, 
&attribute);
+   return true;
+}
diff --git a/src/bin/ui/property_group.c b/src/bin/ui/property_group.c
index a0e9208..dee11ec 100644
--- a/src/bin/ui/property_group.c
+++ b/src/bin/ui/property_group.c
@@ -910,6 +910,7 @@ _on_editor_attribute_changed(void *data,
       case ATTRIBUTE_PROGRAM_STATE2:
       case ATTRIBUTE_PROGRAM_NAME:
       case ATTRIBUTE_PROGRAM_TARGET:
+      case ATTRIBUTE_PROGRAM_AFTER:
          TODO("implement");
          break;
          /* Don't add 'default:'. Compiler must warn about missing cases */

-- 


Reply via email to