Gtk Popover menu does not use indentation by default
I've created GtkPopoverMenu
and added some text buttons to it, but I can't seem to get it to follow the same addition as other popovers like in Nautilus.
The default style classes are applied and GtkInspector
shows the same padding values as the popover in Nautilus, but visually no padding.
Here's the relevant piece of code:
pbox = Gtk.Box(orientation = Gtk.Orientation.VERTICAL)
popover.add(pbox)
one = Gtk.ModelButton.new()
one.set_label("Button One")
pbox.pack_start(one, False, False, 0)
two = Gtk.ModelButton.new()
two.set_label("Button Two")
pbox.pack_start(two, False, False, 0)
three = Gtk.ModelButton.new()
three.set_label("Button Three")
pbox.pack_start(three, False, False, 0)
And how it looks versus how it looks in Nautilus: Image
And the complete code: Code
Did I miss something?
source to share
Nautilus uses a combination of margins and padding for its Popover.
I hope the screenshot shows this. The first is Popover, just like your code. The second has a margin, but as you can see, the selection directly affects the text. Therefore, the third Popover has headroom and padding.
Margins can be set with widget.set_property('margin', 10)
and filled with css file.
source to share