[glib/wip/ebassi/application-quit: 2/4] Use should_quit() to prevent quit() from terminating



commit c068d91f3ff0b51444577f09f26b1d80cee62fe1
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Sun Oct 4 00:54:01 2015 +0100

    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 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/gio/gapplication.c b/gio/gapplication.c
index 6459855..d0ac044 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);
 }
 
 /**


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]