Öppna filer
I detta steg får vi vårt program att visa innehållet för alla filer som det fått på kommandoraden.
To this end, we add a data member to our application window and keep a pointer to the Gtk::Stack there. We get the pointer with a call to Gtk::Builder::get_widget() in the application window's constructor.
Now we revisit the ExampleAppWindow::open_file_view() method that is called for each commandline argument, and construct a Gtk::TextView that we then add as a page to the stack.
Lastly, we add a Gtk::StackSwitcher to the titlebar area in the ui file, and we tell it to display information about our stack.
The stack switcher gets all its information it needs to display tabs from the stack that it belongs to. Here, we are passing the label to show for each file as the last argument to the Gtk::Stack::add() method.
Vårt program börjar få form: