ajwillia-ms pushed a commit to branch master.

http://git.enlightenment.org/tools/edi.git/commit/?id=f9242b82ab7cacfd07b26cf914893ef8d5884d6c

commit f9242b82ab7cacfd07b26cf914893ef8d5884d6c
Author: Andy Williams <[email protected]>
Date:   Sat Feb 21 14:10:25 2015 +0000

    filesystem: don't refresh on every change
    
    Just do the minimum for now - refresh when we add a file.
    The constant monitoring needs a slicker refresh mechanism.
---
 src/bin/edi_filepanel.c | 29 ++++++++++++++++++++++++-----
 src/bin/edi_main.c      |  1 +
 src/bin/edi_private.h   |  3 +++
 3 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/src/bin/edi_filepanel.c b/src/bin/edi_filepanel.c
index 322a5eb..54c3d81 100644
--- a/src/bin/edi_filepanel.c
+++ b/src/bin/edi_filepanel.c
@@ -8,6 +8,8 @@
 #include <Eio.h>
 #include <elm_widget_fileselector.h>
 
+#include "Edi.h"
+
 #include "edi_filepanel.h"
 
 #include "edi_private.h"
@@ -341,24 +343,41 @@ _populate(Evas_Object *obj,
    else
      lreq->selected = NULL;
 
+   // FIXME re-enable the monitors once we have a less intrusive manner of 
refreshing the file tree
    /* TODO: keep track of monitors so they can be cleaned */
-   //sd->monitor =
-   eio_monitor_add(path);
+   //sd->monitor = eio_monitor_add(path);
    //sd->current = 
    eio_file_stat_ls(path, _ls_filter_cb, _ls_main_cb,
                                   _ls_done_cb, _ls_error_cb, lreq);
 }
 
+static void
+_file_listing_reload(const char *dir)
+{
+   elm_genlist_clear(list);
+   _populate(list, dir, NULL, NULL);
+}
 
-void _file_listing_updated(void *data, int type EINA_UNUSED, void *event 
EINA_UNUSED)
+static void
+_file_listing_updated(void *data, int type EINA_UNUSED, void *event 
EINA_UNUSED)
 {
    const char *dir;
 
    dir = (const char *)data;
    DBG("File created in %s\n", dir);
 
-   elm_genlist_clear(list);
-   _populate(list, dir, NULL, NULL);
+   _file_listing_reload(dir);
+}
+
+void
+_edi_filepanel_reload()
+{
+   char *dir;
+
+   dir = realpath(edi_project_get(), NULL);
+   _file_listing_reload(dir);
+
+   free(dir);
 }
 
 void
diff --git a/src/bin/edi_main.c b/src/bin/edi_main.c
index 3959518..243c354 100644
--- a/src/bin/edi_main.c
+++ b/src/bin/edi_main.c
@@ -449,6 +449,7 @@ _tb_new_create_cb(void *data,
    path = edi_project_file_path_get(name);
 
    fclose(fopen(path, "w"));
+   _edi_filepanel_reload();
    edi_mainview_open_path(eina_stringshare_add(path));
 
    evas_object_del(_edi_new_popup);
diff --git a/src/bin/edi_private.h b/src/bin/edi_private.h
index 4d82d3f..8ab1bb1 100644
--- a/src/bin/edi_private.h
+++ b/src/bin/edi_private.h
@@ -33,4 +33,7 @@ Evas_Object *edi_open(const char *path);
 
 void edi_close();
 
+// TODO remove this once our filepanel is updating gracefully
+void _edi_filepanel_reload();
+
 #endif

-- 


Reply via email to