SF.net SVN: geany:[2794] trunk
eht16 at users.sourceforge.net
eht16 at xxxxx
Sun Jul 20 18:07:53 UTC 2008
Revision: 2794
http://geany.svn.sourceforge.net/geany/?rev=2794&view=rev
Author: eht16
Date: 2008-07-20 18:07:53 +0000 (Sun, 20 Jul 2008)
Log Message:
-----------
Move code to reload configuration files into utils_reload_configuration() and add it to the plugin API.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/callbacks.c
trunk/src/plugindata.h
trunk/src/plugins.c
trunk/src/utils.c
trunk/src/utils.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-07-20 17:12:34 UTC (rev 2793)
+++ trunk/ChangeLog 2008-07-20 18:07:53 UTC (rev 2794)
@@ -4,8 +4,10 @@
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>
* plugins/classbuilder.c, plugins/demoplugin.c, plugins/export.c,
Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c 2008-07-20 17:12:34 UTC (rev 2793)
+++ trunk/src/callbacks.c 2008-07-20 18:07:53 UTC (rev 2794)
@@ -2222,29 +2222,6 @@
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();
}
Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h 2008-07-20 17:12:34 UTC (rev 2793)
+++ trunk/src/plugindata.h 2008-07-20 18:07:53 UTC (rev 2794)
@@ -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 @@
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;
Modified: trunk/src/plugins.c
===================================================================
--- trunk/src/plugins.c 2008-07-20 17:12:34 UTC (rev 2793)
+++ trunk/src/plugins.c 2008-07-20 18:07:53 UTC (rev 2794)
@@ -170,7 +170,8 @@
&utils_get_setting_integer,
&utils_get_setting_string,
&utils_spawn_sync,
- &utils_spawn_async
+ &utils_spawn_async,
+ &utils_reload_configuration
};
static UIUtilsFuncs uiutils_funcs = {
Modified: trunk/src/utils.c
===================================================================
--- trunk/src/utils.c 2008-07-20 17:12:34 UTC (rev 2793)
+++ trunk/src/utils.c 2008-07-20 18:07:53 UTC (rev 2794)
@@ -1523,3 +1523,42 @@
#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."));
+}
Modified: trunk/src/utils.h
===================================================================
--- trunk/src/utils.h 2008-07-20 17:12:34 UTC (rev 2793)
+++ trunk/src/utils.h 2008-07-20 18:07:53 UTC (rev 2794)
@@ -141,4 +141,6 @@
GSpawnChildSetupFunc child_setup, gpointer user_data, GPid *child_pid,
GError **error);
+void utils_reload_configuration(void);
+
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list