Updated this patch with two major improvements, largely as outlined above:
- Removed the ability to "temporarily suppress" inhibitions. If you call
SuppressInhibitionnow, it will always store the configuration and apply the same suppression in the future. This allows us to make individual app inhibition items into on/off switches, rather than the complicated button menu for temporary blocks.- I've done some digging and talked to @nclarius about the need for temporary suppressions, and it turns out there wasn't much of a need, rather it got included due to historical implementation quirks.
- This MR does not introduce Switch components quite yet, it sticks with "Unblock" and "Block Again" buttons to avoid blowing up the diff even further.
- Instead of having separate lists
ActiveInhibitionsandSuppressedInhibitions, we now have a single listRequestedInhibitionswhich includes both active and suppressed ones. This allows us to have a single, consistently ordered list in the applet so that pressing "Unblock" and "Block Again" doesn't make the app inhibition item jump around to another category. This is also a precondition for using switch components.ActiveInhibitionsstays in the API because it might be useful to some API users, however it's not used by the power management applet.
This took a little bit of refactoring throughout the entire patch, but ultimately there is less and more robust code than before. This also provides the foundation for better UI strings than !573 could do (in addition to swapping "Unblock" buttons for Switch components).
Sorry about the still-substantial diff. I'm not sure I know how to break it up into smaller atomic commits, changing the API requires both changes in the underlying data model and the applet that uses it.