user_data for callbacks



Hi,

Just checking the introspection of g_volume_mount():

/**
 * g_volume_mount:
 * @volume: a #GVolume.
 * @flags: flags affecting the operation
 * @mount_operation: (allow-none): a #GMountOperation or %NULL to
avoid user interaction.
 * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
 * @callback: (allow-none): a #GAsyncReadyCallback, or %NULL.
 * @user_data: user data that gets passed to @callback
 *
 * Mounts a volume. This is an asynchronous operation, and is
 * finished by calling g_volume_mount_finish() with the @volume
 * and #GAsyncResult returned in the @callback.
 *
 * Virtual: mount_fn
 **/

The user_data parameter above doesn't have a (closure) annotation, but
looking at the gir file, it doesn't seem necessary: the callback
parameter has closure=4 already set.

Python wants me to pass 5 arguments, i.e.
volume.mount(flags, mount_op, cancellable, callback, user_data)

I was expecting the user_data parameter to be optional, as it is with
e.g. mybutton.connect('clicked', clicked_cb)

Similarly, I am forced to provide a user_data parameter in my callback
function to receive the value that was passed, otherwise python throws
an exception about the callback receiving the wrong number of
arguments.

Is this the intended behaviour, or is there a bug somewhere?

Thanks
Daniel


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]