Trash Roxapp - Discussion Document

What features/apps/bugfixes needed in a future Puppy
Message
Author
disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#21 Post by disciple »

Hmmm.
Two problems:
1. Unless there's a feature to sort numbers in gtkdialog, we'll have to have a button to sort by size, as even if we had all the sizes in the same units, a 1000KB file would be sorted before a 200 KB file.
2. I can't check for a folder before writing the extension, as I want that field blank for files without extensions as well. So I need to check for a . in the filename. How can I do that?
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#22 Post by disciple »

Darn!
I checked in Dingo, and only the version that creates info files with just the path and deletion date made it into 4.0
But I guess the good thing about it is that since backwards compatibility for the new summary feature is broken anyway, I can change the fields we put in the info files. So "Location" is now changed to the full path, and there is a new "Item" field to distinguish in the summary between deleted files with the same name.

Here it is!

There are also other minor tweaks from the version that didn't make it into 4.0, such as setting the default button in xmessage windows (not that this helps much in the stock Dingo, as you seem to need gxmessage to use the arrow keys to move buttons).

It should be trivial enough to run `rox deleted_item_appdir` when you right-click on a file in the summary, to get the same window as when you click on the item in rox (with buttons to delete/open/show/restore the file).
But I can't figure out how to work gtkdialog :(

I also haven't implemented a "sort by size" button, as this is a bit beyond me too.
Attachments
Trash.tar.gz
(15.87 KiB) Downloaded 675 times
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#23 Post by Flash »

I just noticed this topic. :oops:
Speaking as a multisession DVD user, ideally the trash would contain a link to the session(s) where the (fragments of the) deleted file is (are). When I mount the DVD and click on the "deleted" file in the trash, at least the last version of the file should load. Better yet, every version of the file would somehow be loaded, so I could see the history of the file. I don't know how this would be done. It's my Christmas wish to Santa. :lol:
[url=http://www.murga-linux.com/puppy/viewtopic.php?t=69321][color=blue]Puppy Help 101 - an interactive tutorial for Lupu 5.25[/color][/url]

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#24 Post by disciple »

I don't think it would be realistic to keep track of old versions of things from a Trash type program. I imagine it would be possible to have an easy way of comparing sessions, but someone capable would have to look into it.
I was recently looking for a gui simply to mount old sessions (on any multisession disc, not just a multisession disc of Puppy), which would be quite useful too.

Out of interest Flash, do you know what does happen when you trash something in multisession Puppy? Does the file get written again, taking up more space, or do the directions to it just change?
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#25 Post by sunburnt »

disciple; This command will output the files in a path from smallest to largest size.

ls -l1 (/PATH) | awk '{print $5}' | sort -g

Note that it's: ls -(lower case "L" & number "1")
Say if you need it sorted in largest to smallest, or a type of file, or a certain file extention.

To my knowledge, the Trash bin is a dir. /.Trash-0, just like /lost+found.
So when deleting a dir. or file, it's just moved to /Trash-0, which is in the pup_save. file.

Also... If you need help making gtkDialog work, I can help out, I've done a number of GUIs.

I don't know exactly what you're doing, looks like a "multisession file" history browser & loader GUI?

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#26 Post by disciple »

Ah thanks - that makes it easier!
I wonder why I don't get notifications for this thread :cry:
I don't know exactly what you're doing, looks like a "multisession file" history browser & loader GUI?
I'm not doing anything except studying for exams :)
I do think that a multisession browser and mounter would be a very useful edition to puppy, but I personally won't be doing anything about it in the near future.
I believe you can mount an old session with the mount option `session=x` where x is a number. But I don't know how to list the sessions on a disc - maybe by parsing the output from cdrecord -vv? (or whatever the command is to output information about a disc with cdrecord)

If you want to help with a sort by size for the Trash, you would have to look at how it works. Trashed items each get their own subdirectory in ~/Trash, and the actual item is stored in a sub-subdirectory called "files". Information about the item is stored in a file called "info", so the summary gui just parses all these "info" files.
To sort by size I guess it would be easiest to use ls to sort all the directories in ~/Trash by size, and pipe the result through the command that parses the "info" files.

-----------------------
Man I'm stupid.

I just realised that by far the biggest improvement we could make to the Trash is to add a -help option to the right-click menu. That might help at least some of the people who don't realise that deleting a file makes it disappear forever, and that you need to drag files onto the trash to trash them.
We'll have to update the help file a bit though - I'll get onto it in a few weeks when I have the time, unless someone else does it.
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#27 Post by disciple »

Google turned up msinfo from the cdrdao distribution, which might be what we're after for listing sessions.
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#28 Post by Flash »

Ok, I see that once again my ignorance has been the source of confusion (my own, if no one else's. :) ) I assumed that the immediate effect of deleting an item is to move it to the trash directory (along with its dependents, I suppose.) I must confess that I've never used Puppy's trash. I guess it makes sense that only items that have been dragged (or otherwise deliberately moved) to the trash will be found in the trash, while deleted items bypass the trash and go straight to the bit recycle bin. The situation is a bit different if you run Puppy from a multisession DVD. Anything written on a DVD cannot be erased, so deleting an item can only remove it from Puppy's file system index or directory or whatever you call it. (Pardon me while I show off my ignorance again.)

What I'm suggesting is that, for multisession Puppy at least, items when they are deleted be moved to the trash directory for a while, then removed from the trash if they aren't accessed for a certain time, or perhaps number of reboots. Putting an item in the trash means it will not be saved when Puppy next shuts down, nor reloaded into RAM the next time Puppy boots. However, a link to its location on the DVD would be in the trash index. Of course, I realize that this is only wishful thinking because I have no idea how to implement it. :cry:
[url=http://www.murga-linux.com/puppy/viewtopic.php?t=69321][color=blue]Puppy Help 101 - an interactive tutorial for Lupu 5.25[/color][/url]

User avatar
HairyWill
Posts: 2928
Joined: Fri 26 May 2006, 23:29
Location: Southampton, UK

#29 Post by HairyWill »

Possiblly in multisession mode the contents of the trash could be moved to archive before the session is written to disc. This does mean that the trash would not show deleted items from previous boots. Maybe it should be able to search through all the archive directories as well.
Will
contribute: [url=http://www.puppylinux.org]community website[/url], [url=http://tinyurl.com/6c3nm6]screenshots[/url], [url=http://tinyurl.com/6j2gbz]puplets[/url], [url=http://tinyurl.com/57gykn]wiki[/url], [url=http://tinyurl.com/5dgr83]rss[/url]

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#30 Post by disciple »

I don't think that makes sense HW. You might as well just delete the items, and then compare sessions to find deleted items.
--EDIT--
No, there are two problems with that:
- firstly if the file is new (not already saved in an old session), it will really be gone forever (not even photorec could save you). Also, a file from another filesystem would be gone forever (but photorec might save you).
- secondly items that you might want to recover (that you would normally trash) would not be distinguished from items that you know you don't want (so would normally delete). Some "power-users" wouldn't like this, but normal users would probably love it :)
--/EDIT--

How much space would you actually save by archiving trashed items anyway?
I may misunderstand how the multisession system works, but I don't think if you trash a 25MB file it will take up an extra 25MB in your latest session. I think the filesystem will refer to the file in its original location in an old session. So it would only be taking up extra space when you move to a new disc. Can anyone confirm this? I think that's what you were saying Flash?

--EDIT--No longer relevant--
In the end, you don't really NEED the trash for a multisession system, as deleted files aren't gone forever like in a normal system. You either need what Flash suggested (a record of which files were deleted when), which I think is complicated and unnecessary; a way of comparing sessions (this would be quite entertaining too); and/or a way of mounting old sessions and searching for files in them.
Or there may be no real disadvantage to using the Trash like it is :) (except if you trash large items from a different filesystem).

I suspect if you were running a multisession puppy, and booting at least once a day, you would probably want an easy way to compare sessions rather than just a gui for mounting them. Maybe all you would need is Xfdiff...
--/EDIT--
I assumed that the immediate effect of deleting an item is to move it to the trash directory
If Flash assumed that, we certainly can't blame newbies for doing the same :)
I think we need to start an education program somehow. Maybe we could hack the forum so that pop-up windows tell you how how to use the trash every time you load a page :)
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

User avatar
HairyWill
Posts: 2928
Joined: Fri 26 May 2006, 23:29
Location: Southampton, UK

#31 Post by HairyWill »

disciple wrote: How much space would you actually save by archiving trashed items anyway?
I may misunderstand how the multisession system works, but I don't think if you trash a 25MB file it will take up an extra 25MB in your latest session. I think the filesystem will refer to the file in its original location in an old session. So it would only be taking up extra space when you move to a new disc. Can anyone confirm this? I think that's what you were saying Flash?
Multisession does not refer to the files stored inside the sessions, if it did it would not be possible to use the CD drive for anything else. The contents of the session directories are copied into ram. The rationale behind /archive in multisession is that files in it are not loaded into ram when puppy boots. Files stored inside /root are. If I am running multisession and I put lots of files into the trash they are all loaded into ram next boot. This is unlikely to be what the hypothetical user wants. If I edit a 25 MB video file 10 times reversioning it with a new name and dumping the old ones in the trash they will all still be stored in ram even when I reboot.

There is a reasonable amount of work involved but it would be more efficient if the trash was multisession aware. It would be nice to have an app that could search through archive in all the sessions. Even better would be a more sophisticated tool that could show which sessions any file had been revised in, nice(connected to diff?). That said, I'm still not sure how many users multisession really has so this may be unimportant.
Will
contribute: [url=http://www.puppylinux.org]community website[/url], [url=http://tinyurl.com/6c3nm6]screenshots[/url], [url=http://tinyurl.com/6j2gbz]puplets[/url], [url=http://tinyurl.com/57gykn]wiki[/url], [url=http://tinyurl.com/5dgr83]rss[/url]

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#32 Post by disciple »

OK, thanks for the clarification.

So we modify whatever script saves sessions so that it moves anything in the trash to the archive. Then the problem is finding what you have trashed, and we can either:
  • - move the roxapp folders for the trashed items to the archive folder, but keep some sort of index of them, so we can mount an old session to recover them, or

    - move the roxapp folders for the trashed items to the archive folder, and search the old sessions to find trashed items. This approach would mean you couldn't permanently delete an item from the trash - so if you trash a lot of things, you would have to sort through them all if you want to find something. The advantage would be that it would be simpler when you move to a new multisession disc, as you wouldn't have an index of trashed items in sessions that aren't on the current disc.
Or we could
  • - leave the roxapp folders in the trash, but archive the actual trashed items, and record in the roxapp which session they were archived in. Modify the trashed item roxapps so they know how to restore the file.
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#33 Post by disciple »

I think the second of the three options would be best.
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

User avatar
HairyWill
Posts: 2928
Joined: Fri 26 May 2006, 23:29
Location: Southampton, UK

#34 Post by HairyWill »

I think you are right. I don't think that you can retain a link or reference to the trashed items because you don't know until shutdown what the name of the session will be. If you tried to do that you would need to modify rc.shutdown or more likely functions4puppy to do some sort of fix when the name of the session is decided.

An additional complication is that the boot CD may not be inserted when someone tries to access the trash. You would need to take account of this.

I notice that no-one that currently uses multisession has posted here saying "yes please I really need this".
Will
contribute: [url=http://www.puppylinux.org]community website[/url], [url=http://tinyurl.com/6c3nm6]screenshots[/url], [url=http://tinyurl.com/6j2gbz]puplets[/url], [url=http://tinyurl.com/57gykn]wiki[/url], [url=http://tinyurl.com/5dgr83]rss[/url]

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#35 Post by disciple »

You'd just need a window that says "please insert your Puppy CD and press OK" or something.
I notice that no-one that currently uses multisession has posted here saying "yes please I really need this".
Yes, but even if there are lots of people who actually use multisession, Flash may well be the only one that knows about this conversation.

I guess nothing will happen unless someone takes it on - I'm not going to be doing anything about it anyway.
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

New version

#36 Post by disciple »

OK, in this version the "View summary" sorts the items in the trash by size.
I also updated the help file and made it html.

We should probably change it so the help option just opens the help file.

We still get people asking why they can't see their deleted files in the trash. I wonder if it would help to add the trash help into Puppy's main help system?... I guess it wasn't clear in the trash help before though, so hopefully the update will help :)
Attachments
Trash.tar.gz
(17.13 KiB) Downloaded 985 times
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#37 Post by disciple »

There was a bug in the summary feature - it didn't display files with spaces in the path.
I've fixed that (Thanks for the help HW!), edited the help file a bit more (I made a mistake in it too), and updated the version numbering so it isn't still claiming to be version 0.1.0 from 2005 :)
Attachments
Trash-0.3.2.tar.gz
(17.41 KiB) Downloaded 989 times
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

User avatar
HairyWill
Posts: 2928
Joined: Fri 26 May 2006, 23:29
Location: Southampton, UK

#38 Post by HairyWill »

I have been trying to use the Trash app symlinked from a path with spaces in it. This has identified that the $APPDIR variable is used unquoted in a few places. There were also a couple of places where the $HOME variable was preceded by a /. Here is the diff

Code: Select all

# diff Trash/AppRun AppRun 
34c34
<  aplay $APPDIR/systemmsg.wav
---
>  aplay "$APPDIR/systemmsg.wav"
44c44
< rox -x $APPDIR
---
> rox -x "$APPDIR"
52c52
< rox -x $APPDIR
---
> rox -x "$APPDIR"
101c101
< mkdir "/$HOME/.Trash/$FileName-$$"
---
> mkdir "$HOME/.Trash/$FileName-$$"
123c123
< mv "$m" "/$HOME/.Trash/$FileName-$$/Files"
---
> mv "$m" "$HOME/.Trash/$FileName-$$/Files"
134c134
< {sub("TRASH", trash); print}' $APPDIR/template/temp-AppRun > "/$HOME/.Trash/$FileName-$$/AppRun"
---
> {sub("TRASH", trash); print}' "$APPDIR/template/temp-AppRun" > "/$HOME/.Trash/$FileName-$$/AppRun"
# 

a replacement is attached
Attachments
AppRun.gz
(3 KiB) Downloaded 922 times
Will
contribute: [url=http://www.puppylinux.org]community website[/url], [url=http://tinyurl.com/6c3nm6]screenshots[/url], [url=http://tinyurl.com/6j2gbz]puplets[/url], [url=http://tinyurl.com/57gykn]wiki[/url], [url=http://tinyurl.com/5dgr83]rss[/url]

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#39 Post by disciple »

Ah - sorry about that :oops:
That probably came about because when I first worked on the Trash to make it work with files with spaces I didn't really know what I was doing so I quoted everything, but later on I didn't because I didn't expect anyone to put it somewhere with spaces. The space isn't in the phrase "Recycle Bin" by any chance? :)
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

User avatar
HairyWill
Posts: 2928
Joined: Fri 26 May 2006, 23:29
Location: Southampton, UK

#40 Post by HairyWill »

no worries, it is easy to do, I think that apprun I posted should solve the problem
Will
contribute: [url=http://www.puppylinux.org]community website[/url], [url=http://tinyurl.com/6c3nm6]screenshots[/url], [url=http://tinyurl.com/6j2gbz]puplets[/url], [url=http://tinyurl.com/57gykn]wiki[/url], [url=http://tinyurl.com/5dgr83]rss[/url]

Post Reply