After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 725648 - Switches should always indicate the current state
Switches should always indicate the current state
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
3.11.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2014-03-04 11:18 UTC by Allan Day
Modified: 2014-04-06 05:53 UTC
See Also:
GNOME target: ---
GNOME version: 3.11/3.12


Attachments
rough mockup (12.33 KB, image/png)
2014-03-04 11:18 UTC, Allan Day
Details
screencast (815.34 KB, video/webm)
2014-03-29 18:08 UTC, Matthias Clasen
Details

Description Allan Day 2014-03-04 11:18:33 UTC
Created attachment 270888 [details]
rough mockup

Currently, switches show the state that the widget is in: they are either in an on or an off position.

However, sometimes the thing that the switch controls might be in a different state from the widget. This is most common when a switch controls a piece of hardware: you might switch off bluetooth, but it might take a few seconds to power off. In that time, the switch indicates that bluetooth is off, even when it is still on.

This might seem like a minor thing, but it would be an enhancement to the widget, in that it would reinforce the direct and transparent relationship between the control and its target.

One thing we'd have to resolve is how switches would look in the various possible states. I've attached a really bad mockup which should hopefully communicate the idea.
Comment 1 Matthias Clasen 2014-03-29 17:44:25 UTC
Pushed a switch-state branch that implements this
Comment 2 Matthias Clasen 2014-03-29 18:08:25 UTC
Created attachment 273244 [details]
screencast

sorry for the big video - I donated to pitivi, but sadly, it can't even crop a video :-(

The video shows a switch where the change of the underlying state is delayed by 2 seconds. I've added a spinner to indicate when the ui state and the underlying state are different. The checkbox represents the underlying state
Comment 3 Matthias Clasen 2014-03-29 18:11:56 UTC
https://git.gnome.org/browse/gtk+/log/?h=switch-state
Comment 4 Allan Day 2014-03-29 18:46:05 UTC
Looks fantastic! Could be nice to use a CSS transition for the color change of the background, but that's a detail we can look at later.
Comment 5 Emmanuele Bassi (:ebassi) 2014-03-31 10:38:23 UTC
quick things I noticed skimming the branch:

 * the ::set-state signal should really be ::state-set instead
 * need to remove a padding slot in the SwitchClass structure
 * maybe have symbolic constants for the ::state-set return value, like we do for GSource and event handling - something lik GTK_SWITCH_APPLY_STATE and GTK_SWITCH_DELAY_STATE - just to improve readability
Comment 6 Matthias Clasen 2014-03-31 12:43:19 UTC
(In reply to comment #5)

>  * maybe have symbolic constants for the ::state-set return value, like we do
> for GSource and event handling - something lik GTK_SWITCH_APPLY_STATE and
> GTK_SWITCH_DELAY_STATE - just to improve readability

I think that would rather be G_SIGNAL_CONTINUE / G_SIGNAL_STOP and be used for all signals using TRUE-to-stop semantics