From d80188f01904438b70f9cd4b82a2b6a166bf70ec Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Tue, 25 Mar 2025 17:18:19 -0300 Subject: [PATCH] sysprof: Implement markchartrow.filter-by-mark action This finally allows setting a session-wide mark filter. --- src/sysprof/sysprof-mark-chart-row.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/sysprof/sysprof-mark-chart-row.c b/src/sysprof/sysprof-mark-chart-row.c index e91f3c96..76b38aa5 100644 --- a/src/sysprof/sysprof-mark-chart-row.c +++ b/src/sysprof/sysprof-mark-chart-row.c @@ -50,6 +50,27 @@ G_DEFINE_FINAL_TYPE (SysprofMarkChartRow, sysprof_mark_chart_row, GTK_TYPE_WIDGE static GParamSpec *properties [N_PROPS]; +static void +filter_by_mark_action (GtkWidget *widget, + const char *action_name, + GVariant *parameter) +{ + SysprofMarkChartRow *self = (SysprofMarkChartRow *)widget; + SysprofMarkCatalog *catalog; + SysprofSession *session; + + g_assert (SYSPROF_IS_MARK_CHART_ROW (self)); + + if (self->item == NULL || + !(session = sysprof_mark_chart_item_get_session (self->item))) + return; + + catalog = sysprof_mark_chart_item_get_catalog (self->item); + g_assert (SYSPROF_IS_MARK_CATALOG (catalog)); + + sysprof_session_filter_by_mark (session, catalog); +} + static gboolean sysprof_mark_chart_row_activate_layer_item_cb (SysprofMarkChartRow *self, SysprofChartLayer *layer, @@ -205,6 +226,8 @@ sysprof_mark_chart_row_class_init (SysprofMarkChartRowClass *klass) gtk_widget_class_bind_template_callback (widget_class, sysprof_mark_chart_row_activate_layer_item_cb); gtk_widget_class_bind_template_callback (widget_class, sysprof_mark_chart_row_button_pressed_cb); + gtk_widget_class_install_action (widget_class, "markchartrow.filter-by-mark", NULL, filter_by_mark_action); + g_type_ensure (SYSPROF_TYPE_CHART); g_type_ensure (SYSPROF_TYPE_TIME_SERIES_ITEM); g_type_ensure (SYSPROF_TYPE_TIME_SPAN_LAYER);