## ThunarVfsVolume

ThunarVfsVolume

## Synopsis

    #include <thunar-vfs/thunar-vfs.h>

    enum                ThunarVfsVolumeKind;
    enum                ThunarVfsVolumeStatus;
                        ThunarVfsVolume;
    ThunarVfsVolumeKind thunar_vfs_volume_get_kind          (ThunarVfsVolume *volume);
    const gchar*        thunar_vfs_volume_get_name          (ThunarVfsVolume *volume);
    ThunarVfsVolumeStatus thunar_vfs_volume_get_status      (ThunarVfsVolume *volume);
    ThunarVfsPath*      thunar_vfs_volume_get_mount_point   (ThunarVfsVolume *volume);
    gboolean            thunar_vfs_volume_is_mounted        (ThunarVfsVolume *volume);
    gboolean            thunar_vfs_volume_is_present        (ThunarVfsVolume *volume);
    gboolean            thunar_vfs_volume_is_ejectable      (ThunarVfsVolume *volume);
    gboolean            thunar_vfs_volume_is_removable      (ThunarVfsVolume *volume);
    const gchar*        thunar_vfs_volume_lookup_icon_name  (ThunarVfsVolume *volume,
                                                             GtkIconTheme *icon_theme);
    gboolean            thunar_vfs_volume_eject             (ThunarVfsVolume *volume,
                                                             GtkWidget *window,
                                                             GError **error);
    gboolean            thunar_vfs_volume_mount             (ThunarVfsVolume *volume,
                                                             GtkWidget *window,
                                                             GError **error);
    gboolean            thunar_vfs_volume_unmount           (ThunarVfsVolume *volume,
                                                             GtkWidget *window,
                                                             GError **error);

## Object Hierarchy

      GObject
       +----ThunarVfsVolume

## Signals

      "changed"                                        : Run Last
      "mounted"                                        : Run Last
      "pre-unmount"                                    : Run Last
      "unmounted"                                      : Run Last

## Description

## Details

### enum ThunarVfsVolumeKind

    typedef enum
    {
      THUNAR_VFS_VOLUME_KIND_UNKNOWN,
      THUNAR_VFS_VOLUME_KIND_CDROM,
      THUNAR_VFS_VOLUME_KIND_CDR,
      THUNAR_VFS_VOLUME_KIND_CDRW,
      THUNAR_VFS_VOLUME_KIND_DVDROM,
      THUNAR_VFS_VOLUME_KIND_DVDRAM,
      THUNAR_VFS_VOLUME_KIND_DVDR,
      THUNAR_VFS_VOLUME_KIND_DVDRW,
      THUNAR_VFS_VOLUME_KIND_DVDPLUSR,
      THUNAR_VFS_VOLUME_KIND_DVDPLUSRW,
      THUNAR_VFS_VOLUME_KIND_FLOPPY,
      THUNAR_VFS_VOLUME_KIND_HARDDISK,
      THUNAR_VFS_VOLUME_KIND_USBSTICK,
      THUNAR_VFS_VOLUME_KIND_AUDIO_PLAYER,
      THUNAR_VFS_VOLUME_KIND_AUDIO_CD,
      THUNAR_VFS_VOLUME_KIND_MEMORY_CARD,
      THUNAR_VFS_VOLUME_KIND_REMOVABLE_DISK,
    } ThunarVfsVolumeKind;

Describes the type of a VFS volume.

`THUNAR_VFS_VOLUME_KIND_UNKNOWN` | Unknown volume.
`THUNAR_VFS_VOLUME_KIND_CDROM` | CD-ROMs.
`THUNAR_VFS_VOLUME_KIND_CDR` | CD-Rs.
`THUNAR_VFS_VOLUME_KIND_CDRW` | CD-RWs.
`THUNAR_VFS_VOLUME_KIND_DVDROM` | DVD-ROMs.
`THUNAR_VFS_VOLUME_KIND_DVDRAM` | DVD-RAMs.
`THUNAR_VFS_VOLUME_KIND_DVDR` | DVD-Rs.
`THUNAR_VFS_VOLUME_KIND_DVDRW` | DVD-RWs.
`THUNAR_VFS_VOLUME_KIND_DVDPLUSR` | DVD+Rs.
`THUNAR_VFS_VOLUME_KIND_DVDPLUSRW` | DVD+RWs.
`THUNAR_VFS_VOLUME_KIND_FLOPPY` | Floppy drives.
`THUNAR_VFS_VOLUME_KIND_HARDDISK` | Hard disk drives.
`THUNAR_VFS_VOLUME_KIND_USBSTICK` | USB sticks.
`THUNAR_VFS_VOLUME_KIND_AUDIO_PLAYER` | Portable audio players (i.e. iPod).
`THUNAR_VFS_VOLUME_KIND_AUDIO_CD` | Audio CDs.
`THUNAR_VFS_VOLUME_KIND_MEMORY_CARD` | Memory cards.
`THUNAR_VFS_VOLUME_KIND_REMOVABLE_DISK` | Other removable disks.

### enum ThunarVfsVolumeStatus

    typedef enum /*< flags >*/
    {
      THUNAR_VFS_VOLUME_STATUS_MOUNTED   = 1 << 0,
      THUNAR_VFS_VOLUME_STATUS_PRESENT   = 1 << 1,
      THUNAR_VFS_VOLUME_STATUS_MOUNTABLE = 1 << 2,
    } ThunarVfsVolumeStatus;

Describes the current status of a VFS volume.

### ThunarVfsVolume

    typedef struct _ThunarVfsVolume ThunarVfsVolume;

### thunar_vfs_volume_get_kind ()

    ThunarVfsVolumeKind thunar_vfs_volume_get_kind          (ThunarVfsVolume *volume);

Returns the kind of drive/device representd by `volume`.

`volume` : | a ThunarVfsVolume instance.
Returns : | the kind of `volume`.

### thunar_vfs_volume_get_name ()

    const gchar*        thunar_vfs_volume_get_name          (ThunarVfsVolume *volume);

Returns the name of the `volume`. This is usually the name of the device or the label of the medium, if a medium is present.

`volume` : | a ThunarVfsVolume instance.
Returns : | the name of `volume`.

### thunar_vfs_volume_get_status ()

    ThunarVfsVolumeStatus thunar_vfs_volume_get_status      (ThunarVfsVolume *volume);

Determines the current status of the `volume`, e.g. whether or not the `volume` is currently mounted, or whether a medium is present.

`volume` : | a ThunarVfsVolume instance.
Returns : | the status for `volume`.

### thunar_vfs_volume_get_mount_point ()

    ThunarVfsPath*      thunar_vfs_volume_get_mount_point   (ThunarVfsVolume *volume);

Determines the current mount point for `volume`. If `volume` is mounted this will be the location at which it is currently mounted. Else it will be the location where `volume` is most probably being mounted. Note that this location may change during a call to `thunar_vfs_volume_mount()`, so be sure to check the mount point after the call to `thunar_vfs_volume_mount()`.

`volume` : | a ThunarVfsVolume instance.
Returns : | the path which identifies the path where the volume will be mounted (or is already mounted).

### thunar_vfs_volume_is_mounted ()

    gboolean            thunar_vfs_volume_is_mounted        (ThunarVfsVolume *volume);

Determines whether `volume` is currently mounted into the filesystem hierarchy.

`volume` : | a ThunarVfsVolume instance.
Returns : | `TRUE` if `volume` is mounted, else `FALSE`.

### thunar_vfs_volume_is_present ()

    gboolean            thunar_vfs_volume_is_present        (ThunarVfsVolume *volume);

Determines whether a medium is currently inserted for `volume`, e.g. for a CD-ROM drive, this will be `TRUE` only if a disc is present in the slot.

`volume` : | a ThunarVfsVolume instance.
Returns : | `TRUE` if `volume` is present, else `FALSE`.

### thunar_vfs_volume_is_ejectable ()

    gboolean            thunar_vfs_volume_is_ejectable      (ThunarVfsVolume *volume);

Determines whether the current user is allowed to eject the medium for `volume`. This method should return `TRUE` only if a medium is present and the `volume` is removable. Still, there's no warranty that a call to `thunar_vfs_volume_eject()` will succeed.

`volume` : | a ThunarVfsVolume instance.
Returns : | whether the medium for `volume` can be ejected.

### thunar_vfs_volume_is_removable ()

    gboolean            thunar_vfs_volume_is_removable      (ThunarVfsVolume *volume);

Determines whether `volume` is a removable device, for example a CD-ROM, an USB stick or a floppy drive.

`volume` : | a ThunarVfsVolume instance.
Returns : | `TRUE` if `volume` is a removable device, else `FALSE`.

### thunar_vfs_volume_lookup_icon_name ()

    const gchar*        thunar_vfs_volume_lookup_icon_name  (ThunarVfsVolume *volume,
                                                             GtkIconTheme *icon_theme);

Tries to find a suitable icon for `volume` in the given `icon_theme` and returns its name. If no suitable icon is found in `icon_theme`, then a fallback icon name will be returned. This way you can always count on this method to return a valid string.

`volume` : | a ThunarVfsVolume instance.
`icon_theme` : | a GtkIconTheme instance.
Returns : | the icon name.

### thunar_vfs_volume_eject ()

    gboolean            thunar_vfs_volume_eject             (ThunarVfsVolume *volume,
                                                             GtkWidget *window,
                                                             GError **error);

Tries to eject the medium present for `volume` (or atleast to unmount the `volume`).

If ejecting `volume` requires some complex user interaction (basicly everything else than displaying an error dialog), it should popup a modal dialog on `window` (or on the default GdkScreen if `window` is `NULL`). But be aware, that if an implementation of ThunarVfsVolume performs user interaction during a call to this method, it must implement this method in a reentrant fashion!

`volume` : | a ThunarVfsVolume instance.
`window` : | a GtkWindow or `NULL`.
`error` : | return location for errors or `NULL`.
Returns : | `TRUE` if the medium for `volume` was successfully ejected (or atleast the `volume` was unmounted successfully), else `FALSE`.

### thunar_vfs_volume_mount ()

    gboolean            thunar_vfs_volume_mount             (ThunarVfsVolume *volume,
                                                             GtkWidget *window,
                                                             GError **error);

Tries to mount `volume`. Will return `TRUE` if either `volume` was already mounted previously to this method invokation or `volume` was successfully mounted now.

If mounting `volume` requires some complex user interaction (basicly everything else than displaying an error dialog), it should popup a modal dialog on `window` (or on the default GdkScreen if `window` is `NULL`). But be aware, that if an implementation of ThunarVfsVolume performs user interaction during a call to this method, it must implement this method in a reentrant fashion!

`volume` : | a ThunarVfsVolume instance.
`window` : | a GtkWindow or `NULL`.
`error` : | return location for errors or `NULL`.
Returns : | `TRUE` if the medium for `volume` was successfully mounted or was already mounted previously, else `FALSE`.

### thunar_vfs_volume_unmount ()

    gboolean            thunar_vfs_volume_unmount           (ThunarVfsVolume *volume,
                                                             GtkWidget *window,
                                                             GError **error);

Tries to unmount `volume`. Will return `TRUE` if either `volume` was already unmounted previously to this method invokation or `volume` was successfully unmounted now.

If unmounting `volume` requires some complex user interaction (basicly everything else than displaying an error dialog), it should popup a modal dialog on `window` (or on the default GdkScreen if `window` is `NULL`). But be aware, that if an implementation of ThunarVfsVolume performs user interaction during a call to this method, it must implement this method in a reentrant fashion!

`volume` : | a ThunarVfsVolume instance.
`window` : | a GtkWindow or `NULL`.
`error` : | return location for errors or `NULL`.
Returns : | `TRUE` if the medium for `volume` was successfully unmounted or wasn't mounted previously, else `FALSE`.

## Signal Details

### The `"changed"` signal

    void                user_function                      (ThunarVfsVolume *volume,
                                                            gpointer         user_data)      : Run Last

Emitted whenever the state of `volume` changed.

`volume` : | the ThunarVfsVolume instance.
`user_data` : | user data set when the signal handler was connected.

### The `"mounted"` signal

    void                user_function                      (ThunarVfsVolume *volume,
                                                            gpointer         user_data)      : Run Last

Emitted by `volume` after a successfull mount operation.

`volume` : | the ThunarVfsVolume instance.
`user_data` : | user data set when the signal handler was connected.

### The `"pre-unmount"` signal

    void                user_function                      (ThunarVfsVolume *volume,
                                                            gpointer         user_data)      : Run Last

Emitted by `volume` right before an attempt is made to unmount the `volume`.

`volume` : | the ThunarVfsVolume instance.
`user_data` : | user data set when the signal handler was connected.

### The `"unmounted"` signal

    void                user_function                      (ThunarVfsVolume *volume,
                                                            gpointer         user_data)      : Run Last

Emitted by `volume` right after the `volume` was successfully unmounted.

`volume` : | the ThunarVfsVolume instance.
`user_data` : | user data set when the signal handler was connected.