From 3afc0b486a93908ccd93219a1260f5a52bd75912 Mon Sep 17 00:00:00 2001
From: Alexander Schwinn <alexxcons@xfce.org>
Date: Sun, 27 Jan 2019 19:04:32 +0100
Subject: [PATCH] Exit when name org.freedesktop.filemanager1 lost on
 message-dbus (Bug #15088)

---
 thunar/thunar-application.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/thunar/thunar-application.c b/thunar/thunar-application.c
index 4e27360b7..694db5327 100644
--- a/thunar/thunar-application.c
+++ b/thunar/thunar-application.c
@@ -117,7 +117,10 @@ static void           thunar_application_dbus_acquired_cb       (GDBusConnection
 static void           thunar_application_name_acquired_cb       (GDBusConnection        *connection,
                                                                  const gchar            *name,
                                                                  gpointer                user_data);
-static void           thunar_application_dbus_name_lost_cb      (GDBusConnection        *connection,
+static void           thunar_application_dbus_name_lost_crit_cb (GDBusConnection        *connection,
+                                                                 const gchar            *name,
+                                                                 gpointer                user_data);
+static void           thunar_application_dbus_name_lost_warn_cb (GDBusConnection        *connection,
                                                                  const gchar            *name,
                                                                  gpointer                user_data);
 static void           thunar_application_dbus_init              (ThunarApplication      *application);
@@ -305,7 +308,7 @@ thunar_application_name_acquired_cb (GDBusConnection *connection,
 
 
 static void
-thunar_application_dbus_name_lost_cb (GDBusConnection *connection,
+thunar_application_dbus_name_lost_crit_cb (GDBusConnection *connection,
                                       const gchar     *name,
                                       gpointer         user_data)
 {
@@ -316,6 +319,16 @@ thunar_application_dbus_name_lost_cb (GDBusConnection *connection,
 
 
 
+static void
+thunar_application_dbus_name_lost_warn_cb (GDBusConnection *connection,
+                                      const gchar     *name,
+                                      gpointer         user_data)
+{
+  g_warning (_("Name '%s' lost on the message dbus."), name);
+}
+
+
+
 /* TODO: [GTK3 Port] Check if there's a cleaner way to register */
 /* this extra dbus name (besides org.xfce.Thunar) */
 static void
@@ -330,7 +343,7 @@ thunar_application_dbus_init (ThunarApplication *application)
                                       G_BUS_NAME_OWNER_FLAGS_NONE,
                                       thunar_application_dbus_acquired_cb,
                                       thunar_application_name_acquired_cb,
-                                      thunar_application_dbus_name_lost_cb,
+                                      thunar_application_dbus_name_lost_crit_cb,
                                       application,
                                       NULL);
 
@@ -339,7 +352,7 @@ thunar_application_dbus_init (ThunarApplication *application)
                                      G_BUS_NAME_OWNER_FLAGS_NONE,
                                      thunar_application_dbus_acquired_cb,
                                      thunar_application_name_acquired_cb,
-                                     thunar_application_dbus_name_lost_cb,
+                                     thunar_application_dbus_name_lost_warn_cb,
                                      application,
                                      NULL);
 }
-- 
GitLab