okra pushed a commit to branch master.

http://git.enlightenment.org/apps/ephoto.git/commit/?id=a8cd52c26632e8837006647085cc0ebf06986b83

commit a8cd52c26632e8837006647085cc0ebf06986b83
Author: Stephen okra Houston <[email protected]>
Date:   Tue Aug 2 13:27:01 2016 -0500

    Ephoto: Move back to using EIO for file system monitoring
---
 src/bin/ephoto.h                   |   6 +-
 src/bin/ephoto_directory_browser.c | 207 +++++++++++++++++++++++++++----------
 src/bin/ephoto_main.c              |  80 +++++++++-----
 src/bin/ephoto_single_browser.c    |  30 ++++--
 4 files changed, 231 insertions(+), 92 deletions(-)

diff --git a/src/bin/ephoto.h b/src/bin/ephoto.h
index 187f601..c0c7b78 100644
--- a/src/bin/ephoto.h
+++ b/src/bin/ephoto.h
@@ -263,7 +263,8 @@ struct _Ephoto
    Eina_Bool folders_toggle;
    Eina_Bool editor_blocking;
 
-   Ecore_File_Monitor *monitor;
+   Eio_Monitor *monitor;
+   Eina_List *monitor_handlers;
    Ecore_Thread *file_thread;
    Eina_List *file_pos;
    Eina_List *upload_handlers;
@@ -301,7 +302,8 @@ struct _Ephoto_Entry
    const char *label;
    double size;
    Ephoto *ephoto;
-   Ecore_File_Monitor *monitor;
+   Eio_Monitor *monitor;
+   Eina_List *monitor_handlers;
    Elm_Object_Item *item;
    Elm_Object_Item *parent;
    Eina_List *free_listeners;
diff --git a/src/bin/ephoto_directory_browser.c 
b/src/bin/ephoto_directory_browser.c
index ac637f3..1818227 100644
--- a/src/bin/ephoto_directory_browser.c
+++ b/src/bin/ephoto_directory_browser.c
@@ -21,7 +21,8 @@ struct _Ephoto_Directory_Browser
    Eio_File *ls;
    Eina_Bool dirs_only;
    Eina_Bool thumbs_only;
-   Ecore_File_Monitor *monitor;
+   Eio_Monitor *monitor;
+   Eina_List *monitor_handlers;
    Eina_List *handlers;
    Eina_List *todo_items;
    Ecore_Job *change_dir_job;
@@ -706,38 +707,40 @@ _todo_items_free(Ephoto_Directory_Browser *db)
    db->todo_items = NULL;
 }
 
-static void
-_monitor_cb(void *data, Ecore_File_Monitor *em EINA_UNUSED,
-    Ecore_File_Event event, const char *path)
+static Eina_Bool
+_monitor_cb(void *data, int type,
+    void *event)
 {
    Elm_Object_Item *item;
    Ephoto_Entry *entry = data;
    Ephoto_Entry *e;
+   Ecore_Event_Handler *handler;
+   Eio_Monitor_Event *ev = event;
    char file[PATH_MAX], dir[PATH_MAX];
    const Elm_Genlist_Item_Class *ic;
    char buf[PATH_MAX];
 
    if (!entry)
-     return;
+     return ECORE_CALLBACK_PASS_ON;
 
-   snprintf(file, PATH_MAX, "%s", path);
+   snprintf(file, PATH_MAX, "%s", ev->filename);
    snprintf(dir, PATH_MAX, "%s", ecore_file_dir_get(file));
 
    if (strcmp(entry->path, dir))
-     return;
-   if (event == ECORE_FILE_EVENT_CREATED_DIRECTORY)
+     return ECORE_CALLBACK_PASS_ON;
+   if (type == EIO_MONITOR_DIRECTORY_CREATED)
      {
-        if (!ecore_file_is_dir(path))
-          return;
-        if (ephoto_entry_exists(entry->ephoto, path))
-          return;
+        if (!ecore_file_is_dir(ev->filename))
+          return ECORE_CALLBACK_PASS_ON;
+        if (ephoto_entry_exists(entry->ephoto, ev->filename))
+          return ECORE_CALLBACK_PASS_ON;
  
         if (elm_genlist_item_type_get(entry->item) == ELM_GENLIST_ITEM_TREE &&
             elm_genlist_item_expanded_get(entry->item) == EINA_TRUE)
           {
              ic = _ephoto_dir_tree_class;
-             snprintf(buf, PATH_MAX, "%s", path);
-             e = ephoto_entry_new(entry->ephoto, path, basename(buf),
+             snprintf(buf, PATH_MAX, "%s", ev->filename);
+             e = ephoto_entry_new(entry->ephoto, ev->filename, basename(buf),
                  EINA_FILE_DIR);
              e->genlist = entry->genlist;
              e->parent = entry->item;
@@ -745,7 +748,21 @@ _monitor_cb(void *data, Ecore_File_Monitor *em EINA_UNUSED,
                  elm_genlist_item_sorted_insert(entry->genlist, ic, e,
                  e->parent, ELM_GENLIST_ITEM_NONE, _entry_cmp, NULL, NULL);
              if (e->item)
-               e->monitor = ecore_file_monitor_add(e->path, _monitor_cb, e);
+               {
+                  e->monitor = eio_monitor_add(e->path);
+                  e->monitor_handlers =
+                      eina_list_append(e->monitor_handlers,
+                          
ecore_event_handler_add(EIO_MONITOR_DIRECTORY_CREATED,
+                              _monitor_cb, e));
+                  e->monitor_handlers =
+                      eina_list_append(e->monitor_handlers,
+                          
ecore_event_handler_add(EIO_MONITOR_DIRECTORY_MODIFIED,
+                              _monitor_cb, e));
+                  e->monitor_handlers =
+                      eina_list_append(e->monitor_handlers,
+                          
ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED,
+                              _monitor_cb, e));
+               }
           }
         if (elm_genlist_item_type_get(entry->item) == ELM_GENLIST_ITEM_NONE)
           {
@@ -757,21 +774,37 @@ _monitor_cb(void *data, Ecore_File_Monitor *em 
EINA_UNUSED,
                      entry->parent, entry->item, ELM_GENLIST_ITEM_TREE, NULL, 
NULL);
              entry->no_delete = EINA_TRUE;
              if (entry->monitor)
-               ecore_file_monitor_del(entry->monitor);
+               {
+                  eio_monitor_del(entry->monitor);
+                  EINA_LIST_FREE(entry->monitor_handlers, handler)
+                    ecore_event_handler_del(handler);
+               }
              elm_object_item_del(entry->item);
              entry->item = parent;
              entry->no_delete = EINA_FALSE;
-             entry->monitor = ecore_file_monitor_add(entry->path, _monitor_cb, 
entry);
+             entry->monitor = eio_monitor_add(entry->path);
+             entry->monitor_handlers =
+                 eina_list_append(entry->monitor_handlers,
+                     ecore_event_handler_add(EIO_MONITOR_DIRECTORY_CREATED,
+                         _monitor_cb, entry));
+             entry->monitor_handlers =
+                 eina_list_append(entry->monitor_handlers,
+                     ecore_event_handler_add(EIO_MONITOR_DIRECTORY_MODIFIED,
+                         _monitor_cb, entry));
+             entry->monitor_handlers =
+                 eina_list_append(entry->monitor_handlers,
+                     ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED,
+                         _monitor_cb, entry));
           }
-        return;
+        return ECORE_CALLBACK_PASS_ON;
      }
-   else if (event == ECORE_FILE_EVENT_DELETED_DIRECTORY)
+   else if (type == EIO_MONITOR_DIRECTORY_DELETED)
      {
         item = elm_genlist_first_item_get(entry->genlist);
         while (item)
           {
              e = elm_object_item_data_get(item);
-             if (!strcmp(e->path, path))
+             if (!strcmp(e->path, ev->filename))
                {
                   elm_object_item_del(e->item);
                   //if (!strcmp(e->path, e->ephoto->config->directory))
@@ -798,19 +831,19 @@ _monitor_cb(void *data, Ecore_File_Monitor *em 
EINA_UNUSED,
              ephoto_directory_set(entry->ephoto, entry->path, entry->parent, 
0, 1);
              ephoto_title_set(entry->ephoto, entry->path);
           }
-        return;
+        return ECORE_CALLBACK_PASS_ON;
      }
-   else if (event == ECORE_FILE_EVENT_MODIFIED)
+   else if (type == EIO_MONITOR_DIRECTORY_MODIFIED)
      {
-        if (!ecore_file_is_dir(path))
-          return;
+        if (!ecore_file_is_dir(ev->filename))
+          return ECORE_CALLBACK_PASS_ON;
         if ((elm_genlist_item_expanded_get(entry->item) == EINA_TRUE))
           {
              item = elm_genlist_first_item_get(entry->genlist);
              while (item)
                {
                   e = elm_object_item_data_get(item);
-                  if (!strcmp(e->path, path))
+                  if (!strcmp(e->path, ev->filename))
                     {
                        elm_genlist_item_update(e->item);
                        break;
@@ -818,35 +851,37 @@ _monitor_cb(void *data, Ecore_File_Monitor *em 
EINA_UNUSED,
                   item = elm_genlist_item_next_get(item);
                }
           }
-        return;
+        return ECORE_CALLBACK_PASS_ON;
      }
+   return ECORE_CALLBACK_PASS_ON;
 }
 
-static void
-_top_monitor_cb(void *data, Ecore_File_Monitor *em EINA_UNUSED,
-    Ecore_File_Event event, const char *path)
+static Eina_Bool
+_top_monitor_cb(void *data, int type,
+    void *event)
 {
    Elm_Object_Item *item;
    Ephoto_Directory_Browser *db = data;
    Ephoto_Entry *e;
+   Eio_Monitor_Event *ev = event;
    const Elm_Genlist_Item_Class *ic;
    char buf[PATH_MAX], file[PATH_MAX], dir[PATH_MAX];
 
    if (!db)
-     return;
-   snprintf(file, PATH_MAX, "%s", path);
+     return ECORE_CALLBACK_PASS_ON;
+   snprintf(file, PATH_MAX, "%s", ev->filename);
    snprintf(dir, PATH_MAX, "%s", ecore_file_dir_get(file));
 
    if (strcmp(db->ephoto->top_directory, dir))
-     return;
-   if (event == ECORE_FILE_EVENT_CREATED_DIRECTORY)
+     return ECORE_CALLBACK_PASS_ON;
+   if (type == EIO_MONITOR_DIRECTORY_CREATED)
      {
-       if (!ecore_file_is_dir(path))
-         return; 
-        if (ephoto_entry_exists(db->ephoto, path))
-          return;
-        snprintf(buf, PATH_MAX, "%s", path);
-        e = ephoto_entry_new(db->ephoto, path, basename(buf),
+        if (!ecore_file_is_dir(ev->filename))
+          return ECORE_CALLBACK_PASS_ON; 
+        if (ephoto_entry_exists(db->ephoto, ev->filename))
+          return ECORE_CALLBACK_PASS_ON;
+        snprintf(buf, PATH_MAX, "%s", ev->filename);
+        e = ephoto_entry_new(db->ephoto, ev->filename, basename(buf),
             EINA_FILE_DIR);
         e->genlist = db->fsel;
         ic = _ephoto_dir_class;
@@ -854,18 +889,32 @@ _top_monitor_cb(void *data, Ecore_File_Monitor *em 
EINA_UNUSED,
             elm_genlist_item_append(db->fsel, ic, e,
             NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
         if (e->item)
-          e->monitor = ecore_file_monitor_add(e->path, _monitor_cb, e);
-        return;
+          {
+             e->monitor = eio_monitor_add(e->path);
+             e->monitor_handlers =
+                 eina_list_append(e->monitor_handlers,
+                     ecore_event_handler_add(EIO_MONITOR_DIRECTORY_CREATED,
+                         _monitor_cb, e));
+             e->monitor_handlers =
+                 eina_list_append(e->monitor_handlers,
+                     ecore_event_handler_add(EIO_MONITOR_DIRECTORY_MODIFIED,
+                         _monitor_cb, e));
+             e->monitor_handlers =
+                 eina_list_append(e->monitor_handlers,
+                     ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED,
+                         _monitor_cb, e));
+          }
+        return ECORE_CALLBACK_PASS_ON;
      }
-   else if (event == ECORE_FILE_EVENT_DELETED_DIRECTORY)
+   else if (type == EIO_MONITOR_DIRECTORY_DELETED)
      {
         item = elm_genlist_first_item_get(db->fsel);
         while (item)
           {
              e = elm_object_item_data_get(item);
-             if (!strcmp(e->path, path))
+             if (!strcmp(e->path, ev->filename))
                {
-                  if (!strcmp(path, db->ephoto->config->directory))
+                  if (!strcmp(ev->filename, db->ephoto->config->directory))
                     elm_genlist_item_expanded_set(e->parent, EINA_TRUE);
                   else
                     elm_object_item_del(e->item);
@@ -873,25 +922,26 @@ _top_monitor_cb(void *data, Ecore_File_Monitor *em 
EINA_UNUSED,
                }
              item = elm_genlist_item_next_get(item);
           }
-        return;
+        return ECORE_CALLBACK_PASS_ON;
      }
-   else if (event == ECORE_FILE_EVENT_MODIFIED)
+   else if (type == EIO_MONITOR_DIRECTORY_MODIFIED)
      {
-        if (!ecore_file_is_dir(path))
-          return;
+        if (!ecore_file_is_dir(ev->filename))
+          return ECORE_CALLBACK_PASS_ON;
         item = elm_genlist_first_item_get(db->fsel);
         while (item)
           {
              e = elm_object_item_data_get(item);
-             if (!strcmp(e->path, path))
+             if (!strcmp(e->path, ev->filename))
                {
                   elm_genlist_item_update(e->item);
                   break;
                }
              item = elm_genlist_item_next_get(item);
           }
-        return;
+        return ECORE_CALLBACK_PASS_ON;
      }
+   return ECORE_CALLBACK_PASS_ON;
 }
 
 static Eina_Bool
@@ -942,8 +992,20 @@ _todo_items_process(void *data)
             }
            else
              {
-               entry->monitor = ecore_file_monitor_add(entry->path, 
_monitor_cb, entry);
-               entry->genlist = db->fsel;
+                entry->monitor = eio_monitor_add(entry->path);
+                entry->monitor_handlers =
+                    eina_list_append(entry->monitor_handlers,
+                        ecore_event_handler_add(EIO_MONITOR_DIRECTORY_CREATED,
+                            _monitor_cb, entry));
+                entry->monitor_handlers =
+                    eina_list_append(entry->monitor_handlers,
+                        ecore_event_handler_add(EIO_MONITOR_DIRECTORY_MODIFIED,
+                            _monitor_cb, entry));
+                entry->monitor_handlers =
+                    eina_list_append(entry->monitor_handlers,
+                        ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED,
+                            _monitor_cb, entry));
+                entry->genlist = db->fsel;
              }
         }
       db->animator.processed++;
@@ -1036,7 +1098,11 @@ _ephoto_main_del(void *data, Evas *e EINA_UNUSED, 
Evas_Object *obj EINA_UNUSED,
        return;
      }
    if (db->monitor)
-     ecore_file_monitor_del(db->monitor);
+     {
+        eio_monitor_del(db->monitor);
+        EINA_LIST_FREE(db->monitor_handlers, handler)
+          ecore_event_handler_del(handler);
+     }
    free(db);
 }
 
@@ -1045,14 +1111,31 @@ ephoto_directory_browser_top_dir_set(Ephoto *ephoto, 
const char *dir)
 {
    Ephoto_Directory_Browser *db =
        evas_object_data_get(ephoto->dir_browser, "directory_browser");
+   Ecore_Event_Handler *handler;
 
    if (db->monitor)
-     ecore_file_monitor_del(db->monitor);
+     {
+        eio_monitor_del(db->monitor);
+        EINA_LIST_FREE(db->monitor_handlers, handler)
+          ecore_event_handler_del(handler);
+     }
    if (ephoto->top_directory)
      eina_stringshare_replace(&ephoto->top_directory, dir);
    else
      ephoto->top_directory = eina_stringshare_add(dir);
-   db->monitor = ecore_file_monitor_add(dir, _top_monitor_cb, db);
+   db->monitor = eio_monitor_add(dir);
+   db->monitor_handlers =
+       eina_list_append(db->monitor_handlers,
+           ecore_event_handler_add(EIO_MONITOR_DIRECTORY_CREATED,
+               _top_monitor_cb, db));
+   db->monitor_handlers =
+       eina_list_append(db->monitor_handlers,
+           ecore_event_handler_add(EIO_MONITOR_DIRECTORY_MODIFIED,
+               _top_monitor_cb, db));
+   db->monitor_handlers =
+       eina_list_append(db->monitor_handlers,
+           ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED,
+               _top_monitor_cb, db));
 }
 
 void
@@ -1124,7 +1207,19 @@ ephoto_directory_browser_initialize_structure(Ephoto 
*ephoto)
                          }
                        else
                          {
-                            entry->monitor = 
ecore_file_monitor_add(entry->path, _monitor_cb, entry);
+                            entry->monitor = eio_monitor_add(entry->path);
+                            entry->monitor_handlers =
+                                eina_list_append(entry->monitor_handlers,
+                                    
ecore_event_handler_add(EIO_MONITOR_DIRECTORY_CREATED,
+                                        _monitor_cb, entry));
+                            entry->monitor_handlers =
+                                eina_list_append(entry->monitor_handlers,
+                                    
ecore_event_handler_add(EIO_MONITOR_DIRECTORY_MODIFIED,
+                                        _monitor_cb, entry));
+                            entry->monitor_handlers =
+                                eina_list_append(entry->monitor_handlers,
+                                    
ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED,
+                                        _monitor_cb, entry));
                             entry->genlist = db->fsel;
                          }
                        if (n)
diff --git a/src/bin/ephoto_main.c b/src/bin/ephoto_main.c
index 7cbacda..90171e1 100644
--- a/src/bin/ephoto_main.c
+++ b/src/bin/ephoto_main.c
@@ -212,7 +212,11 @@ _win_free(void *data, Evas *e EINA_UNUSED, Evas_Object 
*obj EINA_UNUSED,
    if (ephoto->timer.thumb_regen)
      ecore_timer_del(ephoto->timer.thumb_regen);
    if (ephoto->monitor)
-     ecore_file_monitor_del(ephoto->monitor);
+     {
+        eio_monitor_del(ephoto->monitor);
+        EINA_LIST_FREE(ephoto->monitor_handlers, handler)
+          ecore_event_handler_del(handler);
+     }
    if (ephoto->overlay_timer)
      ecore_timer_del(ephoto->overlay_timer);
    ephoto_config_save(ephoto);
@@ -777,30 +781,31 @@ _ephoto_change_dir(void *data)
    _ephoto_populate_entries(ed);
 }
 
-static void
-_monitor_cb(void *data, Ecore_File_Monitor *em EINA_UNUSED,
-    Ecore_File_Event event, const char *path)
+static Eina_Bool
+_monitor_cb(void *data, int type,
+    void *event)
 {
    Ephoto *ephoto = data;
+   Eio_Monitor_Event *ev = event;
    char file[PATH_MAX], dir[PATH_MAX];
 
-   snprintf(file, PATH_MAX, "%s", path);
+   snprintf(file, PATH_MAX, "%s", ev->filename);
    snprintf(dir, PATH_MAX, "%s", ecore_file_dir_get(file));
 
    if (strcmp(ephoto->config->directory, dir))
-     return;
+     return ECORE_CALLBACK_PASS_ON;
 
-   if (evas_object_image_extension_can_load_get(path))
+   if (evas_object_image_extension_can_load_get(ev->filename))
      {
-        if (event == ECORE_FILE_EVENT_CREATED_FILE)
+        if (type == EIO_MONITOR_FILE_CREATED)
           {
              Ephoto_Entry *entry;
              char buf[PATH_MAX];
 
-             if (ephoto_entry_exists(ephoto, path))
-               return;
-             snprintf(buf, PATH_MAX, "%s", path);
-             entry = ephoto_entry_new(ephoto, path, basename(buf),
+             if (ephoto_entry_exists(ephoto, ev->filename))
+               return ECORE_CALLBACK_PASS_ON;
+             snprintf(buf, PATH_MAX, "%s", ev->filename);
+             entry = ephoto_entry_new(ephoto, ev->filename, basename(buf),
                  EINA_FILE_REG);
              ephoto_single_browser_path_created(ephoto->single_browser, entry);
              if (!ephoto->entries)
@@ -824,25 +829,25 @@ _monitor_cb(void *data, Ecore_File_Monitor *em 
EINA_UNUSED,
                          near_node);
                }
              ephoto_thumb_browser_insert(ephoto, entry);
-             return;
+             return ECORE_CALLBACK_PASS_ON;
           }
-        else if (event == ECORE_FILE_EVENT_DELETED_FILE)
+        else if (type == EIO_MONITOR_FILE_DELETED)
           {
              Eina_List *l;
              Ephoto_Entry *entry;
 
              EINA_LIST_FOREACH(ephoto->entries, l, entry)
                {
-                  if (!strcmp(entry->path, path))
+                  if (!strcmp(entry->path, ev->filename))
                     {
                        ephoto_thumb_browser_remove(ephoto, entry);
                        ephoto_entry_free(ephoto, entry);
                        break;
                     }
                }
-             return;
+             return ECORE_CALLBACK_PASS_ON;
           }
-        else if (event == ECORE_FILE_EVENT_MODIFIED)
+        else if (type == EIO_MONITOR_FILE_MODIFIED)
           {
              Eina_List *l;
              Ephoto_Entry *entry;
@@ -850,7 +855,7 @@ _monitor_cb(void *data, Ecore_File_Monitor *em EINA_UNUSED,
 
              EINA_LIST_FOREACH(ephoto->entries, l, entry)
                {
-                  if (!strcmp(entry->path, path))
+                  if (!strcmp(entry->path, ev->filename))
                     {
                        if (!ecore_file_exists(entry->path))
                          {
@@ -872,10 +877,10 @@ _monitor_cb(void *data, Ecore_File_Monitor *em 
EINA_UNUSED,
                {
                   char buf[PATH_MAX];
 
-                  if (ephoto_entry_exists(ephoto, path))
-                    return;
-                  snprintf(buf, PATH_MAX, "%s", path);
-                  entry = ephoto_entry_new(ephoto, path, basename(buf),
+                  if (ephoto_entry_exists(ephoto, ev->filename))
+                    return ECORE_CALLBACK_PASS_ON;
+                  snprintf(buf, PATH_MAX, "%s", ev->filename);
+                  entry = ephoto_entry_new(ephoto, ev->filename, basename(buf),
                       EINA_FILE_REG);
                   ephoto_single_browser_path_created(ephoto->single_browser, 
entry);
                   if (!ephoto->entries)
@@ -899,10 +904,11 @@ _monitor_cb(void *data, Ecore_File_Monitor *em 
EINA_UNUSED,
                               near_node);
                     }
                   ephoto_thumb_browser_insert(ephoto, entry);
-                  return;
+                  return ECORE_CALLBACK_PASS_ON;
                }
           }
      }
+   return ECORE_CALLBACK_PASS_ON;
 }
 
 void
@@ -910,6 +916,7 @@ ephoto_directory_set(Ephoto *ephoto, const char *path, 
Evas_Object *expanded,
     Eina_Bool dirs_only, Eina_Bool thumbs_only)
 {
    Ephoto_Dir_Data *ed;
+   Ecore_Event_Handler *handler;
 
    ed = malloc(sizeof(Ephoto_Dir_Data));
    ed->ephoto = ephoto;
@@ -928,8 +935,24 @@ ephoto_directory_set(Ephoto *ephoto, const char *path, 
Evas_Object *expanded,
       ecore_job_del(ed->ephoto->job.change_dir);
    ed->ephoto->job.change_dir = ecore_job_add(_ephoto_change_dir, ed);
    if (ephoto->monitor)
-     ecore_file_monitor_del(ephoto->monitor);
-   ephoto->monitor = ecore_file_monitor_add(path, _monitor_cb, ephoto);
+     {
+        eio_monitor_del(ephoto->monitor);
+        EINA_LIST_FREE(ephoto->monitor_handlers, handler)
+          ecore_event_handler_del(handler);
+     }
+   ephoto->monitor = eio_monitor_add(path);
+   ephoto->monitor_handlers =
+       eina_list_append(ephoto->monitor_handlers,
+           ecore_event_handler_add(EIO_MONITOR_FILE_CREATED,
+               _monitor_cb, ephoto));
+   ephoto->monitor_handlers =
+       eina_list_append(ephoto->monitor_handlers,
+           ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED,
+               _monitor_cb, ephoto));
+   ephoto->monitor_handlers =
+       eina_list_append(ephoto->monitor_handlers,
+           ecore_event_handler_add(EIO_MONITOR_FILE_DELETED,
+               _monitor_cb, ephoto));
 }
 
 static Eina_Bool
@@ -1095,6 +1118,7 @@ void
 ephoto_entry_free(Ephoto *ephoto, Ephoto_Entry *entry)
 {
    Ephoto_Entry_Free_Listener *fl;
+   Ecore_Event_Handler *handler;
    Eina_List *node;
    
    EINA_LIST_FREE(entry->free_listeners, fl)
@@ -1116,7 +1140,11 @@ ephoto_entry_free(Ephoto *ephoto, Ephoto_Entry *entry)
    eina_stringshare_del(entry->path);
    eina_stringshare_del(entry->label);
    if (entry->monitor)
-     ecore_file_monitor_del(entry->monitor);
+     {
+        eio_monitor_del(entry->monitor);
+        EINA_LIST_FREE(entry->monitor_handlers, handler)
+          ecore_event_handler_del(handler);
+     }
    free(entry);
 }
 
diff --git a/src/bin/ephoto_single_browser.c b/src/bin/ephoto_single_browser.c
index b0f7d20..e6c6ba5 100644
--- a/src/bin/ephoto_single_browser.c
+++ b/src/bin/ephoto_single_browser.c
@@ -32,7 +32,8 @@ struct _Ephoto_Single_Browser
 struct _Ephoto_Viewer
 {
    Eina_List *handlers;
-   Ecore_File_Monitor *monitor;
+   Eio_Monitor *monitor;
+   Eina_List *monitor_handlers;
    Evas_Object *scroller;
    Evas_Object *table;
    Evas_Object *image;
@@ -257,19 +258,24 @@ _viewer_del(void *data, Evas *e EINA_UNUSED, Evas_Object 
*obj EINA_UNUSED,
     void *event_info EINA_UNUSED)
 {
    Ephoto_Viewer *v = data;
+   Ecore_Event_Handler *handler;
    if (v->monitor)
-     ecore_file_monitor_del(v->monitor);
+     {
+        eio_monitor_del(v->monitor);
+        EINA_LIST_FREE(v->monitor_handlers, handler)
+          ecore_event_handler_del(handler);
+     }
    free(v);
 }
 
-static void
-_monitor_cb(void *data, Ecore_File_Monitor *em EINA_UNUSED,
-    Ecore_File_Event event, const char *path EINA_UNUSED)
+static Eina_Bool
+_monitor_cb(void *data, int type,
+    void *event EINA_UNUSED)
 {
    Ephoto_Single_Browser *sb = data;
    Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer");
 
-   if (event == ECORE_FILE_EVENT_MODIFIED)
+   if (type == EIO_MONITOR_FILE_MODIFIED)
      {
         if (!ecore_file_exists(sb->entry->path))
           ephoto_entry_free(sb->ephoto, sb->entry);
@@ -292,7 +298,7 @@ _monitor_cb(void *data, Ecore_File_Monitor *em EINA_UNUSED,
                }
           }
      }
-   return;
+   return ECORE_CALLBACK_PASS_ON;
 }
 
 static void
@@ -1358,7 +1364,15 @@ _viewer_add(Evas_Object *parent, const char *path, 
Ephoto_Single_Browser *sb)
      }
 
 
-   v->monitor = ecore_file_monitor_add(path, _monitor_cb, sb);
+   v->monitor = eio_monitor_add(path);
+   v->monitor_handlers =
+       eina_list_append(v->monitor_handlers,
+           ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED,
+               _monitor_cb, sb));
+   v->monitor_handlers =
+       eina_list_append(v->monitor_handlers,
+           ecore_event_handler_add(EIO_MONITOR_FILE_DELETED,
+               _monitor_cb, sb));
    return v->scroller;
 
   error:

-- 


Reply via email to