Re: Trash system

On Thursday 14 December 2000 11:23, Pavel Cisler wrote:
> Hey Ryan,
> It would be really cool to unify the Trash system between the two
> desktops.
> I worked a bunch on Trash in Nautilus and would very much like to
> cooperate on this.
> We use multiple Trash directories on all the partitions that the user
> tries to delete items and present them as a unified virtual directory in
> Nautilus.
> We have quite an elaborate heuristic that picks the location of the
> actual physical trash directories on the different partitions. 
> While it is really easy to place a Trash directory into your home
> directory for trashed items from the same partition (we use ~/.Trash),
> it's harder to pick a good place on the other ext2, etc. disks because
> there is no standard. 
> We create Trash directories on the other partitions as needed, first
> time a user actually tries to delete something. This helps find a good
> location that is actually user-writable. Our heuristic starts looking
> for a user-writable location in the same directory as the original
> trashed item and continues going up in the partition hierarchy, trying
> to place the trash directory as close to the partition's root as
> possible. We then create a trash directory in that place, it is in the
> form ".Trash-<user_name>", eg. ".Trash-pavel" and we cache the location
> of it so we know where the Trash is next time. If the user mounts a
> partition that has not been mounted before (no cached Trash location),
> we search for the Trash on it first - it could have had Trash from a
> different system and we want to reuse that.
> This way we end up not trying to create trash on disks that have no
> user-owned (and therefore user-deletable) files, we can deal with a
> directory that contains user-owned items on a partition that is
> otherwise root owned, etc.
> This heuristic is designed to deal with the flexible and free form
> nature of partitions on Linux and unix systems. It would be much easier,
> of course, if there was a standard on Trash directory placement on
> partitions that most file managers adhered to which defined a single
> location for Trash on each of the partitions. I'd be more than happy to
> get rid of our complex heuristic if that were the case.
> How does Konqueror go about placing Trash directories? 

At the moment, the Trash is a simple folder on the desktop, i.e.
but this is going to change soon :
I (as the konqueror maintainer) have been contacted by two persons
from Corel, "Oleg Noskov" <olegn corel com> and denis macadamian com,
who are interested in implementing a full-featured Trash in KDE.

This discussion, thus, has a perfect timing, since we are at the initial stage
of designing how it's going to work.

> Besides that, I was going to add more support in to recognize Windows
> and maybe even Mac Trash, either should be easy because on those systems
> Trash is in a well known place.
> As far as metadata for Trash, we are planning to store the original item
> locations but have not implemented the feature yet so it would be really
> easy to adopt any solution that you may already have. Any other metadata
> besides the original location?

Yes :-)

Well, this is really interesting. You've thought a lot about the actual Trash
location and not really about the metadata, and the Corel guys have a
working solution to suggest for the metadata, and not much on the Trash
location yet :-) Sounds like a good opportunity to exchange solutions and
make a standard out of the result.

This is how it works now in CFM (Corel's file manager), and how it
will soon work in KDE:

- Each user has her own Trash directory (in ~/Desktop/Trash).
[Note: I suggest the desktop icon to be just a link, and the actual trash
location to be more elaborate, using the same solution as Nautilus's].

- "Move To Trash" menu item appears in the CFM. When it is invoked, a
new trash entry is created for every item moved. First, the unique
9-character name is generated (starting with dot, then 8 random characters, 
then checked for non-duplicated entry). Then a directory with that name 
is created in ~/Desktop/Trash, and the file or folder in question is moved 
into that directory. Then ".info" is appended to the name
above and file with that name is created in ~/Desktop/Trash.

This file has the following structure:
    <original location>
    <date deleted in hex>
    <File size>
    <File mode>
    <mtime of the original file in hex>
    <ctime of the original file in hex>
with every element appearing on its own line.

Here's a an example.
If we move to trash file "/home/Corelcorp/PeterG/test.gif", then it
could end up in "/home/PeterG/Desktop/Trash/.t49SxmLt/test.gif",
and the file "/home/PeterG/Desktop/" will look
something like:


Well, if CFM, Konqueror and Nautilus use the same trash locations and
the same way of putting files into it (info files with the same format),
they will be perfectly integrated and compatible at this level.

Oleg and Denis are not on this list, I suggest to keep them in the Cc for
any further discussion.

David FAURE, david mandrakesoft com, faure kde org,
KDE, Making The Future of Computing Available Today

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