libsysprof-gtk: add timespan to session

We want to be able to monitor this from session observers to be able to
update the visible area and/or what is rendered.
This commit is contained in:
Christian Hergert
2023-06-15 16:32:12 -07:00
parent d458d312a3
commit 9eca425a25
6 changed files with 133 additions and 3 deletions

View File

@ -25,14 +25,20 @@
struct _SysprofSession
{
GObject parent_instance;
SysprofDocument *document;
GtkCustomFilter *filter;
SysprofTimeSpan selected_time;
SysprofTimeSpan visible_time;
};
enum {
PROP_0,
PROP_DOCUMENT,
PROP_FILTER,
PROP_SELECTED_TIME,
PROP_VISIBLE_TIME,
N_PROPS
};
@ -69,6 +75,14 @@ sysprof_session_get_property (GObject *object,
g_value_set_object (value, sysprof_session_get_filter (self));
break;
case PROP_SELECTED_TIME:
g_value_set_boxed (value, sysprof_session_get_selected_time (self));
break;
case PROP_VISIBLE_TIME:
g_value_set_boxed (value, sysprof_session_get_visible_time (self));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@ -112,6 +126,16 @@ sysprof_session_class_init (SysprofSessionClass *klass)
GTK_TYPE_FILTER,
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
properties [PROP_SELECTED_TIME] =
g_param_spec_boxed ("selected-time", NULL, NULL,
SYSPROF_TYPE_TIME_SPAN,
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
properties [PROP_VISIBLE_TIME] =
g_param_spec_boxed ("visible-time", NULL, NULL,
SYSPROF_TYPE_TIME_SPAN,
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_properties (object_class, N_PROPS, properties);
}
@ -160,3 +184,19 @@ sysprof_session_get_filter (SysprofSession *self)
return GTK_FILTER (self->filter);
}
const SysprofTimeSpan *
sysprof_session_get_selected_time (SysprofSession *self)
{
g_return_val_if_fail (SYSPROF_IS_SESSION (self), NULL);
return &self->selected_time;
}
const SysprofTimeSpan *
sysprof_session_get_visible_time (SysprofSession *self)
{
g_return_val_if_fail (SYSPROF_IS_SESSION (self), NULL);
return &self->visible_time;
}