rimmed pushed a commit to branch master.

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

commit 1b03a86cd025bdd9e0dd954f4c58ed3d38607dee
Author: Andrii Kroitor <an.kroi...@samsung.com>
Date:   Wed Jan 6 15:06:29 2016 +0200

    editor: add editor_program_name_set
---
 src/bin/common/signals.h        |  8 ++++++++
 src/bin/editor/editor.h         |  4 ++++
 src/bin/editor/editor_program.c | 36 ++++++++++++++++++++++++++++++++++++
 src/bin/ui/property_group.c     |  1 +
 4 files changed, 49 insertions(+)

diff --git a/src/bin/common/signals.h b/src/bin/common/signals.h
index acbade4..1553cb9 100644
--- a/src/bin/common/signals.h
+++ b/src/bin/common/signals.h
@@ -89,6 +89,14 @@ typedef struct {
 #define SIGNAL_PART_RENAMED "SIGNAL_PART_RENAMED"
 
 /**
+ * emited when program is renamed.
+ * eventinfo - pointer to Rename structure
+ *
+ * @ingroup Window
+ */
+#define SIGNAL_PROGRAM_RENAMED "SIGNAL_PROGRAM_RENAMED"
+
+/**
  * emited when new state is added.
  * eventinfo - pointer to State structure
  *
diff --git a/src/bin/editor/editor.h b/src/bin/editor/editor.h
index b120b34..4343594 100644
--- a/src/bin/editor/editor.h
+++ b/src/bin/editor/editor.h
@@ -170,6 +170,7 @@ typedef enum {
    ATTRIBUTE_PROGRAM_SOURCE,
    ATTRIBUTE_PROGRAM_STATE,
    ATTRIBUTE_PROGRAM_STATE2,
+   ATTRIBUTE_PROGRAM_NAME,
 } Attribute;
 
 void
@@ -700,5 +701,8 @@ editor_program_state_set(Evas_Object *edit_object, Change 
*change, Eina_Bool mer
 Eina_Bool
 editor_program_state2_set(Evas_Object *edit_object, Change *change, Eina_Bool 
merge,
                           const char *program, const char *new_val);
+Eina_Bool
+editor_program_name_set(Evas_Object *edit_object, Change *change, Eina_Bool 
merge,
+                        const char *name, const char *new_val);
 
 #endif /* EDITOR_H */
diff --git a/src/bin/editor/editor_program.c b/src/bin/editor/editor_program.c
index dd54a06..3a51f0b 100644
--- a/src/bin/editor/editor_program.c
+++ b/src/bin/editor/editor_program.c
@@ -204,3 +204,39 @@ EDITOR_PROGRAM_STRING(signal, ATTRIBUTE_PROGRAM_SIGNAL);
 EDITOR_PROGRAM_STRING(source, ATTRIBUTE_PROGRAM_SOURCE);
 EDITOR_PROGRAM_STRING(state, ATTRIBUTE_PROGRAM_STATE);
 EDITOR_PROGRAM_STRING(state2, ATTRIBUTE_PROGRAM_STATE2);
+
+Eina_Bool
+editor_program_name_set(Evas_Object *edit_object, Change *change, Eina_Bool 
merge,
+                        const char *name, const char *new_val)
+{
+   Diff *diff;
+   Rename ren;
+   Attribute attribute = ATTRIBUTE_PROGRAM_NAME;
+   assert(edit_object != NULL);
+   assert(name != NULL);
+   assert(new_val != NULL);
+   if (change)
+     {
+        diff = mem_calloc(1, sizeof(Diff));
+        diff->redo.type = FUNCTION_TYPE_STRING_STRING;
+        diff->redo.function = editor_program_name_set;
+        diff->redo.args.type_ss.s1 = eina_stringshare_add(name);
+        diff->redo.args.type_ss.s2 = eina_stringshare_add(new_val);
+        diff->undo.type = FUNCTION_TYPE_STRING_STRING;
+        diff->undo.function = editor_program_name_set;
+        diff->undo.args.type_ss.s1 = eina_stringshare_add(new_val);
+        diff->undo.args.type_ss.s2 = eina_stringshare_add(name);
+        if (merge)
+          change_diff_merge_add(change, diff);
+        else
+          change_diff_add(change, diff);
+     }
+   if (!edje_edit_program_name_set(edit_object, name, new_val))
+     return false;
+   _editor_project_changed();
+   ren.old_name = name;
+   ren.new_name = new_val;
+   if (!_editor_signals_blocked) evas_object_smart_callback_call(ap.win, 
SIGNAL_PROGRAM_RENAMED, &ren);
+   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 74d544a..9ba9097 100644
--- a/src/bin/ui/property_group.c
+++ b/src/bin/ui/property_group.c
@@ -908,6 +908,7 @@ _on_editor_attribute_changed(void *data,
       case ATTRIBUTE_PROGRAM_SOURCE:
       case ATTRIBUTE_PROGRAM_STATE:
       case ATTRIBUTE_PROGRAM_STATE2:
+      case ATTRIBUTE_PROGRAM_NAME:
          TODO("implement");
          break;
          /* Don't add 'default:'. Compiler must warn about missing cases */

-- 


Reply via email to