This code places two Elementary file selector widgets on a window.

The one on the left is layouting file system items in a {\bfseries list}, while the the other is layouting them in a {\bfseries grid}.

The one having the majority of hooks of interest is on the left, which we create as follows\-:  
\begin{DoxyCodeInclude}
   \textcolor{comment}{/* first file selector, in list mode */}
   fs = elm_fileselector_add(win);
   \textcolor{comment}{/* enable the fs file name entry */}
   elm_fileselector_is_save_set(fs, EINA\_TRUE);
   \textcolor{comment}{/* custom list view */}
   elm_fileselector_expandable_set(fs, EINA\_FALSE);
   \textcolor{comment}{/* start the fileselector in the /tmp/ dir */}
   elm_fileselector_path_set(fs, \textcolor{stringliteral}{"/tmp"});

   evas\_object\_size\_hint\_weight\_set(fs, EVAS\_HINT\_EXPAND, EVAS\_HINT\_EXPAND);
   evas\_object\_size\_hint\_align\_set(fs, EVAS\_HINT\_FILL, EVAS\_HINT\_FILL);
   elm_box_pack_end(vbox, fs);
   evas\_object\_show(fs);

\end{DoxyCodeInclude}


Note that we enable custom edition of file/directory selection, via the text entry it has on its bottom, via \hyperlink{group__Fileselector_ga3cce4da9062c9d9134d6970ebe3a65c8}{elm\-\_\-fileselector\-\_\-is\-\_\-save\-\_\-set()}. It starts with the list view, which is the default, and we make it not expandable in place (\hyperlink{group__Fileselector_gab12cb7913e0e82ee591471a6e36b6faf}{elm\-\_\-fileselector\-\_\-expandable\-\_\-set()}), so that it replaces its view's contents with the current directory's entries each time one navigates to a different folder. For both of file selectors we are starting to list the contents found in the {\ttfamily \char`\"{}/tmp\char`\"{}} directory (\hyperlink{group__Fileselector_ga0a29bfd628ae0dc1cc0d1a3334580802}{elm\-\_\-fileselector\-\_\-path\-\_\-set()}).

Note the code setting it to \char`\"{}grid mode\char`\"{} and observe the differences in the file selector's views, in the example. We also hide the second file selector's Ok/\-Cancel buttons -- since it's there just to show the grid view (and navigation) -- via \hyperlink{group__Fileselector_ga659af8946a926b2af6be085cdd884cc9}{elm\-\_\-fileselector\-\_\-buttons\-\_\-ok\-\_\-cancel\-\_\-set()}.

The {\ttfamily \char`\"{}done\char`\"{}} event, which triggers the callback below  
\begin{DoxyCodeInclude}
\textcolor{comment}{/* 'done' cb */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_fs\_done(\textcolor{keywordtype}{void}        *data,
         Evas\_Object *obj,
         \textcolor{keywordtype}{void}        *event\_info)
\{
   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *selected = event\_info;
   \textcolor{comment}{/* event\_info contains the full path of the selected file or NULL}
\textcolor{comment}{    * if none is selected (or cancel is pressed) */}

   printf(\textcolor{stringliteral}{"We're done! Selected file is: %s\(\backslash\)n"},
          selected ? selected : \textcolor{stringliteral}{"*none!*"});

   elm_exit();
\}

\end{DoxyCodeInclude}
 will be called at the time one clicks the \char`\"{}\-Ok\char`\"{}/\char`\"{}\-Cancel\char`\"{} buttons of the file selector (on the left). Note that it will print the path to the current selection, if any.

The {\ttfamily \char`\"{}selected\char`\"{}} event, which triggers the callback below  
\begin{DoxyCodeInclude}

\end{DoxyCodeInclude}
 takes place when one selects a file (if the file selector is {\bfseries not} under folders-\/only mode) or when one selects a folder (when in folders-\/only mode). Experiment it by selecting different file system entries.

What comes next is the code creating the three check boxes and two buttons below the file selector in the right. They will exercise a bunch of functions on the file selector's A\-P\-I, for the instance on the left. Experiment with them, specially the buttons, to get the difference between \hyperlink{group__Fileselector_ga070960b00a8317519dc00076d07574ea}{elm\-\_\-fileselector\-\_\-path\-\_\-get()} and \hyperlink{group__Fileselector_gab0f22909aa97264ca6c72131623fa0c4}{elm\-\_\-fileselector\-\_\-selected\-\_\-get()}.

Finally, there's the code adding the second file selector, on the right\-:  
\begin{DoxyCodeInclude}
   \textcolor{comment}{/* second file selector, now with grid view */}
   fs = elm_fileselector_add(win);
   elm_fileselector_is_save_set(fs, EINA\_TRUE);
   elm_fileselector_mode_set(fs, ELM\_FILESELECTOR\_GRID);
   elm_fileselector_buttons_ok_cancel_set(fs, EINA\_FALSE);
   elm_fileselector_path_set(fs, \textcolor{stringliteral}{"/tmp"});

   evas\_object\_size\_hint\_weight\_set(fs, EVAS\_HINT\_EXPAND, EVAS\_HINT\_EXPAND);
   evas\_object\_size\_hint\_align\_set(fs, EVAS\_HINT\_FILL, EVAS\_HINT\_FILL);
   elm_box_pack_end(bx, fs);
   evas\_object\_show(fs);

\end{DoxyCodeInclude}


Pay attention to the code setting it to \char`\"{}grid mode\char`\"{} and observe the differences in the file selector's views, in the example. We also hide the second file selector's Ok/\-Cancel buttons -- since it's there just to show the grid view (and navigation) -- via \hyperlink{group__Fileselector_ga659af8946a926b2af6be085cdd884cc9}{elm\-\_\-fileselector\-\_\-buttons\-\_\-ok\-\_\-cancel\-\_\-set()}.

See the full \hyperlink{fileselector_example_8c-example}{example}, whose window should look like this picture\-:

 
\begin{DoxyImage}
\includegraphics{screenshots/fileselector_example}
\caption{width=}
\end{DoxyImage}


See the full \hyperlink{fileselector_example_c}{source code} for this example. 