1. Overview
The BackupBox module runs and monitors snapshot creation inside the graphical backup workflow.
Its principal responsibilities are:
- Starts the snapshot operation through the central controller
- Displays progress, transfer statistics, current status, and remaining time
- Supports pause and resume for the active RSYNC task
- Handles BTRFS and RSYNC progress models
2. Class Structure and Dependencies
public class BackupBox : Gtk.Box
The source imports:
GtkGeeXAppTeeJee.LoggingTeeJee.FileSystemTeeJee.JsonHelperTeeJee.ProcessHelperTeeJee.GtkHelperTeeJee.SystemTeeJee.Misc
The GTK inheritance and imported modules allow the component to participate in the application event loop, share the central backup state, and construct native GTK4 controls.
3. Primary Runtime State
The principal fields declared by the module include:
Gtk.Box details_box– container or reusable widget for detailsGtk.Spinner spinner– activity indicator shown while an operation is runningGtk.Label lbl_msg– primary operation message labelGtk.Label lbl_status– detailed status labelGtk.Label lbl_remaining– estimated remaining-time labelGtk.ProgressBar progressbar– visual progress indicator for a long-running taskGtk.Label lbl_unchanged– label used to display unchanged informationGtk.Label lbl_created– label used to display created informationGtk.Label lbl_deleted– label used to display deleted informationGtk.Label lbl_modified– label used to display modified informationGtk.Label lbl_checksum– label used to display checksum informationGtk.Label lbl_size– label used to display size informationGtk.Label lbl_timestamp– label used to display timestamp informationGtk.Label lbl_permissions– label used to display permissions informationGtk.Label lbl_owner– label used to display owner informationGtk.Label lbl_group– label used to display group informationGtk.Window parent_window– parent GTK window used for transient dialogsbool thread_is_running– Boolean state for thread is runningbool thread_status_success– Boolean state for thread status success
4. User Interface Composition
The module directly constructs the following GTK widget types:
Gtk.Box– layout containersGtk.ProgressBar– operation progressGtk.SizeGroup– consistent alignment across labels and valuesGtk.Spinner– indeterminate activity indicators
5. Initialization
BackupBox()
public BackupBox(Gtk.Window _parent_window)
Initializes the class instance, creates its GTK controls, and prepares the initial state. It creates Gtk.Box where required.
6. Central Controller Integration
The module reads or modifies the following Main controller members through the global App object:
App.btrfs_modeApp.create_snapshotApp.progress_textApp.space_check_taskApp.task
7. Method Reference
add_progress_area()
private void add_progress_area()
Adds or constructs progress area for the current interface or model. It creates Gtk.Box, Gtk.ProgressBar, Gtk.Spinner where required.
pause()
public void pause()
Implements the pause operation.
resume()
public void resume()
Implements the resume operation.
add_count_label()
private Gtk.Label add_count_label(Gtk.Box box, string text, ref Gtk.SizeGroup? sg_label, ref Gtk.SizeGroup? sg_value, int add_margin_bottom = 0)
Adds or constructs count label for the current interface or model. It creates Gtk.Box, Gtk.SizeGroup where required.
take_snapshot()
public bool take_snapshot()
Implements the take snapshot operation. It reads or updates central state through App.btrfs_mode, App.progress_text, App.space_check_task, App.task. The long-running work is delegated to a background thread.
take_snapshot_thread()
private void take_snapshot_thread()
Worker-thread routine that performs take snapshot outside the immediate event callback. It reads or updates central state through App.create_snapshot.
8. External Resources and Paths
The component does not directly define protected filesystem paths or external command strings.
9. Data and Event Flow
- Construct the component and initialize its child controls
- Read or update central backup and restore state through the global controller
- Run long-running work through the component worker path
10. Runtime and Security Considerations
- Thread coordination: long-running work is separated from immediate GTK callbacks and UI state must be refreshed on the main loop.
- Shared controller state: the component reads and modifies the global
Appcontroller used by the surrounding workflow. - Signal-driven behavior: GTK callbacks update the model and interface when controls are activated or changed.
11. Implementation Considerations
- Polling loops: some operations wait synchronously while continuing to process GTK events.
- Worker result state: completion and success are communicated through shared fields that must remain consistent with the worker lifecycle.
- Global coupling: the class depends on the process-wide
Appobject rather than receiving a controller through dependency injection.
12. Licensing
The source header contains the following copyright notices:
Copyright 2012-2018 Tony George <teejeetech@gmail.com>
The file is distributed under the GNU General Public License version 2 or later.
