1. Overview
The DeleteWindow module implements the multi-step graphical workflow for snapshot deletion.
Its principal responsibilities are:
- Collects selected snapshots
- Runs the deletion page
- Shows the final result
- Supports embedded and standalone modes
2. Class Structure and Dependencies
public class DeleteWindow : Gtk.Window
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.Box vbox_main– primary vertical layout containerGtk.Stack page_stack– GTK stack containing workflow pagesint current_page– index of the currently active workflow pageGtk.Box bbox_action– Box widget used by the interfaceSnapshotListBox snapshot_list_box– container or reusable widget for snapshot listDeleteBox delete_box– container or reusable widget for deleteDeleteFinishBox delete_finish_box– container or reusable widget for delete finishGtk.Button btn_prev– button used to trigger the corresponding prev actionGtk.Button btn_next– button used to trigger the corresponding next actionGtk.Button btn_hide– button used to trigger the corresponding hide actionGtk.Button btn_cancel– button used to trigger the corresponding cancel actionGtk.Button btn_close– button used to trigger the corresponding close actionuint tmr_init– numeric state for tmr initint def_width– numeric state for def widthint def_height– numeric state for def heightbool success– Boolean state for successbool embedded_mode– whether the component is hosted inside another windowGee.ArrayList<Gtk.Image> themed_img_list– collection of themed img list itemsGee.ArrayList<string> themed_img_name– collection of themed img name itemsGee.ArrayList<int> themed_img_size– collection of themed img size items
4. User Interface Composition
The module directly constructs the following GTK widget types:
Gtk.Box– layout containersGtk.Label– headings, descriptions, and status textGtk.Stack– multi-page content navigation
Event-driven behavior is connected through signals such as:
clicked
close_request
5. Initialization
DeleteWindow()
public DeleteWindow(bool embedded = false)
Initializes the class instance, creates its GTK controls, and prepares the initial state. It creates Gtk.Box, Gtk.Label, Gtk.Stack where required. It connects the close_request signal.
6. Workflow Pages and Enumerations
Tabs
The enumeration defines the following states:
SNAPSHOT_LIST
DELETE
DELETE_FINISH
These values provide stable identifiers for navigation, validation, and page-specific initialization.
7. Central Controller Integration
The module reads or modifies the following Main controller members through the global App object:
App.delete_file_taskApp.delete_listApp.thread_delete_running
8. Operational Workflow
- Load repository snapshots into SnapshotListBox
- Validate that at least one snapshot is selected
- Copy selections into the central delete list
- Run DeleteBox until the worker finishes
- Display DeleteFinishBox
9. Method Reference
init_delayed()
private bool init_delayed()
Performs initialization scheduled after the window has been presented.
on_close_request()
private bool on_close_request()
Handles a request to close the window and coordinates cleanup or state persistence.
create_actions()
private void create_actions()
Creates action buttons and connects their callbacks. It reads or updates central state through App.delete_file_task, App.delete_list. It creates Gtk.Box where required. It connects the clicked signal.
action_buttons_set_initial_visibility()
private void action_buttons_set_initial_visibility(bool visible)
Implements the action buttons set initial visibility operation.
go_first()
private void go_first()
Moves the workflow to its first page. It reads or updates central state through App.delete_list, App.thread_delete_running.
go_prev()
private void go_prev()
Moves to the previous valid workflow page.
go_next()
private void go_next()
Validates the current state and advances to the next workflow page. It reads or updates central state through App.delete_list.
initialize_tab()
private void initialize_tab()
Refreshes and initializes the page that has just become active.
validate_current_tab()
private bool validate_current_tab()
Validates the active workflow page before navigation continues.
set_page()
private void set_page(int page)
Activates a specific workflow page and updates navigation state.
detach_root_widget()
public Gtk.Widget detach_root_widget()
Detaches and returns the component root widget for embedding in another window.
themed_icon()
private Gtk.Image themed_icon(string icon_name, int size)
Creates a themed GTK image at the requested size.
reload_themed_icons()
public void reload_themed_icons()
Reloads icons after a theme change.
10. External Resources and Paths
The component does not directly define protected filesystem paths or external command strings.
11. Data and Event Flow
- Construct the component and initialize its child controls
- React to GTK signals generated by navigation, selections, and action controls
- Read or update central backup and restore state through the global controller
12. 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.
- Reusable presentation: the component can be hosted as a standalone window or embedded inside the main navigation stack.
13. Implementation Considerations
- Global coupling: the class depends on the process-wide
Appobject rather than receiving a controller through dependency injection. - Embedding contract: parent containers must use
detach_root_widget()only after the window has initialized its root widget.
14. 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.
