Branch: refs/heads/master Author: Jiří Techet techet@gmail.com Committer: GitHub noreply@github.com Date: Sun, 05 Jan 2025 13:28:57 UTC Commit: f38709bd967c8021771942972c7b0dcfa4ccb20c https://github.com/geany/geany/commit/f38709bd967c8021771942972c7b0dcfa4ccb2...
Log Message: ----------- Merge pull request #4069 from techee/geany_quit_signal
Add the geany-before-quit signal emitted before Geany is quitting
Modified Paths: -------------- doc/pluginsignals.c src/geanyobject.c src/geanyobject.h src/libmain.c src/plugindata.h
Modified: doc/pluginsignals.c 12 lines changed, 12 insertions(+), 0 deletions(-) =================================================================== @@ -221,6 +221,18 @@ signal void (*project_dialog_close)(GObject *obj, GtkWidget *notebook, gpointer */ signal void (*geany_startup_complete)(GObject *obj, gpointer user_data);
+/** Sent immediately after Geany is informed about user action leading to the Geany + * process termination. This signal is emitted before any actual tasks that happen + * during Geany shutdown such as project or file closing, plugin unload, widget + * destruction, etc. + * + * @param obj a GeanyObject instance, should be ignored. + * @param user_data user data. + * + * @since 2.1 + */ +signal void (*geany_before_quit)(GObject *obj, gpointer user_data); + /** Sent before build is started. A plugin could use this signal e.g. to save all unsaved documents * before the build starts. *
Modified: src/geanyobject.c 6 lines changed, 6 insertions(+), 0 deletions(-) =================================================================== @@ -213,6 +213,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_GEANY_BEFORE_QUIT] = g_signal_new ( + "geany-before-quit", + 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_BUILD_START] = g_signal_new ( "build-start", G_OBJECT_CLASS_TYPE (g_object_class),
Modified: src/geanyobject.h 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -58,6 +58,7 @@ typedef enum GCB_LOAD_SETTINGS, GCB_KEY_PRESS_NOTIFY, GCB_DOCUMENT_BEFORE_SAVE_AS, + GCB_GEANY_BEFORE_QUIT, GCB_MAX } GeanyCallbackId;
Modified: src/libmain.c 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -1300,6 +1300,8 @@ static void queue_free(GQueue *queue)
static gboolean do_main_quit(void) { + g_signal_emit_by_name(geany_object, "geany-before-quit"); + configuration_save();
if (app->project != NULL) @@ -1313,8 +1315,6 @@ static gboolean do_main_quit(void)
geany_debug("Quitting...");
- main_status.quitting = TRUE; - #ifdef HAVE_SOCKET socket_finalize(); #endif
Modified: src/plugindata.h 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -57,7 +57,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 249 +#define GEANY_API_VERSION 250
/* hack to have a different ABI when built with different GTK major versions * because loading plugins linked to a different one leads to crashes.
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).