Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Box hierarchy for GTK4 #313

Merged
merged 2 commits into from Aug 27, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lgi/override/Gtk.lua
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ if Gtk.Container then
end
end

-------------------------------- Gtk.Box overrides.
Gtk.Box._container_add = Gtk.Box.append

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to wrap this with a GTK version check to only apply to GTK >= 4?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. This method doesn't exist in GTK3. I'll look into moving this down the bottom the file inside a "GTK4 overrides" block, right next to the old GTK2 check.

Copy link
Author

@ghost ghost Aug 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as of the latest commit:

Gtk override

-------------------------------- Gtk-4 overrides

if Gtk._version == '4.0' then

   --- CONTAINER CLASSES
   --- GTK4 Has removed the Container abstract class.
   --- This means Boxes, Grids and other layout widgets 
   --- Must now add children using their own specific methods.

   --- Gtk.Box overrides

   --- widgets on a the array part of the constructor of a Box
   --- will be `append()`-ed
   --- in order of appearance.
   Gtk.Box._container_add = Gtk.Box.append

end

This will prevent Gtk versions ~= 4.0 from attempting Gtk.Box.append().


-------------------------------- Gtk.Builder overrides.
Gtk.Builder._attribute = {}

Expand Down
Loading