mirror of
https://github.com/brl/mutter.git
synced 2024-12-24 12:02:04 +00:00
prefs: Add get_keybinding_label() method
Commit 7e9d9c7eb9
added new API to replace GTK for accelerator
parsing.
Unfortunately there is another case in gnome-shell, where we have
to get the label from the logical binding name rather than the
modifier+keysym combination.
Add another small method to cover that use case.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2899>
This commit is contained in:
parent
3ac82a58c5
commit
f90749916a
@ -2186,6 +2186,22 @@ meta_prefs_get_keybinding_action (const char *name)
|
||||
: META_KEYBINDING_ACTION_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_prefs_get_keybinding_label:
|
||||
* Returns: (transfer full) (nullable)
|
||||
*/
|
||||
char *
|
||||
meta_prefs_get_keybinding_label (const char *name)
|
||||
{
|
||||
MetaKeyPref *pref = g_hash_table_lookup (key_bindings, name);
|
||||
MetaKeyCombo *combo = NULL;
|
||||
|
||||
if (pref && pref->combos)
|
||||
combo = pref->combos->data;
|
||||
|
||||
return combo ? meta_accelerator_name (combo->modifiers, combo->keysym) : NULL;
|
||||
}
|
||||
|
||||
gint
|
||||
meta_prefs_get_mouse_button_resize (void)
|
||||
{
|
||||
|
@ -468,6 +468,9 @@ GType meta_key_binding_get_type (void);
|
||||
META_EXPORT
|
||||
MetaKeyBindingAction meta_prefs_get_keybinding_action (const char *name);
|
||||
|
||||
META_EXPORT
|
||||
char * meta_prefs_get_keybinding_label (const char *name);
|
||||
|
||||
META_EXPORT
|
||||
gboolean meta_prefs_get_visual_bell (void);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user