[shotwell/wip/cleanup-facedetect: 12/15] Be more resilient if service comes and goes




commit ac8af977716802c94810909aa2ab73cdfe5cad9e
Author: Jens Georg <mail jensge org>
Date:   Sun Aug 14 14:53:34 2022 +0200

    Be more resilient if service comes and goes

 src/faces/FaceDetect.vala | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/src/faces/FaceDetect.vala b/src/faces/FaceDetect.vala
index 0e423d62..6b019968 100644
--- a/src/faces/FaceDetect.vala
+++ b/src/faces/FaceDetect.vala
@@ -59,6 +59,18 @@ public class FaceDetect {
     public static void create_interface(DBusConnection connection, string bus_name, string owner) {
         if (bus_name == DBUS_NAME) {
             message("Dbus name %s available", bus_name);
+
+            try {
+                // Service file should automatically run the facedetect binary
+                interface = Bus.get_proxy_sync (BusType.SESSION, DBUS_NAME, DBUS_PATH);
+                interface.load_net(net_file);
+            } catch(IOError e) {
+                AppWindow.error_message(ERROR_MESSAGE);
+            } catch(DBusError e) {
+                AppWindow.error_message(ERROR_MESSAGE);
+            }
+            connected = true;
+
         }
     }
 
@@ -129,16 +141,6 @@ public class FaceDetect {
 #else
         Bus.watch_name(BusType.SESSION, DBUS_NAME, BusNameWatcherFlags.NONE,
                        create_interface, interface_gone);
-        try {
-            // Service file should automatically run the facedetect binary
-            interface = Bus.get_proxy_sync (BusType.SESSION, DBUS_NAME, DBUS_PATH);
-            interface.load_net(net_file);
-        } catch(IOError e) {
-            AppWindow.error_message(ERROR_MESSAGE);
-        } catch(DBusError e) {
-            AppWindow.error_message(ERROR_MESSAGE);
-        }
-        connected = true;
 #endif
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]