From c068d91f3ff0b51444577f09f26b1d80cee62fe1 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Sun, 4 Oct 2015 00:54:01 +0100 Subject: [PATCH] Use should_quit() to prevent quit() from terminating We query the should_quit() vfunc, and use its return value to determine whether or not the application should terminate. --- gio/gapplication.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gio/gapplication.c b/gio/gapplication.c index 6459855b8..d0ac04475 100644 --- a/gio/gapplication.c +++ b/gio/gapplication.c @@ -2534,6 +2534,10 @@ g_application_set_default (GApplication *application) * Upon return to the mainloop, g_application_run() will return, * calling only the 'shutdown' function before doing so. * + * It's possible to prevent quitting the application in subclasses + * of #GApplication, by overriding the #GApplicationClass.should_quit() + * virtual function. + * * The hold count is ignored. * * The result of calling g_application_run() again after it returns is @@ -2546,7 +2550,8 @@ g_application_quit (GApplication *application) { g_return_if_fail (G_IS_APPLICATION (application)); - application->priv->must_quit_now = TRUE; + application->priv->must_quit_now = + G_APPLICATION_GET_CLASS (application)->should_quit (application); } /**