Move code to reload configuration files into utils_reload_configuration() and add it to the plugin API.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2794 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
d0ec5f6134
commit
8f38a69121
@ -4,7 +4,9 @@
|
||||
Add menu item accelerators first after default and user keybindings
|
||||
have been read to avoid that menu item accelerators of user
|
||||
keybindings can't be overridden anymore (closes #2021703).
|
||||
|
||||
* src/callbacks.c, src/plugindata.h, src/plugins.c, src/utils.c, src/utils.h:
|
||||
Move code to reload configuration files into utils_reload_configuration()
|
||||
and add it to the plugin API.
|
||||
|
||||
2008-07-18 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
|
||||
|
||||
|
@ -2222,29 +2222,6 @@ void
|
||||
on_menu_reload_configuration1_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
guint i;
|
||||
|
||||
/* reload templates */
|
||||
templates_free_templates();
|
||||
templates_init();
|
||||
|
||||
/* reload snippets */
|
||||
editor_snippets_free();
|
||||
editor_snippets_init();
|
||||
|
||||
/* reload filetype extensions */
|
||||
configuration_read_filetype_extensions();
|
||||
|
||||
/* save possibly changed commands before re-reading them */
|
||||
filetypes_save_commands();
|
||||
|
||||
/* reload filetype configs */
|
||||
for (i = 0; i < filetypes_array->len; i++)
|
||||
{
|
||||
/* filetypes_load_config() will skip not loaded filetypes */
|
||||
filetypes_load_config(i, TRUE);
|
||||
}
|
||||
|
||||
ui_set_statusbar(TRUE, _("Configuration files reloaded."));
|
||||
utils_reload_configuration();
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
/* The API version should be incremented whenever any plugin data types below are
|
||||
* modified or appended to. */
|
||||
static const gint api_version = 78;
|
||||
static const gint api_version = 79;
|
||||
|
||||
/* The ABI version should be incremented whenever existing fields in the plugin
|
||||
* data types below have to be changed or reordered. It should stay the same if fields
|
||||
@ -300,6 +300,7 @@ typedef struct UtilsFuncs
|
||||
gboolean (*spawn_async) (const gchar *dir, gchar **argv, gchar **env, GSpawnFlags flags,
|
||||
GSpawnChildSetupFunc child_setup, gpointer user_data, GPid *child_pid,
|
||||
GError **error);
|
||||
void (*reload_configuration) (void);
|
||||
}
|
||||
UtilsFuncs;
|
||||
|
||||
|
@ -170,7 +170,8 @@ static UtilsFuncs utils_funcs = {
|
||||
&utils_get_setting_integer,
|
||||
&utils_get_setting_string,
|
||||
&utils_spawn_sync,
|
||||
&utils_spawn_async
|
||||
&utils_spawn_async,
|
||||
&utils_reload_configuration
|
||||
};
|
||||
|
||||
static UIUtilsFuncs uiutils_funcs = {
|
||||
|
39
src/utils.c
39
src/utils.c
@ -1523,3 +1523,42 @@ gboolean utils_spawn_async(const gchar *dir, gchar **argv, gchar **env, GSpawnFl
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reloads most of Geany's configuration files without restarting. Currently the following
|
||||
* files are reloaded: all template files, also new file templates and the 'New (with template)'
|
||||
* menus will be updated, Snippets (snippets.conf), filetype extensions (filetype_extensions.conf),
|
||||
* and 'settings' and 'build_settings' sections of the filetype definition files.
|
||||
*
|
||||
* Plugins may call this function if they changed any of these files (e.g. a configuration file
|
||||
* editor plugin).
|
||||
*
|
||||
**/
|
||||
void utils_reload_configuration(void)
|
||||
{
|
||||
guint i;
|
||||
|
||||
/* reload templates */
|
||||
templates_free_templates();
|
||||
templates_init();
|
||||
|
||||
/* reload snippets */
|
||||
editor_snippets_free();
|
||||
editor_snippets_init();
|
||||
|
||||
/* reload filetype extensions */
|
||||
configuration_read_filetype_extensions();
|
||||
|
||||
/* save possibly changed commands before re-reading them */
|
||||
filetypes_save_commands();
|
||||
|
||||
/* reload filetype configs */
|
||||
for (i = 0; i < filetypes_array->len; i++)
|
||||
{
|
||||
/* filetypes_load_config() will skip not loaded filetypes */
|
||||
filetypes_load_config(i, TRUE);
|
||||
}
|
||||
|
||||
ui_set_statusbar(TRUE, _("Configuration files reloaded."));
|
||||
}
|
||||
|
@ -141,4 +141,6 @@ gboolean utils_spawn_async(const gchar *dir, gchar **argv, gchar **env, GSpawnFl
|
||||
GSpawnChildSetupFunc child_setup, gpointer user_data, GPid *child_pid,
|
||||
GError **error);
|
||||
|
||||
void utils_reload_configuration(void);
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user