From 7831b767d017edf9396e1f4ff006a6b4a6e000c2 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Wed, 28 Sep 2016 14:10:29 -0700 Subject: [PATCH] visualizer-view: shrink time range when necessary If we don't have a minute worth of input, we should shrink the visible area to exactly what we came across. We still have the issue of the UI creating the capture file before auth has completed, but we can fix that later so we have a "semantically" correct start time. --- lib/sp-visualizer-view.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/sp-visualizer-view.c b/lib/sp-visualizer-view.c index 4284a6ae..ec53892a 100644 --- a/lib/sp-visualizer-view.c +++ b/lib/sp-visualizer-view.c @@ -218,8 +218,18 @@ sp_visualizer_view_set_reader (SpVisualizerView *self, if (reader != NULL) { + gint64 real_end_time; + begin_time = sp_capture_reader_get_start_time (reader); + real_end_time = sp_capture_reader_get_end_time (reader); + end_time = begin_time + (G_GINT64_CONSTANT (1000000000) * 60); + + /* If we were able to extract a proper end time and its less + * than 60 seconds, we will use the whole width to show that. + */ + if (real_end_time > 0 && real_end_time < end_time) + end_time = real_end_time; } sp_visualizer_list_set_reader (priv->list, reader);