Hello
I’m very new at GTK development and I’ve chosen the Vala language.
I have a Gtk.ApplicationWindow containing a Gtk.Box where I want to dynamically add widgets created from template coming from a ui file.
My problem is that I don’t find how to load the UI and create gtk objects from the template inside the ui. I searched in many placed but with no success.
My code is
namespace Gw3t {
[GtkTemplate (ui = "/fr/ghorin/g3wt/gtk/window.ui")]
public class Window : Gtk.ApplicationWindow {
[GtkChild]
private unowned Gtk.Box box_list_downloads; // The Gtk.Box where I want to add widgets
public Window (Gtk.Application app) {
Object (application: app);
var file = File.new_for_path ("widget-download.ui");
for(int cpt=1; cpt<10; cpt++) {
box_list_downloads.append( ???? );
}
}
}
}
If somebody could give me some hint, that would be very nice. And sorry if the answer is very easy, I’m very new at programming in Vala + Gtk.