mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2025-01-23 20:15:32 +00:00
application: Shut down cleanly when application quits
Previously the application was only properly shut down when it received SIGTERM/SIGINT.
This commit is contained in:
parent
0c004b5204
commit
ac6aff798d
1 changed files with 12 additions and 1 deletions
|
@ -72,6 +72,7 @@ struct _CallsApplication {
|
|||
char *uri;
|
||||
guint id_sigterm;
|
||||
guint id_sigint;
|
||||
gboolean shutdown;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (CallsApplication, calls_application, GTK_TYPE_APPLICATION);
|
||||
|
@ -83,14 +84,22 @@ static void start_proper (CallsApplication *self);
|
|||
static void
|
||||
quit_calls (CallsApplication *self)
|
||||
{
|
||||
g_assert (CALLS_IS_APPLICATION (self));
|
||||
|
||||
if (self->shutdown)
|
||||
return;
|
||||
|
||||
gtk_application_remove_window (GTK_APPLICATION (self), GTK_WINDOW (self->main_window));
|
||||
gtk_application_remove_window (GTK_APPLICATION (self), GTK_WINDOW (self->call_window));
|
||||
}
|
||||
|
||||
self->shutdown = TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
on_int_or_term_signal (CallsApplication *self)
|
||||
{
|
||||
g_assert (CALLS_IS_APPLICATION (self));
|
||||
|
||||
g_debug ("Received SIGTERM/SIGINT, shutting down gracefully");
|
||||
|
||||
self->id_sigint = 0;
|
||||
|
@ -553,6 +562,8 @@ calls_application_command_line (GApplication *application,
|
|||
static void
|
||||
app_shutdown (GApplication *application)
|
||||
{
|
||||
quit_calls (CALLS_APPLICATION (application));
|
||||
|
||||
cui_uninit ();
|
||||
|
||||
G_APPLICATION_CLASS (calls_application_parent_class)->shutdown (application);
|
||||
|
|
Loading…
Reference in a new issue