12

I tried to do a GtkHeaderBar application with glade 3.20, but I have the oldschool bar on top every time, when creating my python app.

In glade 3.19, checking the client-side decoration property created a line on top, in which I could put the GtkHeaderBar. This is not the case in the latest version.

I tried to check/uncheck every property, I could not find the way to do this. That is very surprising, since this should be the default way to do a Gnome application.

I looked on the internet, but there is dramatically no documentation on glade…

After searching, it seems that I must add a GtkHeaderBar as child in the main window. But how, that is the mystery.

Boiethios
  • 38,438
  • 19
  • 134
  • 183

2 Answers2

15

Create the window, set the "Client side window decorations" property to True. Next, get the HeaderBar widget from the toolbox and drop it on the top part of the window that just appeared:

GtkHeaderBar in Glade

And here you are, the header bar:

GtkHeaderBar example

m4tx
  • 4,139
  • 5
  • 37
  • 61
  • What version of Glade are you using? – Boiethios Jan 02 '18 at 23:00
  • @Boiethios 3.20.2 – m4tx Jan 03 '18 at 07:06
  • The HeaderBar widget can no longer be dropped there. "Widgets of type Window need placeholders to add children." – Matthias Urlichs Oct 11 '21 at 18:01
  • I can confirm that this works in 2022. Using Glade version 3.38.2. There is just one thing. You need to add the HeaderBar as first container to the window. Basically the workflow should be: 1. Create a window, 2 set the "Client side window decorations" property to True, 3. add the HeaderBar before anything else. If you add something else or already have the window populated then it will not work and you need to edit the xml. – Jan Dec 16 '22 at 21:38
5

Ok, I found by myself a workaround:

We need to create the GtkHeaderBar apart, and after activating the client side decoration property, we close the project. Then, by editing the XML file, we put the header bar section into the titlebar section, instead of the placeholder xml tag. When we reopen the glade project, that's ok, the header bar is in the window.

Boiethios
  • 38,438
  • 19
  • 134
  • 183