1. Overview
The SnapshotBackendBox module selects the snapshot engine used by BastionGuard Backup.
Its principal responsibilities are:
- Offers RSYNC and BTRFS choices
- Checks BTRFS tool availability
- Explains backend characteristics
- Selects a suitable default repository after backend changes
2. Class Structure and Dependencies
public class SnapshotBackendBox : Gtk.Box
The source imports:
GtkGeeTeeJee.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.CheckButton opt_rsync– CheckButton widget used by the interfaceGtk.CheckButton opt_btrfs– CheckButton widget used by the interfaceGtk.Label lbl_description– label used to display description informationGtk.Window parent_window– parent GTK window used for transient dialogs
4. User Interface Composition
The module directly constructs the following GTK widget types:
Gtk.Box– layout containersGtk.CheckButton– Boolean or mutually exclusive choicesGtk.Expander– collapsible explanatory contentGtk.Label– headings, descriptions, and status textGtk.ScrolledWindow– scrollable content regions
Event-driven behavior is connected through signals such as:
toggled
5. Initialization
SnapshotBackendBox()
public SnapshotBackendBox(Gtk.Window _parent_window)
Initializes the class instance, creates its GTK controls, and prepares the initial state.
6. Central Controller Integration
The module reads or modifies the following Main controller members through the global App object:
App.btrfs_modeApp.try_select_default_device_for_backup
7. Method Reference
build_ui()
private void build_ui()
Constructs the complete GTK widget hierarchy for the component. It creates Gtk.Box where required.
add_opt_rsync()
private void add_opt_rsync(Gtk.Box hbox)
Adds or constructs opt rsync for the current interface or model. It reads or updates central state through App.btrfs_mode. It creates Gtk.CheckButton where required. It connects the toggled signal.
add_opt_btrfs()
private void add_opt_btrfs(Gtk.Box hbox)
Adds or constructs opt btrfs for the current interface or model. It reads or updates central state through App.btrfs_mode. It creates Gtk.CheckButton where required. It connects the toggled signal.
check_for_btrfs_tools()
private bool check_for_btrfs_tools()
Checks for btrfs tools and returns the validation result.
add_description()
private void add_description()
Adds or constructs description for the current interface or model. It creates Gtk.Expander, Gtk.Label, Gtk.ScrolledWindow where required.
update_description()
private void update_description()
Updates description to reflect the current state.
init_backend()
public void init_backend()
Initializes backend state and controls. It reads or updates central state through App.try_select_default_device_for_backup.
refresh()
public void refresh()
Reloads current application state and updates the visible controls. It reads or updates central state through App.btrfs_mode.
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
- Load the current model state into the interface
- React to GTK signals generated by navigation, selections, and action controls
- Read or update central backup and restore state through the global controller
10. Runtime and Security Considerations
- 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
- 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.
