From db1830c54ecc70f7933febab02c2ad7ee44d0bd1 Mon Sep 17 00:00:00 2001 From: Marvin W Date: Mon, 7 Apr 2025 13:14:23 +0200 Subject: Improve UI for sfs image progress indicator --- .../file_transmission_progress.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 main/src/ui/conversation_content_view/file_transmission_progress.c (limited to 'main/src/ui/conversation_content_view/file_transmission_progress.c') diff --git a/main/src/ui/conversation_content_view/file_transmission_progress.c b/main/src/ui/conversation_content_view/file_transmission_progress.c new file mode 100644 index 00000000..65357a35 --- /dev/null +++ b/main/src/ui/conversation_content_view/file_transmission_progress.c @@ -0,0 +1,16 @@ +#include + +GskPath *dino_ui_file_transmission_progress_create_progress_arc(GskPath *circle_path, gfloat percentage) { + GskPathMeasure *measure = gsk_path_measure_new(circle_path); + gfloat length = gsk_path_measure_get_length(measure); + GskPathPoint start_point, end_point; + g_return_val_if_fail(gsk_path_measure_get_point(measure, length * 0.75, &start_point), NULL); + percentage += 0.75f; + if (percentage > 1) percentage -= 1.0f; + g_return_val_if_fail(gsk_path_measure_get_point(measure, length * percentage, &end_point), NULL); + GskPathBuilder *builder = gsk_path_builder_new(); + gsk_path_builder_add_segment(builder, circle_path, &start_point, &end_point); + GskPath *arc_path = gsk_path_builder_free_to_path(builder); + gsk_path_measure_unref(measure); + return arc_path; +} \ No newline at end of file -- cgit v1.3