/* Check if we should empty the trash */
if (gnome_vfs_volume_handles_trash(volume))
{
GnomeVFSDeviceType type = gnome_vfs_volume_get_device_type(volume);
switch (type)
{
/* Case: is removable */
case GNOME_VFS_DEVICE_TYPE_CAMERA:
case GNOME_VFS_DEVICE_TYPE_MEMORY_STICK:
case GNOME_VFS_DEVICE_TYPE_APPLE:
case GNOME_VFS_DEVICE_TYPE_MUSIC_PLAYER:
case GNOME_VFS_DEVICE_TYPE_FLOPPY:
case GNOME_VFS_DEVICE_TYPE_ZIP:
case GNOME_VFS_DEVICE_TYPE_JAZ:
{
gint result;
GtkWidget* dialog = gtk_message_dialog_new(GTK_WINDOW(application),
GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_YES_NO,
_("Do you want to empty the trash before you umount %s?"),
gnome_vfs_volume_display_name(drive));
result = gtk_dialog_run(GTK_DIALOG(dialog));
if (result == GTK_RESPONSE_YES)
{
GList* trash_dir = nautilus_trash_monitor_get_trash_directories();
if (trash_dir)
{
GList* I;
for (I = trash_dir; trash_dir != NULL; I = I->next)
{
const gchar* path = gnome_vfs_uri_get_path(GNOME_VFS_URI(I->data));
GnomeVfsVolume* trash_volume = gnome_vfs_volume_monitor_get_volume_for_path(path)
if (gnome_vfs_volume_compare(volume, volume_trash) == 0)
{
/* Found trash on this volume, empty it */
}
}
}
gtk_widget_destroy(dialog);
break;
}
default:
break;
}