Merge pull request #361 from techee/prj_write

Add project_write_config() to force project file rewrite
This commit is contained in:
Colomban Wendling 2014-12-11 00:07:41 +01:00
commit 87331093a9
5 changed files with 31 additions and 1 deletions

View File

@ -438,5 +438,7 @@
geany_functions->p_build->build_set_menu_item
#define build_get_group_count \
geany_functions->p_build->build_get_group_count
#define project_write_config \
geany_functions->p_project->project_write_config
#endif

View File

@ -296,6 +296,7 @@ typedef struct GeanyFunctions
struct StashFuncs *p_stash; /**< See stash.h */
struct SymbolsFuncs *p_symbols; /**< See symbols.h */
struct BuildFuncs *p_build; /**< See build.h */
struct ProjectFuncs *p_project; /**< See project.h */
}
GeanyFunctions;
@ -746,6 +747,13 @@ typedef struct BuildFuncs
}
BuildFuncs;
/* See project.h */
typedef struct ProjectFuncs
{
void (*project_write_config)(void);
}
ProjectFuncs;
/* Deprecated aliases */
#ifndef GEANY_DISABLE_DEPRECATED

View File

@ -362,6 +362,10 @@ static BuildFuncs build_funcs = {
&build_get_group_count
};
static ProjectFuncs project_funcs = {
&project_write_config
};
static GeanyFunctions geany_functions = {
&doc_funcs,
&sci_funcs,
@ -385,7 +389,8 @@ static GeanyFunctions geany_functions = {
&msgwin_funcs,
&stash_funcs,
&symbols_funcs,
&build_funcs
&build_funcs,
&project_funcs
};
static GeanyData geany_data;

View File

@ -1148,6 +1148,18 @@ static gboolean write_config(gboolean emit_signal)
}
/** Forces the project file rewrite and emission of the project-save signal. Plugins
* can use this function to save additional project data outside the project dialog.
*
* @since 1.25
*/
void project_write_config(void)
{
if (!write_config(TRUE))
SHOW_ERR(_("Project file could not be written"));
}
/* Constructs the project's base path which is used for "Make all" and "Execute".
* The result is an absolute string in UTF-8 encoding which is either the same as
* base path if it is absolute or it is built out of project file name's dir and base_path.

View File

@ -47,6 +47,9 @@ typedef struct GeanyProject
GeanyProject;
void project_write_config(void);
#ifdef GEANY_PRIVATE
typedef struct ProjectPrefs