Move deleted pictures to Trash / Recycle Bin
An award-winning drawing program for children of all ages
Brought to you by:
wkendrick
On platforms/environments that have a temporary storage location for deleted files (Recycle Bin on Windows, Trash on Mac OS X, and freedesktop.org (KDE/Dolphin/Konqueror, GNOME/Nautilus, Xfce/Thunar)), the "Delete" option in Tux Paint's "Open" dialog could move the deleted picture & associated files to the temporary storage (Trash).
For xdg, see: http://www.ramendik.ru/docs/trashspec.html and http://code.google.com/p/trash-cli/
Some notes re: xdg from 'auke' in the #meego IRC channel:
http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
$XDG_DATA_HOME defines the base directory relative to which user specific data files should be stored. If $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used.
so, The location of Trash is: ${XDG_DATA_HOME:-$HOME/.local/share}/Trash
Freedesktop.org version implemented.
To-do: Windows and Mac OS X.
dbus-send used to tell KDE when trash:/ needs to be re-reviewed (e.g., update trash icon on panel or desktop).
To-do:
* Make sure trash icons in other freedesktop.org-compatible environments (e.g., GNOME; also xcfe? others?) also get updated, somehow.
* Figure out how to do this in Windows (95 thru 7, if possible!)
* Figure out how to do this on Mac OS X
* Figure out how to do this on Haiku
* Expose and document 'UNLINK_ONLY' #define that can be used to revert Tux Paint back to the unlink() method (rather than only unlink()'ing if all else fails), which may be useful for some platforms (mobile?)
Still to-do:
* macOS (@vindaci)
* Haiku (@begasus)
Anything else really worth worrying about?
macOS done:
https://sourceforge.net/p/tuxpaint/tuxpaint/ci/98198591b54d8cba294588186fe62ce12bcdfab1/
Took the liberty of opening https://github.com/haikuports/haikuports/issues/10568
WIP https://sourceforge.net/p/tuxpaint/tuxpaint/ci/3c5303563a506a8a9066ae26c2bf072655ce4826/
Haiku done, will be in 0.9.33.
@perepujal I see on Android there is also the concept of Trash, which i can access from a "Files" app. Photos I have taken and subsequently chosen to "Delete" (trash can icon when viewing the photo) appear there.
I think it would make sense to place drawings that are removed within Tux Paint (via the Open dialog's "Erase" option) in there, as well -- so they may be recovered later, if necessary. Therefore, I'll keep this ticket open until we can do that (or decide it's not possible -- hopefully that won't be the case?). At that point, we'll have all major currently-supported platforms using their Trash instead of simply
unlink()'ing -- Windows, macOS, XDG, Haiku, Android. :)AFAIK there is not a Trash can in AOSP and each maker or each app tries to do their own method, either using "services"(cloud, backup) or a dedicated hiden directory.
I think we could implement something using a dedicated directory...
Searching around, it sounds like newer Android OS offers a way to view "trash" files, kind of...? https://www.androidpolice.com/2020/06/17/google-added-a-hidden-trash-can-to-android-11-for-deleted-files/
Admittedly, my eyes glaze over whenever I start trying to look into any kind of mobile app development these days.