diff --git a/src/calls-application.c b/src/calls-application.c index 37f1c30..023dc56 100644 --- a/src/calls-application.c +++ b/src/calls-application.c @@ -596,11 +596,16 @@ notify_window_visible_cb (GtkWidget *window, CallsManager *manager = calls_manager_get_default (); g_return_if_fail (CALLS_IS_APPLICATION (application)); - g_return_if_fail (CALLS_IS_CALL_WINDOW (window)); + gboolean calls_visible = gtk_widget_is_visible (GTK_WIDGET (application->call_window)); + gboolean main_visible = gtk_widget_is_visible (GTK_WIDGET (application->main_window)); /* The UI is being closed, hang up active calls */ - if (!gtk_widget_is_visible (window)) + if (!calls_visible) calls_manager_hang_up_all_calls (manager); + + /* No windows (of interest) are open -> exit */ + if (!main_visible && !calls_visible) + app_shutdown (G_APPLICATION (application)); } @@ -666,6 +671,12 @@ start_proper (CallsApplication *self) G_CALLBACK (notify_window_visible_cb), self, G_CONNECT_AFTER); + + g_signal_connect_object (self->main_window, + "notify::visible", + G_CALLBACK (notify_window_visible_cb), + self, + G_CONNECT_AFTER); }