sysprof: Add sysprof_session_filter_by_mark

This will be used to set a global marks filter in the session filter.
This commit is contained in:
Georges Basile Stavracas Neto
2025-03-25 17:17:35 -03:00
parent 02b1d9603b
commit 23dacf954d
2 changed files with 21 additions and 0 deletions

View File

@ -22,6 +22,7 @@
#include <glib/gi18n.h>
#include "sysprof-mark-filter.h"
#include "sysprof-session-private.h"
#include "sysprof-value-axis.h"
@ -488,6 +489,24 @@ sysprof_session_zoom_to_selection (SysprofSession *self)
sysprof_session_update_axis (self);
}
void
sysprof_session_filter_by_mark (SysprofSession *self,
SysprofMarkCatalog *catalog)
{
g_return_if_fail (SYSPROF_IS_SESSION (self));
g_return_if_fail (catalog == NULL || SYSPROF_IS_MARK_CATALOG (catalog));
while (g_list_model_get_n_items (G_LIST_MODEL (self->filter)) > 0)
gtk_multi_filter_remove (GTK_MULTI_FILTER (self->filter), 0);
if (catalog)
{
g_autoptr(SysprofMarkFilter) mark_filter = sysprof_mark_filter_new (self->document, catalog);
gtk_multi_filter_append (GTK_MULTI_FILTER (self->filter), GTK_FILTER (g_steal_pointer (&mark_filter)));
}
}
static char *
get_time_str (gint64 o)
{

View File

@ -44,5 +44,7 @@ SysprofAxis *sysprof_session_get_selected_time_axis (SysprofSession
void sysprof_session_select_time (SysprofSession *self,
const SysprofTimeSpan *time_span);
void sysprof_session_zoom_to_selection (SysprofSession *self);
void sysprof_session_filter_by_mark (SysprofSession *self,
SysprofMarkCatalog *catalog);
G_END_DECLS