\hypertarget{prefs_example_03_8c-example}{}\doxysection{prefs\+\_\+example\+\_\+03.\+c}

\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{//Compile with:}}
\DoxyCodeLine{\textcolor{comment}{//gcc -\/o prefs\_example\_03 prefs\_example\_03.c -\/g `pkg-\/config -\/-\/cflags -\/-\/libs elementary`}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <Elementary.h>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#define WIDTH (500)}}
\DoxyCodeLine{\textcolor{preprocessor}{\#define HEIGHT (700)}}
\DoxyCodeLine{\textcolor{preprocessor}{\#define MSG\_ID\_VEL (1)}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_update\_animation(\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *prefs, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *layout)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{struct__Eina__Value}{Eina\_Value}} value;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}} animation;}
\DoxyCodeLine{}
\DoxyCodeLine{   elm\_prefs\_item\_value\_get(prefs, \textcolor{stringliteral}{"main:config:options:animation"}, \&value);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Value__Value__Group_ga6f088fe6c6127d808cdf214b355cbdeb}{eina\_value\_get}}(\&value, \&animation);}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (animation)}
\DoxyCodeLine{     \mbox{\hyperlink{group__Elm__Layout_gaa39b36a49850270dd692ce135b2979f3}{elm\_layout\_signal\_emit}}(layout, \textcolor{stringliteral}{"start"}, \textcolor{stringliteral}{"animation"});}
\DoxyCodeLine{   \textcolor{keywordflow}{else}}
\DoxyCodeLine{     \mbox{\hyperlink{group__Elm__Layout_gaa39b36a49850270dd692ce135b2979f3}{elm\_layout\_signal\_emit}}(layout, \textcolor{stringliteral}{"stop"}, \textcolor{stringliteral}{"animation"});}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_update\_animation\_time(\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *prefs, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *layout)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{struct__Eina__Value}{Eina\_Value}} value;}
\DoxyCodeLine{   \textcolor{keywordtype}{float} animation\_time;}
\DoxyCodeLine{   \mbox{\hyperlink{struct__Edje__Message__Float}{Edje\_Message\_Float}} msg;}
\DoxyCodeLine{}
\DoxyCodeLine{   elm\_prefs\_item\_value\_get(prefs, \textcolor{stringliteral}{"main:config:options:animation\_time"}, \&value);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Value__Value__Group_ga6f088fe6c6127d808cdf214b355cbdeb}{eina\_value\_get}}(\&value, \&animation\_time);}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (animation\_time < 0.01) animation\_time = 0.01;}
\DoxyCodeLine{   msg.\mbox{\hyperlink{struct__Edje__Message__Float_a6f297371783ce318fa8d153b634a2b3e}{val}} = animation\_time;}
\DoxyCodeLine{   edje\_object\_message\_send(\mbox{\hyperlink{group__Elm__Layout_gac16e9590a879f644aa5c3bf87c28b03e}{elm\_layout\_edje\_get}}(layout), EDJE\_MESSAGE\_FLOAT,}
\DoxyCodeLine{                            MSG\_ID\_VEL, \&msg);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_update(\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *prefs, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *layout)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \_update\_animation(prefs, layout);}
\DoxyCodeLine{   \_update\_animation\_time(prefs, layout);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_page\_loaded\_cb(\textcolor{keywordtype}{void} *data, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj, \textcolor{keywordtype}{void} *event\_info \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *layout = data;}
\DoxyCodeLine{}
\DoxyCodeLine{   \_update(obj, layout);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_item\_changed\_cb(\textcolor{keywordtype}{void} *data, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj, \textcolor{keywordtype}{void} *event\_info)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *item = event\_info;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *layout = data;}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (!strcmp(item, \textcolor{stringliteral}{"main:config:options:animation\_time"}))}
\DoxyCodeLine{     \_update\_animation\_time(obj, layout);}
\DoxyCodeLine{   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp(item, \textcolor{stringliteral}{"main:config:options:animation"}))}
\DoxyCodeLine{     \_update\_animation(obj, layout);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{EAPI\_MAIN \textcolor{keywordtype}{int}}
\DoxyCodeLine{elm\_main(\textcolor{keywordtype}{int} argc \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \textcolor{keywordtype}{char} **argv \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *win, *prefs, *layout;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Prefs_ga7e2cbea5a9696262669748533f578a53}{Elm\_Prefs\_Data}} *prefs\_data;}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__General_ga7a05f37fd3a019da5e26c5fc91fcd937}{elm\_policy\_set}}(\mbox{\hyperlink{group__Elm__General_ggaa16f3378ecdbf660fa378402e3c5a0a9a02fadb6faada04b19d0fa42c11a8d32a}{ELM\_POLICY\_QUIT}}, \mbox{\hyperlink{group__Elm__General_gga46af37e6ac2c406321060be827117196abbe0962d88ae12afe1a173da881f56cd}{ELM\_POLICY\_QUIT\_LAST\_WINDOW\_CLOSED}});}
\DoxyCodeLine{}
\DoxyCodeLine{   win = \mbox{\hyperlink{group__Elm__Win_gac75d7752662fab73d6420706ce5be996}{elm\_win\_util\_standard\_add}}(\textcolor{stringliteral}{"Prefs"}, \textcolor{stringliteral}{"Prefs Example 03"});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Win_ga9a16a2f8c9fd5b6e9203ed9dcb53ea8b}{elm\_win\_autodel\_set}}(win, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{}
\DoxyCodeLine{   layout = \mbox{\hyperlink{group__Elm__Layout_gaca5aee4ad4d92c68f13d1080c70baf8b}{elm\_layout\_add}}(win);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Layout_ga8d1105463d52787a7b0ca8d7402cd3ea}{elm\_layout\_file\_set}}(layout, \textcolor{stringliteral}{"prefs\_example\_03.edj"}, \textcolor{stringliteral}{"prefs\_edje"});}
\DoxyCodeLine{}
\DoxyCodeLine{   prefs = \mbox{\hyperlink{group__Elm__Prefs_ga6736d5f9363dd7acbcb39938668b3e45}{elm\_prefs\_add}}(win);}
\DoxyCodeLine{   evas\_object\_size\_hint\_weight\_set(prefs, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}}, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}});}
\DoxyCodeLine{   evas\_object\_resize(prefs, WIDTH, HEIGHT);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(prefs);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga18a8b179f94d21b2b09e19db11741061}{evas\_object\_smart\_callback\_add}}(prefs, \textcolor{stringliteral}{"page,loaded"}, \_page\_loaded\_cb,}
\DoxyCodeLine{                                  layout);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga18a8b179f94d21b2b09e19db11741061}{evas\_object\_smart\_callback\_add}}(prefs, \textcolor{stringliteral}{"item,changed"}, \_item\_changed\_cb,}
\DoxyCodeLine{                                  layout);}
\DoxyCodeLine{}
\DoxyCodeLine{   elm\_prefs\_autosave\_set(prefs, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{}
\DoxyCodeLine{   prefs\_data =}
\DoxyCodeLine{      \mbox{\hyperlink{group__Elm__Prefs_ga58895cf0ae0fd70db018fbe8eb7ba5c2}{elm\_prefs\_data\_new}}(\textcolor{stringliteral}{"./prefs\_example\_03.cfg"}, NULL, \mbox{\hyperlink{group__Eet__File__Group_ggaa8e1a7af50fefaf15eb2f69543d24998a763d29c19960a4e0d4eb7bc7bb512481}{EET\_FILE\_MODE\_READ\_WRITE}});}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Prefs_gaec5a0c4ea7f8e54909c5cdbc05e9b064}{elm\_prefs\_file\_set}}(prefs, \textcolor{stringliteral}{"prefs\_example\_03.epb"}, NULL);}
\DoxyCodeLine{   elm\_prefs\_data\_set(prefs, prefs\_data);}
\DoxyCodeLine{}
\DoxyCodeLine{   elm\_prefs\_item\_swallow(prefs, \textcolor{stringliteral}{"main:swal"}, layout);}
\DoxyCodeLine{}
\DoxyCodeLine{   \_update\_animation\_time(prefs, layout);}
\DoxyCodeLine{   \_update\_animation(prefs, layout);}
\DoxyCodeLine{}
\DoxyCodeLine{   evas\_object\_resize(win, WIDTH, HEIGHT);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(win);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__General_gadf2553f83e6b0b9c7fbe054019a664a1}{elm\_run}}();}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Prefs_ga6a6905e5914a263a4e0195bae6c0b37d}{elm\_prefs\_data\_unref}}(prefs\_data);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\}}
\DoxyCodeLine{\mbox{\hyperlink{group__Elm__General_ga50fe52d513f7e89c9c770afd76de7ad9}{ELM\_MAIN}}()}
\end{DoxyCodeInclude}
 