On 10/19/18 5:43 PM, aedt wrote:

Thanks that worked but now I'm stuck with another problem. How can I construct a TreeViewColumn that renders a CellRendererProgress? I can't find a proper constructor for it. Here's what I got

The way CellRenderers work in GTK is that when connecting them with the
TreeViewColumn you tell it to connect on or more columns in your model
to a property of the CellRenderer.

For the CellRendererProgress you will want to bind the value propery
which holds a interger in the range [0, 100] which is the percentage
filled for the progress bar.

The Liststore should hold an integer for the progress:

super([GType.UINT, GType.STRING, GType.DOUBLE, GType.DOUBLE, GType.INT]);

(FYI: the getType function for ProgressBar is static so here was no need
fot the new)

After creating the TreeViewColumn you can set up the connections between
the model and the renderer:

usageBarCol = new TreeViewColumn();
usageBarCol.setName("Usage");

auto crp = new CellRendererProgress();
usageBarCol.packStart(crp, 0);
usageBarCol.addAttribute(crp, "value", Columns.usageBar);

The TreeViewColumn constructor you are using allows you set the name of
the column and set up one renderer to model connection in one call and
in this case that would be:

auto crp = new CellRendererProgress();
usageBarCol = new TreeViewColumn("Usage", crp, "value", Columns.usageBar);

When populating the model you will need to set the value of the usageBar
column to the percentage filled:

this.setValue(iter, Columns.usageBar, usedGB / capacityGB * 100);