This code places an Elementary file selector button widget on a window, along with some other checkboxes and a text entry.

Those are there just as knobs on the file selector button\textquotesingle{}s state and to display information from it.

Here\textquotesingle{}s how we instantiate it\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   ic = \mbox{\hyperlink{group__Elm__Icon_gac369f2d67be417e5cff81e8f001ff326}{elm\_icon\_add}}(win);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Icon_gab764b4c6c90543f254c013eff6a6db66}{elm\_icon\_standard\_set}}(ic, \textcolor{stringliteral}{"{}file"{}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_gab09d6bf93b5435230b41ceca2abe783a}{evas\_object\_size\_hint\_aspect\_set}}(ic, \mbox{\hyperlink{Evas__Common_8h_ac68b577b7c0b79c356f01926e4a8099faeaf1e019f2dbfbbc2da9ab1fe1f175f6}{EVAS\_ASPECT\_CONTROL\_VERTICAL}}, 1, 1);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* file selector button */}}
\DoxyCodeLine{   fs\_bt = \mbox{\hyperlink{group__Elm__File__Selector__Button_gaf519191eeba0112eb0c9e4f86018237e}{elm\_fileselector\_button\_add}}(win);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Fileselector_ga0a29bfd628ae0dc1cc0d1a3334580802}{elm\_fileselector\_path\_set}}(fs\_bt, \textcolor{stringliteral}{"{}/tmp"{}});}
\DoxyCodeLine{   elm\_object\_text\_set(fs\_bt, \textcolor{stringliteral}{"{}Select a file"{}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__General_ga0531ec8867c72def7c780601764ca642}{elm\_object\_part\_content\_set}}(fs\_bt, \textcolor{stringliteral}{"{}icon"{}}, ic);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Box__Group_ga66a10dd861578521af2ab7b8c2ca65c5}{elm\_box\_pack\_end}}(vbox, fs\_bt);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(fs\_bt);}

\end{DoxyCodeInclude}
 Note that we set on it both icon and label decorations. It\textquotesingle{}s set to list the contents of the {\ttfamily \char`\"{}/tmp\char`\"{}} directory, too, with \mbox{\hyperlink{group__Elm__File__Selector__Button_ga201be50a20b315235ad58d6e6f177133}{elm\+\_\+fileselector\+\_\+button\+\_\+path\+\_\+set()}}. What follows are checkboxes to exercise some of its API functions\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   ck = \mbox{\hyperlink{group__Elm__Check_ga467a6a6215c116a18664aa40fc95f4e3}{elm\_check\_add}}(win);}
\DoxyCodeLine{   elm\_object\_text\_set(ck, \textcolor{stringliteral}{"{}editable selection"{}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Check_gaa011e6d86f82142698760cf0cc4fd0a4}{elm\_check\_state\_set}}(ck, \mbox{\hyperlink{group__Elm__Fileselector_ga72f29bc1a9070aea636d95188717ee14}{elm\_fileselector\_is\_save\_get}}(fs\_bt));}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_gac12dd6655f488cc47ce6cf00eb7d12b2}{evas\_object\_smart\_callback\_add}}(ck, \textcolor{stringliteral}{"{}changed"{}}, \_current\_sel\_toggle, fs\_bt);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Box__Group_ga66a10dd861578521af2ab7b8c2ca65c5}{elm\_box\_pack\_end}}(hbox, ck);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(ck);}
\DoxyCodeLine{}
\DoxyCodeLine{   ck = \mbox{\hyperlink{group__Elm__Check_ga467a6a6215c116a18664aa40fc95f4e3}{elm\_check\_add}}(win);}
\DoxyCodeLine{   elm\_object\_text\_set(ck, \textcolor{stringliteral}{"{}\(\backslash\)"{}inwin\(\backslash\)"{} mode"{}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Check_gaa011e6d86f82142698760cf0cc4fd0a4}{elm\_check\_state\_set}}(ck, elm\_fileselector\_button\_inwin\_mode\_get(fs\_bt));}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_gac12dd6655f488cc47ce6cf00eb7d12b2}{evas\_object\_smart\_callback\_add}}(ck, \textcolor{stringliteral}{"{}changed"{}}, \_inwin\_mode\_toggle, fs\_bt);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Box__Group_ga66a10dd861578521af2ab7b8c2ca65c5}{elm\_box\_pack\_end}}(hbox, ck);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(ck);}
\DoxyCodeLine{}
\DoxyCodeLine{   ck = \mbox{\hyperlink{group__Elm__Check_ga467a6a6215c116a18664aa40fc95f4e3}{elm\_check\_add}}(win);}
\DoxyCodeLine{   elm\_object\_text\_set(ck, \textcolor{stringliteral}{"{}folders only"{}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Check_gaa011e6d86f82142698760cf0cc4fd0a4}{elm\_check\_state\_set}}(ck, \mbox{\hyperlink{group__Elm__Fileselector_ga0a195d1435ed3440fcfb0a6d799ae68e}{elm\_fileselector\_folder\_only\_get}}(fs\_bt));}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_gac12dd6655f488cc47ce6cf00eb7d12b2}{evas\_object\_smart\_callback\_add}}(ck, \textcolor{stringliteral}{"{}changed"{}}, \_folder\_only\_toggle, fs\_bt);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Box__Group_ga66a10dd861578521af2ab7b8c2ca65c5}{elm\_box\_pack\_end}}(hbox, ck);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(ck);}
\DoxyCodeLine{}
\DoxyCodeLine{   ck = \mbox{\hyperlink{group__Elm__Check_ga467a6a6215c116a18664aa40fc95f4e3}{elm\_check\_add}}(win);}
\DoxyCodeLine{   elm\_object\_text\_set(ck, \textcolor{stringliteral}{"{}expandable"{}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Check_gaa011e6d86f82142698760cf0cc4fd0a4}{elm\_check\_state\_set}}(ck, \mbox{\hyperlink{group__Elm__Fileselector_ga07ea4bc495413dd301a888c3413e9bd5}{elm\_fileselector\_expandable\_get}}(fs\_bt));}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_gac12dd6655f488cc47ce6cf00eb7d12b2}{evas\_object\_smart\_callback\_add}}(ck, \textcolor{stringliteral}{"{}changed"{}}, \_expandable\_toggle, fs\_bt);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Box__Group_ga66a10dd861578521af2ab7b8c2ca65c5}{elm\_box\_pack\_end}}(hbox, ck);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(ck);}
\DoxyCodeLine{}
\DoxyCodeLine{   lb = \mbox{\hyperlink{group__Elm__Label__Group_ga39a584d245f8a4b18d742e3ede702507}{elm\_label\_add}}(win);}
\DoxyCodeLine{   elm\_object\_text\_set(lb, \textcolor{stringliteral}{"{}Last selection:"{}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Box__Group_ga66a10dd861578521af2ab7b8c2ca65c5}{elm\_box\_pack\_end}}(vbox, lb);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(lb);}
\DoxyCodeLine{}
\DoxyCodeLine{   en = \mbox{\hyperlink{group__Elm__Entry__Group_gafb201886fc4ee715d229ad2fddfe2ee7}{elm\_entry\_add}}(win);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Entry__Group_gad3da160ecf782da47c25836d859e31ed}{elm\_entry\_line\_wrap\_set}}(en, \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Entry__Group_gac9e11949b9da7e5dbc29d52b1b2faf44}{elm\_entry\_editable\_set}}(en, \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_gac12dd6655f488cc47ce6cf00eb7d12b2}{evas\_object\_smart\_callback\_add}}(fs\_bt, \textcolor{stringliteral}{"{}file,chosen"{}}, \_file\_chosen, en);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Box__Group_ga66a10dd861578521af2ab7b8c2ca65c5}{elm\_box\_pack\_end}}(vbox, en);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(en);}

\end{DoxyCodeInclude}
 The checkboxes will toggle whether the file selector button\textquotesingle{}s internal file selector\+:
\begin{DoxyItemize}
\item must have an editable text entry for file names (thus, be in \char`\"{}save dialog mode\char`\"{})
\item is to be raised as an \char`\"{}inner window\char`\"{} (note it\textquotesingle{}s the default behavior) or as a dedicated window
\item is to populate its view with folders only
\item is to expand its folders, in its view, {\bfseries{in place}}, and not repainting it entirely just with the contents of a sole directory.
\end{DoxyItemize}

The entry labeled {\ttfamily \char`\"{}\+Last selection\char`\"{}} will exercise the {\ttfamily \char`\"{}file,chosen\char`\"{}} smart event coming from the file selector button\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void} \textcolor{comment}{/* hook on the sole smart callback */}}
\DoxyCodeLine{\_file\_chosen(\textcolor{keywordtype}{void} *data, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \textcolor{keywordtype}{void} *event\_info)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *entry = data;}
\DoxyCodeLine{   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *file = event\_info;}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (file)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        elm\_object\_text\_set(entry, file);}
\DoxyCodeLine{        printf(\textcolor{stringliteral}{"{}File chosen: \%s\(\backslash\)n"{}}, file);}
\DoxyCodeLine{     \}}
\DoxyCodeLine{   \textcolor{keywordflow}{else}}
\DoxyCodeLine{     printf(\textcolor{stringliteral}{"{}File selection canceled.\(\backslash\)n"{}});}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{/* toggle inwin mode */}}

\end{DoxyCodeInclude}
 Whenever you dismiss or acknowledges the file selector, after it\textquotesingle{}s raised, the {\ttfamily event\+\_\+info} string will contain the last selection on it (if any was made).

This is how the example, just after called, should look like\+:

 
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth]{fileselector_button_example_00}}
\end{DoxyImageNoCaption}


Click on the file selector button to raise its internal file selector, which will be contained on an {\bfseries{\char`\"{}inner window\char`\"{}}}\+:

 
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth]{fileselector_button_example_01}}
\end{DoxyImageNoCaption}


Toggle the \char`\"{}inwin mode\char`\"{} switch off and, if you click on the file selector button again, you\textquotesingle{}ll get {\bfseries{two}} windows, the original one (note the last selection there!)

 
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth]{fileselector_button_example_02}}
\end{DoxyImageNoCaption}


and the file selector\textquotesingle{}s new one

 
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth]{fileselector_button_example_03}}
\end{DoxyImageNoCaption}


Play with the checkboxes to get the behavior changes on the file selector button. The respective API calls on the widget coming from those knobs where shown in the code already.

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