[shotwell/wip/cleanup-facedetect: 6/6] Rename "interface" in face detect to what it is




commit 81499d698210a52751cc2fcf8312dc4d5236e3c0
Author: Jens Georg <mail jensge org>
Date:   Sun Aug 14 19:48:17 2022 +0200

    Rename "interface" in face detect to what it is

 src/faces/Face.vala       |  2 +-
 src/faces/FaceDetect.vala | 19 ++++++++++---------
 src/faces/FacesTool.vala  |  2 +-
 3 files changed, 12 insertions(+), 11 deletions(-)
---
diff --git a/src/faces/Face.vala b/src/faces/Face.vala
index b2249076..ba1183f9 100644
--- a/src/faces/Face.vala
+++ b/src/faces/Face.vala
@@ -356,7 +356,7 @@ public class Face : DataSource, ContainerSource, Proxyable, Indexable {
 #if ENABLE_FACES
     public static void terminate() {
         try {
-            FaceDetect.interface.terminate();
+            FaceDetect.face_detect_proxy.terminate();
         } catch(Error e) {}
     }
 #endif
diff --git a/src/faces/FaceDetect.vala b/src/faces/FaceDetect.vala
index 71cc474c..968124ad 100644
--- a/src/faces/FaceDetect.vala
+++ b/src/faces/FaceDetect.vala
@@ -23,7 +23,7 @@
  * SOFTWARE.
  */
 
-// DBus interface definition
+// DBus face_detect_proxy definition
 public struct FaceRect {
     public double x;
     public double y;
@@ -49,21 +49,21 @@ public class FaceDetect {
     public static string net_file;
     public const string ERROR_MESSAGE = "Unable to connect to facedetect service";
     
-    public static FaceDetectInterface interface;
+    public static FaceDetectInterface face_detect_proxy;
 
 #if FACEDETECT_BUS_PRIVATE
     private static GLib.DBusServer dbus_server;
     private static Subprocess process;
 #endif
 
-    public static void create_interface(DBusConnection connection, string bus_name, string owner) {
+    public static void create_face_detect_proxy(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);
+                face_detect_proxy = Bus.get_proxy_sync (BusType.SESSION, DBUS_NAME, DBUS_PATH);
+                face_detect_proxy.load_net(net_file);
                 connected = true;
             } catch(IOError e) {
                 AppWindow.error_message(ERROR_MESSAGE);
@@ -76,17 +76,18 @@ public class FaceDetect {
     public static void interface_gone(DBusConnection connection, string bus_name) {
         message("Dbus name %s gone", bus_name);
         connected = false;
+        face_detect_proxy = null;
     }
 
     private static bool on_new_connection(DBusServer server, DBusConnection connection) {
         try {
-            interface = connection.get_proxy_sync(null, DBUS_PATH,
+            face_detect_proxy = connection.get_proxy_sync(null, DBUS_PATH,
                                                   DBusProxyFlags.DO_NOT_LOAD_PROPERTIES
                                                   | DBusProxyFlags.DO_NOT_CONNECT_SIGNALS,
                                                   null);
             Idle.add(() => {
                 try {
-                    interface.load_net(net_file);
+                    face_detect_proxy.load_net(net_file);
                     connected = true;
                 } catch (Error error) {
                     critical("Failed to call load_net: %s", error.message);
@@ -97,7 +98,7 @@ public class FaceDetect {
 
             return true;
         } catch (Error error) {
-            critical("Failed to create interface for face detect: %s", error.message);
+            critical("Failed to create face_detect_proxy for face detect: %s", error.message);
             AppWindow.error_message(ERROR_MESSAGE);
 
             return false;
@@ -136,7 +137,7 @@ public class FaceDetect {
         }
 #else
         Bus.watch_name(BusType.SESSION, DBUS_NAME, BusNameWatcherFlags.NONE,
-                       create_interface, interface_gone);
+                       create_face_detect_proxy, interface_gone);
 #endif
     }
 
diff --git a/src/faces/FacesTool.vala b/src/faces/FacesTool.vala
index b15390a4..5ce8c7c9 100644
--- a/src/faces/FacesTool.vala
+++ b/src/faces/FacesTool.vala
@@ -333,7 +333,7 @@ public class FacesTool : EditingTools.EditingTool {
             }
             FaceRect[] rects;
             try {
-                rects = FaceDetect.interface.detect_faces(image_path,
+                rects = FaceDetect.face_detect_proxy.detect_faces(image_path,
                                                           AppDirs.get_haarcascade_file().get_path(), scale, 
true);
             } catch(Error e) {
                 spawnError = "DBus error: " + e.message + "!\n";


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