1. Overview
The UsersBox module configures per-user home-directory inclusion rules.
Its principal responsibilities are:
- Lists non-system user accounts
- Supports excluding all, including hidden files, or including all user data
- Handles encrypted-home patterns
- Controls BTRFS @home inclusion for backup or restore
2. Class Structure and Dependencies
public class UsersBox : 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.ListBox listbox– GTK list used to render selectable rowsGtk.ScrolledWindow scrolled_treeview– ScrolledWindow widget used by the interfaceGtk.Window parent_window– parent GTK window used for transient dialogsExcludeBox exclude_box– custom exclusion settings pageGtk.Box box_btrfs– container or reusable widget for btrfsGtk.Label lbl_message– descriptive page or result messageGtk.CheckButton chk_include_btrfs_home– check button controlling include btrfs homebool restore_mode– whether the widget is configuring restore rather than backup
4. User Interface Composition
The module directly constructs the following GTK widget types:
Gtk.Box– layout containersGtk.CheckButton– Boolean or mutually exclusive choicesGtk.Label– headings, descriptions, and status textGtk.ListBox– dynamic selectable rowsGtk.ListBoxRow– custom list rowsGtk.ScrolledWindow– scrollable content regions
Event-driven behavior is connected through signals such as:
toggled
5. Initialization
UsersBox()
public UsersBox(Gtk.Window _parent_window, ExcludeBox _exclude_box, bool _restore_mode)
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.current_system_usersApp.exclude_list_userApp.include_btrfs_home_for_backupApp.include_btrfs_home_for_restore
7. Method Reference
init_listbox()
private void init_listbox()
Initializes listbox state and controls. It creates Gtk.ListBox, Gtk.ScrolledWindow where required.
user_patterns()
private string[] user_patterns(SystemUser user)
Implements the user patterns operation.
apply_user_mode()
private void apply_user_mode(SystemUser user, string mode)
Applies user mode to the active state. It reads or updates central state through App.exclude_list_user.
create_user_row()
private Gtk.Widget create_user_row(SystemUser user)
Creates user row required by the workflow. It reads or updates central state through App.exclude_list_user. It creates Gtk.Box, Gtk.CheckButton, Gtk.Label, Gtk.ListBoxRow where required. It connects the toggled signal.
init_btrfs_home_option()
private void init_btrfs_home_option(Gtk.Box box)
Initializes btrfs home option state and controls. It reads or updates central state through App.include_btrfs_home_for_backup, App.include_btrfs_home_for_restore. It creates Gtk.CheckButton where required. It connects the toggled signal.
refresh()
public void refresh()
Reloads current application state and updates the visible controls. It reads or updates central state through App.btrfs_mode, App.include_btrfs_home_for_backup, App.include_btrfs_home_for_restore.
refresh_treeview()
private void refresh_treeview()
Rebuilds the visible list from the current model state. It reads or updates central state through App.current_system_users.
8. External Resources and Paths
The source references the following relevant paths, command fragments, or resource identifiers:
/home/.ecryptfs/%s/***
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 applicable licensing terms are defined by the source-file header and the containing BastionGuard Backup project.
