Re: Possible API break: Extensions + Keybindings

On Tue, 2012-04-10 at 15:29 -0400, Jasper St. Pierre wrote:
> For 3.4.0, we landed a giant port of keybindings to GSettings. This
> was supposed to give extensions the ability to add keybindings, but
> due to a review oversight, there were problems with the proposed API.
> I have a patch that I would like Florian to review that changes the
> API for mutter/gnome-shell to allow extensions to add keybindings.
> Whether this is an API break is up for debate - while it does change
> API, due to how it was constructed the only possible users for it was
> the internal gnome-shell code, and we can guarantee that we can fix
> that. Unfortunately, Florian is on vacation right now, and it may be a
> tight squeeze between when he gets back and when he reviews the code,
> so I'm hoping that the release team can help me out here.

To clarify, we don't need code review on this - we can do that within
the GNOME Shell team, I asked Jasper to send this mail to make sure that
we were carefully communicating this change and not catching anybody off

The API change is:

gboolean meta_prefs_add_keybinding (const char           *name,
-                                   const char           *schema,
+                                   GSettings            *settings,
                                    MetaKeyBindingAction  action,
                                    MetaKeyBindingFlags   flags);

This API was added in the 3.4 cycle to make it possible to set up
new keybindings without having to modify the Mutter source code and the
global schemas. This was meant both for gnome-shell and for gnome shell
extensions. The above API works for GNOME Shell, but it doesn't work for
GNOME Shell extensions since extensions GSettings schemas live in their
own world (a different GSettingsSource) and not in the global namespace
of system installed extensions referred to by 'schema'.

The two (fairly minor) downsides of making this change are:

 * We would require matched upgrades of GNOME Shell and Mutter

 * If someone wrote a system-installed extension with system-installed
   schemas, then they could have used this API.

In addition this means that there will be extensions that work only with
3.4.x for x >= 1, but that can easily happen with bug fixes as well
and people can mark their extensions on to be
compatible only with 3.4.1, 3.4.2, 3.4.3, 3.4.4 (for however many
dot-releases they guess we'll make).

The upside is that we'd allow extensions to be written for the 3.4 cycle
that add keybindings, something that we've mentioned as a new feature to
extension authors, and definitely is useful.

Alternative approach is to add meta_prefs_add_keybinding_for_settings()
which avoids both of the downsides above, but clutters up the API and
means there is an API left over that looks like it should work for
extension authors but doesn't.

I'm OK with the API addition - in terms of whether to do it with a new
name, or keep stricter compatibility - I don't think it's a huge
difference and basically would leave it up to Florian who write the API
originally. If it's a more convenient API for some things, then maybe we
should just leave it and add new API alongside.

- Owen

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]