jaehyun pushed a commit to branch master.

http://git.enlightenment.org/tools/enventor.git/commit/?id=ff8136dbf36be6f5b2eb57b878df84743d575974

commit ff8136dbf36be6f5b2eb57b878df84743d575974
Author: Jaehyun Cho <jae_hyun....@samsung.com>
Date:   Tue Apr 5 20:47:42 2016 +0900

    file_browser: Add file browser.
    
    File browser shows "collections" main EDC.
    
    This commit implements T3388.
---
 README                                      |   3 +-
 data/about/ABOUT                            |   3 +-
 data/themes/default/images.edc              |   2 +
 data/themes/default/images/Makefile.am      |   1 +
 data/themes/default/images/file_browser.png | Bin 0 -> 2864 bytes
 data/themes/default/layout_common.edc       |  82 ++++++---
 src/bin/Makefile.am                         |   3 +-
 src/bin/base_gui.c                          |  25 ++-
 src/bin/config_data.c                       |  18 ++
 src/bin/file_browser.c                      | 271 ++++++++++++++++++++++++++++
 src/bin/main.c                              |  10 +-
 src/bin/setting.c                           |   9 +
 src/bin/tools.c                             |  38 ++++
 src/include/Makefile.am                     |   3 +-
 src/include/base_gui.h                      |   2 +
 src/include/common.h                        |   2 +-
 src/include/config_data.h                   |   2 +
 src/include/file_browser.h                  |   4 +
 src/include/tools.h                         |   1 +
 19 files changed, 440 insertions(+), 39 deletions(-)

diff --git a/README b/README
index d65492f..d2bb4fa 100644
--- a/README
+++ b/README
@@ -35,7 +35,8 @@ F2 - New
 F3 - Save
 F4 - Load
 F5 - Toggle Line Number
-F9 - Toggle Tools
+F8 - Toggle Tools
+F9 - Toggle File Browser
 F10 - Toggle EDC Navigator
 F11 - Toggle Status
 F12 - Settings
diff --git a/data/about/ABOUT b/data/about/ABOUT
index cf7b9db..d2f5bf7 100644
--- a/data/about/ABOUT
+++ b/data/about/ABOUT
@@ -17,7 +17,8 @@ F2 - New</br>
 F3 - Save</br>
 F4 - Load</br>
 F5 - Toggle Line Number</br>
-F9 - Toggle Tools</br>
+F8 - Toggle Tools</br>
+F9 - Toggle File Browser</br>
 F10 - Toggle EDC Navigator</br>
 F11 - Toggle Status</br>
 F12 - Settings</br>
diff --git a/data/themes/default/images.edc b/data/themes/default/images.edc
index 3f116d8..38661db 100644
--- a/data/themes/default/images.edc
+++ b/data/themes/default/images.edc
@@ -22,6 +22,7 @@ images {
    image: "live_textblock.png" COMP;
    image: "expand.png" COMP;
    image: "invert.png" COMP;
+   image: "file_browser.png" COMP;
    image: "edc_navigator.png" COMP;
    image: "navi_group.png" COMP;
    image: "navi_rect.png" COMP;
@@ -68,6 +69,7 @@ ICON_GROUP("Swallow", "live_swallow.png")
 ICON_GROUP("Text", "live_text.png")
 ICON_GROUP("Textblock", "live_textblock.png")
 ICON_GROUP("close", "icon_close.png")
+ICON_GROUP("file_browser", "file_browser.png")
 ICON_GROUP("edc_navigator", "edc_navigator.png")
 ICON_GROUP("navi_group", "navi_group.png")
 ICON_GROUP("navi_image", "navi_image.png")
diff --git a/data/themes/default/images/Makefile.am 
b/data/themes/default/images/Makefile.am
index 1a84952..3b78e72 100644
--- a/data/themes/default/images/Makefile.am
+++ b/data/themes/default/images/Makefile.am
@@ -71,6 +71,7 @@ EXTRA_DIST = \
    expand.png \
        invert.png \
        icon_close.png \
+   file_browser.png \
    edc_navigator.png \
        cursor_arrow.png \
        navi_group.png \
diff --git a/data/themes/default/images/file_browser.png 
b/data/themes/default/images/file_browser.png
new file mode 100644
index 0000000..e0358ea
Binary files /dev/null and b/data/themes/default/images/file_browser.png differ
diff --git a/data/themes/default/layout_common.edc 
b/data/themes/default/layout_common.edc
index f9f8c7e..88a630e 100644
--- a/data/themes/default/layout_common.edc
+++ b/data/themes/default/layout_common.edc
@@ -1931,7 +1931,7 @@ group { name: "colorselector_layout";
             rel2.relative: 1.0 1.0;
          }
       }
-         swallow { "elm.swallow.input_green";
+      swallow { "elm.swallow.input_green";
          scale: 1;
          desc {
             align: 0.0 0.0;
@@ -2582,14 +2582,9 @@ group { name: "main_layout";
       swallow { "elm.swallow.panes";
          scale: 1;
          desc { "default";
-            rel1.relative: 0 1;
-            rel2.relative: 1 0;
-            rel1.to_y: "elm.swallow.tools";
-            rel2.to_y: "elm.swallow.statusbar";
-         }
-         desc { "visible";
             rel1 {
-               relative: 0.0 1.0;
+               relative: 1.0 1.0;
+               to_x: "elm.swallow.file_browser";
                to_y: "elm.swallow.tools";
             }
             rel2 {
@@ -2627,21 +2622,49 @@ group { name: "main_layout";
             align: 0.5 1;
          }
       }
-      swallow { "elm.swallow.edc_navigator";
+      swallow { "elm.swallow.file_browser";
          scale: 1;
          desc { "default";
-            rel1.relative: 1 1;
-            rel2.relative: 1.5 0;
-            rel1.to_y: "elm.swallow.tools";
-            rel2.to_y: "elm.swallow.statusbar";
+            rel1 {
+               relative: 0.0 1.0;
+               to_y: "elm.swallow.tools";
+            }
+            rel2 {
+               relative: 0.0 0.0;
+               to_y: "elm.swallow.statusbar";
+            }
             align: 1 0;
-            min: 0 0;
+            min: 200 0;
             max: 0 -1;
             fixed: 1 0;
+            visible: 0;
          }
          desc { "visible";
             inherit: "default";
+            align: 0 0;
+            visible: 1;
+         }
+      }
+      swallow { "elm.swallow.edc_navigator";
+         scale: 1;
+         desc { "default";
+            rel1 {
+               relative: 1.0 1.0;
+               to_y: "elm.swallow.tools";
+            }
+            rel2 {
+               relative: 1.0 0.0;
+               to_y: "elm.swallow.statusbar";
+            }
+            align: 0 0;
             min: 200 0;
+            max: 0 -1;
+            fixed: 1 0;
+            visible: 0;
+         }
+         desc { "visible";
+            inherit: "default";
+            align: 1 0;
             rel1 {
                relative: 1.0 1.0;
                to_y: "elm.swallow.tools";
@@ -2650,10 +2673,23 @@ group { name: "main_layout";
                relative: 1.0 0.0;
                to_y: "elm.swallow.statusbar";
             }
+            visible: 1;
          }
       }
    }
    programs {
+      program { "file_browser_show";
+         signal: "elm,state,file_browser,show";
+         action: STATE_SET "visible" 0.0;
+         target: "elm.swallow.file_browser";
+         transition: DECELERATE 0.25;
+      }
+      program { "file_browser_hide";
+         signal: "elm,state,file_browser,hide";
+         action: STATE_SET "default" 0.0;
+         target: "elm.swallow.file_browser";
+         transition: DECELERATE 0.25;
+      }
       program { "edc_navigator_show";
          signal: "elm,state,edc_navigator,show";
          action: STATE_SET "visible" 0.0;
@@ -2663,22 +2699,8 @@ group { name: "main_layout";
       program { "edc_navigator_hide";
          signal: "elm,state,edc_navigator,hide";
          action: STATE_SET "default" 0.0;
-         target: "elm.swallow.panes";
-         transition: DECELERATE 0.25;
-      }
-      program { name: "navigator_hide";
-         signal: "elm,state,edc_navigator,hide";
-         action: STATE_SET "default" 0.0;
-         transition: LINEAR 0.25;
-         in: 0.05 0.0;
          target: "elm.swallow.edc_navigator";
-      }
-      program { name: "navigator_show";
-         signal: "elm,state,edc_navigator,show";
-         action: STATE_SET "visible" 0.0;
-         transition: LINEAR 0.25;
-         in: 0.05 0.0;
-         target: "elm.swallow.panes";
+         transition: DECELERATE 0.25;
       }
       program { name: "statusbar_show";
          signal: "elm,state,statusbar,show";
@@ -2719,7 +2741,7 @@ group { name: "main_layout";
 }
 
 group { name: "padding3_layout";
-    parts {
+   parts {
       part { name: "elm.swallow.content";
          type: SWALLOW;
          description { state: "default" 0.0;
diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
index 57cecd5..8ba9f3f 100644
--- a/src/bin/Makefile.am
+++ b/src/bin/Makefile.am
@@ -29,7 +29,8 @@ enventor_SOURCES = \
        live_edit.c \
        console.c \
        file_mgr.c \
-       edc_navigator.c
+       edc_navigator.c \
+       file_browser.c
 
 enventor_LDADD = \
        $(top_builddir)/src/lib/libenventor.la \
diff --git a/src/bin/base_gui.c b/src/bin/base_gui.c
index 8344202..1df657f 100644
--- a/src/bin/base_gui.c
+++ b/src/bin/base_gui.c
@@ -97,6 +97,19 @@ base_statusbar_toggle(Eina_Bool toggle)
      elm_object_signal_emit(bd->layout, "elm,state,statusbar,hide", "");
 }
 
+void base_file_browser_toggle(Eina_Bool toggle)
+{
+   base_data *bd = g_bd;
+   assert(bd);
+
+   if (toggle) config_file_browser_set(!config_file_browser_get());
+
+   if (config_file_browser_get())
+     elm_object_signal_emit(bd->layout, "elm,state,file_browser,show", "");
+   else
+     elm_object_signal_emit(bd->layout, "elm,state,file_browser,hide", "");
+}
+
 void base_edc_navigator_toggle(Eina_Bool toggle)
 {
    base_data *bd = g_bd;
@@ -229,6 +242,7 @@ base_gui_term(void)
 
    ecore_timer_del(bd->edc_navi_update_timer);
    ecore_timer_del(bd->edc_navi_reload_timer);
+   file_browser_term();
    edc_navigator_term();
    panes_term();
 
@@ -246,8 +260,8 @@ base_edc_navigator_group_update(const char *group_name)
 
    ecore_timer_del(bd->edc_navi_update_timer);
    bd->edc_navi_update_timer = ecore_timer_add(EDC_NAVIGATOR_UPDATE_TIME,
-                                             edc_navigator_update_timer_cb,
-                                             group_name);
+                                               edc_navigator_update_timer_cb,
+                                               group_name);
 }
 
 void
@@ -327,11 +341,16 @@ base_gui_init(void)
    if (config_console_get())
      panes_editors_full_view(EINA_TRUE);
 
+   //File Browser
+   Evas_Object *file_browser = file_browser_init(layout);
+   elm_object_part_content_set(layout, "elm.swallow.file_browser",
+                               file_browser);
+   file_browser_edc_file_set(config_input_path_get());
+
    //EDC Navigator
    Evas_Object *edc_navigator = edc_navigator_init(layout);
    elm_object_part_content_set(layout, "elm.swallow.edc_navigator",
                                edc_navigator);
-
    bd->win = win;
    bd->layout = layout;
    bd->console = console;
diff --git a/src/bin/config_data.c b/src/bin/config_data.c
index f788dd4..e7008c9 100644
--- a/src/bin/config_data.c
+++ b/src/bin/config_data.c
@@ -39,6 +39,7 @@ typedef struct config_s
    Eina_Bool console;
    Eina_Bool auto_complete;
    Eina_Bool smart_undo_redo;
+   Eina_Bool file_browser;
    Eina_Bool edc_navigator;
 } config_data;
 
@@ -185,6 +186,7 @@ config_load(void)
         cd->auto_complete = EINA_TRUE;
         cd->version = ENVENTOR_CONFIG_VERSION;
         cd->smart_undo_redo = EINA_FALSE;
+        cd->file_browser = EINA_TRUE;
         cd->edc_navigator = EINA_TRUE;
      }
 
@@ -303,6 +305,8 @@ eddc_init(void)
                                     auto_complete, EET_T_UCHAR);
    EET_DATA_DESCRIPTOR_ADD_BASIC(edd_base, config_data, "smart_undo_redo",
                                     smart_undo_redo, EET_T_UCHAR);
+   EET_DATA_DESCRIPTOR_ADD_BASIC(edd_base, config_data, "file_browser",
+                                    file_browser, EET_T_UCHAR);
    EET_DATA_DESCRIPTOR_ADD_BASIC(edd_base, config_data, "edc_navigator",
                                     edc_navigator, EET_T_UCHAR);
 }
@@ -912,6 +916,20 @@ config_tools_set(Eina_Bool enabled)
 }
 
 void
+config_file_browser_set(Eina_Bool enabled)
+{
+   config_data *cd = g_cd;
+   cd->file_browser = enabled;
+}
+
+Eina_Bool
+config_file_browser_get(void)
+{
+   config_data *cd = g_cd;
+   return cd->file_browser;
+}
+
+void
 config_edc_navigator_set(Eina_Bool enabled)
 {
    config_data *cd = g_cd;
diff --git a/src/bin/file_browser.c b/src/bin/file_browser.c
new file mode 100644
index 0000000..de9e744
--- /dev/null
+++ b/src/bin/file_browser.c
@@ -0,0 +1,271 @@
+#include "common.h"
+
+typedef enum
+{
+   FILE_BROWSER_FILE_TYPE_DIR = 0,
+   FILE_BROWSER_FILE_TYPE_FILE
+} File_Browser_File_Type;
+
+typedef struct file_browser_file_s brows_file;
+struct file_browser_file_s
+{
+   char *path;
+   char *name;
+
+   File_Browser_File_Type type;
+
+   Eina_List *sub_file_list; //NULL if file type is not directory.
+
+   Elm_Object_Item *it;
+};
+
+typedef struct file_browser_s
+{
+   brows_file *col_edc;   //collections edc
+
+   Evas_Object *genlist;
+   Elm_Genlist_Item_Class *itc;
+   Elm_Genlist_Item_Class *group_itc;
+} brows_data;
+
+static brows_data *g_bd = NULL;
+
+/*****************************************************************************/
+/* Internal method implementation                                            */
+/*****************************************************************************/
+
+static void brows_file_list_free(Eina_List *file_list);
+
+static void
+gl_file_selected_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+   brows_file *file = data;
+   Elm_Object_Item *it = event_info;
+}
+
+static Elm_Object_Item *
+file_genlist_item_append(char *file_name, Elm_Object_Item *parent_it,
+                         Elm_Genlist_Item_Type it_type, brows_file *file)
+{
+   brows_data *bd = g_bd;
+   if (!bd) return NULL;
+
+   if (!file_name) return NULL;
+   if (!file) return NULL;
+
+   Elm_Object_Item *it =
+      elm_genlist_item_append(bd->genlist,
+                              bd->itc,             /* item class */
+                              file_name,           /* item data */
+                              parent_it,           /* parent */
+                              it_type,             /* item type */
+                              gl_file_selected_cb, /* select cb */
+                              file);               /* select cb data */
+   return it;
+}
+
+static char *
+gl_file_text_get_cb(void *data, Evas_Object *obj EINA_UNUSED,
+                    const char *part EINA_UNUSED)
+{
+   char *file_name = data;
+   return strdup(file_name);
+}
+
+/* Find including sub edc files and Create a list of brows_file. */
+static Eina_List *
+sub_file_list_create(brows_file *file)
+{
+   brows_data *bd = g_bd;
+   if (!bd) return NULL;
+
+   if (!file) return NULL;
+   if (file->type != FILE_BROWSER_FILE_TYPE_DIR) return NULL;
+
+   Eina_List *sub_file_list = NULL;
+
+   Eina_List *sub_file_name_list = ecore_file_ls(file->path);
+   Eina_List *l = NULL;
+   char *sub_file_name = NULL;
+   char *dir_path = file->path;
+   EINA_LIST_FOREACH(sub_file_name_list, l, sub_file_name)
+     {
+        if (!strcmp(".", sub_file_name) || !strcmp("..", sub_file_name))
+          continue;
+
+        brows_file *sub_file = calloc(1, sizeof(brows_file));
+
+        int sub_file_path_len = strlen(dir_path) + strlen(sub_file_name) + 2;
+        char *sub_file_path = calloc(1, sizeof(char) * (sub_file_path_len));
+        snprintf(sub_file_path, sub_file_path_len, "%s/%s", dir_path,
+                 sub_file_name);
+        sub_file->path = sub_file_path;
+        sub_file->name = strdup(sub_file_name);
+
+        if (ecore_file_is_dir(sub_file_path))
+          sub_file->type = FILE_BROWSER_FILE_TYPE_DIR;
+        else
+          sub_file->type = FILE_BROWSER_FILE_TYPE_FILE;
+
+        sub_file->sub_file_list = sub_file_list_create(sub_file);
+
+        sub_file->it = NULL;
+
+        sub_file_list = eina_list_append(sub_file_list, sub_file);
+     }
+
+   EINA_LIST_FREE(sub_file_name_list, sub_file_name)
+     {
+        free(sub_file_name);
+     }
+
+   return sub_file_list;
+}
+
+static void
+brows_file_free(brows_file *file)
+{
+   if (!file) return;
+
+   if (file->path) free(file->path);
+   if (file->name) free(file->name);
+
+   if (file->sub_file_list)
+     brows_file_list_free(file->sub_file_list);
+}
+
+static void
+brows_file_list_free(Eina_List *file_list)
+{
+   if (!file_list) return;
+
+   brows_file *file = NULL;
+   EINA_LIST_FREE(file_list, file)
+     {
+        brows_file_free(file);
+     }
+}
+
+static brows_file *
+file_set_internal(const char *file_path, File_Browser_File_Type file_type)
+{
+   brows_data *bd = g_bd;
+   if (!bd) return;
+
+   if (!file_path) return;
+
+   brows_file *file = calloc(1, sizeof(brows_file));
+   if (!file)
+     {
+        EINA_LOG_ERR("Failed to allocate Memory!");
+        return NULL;
+     }
+
+   file->path = ecore_file_realpath(file_path);
+   file->name = strdup(ecore_file_file_get(file->path));
+
+   file->type = file_type;
+
+   if (file_type == FILE_BROWSER_FILE_TYPE_DIR)
+     file->sub_file_list = sub_file_list_create(file);
+   else
+     file->sub_file_list = NULL;
+
+   Elm_Genlist_Item_Type it_type = ELM_GENLIST_ITEM_NONE;
+   if (file->sub_file_list)
+     it_type = ELM_GENLIST_ITEM_TREE;
+   file->it = file_genlist_item_append(file->name, NULL, it_type, file);
+
+   return file;
+}
+
+/*****************************************************************************/
+/* Externally accessible calls                                               */
+/*****************************************************************************/
+
+/* Set "collections" edc file. */
+void
+file_browser_edc_file_set(const char *edc_file)
+{
+   brows_data *bd = g_bd;
+   if (!bd) return;
+
+   if (!edc_file) return;
+   if (!ecore_file_exists(edc_file)) return;
+
+   char *ext = strrchr(edc_file, '.');
+   if (!ext || (strlen(ext) != 4) || strncmp(ext, ".edc", 4))
+     return;
+
+   if (bd->col_edc)
+     {
+        if (!strcmp(edc_file, bd->col_edc->path))
+          return;
+
+        brows_file_free(bd->col_edc);
+        bd->col_edc = NULL;
+     }
+
+   Elm_Object_Item *group_it =
+      elm_genlist_item_append(bd->genlist,
+                              bd->group_itc,         /* item class */
+                              "Collections",         /* item data */
+                              NULL,                  /* parent */
+                              ELM_GENLIST_ITEM_NONE, /* item type */
+                              NULL,                  /* select_cb */
+                              NULL);                 /* select_cb data */
+   elm_genlist_item_select_mode_set(group_it,
+                                    ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+
+   brows_file *edc = file_set_internal(edc_file, FILE_BROWSER_FILE_TYPE_FILE);
+   if (!edc) return;
+   bd->col_edc = edc;
+}
+
+Evas_Object *
+file_browser_init(Evas_Object *parent)
+{
+   brows_data *bd = calloc(1, sizeof(brows_data));
+   if (!bd)
+     {
+        EINA_LOG_ERR("Failed to allocate Memory!");
+        return NULL;
+     }
+   g_bd = bd;
+
+   Evas_Object *genlist = elm_genlist_add(parent);
+   elm_object_focus_allow_set(genlist, EINA_FALSE);
+
+   //Item Class
+   Elm_Genlist_Item_Class *itc;
+   itc = elm_genlist_item_class_new();
+   itc->item_style = "no_icon";
+   itc->func.text_get = gl_file_text_get_cb;
+   bd->itc = itc;
+
+   //Group Index Item Class
+   Elm_Genlist_Item_Class *group_itc;
+   group_itc = elm_genlist_item_class_new();
+   group_itc->item_style = "group_index";
+   group_itc->func.text_get = gl_file_text_get_cb;
+   bd->group_itc = group_itc;
+
+   bd->genlist = genlist;
+
+   return genlist;
+}
+
+void
+file_browser_term(void)
+{
+   brows_data *bd = g_bd;
+   if (!bd) return;
+
+   if (bd->col_edc) brows_file_free(bd->col_edc);
+
+   elm_genlist_item_class_free(bd->itc);
+   elm_genlist_item_class_free(bd->group_itc);
+
+   free(bd);
+   g_bd = NULL;
+}
diff --git a/src/bin/main.c b/src/bin/main.c
index d6dee66..1a03a32 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -44,6 +44,7 @@ tools_update(void)
    tools_dummy_update(EINA_FALSE);
    tools_mirror_mode_update(EINA_FALSE);
    tools_status_update(EINA_FALSE);
+   tools_file_browser_update(EINA_FALSE);
    tools_edc_navigator_update(EINA_FALSE);
 }
 
@@ -790,12 +791,19 @@ keygrabber_key_down_cb(void *data, Evas *e EINA_UNUSED,
         return;
      }
    //Tools
-   if (!strcmp(ev->key, "F9"))
+   if (!strcmp(ev->key, "F8"))
      {
         enventor_object_ctxpopup_dismiss(ad->enventor);
         base_tools_toggle(EINA_TRUE);
         return;
      }
+   //File Browser
+   if (!strcmp(ev->key, "F9"))
+     {
+        enventor_object_ctxpopup_dismiss(ad->enventor);
+        tools_file_browser_update(EINA_TRUE);
+        return;
+     }
    //EDC Navigator
    if (!strcmp(ev->key, "F10"))
      {
diff --git a/src/bin/setting.c b/src/bin/setting.c
index 7f20953..9d5db6a 100644
--- a/src/bin/setting.c
+++ b/src/bin/setting.c
@@ -23,6 +23,7 @@ struct setting_s
    Evas_Object *toggle_highlight;
    Evas_Object *toggle_swallow;
    Evas_Object *toggle_stats;
+   Evas_Object *toggle_file_browser;
    Evas_Object *toggle_edc_navigator;
    Evas_Object *toggle_tools;
    Evas_Object *toggle_console;
@@ -125,6 +126,7 @@ setting_apply_btn_cb(void *data, Evas_Object *obj 
EINA_UNUSED,
    config_stats_bar_set(elm_check_state_get(sd->toggle_stats));
    config_part_highlight_set(elm_check_state_get(sd->toggle_highlight));
    config_dummy_parts_set(elm_check_state_get(sd->toggle_swallow));
+   config_file_browser_set(elm_check_state_get(sd->toggle_file_browser));
    config_edc_navigator_set(elm_check_state_get(sd->toggle_edc_navigator));
    text_setting_config_set();
 
@@ -172,6 +174,7 @@ setting_reset_btn_cb(void *data EINA_UNUSED, Evas_Object 
*obj EINA_UNUSED,
    elm_check_state_set(sd->toggle_stats, config_stats_bar_get());
    elm_check_state_set(sd->toggle_highlight, config_part_highlight_get());
    elm_check_state_set(sd->toggle_swallow, config_dummy_parts_get());
+   elm_check_state_set(sd->toggle_file_browser, config_file_browser_get());
    elm_check_state_set(sd->toggle_edc_navigator, config_edc_navigator_get());
 
    //Reset view scale
@@ -421,6 +424,11 @@ general_layout_create(setting_data *sd, Evas_Object 
*parent)
                                              config_stats_bar_get());
    elm_box_pack_end(box, toggle_stats);
 
+   //Toggle (File Browser)
+   Evas_Object *toggle_file_browser = toggle_create(box, _("File Browser"),
+                                                    config_file_browser_get());
+   elm_box_pack_end(box, toggle_file_browser);
+
    //Toggle (EDC Navigator)
    Evas_Object *toggle_edc_navigator = toggle_create(box, _("EDC Navigator"),
                                                config_edc_navigator_get());
@@ -447,6 +455,7 @@ general_layout_create(setting_data *sd, Evas_Object *parent)
    sd->toggle_highlight = toggle_highlight;
    sd->toggle_swallow = toggle_swallow;
    sd->toggle_stats = toggle_stats;
+   sd->toggle_file_browser = toggle_file_browser;
    sd->toggle_edc_navigator = toggle_edc_navigator;
    sd->toggle_tools = toggle_tools;
    sd->toggle_console = toggle_console;
diff --git a/src/bin/tools.c b/src/bin/tools.c
index e22bc31..8157016 100644
--- a/src/bin/tools.c
+++ b/src/bin/tools.c
@@ -8,6 +8,7 @@ typedef struct tools_s
 {
    Evas_Object *swallow_btn;
    Evas_Object *status_btn;
+   Evas_Object *file_browser_btn;
    Evas_Object *edc_navigator_btn;
    Evas_Object *lines_btn;
    Evas_Object *highlight_btn;
@@ -61,6 +62,13 @@ lines_cb(void *data EINA_UNUSED, Evas_Object *obj 
EINA_UNUSED,
 }
 
 static void
+file_browser_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
+                void *event_info EINA_UNUSED)
+{
+   tools_file_browser_update(EINA_TRUE);
+}
+
+static void
 edc_navigator_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
                  void *event_info EINA_UNUSED)
 {
@@ -274,6 +282,13 @@ tools_init(Evas_Object *parent)
    elm_box_pack_end(box, btn);
    td->console_btn = btn;
 
+   btn = tools_btn_create(box, "file_browser", _("File Browser (F9)"),
+                          file_browser_cb);
+   evas_object_size_hint_weight_set(btn, 0, EVAS_HINT_EXPAND);
+   evas_object_size_hint_align_set(btn, 1.0, EVAS_HINT_FILL);
+   elm_box_pack_end(box, btn);
+   td->file_browser_btn = btn;
+
    btn = tools_btn_create(box, "edc_navigator", _("EDC Navigator (F10)"),
                           edc_navigator_cb);
    evas_object_size_hint_weight_set(btn, 0, EVAS_HINT_EXPAND);
@@ -341,6 +356,29 @@ tools_highlight_update(Eina_Bool toggle)
 }
 
 void
+tools_file_browser_update(Eina_Bool toggle)
+{
+   tools_data *td = g_td;
+   if (!td) return;
+
+   if (toggle) config_file_browser_set(!config_file_browser_get());
+
+   base_file_browser_toggle(EINA_FALSE);
+
+   //Toggle on/off
+   if (config_file_browser_get())
+     {
+        elm_object_signal_emit(td->file_browser_btn, "icon,highlight,enabled",
+                               "");
+     }
+   else
+     {
+        elm_object_signal_emit(td->file_browser_btn, "icon,highlight,disabled",
+                               "");
+     }
+}
+
+void
 tools_edc_navigator_update(Eina_Bool toggle)
 {
    tools_data *td = g_td;
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index 3665827..773a951 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -16,4 +16,5 @@ EXTRA_DIST = common.h \
        live_edit.h \
        console.h \
        file_mgr.h \
-       edc_navigator.h
+       edc_navigator.h \
+       file_browser.h
diff --git a/src/include/base_gui.h b/src/include/base_gui.h
index 2b62a3c..965d02a 100644
--- a/src/include/base_gui.h
+++ b/src/include/base_gui.h
@@ -1,5 +1,6 @@
 #include "panes.h"
 #include "edc_navigator.h"
+#include "file_browser.h"
 
 #define EDC_NAVIGATOR_UPDATE_TIME 0.25
 
@@ -24,6 +25,7 @@ void base_gui_term(void);
 void base_console_reset(void);
 void base_error_msg_set(const char *msg);
 void base_console_full_view(void);
+void base_file_browser_toggle(Eina_Bool toggle);
 void base_edc_navigator_toggle(Eina_Bool toggle);
 void base_edc_navigator_reload(void);
 void base_edc_navigator_group_update(const char *group_name);
diff --git a/src/include/common.h b/src/include/common.h
index 2376779..8be3235 100644
--- a/src/include/common.h
+++ b/src/include/common.h
@@ -54,7 +54,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
 
 #define ROUNDING(x, dig) (floor((x) * pow(10, dig) + 0.5) / pow(10, dig))
 
-#define ENVENTOR_CONFIG_VERSION 7
+#define ENVENTOR_CONFIG_VERSION 8
 
 #define EVENT_KEY_MODIFIER_CHECK(NAME, MASK) \
   ((MASK & ECORE_EVENT_MODIFIER_##NAME) && \
diff --git a/src/include/config_data.h b/src/include/config_data.h
index 7fbbce5..562a6b5 100644
--- a/src/include/config_data.h
+++ b/src/include/config_data.h
@@ -58,5 +58,7 @@ void config_win_size_get(Evas_Coord *w, Evas_Coord *h);
 void config_win_size_set(Evas_Coord w, Evas_Coord h);
 void config_smart_undo_redo_set(Eina_Bool smart_undo_redo);
 Eina_Bool config_smart_undo_redo_get(void);
+void config_file_browser_set(Eina_Bool enabled);
+Eina_Bool config_file_browser_get(void);
 void config_edc_navigator_set(Eina_Bool enabled);
 Eina_Bool config_edc_navigator_get(void);
diff --git a/src/include/file_browser.h b/src/include/file_browser.h
new file mode 100644
index 0000000..348f7fa
--- /dev/null
+++ b/src/include/file_browser.h
@@ -0,0 +1,4 @@
+Evas_Object *file_browser_init(Evas_Object *parent);
+void file_browser_term(void);
+void file_browser_workspace_set(const char *workspace_dir);
+void file_browser_edc_file_set(const char *edc_file);
diff --git a/src/include/tools.h b/src/include/tools.h
index 8df325b..56ed3ea 100644
--- a/src/include/tools.h
+++ b/src/include/tools.h
@@ -6,6 +6,7 @@ void tools_lines_update(Eina_Bool toggle);
 void tools_dummy_update(Eina_Bool toggle);
 void tools_mirror_mode_update(Eina_Bool toggle);
 void tools_status_update(Eina_Bool toggle);
+void tools_file_browser_update(Eina_Bool toggle);
 void tools_edc_navigator_update(Eina_Bool toggle);
 void tools_goto_update(void);
 void tools_search_update(void);

-- 


Reply via email to