Class FileMonitor

All Implemented Interfaces:
PointerInterface

public class FileMonitor extends Object
Monitors a file or directory for changes.

To obtain a #GFileMonitor for a file or directory, use
g_file_monitor(), g_file_monitor_file(), or
g_file_monitor_directory().

To get informed about changes to the file or directory you are
monitoring, connect to the #GFileMonitor::changed signal. The
signal will be emitted in the
[thread-default main context][g-main-context-push-thread-default]
of the thread that the monitor was created in
(though if the global default main context is blocked, this may
cause notifications to be blocked even if the thread-default
context is still running).

https://docs.gtk.org/gio/class.FileMonitor.html

  • Field Details

  • Constructor Details

  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • cancel

      public boolean cancel()
      Cancels a file monitor.
      Returns:
      always %TRUE
    • emitEvent

      public void emitEvent(@Nonnull File child, @Nonnull File other_file, int event_type)
      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.
      Parameters:
      child - a #GFile.
      other_file - a #GFile.
      event_type - a set of #GFileMonitorEvent flags.
    • isCancelled

      public boolean isCancelled()
      Returns whether the monitor is canceled.
      Returns:
      %TRUE if monitor is canceled. %FALSE otherwise.
    • setRateLimit

      public void setRateLimit(int limit_msecs)
      Sets the rate limit to which the @monitor will report
      consecutive change events to the same file.
      Parameters:
      limit_msecs - a non-negative integer with the limit in milliseconds to poll for changes
    • onChanged

      public SignalHandler onChanged(FileMonitor.OnChanged signal)
      Connect to signal "changed".
      See FileMonitor.OnChanged.onChanged(ch.bailu.gtk.gio.File, ch.bailu.gtk.gio.File, int) for signal description.
      Field SIGNAL_ON_CHANGED contains original signal name and can be used as resource reference.
      Parameters:
      signal - callback function (lambda).
      Returns:
      SignalHandler. Can be used to disconnect signal and to release callback function.
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()