Round Peg, Square Hole

02 Oct 2006

EWL has been using the ecore_config subsystem to handle all of its
configuration tasks. I converted it over to ecore_config fairly soon after its
appearance in CVS. The way EWL worked was to hook into what is called the
_system portion of ecore_config so that its configuration wouldn’t show up if
an application was also using ecore_config.

Now, while this seemed like a good idea at the time, the tool to edit the
_system data for EWL, examine, has been busted for quite a while. Meaning, we
can’t change any default values in EWL. We have some command line options but
there limited.

So, I ripped it out. It doesn’t work, so we don’t use it. In its place we have a
simple system to use plain text key/value pair files. There is a system
configuration file in @PACKAGE_DATA_DIR@/ewl/config/ewl.cfg that contains all
of the possible keys.

Anything beginning with a # is a comment. So we’re really only using 6 keys out
of that file.

Along with the system config each user can have their own overrides in
~/.ewl/config/ewl.cfg.

The content of these files can be configured with the ewl_config command, or
edited by hand if desired. ewl_config can either be used from the command line
using the -set and -get flags or in GUI mode. If you run ewl_config as root, or
someone with permissions to write the system file, you’ll be able to set the
system configuration.

The ewl_config code can also handle application configuration. By calling
Ewl_Config *ewl_config_new(const char *app_name) you’ll be able to set and
get configuration for your application. This will work with user, system and
command line configuration. If you need to save the system configuration there
is a int ewl_config_can_save_system(Ewl_Config *cfg) that returns TRUE if
possible, FALSE otherwise.

Application configuration will be stored in
@PACKAGE_DATA_DIR@/ewl/config/apps/app_name.cfg and
~/.ewl/config/apps/app_name.cfg for system and user respectively.

The final piece to be completed for the ewl_config code in EWL is to to hook it
into ecore_dbus to send messages when the configuration is saved. Then other
instances of the application, or other users of the EWL library, can be notified
when configuration is changed. This will allow us to have EWL update its theme
as soon as the configuration is changed, assuming the user used ewl_config to do
the changing.

As usual, bug reports to xcomputerman.com/bugs.
If you want to discuss, either the enlightenment-devel mailing list or #ewl on
irc.freenode.net.