-
-
Notifications
You must be signed in to change notification settings - Fork 60
Add Granite.Box #767
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
Add Granite.Box #767
Conversation
danirabbit
commented
Mar 21, 2025

- Adds a box subclass with a built-in property for child spacing. Enforces box spacing and makes it respond to text scaling. No more custom CSS or putting in the wrong magic numbers when doing layouts
- Adds some test cases for linked children.
| NONE, | ||
| SINGLE, | ||
| DOUBLE, | ||
| LINKED; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably needs docs
leolost2605
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments but I like it makes it easier to do the right thing. (e.g. I recently was looking for exactly the linked style but didn't know it existed as a css class)
| * @since 7.7.0 | ||
| */ | ||
| [Version (since = "7.7.0")] | ||
| public class Granite.Box : Gtk.Box { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not very important right now but something to keep in mind is that Gtk.Box probably won't be derivable in GTK 5 so it might make sense to already just derive from Gtk.Widget. Would also make sure that the spacing property of the box isn't used which it isn't intended to be with Granite.Box I think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good call. I was wondering if I should just go ahead and make it a box layout and not a Gtk.Box subclass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@leolost2605 I opened #770 but I'm kind of less sure about it. It seems like it won't be terribly hard to basically support all the same Gtk.Box API since it mostly inherits from other interfaces, but I wonder if we should wait until there's something more definitive about not being able to subclass Gtk.Box just in case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#770 looks good but we can wait. We'll have API breaks anyways once GTK5 drops so it doesn't really matter ig.
leolost2605
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't comment on CSS but otherwise looks good