1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-12-12 15:47:35 +00:00

application: Hang up calls when closing the UI

This commit is contained in:
Evangelos Ribeiro Tzaras 2021-01-12 01:27:45 +01:00
parent f69c597387
commit 5bdfb0e223

View file

@ -328,6 +328,22 @@ startup (GApplication *application)
} }
static void
notify_window_visible_cb (GtkWidget *window,
GParamSpec *pspec,
CallsApplication *application)
{
CallsManager *manager = calls_manager_get_default ();
g_return_if_fail (CALLS_IS_APPLICATION (application));
g_return_if_fail (CALLS_IS_CALL_WINDOW (window));
/* The UI is being closed, hang up active calls */
if (!gtk_widget_is_visible (window))
calls_manager_hang_up_all_calls (manager);
}
static gboolean static gboolean
start_proper (CallsApplication *self) start_proper (CallsApplication *self)
{ {
@ -360,6 +376,11 @@ start_proper (CallsApplication *self)
self->call_window = calls_call_window_new (gtk_app); self->call_window = calls_call_window_new (gtk_app);
g_assert (self->call_window != NULL); g_assert (self->call_window != NULL);
g_signal_connect (self->call_window,
"notify::visible",
G_CALLBACK (notify_window_visible_cb),
self);
return TRUE; return TRUE;
} }