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.
This commit is contained in:
Andy Williams 2015-02-21 14:10:25 +00:00
parent bf81658432
commit f9242b82ab
3 changed files with 28 additions and 5 deletions

View File

@ -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

View File

@ -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);

View File

@ -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