This example shows how to create a simple prefs widget with Elementary, where some items properties are changed on each timer tick.
We'll create items on the .EPC file and after handle it on the .C file.
First we'll create prefs items on .EPC file that we'll use later on the .C file. Note that the code is similar to .EDC (edje) files.
In this part, we create a TEXTAREA
item and, by default, it will become a multi-line text entry in the UI. Note that we use a regular expression to accept only characters and whitespaces in it.
Now we create a FLOAT type item, by default will become a spinner in UI, and default, min and max parameters are optional as well as in INT type.
Here we create a BOOL type item, by default will become a checkbox in UI.
Here we create two items, separator and save types, that we've already covered in Prefs Example 01
In this part, we create a ACTION type item. when clicked, the action item will emit a signal to .C file and call a smart callback.
Now we're handling the .C file and first we'll create a prefs widget.
In this part we add the action smart callback, that will be called when the action item be clicked.
Here we add a simple action item callback that sets a text to another item.
Now we set the prefs to save its values back (on the user data file) automatically on every UI element changes.
In this part we create the prefs data handle and set the .EPB file (.EPC compiled).
Here we just create a notify widget to appear when the items properties are changed.
Now we add a timer to change text editable, spinners visibility and checkbox enable/disable properties on each 5.0 seconds and show the notify.
Here we finish the example. The full source code can be found on prefs_example_02.c and prefs_example_02.epc