rimmed pushed a commit to branch master.

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

commit beb696e4bf21bd7ab97562dd510866f6bd71722f
Author: Mykyta Biliavskyi <m.biliavs...@samsung.com>
Date:   Tue Jan 17 16:56:08 2017 +0200

    Editor: add proxy for edje_edit_image_set_add API.
    
    Added signal SIGNAL_EDITOR_IMAGE_SET_ADDED for make possible
    communication between resource manager and editor modules. This signal
    will be emmited when new image set will be added.
---
 src/bin/common/signals.h                          |  9 ++++++++-
 src/bin/editor/editor.h                           |  3 +++
 src/bin/editor/editor_top_level.c                 | 18 ++++++++++++++++++
 src/bin/resource_manager/resource_manager_react.c | 19 +++++++++++++++++++
 4 files changed, 48 insertions(+), 1 deletion(-)

diff --git a/src/bin/common/signals.h b/src/bin/common/signals.h
index c7d8e1e..5ac1004 100644
--- a/src/bin/common/signals.h
+++ b/src/bin/common/signals.h
@@ -567,7 +567,14 @@ typedef struct {
 #define SIGNAL_EDITOR_IMAGE_DELETED "SIGNAL_EDITOR_IMAGE_DELETED"
 
 /**
- * emited when tone is added.
+ * emited when image set added.
+ * eventinfo - image set name.
+ *
+ * @ingroup Window
+ */
+#define SIGNAL_EDITOR_IMAGE_SET_ADDED "SIGNAL_EDITOR_IMAGE_SET_ADDED"
+/**
+ * emited when textblock style is added.
  * eventinfo - NULL
  *
  * @ingroup Window
diff --git a/src/bin/editor/editor.h b/src/bin/editor/editor.h
index a0dede8..144c869 100644
--- a/src/bin/editor/editor.h
+++ b/src/bin/editor/editor.h
@@ -289,6 +289,9 @@ Eina_Bool
 editor_image_del(Evas_Object *obj, const char *selected, Eina_Bool notify) 
EINA_WARN_UNUSED_RESULT;
 
 Eina_Bool
+editor_image_set_add(Evas_Object *obj, const char *name, Eina_Bool notify) 
EINA_WARN_UNUSED_RESULT;
+
+Eina_Bool
 editor_image_set_image_border_left_set(Evas_Object *obj, const char *name, int 
position, int l) EINA_WARN_UNUSED_RESULT;
 
 Eina_Bool
diff --git a/src/bin/editor/editor_top_level.c 
b/src/bin/editor/editor_top_level.c
index 0d462f7..e0bf277 100644
--- a/src/bin/editor/editor_top_level.c
+++ b/src/bin/editor/editor_top_level.c
@@ -58,6 +58,24 @@ editor_image_del(Evas_Object *obj, const char *name, 
Eina_Bool notify)
    return true;
 }
 
+Eina_Bool
+editor_image_set_add(Evas_Object *obj, const char *name, Eina_Bool notify)
+{
+   assert(obj != NULL);
+   assert(name != NULL);
+
+   if (!edje_edit_image_set_add(obj, name))
+     return false;
+
+   if (!editor_save_all(obj))
+     return false;
+   _editor_project_changed();
+
+   if (notify)
+     evas_object_smart_callback_call(ap.win, SIGNAL_EDITOR_IMAGE_SET_ADDED, 
(void *)name);
+   return true;
+}
+
 inline static Eina_Bool
 _image_set_image_attribute_save(Evas_Object *obj, 
Editor_Attribute_Resource_Change *send)
 {
diff --git a/src/bin/resource_manager/resource_manager_react.c 
b/src/bin/resource_manager/resource_manager_react.c
index 4b93896..501c767 100644
--- a/src/bin/resource_manager/resource_manager_react.c
+++ b/src/bin/resource_manager/resource_manager_react.c
@@ -634,6 +634,23 @@ image_deleted(void *data,
 }
 
 static void
+_image_set_added(void *data,
+             Evas_Object *obj __UNUSED__,
+             void *ei)
+{
+   Image_Set2 *res;
+   const char *name = (const char *)ei;
+   Project *project = (Project *)data;
+
+
+   res = mem_calloc(1, sizeof(Image2));
+   res->common.type = RESOURCE2_TYPE_IMAGE_SET;
+   res->common.name = eina_stringshare_add(name);
+
+   project->RM.image_sets = eina_list_append(project->RM.image_sets, res);
+}
+
+static void
 _style_added(void *data,
              Evas_Object *obj __UNUSED__,
              void *ei)
@@ -937,6 +954,7 @@ _resource_callbacks_register(Project *project)
    evas_object_smart_callback_add(ap.win,  SIGNAL_EDITOR_TONE_DELETED, 
_tone_deleted, project);
    evas_object_smart_callback_add(ap.win,  SIGNAL_EDITOR_IMAGE_ADDED, 
_image_added, project);
    evas_object_smart_callback_add(ap.win,  SIGNAL_EDITOR_IMAGE_DELETED, 
image_deleted, project);
+   evas_object_smart_callback_add(ap.win,  SIGNAL_EDITOR_IMAGE_SET_ADDED, 
_image_set_added, project);
    evas_object_smart_callback_add(ap.win,  SIGNAL_EDITOR_STYLE_ADDED, 
_style_added, project);
    evas_object_smart_callback_add(ap.win,  SIGNAL_EDITOR_STYLE_DELETED, 
_style_deleted, project);
    evas_object_smart_callback_add(ap.win,  SIGNAL_EDITOR_STYLE_TAG_CHANGED, 
_style_changed, project);
@@ -972,6 +990,7 @@ _resource_callbacks_unregister(Project *project)
    evas_object_smart_callback_del_full(ap.win,  SIGNAL_EDITOR_TONE_DELETED, 
_tone_deleted, project);
    evas_object_smart_callback_del_full(ap.win,  SIGNAL_EDITOR_IMAGE_ADDED, 
_image_added, project);
    evas_object_smart_callback_del_full(ap.win,  SIGNAL_EDITOR_IMAGE_DELETED, 
image_deleted, project);
+   evas_object_smart_callback_del_full(ap.win,  SIGNAL_EDITOR_IMAGE_SET_ADDED, 
_image_set_added, project);
    evas_object_smart_callback_del_full(ap.win,  SIGNAL_EDITOR_STYLE_ADDED, 
_style_added, project);
    evas_object_smart_callback_del_full(ap.win,  SIGNAL_EDITOR_STYLE_DELETED, 
_style_deleted, project);
    evas_object_smart_callback_del_full(ap.win,  
SIGNAL_EDITOR_STYLE_TAG_CHANGED, _style_changed, project);

-- 


Reply via email to