From b718e3ac9e83d923c24a417dac453e15b35b3617 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Thu, 15 Jun 2023 16:43:49 -0700 Subject: [PATCH] libsysprof-gtk: set session time range from document This will eventually get updated as selections are made, and various other components can adapt to that change. --- src/libsysprof-gtk/sysprof-session.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/libsysprof-gtk/sysprof-session.c b/src/libsysprof-gtk/sysprof-session.c index 0fe575cc..2a4dbbe8 100644 --- a/src/libsysprof-gtk/sysprof-session.c +++ b/src/libsysprof-gtk/sysprof-session.c @@ -46,6 +46,19 @@ G_DEFINE_FINAL_TYPE (SysprofSession, sysprof_session, G_TYPE_OBJECT) static GParamSpec *properties [N_PROPS]; +static void +sysprof_session_set_document (SysprofSession *self, + SysprofDocument *document) +{ + g_assert (SYSPROF_IS_SESSION (self)); + g_assert (SYSPROF_IS_DOCUMENT (document)); + + g_set_object (&self->document, document); + + self->visible_time = *sysprof_document_get_time_span (document); + self->selected_time = self->visible_time; +} + static void sysprof_session_dispose (GObject *object) { @@ -99,7 +112,7 @@ sysprof_session_set_property (GObject *object, switch (prop_id) { case PROP_DOCUMENT: - self->document = g_value_dup_object (value); + sysprof_session_set_document (self, g_value_get_object (value)); break; default: