We are trialing Gtk3/Vala/Genie for the development of application user interfaces using Gnome-Builder/Meson/Glade/Flatpak. While there are many examples of Gtk.HeaderBar.pack_start( ... ) and Gtk.ActionBar.pack_start( ... ) within the Vala and other Gtk documentation, we have not been able to find examples of use within an xml ui file.
So the question is: how does one use pack_start/pack_end with the ui xml file? Are there any examples of a generated xml ui file or how to generate within Glade? Would this be entered as a property/attribute/child of the HeaderBar/ActionBar? What would this look like - what would be the general structure? If it is not a GtkChild, then how does one access it within the Vala/Genie source file?
Supplying the following trivial xml file MainApplication.ui, for example, how would one pack_start and pack_end a GtkColorButton to the GtkHeaderBar?
<?xml version="1.0" encoding="UTF-8"?> <!-- Generated with glade 3.20.2 --> <interface> <requires lib="gtk+" version="3.20"/> <template class="MainWindow" parent="GtkApplicationWindow"> <property name="can_focus">False</property> <property name="default_width">1024</property> <property name="default_height">768</property> <child type="titlebar"> <object class="GtkHeaderBar" id="header_bar"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="title">Test Application</property> <property name="subtitle">gnome.org</property> <property name="show_close_button">True</property> </object> </child> <child> <object class="GtkBox" id="content_box"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="orientation">vertical</property> <child> <placeholder/> </child> <child> <object class="GtkActionBar" id="action_bar"> <property name="visible">True</property> <property name="can_focus">False</property> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> <property name="position">1</property> </packing> </child> </object> </child> </template> </interface> This is used within the source file MainApplication.gs as follows:
[GtkTemplate (ui = "/org/gnome/application/ui/MainApplication.ui")] class MainWindow : Gtk.ApplicationWindow [GtkChild] header_bar:Gtk.HeaderBar [GtkChild] action_bar:Gtk.ActionBar construct ( application:Gtk.Application ) GLib.Object( application: application ) class MainApplication:Gtk.Application construct( id:string, flags:GLib.ApplicationFlags ) /* set locale: ALL, "" */ Intl.setlocale() /* set properties */ set_application_id( id ) set_flags( flags ) 
