diff --git a/src/libsysprof-analyze/sysprof-document-file.c b/src/libsysprof-analyze/sysprof-document-file.c index bfd70a1a..fe949e34 100644 --- a/src/libsysprof-analyze/sysprof-document-file.c +++ b/src/libsysprof-analyze/sysprof-document-file.c @@ -35,6 +35,7 @@ struct _SysprofDocumentFile enum { PROP_0, PROP_BYTES, + PROP_IS_COMPRESSED, PROP_PATH, PROP_SIZE, N_PROPS @@ -73,6 +74,10 @@ sysprof_document_file_get_property (GObject *object, g_value_take_boxed (value, sysprof_document_file_dup_bytes (self)); break; + case PROP_IS_COMPRESSED: + g_value_set_boolean (value, sysprof_document_file_is_compressed (self)); + break; + case PROP_SIZE: g_value_set_uint64 (value, sysprof_document_file_get_size (self)); break; @@ -100,6 +105,11 @@ sysprof_document_file_class_init (SysprofDocumentFileClass *klass) G_TYPE_BYTES, (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + properties [PROP_IS_COMPRESSED] = + g_param_spec_boolean ("is-compressed", NULL, NULL, + FALSE, + (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + properties [PROP_SIZE] = g_param_spec_uint64 ("size", NULL, NULL, 0, G_MAXUINT64, 0, @@ -249,3 +259,21 @@ sysprof_document_file_get_size (SysprofDocumentFile *self) return size; } + +/** + * sysprof_document_file_is_compressed: + * @self: a #SysprofDocumentFile + * + * Checks if the embedded file is compressed. If so, %TRUE is returned. + * + * Note that files are transparently decompressed when opening streams. + * + * Returns: %TRUE if the embedded file was compressed + */ +gboolean +sysprof_document_file_is_compressed (SysprofDocumentFile *self) +{ + g_return_val_if_fail (SYSPROF_IS_DOCUMENT_FILE (self), FALSE); + + return self->compressed; +} diff --git a/src/libsysprof-analyze/sysprof-document-file.h b/src/libsysprof-analyze/sysprof-document-file.h index 4865e469..faa60747 100644 --- a/src/libsysprof-analyze/sysprof-document-file.h +++ b/src/libsysprof-analyze/sysprof-document-file.h @@ -32,12 +32,14 @@ SYSPROF_AVAILABLE_IN_ALL G_DECLARE_FINAL_TYPE (SysprofDocumentFile, sysprof_document_file, SYSPROF, DOCUMENT_FILE, GObject) SYSPROF_AVAILABLE_IN_ALL -const char *sysprof_document_file_get_path (SysprofDocumentFile *self); +const char *sysprof_document_file_get_path (SysprofDocumentFile *self); SYSPROF_AVAILABLE_IN_ALL -GBytes *sysprof_document_file_dup_bytes (SysprofDocumentFile *self); +GBytes *sysprof_document_file_dup_bytes (SysprofDocumentFile *self); SYSPROF_AVAILABLE_IN_ALL -GInputStream *sysprof_document_file_read (SysprofDocumentFile *self); +GInputStream *sysprof_document_file_read (SysprofDocumentFile *self); SYSPROF_AVAILABLE_IN_ALL -gsize sysprof_document_file_get_size (SysprofDocumentFile *self); +gsize sysprof_document_file_get_size (SysprofDocumentFile *self); +SYSPROF_AVAILABLE_IN_ALL +gboolean sysprof_document_file_is_compressed (SysprofDocumentFile *self); G_END_DECLS