[shotwell/wip/phako/enhanced-faces: 51/136] Not force quitting facedetect process
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [shotwell/wip/phako/enhanced-faces: 51/136] Not force quitting facedetect process
- Date: Thu, 11 Oct 2018 09:56:41 +0000 (UTC)
commit eec290814d567bb6030490a795716a93ba7284dc
Author: NarendraMA <narendra_m_a yahoo com>
Date: Sun Aug 19 09:09:51 2018 +0530
Not force quitting facedetect process
facedetect/shotwell-facedetect.cpp | 20 ++++++++++++--------
src/faces/FaceShape.vala | 9 +++++++++
src/faces/FacesTool.vala | 5 ++++-
3 files changed, 25 insertions(+), 9 deletions(-)
---
diff --git a/facedetect/shotwell-facedetect.cpp b/facedetect/shotwell-facedetect.cpp
index d6d46d36..e19258e0 100644
--- a/facedetect/shotwell-facedetect.cpp
+++ b/facedetect/shotwell-facedetect.cpp
@@ -75,7 +75,7 @@ static gboolean on_handle_face_to_vec(ShotwellFaces1 *object,
static gboolean on_handle_terminate(ShotwellFaces1 *object,
GDBusMethodInvocation *invocation) {
g_debug("Exiting...");
- exit(0);
+ shotwell_faces1_complete_terminate(object, invocation);
return TRUE;
}
@@ -86,19 +86,23 @@ static void on_name_acquired(GDBusConnection *connection,
interface = shotwell_faces1_skeleton_new();
g_debug("Got name %s", name);
g_signal_connect(interface, "handle-detect-faces", G_CALLBACK (on_handle_detect_faces), NULL);
- g_signal_connect(interface, "handle-terminate", G_CALLBACK (on_handle_terminate), NULL);
+ g_signal_connect(interface, "handle-terminate", G_CALLBACK (on_handle_terminate), user_data);
g_signal_connect(interface, "handle-load-net", G_CALLBACK (on_handle_load_net), NULL);
g_signal_connect(interface, "handle-face-to-vec", G_CALLBACK (on_handle_face_to_vec), NULL);
error = NULL;
!g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(interface), connection,
"/org/gnome/shotwell/faces", &error);
}
+static void on_name_lost(GDBusConnection *connection,
+ const gchar *name, gpointer user_data) {
+ g_main_loop_quit((GMainLoop *)user_data);
+}
+
int main(int argc, char **argv) {
- GMainLoop *loop;
- loop = g_main_loop_new (NULL, FALSE);
+ GMainLoop *loop;
+ loop = g_main_loop_new (NULL, FALSE);
g_bus_own_name(G_BUS_TYPE_SESSION, "org.gnome.shotwell.faces", G_BUS_NAME_OWNER_FLAGS_NONE, NULL,
- on_name_acquired, NULL, NULL, NULL);
- g_main_loop_run (loop);
-
- return 0;
+ on_name_acquired, on_name_lost, loop, NULL);
+ g_main_loop_run (loop);
+ return 0;
}
diff --git a/src/faces/FaceShape.vala b/src/faces/FaceShape.vala
index 349627b9..34e13b56 100644
--- a/src/faces/FaceShape.vala
+++ b/src/faces/FaceShape.vala
@@ -25,6 +25,7 @@ public abstract class FaceShape : Object {
private bool editable = true;
private bool visible = true;
private bool known = true;
+ private double guess = 0.0;
private weak FacesTool.FaceWidget face_widget = null;
@@ -92,7 +93,15 @@ public abstract class FaceShape : Object {
public bool get_known() {
return known;
}
+
+ public void set_guess(double guess) {
+ this.guess = guess;
+ }
+ public double get_guess() {
+ return guess;
+ }
+
public void set_widget(FacesTool.FaceWidget face_widget) {
this.face_widget = face_widget;
}
diff --git a/src/faces/FacesTool.vala b/src/faces/FacesTool.vala
index 349fb4b5..43f87151 100644
--- a/src/faces/FacesTool.vala
+++ b/src/faces/FacesTool.vala
@@ -891,7 +891,9 @@ public class FacesTool : EditingTools.EditingTool {
face_shape.set_name("Unknown face #%d".printf(c));
face_shape.set_known(false);
} else {
- face_shape.set_name(guess.get_name());
+ string name_str;
+ name_str = "%s (%0.2f%%)".printf(guess.get_name(), face_shape.get_guess() * 100);
+ face_shape.set_name(name_str);
face_shape.set_known(true);
}
add_face(face_shape);
@@ -923,6 +925,7 @@ public class FacesTool : EditingTools.EditingTool {
Face? face = null;
if (guess_id != null) {
face = Face.global.fetch(guess_id);
+ face_shape.set_guess(max_product);
assert(face != null);
}
return face;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]