Next: , Previous: Basic Directory Operations, Up: Top


10 GnomeVFSVolume

Abstraction for a mounted file system or a network location.

10.1 Overview

10.2 Usage

— Class: <gnome-vfs-volume>

Derives from <gobject>.

This class defines no direct slots.

— Function: gnome-vfs-volume-compare (self <gnome-vfs-volume>) (<gnome-vfs-volume>) ⇒  (ret int)
— Method: compare

Compares two <gnome-vfs-volume> objects a and b. Two <gnome-vfs-volume> objects referring to different volumes are guaranteed to not return 0 when comparing them, if they refer to the same volume 0 is returned.

The resulting <gint> should be used to determine the order in which a and b are displayed in graphical user interfces.

The comparison algorithm first of all peeks the device type of a and b, they will be sorted in the following order:

Magnetic and opto-magnetic volumes (ZIP, floppy)

Optical volumes (CD, DVD)

External volumes (USB sticks, music players)

Mounted hard disks

Network mounts

Other volumes

Afterwards, the display name of a and b is compared using a locale-sensitive sorting algorithm, which involves g-utf8-collate-key.

If two volumes have the same display name, their unique ID is compared which can be queried using gnome-vfs-volume-get-id.

a
a <gnome-vfs-volume>.
b
a <gnome-vfs-volume>.
ret
0 if the volumes refer to the same gnome-vfs-volume, a negative value if a should be displayed before b, or a positive value if a should be displayed after b.

Since 2.6

— Function: gnome-vfs-volume-get-activation-uri (self <gnome-vfs-volume>) ⇒  (ret mchars)
— Method: get-activation-uri

Returns the activation URI of a <gnome-vfs-volume>.

The returned URI usually refers to a valid location. You can check the validity of the location by calling gnome-vfs-uri-new with the URI, and checking whether the return value is not ‘#f’.

volume
a <gnome-vfs-volume>.
ret
a newly allocated string for activation uri of volume.

Since 2.6

— Function: gnome-vfs-volume-get-device-path (self <gnome-vfs-volume>) ⇒  (ret mchars)
— Method: get-device-path

Returns the device path of a <gnome-vfs-volume>.

For HAL volumes, this returns the value of the volume's "block.device" key. For UNIX mounts, it returns the ‘mntent’'s ‘mnt_fsname’ entry.

Otherwise, it returns ‘#f’.

volume
a <gnome-vfs-volume>.
ret
a newly allocated string for device path of volume.

Since 2.6

— Function: gnome-vfs-volume-get-device-type (self <gnome-vfs-volume>) ⇒  (ret <gnome-vfs-device-type>)
— Method: get-device-type

Returns the <gnome-vfs-device-type> of the volume.

volume
a <gnome-vfs-volume>.
ret
the device type for volume.

Since 2.6

— Function: gnome-vfs-volume-get-display-name (self <gnome-vfs-volume>) ⇒  (ret mchars)
— Method: get-display-name

Returns the display name of the volume.

volume
a <gnome-vfs-volume>.
ret
a newly allocated string for display name of volume.

Since 2.6

— Function: gnome-vfs-volume-get-drive (self <gnome-vfs-volume>) ⇒  (ret <gnome-vfs-drive>)
— Method: get-drive
volume
a <gnome-vfs-volume>.
ret
the drive for the volume.

Since 2.6

— Function: gnome-vfs-volume-get-hal-udi (self <gnome-vfs-volume>) ⇒  (ret mchars)
— Method: get-hal-udi

Returns the HAL UDI of a <gnome-vfs-volume>.

For HAL volumes, this matches the value of the "info.udi" key, for other volumes it is ‘#f’.

volume
a <gnome-vfs-volume>.
ret
a newly allocated string for unique device id of volume, or ‘#f’.

Since 2.6

— Function: gnome-vfs-volume-get-icon (self <gnome-vfs-volume>) ⇒  (ret mchars)
— Method: get-icon
volume
a <gnome-vfs-volume>.
ret
a newly allocated string for the icon filename of volume.

Since 2.6

— Function: gnome-vfs-volume-get-id (self <gnome-vfs-volume>) ⇒  (ret unsigned-long)
— Method: get-id

Returns the ID of the volume,

Two <gnome-vfs-volumes> are guaranteed to refer to the same volume if they have the same ID.

volume
a <gnome-vfs-volume>.
ret
the id for the volume.

Since 2.6

— Function: gnome-vfs-volume-get-volume-type (self <gnome-vfs-volume>) ⇒  (ret <gnome-vfs-volume-type>)
— Method: get-volume-type

Returns the <gnome-vfs-volume-type> of the volume.

volume
a <gnome-vfs-volume>.
ret
the volume type for volume.

Since 2.6

— Function: gnome-vfs-volume-handles-trash (self <gnome-vfs-volume>) ⇒  (ret bool)
— Method: handles-trash

Returns whether the file system on a volume supports trashing of files.

If the volume has an AutoFS file system (i.e. gnome-vfs-volume-get-device-type returns <gnome-vfs-device-type-autofs>), or if the volume is mounted read-only (gnome-vfs-volume-is-read-only returns ‘#t’), it is assumed to not support trashing of files.

Otherwise, if the volume provides file system information, it is determined whether the file system supports trashing of files. See gnome-vfs-volume-get-filesystem-type for details which volumes provide file system information, and which file systems currently support a trash.

volume
a <gnome-vfs-volume>.
ret
#t’ if volume handles trash, ‘#f’ otherwise.

Since 2.6

— Function: gnome-vfs-volume-is-mounted (self <gnome-vfs-volume>) ⇒  (ret bool)
— Method: is-mounted

Returns whether the file system on a volume is currently mounted.

For HAL volumes, this reflects the value of the "volume.is_mounted" key, for traditional UNIX mounts and connected servers, ‘#t’ is returned, because their existence implies that they are mounted.

volume
a <gnome-vfs-volume>.
ret
#t’ if the volume is mounted, ‘#f’ otherwise.

Since 2.6

— Function: gnome-vfs-volume-is-read-only (self <gnome-vfs-volume>) ⇒  (ret bool)
— Method: is-read-only

Returns whether the file system on a volume is read-only.

For HAL volumes, the "volume.is_mounted_read_only" key is authoritative, for traditional UNIX mounts it returns ‘#t’ if the mount was done with the "ro" option. For servers, ‘#f’ is returned.

volume
a <gnome-vfs-volume>.
ret
#t’ if the volume is read-only to the user, ‘#f’ otherwise.

Since 2.6

— Function: gnome-vfs-volume-is-user-visible (self <gnome-vfs-volume>) ⇒  (ret bool)
— Method: is-user-visible

Returns whether the volume is visible to the user. This should be used by applications to determine whether it is included in user interfaces listing available volumes.

volume
a <gnome-vfs-volume>.
ret
#t’ if volume is visible to the user, ‘#f’ otherwise.

Since 2.6

— Function: gnome-vfs-connect-to-server (uri mchars) (display_name mchars) (icon mchars)

This function adds a server connection to the specified uri, which is displayed in user interfaces with the specified display-name and icon.

If this function is invoked successfully, the created server shows up in the list of mounted volumes of the <gnome-vfs-volume-monitor>, which can be queried using gnome-vfs-volume-monitor-get-mounted-volumes.

This function does not have a return value. Hence, you can't easily detect whether the specified server was successfully created. The actual creation and consumption of the new server through the <gnome-vfs-volume-monitor> is done asynchronously.

uri, display-name, and icon can be freely chosen, but should be meaningful:

uri should refer to a valid location. You can check the validity of the location by calling gnome-vfs-uri-new with uri, and checking whether the return value is not ‘#f’.

The display-name should be queried from the user, and an empty string should not be considered valid.

icon typically references an icon from the icon theme. Some implementations currently use ‘gnome-fs-smb’, ‘gnome-fs-ssh’, ‘gnome-fs-ftp’ and ‘gnome-fs-share’, depending on the type of the server referenced by uri. The icon naming conventions might change in the future, though. Obeying the freedesktop.org Icon Naming Specification is suggested.

uri
The string representation of the server to connect to.
display-name
The display name that is used to identify the server connection.
icon
The icon that is used to identify the server connection.

Since 2.6