GNOME Bugzilla – Bug 669811
Checkbox widget
Last modified: 2012-02-17 17:40:26 UTC
As part of the gnome-keyring prompting work I tried to implement a simple checkbox using StButton. However it doesn't seem to be capable enough, both in design, and implementation: From Florian Müllner: > 'check-box' (single quotes!) is very generic (which is fine by me), but the > corresponding CSS is not - I wonder if it would be clearer to use a composite > widget here (for instance a BoxLayout with a Bin (for the check-box image) and > a Label) and set it as the Button child. In addition to the artwork, the > ellipsized label also feels wrong (in my testing, I get "Automatically unlock > this keyring whenever ...", which means the most important part is missing). I > suspect this is way easier to fix with a custom Button child than with crazy > CSS. I agree that it needs to be done better. I tried to do it similar to what you're suggesting but ran out of time somewhere between undocumented St toolkit, unfamiliar (or strange) clutter behavior, and CSS selectors that didn't work as expected. In addition a new widget would need to support keyboard, active, focus, hover and other things I'm sure. StButton has all those already, so that was the reason behind restyling it. The ellipsizing behavior of StButton is quite brittle, and should probably be tweaked or removed. I can imagine it running into problems with translated labels as well. In addition the checkbox needs to have its look designed properly. So here's a new bug for properly designing a checkbox control.
Created attachment 207669 [details] [review] Add a checkbox widget gnome-keyring dialogs need checkboxes, and while it is possible to get pretty close using CSS tricks, a dedicated widgets yields better results.
Created attachment 207670 [details] Example usage of the widget
Review of attachment 207669 [details] [review]: While I'm not a fan of the Shell.GenericContainer, this is good for now.
Attachment 207669 [details] pushed as e2726f3 - Add a checkbox widget Sure, I expect a get-rid-of-generic-container cleanup at some point, but until then I don't see a good reason to avoid it (especially as the usage here is hardly very sophisticated)
Wonderful. Looks nice :)
Created attachment 207761 [details] checkbox widget SVG I've made the checkbox as tall as the on/off switch by default.
Created attachment 207762 [details] forgot to narrow it though :)
Created attachment 207763 [details] unchecked state
Created attachment 207774 [details] [review] theme: Adjust checkbox style Replace the original hacked-up style with some original Steiner artwork.
Reopening for the style update.
Review of attachment 207774 [details] [review]: Go for it.
Attachment 207774 [details] pushed as 36c3ce9 - theme: Adjust checkbox style