GnomeVFSVolumeMonitor

GnomeVFSVolumeMonitor — Monitors volume mounts and unmounts

Synopsis




#define     GNOME_IS_VFS_VOLUME_MONITOR     (o)
#define     GNOME_IS_VFS_VOLUME_MONITOR_CLASS(k)
#define     GNOME_VFS_TYPE_VOLUME_MONITOR
#define     GNOME_VFS_VOLUME_MONITOR        (o)
#define     GNOME_VFS_VOLUME_MONITOR_CLASS  (k)
            GnomeVFSVolumeMonitor;
            GnomeVFSVolumeMonitorClass;
GnomeVFSVolumeMonitor* gnome_vfs_get_volume_monitor
                                            (void);
GList*      gnome_vfs_volume_monitor_get_connected_drives
                                            (GnomeVFSVolumeMonitor *volume_monitor);
GnomeVFSDrive* gnome_vfs_volume_monitor_get_drive_by_id
                                            (GnomeVFSVolumeMonitor *volume_monitor,
                                             gulong id);
GList*      gnome_vfs_volume_monitor_get_mounted_volumes
                                            (GnomeVFSVolumeMonitor *volume_monitor);
GType       gnome_vfs_volume_monitor_get_type
                                            (void);
GnomeVFSVolume* gnome_vfs_volume_monitor_get_volume_by_id
                                            (GnomeVFSVolumeMonitor *volume_monitor,
                                             gulong id);
GnomeVFSVolume* gnome_vfs_volume_monitor_get_volume_for_path
                                            (GnomeVFSVolumeMonitor *volume_monitor,
                                             const char *path);
GnomeVFSVolumeMonitor* gnome_vfs_volume_monitor_ref
                                            (GnomeVFSVolumeMonitor *volume_monitor);
void        gnome_vfs_volume_monitor_unref  (GnomeVFSVolumeMonitor *volume_monitor);

Object Hierarchy


  GObject
   +----GnomeVFSVolumeMonitor

Signals


"drive-connected"
            void        user_function      (GnomeVFSVolumeMonitor *volume_monitor,
                                            GnomeVFSDrive         *drive,
                                            gpointer               user_data)           : Run first
"drive-disconnected"
            void        user_function      (GnomeVFSVolumeMonitor *volume_monitor,
                                            GnomeVFSDrive         *drive,
                                            gpointer               user_data)           : Run first
"volume-mounted"
            void        user_function      (GnomeVFSVolumeMonitor *volume_monitor,
                                            GnomeVFSVolume        *volume,
                                            gpointer               user_data)           : Run first
"volume-pre-unmount"
            void        user_function      (GnomeVFSVolumeMonitor *volume_monitor,
                                            GnomeVFSVolume        *volume,
                                            gpointer               user_data)           : Run first
"volume-unmounted"
            void        user_function      (GnomeVFSVolumeMonitor *volume_monitor,
                                            GnomeVFSVolume        *volume,
                                            gpointer               user_data)           : Run first

Description

Details

GNOME_IS_VFS_VOLUME_MONITOR()

#define GNOME_IS_VFS_VOLUME_MONITOR(o)       (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNOME_VFS_TYPE_VOLUME_MONITOR))

o :

GNOME_IS_VFS_VOLUME_MONITOR_CLASS()

#define GNOME_IS_VFS_VOLUME_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GNOME_VFS_TYPE_VOLUME_MONITOR))

k :

GNOME_VFS_TYPE_VOLUME_MONITOR

#define GNOME_VFS_TYPE_VOLUME_MONITOR        (gnome_vfs_volume_monitor_get_type ())


GNOME_VFS_VOLUME_MONITOR()

#define GNOME_VFS_VOLUME_MONITOR(o)          (G_TYPE_CHECK_INSTANCE_CAST ((o), GNOME_VFS_TYPE_VOLUME_MONITOR, GnomeVFSVolumeMonitor))

o :

GNOME_VFS_VOLUME_MONITOR_CLASS()

#define GNOME_VFS_VOLUME_MONITOR_CLASS(k)    (G_TYPE_CHECK_CLASS_CAST((k), GNOME_VFS_TYPE_VOLUME_MONITOR, GnomeVFSVolumeMonitorClass))

k :

GnomeVFSVolumeMonitor

typedef struct _GnomeVFSVolumeMonitor GnomeVFSVolumeMonitor;


GnomeVFSVolumeMonitorClass

typedef struct {
	GObjectClass parent_class;

	/* signals */
	void (* volume_mounted)	  	(GnomeVFSVolumeMonitor *volume_monitor,
				   	 GnomeVFSVolume	       *volume);
	void (* volume_pre_unmount)	(GnomeVFSVolumeMonitor *volume_monitor,
				   	 GnomeVFSVolume	       *volume);
	void (* volume_unmounted)	(GnomeVFSVolumeMonitor *volume_monitor,
				   	 GnomeVFSVolume	       *volume);
	void (* drive_connected) 	(GnomeVFSVolumeMonitor *volume_monitor,
				   	 GnomeVFSDrive	       *drive);
	void (* drive_disconnected)	(GnomeVFSVolumeMonitor *volume_monitor,
				   	 GnomeVFSDrive         *drive);
} GnomeVFSVolumeMonitorClass;


gnome_vfs_get_volume_monitor ()

GnomeVFSVolumeMonitor* gnome_vfs_get_volume_monitor
                                            (void);

Returns a pointer to the GnomeVFSVolumeMonitor singleton. GnomeVFSVolumeMonitor is a singleton, this means it is guaranteed to exist and be valid until gnome_vfs_shutdown() is called. Consequently, it doesn't need to be refcounted since gnome-vfs will hold a reference to it until it is shut down.

Returns : a pointer to the GnomeVFSVolumeMonitor singleton.

Since 2.6


gnome_vfs_volume_monitor_get_connected_drives ()

GList*      gnome_vfs_volume_monitor_get_connected_drives
                                            (GnomeVFSVolumeMonitor *volume_monitor);

Returns a GList of all drives connected to the machine. The GnomeVFSDrive objects must be unreffed by the caller when no longer needed with gnome_vfs_drive_unref() and the GList must be freed.

volume_monitor : a GnomeVFSVolumeMonitor.
Returns : a GList of all connected drives.

Since 2.6


gnome_vfs_volume_monitor_get_drive_by_id ()

GnomeVFSDrive* gnome_vfs_volume_monitor_get_drive_by_id
                                            (GnomeVFSVolumeMonitor *volume_monitor,
                                             gulong id);

Looks for a GnomeVFSDrive whose id is id. A valid volume_monitor to pass to this function can be acquired using gnome_vfs_get_volume_monitor()

volume_monitor : a GnomeVFSVolumeMonitor.
id : the GnomeVFSVolume id to look for.
Returns : the GnomeVFSDrive corresponding to id, or NULL if no GnomeVFSDrive with a matching id could be found. The caller owns a reference on the returned drive, and must call gnome_vfs_drive_unref() when it no longer needs it.

Since 2.6


gnome_vfs_volume_monitor_get_mounted_volumes ()

GList*      gnome_vfs_volume_monitor_get_mounted_volumes
                                            (GnomeVFSVolumeMonitor *volume_monitor);

Gets the list of all the mounted GnomeVFSVolume volumes.

volume_monitor : a GnomeVFSVolumeMonitor.
Returns : GList of GnomeVFSVolume. The GnomeVFSVolume objects must be unreffed by the caller when no longer needed with gnome_vfs_volume_unref() and the GList must be freed.

Since 2.6


gnome_vfs_volume_monitor_get_type ()

GType       gnome_vfs_volume_monitor_get_type
                                            (void);

Returns :

gnome_vfs_volume_monitor_get_volume_by_id ()

GnomeVFSVolume* gnome_vfs_volume_monitor_get_volume_by_id
                                            (GnomeVFSVolumeMonitor *volume_monitor,
                                             gulong id);

Looks for a GnomeVFSVolume whose id is id. A valid volume_monitor to pass to this function can be acquired using gnome_vfs_get_volume_monitor().

volume_monitor : a GnomeVFSVolumeMonitor.
id : GnomeVFSVolume id to look for.
Returns : the GnomeVFSVolume corresponding to id, or NULL if no GnomeVFSVolume with a matching id could be found. The caller owns a reference on the returned volume, and must call gnome_vfs_volume_unref() when it no longer needs it.

Since 2.6


gnome_vfs_volume_monitor_get_volume_for_path ()

GnomeVFSVolume* gnome_vfs_volume_monitor_get_volume_for_path
                                            (GnomeVFSVolumeMonitor *volume_monitor,
                                             const char *path);

Returns the GnomeVFSVolume corresponding to path, or NULL.

The volume referring to path is found by calling stat on path, and then iterating through the list of volumes that refer to currently mounted local file systems. The first volume in this list maching the path's UNIX device is returned.

If the stat on path was not successful, or no volume matches path, or NULL is returned.

volume_monitor : a GnomeVFSVolumeMonitor.
path : string representing a path.
Returns : the GnomeVFSVolume corresponding to the path, or NULL. Volume returned must be unreffed by the caller with gnome_vfs_volume_unref().

Since 2.6


gnome_vfs_volume_monitor_ref ()

GnomeVFSVolumeMonitor* gnome_vfs_volume_monitor_ref
                                            (GnomeVFSVolumeMonitor *volume_monitor);

Increases the refcount of volume_monitor by one, if it is not NULL.

You shouldn't use this function unless you know what you are doing: GnomeVFSVolumeMonitor is to be used as a singleton object, see gnome_vfs_get_volume_monitor() for more details.

volume_monitor : the GnomeVFSVolumeMonitor, or NULL.
Returns : volume_monitor with its refcount increased by one, or NULL if volume_monitor is NULL.

Since 2.6


gnome_vfs_volume_monitor_unref ()

void        gnome_vfs_volume_monitor_unref  (GnomeVFSVolumeMonitor *volume_monitor);

Decreases the refcount of volume_monitor by one, if it is not NULL.

You shouldn't use this function unless you know what you are doing: GnomeVFSVolumeMonitor is to be used as a singleton object, see gnome_vfs_get_volume_monitor() for more details.

volume_monitor : GnomeVFSVolumeMonitor, or NULL.

Since 2.6

Signal Details

The "drive-connected" signal

void        user_function                  (GnomeVFSVolumeMonitor *volume_monitor,
                                            GnomeVFSDrive         *drive,
                                            gpointer               user_data)           : Run first

This signal is emitted when the GnomeVFSDrive drive has been connected.

When the drive is connected, it is present in the volume_monitor's list of connected drives, which can be queried using gnome_vfs_volume_monitor_get_connected_drives().

volume_monitor : the GnomeVFSVolumeMonitor which received the signal.
drive : the GnomeVFSDrive that has been connected.
user_data : user data set when the signal handler was connected.

The "drive-disconnected" signal

void        user_function                  (GnomeVFSVolumeMonitor *volume_monitor,
                                            GnomeVFSDrive         *drive,
                                            gpointer               user_data)           : Run first

This signal is emitted after the GnomeVFSDrive drive has been disconnected.

When the drive is disconnected, it is removed from the volume_monitor's list of connected drives, which can be queried using gnome_vfs_volume_monitor_get_connected_drives().

volume_monitor : the GnomeVFSVolumeMonitor which received the signal.
drive : the GnomeVFSDrive that has been disconnected.
user_data : user data set when the signal handler was connected.

The "volume-mounted" signal

void        user_function                  (GnomeVFSVolumeMonitor *volume_monitor,
                                            GnomeVFSVolume        *volume,
                                            gpointer               user_data)           : Run first

This signal is emitted after the GnomeVFSVolume volume has been mounted.

When the volume is mounted, it is present in the volume_monitor's list of mounted volumes, which can be queried using gnome_vfs_volume_monitor_get_mounted_volumes().

If the volume has an associated GnomeVFSDrive, it also appears in the drive's list of mounted volumes, which can be queried using gnome_vfs_drive_get_mounted_volumes().

volume_monitor : the GnomeVFSVolumeMonitor which received the signal.
volume : the GnomeVFSVolume that has been mounted.
user_data : user data set when the signal handler was connected.

The "volume-pre-unmount" signal

void        user_function                  (GnomeVFSVolumeMonitor *volume_monitor,
                                            GnomeVFSVolume        *volume,
                                            gpointer               user_data)           : Run first

This signal is emitted when the GnomeVFSVolume volume is about to be unmounted.

When the volume is unmounted, it is removed from the volume_monitor's list of mounted volumes, which can be queried using gnome_vfs_volume_monitor_get_mounted_volumes().

If the volume has an associated GnomeVFSDrive, it is also removed from in the drive's list of mounted volumes, which can be queried using gnome_vfs_drive_get_mounted_volumes().

When a client application receives this signal, it must free all resources associated with the volume, for instance cancel all pending file operations on the volume, and cancel all pending file monitors using gnome_vfs_monitor_cancel().

volume_monitor : the GnomeVFSVolumeMonitor which received the signal.
volume : the GnomeVFSVolume that is about to be unmounted.
user_data : user data set when the signal handler was connected.

The "volume-unmounted" signal

void        user_function                  (GnomeVFSVolumeMonitor *volume_monitor,
                                            GnomeVFSVolume        *volume,
                                            gpointer               user_data)           : Run first

This signal is emitted after the GnomeVFSVolume volume has been unmounted.

When the volume is unmounted, it is removed from the volume_monitor's list of mounted volumes, which can be queried using gnome_vfs_volume_monitor_get_mounted_volumes().

If the volume has an associated GnomeVFSDrive, it is also removed from in the drive's list of mounted volumes, which can be queried using gnome_vfs_drive_get_mounted_volumes().

volume_monitor : the GnomeVFSVolumeMonitor which received the signal.
volume : the GnomeVFSVolume that has been unmounted.
user_data : user data set when the signal handler was connected.