RBTrackTransferBatch: Rhythmbox Development Reference Manual

## RBTrackTransferBatch RBTrackTransferBatch — batch track transfer job |

## Functions

RBTrackTransferBatch * | rb_track_transfer_batch_new ()
void | rb_track_transfer_batch_add ()
void | rb_track_transfer_batch_cancel ()

## Properties

RBSource * | destination | Read / Write / Construct Only
gint | done-entries | Read
GstEncodingTarget * | encoding-target | Read / Write / Construct
gpointer | entry-list | Read
gdouble | progress | Read
RBTrackTransferQueue * | queue | Read / Write / Construct Only
GSettings * | settings | Read / Write / Construct Only
RBSource * | source | Read / Write / Construct Only
gint | total-entries | Read

## Signals

void | cancelled | Run Last
void | complete | Run Last
gchar* | get-dest-uri | Run Last
void | overwrite-prompt | Run Last
void | started | Run Last
void | track-done | Run Last
void | track-progress | Run Last
void | track-started | Run Last

## Types and Values

struct | RBTrackTransferBatch
struct | RBTrackTransferBatchClass

## Object Hierarchy

        GObject
        ╰── RBTrackTransferBatch

## Implemented Interfaces

RBTrackTransferBatch implements RBTaskProgress.

## Description

Manages the transfer of a set of tracks (using RBEncoder), providing overall status information and allowing the transfer to be cancelled as a single unit.

## Functions

### rb_track_transfer_batch_new ()

    RBTrackTransferBatch *
    rb_track_transfer_batch_new (GstEncodingTarget *target,
                                 GSettings *settings,
                                 GObject *source,
                                 GObject *destination,
                                 GObject *queue);

Creates a new transfer batch with the specified encoding target. If no target is specified, the default target will be used with the user's preferred encoding type.

One or more entries must be added to the batch (using rb_track_transfer_batch_add) before the batch can be started (rb_track_transfer_manager_start_batch).

#### Parameters

target | a GstEncodingTarget describing allowable encodings (or NULL for defaults) |
source | the RBSource from which the entries are to be transferred |
destination | the RBSource to which the entries are to be transferred |
queue | the RBTrackTransferQueue instance |

#### Returns

new RBTrackTransferBatch object

### rb_track_transfer_batch_add ()

    void
    rb_track_transfer_batch_add (RBTrackTransferBatch *batch,
                                 RhythmDBEntry *entry);

Adds an entry to be transferred.

#### Parameters

batch | a RBTrackTransferBatch |
entry | the source RhythmDBEntry to transfer |

### rb_track_transfer_batch_cancel ()

    void
    rb_track_transfer_batch_cancel (RBTrackTransferBatch *batch);

Cancels the batch.

#### Parameters

batch | a RBTrackTransferBatch |

## Types and Values

### struct RBTrackTransferBatch

    struct RBTrackTransferBatch;

### struct RBTrackTransferBatchClass

    struct RBTrackTransferBatchClass {
    	GObjectClass parent_class;

    	/* signals */
    	void (*started)		(RBTrackTransferBatch *batch);
    	void (*cancelled)		(RBTrackTransferBatch *batch);
    	void (*complete)		(RBTrackTransferBatch *batch);

    	char *  (*get_dest_uri)		(RBTrackTransferBatch *batch,
    					 RhythmDBEntry *entry,
    					 const char *mediatype,
    					 const char *extension);
    	gboolean (*overwrite_prompt) (RBTrackTransferBatch *batch,
    					 GFile *dest_file);
    	void (*track_started) (RBTrackTransferBatch *batch,
    					 RhythmDBEntry *entry,
    					 const char *dest);
    	void (*track_progress) (RBTrackTransferBatch *batch,
    					 RhythmDBEntry *entry,
    					 const char *dest,
    					 int done,
    					 int total,
    					 double fraction);
    	void (*track_done)		(RBTrackTransferBatch *batch,
    					 RhythmDBEntry *entry,
    					 const char *dest,
    					 guint64 dest_size,
    					 const char *mediatype,
    					 GError *error);
    };

## Property Details

### The `“destination”` property

      “destination”              RBSource *

The RBSource to which the tracks are being transferred.

Owner: RBTrackTransferBatch

Flags: Read / Write / Construct Only

### The `“done-entries”` property

      “done-entries”             gint

Number of entries in the batch that have been transferred.

Owner: RBTrackTransferBatch

Flags: Read

Allowed values: >= 0

Default value: 0

### The `“encoding-target”` property

      “encoding-target”          GstEncodingTarget *

A GstEncodingTarget describing allowable target formats. If NULL, the default set of profiles will be used.

Owner: RBTrackTransferBatch

Flags: Read / Write / Construct

### The `“entry-list”` property

      “entry-list”               gpointer

A list of all entries in the batch.

Owner: RBTrackTransferBatch

Flags: Read

### The `“progress”` property

      “progress”                 gdouble

Fraction of the transfer batch that has been processed.

Owner: RBTrackTransferBatch

Flags: Read

Allowed values: [0,1]

Default value: 0

### The `“queue”` property

      “queue”                    RBTrackTransferQueue *

The RBTrackTransferQueue instance

Owner: RBTrackTransferBatch

Flags: Read / Write / Construct Only

### The `“settings”` property

      “settings”                 GSettings *

GSettings instance holding profile preferences

Owner: RBTrackTransferBatch

Flags: Read / Write / Construct Only

### The `“source”` property

      “source”                   RBSource *

The RBSource from which the tracks are being transferred.

Owner: RBTrackTransferBatch

Flags: Read / Write / Construct Only

### The `“total-entries”` property

      “total-entries”            gint

Total number of entries in the transfer batch.

Owner: RBTrackTransferBatch

Flags: Read

Allowed values: >= 0

Default value: 0

## Signal Details

### The `“cancelled”` signal

    void
    user_function (RBTrackTransferBatch *batch,
                   gpointer              user_data)

Emitted when the batch is cancelled.

hmm. will 'complete' still be emitted in this case?

#### Parameters

batch | the RBTrackTransferBatch |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“complete”` signal

    void
    user_function (RBTrackTransferBatch *batch,
                   gpointer              user_data)

Emitted when the batch is complete. This will be immediately after the final entry transfer is complete.

#### Parameters

batch | the RBTrackTransferBatch |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“get-dest-uri”` signal

    gchar*
    user_function (RBTrackTransferBatch *batch,
                   RhythmDBEntry        *entry,
                   gchar                *mediatype,
                   gchar                *extension,
                   gpointer              user_data)

The batch emits this to allow the creator to provide a destination URI for an entry being transferred. This is emitted after the output media type is decided, so the usual extension for the media type can be taken into consideration.

#### Parameters

batch | the RBTrackTransferBatch |
entry | the RhythmDBEntry to be transferred |
mediatype | the destination media type for the transfer |
extension | usual extension for the destionation media type |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“overwrite-prompt”` signal

    void
    user_function (RBTrackTransferBatch *batch,
                   gchar                *uri,
                   gpointer              user_data)

Emitted when the destination URI for a transfer already exists. The handler must call _rb_track_transfer_batch_continue or _rb_track_transfer_batch_cancel when it has figured out what to do.

#### Parameters

batch | the RBTrackTransferBatch |
uri | the destination URI that already exists |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“started”` signal

    void
    user_function (RBTrackTransferBatch *batch,
                   gpointer              user_data)

Emitted when the batch is started. This will be after all previous batches have finished, which is not necessarily when rb_track_transfer_manager_start_batch is called.

#### Parameters

batch | the RBTrackTransferBatch |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“track-done”` signal

    void
    user_function (RBTrackTransferBatch *batch,
                   RhythmDBEntry        *entry,
                   gchar                *dest,
                   guint64               dest_size,
                   gchar                *dest_mediatype,
                   gpointer              error,
                   gpointer              user_data)

Emitted when a track transfer is complete, whether because the track was fully transferred, because an error occurred, or because the batch was cancelled (maybe..).

#### Parameters

batch | the RBTrackTransferBatch |
entry | the RhythmDBEntry that was transferred |
dest | the destination URI for the transfer |
dest_size | size of the destination file |
dest_mediatype | the media type of the destination file |
error | any error that occurred during transfer |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“track-progress”` signal

    void
    user_function (RBTrackTransferBatch *batch,
                   RhythmDBEntry        *entry,
                   gchar                *dest,
                   gint                  done,
                   gint                  total,
                   gdouble               fraction,
                   gpointer              user_data)

Emitted regularly throughout the transfer to allow progress bars and other UI elements to be updated.

#### Parameters

batch | the RBTrackTransferBatch |
entry | the RhythmDBEntry being transferred |
dest | the destination URI for the transfer |
done | some measure of how much of the transfer is done |
total | the total amount of that same measure |
fraction | the fraction of the transfer that is done |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“track-started”` signal

    void
    user_function (RBTrackTransferBatch *batch,
                   RhythmDBEntry        *entry,
                   gchar                *dest,
                   gpointer              user_data)

Emitted when a new entry is about to be transferred. This will be emitted for each entry in the batch, unless the batch is cancelled.

#### Parameters

batch | the RBTrackTransferBatch |
entry | the RhythmDBEntry being transferred |
dest | the destination URI for the transfer |
user_data | user data set when the signal handler was connected. |

Flags: Run Last