mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-23 04:36:17 +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
|
enum
|
||||||
{
|
{
|
||||||
SIGNAL_STARTUP,
|
SIGNAL_STARTUP,
|
||||||
|
SIGNAL_SHUTDOWN,
|
||||||
SIGNAL_ACTIVATE,
|
SIGNAL_ACTIVATE,
|
||||||
SIGNAL_OPEN,
|
SIGNAL_OPEN,
|
||||||
SIGNAL_ACTION,
|
SIGNAL_ACTION,
|
||||||
@ -208,6 +209,11 @@ g_application_real_startup (GApplication *application)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
g_application_real_shutdown (GApplication *application)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
g_application_real_activate (GApplication *application)
|
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->before_emit = g_application_real_before_emit;
|
||||||
class->after_emit = g_application_real_after_emit;
|
class->after_emit = g_application_real_after_emit;
|
||||||
class->startup = g_application_real_startup;
|
class->startup = g_application_real_startup;
|
||||||
|
class->shutdown = g_application_real_shutdown;
|
||||||
class->activate = g_application_real_activate;
|
class->activate = g_application_real_activate;
|
||||||
class->open = g_application_real_open;
|
class->open = g_application_real_open;
|
||||||
class->command_line = g_application_real_command_line;
|
class->command_line = g_application_real_command_line;
|
||||||
@ -580,6 +587,18 @@ g_application_class_init (GApplicationClass *class)
|
|||||||
G_STRUCT_OFFSET (GApplicationClass, startup),
|
G_STRUCT_OFFSET (GApplicationClass, startup),
|
||||||
NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
|
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:
|
* GApplication::activate:
|
||||||
* @application: the application
|
* @application: the application
|
||||||
@ -1324,6 +1343,9 @@ g_application_run (GApplication *application,
|
|||||||
status = 0;
|
status = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (application->priv->is_registered)
|
||||||
|
g_signal_emit (application, g_application_signals[SIGNAL_SHUTDOWN], 0);
|
||||||
|
|
||||||
if (application->priv->impl)
|
if (application->priv->impl)
|
||||||
g_application_impl_flush (application->priv->impl);
|
g_application_impl_flush (application->priv->impl);
|
||||||
|
|
||||||
|
@ -62,6 +62,8 @@ struct _GApplication
|
|||||||
/**
|
/**
|
||||||
* GApplicationClass:
|
* GApplicationClass:
|
||||||
* @startup: invoked on the primary instance immediately after registration
|
* @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
|
* @activate: invoked on the primary instance when an activation occurs
|
||||||
* @open: invoked on the primary instance when there are files to open
|
* @open: invoked on the primary instance when there are files to open
|
||||||
* @command_line: invoked on the primary instance when a command-line is
|
* @command_line: invoked on the primary instance when a command-line is
|
||||||
@ -118,9 +120,10 @@ struct _GApplicationClass
|
|||||||
GVariantBuilder *builder);
|
GVariantBuilder *builder);
|
||||||
void (* quit_mainloop) (GApplication *application);
|
void (* quit_mainloop) (GApplication *application);
|
||||||
void (* run_mainloop) (GApplication *application);
|
void (* run_mainloop) (GApplication *application);
|
||||||
|
void (* shutdown) (GApplication *application);
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
gpointer padding[12];
|
gpointer padding[11];
|
||||||
};
|
};
|
||||||
|
|
||||||
GType g_application_get_type (void) G_GNUC_CONST;
|
GType g_application_get_type (void) G_GNUC_CONST;
|
||||||
|
Loading…
Reference in New Issue
Block a user