How to use the GtkHeaderBar in glade 3.20?
Asked Answered
F

2

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.

Fulvia answered 24/6, 2016 at 9:41 Comment(0)
B
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

Bathy answered 2/1, 2018 at 22:26 Comment(4)
What version of Glade are you using?Fulvia
@Fulvia 3.20.2Bathy
The HeaderBar widget can no longer be dropped there. "Widgets of type Window need placeholders to add children."Chequered
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.Radioluminescence
F
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.

Fulvia answered 24/6, 2016 at 14:18 Comment(5)
can you show the relevant excerpt of your XML file?Redmond
@FrederickNord I made a little video on youtube about that : youtu.be/xKVvi_8DIW8?t=1m41s . I shall put the XML in the answer soon.Fulvia
It has been 4 years, will you ever put that XML?Mazurka
@AkibAzmain Huh, sorry, I didn't touch that for a while, I don't remember at all how to do that stuff, but I assure you it's straightforward.Fulvia
Now it's possible from Glade by following instructions in answer by m4tx.Mazurka

© 2022 - 2024 — McMap. All rights reserved.