[gnome-builder] libide-core: cleanup progress callback helper
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide-core: cleanup progress callback helper
- Date: Tue, 12 Jul 2022 06:39:08 +0000 (UTC)
commit 4155254032e33c513b554ed460a901321001deca
Author: Christian Hergert <chergert redhat com>
Date: Mon Jul 11 16:33:40 2022 -0700
libide-core: cleanup progress callback helper
src/libide/core/ide-notification.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/libide/core/ide-notification.c b/src/libide/core/ide-notification.c
index ab1fa943b..bb3a5bfeb 100644
--- a/src/libide/core/ide-notification.c
+++ b/src/libide/core/ide-notification.c
@@ -1116,12 +1116,19 @@ ide_notification_file_progress_callback (goffset current_num_bytes,
gpointer user_data)
{
IdeNotification *self = user_data;
- gdouble fraction = 0.0;
+ double fraction;
g_return_if_fail (IDE_IS_NOTIFICATION (self));
if (total_num_bytes)
- fraction = (gdouble)current_num_bytes / (gdouble)total_num_bytes;
+ fraction = (double)current_num_bytes / (double)total_num_bytes;
+ else
+ fraction = .0;
+
+ if (fraction < .0)
+ fraction = .0;
+ else if (fraction > 1.)
+ fraction = 1.;
ide_notification_set_progress (self, fraction);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]