Signed-off-by: Jiří Techet techet@gmail.com --- doc/plugins.dox | 12 ++++++++++++ src/build.c | 2 ++ src/geanyobject.c | 8 ++++++++ src/geanyobject.h | 2 ++ 4 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/doc/plugins.dox b/doc/plugins.dox index df156eb..ba3128a 100644 --- a/doc/plugins.dox +++ b/doc/plugins.dox @@ -253,6 +253,18 @@ PluginCallback plugin_callbacks[] = * @param user_data user data. * @endsignaldef * + * @signaldef build-notify + * @signalproto + * void user_function(GObject *obj, gpointer user_data); + * @endsignalproto + * @signaldesc + * Sent before build is started. Plugins can use this signal e.g. to save the opened documents + * before the build starts. + * + * @param obj a GeanyObject instance, should be ignored. + * @param user_data user data. + * @endsignaldef + * * @signaldef update-editor-menu * @signalproto * void user_function(GObject *obj, const gchar *word, gint pos, GeanyDocument *doc, diff --git a/src/build.c b/src/build.c index 2baa035..66cb52c 100644 --- a/src/build.c +++ b/src/build.c @@ -1243,6 +1243,8 @@ static void on_build_menu_item(GtkWidget *w, gpointer user_data) gint grp = GPOINTER_TO_GRP(user_data); gint cmd = GPOINTER_TO_CMD(user_data);
+ g_signal_emit_by_name(geany_object, "build-notify"); + if (doc && doc->changed) document_save_file(doc, FALSE); if (grp == GEANY_GBG_NON_FT && cmd == GBO_TO_CMD(GEANY_GBO_CUSTOM)) diff --git a/src/geanyobject.c b/src/geanyobject.c index 6e4d36e..41e6e16 100644 --- a/src/geanyobject.c +++ b/src/geanyobject.c @@ -292,6 +292,14 @@ static void create_signals(GObjectClass *g_object_class) NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + geany_object_signals[GCB_BUILD_NOTIFY] = g_signal_new ( + "build-notify", + G_OBJECT_CLASS_TYPE (g_object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (GeanyObjectClass, build_notify), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0);
/* Core-only signals */ geany_object_signals[GCB_SAVE_SETTINGS] = g_signal_new ( diff --git a/src/geanyobject.h b/src/geanyobject.h index 1bfc70f..aa04613 100644 --- a/src/geanyobject.h +++ b/src/geanyobject.h @@ -45,6 +45,7 @@ typedef enum GCB_UPDATE_EDITOR_MENU, GCB_EDITOR_NOTIFY, GCB_GEANY_STARTUP_COMPLETE, + GCB_BUILD_NOTIFY, GCB_SAVE_SETTINGS, GCB_LOAD_SETTINGS, GCB_MAX @@ -90,6 +91,7 @@ struct _GeanyObjectClass void (*update_editor_menu)(const gchar *word, gint click_pos, GeanyDocument *doc); gboolean (*editor_notify)(GeanyEditor *editor, gpointer scnt); void (*geany_startup_complete)(void); + void (*build_notify)(void); void (*save_settings)(GKeyFile *keyfile); void (*load_settings)(GKeyFile *keyfile); };