app_window.hpp

1. Overview

The app_window.hpp file implements the top-level GTK window shell and its application-level window behavior.

This is an interface and data-contract file. It declares the public and internal types used by this subsystem, allowing implementation files and callers to share a stable compile-time contract.

Its paired source or interface file is app_window.cpp.

Primary responsibilities:

  • Construct the application window
  • Connect window actions and lifecycle signals
  • Coordinate the principal content widget or main window

2. File Identity and Scope

  • Source path: src/app_window.hpp
  • Language: C++
  • File role: interface and data-contract file
  • Physical lines: 76
  • Non-empty lines: 67
  • SHA-256: 35f4e4a762f0263faec02d8e7ac5e8498b97961e32241a491fa447f9ad014bfc

The declarations in this file use the global namespace.


3. Dependencies

3.1 Project Headers

  • models.hpp
  • scan_worker.hpp
  • recovery_worker.hpp

3.2 Standard and External Headers

  • giomm.h
  • gtkmm.h

These dependencies define the file’s compile-time integration with the recovery engine, GTK interface, on-disk format decoders, operating-system services, or C++ standard library.


4. Declared Types

  • class ResultRow derives from or specifies public Glib::Object.
  • class AppWindow derives from or specifies public Gtk::ApplicationWindow.

5. Constants and Configuration Values

No preprocessor or compile-time constants were detected as top-level declarations in this file.


6. Data Members and Persistent State

The interface declares the following state-bearing members:

  • Glib::Property<Glib::ustring> offset
  • Glib::Property<Glib::ustring> size
  • Glib::Property<Glib::ustring> type
  • Glib::Property<Glib::ustring> source
  • Glib::Property<Glib::ustring> detail
  • Glib::Property<Glib::ustring> confidence
  • Gtk::Box root_ {Gtk::Orientation::VERTICAL,8}
  • Gtk::Box toolbar_ {Gtk::Orientation::HORIZONTAL,8}
  • Gtk::Button btn_open_
  • Gtk::Button btn_scan_
  • Gtk::Button btn_save_report_
  • Gtk::Button btn_recover_
  • Gtk::Entry entry_path_
  • Gtk::Label status_
  • Gtk::Paned paned_ {Gtk::Orientation::VERTICAL}
  • Gtk::ScrolledWindow results_scroller_
  • Gtk::ScrolledWindow logs_scroller_
  • Gtk::ColumnView column_view_
  • Gtk::TextView log_view_
  • Glib::RefPtr<Gtk::TextBuffer> log_buffer_
  • Glib::RefPtr<Gio::ListStore<ResultRow>> store_
  • Glib::RefPtr<Gtk::SingleSelection> selection_model_
  • Glib::RefPtr<Gtk::FileDialog> file_dialog_
  • Glib::RefPtr<Gtk::FileDialog> save_dialog_
  • Glib::RefPtr<Gtk::FileDialog> output_dialog_
  • std::string selected_path_
  • std::string output_dir_
  • ScanReport last_report_
  • ScanWorker worker_
  • RecoveryWorker recovery_worker_

These members hold configuration, parser context, UI widgets, source references, progress state, recovered metadata, or temporary resources according to the owning type.


7. API and Function Inventory

The following callable interfaces or definitions were detected:

  • static Glib::RefPtr<ResultRow> create(const Glib::ustring&offset,const Glib::ustring&size,const Glib::ustring&type,const Glib::ustring&source,const Glib::ustring&detail,const Glib::ustring&confidence) – Implements the operation identified by this API and updates or returns the associated state.
  • ~AppWindow()override – Destroys the object and releases resources owned by the instance.
  • void setup_columns() – Implements the operation identified by this API and updates or returns the associated state.
  • void add_text_column(const Glib::ustring&title,const char*property_name) – Updates the relevant collection or range state.
  • void on_choose_file() – Handles the related event, callback or user action.
  • void on_file_chosen(const Glib::RefPtr<Gio::AsyncResult>&result) – Handles the related event, callback or user action.
  • void on_scan_clicked() – Handles the related event, callback or user action.
  • void on_scan_completed(const ScanReport&report) – Handles the related event, callback or user action.
  • void on_save_report_clicked() – Handles the related event, callback or user action.
  • void on_report_file_chosen(const Glib::RefPtr<Gio::AsyncResult>&result) – Handles the related event, callback or user action.
  • void on_choose_output_folder() – Handles the related event, callback or user action.
  • void on_output_folder_chosen(const Glib::RefPtr<Gio::AsyncResult>&result) – Handles the related event, callback or user action.
  • void on_recovery_completed(const RecoveryResult&result) – Handles the related event, callback or user action.
  • void append_log(const std::string&line) – Updates the relevant collection or range state.
  • static std::string human_size(uint64_t bytes) – Implements the operation identified by this API and updates or returns the associated state.
  • static std::string human_offset(uint64_t bytes) – Implements the operation identified by this API and updates or returns the associated state.

8. Operational Flow

The subsystem represented by this file normally participates in the following flow:

  1. Construct the application window.
  2. Connect window actions and lifecycle signals.
  3. Coordinate the principal content widget or main window.
  4. Expose or execute the detected APIs: create, ~AppWindow, setup_columns, add_text_column, on_choose_file, on_file_chosen, on_scan_clicked, on_scan_completed, on_save_report_clicked, on_report_file_chosen, on_choose_output_folder, on_output_folder_chosen, on_recovery_completed, append_log, human_size, human_offset.
  5. Return explicit results, progress data, recovered records, or diagnostics to the calling layer.

9. Validation and Error Handling

  • Byte offsets, sizes and lengths must be validated before arithmetic and before every read to avoid overflow and out-of-bounds access.
  • Input and output paths require existence checks, permission handling and safe destination construction.

10. Runtime, Concurrency, and Resource Management

  • GTK lifecycle: widget ownership, signal connections and main-thread affinity must be preserved.
  • GTK objects and callbacks must obey main-thread affinity and signal lifetime rules.

11. Security and Data-Recovery Considerations

  • Recovery code should prefer read-only source access and avoid writing to the original damaged medium.
  • Raw devices and image files are treated as untrusted binary input; every offset and length must remain bounded by the source size.
  • Recovered names and destination paths must be sanitized to prevent directory traversal and accidental overwrite outside the selected export directory.

12. Implementation Considerations

  • Changes to public declarations can affect every translation unit that includes this header and should preserve binary and source compatibility where required.
  • State-bearing members should have explicit ownership and initialization semantics, especially for references, pointers, file descriptors and GTK widgets.
  • Large-device arithmetic uses 64-bit values; additions and multiplications should be checked before use as offsets or allocation sizes.

13. Integration with the Recovery Pipeline

  • The file belongs to the application startup or presentation layer.
  • It receives or presents data produced by scan and recovery services.
  • Long-running operations should remain delegated to worker classes rather than blocking the GTK main loop.

14. Licensing and Provenance

No explicit copyright or software-license statement was detected in the opening section of this individual file. Distribution terms should therefore be verified against the project-level license and repository metadata.

The SHA-256 value in this document can be used to associate the generated documentation with the exact source version analyzed.