Trait gio::prelude::FileMonitorExt

source ·
pub trait FileMonitorExt: IsA<FileMonitor> + Sealed + 'static {
    // Provided methods
    fn cancel(&self) -> bool { ... }
    fn emit_event(
        &self,
        child: &impl IsA<File>,
        other_file: &impl IsA<File>,
        event_type: FileMonitorEvent,
    ) { ... }
    fn is_cancelled(&self) -> bool { ... }
    fn set_rate_limit(&self, limit_msecs: i32) { ... }
    fn rate_limit(&self) -> i32 { ... }
    fn connect_changed<F: Fn(&Self, &File, Option<&File>, FileMonitorEvent) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId { ... }
    fn connect_cancelled_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId { ... }
    fn connect_rate_limit_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId { ... }
}
Expand description

Trait containing all FileMonitor methods.

§Implementors

FileMonitor

Provided Methods§

source

fn cancel(&self) -> bool

Cancels a file monitor.

§Returns

always true

source

fn emit_event( &self, child: &impl IsA<File>, other_file: &impl IsA<File>, event_type: FileMonitorEvent, )

Emits the #GFileMonitor::changed signal if a change has taken place. Should be called from file monitor implementations only.

Implementations are responsible to call this method from the [thread-default main context][g-main-context-push-thread-default] of the thread that the monitor was created in.

§child

a #GFile.

§other_file

a #GFile.

§event_type

a set of #GFileMonitorEvent flags.

source

fn is_cancelled(&self) -> bool

Returns whether the monitor is canceled.

§Returns

true if monitor is canceled. false otherwise.

source

fn set_rate_limit(&self, limit_msecs: i32)

Sets the rate limit to which the @self will report consecutive change events to the same file.

§limit_msecs

a non-negative integer with the limit in milliseconds to poll for changes

source

fn rate_limit(&self) -> i32

The limit of the monitor to watch for changes, in milliseconds.

source

fn connect_changed<F: Fn(&Self, &File, Option<&File>, FileMonitorEvent) + 'static>( &self, f: F, ) -> SignalHandlerId

Emitted when @file has been changed.

If using FileMonitorFlags::WATCH_MOVES on a directory monitor, and the information is available (and if supported by the backend), @event_type may be FileMonitorEvent::Renamed, FileMonitorEvent::MovedIn or FileMonitorEvent::MovedOut.

In all cases @file will be a child of the monitored directory. For renames, @file will be the old name and @other_file is the new name. For “moved in” events, @file is the name of the file that appeared and @other_file is the old name that it was moved from (in another directory). For “moved out” events, @file is the name of the file that used to be in this directory and @other_file is the name of the file at its new location.

It makes sense to treat FileMonitorEvent::MovedIn as equivalent to FileMonitorEvent::Created and FileMonitorEvent::MovedOut as equivalent to FileMonitorEvent::Deleted, with extra information. FileMonitorEvent::Renamed is equivalent to a delete/create pair. This is exactly how the events will be reported in the case that the FileMonitorFlags::WATCH_MOVES flag is not in use.

If using the deprecated flag FileMonitorFlags::SEND_MOVED flag and @event_type is FileMonitorEvent::Moved, @file will be set to a #GFile containing the old path, and @other_file will be set to a #GFile containing the new path.

In all the other cases, @other_file will be set to #NULL.

§file

a #GFile.

§other_file

a #GFile or #NULL.

§event_type

a #GFileMonitorEvent.

source

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

source

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

Object Safety§

This trait is not object safe.

Implementors§