After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 410758 - Should be pluggable
Should be pluggable
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: [obsolete] Keybinding
git master
Other Linux
: Normal enhancement
: ---
Assigned To: Control-Center Maintainers
Control-Center Maintainers
Depends on:
Blocks: 376045 410759 410760 413538
 
 
Reported: 2007-02-22 11:40 UTC by Bastien Nocera
Modified: 2007-03-19 15:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gcc-pluggable-bindings.patch (5.82 KB, patch)
2007-02-22 18:19 UTC, Bastien Nocera
needs-work Details | Review
gcc-pluggable-bindings-2.patch (7.63 KB, patch)
2007-02-23 14:52 UTC, Bastien Nocera
needs-work Details | Review
gcc-pluggable-bindings-3.patch (14.55 KB, patch)
2007-03-01 15:57 UTC, Bastien Nocera
needs-work Details | Review
gcc-pluggable-bindings-4.patch (30.79 KB, patch)
2007-03-01 17:07 UTC, Bastien Nocera
needs-work Details | Review
test.c (5.71 KB, text/plain)
2007-03-01 17:08 UTC, Bastien Nocera
  Details
gcc-pluggable-bindings-5.patch (31.52 KB, patch)
2007-03-05 11:08 UTC, Bastien Nocera
committed Details | Review

Description Bastien Nocera 2007-02-22 11:40:19 UTC
The current arch is very static, and compiled in. We should have a plugin system for application to allow desktop-wide shortcuts (useful for Beagle, and Tomboy), as well as a way to check whether a particular window manager is running, so we can add compiz/beryl support to the app.

I'm thinking simple xml files (with translations), actions <-> associated GConf key, and a way to check which window manager is running (for compiz/beryl support).
Comment 1 Thomas Wood 2007-02-22 11:47:44 UTC
There are already some functions for window manager detection in capplets/common/wm-common.{c,h}
Comment 2 Bastien Nocera 2007-02-22 18:19:32 UTC
Created attachment 83118 [details] [review]
gcc-pluggable-bindings.patch

A braindump. It will parse .xml files in the current directory, and add them to the tree. It doesn't support section names, or using the ".data".

Here's an exaample file:
<?xml version="1.0" encoding="UTF-8" ?>
<KeyListEntries>
        <KeyListEntry
                name="/apps/gnome_settings_daemon/keybindings/help"
                visibility="ALWAYS_VISIBLE"
                data="1" />
</KeyListEntries>
Comment 3 Bastien Nocera 2007-02-23 14:52:55 UTC
Created attachment 83172 [details] [review]
gcc-pluggable-bindings-2.patch

Take 2. Loads the section name from the .xml, loads ".data" correctly, some bits of conditions support added (which actually work in our case, but only because we currently have some builtin support).

This is an updated file.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<KeyListEntries name="My not so supa-test">
        <Condition
        name="N_WORKSPACES_GT"
        key="/apps/metacity/general/num_workspaces"
        comparison="gt" />

        <KeyListEntry
        name="/apps/gnome_settings_daemon/keybindings/help"
        visibility="ALWAYS_VISIBLE"
        data="1" />
        <KeyListEntry
        name="/apps/metacity/window_keybindings/move_to_workspace_12"
        visibility="N_WORKSPACES_GT"
        data="11" />
        <KeyListEntry
        name="/apps/metacity/window_keybindings/move_to_workspace_5"
        visibility="N_WORKSPACES_GT"
        data="4" />
</KeyListEntries>
Comment 4 Jens Granseuer 2007-02-23 17:43:01 UTC
Should the window manager name be in there somewhere? Or would you just install a separate file per wm?
Comment 5 Bastien Nocera 2007-02-23 18:27:15 UTC
(In reply to comment #4)
> Should the window manager name be in there somewhere? Or would you just install
> a separate file per wm?

I have that code on my HD now. You can put the window manager's expected name in the .xml file.
Comment 6 Bastien Nocera 2007-03-01 15:57:09 UTC
Created attachment 83647 [details] [review]
gcc-pluggable-bindings-3.patch

Another patch, with some of the keybindings implemented. I have a problem with some of the keybindings being window manager dependent, but in the same section as "always" keybindings. Need to fix that...
Comment 7 Bastien Nocera 2007-03-01 17:07:24 UTC
Created attachment 83655 [details] [review]
gcc-pluggable-bindings-4.patch

All fixed up.

We now get:
- XML files-based definition for keybindings
- Per-window manager keybindings (no more hacking the sources)
- Conditional appearance supporting any GConf key with an integer type
- Ability to prioritise entries/sections, through the filenames

The Metacity XML files obviously need to go in Metacity itself. But until then, this patch ensures feature-parity.

There's only one FIXME in the code. The path to find the XML file needs to be the install pkgdatadir.
Comment 8 Bastien Nocera 2007-03-01 17:08:55 UTC
Created attachment 83656 [details]
test.c

The gruesome piece of code used to generate the metacity xml.in file.
Comment 9 Bastien Nocera 2007-03-01 18:00:43 UTC
I just realised that the code I attached wouldn't be able to translate .xml files from other modules properly. Need to add a package name in the .xml file, and use dgettext.
Comment 10 Bastien Nocera 2007-03-05 11:08:50 UTC
Created attachment 83952 [details] [review]
gcc-pluggable-bindings-5.patch

Allows the "package" property in XML files to set the package that should be used to translate the section name.
Comment 11 Bastien Nocera 2007-03-19 15:18:36 UTC
Committed to trunk!

2007-03-19  Bastien Nocera  <hadess@hadess.net>

        * capplets/keybindings/00-multimedia-key.xml.in:
        * capplets/keybindings/01-desktop-key.xml.in:
        * capplets/keybindings/50-metacity-desktop-key.xml.in:
        * capplets/keybindings/50-metacity-key.xml.in:
        * capplets/keybindings/Makefile.am:
        * capplets/keybindings/gnome-keybinding-properties.c:
        (create_dialog), (should_show_key), (count_rows_foreach),
        (ensure_scrollbar), (append_keys_to_tree), (parse_start_tag),
        (append_keys_to_tree_from_file), (reload_key_entries),
        (setup_dialog):
        * po/POTFILES.in: Make all the keybindings be external to the keybindings
        capplet itself. This allows applications to add their own keybindings
        without recompilation (Closes: #410758)