Add project_write_config() to force project file rewrite
Since plugins don't have direct access to the project file, only through the project-save signal, they need some way to emit this signal when saving their preferences outside the project dialog, which is what this function does.
This commit is contained in:
parent
c35dedf35f
commit
233ca08e88
@ -436,5 +436,7 @@
|
|||||||
geany_functions->p_build->build_set_menu_item
|
geany_functions->p_build->build_set_menu_item
|
||||||
#define build_get_group_count \
|
#define build_get_group_count \
|
||||||
geany_functions->p_build->build_get_group_count
|
geany_functions->p_build->build_get_group_count
|
||||||
|
#define project_write_config \
|
||||||
|
geany_functions->p_project->project_write_config
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -288,6 +288,7 @@ typedef struct GeanyFunctions
|
|||||||
struct StashFuncs *p_stash; /**< See stash.h */
|
struct StashFuncs *p_stash; /**< See stash.h */
|
||||||
struct SymbolsFuncs *p_symbols; /**< See symbols.h */
|
struct SymbolsFuncs *p_symbols; /**< See symbols.h */
|
||||||
struct BuildFuncs *p_build; /**< See build.h */
|
struct BuildFuncs *p_build; /**< See build.h */
|
||||||
|
struct ProjectFuncs *p_project; /**< See project.h */
|
||||||
}
|
}
|
||||||
GeanyFunctions;
|
GeanyFunctions;
|
||||||
|
|
||||||
@ -738,6 +739,13 @@ typedef struct BuildFuncs
|
|||||||
}
|
}
|
||||||
BuildFuncs;
|
BuildFuncs;
|
||||||
|
|
||||||
|
/* See project.h */
|
||||||
|
typedef struct ProjectFuncs
|
||||||
|
{
|
||||||
|
void (*project_write_config)(void);
|
||||||
|
}
|
||||||
|
ProjectFuncs;
|
||||||
|
|
||||||
/* Deprecated aliases */
|
/* Deprecated aliases */
|
||||||
#ifndef GEANY_DISABLE_DEPRECATED
|
#ifndef GEANY_DISABLE_DEPRECATED
|
||||||
|
|
||||||
|
@ -361,6 +361,10 @@ static BuildFuncs build_funcs = {
|
|||||||
&build_get_group_count
|
&build_get_group_count
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static ProjectFuncs project_funcs = {
|
||||||
|
&project_write_config
|
||||||
|
};
|
||||||
|
|
||||||
static GeanyFunctions geany_functions = {
|
static GeanyFunctions geany_functions = {
|
||||||
&doc_funcs,
|
&doc_funcs,
|
||||||
&sci_funcs,
|
&sci_funcs,
|
||||||
@ -384,7 +388,8 @@ static GeanyFunctions geany_functions = {
|
|||||||
&msgwin_funcs,
|
&msgwin_funcs,
|
||||||
&stash_funcs,
|
&stash_funcs,
|
||||||
&symbols_funcs,
|
&symbols_funcs,
|
||||||
&build_funcs
|
&build_funcs,
|
||||||
|
&project_funcs
|
||||||
};
|
};
|
||||||
|
|
||||||
static GeanyData geany_data;
|
static GeanyData geany_data;
|
||||||
|
@ -1153,6 +1153,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".
|
/* 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
|
* 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.
|
* base path if it is absolute or it is built out of project file name's dir and base_path.
|
||||||
|
@ -47,6 +47,9 @@ typedef struct GeanyProject
|
|||||||
GeanyProject;
|
GeanyProject;
|
||||||
|
|
||||||
|
|
||||||
|
void project_write_config(void);
|
||||||
|
|
||||||
|
|
||||||
#ifdef GEANY_PRIVATE
|
#ifdef GEANY_PRIVATE
|
||||||
|
|
||||||
typedef struct ProjectPrefs
|
typedef struct ProjectPrefs
|
||||||
|
Loading…
x
Reference in New Issue
Block a user