Trouble with GtkHeaderBar
- Create a GtkApplicationWindow
- Set Decorated property to false
- Create a GtkBox
- Set Orientation to vertical
- Adding a GtkHeaderBar in the first (top) box placeholder
How can I add something on the GtkHeaderBar ?
Tried to edit the ui out of cambalache
Loading the project loose the modifications
original ui:
<?xml version='1.0' encoding='UTF-8'?>
<!-- Created with Cambalache 0.8.1 -->
<interface>
<!-- interface-name test.ui -->
<!-- interface-description Cambalache Test -->
<requires lib="gtk" version="4.0"/>
<object class="GtkApplicationWindow">
<property name="decorated">False</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkHeaderBar"/>
</child>
<child>
<object class="GtkLabel" id="lb_hello">
<property name="label">Hello</property>
<property name="name">lb_hello</property>
<property name="vexpand">True</property>
<property name="vexpand-set">True</property>
</object>
</child>
<child>
<object class="GtkStatusbar"/>
</child>
</object>
</child>
</object>
</interface>
hand modified:
<?xml version='1.0' encoding='UTF-8'?>
<!-- Created with Cambalache 0.8.1 -->
<interface>
<!-- interface-name test.ui -->
<!-- interface-description Cambalache Test -->
<requires lib="gtk" version="4.0"/>
<object class="GtkApplicationWindow">
<property name="decorated">False</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkHeaderBar">
<property name="title-widget">
<object class="GtkLabel">
<property name="label" translatable="yes">Label</property>
<property name="single-line-mode">True</property>
<property name="ellipsize">end</property>
<property name="width-chars">5</property>
<style>
<class name="title"/>
</style>
</object>
</property>
</object>
</child>
<child>
<object class="GtkLabel" id="lb_hello">
<property name="label">Hello</property>
<property name="name">lb_hello</property>
<property name="vexpand">True</property>
<property name="vexpand-set">True</property>
</object>
</child>
<child>
<object class="GtkStatusbar"/>
</child>
</object>
</child>
</object>
</interface>
Edited by Roberto Mantovani