Re: How to get trashed file path after "g_file_trash" ?



Hello again, 
and thank you all for your replies :)

Il giorno mer, 19/03/2008 alle 21.48 -0400, A. Walton ha scritto:

> The "g_file_restore_from_trash()" API seems like a bit odd to me; the
> trash location is a real location now, we can move to and from it at
> will, but it's certainly doable. The problem I see with this API is
> that if you've got a GFile to the item in the trash, coding up the
> restore operation isn't difficult at all, but probably should be
> application-specific (as there are several different cases I can think
> of in this situation).

Actually I don't have the path of the item in the trash; also, after a
g_file_trash, the uri returned by g_file_get_uri does not reflect the
actual position of the file. If it did, it would be trivial such
"restore from trash" in nautilus (and in all applications using
g_file_trash).

>  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.

Il giorno gio, 20/03/2008 alle 00.45 +0100, Cosimo Cecchi ha scritto:
> Hi Amos,
> I think the right way to obtain what you need would be implementing
> first a g_file_restore_from_trash () API in GIO (see bug #518573 [1]).
> This would also bring the chance to have something like
> nautilus_file_operations_restore (), and would also solve the
> long-standing bug #41850 [2] about restoring from trash.
> The trash GVfs backend already stores information about the trashed
> files inside ~/.local/share/Trash/info (including the original path
> (uri?)), so I think this would have to be implemented there.
> 
> [1] http://bugzilla.gnome.org/show_bug.cgi?id=518573
> [2] http://bugzilla.gnome.org/show_bug.cgi?id=41850

would g_file_restore_from_trash require the original path or the
"trashed file path"? In the first case it would be difficult to get the
right file if more files with the same name/path are put in the trash;
in the latter case, an application we would need to know that path in
the trash.

cheers

Amos

-- 

"Make everything as simple as possible, but not simpler."
                                      --  Albert Einstein  

Amos Brocco
Ph.D Student
Computer Science Department - DIUF
University of Fribourg

Address:    A406 Pérolles 21
            Bd. Pérolles 90, CH-1700 Fribourg
            
WWW:        http://diuf.unifr.ch/pai/people/broccoa
Phone:      +41 (0)26 300 8481

Attachment: signature.asc
Description: Questa =?ISO-8859-1?Q?=E8?= una parte del messaggio firmata digitalmente



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