In PackageKit, the packaging backend is able to control what part of each transaction is cancellable so we can do things like set the cancel GUI button sensitive or insensitive at appropriate times. For instance loading the rpmdb is not cancellable, but downloading a file is. In converting some of the server code to use GCancellable, I've found it's missing this 'hinting' functionality. It would be really great to wrap GCancellable in another object, in my case PkCancellable and add the extra functionality there. Unfortunately _GCancellable is private and not public, and thus can't be subclassed. I've attached a patch to make it public, and use a _GCancellablePrivate struct, which solves my problem nicely. I'm guessing this is a better idea than adding methods to GCancellable such as g_cancellable_set_hint_can_cancel(), g_cancellable_get_hint_can_cancel() and a signal ::hint_can_cancel_changed(bool), but I'm open to the latter as well if this is the approach you want. Comments please, thanks, Richard.
Attachment:
0001-Allow-GCancellable-to-be-subclassed-by-adding-a-priv.patch
Description: application/force-download