Kaydet (Commit) b7839a6e authored tarafından Matthew Brush's avatar Matthew Brush Kaydeden (comit) Colomban Wendling

Add "project-before-close" signal to API

Closes #1223.
üst 931df75f
......@@ -159,6 +159,15 @@ signal void (*project_save)(GObject *obj, GKeyFile *config, gpointer user_data);
*/
signal void (*project_close)(GObject *obj, gpointer user_data);
/** Sent before a project is closed.
*
* @param obj a GeanyObject instance, should be ignored.
* @param user_data user data.
*
* @since 1.29 (API 230)
*/
signal void (*project_before_close)(GObject *obj, gpointer user_data);
/** Sent after a project dialog is opened but before it is displayed. Plugins
* can append their own project settings tabs by using this signal.
*
......
......@@ -156,6 +156,12 @@ static void create_signals(GObjectClass *g_object_class)
G_SIGNAL_RUN_FIRST,
0, NULL, NULL, g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
geany_object_signals[GCB_PROJECT_BEFORE_CLOSE] = g_signal_new (
"project-before-close",
G_OBJECT_CLASS_TYPE (g_object_class),
G_SIGNAL_RUN_FIRST,
0, NULL, NULL, g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
geany_object_signals[GCB_PROJECT_DIALOG_OPEN] = g_signal_new (
"project-dialog-open",
G_OBJECT_CLASS_TYPE (g_object_class),
......
......@@ -47,6 +47,7 @@ typedef enum
GCB_PROJECT_OPEN,
GCB_PROJECT_SAVE,
GCB_PROJECT_CLOSE,
GCB_PROJECT_BEFORE_CLOSE,
GCB_PROJECT_DIALOG_OPEN,
GCB_PROJECT_DIALOG_CONFIRMED,
GCB_PROJECT_DIALOG_CLOSE,
......
......@@ -59,7 +59,7 @@ G_BEGIN_DECLS
* @warning You should not test for values below 200 as previously
* @c GEANY_API_VERSION was defined as an enum value, not a macro.
*/
#define GEANY_API_VERSION 229
#define GEANY_API_VERSION 230
/* hack to have a different ABI when built with GTK3 because loading GTK2-linked plugins
* with GTK3-linked Geany leads to crash */
......
......@@ -425,6 +425,8 @@ static void destroy_project(gboolean open_default)
g_return_if_fail(app->project != NULL);
g_signal_emit_by_name(geany_object, "project-before-close");
/* remove project filetypes build entries */
if (app->project->priv->build_filetypes_list != NULL)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment