## RBRemovableMediaManager

RBRemovableMediaManager — handling of removable media such as audio CDs and DAP devices

## Synopsis

                        RBRemovableMediaManager;
                        RBRemovableMediaManagerClass;
    RBRemovableMediaManager* rb_removable_media_manager_new (RBShell *shell);
    void                rb_removable_media_manager_scan     (RBRemovableMediaManager *manager);
    void                rb_removable_media_manager_queue_transfer
                                                            (RBRemovableMediaManager *mgr,
                                                             RhythmDBEntry *entry,
                                                             const char *dest,
                                                             GList *mime_types,
                                                             RBTransferCompleteCallback callback,
                                                             gpointer userdata);

## Object Hierarchy

      GObject
       +----RBRemovableMediaManager

## Properties

      "scanned"                  gboolean              : Read
      "shell"                    RBShell*              : Read / Write
      "source"                   RBSource*             : Read / Write

## Signals

      "create-source-mount"                            : Run Last
      "create-source-volume"                           : Run Last
      "medium-added"                                   : Run Last
      "transfer-progress"                              : Run Last

## Description

The removable media manager maintains the mapping between GIO GVolume and GMount objects and rhythmbox sources, and also performs track transfers between removable media sources and the library.

## Details

### RBRemovableMediaManager

    typedef struct _RBRemovableMediaManager RBRemovableMediaManager;

### RBRemovableMediaManagerClass

    typedef struct {
    	GObjectClass parent_class;

    	/* signals */
    	void	(*medium_added)		(RBRemovableMediaManager *mgr,
    					 RBSource *source);
    	void	(*transfer_progress)	(RBRemovableMediaManager *mgr,
    					 gint done,
    					 gint total,
    					 double fraction);
    	RBSource * (*create_source_mount) (RBRemovableMediaManager *mgr,
    					 GMount *mount);
    	RBSource * (*create_source_volume) (RBRemovableMediaManager *mgr,
    					 GVolume *volume);
    } RBRemovableMediaManagerClass;

### rb_removable_media_manager_new ()

    RBRemovableMediaManager* rb_removable_media_manager_new (RBShell *shell);

Creates the RBRemovableMediaManager instance.

`shell` : | the RBShell
Returns : |

### rb_removable_media_manager_scan ()

    void                rb_removable_media_manager_scan     (RBRemovableMediaManager *manager);

Initiates a new scan of all attached media. Newly activated plugins that use the create-source-volume or create-source-mount signals should call this if the 'scanned' property is `TRUE`. Otherwise, the first scan will catch any existing volumes or mounts that the plugin is interested in.

`manager` : | the RBRemovableMediaManager

### rb_removable_media_manager_queue_transfer ()

    void                rb_removable_media_manager_queue_transfer
                                                            (RBRemovableMediaManager *mgr,
                                                             RhythmDBEntry *entry,
                                                             const char *dest,
                                                             GList *mime_types,
                                                             RBTransferCompleteCallback callback,
                                                             gpointer userdata);

Initiates a track transfer. This will transfer the track identified by the RhythmDBEntry to the given destination, transcoding it if its current media type is not in the list of acceptable output types.

`mgr` : |
`entry` : | the RhythmDBEntry to transfer
`dest` : | the destination URI
`mime_types` : | a list of acceptable output MIME types
`callback` : | function to call when the transfer is complete
`userdata` : | data to pass to the callback

## Property Details

### The `"scanned"` property

      "scanned"                  gboolean              : Read

This is set to TRUE when the removable media manager has scanned all existing volumes and mounts. When a plugin that handles removable media is activated, it should request a new scan if this property is already set to TRUE.

Default value: FALSE

### The `"shell"` property

      "shell"                    RBShell*              : Read / Write

The RBShell instance.

### The `"source"` property

      "source"                   RBSource*             : Read / Write

The current selected source.

## Signal Details

### The `"create-source-mount"` signal

    RBSource*           user_function                      (RBRemovableMediaManager *mgr,
                                                            GMount                  *mount,
                                                            gpointer                 user_data)      : Run Last

Emitted when a new mount is added to allow plugins to create a corresponding RBSource. The first signal handler that returns a source wins. If a source was created for the GVolume for a mount, then this signal will not be emitted.

`mgr` : | the RBRemovableMediaManager
`mount` : | the GMount
`user_data` : | user data set when the signal handler was connected.

### The `"create-source-volume"` signal

    RBSource*           user_function                      (RBRemovableMediaManager *mgr,
                                                            GVolume                 *volume,
                                                            gpointer                 user_data)      : Run Last

Emitted when a new volume is added to allow plugins to create a corresponding RBSource. The first signal handler that returns a source wins. A plugin should only use this signal if it doesn't require the volume to be mounted. If the volume must be mounted to be useful, use the create-source-mount signal instead.

`mgr` : | the RBRemovableMediaManager
`volume` : | the GVolume
`user_data` : | user data set when the signal handler was connected.

### The `"medium-added"` signal

    void                user_function                      (RBRemovableMediaManager *mgr,
                                                            GObject                 *source,
                                                            gpointer                 user_data)      : Run Last

Emitted when a new source is added for a removable medium.

`mgr` : | the RBRemovableMediaManager
`source` : | the newly added RBSource
`user_data` : | user data set when the signal handler was connected.

### The `"transfer-progress"` signal

    void                user_function                      (RBRemovableMediaManager *mgr,
                                                            gint                     done,
                                                            gint                     total,
                                                            gdouble                  progress,
                                                            gpointer                 user_data)      : Run Last

Emitted throughout the track transfer process to allow UI elements showing transfer progress to be updated.

`mgr` : | the RBRemovableMediaManager
`done` : | number of tracks that have been fully transferred
`total` : | total number of tracks to transfer
`progress` : | fraction of the current track that has been transferred
`user_data` : | user data set when the signal handler was connected.