[sysprof/wip/chergert/sysprof-3] libsysprof-ui: tweak sorting of marks



commit d83dad64848ada8e96a20c1d9db407838230ba4b
Author: Christian Hergert <chergert redhat com>
Date:   Fri May 17 17:00:44 2019 -0700

    libsysprof-ui: tweak sorting of marks

 src/libsysprof-ui/sysprof-marks-model.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/libsysprof-ui/sysprof-marks-model.c b/src/libsysprof-ui/sysprof-marks-model.c
index 219bf42..a9e1e3b 100644
--- a/src/libsysprof-ui/sysprof-marks-model.c
+++ b/src/libsysprof-ui/sysprof-marks-model.c
@@ -298,10 +298,16 @@ item_compare (gconstpointer a,
     return -1;
   else if (ia->begin_time > ib->begin_time)
     return 1;
-  else if (ia->end_time > ib->end_time)
+
+  /* Sort items with longer duration first, as they might be
+   * "overarching" marks containing other marks.
+   */
+  if (ia->end_time > ib->end_time)
+    return -1;
+  else if (ib->end_time > ia->end_time)
     return 1;
-  else
-    return 0;
+
+  return 0;
 }
 
 static void


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