On Thu, 2008-03-20 at 10:18 +0100, Amos Brocco wrote: > > Not sure what would happen > > if you trashed two files of the same name from the same directory > > though, having to deal with the edge cases of the "_filename.2", > > "_filename.3" with the same original path if you're thinking about > > going that way though. > > By having GFile updating the uri/path information after g_file_trash it > wouldn't be difficult. For the undo I keep track of the "old uri", "new > uri" and the operation (copy, move, trash, etc.); if g_file_get_uri > returns the updated path (in the trash) I could just use the "orig-path" > attribute to get the original file.
GFiles are immutable identifies, similare to a pathname string. This proposal is similar to having trash_file(char *filename) change the value of filename to the new location. It just doesn't work. I realize this is a problem for the undo operation though. I'm not sure what the best way to solve that is though. The result of trashing a file is dependent on the platform, and i'm not sure you can always find the target file after doing a trash operation (would have to check those apis). In the case of unix, the exact uri this would have in the trash: location is kinda hard to recreate inside gio as how trash: uris are encoded is defined by the trash backend and can change. It would be possible to somehow return the GFile for the on-disk location though. -- nautilus-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/nautilus-list
