sysprof/logs: ignore -1 for cpu/pid in cells

They just mean empty, so show it as such in the cells.
This commit is contained in:
Christian Hergert
2024-10-24 12:55:24 -07:00
parent c9a1b322cd
commit 571eb5f85b
2 changed files with 21 additions and 6 deletions

View File

@ -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);

View File

@ -160,9 +160,11 @@
<property name="min-chars">2</property>
<property name="nat-chars">2</property>
<binding name="text">
<lookup name="cpu" type="SysprofDocumentLog">
<lookup name="item">GtkListItem</lookup>
</lookup>
<closure function="int_to_string_filtered" type="gchararray">
<lookup name="cpu" type="SysprofDocumentLog">
<lookup name="item">GtkListItem</lookup>
</lookup>
</closure>
</binding>
</object>
</property>
@ -196,9 +198,11 @@
<property name="min-chars">2</property>
<property name="nat-chars">2</property>
<binding name="text">
<lookup name="pid" type="SysprofDocumentLog">
<lookup name="item">GtkListItem</lookup>
</lookup>
<closure function="int_to_string_filtered" type="gchararray">
<lookup name="pid" type="SysprofDocumentLog">
<lookup name="item">GtkListItem</lookup>
</lookup>
</closure>
</binding>
</object>
</property>