mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-09 19:06:15 +01:00
GApplication: introduce ::shutdown
Introduce ::shutdown as a dual to ::startup. https://bugzilla.gnome.org/show_bug.cgi?id=643934
This commit is contained in:
parent
8d52bdfd97
commit
15b1c1bf4f
@ -176,6 +176,7 @@ enum
|
||||
enum
|
||||
{
|
||||
SIGNAL_STARTUP,
|
||||
SIGNAL_SHUTDOWN,
|
||||
SIGNAL_ACTIVATE,
|
||||
SIGNAL_OPEN,
|
||||
SIGNAL_ACTION,
|
||||
@ -208,6 +209,11 @@ g_application_real_startup (GApplication *application)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
g_application_real_shutdown (GApplication *application)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
g_application_real_activate (GApplication *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;
|
||||
@ -580,6 +587,18 @@ g_application_class_init (GApplicationClass *class)
|
||||
G_STRUCT_OFFSET (GApplicationClass, startup),
|
||||
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);
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user