GJsonArrayModel: Support fields that aren't tied to a single JSON value

Change the custom data massaging callback to take a const JsonObject&.
This will allow binding together data from multiple fields into one
output in the model. :^)
This commit is contained in:
Andreas Kling 2019-08-10 15:06:29 +02:00
parent a4548a150f
commit afd25679bc
Notes: sideshowbarker 2024-07-19 12:46:16 +09:00
3 changed files with 13 additions and 6 deletions

View file

@ -16,8 +16,8 @@ ProcessFileDescriptorMapWidget::ProcessFileDescriptorMapWidget(GWidget* parent)
pid_fds_fields.empend("class", "Class", TextAlignment::CenterLeft);
pid_fds_fields.empend("offset", "Offset", TextAlignment::CenterRight);
pid_fds_fields.empend("absolute_path", "Path", TextAlignment::CenterLeft);
pid_fds_fields.empend("seekable", "Access", TextAlignment::CenterLeft, [](auto& data) {
return data.to_bool() ? "Seekable" : "Sequential";
pid_fds_fields.empend("Access", TextAlignment::CenterLeft, [](auto& object) {
return object.get("seekable").to_bool() ? "Seekable" : "Sequential";
});
m_table_view->set_model(GJsonArrayModel::create({}, move(pid_fds_fields)));