aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-io-activity.h
Commit message (Collapse)AuthorAgeFilesLines
* Simplify EActivity.Matthew Barnes2010-10-231-72/+0
| | | | | | | | | | | | | | | | | | | | | | With unintrusive error dialogs gone, we can cut some unnecessary bits out of EActivity. I'm also adding a new enum property called "state", which is one of: E_ACTIVITY_RUNNING E_ACTIVITY_WAITING E_ACTIVITY_CANCELLED E_ACTIVITY_COMPLETED The state of an activity must be explicitly changed. In particular, when the user cancels an activity the state should be set only after confirming the operation has been cancelled and not when cancellation is requested (e.g. after receiving a G_IO_ERROR_CANCELLED, not when the GCancellable emits "cancelled"). EActivityBar and EActivityProxy widgets have been updated to make this distinction clearer in the UI. E_ACTIVITY_WAITING will be used when activities have to be queued and dispatched in sequence, which I haven't written yet.
* Add a GCancellable to EActivity.Matthew Barnes2010-09-191-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | EActivity now uses a GCancellable to manage cancellations, instead of having its own redundant cancellation API. API changes are as follows: + e_activity_get_cancellable() + e_activity_set_cancellable() - e_activity_cancel() - e_activity_is_cancelled() - e_activity_get_allow_cancel() - e_activity_set_allow_cancel() EActivity's "cancelled" signal remains, but only as a repeater for GCancellable::cancelled signals. It should not be emitted directly. The presence of a GCancellable implies that cancellation is allowed. EActivity does not create its own default GCancellable, it has to be given one. If a CamelOperation (cast as a GCancellable) is given, EActivity will configure itself to listen for status updates from the CamelOperation and propagate the information to its own "primary-text" and "percent" properties. These changes allowed me to start cleaning up some of the incredibly convoluted logic in mail-mt.c -- in particular, mail_operation_status() is completely gone now. mail-mt.c is still in a transitional state -- much more significant changes coming soon.
* Test drive EIOActivity with a simple asynchronous function.Matthew Barnes2009-11-081-4/+8
| | | | | | | | | | | | | | Rename e-fsutils to e-file-utils. This is where we'll add asynchronous functions for common file I/O operations with EActivity integration. Start with e_file_replace_contents_async() (and corresponding finish() function). This is a simple wrapper for g_file_replace_contents_async() which also returns an EActivity. It replaces e_write_file_uri(). Also redesign EIOActivity to -contain- a GAsyncResult rather than implement the interface for itself. This is easier for now but I may change my mind again when I figure out how to tie centralized error reporting into the EActivity framework.
* Prototype EIOActivity, which integrates with GIO.Matthew Barnes2009-11-081-0/+71
EIOActivity implements the GAsyncResult interface, and the idea is to use this instead of GSimpleAsyncResult. In addition to the features offered by EActivity, it also contains GAsyncReadyCallback information and a GCancellable. - Calling e_activity_cancel() triggers the GCancellable. - Calling e_activity_complete() triggers the GAsyncReadyCallback. Functions that follow GIO's asynchronous pattern should return an EIOActivity (cast as an EActivity) instead of 'void', so it can be handed to an EShellBackend or whatever else dispatches activities. This is not yet feature-complete. It's missing API for storing result values and GErrors. I don't have a complete picture of the final API in my head yet, so I'll copy things over from GSimpleAsyncResult as needed.