From 571eb5f85bfbc1a4208b470592ccfcf12fab9645 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Thu, 24 Oct 2024 12:55:24 -0700 Subject: [PATCH] sysprof/logs: ignore -1 for cpu/pid in cells They just mean empty, so show it as such in the cells. --- src/sysprof/sysprof-logs-section.c | 11 +++++++++++ src/sysprof/sysprof-logs-section.ui | 16 ++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/sysprof/sysprof-logs-section.c b/src/sysprof/sysprof-logs-section.c index 595eac95..ac05f41b 100644 --- a/src/sysprof/sysprof-logs-section.c +++ b/src/sysprof/sysprof-logs-section.c @@ -87,6 +87,16 @@ format_number (gpointer unused, return g_strdup_printf ("%'u", number); } +static char * +int_to_string_filtered (gpointer unused, + int value) +{ + if (value < 0) + return NULL; + + return g_strdup_printf ("%d", value); +} + static char * format_severity (gpointer unused, GLogLevelFlags severity) @@ -135,6 +145,7 @@ sysprof_logs_section_class_init (SysprofLogsSectionClass *klass) gtk_widget_class_bind_template_child (widget_class, SysprofLogsSection, time_column); gtk_widget_class_bind_template_callback (widget_class, format_number); gtk_widget_class_bind_template_callback (widget_class, format_severity); + gtk_widget_class_bind_template_callback (widget_class, int_to_string_filtered); gtk_widget_class_bind_template_callback (widget_class, sysprof_logs_section_activate_layer_item_cb); g_type_ensure (SYSPROF_TYPE_DOCUMENT_BITSET_INDEX); diff --git a/src/sysprof/sysprof-logs-section.ui b/src/sysprof/sysprof-logs-section.ui index 7e83663e..a7723015 100644 --- a/src/sysprof/sysprof-logs-section.ui +++ b/src/sysprof/sysprof-logs-section.ui @@ -160,9 +160,11 @@ 2 2 - - GtkListItem - + + + GtkListItem + + @@ -196,9 +198,11 @@ 2 2 - - GtkListItem - + + + GtkListItem + +