Re: GCancellable hints
- From: Benjamin Otte <otte gnome org>
- To: gtk-devel-list gnome org
- Subject: Re: GCancellable hints
- Date: Thu, 27 Aug 2009 08:09:21 +0000 (UTC)
Richard Hughes <hughsient <at> gmail.com> writes:
> The only functionality that ZifCancellable adds is two methods:
>
> void zif_cancellable_set_hint (GCancellable *cancellable, gboolean can_cancel)
> gboolean zif_cancellable_get_hint (GCancellable *cancellable);
>
> And added the "hint-changed" signal
>
I'm not Alex, who has final say on API issues, but I don't think this API
should be part of GCancellable. And that's because I think you're treating
GCancellable wrong.
GCancellable's only purpose is as a token that ensures function calls can be
cancelled over thread or operating system boundaries. In an async program, the
same cancellable is often used for multiple calls at the same time. Operation
is one-way: The caller cancels the function call.
What you want is a way to describe a transaction, where the caller and the
function call interact in two directions and one of the interactions is
cancellation while another interaction is telling the caller that cancellation
is currently disabled. Other transaction information you probably have in
PackageKit is progress information. From my POV this is quite a different
thing conceptually than what GCancellable does.
I should also note that GIO functions put transaction information into
separate parameters passed to the function call - g_file_copy() for example
has the progress_callback parameters. They do not attach this information to
the cancellable.
Benjamin
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]