Note: Some code is commented with the message NOT USED BECAUSE FLATPAK REMOVES ACCESS TO DEVICE FILES
. This code shows a handy list of thumb drives that are plugged into the computer. But to shred them, Raider needs administrator access to the device files that correspond with those thumb drives. And that is not possible in flatpak because it is sandboxed. Therefore they are commented out.
- Files supplied on the commandline are opened in
raider_application_open
. It converts the double array of files into aGList
and sends thatGList
to a newly created window. - When the
GAction
to exit is activated, it callsraider_application_try_exit
which queries each open window to exit. If any window returnsTRUE
then shredding is ongoing, and cannot exit. - Files opened in the file chooser are converted into a
GList
and are sent to the active window.
RaiderWindow
handles drag-and-drop. It converts the list of files dragged in and converts it toGList
and sends it to its file loader.raider_window_open_files
is the file loader. It takes aGList
ofGFile
s from the callee. It runs its internal worker functionraider_window_open_files_thread
asynchronously, which in turn calls a function that opens a singleGFile
. That function runs tests on that file, and if it passes, aRaiderFileRow
is created and added to the window.- Whenever a
RaiderFileRow
destroys itself, it callsraider_window_close_file
, which updates the user interface if necessary. - Launching shredding and aborting shredding and adding files are done asynchronously with
GTask
because it can take a while. Seeraider_window_start_shredding
andraider_window_abort_shredding
for more details. - When
RaiderWindow
is queried to exit, it returnsTRUE
if shredding.TRUE
tells GTK+ internally to not call the defaultclose-request
signal handler. Otherwise,FALSE
is returned, andRaiderWindow
is closed by internal system of GTK+. BeforeTRUE
is returned, and ifTRUE
will be returned, a dialog will be shown to the user if he wants to exit. If so, the shredding is aborted, to clean up running processes, and in theraider_window_abort_files_finish
function, the return result from the message dialog that has been passed along is tested, and if it equalsexit
, the window is destroyed.
- When the
Shred
button is activated,RaiderWindow
callsraider_file_row_launch_shredding
on each item it has in itsGtkListBox
. The launch shredding code creates a Corrupt variable, which shreds the code. Progress updates are done when the amount of progress done since that last GUI update is 1%. If it is larger than that, then a function is invoked from the shredding thread to the main context thread to update the gui.