As told in their documentation blocks, the elm_app_compile_*_dir_set() family of functions have to be called before elm_app_info_set():
We are here setting the fallback paths to the compiling time target paths, naturally. If you're building the example out of the project's build system, we're assuming they are the canonical ones.
After the program starts, elm_app_info_set() will actually run and then you'll see a problem: Elementary does the prefix lookup twice. This is so because of the quicklaunch infrastructure in Elementary (Start), which will register a predefined prefix for possible users of the launch schema. We're not hooking into a quick launch, so this first call can't be avoided.
If you ran this example from your "bindir" installation directory, no output will emerge from these both attempts – it will find the "magic" file there registered and set the prefixes silently. Otherwise, you could get something like:
WARNING: Could not determine its installed prefix for 'ELM' so am falling back on the compiled in default: usr implied by the following: bindir = usr/lib libdir = usr/lib datadir = usr/share/elementary localedir = usr/share/locale Try setting the following environment variables: ELM_PREFIX - points to the base prefix of install or the next 4 variables ELM_BIN_DIR - provide a specific binary directory ELM_LIB_DIR - provide a specific library directory ELM_DATA_DIR - provide a specific data directory ELM_LOCALE_DIR - provide a specific locale directory
if you also didn't change those environment variables (remember they are also a valid way of communicating your prefix to the binary) - this is the scenario where it fallbacks to the paths set for compile time.
Then, you can check the prefixes set on the standard output:
In the fragment
we demonstrate the use of Elementary policies. The policy defining under which circumstances our application should quit automatically is set to when its last window is closed (this one has just one window, though). This will save us from having to set a callback ourselves on the window, like done in this example. Note that we need to tell the window to delete itself's object on a request to destroy the canvas coming, with elm_win_autodel_set().
What follows is some boilerplate code, creating a frame with a button, our object of interest, and, below, widgets to change the button's behavior and exemplify the group of functions in question.
We enabled the focus highlight object for this window, so that you can keep track of the current focused object better:
Use the tab key to navigate through the focus chain.
While creating the button, we exemplify how to use Elementary's finger size information to scale our UI:
The first checkbox's callback is:
When unsetting the checkbox, we disable the button, which will get a new decoration (greyed out) and stop receiving events. The focus chain will also ignore it.
Following, there are 2 more buttons whose actions are focus/unfocus the top button, respectively:
and
Note the situations in which they won't take effect:
The first restriction above you'll get by a second checkbox, whose callback is:
Note that the button will still get mouse events, though.
Next, there's a slider controlling the button's scale:
Experiment with it, so you understand the effect better. If you change its value, it will mess with the button's original size, naturally.
The full code for this example can be found here.