rimmed pushed a commit to branch master.

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

commit 7fc6e57726565afd71ad13c26d6c65ad7fb0f28a
Author: Vitalii Vorobiov <vi.vorob...@samsung.com>
Date:   Tue Sep 6 14:10:49 2016 +0300

    resource_manager2: move edje_edit_image_add/del function under editor
---
 src/bin/Makefile.am                       |  1 +
 src/bin/editor/banned_edje_edit_api.h     |  4 +--
 src/bin/editor/editor.h                   |  7 ++++
 src/bin/editor/editor_top_level.c         | 58 +++++++++++++++++++++++++++++++
 src/bin/project_manager/project_manager.c |  4 +--
 src/bin/ui/image_manager.c                | 10 ++----
 6 files changed, 72 insertions(+), 12 deletions(-)

diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
index 1614188..0f4314d 100644
--- a/src/bin/Makefile.am
+++ b/src/bin/Makefile.am
@@ -87,6 +87,7 @@ libete_a_SOURCES = \
 ../../src/bin/editor/history.c \
 ../../src/bin/editor/default.c \
 ../../src/bin/editor/editor_general.c \
+../../src/bin/editor/editor_top_level.c \
 ../../src/bin/editor/editor_group.c \
 ../../src/bin/editor/editor_part.c \
 ../../src/bin/editor/editor_states.c \
diff --git a/src/bin/editor/banned_edje_edit_api.h 
b/src/bin/editor/banned_edje_edit_api.h
index 7c963aa..fea958f 100644
--- a/src/bin/editor/banned_edje_edit_api.h
+++ b/src/bin/editor/banned_edje_edit_api.h
@@ -220,8 +220,8 @@
 //#pragma GCC poison edje_edit_font_del
 
 /* Images API */
-//#pragma GCC poison edje_edit_image_add
-//#pragma GCC poison edje_edit_image_del
+#pragma GCC poison edje_edit_image_add
+#pragma GCC poison edje_edit_image_del
 //#pragma GCC poison edje_edit_image_replace
 //#pragma GCC poison edje_edit_image_data_add
 #pragma GCC poison edje_edit_state_image_set
diff --git a/src/bin/editor/editor.h b/src/bin/editor/editor.h
index dc3cd61..a2a129d 100644
--- a/src/bin/editor/editor.h
+++ b/src/bin/editor/editor.h
@@ -221,6 +221,13 @@ typedef enum {
 void
 _editor_project_changed();
 
+/* Top Level Blocks */
+Eina_Bool
+editor_image_add(Evas_Object *obj, const char *selected, Eina_Bool notify) 
EINA_WARN_UNUSED_RESULT;
+
+Eina_Bool
+editor_image_del(Evas_Object *obj, const char *selected, Eina_Bool notify) 
EINA_WARN_UNUSED_RESULT;
+
 /* General */
 Eina_Bool
 editor_save(Evas_Object *edit_object) EINA_WARN_UNUSED_RESULT;
diff --git a/src/bin/editor/editor_top_level.c 
b/src/bin/editor/editor_top_level.c
new file mode 100644
index 0000000..333cf53
--- /dev/null
+++ b/src/bin/editor/editor_top_level.c
@@ -0,0 +1,58 @@
+/*
+ * Edje Theme Editor
+ * Copyright (C) 2013-2015 Samsung Electronics.
+ *
+ * This file is part of Edje Theme Editor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; If not, see www.gnu.org/licenses/lgpl.html.
+ */
+
+#define ALLOW_DIRECT_EDJE_EDIT_CALLS
+#include "editor.h"
+#include "editor_macro.h"
+#include "change.h"
+#include "diff.h"
+
+extern int _editor_signals_blocked;
+
+Eina_Bool
+editor_image_add(Evas_Object *obj, const char *name, Eina_Bool notify)
+{
+   assert(obj != NULL);
+   assert(name != NULL);
+
+   CRIT_ON_FAIL(edje_edit_image_add(obj, name));
+
+   if (!editor_save(obj))
+     return false; /* i hope it will never happen */
+   _editor_project_changed();
+   if (notify)
+     evas_object_smart_callback_call(ap.win, SIGNAL_EDITOR_IMAGE_ADDED, (void 
*)name);
+   return true;
+}
+
+Eina_Bool
+editor_image_del(Evas_Object *obj, const char *name, Eina_Bool notify)
+{
+   assert(obj != NULL);
+   assert(name != NULL);
+
+   CRIT_ON_FAIL(edje_edit_image_del(obj, name));
+
+   if (!editor_save(obj))
+     return false; /* i hope it will never happen */
+   _editor_project_changed();
+   if (notify)
+     evas_object_smart_callback_call(ap.win, SIGNAL_EDITOR_IMAGE_DELETED, 
(void *)name);
+   return true;
+}
diff --git a/src/bin/project_manager/project_manager.c 
b/src/bin/project_manager/project_manager.c
index 0db705f..3916eb2 100644
--- a/src/bin/project_manager/project_manager.c
+++ b/src/bin/project_manager/project_manager.c
@@ -437,7 +437,7 @@ _project_dummy_image_add(Project *project)
 
    edje_object_file_set(edje_edit_obj, project->saved_edj, 
EFLETE_INTERNAL_GROUP_NAME);
    snprintf(buf, sizeof(buf), "%s"EFLETE_DUMMY_IMAGE_NAME, ap.path.image_path);
-   edje_edit_image_add(edje_edit_obj, buf);
+   CRIT_ON_FAIL(editor_image_add(edje_edit_obj, buf, false));
 
    evas_object_del(edje_edit_obj);
    ecore_evas_free(project->ecore_evas);
@@ -1149,7 +1149,7 @@ pm_project_group_import(Project *project, const char 
*edj, const char *group)
         evas_object_del(img);
         THREAD_CONTEXT_SWITCH_END;
 
-        CRIT_ON_FAIL(edje_edit_image_add(project->global_object, res_file));
+        CRIT_ON_FAIL(editor_image_add(ap.project->global_object, res_file, 
false));
         res = (External_Resource *)resource_add(data, RESOURCE_TYPE_IMAGE);
         res->source = eina_stringshare_add(data);
         resource_insert(&project->images, (Resource *)res);
diff --git a/src/bin/ui/image_manager.c b/src/bin/ui/image_manager.c
index 2020fb2..0c70afe 100644
--- a/src/bin/ui/image_manager.c
+++ b/src/bin/ui/image_manager.c
@@ -307,10 +307,7 @@ _on_image_done(void *data __UNUSED__,
              resource_free((Resource *)res);
              continue;
           }
-        edje_edit_image_add(ap.project->global_object, selected);
-        CRIT_ON_FAIL(editor_save(ap.project->global_object));
-        TODO("Remove this line once edje_edit_image_add would be added into 
Editor Modulei and saving would work properly")
-        ap.project->changed = true;
+        CRIT_ON_FAIL(editor_image_add(ap.project->global_object, selected, 
true));
 
         it = (Image_Item *)mem_malloc(sizeof(Image_Item));
         it->image_name = eina_stringshare_add(file_name);
@@ -382,7 +379,7 @@ _image_del_cb(void *data __UNUSED__,
           {
              ecore_file_unlink(res->path);
              elm_object_item_del(grid_item);
-             edje_edit_image_del(ap.project->global_object, it->image_name);
+             CRIT_ON_FAIL(editor_image_del(ap.project->global_object, 
it->image_name, true));
              resource_remove(&ap.project->images, (Resource *)res);
              resource_free((Resource *)res);
           }
@@ -391,9 +388,6 @@ _image_del_cb(void *data __UNUSED__,
      }
 
    evas_object_smart_callback_call(ap.win, SIGNAL_IMAGE_SELECTED, NULL);
-   CRIT_ON_FAIL(editor_save(ap.project->global_object));
-   TODO("Remove this line once edje_edit_image_del would be added into Editor 
Modulei and saving would work properly")
-   ap.project->changed = true;
    elm_object_disabled_set(mng.del_button, true);
 }
 

-- 


Reply via email to