pub trait FileExt: IsA<File> + Sealed + 'static {
Show 17 methods // Provided methods fn check_file_on_disk(&self) { ... } fn compression_type(&self) -> CompressionType { ... } fn encoding(&self) -> Option<Encoding> { ... } fn location(&self) -> Option<File> { ... } fn newline_type(&self) -> NewlineType { ... } fn is_deleted(&self) -> bool { ... } fn is_externally_modified(&self) -> bool { ... } fn is_local(&self) -> bool { ... } fn is_readonly(&self) -> bool { ... } fn set_location(&self, location: Option<&impl IsA<File>>) { ... } fn set_mount_operation_factory<P: Fn(&File) -> MountOperation + 'static>( &self, callback: P ) { ... } fn is_read_only(&self) -> bool { ... } fn connect_compression_type_notify<F: Fn(&Self) + 'static>( &self, f: F ) -> SignalHandlerId { ... } fn connect_encoding_notify<F: Fn(&Self) + 'static>( &self, f: F ) -> SignalHandlerId { ... } fn connect_location_notify<F: Fn(&Self) + 'static>( &self, f: F ) -> SignalHandlerId { ... } fn connect_newline_type_notify<F: Fn(&Self) + 'static>( &self, f: F ) -> SignalHandlerId { ... } fn connect_read_only_notify<F: Fn(&Self) + 'static>( &self, f: F ) -> SignalHandlerId { ... }
}
Expand description

Trait containing all File methods.

Implementors

File

Provided Methods§

source

fn check_file_on_disk(&self)

Checks synchronously the file on disk, to know whether the file is externally modified, or has been deleted, and whether the file is read-only.

File doesn’t create a GFileMonitor to track those properties, so this function needs to be called instead. Creating lots of GFileMonitor’s would take lots of resources.

Since this function is synchronous, it is advised to call it only on local files. See is_local().

source

fn compression_type(&self) -> CompressionType

Returns

the compression type.

source

fn encoding(&self) -> Option<Encoding>

The encoding is initially None. After a successful file loading or saving operation, the encoding is non-None.

Returns

the character encoding.

source

fn location(&self) -> Option<File>

source

fn newline_type(&self) -> NewlineType

Returns

the newline type.

source

fn is_deleted(&self) -> bool

Returns whether the file has been deleted. If the location is None, returns false.

To have an up-to-date value, you must first call check_file_on_disk().

Returns

whether the file has been deleted.

source

fn is_externally_modified(&self) -> bool

Returns whether the file is externally modified. If the location is None, returns false.

To have an up-to-date value, you must first call check_file_on_disk().

Returns

whether the file is externally modified.

source

fn is_local(&self) -> bool

Returns whether the file is local. If the location is None, returns false.

Returns

whether the file is local.

source

fn is_readonly(&self) -> bool

Returns whether the file is read-only. If the location is None, returns false.

To have an up-to-date value, you must first call check_file_on_disk().

Returns

whether the file is read-only.

source

fn set_location(&self, location: Option<&impl IsA<File>>)

Sets the location.

location

the new gio::File, or None.

source

fn set_mount_operation_factory<P: Fn(&File) -> MountOperation + 'static>( &self, callback: P )

Sets a GtkSourceMountOperationFactory function that will be called when a gio::MountOperation must be created. This is useful for creating a GtkMountOperation with the parent gtk::Window.

If a mount operation factory isn’t set, gio::MountOperation::new() will be called.

callback

a GtkSourceMountOperationFactory to call when a gio::MountOperation is needed.

notify

function to call on user_data when the callback is no longer needed, or None.

source

fn is_read_only(&self) -> bool

Whether the file is read-only or not. The value of this property is not updated automatically (there is no file monitors).

source

fn connect_compression_type_notify<F: Fn(&Self) + 'static>( &self, f: F ) -> SignalHandlerId

source

fn connect_encoding_notify<F: Fn(&Self) + 'static>( &self, f: F ) -> SignalHandlerId

source

fn connect_location_notify<F: Fn(&Self) + 'static>( &self, f: F ) -> SignalHandlerId

source

fn connect_newline_type_notify<F: Fn(&Self) + 'static>( &self, f: F ) -> SignalHandlerId

source

fn connect_read_only_notify<F: Fn(&Self) + 'static>( &self, f: F ) -> SignalHandlerId

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<O: IsA<File>> FileExt for O