sysprof: add dbus utility

This allows viewing the message contents that were captured in a textview
within the utility pane.

We already limit the max size of a message in the capture file, so
presumably messages are relatively small enough to fit here.
This commit is contained in:
Christian Hergert
2023-08-01 11:20:24 -07:00
parent fa1c88eaf9
commit 3c33ae06a0
9 changed files with 252 additions and 5 deletions

View File

@ -51,6 +51,7 @@ enum {
PROP_SIGNATURE,
PROP_SENDER,
PROP_SERIAL,
PROP_STRING,
N_PROPS
};
@ -130,6 +131,10 @@ sysprof_document_dbus_message_get_property (GObject *object,
g_value_set_string (value, sysprof_document_dbus_message_get_signature (self));
break;
case PROP_STRING:
g_value_take_string (value, sysprof_document_dbus_message_dup_string (self));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@ -214,6 +219,11 @@ sysprof_document_dbus_message_class_init (SysprofDocumentDBusMessageClass *klass
0,
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
properties[PROP_STRING] =
g_param_spec_string ("string", NULL, NULL,
NULL,
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_properties (object_class, N_PROPS, properties);
}
@ -444,3 +454,16 @@ sysprof_document_dbus_message_get_bus_type (SysprofDocumentDBusMessage *self)
return 0;
}
char *
sysprof_document_dbus_message_dup_string (SysprofDocumentDBusMessage *self)
{
g_autoptr(GDBusMessage) message = NULL;
g_return_val_if_fail (SYSPROF_IS_DOCUMENT_DBUS_MESSAGE (self), NULL);
if (!(message = sysprof_document_dbus_message_dup_message (self)))
return NULL;
return g_dbus_message_print (message, 0);
}