mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-ui: allow double click to select mark range
This commit is contained in:
@ -1248,3 +1248,17 @@ _sysprof_display_reload_page (SysprofDisplay *self,
|
||||
priv->filter,
|
||||
NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
sysprof_display_add_to_selection (SysprofDisplay *self,
|
||||
gint64 begin_time,
|
||||
gint64 end_time)
|
||||
{
|
||||
SysprofDisplayPrivate *priv = sysprof_display_get_instance_private (self);
|
||||
SysprofSelection *selection;
|
||||
|
||||
g_return_if_fail (SYSPROF_IS_DISPLAY (self));
|
||||
|
||||
selection = sysprof_visualizers_frame_get_selection (priv->visualizers);
|
||||
sysprof_selection_select_range (selection, begin_time, end_time);
|
||||
}
|
||||
|
||||
@ -88,5 +88,9 @@ SYSPROF_AVAILABLE_IN_ALL
|
||||
gboolean sysprof_display_get_can_replay (SysprofDisplay *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
SysprofDisplay *sysprof_display_replay (SysprofDisplay *self);
|
||||
SYSPROF_AVAILABLE_IN_3_38
|
||||
void sysprof_display_add_to_selection (SysprofDisplay *self,
|
||||
gint64 begin_time,
|
||||
gint64 end_time);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@ -384,6 +384,38 @@ sysprof_marks_page_set_size_group (SysprofPage *page,
|
||||
gtk_size_group_add_widget (size_group, GTK_WIDGET (priv->details_box));
|
||||
}
|
||||
|
||||
static void
|
||||
sysprof_marks_page_tree_view_row_activated_cb (SysprofMarksPage *self,
|
||||
GtkTreePath *path,
|
||||
GtkTreeViewColumn *column,
|
||||
GtkTreeView *tree_view)
|
||||
{
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
|
||||
g_assert (SYSPROF_IS_MARKS_PAGE (self));
|
||||
g_assert (path != NULL);
|
||||
g_assert (GTK_IS_TREE_VIEW_COLUMN (column));
|
||||
g_assert (GTK_IS_TREE_VIEW (tree_view));
|
||||
|
||||
model = gtk_tree_view_get_model (tree_view);
|
||||
|
||||
if (gtk_tree_model_get_iter (model, &iter, path))
|
||||
{
|
||||
SysprofDisplay *display;
|
||||
gint64 begin_time;
|
||||
gint64 end_time;
|
||||
|
||||
gtk_tree_model_get (model, &iter,
|
||||
SYSPROF_MARKS_MODEL_COLUMN_BEGIN_TIME, &begin_time,
|
||||
SYSPROF_MARKS_MODEL_COLUMN_END_TIME, &end_time,
|
||||
-1);
|
||||
|
||||
display = SYSPROF_DISPLAY (gtk_widget_get_ancestor (GTK_WIDGET (self), SYSPROF_TYPE_DISPLAY));
|
||||
sysprof_display_add_to_selection (display, begin_time, end_time);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
sysprof_marks_page_finalize (GObject *object)
|
||||
{
|
||||
@ -518,6 +550,12 @@ sysprof_marks_page_init (SysprofMarksPage *self)
|
||||
self,
|
||||
G_CONNECT_SWAPPED);
|
||||
|
||||
g_signal_connect_object (priv->tree_view,
|
||||
"row-activated",
|
||||
G_CALLBACK (sysprof_marks_page_tree_view_row_activated_cb),
|
||||
self,
|
||||
G_CONNECT_SWAPPED);
|
||||
|
||||
g_signal_connect_object (priv->tree_view,
|
||||
"query-tooltip",
|
||||
G_CALLBACK (sysprof_marks_page_tree_view_query_tooltip_cb),
|
||||
|
||||
Reference in New Issue
Block a user