From 45e40697a3275703c63f3cc734e0629b226e0ed3 Mon Sep 17 00:00:00 2001 From: Alexander Schwinn Date: Sat, 29 Dec 2018 19:20:40 +0100 Subject: [PATCH] Still 8sec delay on logout when there is an open thunar window (Bug #15008) --- thunar/thunar-application.c | 27 +++++++++++++++++++++++++++ thunar/thunar-application.h | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/thunar/thunar-application.c b/thunar/thunar-application.c index c5ea2868..71a1594c 100644 --- a/thunar/thunar-application.c +++ b/thunar/thunar-application.c @@ -1104,6 +1104,11 @@ thunar_application_quit (ThunarApplication *application) _thunar_return_if_fail (THUNAR_IS_APPLICATION (application)); thunar_application_set_daemon(application, FALSE); + + /* For some unknown reason we need to close all open thunar windows before quit */ + /* Otherwise thunar will hangup on quit and thunar_application_shutdown will not be called */ + thunar_application_close_all_windows (application); + gtk_main_quit (); } @@ -1154,6 +1159,28 @@ thunar_application_set_daemon (ThunarApplication *application, /** + * thunar_application_close_all_windows: + * @application : a #ThunarApplication. + * + * Closes all #ThunarWindows currently handled by @application. + **/ +void +thunar_application_close_all_windows (ThunarApplication *application) +{ + GList *gtk_windows, *lp; + + _thunar_return_if_fail (THUNAR_IS_APPLICATION (application)); + + gtk_windows = gtk_application_get_windows (GTK_APPLICATION (application)); + + for (lp = gtk_windows; lp != NULL; lp = lp->next) + if (G_LIKELY (THUNAR_IS_WINDOW (lp->data))) + gtk_window_close (lp->data); +} + + + +/** * thunar_application_get_windows: * @application : a #ThunarApplication. * diff --git a/thunar/thunar-application.h b/thunar/thunar-application.h index e5b23def..547cb701 100644 --- a/thunar/thunar-application.h +++ b/thunar/thunar-application.h @@ -51,7 +51,7 @@ void thunar_application_set_daemon (ThunarAppli GList *thunar_application_get_windows (ThunarApplication *application); gboolean thunar_application_has_windows (ThunarApplication *application); - +void thunar_application_close_all_windows (ThunarApplication *application); void thunar_application_take_window (ThunarApplication *application, GtkWindow *window); -- 2.11.0