[shotwell/wip/cleanup-facedetect: 6/15] Simplify faceToVec
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [shotwell/wip/cleanup-facedetect: 6/15] Simplify faceToVec
- Date: Sun, 14 Aug 2022 15:32:29 +0000 (UTC)
commit 9e558e959380130f6582fa350a521bcb3847f195
Author: Jens Georg <mail jensge org>
Date: Sat Aug 13 18:55:31 2022 +0200
Simplify faceToVec
.../shotwell-facedetect/shotwell-facedetect.cpp | 22 +++++++---------------
1 file changed, 7 insertions(+), 15 deletions(-)
---
diff --git a/subprojects/shotwell-facedetect/shotwell-facedetect.cpp
b/subprojects/shotwell-facedetect/shotwell-facedetect.cpp
index fe79de33..3e278437 100644
--- a/subprojects/shotwell-facedetect/shotwell-facedetect.cpp
+++ b/subprojects/shotwell-facedetect/shotwell-facedetect.cpp
@@ -54,21 +54,13 @@ static gboolean on_handle_load_net(ShotwellFaces1 *object,
return TRUE;
}
-static gboolean on_handle_face_to_vec(ShotwellFaces1 *object,
- GDBusMethodInvocation *invocation,
- const gchar *arg_image) {
- GVariantBuilder *builder;
- GVariant *ret;
- std::vector<double> vec = faceToVec(arg_image);
- builder = g_variant_builder_new(G_VARIANT_TYPE ("ad"));
- for (std::vector<double>::const_iterator r = vec.begin(); r != vec.end(); r++) {
- GVariant *v = g_variant_new("d", *r);
- g_variant_builder_add(builder, "d", v);
- }
- ret = g_variant_new("ad", builder);
- g_variant_builder_unref(builder);
- shotwell_faces1_complete_face_to_vec(object, invocation,
- ret);
+static gboolean on_handle_face_to_vec(ShotwellFaces1 *object, GDBusMethodInvocation *invocation, const gchar
*arg_image)
+{
+ auto vec = faceToVec(arg_image);
+
+ shotwell_faces1_complete_face_to_vec(
+ object, invocation, g_variant_new_fixed_array(G_VARIANT_TYPE_DOUBLE, vec.data(), vec.size(),
sizeof(double)));
+
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]