ThunarVfsMonitor

ThunarVfsMonitor — Portable file system monitoring class.

Synopsis


#include <thunar-vfs/thunar-vfs.h>


            ThunarVfsMonitor;
enum        ThunarVfsMonitorEvent;
            ThunarVfsMonitorHandle;
void        (*ThunarVfsMonitorCallback)     (ThunarVfsMonitor *monitor,
                                             ThunarVfsMonitorHandle *handle,
                                             ThunarVfsMonitorEvent event,
                                             ThunarVfsPath *handle_path,
                                             ThunarVfsPath *event_path,
                                             gpointer user_data);
ThunarVfsMonitor* thunar_vfs_monitor_get_default
                                            (void);
ThunarVfsMonitorHandle* thunar_vfs_monitor_add_directory
                                            (ThunarVfsMonitor *monitor,
                                             ThunarVfsPath *path,
                                             ThunarVfsMonitorCallback callback,
                                             gpointer user_data);
ThunarVfsMonitorHandle* thunar_vfs_monitor_add_file
                                            (ThunarVfsMonitor *monitor,
                                             ThunarVfsPath *path,
                                             ThunarVfsMonitorCallback callback,
                                             gpointer user_data);
void        thunar_vfs_monitor_remove       (ThunarVfsMonitor *monitor,
                                             ThunarVfsMonitorHandle *handle);
void        thunar_vfs_monitor_feed         (ThunarVfsMonitor *monitor,
                                             ThunarVfsMonitorEvent event,
                                             ThunarVfsPath *path);
void        thunar_vfs_monitor_wait         (ThunarVfsMonitor *monitor);


Object Hierarchy


  GObject
   +----ThunarVfsMonitor

Description

Details

ThunarVfsMonitor

typedef struct _ThunarVfsMonitor ThunarVfsMonitor;

The ThunarVfsMonitor-struct contains private data only, and should be accessed using the functions below.


enum ThunarVfsMonitorEvent

typedef enum
{
  THUNAR_VFS_MONITOR_EVENT_CHANGED,
  THUNAR_VFS_MONITOR_EVENT_CREATED,
  THUNAR_VFS_MONITOR_EVENT_DELETED,
} ThunarVfsMonitorEvent;

Describes an event that occurred on a ThunarVfsMonitorHandle.

THUNAR_VFS_MONITOR_EVENT_CHANGED a file or directory was changed.
THUNAR_VFS_MONITOR_EVENT_CREATED a file or directory was created.
THUNAR_VFS_MONITOR_EVENT_DELETED a file or directory was deleted.

ThunarVfsMonitorHandle

typedef struct _ThunarVfsMonitorHandle ThunarVfsMonitorHandle;

A handle on a file system entity, which is currently watched by a ThunarVfsMonitor.


ThunarVfsMonitorCallback ()

void        (*ThunarVfsMonitorCallback)     (ThunarVfsMonitor *monitor,
                                             ThunarVfsMonitorHandle *handle,
                                             ThunarVfsMonitorEvent event,
                                             ThunarVfsPath *handle_path,
                                             ThunarVfsPath *event_path,
                                             gpointer user_data);

The prototype for callback functions that will be called by a ThunarVfsMonitor whenever one of its associated ThunarVfsMonitorHandles notice a change.

monitor : a ThunarVfsMonitor.
handle : a ThunarVfsMonitorHandle.
event : the event that occurred.
handle_path : the ThunarVfsPath that was specified when registering the handle.
event_path : the ThunarVfsPath on which the event occurred.
user_data : the user data that was specified when registering the handle with the monitor.

thunar_vfs_monitor_get_default ()

ThunarVfsMonitor* thunar_vfs_monitor_get_default
                                            (void);

Returns the shared ThunarVfsMonitor instance. The caller is responsible to call g_object_unref() on the returned object when no longer needed.

Returns : a reference to the shared ThunarVfsMonitor instance.

thunar_vfs_monitor_add_directory ()

ThunarVfsMonitorHandle* thunar_vfs_monitor_add_directory
                                            (ThunarVfsMonitor *monitor,
                                             ThunarVfsPath *path,
                                             ThunarVfsMonitorCallback callback,
                                             gpointer user_data);

Registers path as directory for monitor. monitor will invoke callback whenever it notices a change to the directory to which path refers or any of the files within the directory.

The returned ThunarVfsMonitorHandle can be used to remove the path from monitor using thunar_vfs_monitor_remove().

monitor : a ThunarVfsMonitor.
path : the ThunarVfsPath of the directory that should be watched.
callback : the callback function to invoke.
user_data : additional data to pass to callback.
Returns : the ThunarVfsMonitorHandle for the new watch.

thunar_vfs_monitor_add_file ()

ThunarVfsMonitorHandle* thunar_vfs_monitor_add_file
                                            (ThunarVfsMonitor *monitor,
                                             ThunarVfsPath *path,
                                             ThunarVfsMonitorCallback callback,
                                             gpointer user_data);

Registers path as file with monitor. monitor will then invoke callback whenever it notices a change to the file to which path refers.

The returned ThunarVfsMonitorHandle can be used to remove the path from monitor using thunar_vfs_monitor_remove().

monitor : a ThunarVfsMonitor.
path : the ThunarVfsPath of the file that should be watched.
callback : the callback function to invoke.
user_data : additional data to pass to callback.
Returns : the ThunarVfsMonitorHandle for the new watch.

thunar_vfs_monitor_remove ()

void        thunar_vfs_monitor_remove       (ThunarVfsMonitor *monitor,
                                             ThunarVfsMonitorHandle *handle);

Removes handle from monitor.

monitor : a ThunarVfsMonitor.
handle : a valid ThunarVfsMonitorHandle for monitor.

thunar_vfs_monitor_feed ()

void        thunar_vfs_monitor_feed         (ThunarVfsMonitor *monitor,
                                             ThunarVfsMonitorEvent event,
                                             ThunarVfsPath *path);

Explicitly injects the given event into monitors event processing logic.

monitor : a ThunarVfsMonitor.
event : the ThunarVfsMonitorEvent that should be emulated.
path : the ThunarVfsPath on which event took place.

thunar_vfs_monitor_wait ()

void        thunar_vfs_monitor_wait         (ThunarVfsMonitor *monitor);

Suspends the execution of the current thread until the monitor has processed all currently pending events. The calling thread must own a reference on the monitor!

This method should never be called from the main thread or you'll lock up your application!!

monitor : a ThunarVfsMonitor.