Functions

desktop_app_info_lookup_get_default_for_uri_scheme (lookup, uri_scheme)

file_descriptor_based_get_fd (fd_based)

is_mount_path_system_internal (mount_path)

is_system_device_path (device_path)

is_system_fs_type (fs_type)

mount_at (mount_path)

mount_compare (mount1, mount2)

mount_copy (mount_entry)

mount_for (file_path)

mount_free (mount_entry)

mount_get_device_path (mount_entry)

mount_get_fs_type (mount_entry)

mount_get_mount_path (mount_entry)

mount_get_options (mount_entry)

mount_get_root_path (mount_entry)

mount_guess_can_eject (mount_entry)

mount_guess_icon (mount_entry)

mount_guess_name (mount_entry)

mount_guess_should_display (mount_entry)

mount_guess_symbolic_icon (mount_entry)

mount_is_readonly (mount_entry)

mount_is_system_internal (mount_entry)

mount_point_at (mount_path)

mount_point_compare (mount1, mount2)

mount_point_copy (mount_point)

mount_point_free (mount_point)

mount_point_get_device_path (mount_point)

mount_point_get_fs_type (mount_point)

mount_point_get_mount_path (mount_point)

mount_point_get_options (mount_point)

mount_point_guess_can_eject (mount_point)

mount_point_guess_icon (mount_point)

mount_point_guess_name (mount_point)

mount_point_guess_symbolic_icon (mount_point)

mount_point_is_loopback (mount_point)

mount_point_is_readonly (mount_point)

mount_point_is_user_mountable (mount_point)

mount_points_changed_since (time)

mount_points_get ()

mounts_changed_since (time)

mounts_get ()

Details

GioUnix.desktop_app_info_lookup_get_default_for_uri_scheme(lookup, uri_scheme)
Parameters:
Returns:

Gio.AppInfo for given uri_scheme or None on error.

Return type:

Gio.AppInfo or None

Gets the default application for launching applications using this URI scheme for a particular GioUnix.DesktopAppInfoLookup implementation.

The GioUnix.DesktopAppInfoLookup interface and this function is used to implement Gio.AppInfo.get_default_for_uri_scheme() backends in a GIO module. There is no reason for applications to use it directly. Applications should use Gio.AppInfo.get_default_for_uri_scheme().

Deprecated since version 2.28: The GioUnix.DesktopAppInfoLookup interface is deprecated and unused by GIO.

GioUnix.file_descriptor_based_get_fd(fd_based)
Parameters:

fd_based (Gio.FileDescriptorBased) – a GioUnix.FileDescriptorBased.

Returns:

The file descriptor

Return type:

int

Gets the underlying file descriptor.

New in version 2.24.

GioUnix.is_mount_path_system_internal(mount_path)
Parameters:

mount_path (str) – a mount path, e.g. /media/disk or /usr

Returns:

True if mount_path is considered an implementation detail of the OS.

Return type:

bool

Determines if mount_path is considered an implementation of the OS. This is primarily used for hiding mountable and mounted volumes that only are used in the OS and has little to no relevance to the casual user.

GioUnix.is_system_device_path(device_path)
Parameters:

device_path (str) – a device path, e.g. /dev/loop0 or nfsd

Returns:

True if device_path is considered an implementation detail of the OS.

Return type:

bool

Determines if device_path is considered a block device path which is only used in implementation of the OS. This is primarily used for hiding mounted volumes that are intended as APIs for programs to read, and system administrators at a shell; rather than something that should, for example, appear in a GUI. For example, the Linux /proc filesystem.

The list of device paths considered ‘system’ ones may change over time.

New in version 2.56.

GioUnix.is_system_fs_type(fs_type)
Parameters:

fs_type (str) – a file system type, e.g. procfs or tmpfs

Returns:

True if fs_type is considered an implementation detail of the OS.

Return type:

bool

Determines if fs_type is considered a type of file system which is only used in implementation of the OS. This is primarily used for hiding mounted volumes that are intended as APIs for programs to read, and system administrators at a shell; rather than something that should, for example, appear in a GUI. For example, the Linux /proc filesystem.

The list of file system types considered ‘system’ ones may change over time.

New in version 2.56.

GioUnix.mount_at(mount_path)
Parameters:

mount_path (str) – path for a possible unix mount.

Returns:

a GioUnix.MountEntry.

time_read:

guint64 to contain a timestamp.

Return type:

(Gio.UnixMountEntry or None, time_read: int)

Gets a GioUnix.MountEntry for a given mount path. If time_read is set, it will be filled with a unix timestamp for checking if the mounts have changed since with GioUnix.mounts_changed_since().

If more mounts have the same mount path, the last matching mount is returned.

This will return None if there is no mount point at mount_path.

GioUnix.mount_compare(mount1, mount2)
Parameters:
Returns:

1, 0 or -1 if mount1 is greater than, equal to, or less than mount2, respectively.

Return type:

int

Compares two unix mounts.

GioUnix.mount_copy(mount_entry)
Parameters:

mount_entry (Gio.UnixMountEntry) – a GioUnix.MountEntry.

Returns:

a new GioUnix.MountEntry

Return type:

Gio.UnixMountEntry

Makes a copy of mount_entry.

New in version 2.54.

GioUnix.mount_for(file_path)
Parameters:

file_path (str) – file path on some unix mount.

Returns:

a GioUnix.MountEntry.

time_read:

guint64 to contain a timestamp.

Return type:

(Gio.UnixMountEntry or None, time_read: int)

Gets a GioUnix.MountEntry for a given file path. If time_read is set, it will be filled with a unix timestamp for checking if the mounts have changed since with GioUnix.mounts_changed_since().

If more mounts have the same mount path, the last matching mount is returned.

This will return None if looking up the mount entry fails, if file_path doesn’t exist or there is an I/O error.

New in version 2.52.

GioUnix.mount_free(mount_entry)
Parameters:

mount_entry (Gio.UnixMountEntry) – a GioUnix.MountEntry.

Frees a unix mount.

GioUnix.mount_get_device_path(mount_entry)
Parameters:

mount_entry (Gio.UnixMountEntry) – a #GUnixMount.

Returns:

a string containing the device path.

Return type:

str

Gets the device path for a unix mount.

GioUnix.mount_get_fs_type(mount_entry)
Parameters:

mount_entry (Gio.UnixMountEntry) – a #GUnixMount.

Returns:

a string containing the file system type.

Return type:

str

Gets the filesystem type for the unix mount.

GioUnix.mount_get_mount_path(mount_entry)
Parameters:

mount_entry (Gio.UnixMountEntry) – input GioUnix.MountEntry to get the mount path for.

Returns:

the mount path for mount_entry.

Return type:

str

Gets the mount path for a unix mount.

GioUnix.mount_get_options(mount_entry)
Parameters:

mount_entry (Gio.UnixMountEntry) – a GioUnix.MountEntry.

Returns:

a string containing the options, or None if not available.

Return type:

str or None

Gets a comma-separated list of mount options for the unix mount. For example, rw,relatime,seclabel,data=ordered.

This is similar to GioUnix.MountPoint.get_options(), but it takes a GioUnix.MountEntry as an argument.

New in version 2.58.

GioUnix.mount_get_root_path(mount_entry)
Parameters:

mount_entry (Gio.UnixMountEntry) – a GioUnix.MountEntry.

Returns:

a string containing the root, or None if not supported.

Return type:

str or None

Gets the root of the mount within the filesystem. This is useful e.g. for mounts created by bind operation, or btrfs subvolumes.

For example, the root path is equal to “/” for mount created by “mount /dev/sda1 /mnt/foo” and “/bar” for “mount –bind /mnt/foo/bar /mnt/bar”.

New in version 2.60.

GioUnix.mount_guess_can_eject(mount_entry)
Parameters:

mount_entry (Gio.UnixMountEntry) – a GioUnix.MountEntry

Returns:

True if mount_entry is deemed to be ejectable.

Return type:

bool

Guesses whether a Unix mount can be ejected.

GioUnix.mount_guess_icon(mount_entry)
Parameters:

mount_entry (Gio.UnixMountEntry) – a GioUnix.MountEntry

Returns:

a Gio.Icon

Return type:

Gio.Icon

Guesses the icon of a Unix mount.

GioUnix.mount_guess_name(mount_entry)
Parameters:

mount_entry (Gio.UnixMountEntry) – a GioUnix.MountEntry

Returns:

A newly allocated string that must be freed with GLib.free()

Return type:

str

Guesses the name of a Unix mount. The result is a translated string.

GioUnix.mount_guess_should_display(mount_entry)
Parameters:

mount_entry (Gio.UnixMountEntry) – a GioUnix.MountEntry

Returns:

True if mount_entry is deemed to be displayable.

Return type:

bool

Guesses whether a Unix mount should be displayed in the UI.

GioUnix.mount_guess_symbolic_icon(mount_entry)
Parameters:

mount_entry (Gio.UnixMountEntry) – a GioUnix.MountEntry

Returns:

a Gio.Icon

Return type:

Gio.Icon

Guesses the symbolic icon of a Unix mount.

New in version 2.34.

GioUnix.mount_is_readonly(mount_entry)
Parameters:

mount_entry (Gio.UnixMountEntry) – a #GUnixMount.

Returns:

True if mount_entry is read only.

Return type:

bool

Checks if a unix mount is mounted read only.

GioUnix.mount_is_system_internal(mount_entry)
Parameters:

mount_entry (Gio.UnixMountEntry) – a #GUnixMount.

Returns:

True if the unix mount is for a system path.

Return type:

bool

Checks if a Unix mount is a system mount. This is the Boolean OR of GioUnix.is_system_fs_type(), GioUnix.is_system_device_path() and GioUnix.is_mount_path_system_internal() on mount_entry’s properties.

The definition of what a ‘system’ mount entry is may change over time as new file system types and device paths are ignored.

GioUnix.mount_point_at(mount_path)
Parameters:

mount_path (str) – path for a possible unix mount point.

Returns:

a GioUnix.MountPoint, or None if no match is found.

time_read:

guint64 to contain a timestamp.

Return type:

(Gio.UnixMountPoint or None, time_read: int)

Gets a GioUnix.MountPoint for a given mount path. If time_read is set, it will be filled with a unix timestamp for checking if the mount points have changed since with GioUnix.mount_points_changed_since().

If more mount points have the same mount path, the last matching mount point is returned.

New in version 2.66.

GioUnix.mount_point_compare(mount1, mount2)
Parameters:
Returns:

1, 0 or -1 if mount1 is greater than, equal to, or less than mount2, respectively.

Return type:

int

Compares two unix mount points.

GioUnix.mount_point_copy(mount_point)
Parameters:

mount_point (Gio.UnixMountPoint) – a GioUnix.MountPoint.

Returns:

a new GioUnix.MountPoint

Return type:

Gio.UnixMountPoint

Makes a copy of mount_point.

New in version 2.54.

GioUnix.mount_point_free(mount_point)
Parameters:

mount_point (Gio.UnixMountPoint) – unix mount point to free.

Frees a unix mount point.

GioUnix.mount_point_get_device_path(mount_point)
Parameters:

mount_point (Gio.UnixMountPoint) – a GioUnix.MountPoint.

Returns:

a string containing the device path.

Return type:

str

Gets the device path for a unix mount point.

GioUnix.mount_point_get_fs_type(mount_point)
Parameters:

mount_point (Gio.UnixMountPoint) – a GioUnix.MountPoint.

Returns:

a string containing the file system type.

Return type:

str

Gets the file system type for the mount point.

GioUnix.mount_point_get_mount_path(mount_point)
Parameters:

mount_point (Gio.UnixMountPoint) – a GioUnix.MountPoint.

Returns:

a string containing the mount path.

Return type:

str

Gets the mount path for a unix mount point.

GioUnix.mount_point_get_options(mount_point)
Parameters:

mount_point (Gio.UnixMountPoint) – a GioUnix.MountPoint.

Returns:

a string containing the options.

Return type:

str or None

Gets the options for the mount point.

New in version 2.32.

GioUnix.mount_point_guess_can_eject(mount_point)
Parameters:

mount_point (Gio.UnixMountPoint) – a GioUnix.MountPoint

Returns:

True if mount_point is deemed to be ejectable.

Return type:

bool

Guesses whether a Unix mount point can be ejected.

GioUnix.mount_point_guess_icon(mount_point)
Parameters:

mount_point (Gio.UnixMountPoint) – a GioUnix.MountPoint

Returns:

a Gio.Icon

Return type:

Gio.Icon

Guesses the icon of a Unix mount point.

GioUnix.mount_point_guess_name(mount_point)
Parameters:

mount_point (Gio.UnixMountPoint) – a GioUnix.MountPoint

Returns:

A newly allocated string that must be freed with GLib.free()

Return type:

str

Guesses the name of a Unix mount point. The result is a translated string.

GioUnix.mount_point_guess_symbolic_icon(mount_point)
Parameters:

mount_point (Gio.UnixMountPoint) – a GioUnix.MountPoint

Returns:

a Gio.Icon

Return type:

Gio.Icon

Guesses the symbolic icon of a Unix mount point.

New in version 2.34.

GioUnix.mount_point_is_loopback(mount_point)
Parameters:

mount_point (Gio.UnixMountPoint) – a GioUnix.MountPoint.

Returns:

True if the mount point is a loopback. False otherwise.

Return type:

bool

Checks if a unix mount point is a loopback device.

GioUnix.mount_point_is_readonly(mount_point)
Parameters:

mount_point (Gio.UnixMountPoint) – a GioUnix.MountPoint.

Returns:

True if a mount point is read only.

Return type:

bool

Checks if a unix mount point is read only.

GioUnix.mount_point_is_user_mountable(mount_point)
Parameters:

mount_point (Gio.UnixMountPoint) – a GioUnix.MountPoint.

Returns:

True if the mount point is user mountable.

Return type:

bool

Checks if a unix mount point is mountable by the user.

GioUnix.mount_points_changed_since(time)
Parameters:

time (int) – guint64 to contain a timestamp.

Returns:

True if the mount points have changed since time.

Return type:

bool

Checks if the unix mount points have changed since a given unix time.

GioUnix.mount_points_get()
Returns:

a GLib.List of the UNIX mountpoints.

time_read:

guint64 to contain a timestamp.

Return type:

([Gio.UnixMountPoint], time_read: int)

Gets a GLib.List of GioUnix.MountPoint containing the unix mount points. If time_read is set, it will be filled with the mount timestamp, allowing for checking if the mounts have changed with GioUnix.mount_points_changed_since().

GioUnix.mounts_changed_since(time)
Parameters:

time (int) – guint64 to contain a timestamp.

Returns:

True if the mounts have changed since time.

Return type:

bool

Checks if the unix mounts have changed since a given unix time.

GioUnix.mounts_get()
Returns:

a GLib.List of the UNIX mounts.

time_read:

guint64 to contain a timestamp, or None

Return type:

([Gio.UnixMountEntry], time_read: int)

Gets a GLib.List of GioUnix.MountEntry containing the unix mounts. If time_read is set, it will be filled with the mount timestamp, allowing for checking if the mounts have changed with GioUnix.mounts_changed_since().