mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
libsysprof-gtk: select time range when activating mark w/ duration
This commit is contained in:
@ -84,6 +84,31 @@ sysprof_mark_table_connect (SysprofMarkTable *self)
|
|||||||
GTK_SORT_ASCENDING);
|
GTK_SORT_ASCENDING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
sysprof_mark_table_activate_cb (SysprofMarkTable *self,
|
||||||
|
guint position,
|
||||||
|
GtkColumnView *column_view)
|
||||||
|
{
|
||||||
|
g_autoptr(SysprofDocumentMark) mark = NULL;
|
||||||
|
SysprofTimeSpan time_span;
|
||||||
|
GListModel *model;
|
||||||
|
|
||||||
|
g_assert (SYSPROF_IS_MARK_TABLE (self));
|
||||||
|
g_assert (GTK_IS_COLUMN_VIEW (column_view));
|
||||||
|
|
||||||
|
if (self->session == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
model = G_LIST_MODEL (gtk_column_view_get_model (column_view));
|
||||||
|
mark = g_list_model_get_item (model, position);
|
||||||
|
|
||||||
|
time_span.begin_nsec = sysprof_document_frame_get_time (SYSPROF_DOCUMENT_FRAME (mark));
|
||||||
|
time_span.end_nsec = time_span.begin_nsec + sysprof_document_mark_get_duration (mark);
|
||||||
|
|
||||||
|
if (time_span.end_nsec != time_span.begin_nsec)
|
||||||
|
sysprof_session_select_time (self->session, &time_span);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sysprof_mark_table_dispose (GObject *object)
|
sysprof_mark_table_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
@ -161,6 +186,7 @@ sysprof_mark_table_class_init (SysprofMarkTableClass *klass)
|
|||||||
gtk_widget_class_bind_template_child (widget_class, SysprofMarkTable, box);
|
gtk_widget_class_bind_template_child (widget_class, SysprofMarkTable, box);
|
||||||
gtk_widget_class_bind_template_child (widget_class, SysprofMarkTable, column_view);
|
gtk_widget_class_bind_template_child (widget_class, SysprofMarkTable, column_view);
|
||||||
gtk_widget_class_bind_template_child (widget_class, SysprofMarkTable, start_column);
|
gtk_widget_class_bind_template_child (widget_class, SysprofMarkTable, start_column);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, sysprof_mark_table_activate_cb);
|
||||||
|
|
||||||
g_resources_register (libsysprof_gtk_get_resource ());
|
g_resources_register (libsysprof_gtk_get_resource ());
|
||||||
|
|
||||||
|
|||||||
@ -12,6 +12,7 @@
|
|||||||
<style>
|
<style>
|
||||||
<class name="data-table"/>
|
<class name="data-table"/>
|
||||||
</style>
|
</style>
|
||||||
|
<signal name="activate" handler="sysprof_mark_table_activate_cb" swapped="true"/>
|
||||||
<property name="show-column-separators">true</property>
|
<property name="show-column-separators">true</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkColumnViewColumn" id="start_column">
|
<object class="GtkColumnViewColumn" id="start_column">
|
||||||
|
|||||||
Reference in New Issue
Block a user