The exact opposite of you.  Ecore_File's monitors can handle two at the
same time just fine for me.  EIO monitors don't always notify accurately...
likely an async issue.  Ecore worked, eio didnt, and i dont have a lot of
spare time for development this month, so what i do have, i want to spend
on getting ephoto released, not hunting down bugs in eio.
On Feb 29, 2016 1:33 PM, "Davide Andreoli" <d...@gurumeditation.it> wrote:

> 2016-02-29 18:16 GMT+01:00 Stephen okra Houston <smhousto...@gmail.com>:
>
> > okra pushed a commit to branch master.
> >
> >
> >
> http://git.enlightenment.org/apps/ephoto.git/commit/?id=97e82b216f0191697691d768451cca6824d447e6
> >
> > commit 97e82b216f0191697691d768451cca6824d447e6
> > Author: Stephen okra Houston <smhousto...@gmail.com>
> > Date:   Mon Feb 29 11:15:52 2016 -0600
> >
> >     Ephoto: Move to Ecore_File_Monitor: It behaves better than Eio at
> this
> > point.
> >
>
> oh, really? I have plans to port my usage of Ecore_File_Monitor to Eio in
> the near future, because
> the ecore one is not able to manage 2 monitors on the same folder at the
> same time.
> What problems are you getting using Eio?
>
>
> > ---
> >  src/bin/ephoto.h                |   6 +-
> >  src/bin/ephoto_main.c           | 234 ++++++++++------------
> >  src/bin/ephoto_single_browser.c |  55 +++--
> >  src/bin/ephoto_thumb_browser.c  | 431
> > ++++++++++++++--------------------------
> >  4 files changed, 280 insertions(+), 446 deletions(-)
> >
> > diff --git a/src/bin/ephoto.h b/src/bin/ephoto.h
> > index c828b60..adc1d61 100644
> > --- a/src/bin/ephoto.h
> > +++ b/src/bin/ephoto.h
> > @@ -171,8 +171,7 @@ struct _Ephoto
> >     Eina_List *searchentries;
> >     Eina_List *thumbs;
> >
> > -   Eio_Monitor *monitor;
> > -   Eina_List *monitor_handlers;
> > +   Ecore_File_Monitor *monitor;
> >
> >     const char *top_directory;
> >
> > @@ -203,8 +202,7 @@ struct _Ephoto_Entry
> >     const char *label;
> >     double size;
> >     Ephoto *ephoto;
> > -   Eio_Monitor *monitor;
> > -   Eina_List *monitor_handlers;
> > +   Ecore_File_Monitor *monitor;
> >     Elm_Object_Item *item;
> >     Elm_Object_Item *parent;
> >     Eina_List *free_listeners;
> > diff --git a/src/bin/ephoto_main.c b/src/bin/ephoto_main.c
> > index 9b35096..62c3c83 100644
> > --- a/src/bin/ephoto_main.c
> > +++ b/src/bin/ephoto_main.c
> > @@ -166,13 +166,7 @@ _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_Event_Handler *handler;
> > -
> > -        EINA_LIST_FREE(ephoto->monitor_handlers, handler)
> > -          ecore_event_handler_del(handler);
> > -        eio_monitor_del(ephoto->monitor);
> > -     }
> > +     ecore_file_monitor_del(ephoto->monitor);
> >     ephoto_config_save(ephoto);
> >     free(ephoto);
> >  }
> > @@ -461,133 +455,133 @@ _ephoto_change_dir(void *data)
> >     _ephoto_populate_entries(ed);
> >  }
> >
> > -static Eina_Bool
> > -_monitor_created(void *data, int type EINA_UNUSED, void *event)
> > +static void
> > +_monitor_cb(void *data, Ecore_File_Monitor *em EINA_UNUSED,
> > +    Ecore_File_Event event, const char *path)
> >  {
> >     Ephoto *ephoto = data;
> > -   Eio_Monitor_Event *ev = event;
> >     char file[PATH_MAX], dir[PATH_MAX];
> >
> > -   snprintf(file, PATH_MAX, "%s", ev->filename);
> > +   snprintf(file, PATH_MAX, "%s", path);
> >     snprintf(dir, PATH_MAX, "%s", ecore_file_dir_get(file));
> >
> >     if (strcmp(ephoto->config->directory, dir))
> > -     return ECORE_CALLBACK_PASS_ON;
> > +     return;
> >
> > -   if (evas_object_image_extension_can_load_get(ev->filename))
> > +   if (evas_object_image_extension_can_load_get(path))
> >       {
> > -        Eina_List *l;
> > -        Ephoto_Entry *entry;
> > -        char buf[PATH_MAX];
> > +        if (event == ECORE_FILE_EVENT_CREATED_FILE)
> > +          {
> > +             Eina_List *l;
> > +             Ephoto_Entry *entry;
> > +             char buf[PATH_MAX];
> >
> > -        EINA_LIST_FOREACH(ephoto->entries, l, entry)
> > -          {
> > -             if (!strcmp(entry->path, 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)
> > -          {
> > -             ephoto->entries = eina_list_append(ephoto->entries, entry);
> > -          }
> > -        else
> > -          {
> > -             int near_cmp;
> > -             Eina_List *near_node =
> > -                 eina_list_search_sorted_near_list(ephoto->entries,
> > -                 ephoto_entries_cmp, entry, &near_cmp);
> > -
> > -             if (near_cmp < 0)
> > -                ephoto->entries =
> > -                    eina_list_append_relative_list(ephoto->entries,
> entry,
> > -                    near_node);
> > +             EINA_LIST_FOREACH(ephoto->entries, l, entry)
> > +               {
> > +                  if (!strcmp(entry->path, path))
> > +                    return;
> > +               }
> > +             snprintf(buf, PATH_MAX, "%s", path);
> > +             entry = ephoto_entry_new(ephoto, path, basename(buf),
> > +                 EINA_FILE_REG);
> > +             ephoto_single_browser_path_created(ephoto->single_browser,
> > entry);
> > +             if (!ephoto->entries)
> > +               {
> > +                  ephoto->entries = eina_list_append(ephoto->entries,
> > entry);
> > +               }
> >               else
> > -                ephoto->entries =
> > -                    eina_list_prepend_relative_list(ephoto->entries,
> > entry,
> > -                    near_node);
> > +               {
> > +                  int near_cmp;
> > +                  Eina_List *near_node =
> > +                      eina_list_search_sorted_near_list(ephoto->entries,
> > +                      ephoto_entries_cmp, entry, &near_cmp);
> > +
> > +                  if (near_cmp < 0)
> > +                     ephoto->entries =
> > +                         eina_list_append_relative_list(ephoto->entries,
> > entry,
> > +                         near_node);
> > +                  else
> > +                     ephoto->entries =
> > +
>  eina_list_prepend_relative_list(ephoto->entries,
> > entry,
> > +                         near_node);
> > +               }
> > +             ephoto_thumb_browser_insert(ephoto, entry);
> > +             return;
> >            }
> > -        ephoto_thumb_browser_insert(ephoto, entry);
> > -     }
> > -   return ECORE_CALLBACK_PASS_ON;
> > -}
> > -
> > -static Eina_Bool
> > -_monitor_deleted(void *data, int type EINA_UNUSED, void *event)
> > -{
> > -   Ephoto *ephoto = data;
> > -   Eio_Monitor_Event *ev = event;
> > -   char file[PATH_MAX], dir[PATH_MAX];
> > -
> > -   snprintf(file, PATH_MAX, "%s", ev->filename);
> > -   snprintf(dir, PATH_MAX, "%s", ecore_file_dir_get(file));
> > -
> > -   if (strcmp(ephoto->config->directory, dir))
> > -     return ECORE_CALLBACK_PASS_ON;
> > -
> > -   if (evas_object_image_extension_can_load_get(ev->filename))
> > -     {
> > -        Eina_List *l;
> > -        Ephoto_Entry *entry;
> > -
> > -        EINA_LIST_FOREACH(ephoto->entries, l, entry)
> > +        else if (event == ECORE_FILE_EVENT_DELETED_FILE)
> >            {
> > -             if (!strcmp(entry->path, ev->filename))
> > +             Eina_List *l;
> > +             Ephoto_Entry *entry;
> > +
> > +             EINA_LIST_FOREACH(ephoto->entries, l, entry)
> >                 {
> > -                  ephoto_thumb_browser_remove(ephoto, entry);
> > -                  ephoto_entry_free(ephoto, entry);
> > -                  break;
> > +                  if (!strcmp(entry->path, path))
> > +                    {
> > +                       ephoto_thumb_browser_remove(ephoto, entry);
> > +                       ephoto_entry_free(ephoto, entry);
> > +                       break;
> > +                    }
> >                 }
> > +             return;
> >            }
> > -     }
> > -   return ECORE_CALLBACK_PASS_ON;
> > -}
> > -
> > -static Eina_Bool
> > -_monitor_modified(void *data, int type EINA_UNUSED, void *event)
> > -{
> > -   Ephoto *ephoto = data;
> > -   Eio_Monitor_Event *ev = event;
> > -   char file[PATH_MAX], dir[PATH_MAX];
> > -
> > -   snprintf(file, PATH_MAX, "%s", ev->filename);
> > -   snprintf(dir, PATH_MAX, "%s", ecore_file_dir_get(file));
> > -
> > -   if (strcmp(ephoto->config->directory, dir))
> > -     return ECORE_CALLBACK_PASS_ON;
> > -
> > -   if (evas_object_image_extension_can_load_get(ev->filename))
> > -     {
> > -        Eina_List *l;
> > -        Ephoto_Entry *entry;
> > -        int found = 0;
> > -
> > -        EINA_LIST_FOREACH(ephoto->entries, l, entry)
> > +        else if (event == ECORE_FILE_EVENT_MODIFIED)
> >            {
> > -             if (!strcmp(entry->path, ev->filename))
> > +             Eina_List *l;
> > +             Ephoto_Entry *entry;
> > +             int found = 0;
> > +
> > +             EINA_LIST_FOREACH(ephoto->entries, l, entry)
> >                 {
> > -                  if (!ecore_file_exists(entry->path))
> > +                  if (!strcmp(entry->path, path))
> >                      {
> > -                       elm_object_item_del(entry->item);
> > -                       ephoto_entry_free(ephoto, entry);
> > +                       if (!ecore_file_exists(entry->path))
> > +                         {
> > +                            elm_object_item_del(entry->item);
> > +                            ephoto_entry_free(ephoto, entry);
> > +                         }
> > +                       else
> > +                         {
> > +                            if (!entry->item)
> > +                              ephoto_thumb_browser_insert(ephoto,
> entry);
> > +                            else
> > +                              ephoto_thumb_browser_update(ephoto,
> entry);
> > +                         }
> > +                       found = 1;
> > +                       break;
> > +                    }
> > +               }
> > +             if (!found)
> > +               {
> > +                  char buf[PATH_MAX];
> > +                  snprintf(buf, PATH_MAX, "%s", path);
> > +                  entry = ephoto_entry_new(ephoto, path, basename(buf),
> > +                      EINA_FILE_REG);
> > +
> > ephoto_single_browser_path_created(ephoto->single_browser, entry);
> > +                  if (!ephoto->entries)
> > +                    {
> > +                       ephoto->entries =
> > eina_list_append(ephoto->entries, entry);
> >                      }
> >                    else
> >                      {
> > -                       if (!entry->item)
> > -                         ephoto_thumb_browser_insert(ephoto, entry);
> > +                       int near_cmp;
> > +                       Eina_List *near_node =
> > +
> >  eina_list_search_sorted_near_list(ephoto->entries,
> > +                           ephoto_entries_cmp, entry, &near_cmp);
> > +
> > +                       if (near_cmp < 0)
> > +                          ephoto->entries =
> > +
> > eina_list_append_relative_list(ephoto->entries, entry,
> > +                              near_node);
> >                         else
> > -                         ephoto_thumb_browser_update(ephoto, entry);
> > +                          ephoto->entries =
> > +
> > eina_list_prepend_relative_list(ephoto->entries, entry,
> > +                              near_node);
> >                      }
> > -                  found = 1;
> > -                  break;
> > +                  ephoto_thumb_browser_insert(ephoto, entry);
> > +                  return;
> >                 }
> >            }
> > -        if (!found)
> > -          _monitor_created(ephoto, 0, ev);
> >       }
> > -   return ECORE_CALLBACK_PASS_ON;
> >  }
> >
> >  void
> > @@ -610,23 +604,8 @@ 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_Event_Handler *handler;
> > -
> > -        EINA_LIST_FREE(ephoto->monitor_handlers, handler)
> > -          ecore_event_handler_del(handler);
> > -        eio_monitor_del(ephoto->monitor);
> > -     }
> > -   ephoto->monitor = eio_monitor_add(path);
> > -   ephoto->monitor_handlers = eina_list_append(ephoto->monitor_handlers,
> > -       ecore_event_handler_add(EIO_MONITOR_FILE_CREATED,
> _monitor_created,
> > -       ephoto));
> > -   ephoto->monitor_handlers = eina_list_append(ephoto->monitor_handlers,
> > -       ecore_event_handler_add(EIO_MONITOR_FILE_DELETED,
> _monitor_deleted,
> > -       ephoto));
> > -   ephoto->monitor_handlers = eina_list_append(ephoto->monitor_handlers,
> > -       ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED,
> > _monitor_modified,
> > -       ephoto));
> > +     ecore_file_monitor_del(ephoto->monitor);
> > +   ephoto->monitor = ecore_file_monitor_add(path, _monitor_cb, ephoto);
> >  }
> >
> >  static Eina_Bool
> > @@ -789,8 +768,7 @@ ephoto_entry_free(Ephoto *ephoto, Ephoto_Entry
> *entry)
> >  {
> >     Ephoto_Entry_Free_Listener *fl;
> >     Eina_List *node;
> > -   Ecore_Event_Handler *handler;
> > -
> > +
> >     EINA_LIST_FREE(entry->free_listeners, fl)
> >       {
> >          fl->cb((void *) fl->data, entry);
> > @@ -810,9 +788,7 @@ ephoto_entry_free(Ephoto *ephoto, Ephoto_Entry
> *entry)
> >     eina_stringshare_del(entry->path);
> >     eina_stringshare_del(entry->label);
> >     if (entry->monitor)
> > -     eio_monitor_del(entry->monitor);
> > -   EINA_LIST_FREE(entry->monitor_handlers, handler)
> > -     ecore_event_handler_del(handler);
> > +     ecore_file_monitor_del(entry->monitor);
> >     free(entry);
> >  }
> >
> > diff --git a/src/bin/ephoto_single_browser.c
> > b/src/bin/ephoto_single_browser.c
> > index f99e518..9dd7044 100644
> > --- a/src/bin/ephoto_single_browser.c
> > +++ b/src/bin/ephoto_single_browser.c
> > @@ -40,7 +40,7 @@ struct _Ephoto_Single_Browser
> >  struct _Ephoto_Viewer
> >  {
> >     Eina_List *handlers;
> > -   Eio_Monitor *monitor;
> > +   Ecore_File_Monitor *monitor;
> >     Evas_Object *scroller;
> >     Evas_Object *table;
> >     Evas_Object *image;
> > @@ -61,12 +61,8 @@ _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;
> > -
> > -   EINA_LIST_FREE(v->handlers, handler)
> > -      ecore_event_handler_del(handler);
> >     if (v->monitor)
> > -     eio_monitor_del(v->monitor);
> > +     ecore_file_monitor_del(v->monitor);
> >     free(v);
> >  }
> >
> > @@ -176,34 +172,37 @@ _get_edje_group(const char  *path)
> >     return group;
> >  }
> >
> > -static Eina_Bool
> > -_monitor_modified(void *data, int type EINA_UNUSED, void *event
> > EINA_UNUSED)
> > +static void
> > +_monitor_cb(void *data, Ecore_File_Monitor *em EINA_UNUSED,
> > +    Ecore_File_Event event, const char *path EINA_UNUSED)
> >  {
> >     Ephoto_Single_Browser *sb = data;
> >     Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer");
> >
> > -   if (!ecore_file_exists(sb->entry->path))
> > -     ephoto_entry_free(sb->ephoto, sb->entry);
> > -   else
> > +   if (event == ECORE_FILE_EVENT_MODIFIED)
> >       {
> > -        Evas_Object *tmp;
> > -        Evas_Coord w, h;
> > -        const char *group = _get_edje_group(sb->entry->path);
> > +        if (!ecore_file_exists(sb->entry->path))
> > +          ephoto_entry_free(sb->ephoto, sb->entry);
> > +        else
> > +          {
> > +             Evas_Object *tmp;
> > +             Evas_Coord w, h;
> > +             const char *group = _get_edje_group(sb->entry->path);
> >
> > -        tmp = evas_object_image_add(evas_object_evas_get(v->table));
> > -        evas_object_image_file_set(tmp, sb->entry->path, group);
> > -        evas_object_image_size_get(tmp, &w, &h);
> > -        evas_object_del(tmp);
> > +             tmp =
> evas_object_image_add(evas_object_evas_get(v->table));
> > +             evas_object_image_file_set(tmp, sb->entry->path, group);
> > +             evas_object_image_size_get(tmp, &w, &h);
> > +             evas_object_del(tmp);
> >
> > -        if (w > 0 && h > 0)
> > -          {
> > -             evas_object_hide(v->image);
> > -             elm_image_file_set(v->image, sb->entry->path, group);
> > -             evas_object_show(v->image);
> > +             if (w > 0 && h > 0)
> > +               {
> > +                  evas_object_hide(v->image);
> > +                  elm_image_file_set(v->image, sb->entry->path, group);
> > +                  evas_object_show(v->image);
> > +               }
> >            }
> >       }
> > -
> > -   return ECORE_CALLBACK_PASS_ON;
> > +   return;
> >  }
> >
> >  static Evas_Object *
> > @@ -258,10 +257,7 @@ _viewer_add(Evas_Object *parent, const char *path,
> > Ephoto_Single_Browser *sb)
> >       }
> >
> >
> > -   v->monitor = eio_monitor_add(path);
> > -   v->handlers = eina_list_append(v->handlers,
> > -       ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED,
> > -           _monitor_modified, sb));
> > +   v->monitor = ecore_file_monitor_add(path, _monitor_cb, sb);
> >     return v->scroller;
> >
> >    error:
> > @@ -1353,6 +1349,7 @@ _save_image_as_done(void *data, Evas_Object *obj
> > EINA_UNUSED, void *event_info)
> >                 }
> >              else
> >                {
> > +                  evas_object_del(opopup);
> >                   char *dir = ecore_file_dir_get(buf);
> >
> >                    if (strcmp(dir, sb->ephoto->config->directory))
> > diff --git a/src/bin/ephoto_thumb_browser.c
> > b/src/bin/ephoto_thumb_browser.c
> > index f3e221b..97ee42c 100644
> > --- a/src/bin/ephoto_thumb_browser.c
> > +++ b/src/bin/ephoto_thumb_browser.c
> > @@ -39,8 +39,7 @@ struct _Ephoto_Thumb_Browser
> >     Elm_Object_Item *last_sel;
> >     Ephoto_Sort sort;
> >     Eio_File *ls;
> > -   Eio_Monitor *monitor;
> > -   Eina_List *monitor_handlers;
> > +   Ecore_File_Monitor *monitor;
> >     Eina_List *cut_items;
> >     Eina_List *copy_items;
> >     Eina_List *handlers;
> > @@ -86,12 +85,8 @@ static void _grid_mouse_up_cb(void *data, Evas *e
> > EINA_UNUSED,
> >  static void _ephoto_thumb_activated(void *data, Evas_Object *obj
> > EINA_UNUSED,
> >      void *event_info);
> >  static void _zoom_set(Ephoto_Thumb_Browser *tb, int zoom);
> > -static Eina_Bool _monitor_created(void *data, int type EINA_UNUSED,
> > -    void *event);
> > -static Eina_Bool _monitor_deleted(void *data, int type EINA_UNUSED,
> > -    void *event);
> > -static Eina_Bool _monitor_modified(void *data, int type EINA_UNUSED,
> > -    void *event);
> > +static void _monitor_cb(void *data, Ecore_File_Monitor *em EINA_UNUSED,
> > +    Ecore_File_Event event, const char *path);
> >
> >  static void
> >  _update_info_label(Ephoto_Thumb_Browser *tb)
> > @@ -494,181 +489,124 @@ _check_for_subdirs(Ephoto_Entry *entry)
> >     return EINA_FALSE;
> >  }
> >
> > -static Eina_Bool
> > -_monitor_created(void *data, int type EINA_UNUSED, void *event)
> > +static void
> > +_monitor_cb(void *data, Ecore_File_Monitor *em EINA_UNUSED,
> > +    Ecore_File_Event event, const char *path)
> >  {
> >     Elm_Object_Item *item;
> >     Ephoto_Entry *entry = data;
> >     Ephoto_Entry *e;
> > -   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 ECORE_CALLBACK_PASS_ON;
> > -   if (!ecore_file_is_dir(ev->filename))
> > -     return ECORE_CALLBACK_PASS_ON;
> > +     return;
> >
> > -   snprintf(file, PATH_MAX, "%s", ev->filename);
> > +   snprintf(file, PATH_MAX, "%s", path);
> >     snprintf(dir, PATH_MAX, "%s", ecore_file_dir_get(file));
> >
> >     if (strcmp(entry->path, dir))
> > -     return ECORE_CALLBACK_PASS_ON;
> > -
> > -   item = elm_genlist_first_item_get(entry->genlist);
> > -   while (item)
> > -     {
> > -        e = elm_object_item_data_get(item);
> > -        if (!strcmp(e->path, ev->filename))
> > -           return ECORE_CALLBACK_PASS_ON;
> > -        item = elm_genlist_item_next_get(item);
> > -     }
> > -   if (elm_genlist_item_type_get(entry->item) == ELM_GENLIST_ITEM_TREE
> &&
> > -       elm_genlist_item_expanded_get(entry->item) == EINA_TRUE)
> > +     return;
> > +   if (event == ECORE_FILE_EVENT_CREATED_DIRECTORY)
> >       {
> > -        ic = &_ephoto_dir_class;
> > -        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;
> > -        e->item =
> > -            elm_genlist_item_sorted_insert(entry->genlist, ic, e,
> > -            e->parent, ELM_GENLIST_ITEM_NONE, _entry_cmp, NULL, NULL);
> > -        if (e->item)
> > +        if (!ecore_file_is_dir(path))
> > +          return;
> > +        item = elm_genlist_first_item_get(entry->genlist);
> > +        while (item)
> >            {
> > -             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_created, e));
> > -             e->monitor_handlers = eina_list_append(e->monitor_handlers,
> > -                 ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED,
> > -                 _monitor_deleted, e));
> > -             e->monitor_handlers = eina_list_append(e->monitor_handlers,
> > -                 ecore_event_handler_add(EIO_MONITOR_DIRECTORY_MODIFIED,
> > -                 _monitor_modified, e));
> > +             e = elm_object_item_data_get(item);
> > +             if (!strcmp(e->path, path))
> > +               return;
> > +             item = elm_genlist_item_next_get(item);
> >            }
> > -     }
> > -   if (elm_genlist_item_type_get(entry->item) == ELM_GENLIST_ITEM_NONE)
> > -     {
> > -        Elm_Object_Item *parent;
> > -        Ecore_Event_Handler *handler;
> > -
> > -        ic = &_ephoto_dir_class;
> > -        parent =
> > -            elm_genlist_item_insert_before(entry->genlist, ic, entry,
> > -                entry->parent, entry->item, ELM_GENLIST_ITEM_TREE, NULL,
> > NULL);
> > -        entry->no_delete = EINA_TRUE;
> > -        if (entry->monitor)
> > +        if (elm_genlist_item_type_get(entry->item) ==
> > ELM_GENLIST_ITEM_TREE &&
> > +            elm_genlist_item_expanded_get(entry->item) == EINA_TRUE)
> >            {
> > -             eio_monitor_del(entry->monitor);
> > -             EINA_LIST_FREE(entry->monitor_handlers, handler)
> > -               ecore_event_handler_del(handler);
> > +             ic = &_ephoto_dir_class;
> > +             snprintf(buf, PATH_MAX, "%s", path);
> > +             e = ephoto_entry_new(entry->ephoto, path, basename(buf),
> > +                 EINA_FILE_DIR);
> > +             e->genlist = entry->genlist;
> > +             e->parent = entry->item;
> > +             e->item =
> > +                 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);
> >            }
> > -        elm_object_item_del(entry->item);
> > -        entry->item = parent;
> > -        entry->no_delete = EINA_FALSE;
> > -        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_created, entry));
> > -        entry->monitor_handlers =
> > eina_list_append(entry->monitor_handlers,
> > -            ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED,
> > -            _monitor_deleted, entry));
> > -        entry->monitor_handlers =
> > eina_list_append(entry->monitor_handlers,
> > -            ecore_event_handler_add(EIO_MONITOR_DIRECTORY_MODIFIED,
> > -            _monitor_modified, entry));
> > -     }
> > -   return ECORE_CALLBACK_PASS_ON;
> > -}
> > -
> > -static Eina_Bool
> > -_monitor_deleted(void *data, int type EINA_UNUSED, void *event)
> > -{
> > -   Elm_Object_Item *item;
> > -   Ephoto_Entry *entry = data;
> > -   Eio_Monitor_Event *ev = event;
> > -   char file[PATH_MAX], dir[PATH_MAX];
> > -   const Elm_Genlist_Item_Class *ic;
> > -
> > -   if (!entry)
> > -     return ECORE_CALLBACK_PASS_ON;
> > -
> > -   snprintf(file, PATH_MAX, "%s", ev->filename);
> > -   snprintf(dir, PATH_MAX, "%s", ecore_file_dir_get(file));
> > -
> > -   if (strcmp(entry->path, dir))
> > -     return ECORE_CALLBACK_PASS_ON;
> > -
> > -   item = elm_genlist_first_item_get(entry->genlist);
> > -   while (item)
> > -     {
> > -        Ephoto_Entry *e = elm_object_item_data_get(item);
> > -        if (!strcmp(e->path, ev->filename))
> > +        if (elm_genlist_item_type_get(entry->item) ==
> > ELM_GENLIST_ITEM_NONE)
> >            {
> > -             elm_object_item_del(e->item);
> > -             break;
> > +             Elm_Object_Item *parent;
> > +
> > +             ic = &_ephoto_dir_class;
> > +             parent =
> > +                 elm_genlist_item_insert_before(entry->genlist, ic,
> entry,
> > +                     entry->parent, entry->item, ELM_GENLIST_ITEM_TREE,
> > NULL, NULL);
> > +             entry->no_delete = EINA_TRUE;
> > +             if (entry->monitor)
> > +               ecore_file_monitor_del(entry->monitor);
> > +             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);
> >            }
> > -        item = elm_genlist_item_next_get(item);
> > -     }
> > -   if (elm_genlist_item_type_get(entry->item) == ELM_GENLIST_ITEM_TREE
> &&
> > -       _check_for_subdirs(entry) == EINA_FALSE)
> > -     {
> > -        Elm_Object_Item *parent;
> > -
> > -        ic = &_ephoto_dir_class;
> > -        parent =
> > -            elm_genlist_item_insert_before(entry->genlist, ic, entry,
> > -            entry->parent, entry->item, ELM_GENLIST_ITEM_NONE, NULL,
> > NULL);
> > -        entry->no_delete = EINA_TRUE;
> > -        elm_object_item_del(entry->item);
> > -        entry->item = parent;
> > -        entry->no_delete = EINA_FALSE;
> > -     }
> > -   if (!ecore_file_exists(entry->ephoto->config->directory))
> > -     {
> > -        ephoto_directory_set(entry->ephoto, entry->path, entry->parent,
> > 0, 1);
> > -        ephoto_title_set(entry->ephoto, entry->path);
> > +        return;
> >       }
> > -   return ECORE_CALLBACK_PASS_ON;
> > -}
> > -
> > -static Eina_Bool
> > -_monitor_modified(void *data, int type EINA_UNUSED, void *event)
> > -{
> > -   Ephoto_Entry *entry = data;
> > -   Eio_Monitor_Event *ev = event;
> > -   char file[PATH_MAX], dir[PATH_MAX];
> > -
> > -   if (!entry)
> > -     return ECORE_CALLBACK_PASS_ON;
> > -   if (!ecore_file_is_dir(ev->filename))
> > -     return ECORE_CALLBACK_PASS_ON;
> > -
> > -   snprintf(file, PATH_MAX, "%s", ev->filename);
> > -   snprintf(dir, PATH_MAX, "%s", ecore_file_dir_get(file));
> > -
> > -   if (strcmp(entry->path, dir))
> > -     return ECORE_CALLBACK_PASS_ON;
> > -
> > -   if ((elm_genlist_item_expanded_get(entry->item) == EINA_TRUE))
> > +   else if (event == ECORE_FILE_EVENT_DELETED_DIRECTORY)
> >       {
> > -        Elm_Object_Item *item;
> > -
> >          item = elm_genlist_first_item_get(entry->genlist);
> >          while (item)
> >            {
> > -             Ephoto_Entry *e = elm_object_item_data_get(item);
> > -             if (!strcmp(e->path, ev->filename))
> > +             e = elm_object_item_data_get(item);
> > +             if (!strcmp(e->path, path))
> >                 {
> > -                  elm_genlist_item_update(e->item);
> > +                  elm_object_item_del(e->item);
> >                    break;
> >                 }
> >               item = elm_genlist_item_next_get(item);
> >            }
> > +        if (elm_genlist_item_type_get(entry->item) ==
> > ELM_GENLIST_ITEM_TREE &&
> > +            _check_for_subdirs(entry) == EINA_FALSE)
> > +          {
> > +             Elm_Object_Item *parent;
> > +
> > +             ic = &_ephoto_dir_class;
> > +             parent =
> > +                 elm_genlist_item_insert_before(entry->genlist, ic,
> entry,
> > +                 entry->parent, entry->item, ELM_GENLIST_ITEM_NONE,
> NULL,
> > NULL);
> > +             entry->no_delete = EINA_TRUE;
> > +             elm_object_item_del(entry->item);
> > +             entry->item = parent;
> > +             entry->no_delete = EINA_FALSE;
> > +          }
> > +        if (!ecore_file_exists(entry->ephoto->config->directory))
> > +          {
> > +             ephoto_directory_set(entry->ephoto, entry->path,
> > entry->parent, 0, 1);
> > +             ephoto_title_set(entry->ephoto, entry->path);
> > +          }
> > +        return;
> > +     }
> > +   else if (event == ECORE_FILE_EVENT_MODIFIED)
> > +     {
> > +        if (!ecore_file_is_dir(path))
> > +          return;
> > +        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))
> > +                    {
> > +                       elm_genlist_item_update(e->item);
> > +                       break;
> > +                    }
> > +                  item = elm_genlist_item_next_get(item);
> > +               }
> > +          }
> > +        return;
> >       }
> > -   return ECORE_CALLBACK_PASS_ON;
> >  }
> >
> >  static Eina_Bool
> > @@ -715,20 +653,8 @@ _todo_items_process(void *data)
> >              }
> >             else
> >               {
> > -                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_created, entry));
> > -                entry->monitor_handlers = eina_list_append(
> > -                    entry->monitor_handlers,
> > -
> ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED,
> > -                        _monitor_deleted, entry));
> > -                entry->monitor_handlers = eina_list_append(
> > -                    entry->monitor_handlers,
> > -
> > ecore_event_handler_add(EIO_MONITOR_DIRECTORY_MODIFIED,
> > -                        _monitor_modified, entry));
> > -                entry->genlist = tb->fsel;
> > +               entry->monitor = ecore_file_monitor_add(entry->path,
> > _monitor_cb, entry);
> > +               entry->genlist = tb->fsel;
> >               }
> >          }
> >        else
> > @@ -3566,12 +3492,7 @@ _main_del(void *data, Evas *e EINA_UNUSED,
> > Evas_Object *obj EINA_UNUSED,
> >     if (tb->searchentries)
> >        eina_list_free(tb->searchentries);
> >     if (tb->monitor)
> > -     {
> > -        eio_monitor_del(tb->monitor);
> > -        EINA_LIST_FREE(tb->monitor_handlers, handler)
> > -          ecore_event_handler_del(handler);
> > -     }
> > -
> > +     ecore_file_monitor_del(tb->monitor);
> >     free(tb);
> >  }
> >
> > @@ -3638,123 +3559,79 @@ _ephoto_thumb_populate_error(void *data, int
> type
> > EINA_UNUSED,
> >     return ECORE_CALLBACK_PASS_ON;
> >  }
> >
> > -static Eina_Bool
> > -_top_monitor_created(void *data, int type EINA_UNUSED, void *event)
> > +static void
> > +_top_monitor_cb(void *data, Ecore_File_Monitor *em EINA_UNUSED,
> > +    Ecore_File_Event event, const char *path)
> >  {
> >     Elm_Object_Item *item;
> >     Ephoto_Thumb_Browser *tb = data;
> > -   Eio_Monitor_Event *ev = event;
> >     Ephoto_Entry *e;
> >     const Elm_Genlist_Item_Class *ic;
> >     char buf[PATH_MAX], file[PATH_MAX], dir[PATH_MAX];
> >
> >     if (!tb)
> > -     return ECORE_CALLBACK_PASS_ON;
> > -   if (!ecore_file_is_dir(ev->filename))
> > -     return ECORE_CALLBACK_PASS_ON;
> > -
> > -   snprintf(file, PATH_MAX, "%s", ev->filename);
> > +     return;
> > +   snprintf(file, PATH_MAX, "%s", path);
> >     snprintf(dir, PATH_MAX, "%s", ecore_file_dir_get(file));
> >
> >     if (strcmp(tb->ephoto->top_directory, dir))
> > -     return ECORE_CALLBACK_PASS_ON;
> > -
> > -   item = elm_genlist_first_item_get(tb->fsel);
> > -   while (item)
> > +     return;
> > +   if (event == ECORE_FILE_EVENT_CREATED_DIRECTORY)
> >       {
> > -        e = elm_object_item_data_get(item);
> > -        if (!strcmp(e->path, ev->filename))
> > -          return ECORE_CALLBACK_PASS_ON;
> > -        item = elm_genlist_item_next_get(item);
> > +       if (!ecore_file_is_dir(path))
> > +         return;
> > +       item = elm_genlist_first_item_get(tb->fsel);
> > +        while (item)
> > +          {
> > +             e = elm_object_item_data_get(item);
> > +             if (!strcmp(e->path, path))
> > +               return;
> > +             item = elm_genlist_item_next_get(item);
> > +          }
> > +        snprintf(buf, PATH_MAX, "%s", path);
> > +        e = ephoto_entry_new(tb->ephoto, path, basename(buf),
> > +            EINA_FILE_DIR);
> > +        e->genlist = tb->fsel;
> > +        ic = &_ephoto_dir_class;
> > +        e->item =
> > +            elm_genlist_item_append(tb->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;
> >       }
> > -   snprintf(buf, PATH_MAX, "%s", ev->filename);
> > -   e = ephoto_entry_new(tb->ephoto, ev->filename, basename(buf),
> > -       EINA_FILE_DIR);
> > -   e->genlist = tb->fsel;
> > -   ic = &_ephoto_dir_class;
> > -   e->item =
> > -         elm_genlist_item_append(tb->fsel, ic, e,
> > -         NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
> > -   if (e->item)
> > +   else if (event == ECORE_FILE_EVENT_DELETED_DIRECTORY)
> >       {
> > -        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_created, e));
> > -        e->monitor_handlers = eina_list_append(e->monitor_handlers,
> > -            ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED,
> > -                _monitor_deleted, e));
> > -        e->monitor_handlers = eina_list_append(e->monitor_handlers,
> > -            ecore_event_handler_add(EIO_MONITOR_DIRECTORY_MODIFIED,
> > -                _monitor_modified, e));
> > -     }
> > -
> > -   return ECORE_CALLBACK_PASS_ON;
> > -}
> > -
> > -static Eina_Bool
> > -_top_monitor_deleted(void *data, int type EINA_UNUSED, void *event)
> > -{
> > -   Elm_Object_Item *item;
> > -   Ephoto_Thumb_Browser *tb = data;
> > -   Eio_Monitor_Event *ev = event;
> > -   char file[PATH_MAX], dir[PATH_MAX];
> > -
> > -   if (!tb)
> > -     return ECORE_CALLBACK_PASS_ON;
> > -
> > -   snprintf(file, PATH_MAX, "%s", ev->filename);
> > -   snprintf(dir, PATH_MAX, "%s", ecore_file_dir_get(file));
> > -
> > -   if (strcmp(tb->ephoto->top_directory, dir))
> > -     return ECORE_CALLBACK_PASS_ON;
> > -
> > -   item = elm_genlist_first_item_get(tb->fsel);
> > -   while (item)
> > -     {
> > -        Ephoto_Entry *e = elm_object_item_data_get(item);
> > -        if (!strcmp(e->path, ev->filename))
> > +        item = elm_genlist_first_item_get(tb->fsel);
> > +        while (item)
> >            {
> > -             elm_object_item_del(e->item);
> > -             break;
> > +             e = elm_object_item_data_get(item);
> > +             if (!strcmp(e->path, path))
> > +               {
> > +                  elm_object_item_del(e->item);
> > +                  break;
> > +               }
> > +             item = elm_genlist_item_next_get(item);
> >            }
> > -        item = elm_genlist_item_next_get(item);
> > +        return;
> >       }
> > -   return ECORE_CALLBACK_PASS_ON;
> > -}
> > -
> > -
> > -static Eina_Bool
> > -_top_monitor_modified(void *data, int type EINA_UNUSED, void *event)
> > -{
> > -   Elm_Object_Item *item;
> > -   Ephoto_Thumb_Browser *tb = data;
> > -   Eio_Monitor_Event *ev = event;
> > -   char file[PATH_MAX], dir[PATH_MAX];
> > -
> > -   if (!tb)
> > -     return ECORE_CALLBACK_PASS_ON;
> > -   if (!ecore_file_is_dir(ev->filename))
> > -     return ECORE_CALLBACK_PASS_ON;
> > -
> > -   snprintf(file, PATH_MAX, "%s", ev->filename);
> > -   snprintf(dir, PATH_MAX, "%s", ecore_file_dir_get(file));
> > -
> > -   if (strcmp(tb->ephoto->top_directory, dir))
> > -     return ECORE_CALLBACK_PASS_ON;
> > -
> > -   item = elm_genlist_first_item_get(tb->fsel);
> > -   while (item)
> > +   else if (event == ECORE_FILE_EVENT_MODIFIED)
> >       {
> > -        Ephoto_Entry *e = elm_object_item_data_get(item);
> > -        if (!strcmp(e->path, ev->filename))
> > +        if (!ecore_file_is_dir(path))
> > +          return;
> > +        item = elm_genlist_first_item_get(tb->fsel);
> > +        while (item)
> >            {
> > -             elm_genlist_item_update(e->item);
> > -             break;
> > +             e = elm_object_item_data_get(item);
> > +             if (!strcmp(e->path, path))
> > +               {
> > +                  elm_genlist_item_update(e->item);
> > +                  break;
> > +               }
> > +             item = elm_genlist_item_next_get(item);
> >            }
> > -        item = elm_genlist_item_next_get(item);
> > +        return;
> >       }
> > -   return ECORE_CALLBACK_PASS_ON;
> >  }
> >
> >  static Eina_Bool
> > @@ -3885,26 +3762,12 @@ ephoto_thumb_browser_top_dir_set(Ephoto *ephoto,
> > const char *dir)
> >         evas_object_data_get(ephoto->thumb_browser, "thumb_browser");
> >
> >     if (tb->monitor)
> > -     {
> > -        Ecore_Event_Handler *handler;
> > -        eio_monitor_del(tb->monitor);
> > -        EINA_LIST_FREE(tb->monitor_handlers, handler)
> > -          ecore_event_handler_del(handler);
> > -     }
> > +     ecore_file_monitor_del(tb->monitor);
> >     if (ephoto->top_directory)
> >       eina_stringshare_replace(&ephoto->top_directory, dir);
> >     else
> >       ephoto->top_directory = eina_stringshare_add(dir);
> > -   tb->monitor = eio_monitor_add(dir);
> > -   tb->monitor_handlers = eina_list_append(tb->monitor_handlers,
> > -       ecore_event_handler_add(EIO_MONITOR_DIRECTORY_CREATED,
> > -           _top_monitor_created, tb));
> > -   tb->monitor_handlers = eina_list_append(tb->monitor_handlers,
> > -       ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED,
> > -           _top_monitor_deleted, tb));
> > -   tb->monitor_handlers = eina_list_append(tb->monitor_handlers,
> > -       ecore_event_handler_add(EIO_MONITOR_DIRECTORY_MODIFIED,
> > -           _top_monitor_modified, tb));
> > +   tb->monitor = ecore_file_monitor_add(dir, _top_monitor_cb, tb);
> >  }
> >
> >  void
> >
> > --
> >
> >
> >
>
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to