[glib] GApplication: introduce ::shutdown
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] GApplication: introduce ::shutdown
- Date: Wed, 14 Sep 2011 17:46:01 +0000 (UTC)
commit 15b1c1bf4f782189cf881a44b9116460a066c5da
Author: Brian Koning <brkoning gmail com>
Date: Wed Sep 14 13:42:35 2011 -0400
GApplication: introduce ::shutdown
Introduce ::shutdown as a dual to ::startup.
https://bugzilla.gnome.org/show_bug.cgi?id=643934
gio/gapplication.c | 22 ++++++++++++++++++++++
gio/gapplication.h | 5 ++++-
2 files changed, 26 insertions(+), 1 deletions(-)
---
diff --git a/gio/gapplication.c b/gio/gapplication.c
index 7055a73..7fa406f 100644
--- a/gio/gapplication.c
+++ b/gio/gapplication.c
@@ -176,6 +176,7 @@ enum
enum
{
SIGNAL_STARTUP,
+ SIGNAL_SHUTDOWN,
SIGNAL_ACTIVATE,
SIGNAL_OPEN,
SIGNAL_ACTION,
@@ -209,6 +210,11 @@ g_application_real_startup (GApplication *application)
}
static void
+g_application_real_shutdown (GApplication *application)
+{
+}
+
+static void
g_application_real_activate (GApplication *application)
{
if (!g_signal_has_handler_pending (application,
@@ -520,6 +526,7 @@ g_application_class_init (GApplicationClass *class)
class->before_emit = g_application_real_before_emit;
class->after_emit = g_application_real_after_emit;
class->startup = g_application_real_startup;
+ class->shutdown = g_application_real_shutdown;
class->activate = g_application_real_activate;
class->open = g_application_real_open;
class->command_line = g_application_real_command_line;
@@ -581,6 +588,18 @@ g_application_class_init (GApplicationClass *class)
NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
/**
+ * GApplication::shutdown:
+ * @application: the application
+ *
+ * The ::shutdown signal is emitted only on the registered primary instance
+ * immediately after the main loop terminates.
+ */
+ g_application_signals[SIGNAL_SHUTDOWN] =
+ g_signal_new ("shutdown", G_TYPE_APPLICATION, G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GApplicationClass, shutdown),
+ NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+
+ /**
* GApplication::activate:
* @application: the application
*
@@ -1323,6 +1342,9 @@ g_application_run (GApplication *application,
->run_mainloop (application);
status = 0;
}
+
+ if (application->priv->is_registered)
+ g_signal_emit (application, g_application_signals[SIGNAL_SHUTDOWN], 0);
if (application->priv->impl)
g_application_impl_flush (application->priv->impl);
diff --git a/gio/gapplication.h b/gio/gapplication.h
index b178701..254b841 100644
--- a/gio/gapplication.h
+++ b/gio/gapplication.h
@@ -62,6 +62,8 @@ struct _GApplication
/**
* GApplicationClass:
* @startup: invoked on the primary instance immediately after registration
+ * @shutdown: invoked only on the registered primary instance immediately
+ * after the main loop terminates
* @activate: invoked on the primary instance when an activation occurs
* @open: invoked on the primary instance when there are files to open
* @command_line: invoked on the primary instance when a command-line is
@@ -118,9 +120,10 @@ struct _GApplicationClass
GVariantBuilder *builder);
void (* quit_mainloop) (GApplication *application);
void (* run_mainloop) (GApplication *application);
+ void (* shutdown) (GApplication *application);
/*< private >*/
- gpointer padding[12];
+ gpointer padding[11];
};
GType g_application_get_type (void) G_GNUC_CONST;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]