RBDeviceSource

## RBDeviceSource RBDeviceSource — interface for sources based on physical devices |

## Synopsis

    #include <rb-device-source.h>

    struct              RBDeviceSourceInterface;
    gboolean            rb_device_source_can_eject          (RBDeviceSource *source);
    void                rb_device_source_eject              (RBDeviceSource *source);
    guint               rb_device_source_want_uri           (RBSource *source,
                                                             const char *uri);
    gboolean            rb_device_source_uri_is_source      (RBSource *source,
                                                             const char *uri);
    void                rb_device_source_set_display_details
                                                            (RBDeviceSource *source);

## Description

Sources that represent physical devices should implement this interface. It exposes the ability to eject the device, and also can be used to implement some RBSource methods by using details from a GVolume or GMount accessed via 'volume' and 'mount' properties on the source object. Devices that are not based on a GVolume or GMount can still use the interface, but they must provide implementations of the `can_eject` and `eject` methods.

## Details

### struct RBDeviceSourceInterface

    struct RBDeviceSourceInterface {
    	GTypeInterface g_iface;

    	gboolean (*can_eject)		(RBDeviceSource *source);
    	void		(*eject)		(RBDeviceSource *source);
    };

### rb_device_source_can_eject ()

    gboolean            rb_device_source_can_eject          (RBDeviceSource *source);

### rb_device_source_eject ()

    void                rb_device_source_eject              (RBDeviceSource *source);

Ejects the device that the source represents.

`source` : | a RBDeviceSource

### rb_device_source_want_uri ()

    guint               rb_device_source_want_uri           (RBSource *source,
                                                             const char *uri);

Checks whether `uri` identifies a path underneath the device's mount point. Should be used to implement the RBSource impl_want_uri method.

`source` : | a RBDeviceSource
`uri` : | a URI to consider
Returns : | URI match strength

### rb_device_source_uri_is_source ()

    gboolean            rb_device_source_uri_is_source      (RBSource *source,
                                                             const char *uri);

Returns `TRUE` if `uri` matches `source`. This should be used to implement the impl_uri_is_source RBSource method.

`source` : | a RBDeviceSource
`uri` : | a URI to check
Returns : | `TRUE` if `uri` matches `source`

### rb_device_source_set_display_details ()

    void                rb_device_source_set_display_details
                                                            (RBDeviceSource *source);

Sets the icon and display name for a device-based source. The details come from the mount and/or volume. This should be called in the source's constructed method.

`source` : | a RBDeviceSource