rimmed pushed a commit to branch master.

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

commit 9907853343978044e79a037b2bd8c5602708a0e3
Author: Tetiana Naumenko <t.naume...@samsung.com>
Date:   Tue Mar 14 19:41:53 2017 +0200

    syntax color: refactor of color_init and color_term
    
    This refactoring is needed in order to further implementation colorful
    text of code in different places in project
    
    Change-Id: I447cc08ae253caef2f0ed144abb731b2d2592f19
---
 src/bin/eflete.c                 | 5 +++++
 src/bin/eflete.h                 | 2 ++
 src/bin/ui/workspace/workspace.c | 5 +----
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/bin/eflete.c b/src/bin/eflete.c
index 4188ac5..f71cbc8 100644
--- a/src/bin/eflete.c
+++ b/src/bin/eflete.c
@@ -21,6 +21,7 @@
 #include "main_window.h"
 #include "shortcuts.h"
 #include "config.h"
+#include "syntax_color.h"
 
 #define EXT ""
 #ifdef _WIN32
@@ -128,6 +129,8 @@ app_init()
 
    ap.last_path = NULL;
 
+   ap.color_data = color_init(eina_strbuf_new());
+
    eina_stringshare_del(conf_path);
    return true;
 }
@@ -135,6 +138,8 @@ app_init()
 Eina_Bool
 app_shutdown()
 {
+   if(ap.color_data)
+     color_term(ap.color_data);
    if (ap.last_path)
      eina_stringshare_del(ap.last_path);
    if (ap.path.theme_edj)
diff --git a/src/bin/eflete.h b/src/bin/eflete.h
index 431a2b7..632ae9e 100644
--- a/src/bin/eflete.h
+++ b/src/bin/eflete.h
@@ -68,6 +68,7 @@ typedef struct _Shortcuts Shortcuts;
 typedef struct _ColorClassData ColorClassData;
 typedef struct _Image_Item Image_Item;
 typedef struct _Colorclass_Item Colorclass_Item;
+typedef struct syntax_color_s color_data;
 
 #include "common_macro.h"
 TODO("delete it, and remake all strings to eina_stringshare or eina_strbuff")
@@ -100,6 +101,7 @@ TODO("delete it, and remake all strings to eina_stringshare 
or eina_strbuff")
 
 struct _App_Data
 {
+   color_data *color_data;
    Elm_Theme *theme;
    Evas_Object *win;
    Evas_Object *win_layout;
diff --git a/src/bin/ui/workspace/workspace.c b/src/bin/ui/workspace/workspace.c
index f2693e5..ad67f8a 100644
--- a/src/bin/ui/workspace/workspace.c
+++ b/src/bin/ui/workspace/workspace.c
@@ -135,7 +135,6 @@ struct _Workspace_Data
    Scroll_Area demo;
    struct {
       Evas_Object *obj;
-      color_data *color_data;
       double size;
    } code;
    Workspace_Mode mode;
@@ -173,7 +172,7 @@ _group_code_get(Workspace_Data *wd)
 
    code = edje_edit_source_generate(wd->group->edit_object);
    str = elm_entry_utf8_to_markup(code);
-   colored = color_apply(wd->code.color_data, str, strlen(str), NULL, NULL);
+   colored = color_apply(ap.color_data, str, strlen(str), NULL, NULL);
 
    free(str);
    eina_stringshare_del(code);
@@ -236,7 +235,6 @@ _workspace_del(void *data,
 
    Workspace_Data *wd = data;
    resource_group_edit_object_unload(wd->group);
-   color_term(wd->code.color_data);
 
    TODO("remove after moving from smart object");
    evas_object_del(wd->normal.layout);
@@ -1614,7 +1612,6 @@ workspace_add(Evas_Object *parent, Group2 *group)
    ENTRY_ADD(wd->panes_h, wd->code.obj, false)
    elm_entry_editable_set(wd->code.obj, false);
    elm_object_part_content_set(wd->panes_h, "right", wd->code.obj);
-   wd->code.color_data = color_init(eina_strbuf_new());
 
    _scroll_area_add(wd, &wd->normal, true);
    elm_object_part_content_set(wd->panes_h, "left", wd->normal.layout);

-- 


Reply via email to