Skip to content

Conversation

@danirabbit
Copy link
Member

Screenshot from 2025-03-21 10 27 25

  • 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.

@danirabbit danirabbit requested a review from a team March 21, 2025 17:44
@danirabbit danirabbit requested a review from a team March 21, 2025 18:00
NONE,
SINGLE,
DOUBLE,
LINKED;
Copy link
Member Author

Choose a reason for hiding this comment

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

Probably needs docs

@danirabbit danirabbit added this to OS 9 Mar 21, 2025
@danirabbit danirabbit moved this to Needs Review in OS 9 Mar 21, 2025
Copy link
Member

@leolost2605 leolost2605 left a 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 {
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member Author

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?

Copy link
Member

@leolost2605 leolost2605 Mar 25, 2025

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.

Copy link
Member

@leolost2605 leolost2605 left a 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

@danirabbit danirabbit merged commit 9e48ecc into main Mar 25, 2025
5 checks passed
@github-project-automation github-project-automation bot moved this from Needs Review to Done in OS 9 Mar 25, 2025
@danirabbit danirabbit deleted the danirabbit/box branch March 25, 2025 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants