\begin{DoxyItemize}
\item The filter callback, which allow or not a file to be seen by the main loop handler. This callback run in a separated thread. It also take care of getting a stat buffer needed by the main callback to display the file size. \item The main callback, which receive in the main loop all the file that are allowed by the filter. If you are updating a user interface it make sense to delay the insertion a little, so you get a chance to update the canvas for a bunch of file instead of one by one. \item The end callback, which is called in the main loop when the content of the directory has been correctly scanned and all the file notified to the main loop. \item The error callback, which is called if an error occurred or if the listing was cancelled during it\textquotesingle{}s run. You can then retrieve the error type as an errno error.\end{DoxyItemize}
Here is a simple example that implement a stupidly simple recursive ls that display file size\+:


\begin{DoxyCode}
\textcolor{preprocessor}{#include <\mbox{\hyperlink{Eina_8h}{Eina.h}}>}
\textcolor{preprocessor}{#include <Ecore.h>}
\textcolor{preprocessor}{#include <Eio.h>}

\textcolor{keyword}{static} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}
\_test\_filter\_cb(\textcolor{keywordtype}{void} *data, \mbox{\hyperlink{group__Eio__List_ga1145f009745ecb4d9f6a01a9bc5a9ac0}{Eio\_File}} *handler, \mbox{\hyperlink{struct__Eina__File__Direct__Info}{Eina\_File\_Direct\_Info}} *info)
\{
   \mbox{\hyperlink{struct__Eina__Stat}{Eina\_Stat}} *buffer;
   \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}} isdir;

   isdir = \mbox{\hyperlink{namespaceefl_1_1eina_1_1log__level_a6147b4910c3c6e203f2aedb1656a8c3e}{info}}->type == \mbox{\hyperlink{group__Eina__File__Group_gga0b7b2db79f9a05b07273fb3428d46cd8a0b8844f30974a2fa27af9ba78bcfaa53}{EINA\_FILE\_DIR}};

   buffer = malloc(\textcolor{keyword}{sizeof} (\mbox{\hyperlink{struct__Eina__Stat}{Eina\_Stat}}));
   \textcolor{keywordflow}{if} (\mbox{\hyperlink{group__Eina__File__Group_ga48cc0e04ab40c51160cda615c871e1f0}{eina\_file\_statat}}(\mbox{\hyperlink{group__Eio__Helper_gae9b4601b0e0526d0d574e4e9f1b79781}{eio\_file\_container\_get}}(handler), info, buffer
      ))
     \{
        free(buffer);
        \textcolor{keywordflow}{return} \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}};
     \}

   \textcolor{keywordflow}{if} (!isdir && \mbox{\hyperlink{namespaceefl_1_1eina_1_1log__level_a6147b4910c3c6e203f2aedb1656a8c3e}{info}}->type == \mbox{\hyperlink{group__Eina__File__Group_gga0b7b2db79f9a05b07273fb3428d46cd8a0b8844f30974a2fa27af9ba78bcfaa53}{EINA\_FILE\_DIR}})
     \{
        \textcolor{keyword}{struct }stat st;
        \textcolor{keywordflow}{if} (lstat(\mbox{\hyperlink{namespaceefl_1_1eina_1_1log__level_a6147b4910c3c6e203f2aedb1656a8c3e}{info}}->path, &st) == 0)
          \{
             \textcolor{keywordflow}{if} (S\_ISLNK(st.st\_mode))
               \mbox{\hyperlink{namespaceefl_1_1eina_1_1log__level_a6147b4910c3c6e203f2aedb1656a8c3e}{info}}->type = \mbox{\hyperlink{group__Eina__File__Group_gga0b7b2db79f9a05b07273fb3428d46cd8abcfb23817258fffca146c9c43df45862}{EINA\_FILE\_LNK}};
          \}
     \}

   \mbox{\hyperlink{group__Eio__Helper_ga5fb2c116e5c135a2531308fc452aecf3}{eio\_file\_associate\_direct\_add}}(handler, \textcolor{stringliteral}{"stat"}, buffer, free);
   fprintf(stdout, \textcolor{stringliteral}{"ACCEPTING: %s\(\backslash\)n"}, \mbox{\hyperlink{namespaceefl_1_1eina_1_1log__level_a6147b4910c3c6e203f2aedb1656a8c3e}{info}}->path);
   \textcolor{keywordflow}{return} \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}};
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_test\_main\_cb(\textcolor{keywordtype}{void} *data, \mbox{\hyperlink{group__Eio__List_ga1145f009745ecb4d9f6a01a9bc5a9ac0}{Eio\_File}} *handler, \textcolor{keyword}{const} \mbox{\hyperlink{struct__Eina__File__Direct__Info}{Eina\_File\_Direct\_Info}} *info
      )
\{
   \textcolor{keyword}{struct }stat *buffer;

   buffer = \mbox{\hyperlink{group__Eio__Helper_ga56b02156b1d13fcf633ba7fab8a7dc8b}{eio\_file\_associate\_find}}(handler, \textcolor{stringliteral}{"stat"});
   fprintf(stdout, \textcolor{stringliteral}{"PROCESS: %s of size %li\(\backslash\)n"}, \mbox{\hyperlink{namespaceefl_1_1eina_1_1log__level_a6147b4910c3c6e203f2aedb1656a8c3e}{info}}->path, buffer->st\_size);
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_test\_done\_cb(\textcolor{keywordtype}{void} *data, \mbox{\hyperlink{group__Eio__List_ga1145f009745ecb4d9f6a01a9bc5a9ac0}{Eio\_File}} *handler)
\{
   printf(\textcolor{stringliteral}{"ls done\(\backslash\)n"});
   \mbox{\hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}}();
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_test\_error\_cb(\textcolor{keywordtype}{void} *data, \mbox{\hyperlink{group__Eio__List_ga1145f009745ecb4d9f6a01a9bc5a9ac0}{Eio\_File}} *handler, \textcolor{keywordtype}{int} error)
\{
   fprintf(stdout, \textcolor{stringliteral}{"error: [%s]\(\backslash\)n"}, strerror(error));
   \mbox{\hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}}();
\}

\textcolor{keywordtype}{int}
main(\textcolor{keywordtype}{int} argc, \textcolor{keywordtype}{char} **argv)
\{
   \mbox{\hyperlink{group__Eio__List_ga1145f009745ecb4d9f6a01a9bc5a9ac0}{Eio\_File}} *cp;

   \textcolor{keywordflow}{if} (argc != 2)
     \{
        fprintf(stdout, \textcolor{stringliteral}{"eio\_ls directory\(\backslash\)n"});
        \textcolor{keywordflow}{return} -1;
     \}

   \mbox{\hyperlink{group__Ecore__Init__Group_ga77757609684a2c922dc5ec398274751b}{ecore\_init}}();
   \mbox{\hyperlink{group__Eio__Helper_ga89ffd478ac602179bf7877ed6adc90a9}{eio\_init}}();

   cp = \mbox{\hyperlink{group__Eio__List_ga777a7b7150cf21cb847a0a8d77973229}{eio\_dir\_direct\_ls}}(argv[1],
                          \_test\_filter\_cb,
                          \_test\_main\_cb,
                          \_test\_done\_cb,
                          \_test\_error\_cb,
                          NULL);

   \mbox{\hyperlink{group__Ecore__Main__Loop__Group_gaf103b9f668bb3e4fed12e52c6180132d}{ecore\_main\_loop\_begin}}();

   \mbox{\hyperlink{group__Eio__Helper_ga8eea29cef62953a2916aecb08b222d66}{eio\_shutdown}}();
   \mbox{\hyperlink{group__Ecore__Init__Group_ga768298b932f18d7e7593a447493e5cde}{ecore\_shutdown}}();

   \textcolor{keywordflow}{return} 0;
\}
\end{DoxyCode}
 