Export keybindings_load_keyfile() for plugins

This allows plugins to reload keybindings later during their execution.
For more info see the comment in the commit.

Closes #1430
This commit is contained in:
Jiří Techet 2017-03-15 21:32:06 +01:00 committed by Matthew Brush
parent 169feae90e
commit 745f424b77
2 changed files with 11 additions and 2 deletions

View File

@ -824,6 +824,15 @@ static void apply_kb_accel(GeanyKeyGroup *group, GeanyKeyBinding *kb, gpointer u
} }
/** Reloads keybinding settings from configuration file. Normally plugins do
* not need to call this function as it is called automatically when a the
* plugin is activated. However, plugins which need to create keybindings
* dynamically and reload them when needed should call this function after
* all keybindings have been updated with plugin_set_key_group() and
* keybindings_set_item() calls - this makes sure that the corresponding user
* keybinding shortcuts are applied.
* @since 1.31. */
GEANY_API_SYMBOL
void keybindings_load_keyfile(void) void keybindings_load_keyfile(void)
{ {
load_user_kb(); load_user_kb();

View File

@ -293,6 +293,8 @@ GeanyKeyBinding *keybindings_get_item(GeanyKeyGroup *group, gsize key_id);
GdkModifierType keybindings_get_modifiers(GdkModifierType mods); GdkModifierType keybindings_get_modifiers(GdkModifierType mods);
void keybindings_load_keyfile(void);
#ifdef GEANY_PRIVATE #ifdef GEANY_PRIVATE
extern GPtrArray *keybinding_groups; /* array of GeanyKeyGroup pointers */ extern GPtrArray *keybinding_groups; /* array of GeanyKeyGroup pointers */
@ -300,8 +302,6 @@ extern GPtrArray *keybinding_groups; /* array of GeanyKeyGroup pointers */
void keybindings_init(void); void keybindings_init(void);
void keybindings_load_keyfile(void);
void keybindings_free(void); void keybindings_free(void);
GeanyKeyGroup *keybindings_get_core_group(guint id); GeanyKeyGroup *keybindings_get_core_group(guint id);