Interface
RBTransferTarget
Description [src]
interface RB.TransferTarget : GObject.Object
Sources that can accept track transfers should implement this interface
and call the associated functions to perform transfers. The source
needs to be able to construct target URIs for transfers, and can optionally
perform its own processing after transfers have finished. The source
must also provide a GstEncodingTarget
that describes the formats it accepts.
Prerequisite
In order to implement TransferTarget, your type must inherit fromGObject
.
Instance methods
rb_transfer_target_build_dest_uri
Constructs a URI to use as the destination for a transfer or transcoding operation. The URI may be on the device itself, if the device is mounted into the normal filesystem or through gvfs, or it may be a temporary location used to store the file before uploading it to the device.
rb_transfer_target_check_category
This checks that the entry type of entry
is in a suitable
category for transfer. This can be used to implement
should_transfer
.
rb_transfer_target_check_duplicate
This checks for an existing entry in the target that matches
the title, album, artist, and track number of the entry being
considered. This can be used to implement should_transfer
.
rb_transfer_target_get_format_descriptions
Returns a GList
of allocated media format descriptions for
the formats supported by the target. The list and the strings
it holds must be freed by the caller.
rb_transfer_target_should_transfer
Checks whether entry
should be transferred to the target.
The target can check whether a matching entry already exists on the device,
for instance. rb_transfer_target_check_duplicate
may form part of
an implementation. If this method returns FALSE
, the entry
will be skipped.
rb_transfer_target_track_add_error
This is called when a transfer fails. If the source’s
impl_track_add_error implementation returns TRUE
, an error dialog
will be displayed to the user containing the error message, unless
the error indicates that the destination file already exists.
rb_transfer_target_track_added
This is called when a transfer to the target has completed.
If the source’s track_added
method returns TRUE
, the destination
URI will be added to the database using the entry type for the device.
rb_transfer_target_track_prepare
Performs any preparation necessary before starting the transfer. This is called on a task thread, so no UI interaction is possible.
rb_transfer_target_track_upload
This is called after a transfer to a temporary file has finished, allowing the transfer target to upload the file to a device or a remote service.
rb_transfer_target_transfer
Starts tranferring entries
to the target. This returns the
RBTrackTransferBatch
that it starts, so the caller can track
the progress of the transfer, or NULL if the target doesn’t
want any of the entries.
Interface structure
struct RBTransferTargetInterface {
GTypeInterface g_iface;
char* (* build_dest_uri) (
RBTransferTarget* target,
RhythmDBEntry* entry,
const char* media_type,
const char* extension
);
void (* track_prepare) (
RBTransferTarget* target,
RhythmDBEntry* entry,
const char* uri,
GError** error
);
void (* track_upload) (
RBTransferTarget* target,
RhythmDBEntry* entry,
const char* uri,
guint64 dest_size,
const char* media_type,
GError** error
);
gboolean (* track_added) (
RBTransferTarget* target,
RhythmDBEntry* entry,
const char* uri,
guint64 dest_size,
const char* media_type
);
gboolean (* track_add_error) (
RBTransferTarget* target,
RhythmDBEntry* entry,
const char* uri,
GError* error
);
gboolean (* should_transfer) (
RBTransferTarget* target,
RhythmDBEntry* entry
);
}
No description available.
Interface members
g_iface |
|
No description available. |
|
build_dest_uri |
|
No description available. |
|
track_prepare |
|
No description available. |
|
track_upload |
|
No description available. |
|
track_added |
|
No description available. |
|
track_add_error |
|
No description available. |
|
should_transfer |
|
No description available. |
Virtual methods
RB.TransferTarget.build_dest_uri
Constructs a URI to use as the destination for a transfer or transcoding operation. The URI may be on the device itself, if the device is mounted into the normal filesystem or through gvfs, or it may be a temporary location used to store the file before uploading it to the device.
RB.TransferTarget.should_transfer
Checks whether entry
should be transferred to the target.
The target can check whether a matching entry already exists on the device,
for instance. rb_transfer_target_check_duplicate
may form part of
an implementation. If this method returns FALSE
, the entry
will be skipped.
RB.TransferTarget.track_prepare
Performs any preparation necessary before starting the transfer. This is called on a task thread, so no UI interaction is possible.
RB.TransferTarget.track_upload
This is called after a transfer to a temporary file has finished, allowing the transfer target to upload the file to a device or a remote service.