Moving to GSettings

"7 Days of Shooting" 23 Oct 2007 - DigitalIn the beginning, Metacity stored keybindings in GConf.  There was one GConf key for each action, and the string value gave the key bound to it.  If it was undefined or “disabled”, there would be no key bound to that action.

In 2005, GNOME bug 164831 raised the point that other platforms used several keybindings for some of the actions. For example, the command to show the main menu is alt-f1 in CUA, but ctrl-Esc in Windows.  We decided to find a way to support mulitple keybindings for the sake of people transitioning from these systems.

This posed a further problem.  There is or was a principle that GConf configuration should be both forwards and backwards compatible.  In other words, if you take a Metacity configuration from any point in time, it should work as well as possible with every other version of Metacity, both later and earlier.  This meant that we couldn’t change the format of the single string keys.  So instead we created two keys: one, the original key, took a single string, and the other, a new key, took a list of strings.  This worked, but resulted in everything getting a lot more complicated.  It’s not clear that it was ever widely used.

Now, in GNOME bug 621204, there is a laudable move to switch Metacity to using the new GSettings API. The dual nature of the keybinding settings makes this problematic.  We could proceed by:

  • implementing it exactly as it is currently, even though it’s fiddly;
  • removing the ability to use multiple keybindings for the same action, even though that would break compatibility;
  • making all keybinding settings be lists of strings;
  • making all keybindings be represented by one very large settings, a list of pairs of strings.

Gentle reader, your thoughts on this are welcome, here or on the bug.

Photo © Matthew Boyle, cc-by-nc

Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported.