Closed danirabbit closed 2 years ago
Isn't it easier to set menu_button.icon_size = LARGE?
Oh huh, my bad. That's only a thing on GtkImage, somehow I thought it was on buttons as well. Nevermind...
@Exalm it looks like icon_size
is a property for Gtk.Image but not Gtk.Button
Indeed. Kinda defeats the point really, I wonder if it's just an oversight.
Yeah that would be pretty clean to have that as a property of Gtk.Button imo! I would :+1: that issue/PR ;)
If you want it to be a "large-icon", I think that you need:
var updates_button = new Gtk.Button.from_icon_name ("software-update-available");
((Gtk.Image) updates_button.child).icon_size = Gtk.IconSize.LARGE;
The fact the button child when you use from_icon_name()
is:
are implementation details. Don't rely on that, it can change at any time (and has changed for GtkMenuButton, where it went from menubutton > button > image to menubutton > button > box > image in 4.6).
Yeah, I want to avoid trying to get and cast the child because it's not consistent or necessarily reliable
Makes my life easier to set icon sizes for buttons and menu buttons in titlebars. Especially for menubuttons since manually setting the child means no image-button class and it isn't easy to select the button since the popover is also a child.
has_frame
technically works here, but it addsflat
which is slightly different fromimage-button
.Also in
images
, don't require thelarge-icons
class to be directly on an image, because it's useful to set it on a container widget like a buttonVala before:
Vala after: