Changes to GtkFileSystem API



Hi, everyone,

Last night I committed a bunch of changes to the GtkFileSystem API.  The
intention is to remove the list_roots and get_root_info methods, and to
add the following:

typedef struct _GtkFileSystemVolume GtkFileSystemVolume;

GSList * (*list_volumes) (GtkFileSystem *file_system);

void (*volume_free) (GtkFileSystem        *file_system,
		     GtkFileSystemVolume  *volume);

GtkFilePath * (*volume_get_base_path) (GtkFileSystem       *file_system,
				       GtkFileSystemVolume *volume);

gboolean (*volume_get_is_mounted) (GtkFileSystem       *file_system,
				   GtkFileSystemVolume *volume);

gboolean (*volume_mount) (GtkFileSystem        *file_system, 
			  GtkFileSystemVolume  *volume,
			  GError              **error);

char * (*volume_get_display_name) (GtkFileSystem       *file_system, 
				   GtkFileSystemVolume *volume);

GdkPixbuf * (*volume_render_icon) (GtkFileSystem        *file_system,
				   GtkFileSystemVolume  *volume,
				   GtkWidget            *widget,
				   gint                  pixel_size,
				   GError              **error);

/* Signal */
void (* volumes_changed) (GtkFileSystem *file_system);

This is to make it easy to plug in the relatively new
GnomeVFSVolumeMonitor into the VFS backend.

In gnome-vfs, the idea is that you have drives and volumes.  Drives are
things like CD-ROMs, floppies, and compactflash cards.  Mounted drives
have a corresponding volume.  Not all volumes have a corresponding
drive, however, as they may be things like NFS or SMB volumes.

With this scheme, GtkFileSystemVolume is an opaque object that acts as a
handle into the file system implementation.  A volume can be mounted or
unmounted, it has a base folder (e.g. /mnt/cdrom), a display name
("CD-ROM"), and an icon.  With this in mind, the API should be
self-explanatory.

The file chooser needs to know if a volume is mounted or not so that it
can display unmounted volumes in a special way in the shortcuts list ---
for example, it could gray them out.  When the user double-clicks on a
volume, the file chooser first sees if it is mounted.  If it is not, it
tries to mount it.  Then, it changes the current folder to the base
folder of the volume.

Are people comfortable with this change?  GtkFileSystemUnix already
works, but of course it only exports a "/" volume that is always
mounted.  I'm finishing the implementation in the gnome-vfs backend.

I have not removed the "list_roots" method and the associated signal
because I still need to convert GtkFileSystemModel.

Best regards,

  Federico




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]