Some thoughts on settings manager

Jasper Huijsmans jasper at moongroup.com
Mon Nov 18 15:52:26 CET 2002


Apologies to Chuck, for posting from the wrong adress initially. Sorry 
about that.

Hi Olivier, list,

while I was working ...

Ok, so I didn't want to work. Anyway, I started thinking about our new 
settingsmanager and the plugin system you proposed. Just for the sake of 
clearing my mind I'll write down my understanding of how it works (or 
should work).

As I see it there are four basic ways in which code may need to interact 
with the settings manger:

1) listening
This is easy and fully covered by the client library. An app can listen 
to it's own channel and others.

2) requesting a configuration dialog for a channel.
This is accomplished by the client library using the "SHOW" atom.

3) registering a channel and options
This can either be done by the app or by the plugins. To find the 
plugins the app could provide a location for the plugin or the settings 
manager searches a number of predefined locations (XFSETTINGS_PLUGIN_PATH?).

I think the plugins should set initial defaults since only they have 
direct access to the setttings manager. The application would require 
extra API to set values for properties and that would partially defeat 
the purpose of the plugins.

After obtaining the inital default values the settings manager can see 
if it has saved previous values and apply those instead of the defaults 
given.

4) Actually changing the settings
The plugins can do this using the settings manager library if they have 
a pointer to the XSettingsManager structure.

Functions a plugin must provide:

   char *get_channel_name(void);
   void *set_default_values(XSettingsManager *sm);
   GtkWidget *create_options_dialog(XSettingsManager *sm);

We have to think about what we want. If we want all separate dialogs the 
function can be

   void run_options_dialog(XSettingsManger *sm);

if we want a control-center-like app, the dialog needs buttons to revert 
the options and close the dialog and the plugin needs access to the 
revert button at least.

   GtkWidget *create_options_dialog(XSettingsManager *sm,
                                    GtkWidget *revert);


The settings manager saves the settings in a simple xml format, like:

<channel name="SETTINGS">
   <option name="Net/Doubleclicktime" type="INT" value="50"/>
</channel>
<channel name="XFCE">
   <option name="size" type="INT" value="1"/>
   <option name="theme" type="STRING" value="Curve"/>
</channel>

To reduce memory usage the settings manager should load and unload the 
plugins when required. Initially all plugins are opened, their name and 
location saved in a list, the channel is created and the plugin is asked 
to set default values for the options. Then the plugin is closed and 
opened when a client request a dialog for that channel.

Well, this is how I understand it. Am I missing anything?

Should I try to write a sample plugin for the panel based on this API?

     Jasper





More information about the Xfce4-dev mailing list