From: <ni...@te...> - 2002-12-10 23:26:43
|
After some chat in the IRC channel, I've set myself the mission of trying to improve the configuration system. Currenty, gaim has a configuration system which seems to have the following main goals: * Instant setting activation. * Minimum *bit* overhead. I'd like to remove the second goal. What I propose is a system where each pref has a name, and it's retrieved with a function. My idea would be to model the system to be similar to gconf, so that it gconf support can be a ./configure option. The API could resemble this: gboolean get_bool_pref(GQuark pref); void set_bool_pref(GQuark pref, gboolean value); GQuark is a way to be able to optimize things. It's like an "atom" in other systems. It can be viewed as a string. The pref names (represented by GQuark's) would be hierarchical: /sound/nice_sounds /misc/debug_window (In gconf they would be prepended with /apps/gaim ). There would be a system which will enable parts of gaim to register some function pointer to be called when a property changes. As the most important use for this would be to update a local variable, I propose an API like this one: gboolean myProp; int handle = track_bool_pref(GQuark pref, &myProp); while( ... ) { // we use myProp a lot here } dont_track_pref(handle); When using gconf this will allow instant change of things when somebody edits prefs with a gconf editor. Avoiding the overhead of querying the pref each time the user types a key. For the not-gconf version I would use two GData variables. One for the pref values ("all_prefs") and one for the default pref values ("all_default_prefs"). The getter functions would first query "all_prefs", and then fallback to "all_default_prefs". This way there could be buttons to reset prefs to "factory defaults" (they will just remove the value in "all_prefs"). And the prefs which are not touched will be able to change between gaim versions. But if the user has edited the pref, then it would override the default (until the user reset the pref). Having an API like this one will make very easy other improvements, like smarter gaimrc saving. Well.. any thoughts? I must go now, bye! =) |