libsysprof-analyze: add listmodel of traceables

It can be handy to iterate through the traceables and we already have a
bitset index for that. Use the new bitset index listmodel to provide that
filtered list externally without having to inflate every object in the
underlying listmodel, as GtkFilterListModel would have to do.
This commit is contained in:
Christian Hergert
2023-05-08 12:24:26 -07:00
parent 7720f690e0
commit c18b401ab6
2 changed files with 21 additions and 0 deletions

View File

@ -25,6 +25,8 @@
#include <glib/gstdio.h>
#include "sysprof-document-private.h"
#include "sysprof-document-bitset-index-private.h"
#include "sysprof-document-file-chunk.h"
#include "sysprof-document-frame-private.h"
#include "sysprof-document-symbols-private.h"
@ -495,3 +497,20 @@ _sysprof_document_traceables (SysprofDocument *self)
return self->traceables;
}
/**
* sysprof_document_list_traceables:
* @self: a #SysprofDocument
*
* Gets a #GListModel containing #SysprofDocumentTraceable found within
* the #SysprofDocument.
*
* Returns: (transfer full): a #GListModel
*/
GListModel *
sysprof_document_list_traceables (SysprofDocument *self)
{
g_return_val_if_fail (SYSPROF_IS_DOCUMENT (self), NULL);
return _sysprof_document_bitset_index_new (G_LIST_MODEL (self), self->traceables);
}

View File

@ -60,5 +60,7 @@ SYSPROF_AVAILABLE_IN_ALL
GBytes *sysprof_document_lookup_file_finish (SysprofDocument *self,
GAsyncResult *result,
GError **error);
SYSPROF_AVAILABLE_IN_ALL
GListModel *sysprof_document_list_traceables (SysprofDocument *self);
G_END_DECLS