diff --git a/src/libsysprof-analyze/sysprof-document-allocation.c b/src/libsysprof-analyze/sysprof-document-allocation.c index c1091560..c64a549b 100644 --- a/src/libsysprof-analyze/sysprof-document-allocation.c +++ b/src/libsysprof-analyze/sysprof-document-allocation.c @@ -20,6 +20,8 @@ #include "config.h" +#include + #include "sysprof-document-frame-private.h" #include "sysprof-document-allocation.h" @@ -142,9 +144,12 @@ static void sysprof_document_allocation_class_init (SysprofDocumentAllocationClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + SysprofDocumentFrameClass *document_frame_class = SYSPROF_DOCUMENT_FRAME_CLASS (klass); object_class->get_property = sysprof_document_allocation_get_property; + document_frame_class->type_name = N_("Allocation"); + /** * SysprofDocumentAllocation:thread-id: * diff --git a/src/libsysprof-analyze/sysprof-document-frame-private.h b/src/libsysprof-analyze/sysprof-document-frame-private.h index e10aaee2..a7e0e5b2 100644 --- a/src/libsysprof-analyze/sysprof-document-frame-private.h +++ b/src/libsysprof-analyze/sysprof-document-frame-private.h @@ -40,6 +40,7 @@ struct _SysprofDocumentFrame struct _SysprofDocumentFrameClass { GObjectClass parent_class; + const char *type_name; }; SysprofDocumentFrame *_sysprof_document_frame_new (GMappedFile *mapped, @@ -49,6 +50,9 @@ SysprofDocumentFrame *_sysprof_document_frame_new (GMappedFile *ma gint64 begin_time, gint64 end_time); +#define SYSPROF_DOCUMENT_FRAME_GET_CLASS(obj) \ + G_TYPE_INSTANCE_GET_CLASS(obj, SYSPROF_TYPE_DOCUMENT_FRAME, SysprofDocumentFrameClass) + #define SYSPROF_DOCUMENT_FRAME_ENDPTR(obj) \ (&((const guint8 *)SYSPROF_DOCUMENT_FRAME(obj)->frame)[SYSPROF_DOCUMENT_FRAME(obj)->frame_len]) diff --git a/src/libsysprof-analyze/sysprof-document-frame.c b/src/libsysprof-analyze/sysprof-document-frame.c index 014bfd51..00a9b8f1 100644 --- a/src/libsysprof-analyze/sysprof-document-frame.c +++ b/src/libsysprof-analyze/sysprof-document-frame.c @@ -20,6 +20,8 @@ #include "config.h" +#include + #include "sysprof-document-frame-private.h" #include "sysprof-document-allocation.h" @@ -45,11 +47,18 @@ enum { PROP_PID, PROP_TIME, PROP_TIME_OFFSET, + PROP_TYPE_NAME, N_PROPS }; static GParamSpec *properties[N_PROPS]; +static const char * +sysprof_document_frame_get_type_name (SysprofDocumentFrame *self) +{ + return g_dgettext (GETTEXT_PACKAGE, SYSPROF_DOCUMENT_FRAME_GET_CLASS (self)->type_name); +} + static void sysprof_document_frame_finalize (GObject *object) { @@ -89,6 +98,10 @@ sysprof_document_frame_get_property (GObject *object, g_value_set_int64 (value, sysprof_document_frame_get_time_offset (self)); break; + case PROP_TYPE_NAME: + g_value_set_static_string (value, sysprof_document_frame_get_type_name (self)); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); } @@ -102,6 +115,8 @@ sysprof_document_frame_class_init (SysprofDocumentFrameClass *klass) object_class->finalize = sysprof_document_frame_finalize; object_class->get_property = sysprof_document_frame_get_property; + klass->type_name = N_("Frame"); + properties[PROP_CPU] = g_param_spec_int ("cpu", NULL, NULL, G_MININT32, @@ -130,6 +145,11 @@ sysprof_document_frame_class_init (SysprofDocumentFrameClass *klass) 0, (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + properties[PROP_TYPE_NAME] = + g_param_spec_string ("type-name", NULL, NULL, + NULL, + (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_properties (object_class, N_PROPS, properties); } diff --git a/src/libsysprof-analyze/sysprof-document-log.c b/src/libsysprof-analyze/sysprof-document-log.c index ce03db0a..4a7dbc5e 100644 --- a/src/libsysprof-analyze/sysprof-document-log.c +++ b/src/libsysprof-analyze/sysprof-document-log.c @@ -20,6 +20,8 @@ #include "config.h" +#include + #include "sysprof-document-frame-private.h" #include "sysprof-document-log.h" @@ -76,9 +78,12 @@ static void sysprof_document_log_class_init (SysprofDocumentLogClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + SysprofDocumentFrameClass *document_frame_class = SYSPROF_DOCUMENT_FRAME_CLASS (klass); object_class->get_property = sysprof_document_log_get_property; + document_frame_class->type_name = N_("Log"); + properties [PROP_SEVERITY] = g_param_spec_uint ("severity", NULL, NULL, 0, G_MAXUINT16, 0, diff --git a/src/libsysprof-analyze/sysprof-document-mark.c b/src/libsysprof-analyze/sysprof-document-mark.c index a481947b..712fd14d 100644 --- a/src/libsysprof-analyze/sysprof-document-mark.c +++ b/src/libsysprof-analyze/sysprof-document-mark.c @@ -20,6 +20,8 @@ #include "config.h" +#include + #include "sysprof-document-frame-private.h" #include "sysprof-document-mark.h" @@ -87,9 +89,12 @@ static void sysprof_document_mark_class_init (SysprofDocumentMarkClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + SysprofDocumentFrameClass *document_frame_class = SYSPROF_DOCUMENT_FRAME_CLASS (klass); object_class->get_property = sysprof_document_mark_get_property; + document_frame_class->type_name = N_("Mark"); + properties [PROP_DURATION] = g_param_spec_int64 ("duration", NULL, NULL, G_MININT64, G_MAXINT64, 0, diff --git a/src/libsysprof-analyze/sysprof-document-sample.c b/src/libsysprof-analyze/sysprof-document-sample.c index b6b48b2a..3eb612a6 100644 --- a/src/libsysprof-analyze/sysprof-document-sample.c +++ b/src/libsysprof-analyze/sysprof-document-sample.c @@ -20,6 +20,8 @@ #include "config.h" +#include + #include "sysprof-document-frame-private.h" #include "sysprof-document-sample.h" @@ -127,9 +129,12 @@ static void sysprof_document_sample_class_init (SysprofDocumentSampleClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + SysprofDocumentFrameClass *document_frame_class = SYSPROF_DOCUMENT_FRAME_CLASS (klass); object_class->get_property = sysprof_document_sample_get_property; + document_frame_class->type_name = N_("Sample"); + /** * SysprofDocumentSample:thread-id: *