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

add settings to center buttons-grid #426

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

rtgiskard
Copy link

buttonsGrid is using flowbox as the container, with default halign set
to FILL, for which users have to tweak the button size to make it really
fill the space or it will not be centered.

This adds options to make the buttonGrid centered properly

buttonsGrid is using flowbox as the container, with default halign set
to FILL, for which users have to tweak the button size to make it really
fill the space or it will not be centered.

this add options to make the buttonGrid centered properly
set options only when it's present
@ErikReider ErikReider added the enhancement New feature or request label Jul 10, 2024
Copy link
Owner

@ErikReider ErikReider left a comment

Choose a reason for hiding this comment

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

Would be great if the column min/max wouldn't be needed, but that's sadly just how GTK works...

Not sure how one would fix this without needing those config properties. Any ideas?

Comment on lines 28 to 37
if (center != null && center)
container.set_halign(Gtk.Align.CENTER);

int? col_min = get_prop<int> (config, "column-min");
if (col_min != null && col_min > 0)
container.set_min_children_per_line(col_min);

int? col_max = get_prop<int> (config, "column-max");
if (col_max != null && col_max > 0)
container.set_max_children_per_line(col_max);
Copy link
Owner

Choose a reason for hiding this comment

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

The linter requires spaces between the function name and the parenthesis. Also, I'd prefer if you use brackets on small if-statments.

Not sure why GitHub isn't allowing me to run my GitHub Linting Actions…

Copy link
Author

Choose a reason for hiding this comment

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

The vala dev settings on my laptop not seems to be stable enough, reformat with uncrustify, feel free to adjust the code on merge if you like ;)

@rtgiskard
Copy link
Author

rtgiskard commented Jul 12, 2024

Would be great if the column min/max wouldn't be needed, but that's sadly just how GTK works...

Not sure how one would fix this without needing those config properties. Any ideas?

Maybe use some other container other than flowbox. Anyway, for flowbox, align to center seems to require set_min_children_per_line() to be set properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants