Rhythmbox Development Reference Manual: RBRemovableMediaManager

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

## Functions

RBRemovableMediaManager * | rb_removable_media_manager_new ()
void | rb_removable_media_manager_scan ()

## Properties

gboolean | scanned | Read
RBShell * | shell | Read / Write / Construct Only

## Signals

RBSource* | create-source-device | Run Last
RBSource* | create-source-mount | Run Last
RBSource* | create-source-volume | Run Last
void | medium-added | Run Last

## Types and Values

struct | RBRemovableMediaManager
struct | RBRemovableMediaManagerClass

## Object Hierarchy

        GObject
        ╰── RBRemovableMediaManager

## Description

The removable media manager maintains the mapping between GIO GVolume and GMount objects and rhythmbox sources.

## Functions

### rb_removable_media_manager_new ()

    RBRemovableMediaManager *
    rb_removable_media_manager_new (RBShell *shell);

Creates the RBRemovableMediaManager instance.

#### Parameters

shell | the RBShell |

#### Returns

the RBRemovableMediaManager

### 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.

#### Parameters

manager | the RBRemovableMediaManager |

## Types and Values

### struct RBRemovableMediaManager

    struct RBRemovableMediaManager;

### struct RBRemovableMediaManagerClass

    struct RBRemovableMediaManagerClass {
    	GObjectClass parent_class;

    	/* signals */
    	void (*medium_added)		(RBRemovableMediaManager *mgr,
    					 RBSource *source);
    	RBSource * (*create_source_device) (RBRemovableMediaManager *mgr,
    					 GObject *device);		/* actually a GUdevDevice */
    	RBSource * (*create_source_mount) (RBRemovableMediaManager *mgr,
    					 GMount *mount,
    					 MPIDDevice *device_info);
    	RBSource * (*create_source_volume) (RBRemovableMediaManager *mgr,
    					 GVolume *volume);
    };

## Property Details

### The `“scanned”` property

      “scanned”                  gboolean

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.

Flags: Read

Default value: FALSE

### The `“shell”` property

      “shell”                    RBShell *

The RBShell instance.

Flags: Read / Write / Construct Only

## Signal Details

### The `“create-source-device”` signal

    RBSource*
    user_function (RBRemovableMediaManager *mgr,
                   GObject                 *device,
                   gpointer                 user_data)

Emitted when a new device is detected to allow plugins to create a corresponding RBSource. The first signal handler that returns a source wins. Plugins should only use this signal if there will be no GVolume or GMount created for the device.

#### Parameters

mgr | the RBRemovableMediaManager |
device | the device (actually a GUdevDevice) |
user_data | user data set when the signal handler was connected. |

#### Returns

a source for the device, or NULL.

[transfer full]

Flags: Run Last

### The `“create-source-mount”` signal

    RBSource*
    user_function (RBRemovableMediaManager *mgr,
                   GMount                  *device_info,
                   MPIDDevice              *mount,
                   gpointer                 user_data)

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.

#### Parameters

mgr | the RBRemovableMediaManager |
device_info | a MPIDDevice containing information on the device |
mount | the GMount |
user_data | user data set when the signal handler was connected. |

#### Returns

a source for the mount, or NULL.

[transfer full]

Flags: Run Last

### The `“create-source-volume”` signal

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

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.

#### Parameters

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

#### Returns

a source for the volume, or NULL.

[transfer full]

Flags: Run Last

### The `“medium-added”` signal

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

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

#### Parameters

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

Flags: Run Last