libsysprof-gtk: connect zoom plumbing to session

This gets the plumbing in place, but all of the charts are not yet doing
the proper filtering based on session visible time.
This commit is contained in:
Christian Hergert
2023-06-30 15:38:55 -07:00
parent bd5ce9de06
commit a3a9ca1529
3 changed files with 32 additions and 0 deletions

View File

@ -364,3 +364,18 @@ sysprof_session_list_tracks (SysprofSession *self)
return g_object_ref (G_LIST_MODEL (self->tracks));
}
void
sysprof_session_zoom_to_selection (SysprofSession *self)
{
g_return_if_fail (SYSPROF_IS_SESSION (self));
if (memcmp (&self->visible_time, &self->selected_time, sizeof self->visible_time) == 0)
return;
self->visible_time = self->selected_time;
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_VISIBLE_TIME]);
sysprof_session_update_axis (self);
}

View File

@ -52,6 +52,8 @@ SYSPROF_AVAILABLE_IN_ALL
void sysprof_session_select_time (SysprofSession *self,
const SysprofTimeSpan *time_span);
SYSPROF_AVAILABLE_IN_ALL
void sysprof_session_zoom_to_selection (SysprofSession *self);
SYSPROF_AVAILABLE_IN_ALL
GListModel *sysprof_session_list_tracks (SysprofSession *self);
G_END_DECLS

View File

@ -319,6 +319,19 @@ G_GNUC_END_IGNORE_DEPRECATIONS
gtk_widget_get_height (GTK_WIDGET (self))));
}
static void
sysprof_tracks_view_zoom_to_selection (GtkWidget *widget,
const char *action_name,
GVariant *params)
{
SysprofTracksView *self = (SysprofTracksView *)widget;
g_assert (SYSPROF_IS_TRACKS_VIEW (self));
if (self->session != NULL)
sysprof_session_zoom_to_selection (self->session);
}
static void
sysprof_tracks_view_measure (GtkWidget *widget,
GtkOrientation orientation,
@ -467,6 +480,8 @@ sysprof_tracks_view_class_init (SysprofTracksViewClass *klass)
gtk_widget_class_bind_template_callback (widget_class, sysprof_tracks_view_drag_end_cb);
gtk_widget_class_bind_template_callback (widget_class, sysprof_tracks_view_drag_update_cb);
gtk_widget_class_install_action (widget_class, "zoom-to-selection", NULL, sysprof_tracks_view_zoom_to_selection);
g_type_ensure (SYSPROF_TYPE_TIME_RULER);
g_type_ensure (SYSPROF_TYPE_TRACK_VIEW);
}