1. Overview
The DashboardPage.hpp header defines the DashboardPage class, a GTKmm (GTK4) UI component responsible for presenting a real-time operational overview of BastionGuard.
The dashboard aggregates:
- Antivirus on-access status
- Signature database version and date
- Anti-Ransomware and Anti-Phishing state
- Recent on-access log events
- Application update availability
The page is designed as a visual summary layer that reflects backend state without directly managing security services.
2. Dependencies and Includes
#include <gtkmm.h>
#include <string>
- gtkmm.h – GTK4 C++ widgets, signals, timers
- <string> – log paths and status strings
3. Class Declaration and Scope
class DashboardPage : public Gtk::Box
The class derives from Gtk::Box, making it suitable for embedding inside a notebook page or main application container.
It encapsulates both UI composition and periodic refresh logic.
4. Public Interface
4.1 Constructor
DashboardPage();
Initializes layout, builds dashboard cards, connects timers, and prepares asynchronous update checks.
4.2 Log-Based Update (Explicit)
void update_from_logs(const std::string& log_path,
const Glib::ustring& db_version,
bool on_access_enabled);
Updates dashboard content using:
- Path to ClamAV logs
- Database version string
- On-access scanning state
Intended for external invocation by higher-level controllers.
4.3 Log-Based Update (Automatic)
bool update_from_logs();
Convenience overload that retrieves necessary information internally (via Backend or log inspection) and refreshes the UI.
5. UI Components
5.1 Layout Structure
Gtk::Label lbl_title_;
Gtk::Grid grid_cards_;
- lbl_title_ – dashboard title header
- grid_cards_ – responsive grid layout for information cards
5.2 Information Cards
Gtk::Frame* card_status_;
Gtk::Frame* card_db_version_;
Gtk::Frame* card_db_date_;
Gtk::Frame* card_logs_;
Each card represents a visually isolated status block.
5.3 Status Labels
Gtk::Label lbl_status_;
Gtk::Label lbl_db_version_;
Gtk::Label lbl_db_date_;
Gtk::Label lbl_ransomware_status_;
Gtk::Label lbl_phishing_status_;
Labels reflect runtime state of:
- General system status
- Signature DB version
- Signature DB last update date
- Anti-Ransomware engine
- Anti-Phishing engine
5.4 On-Access Log View
Gtk::TextView txt_onaccess_report_;
Glib::RefPtr<Gtk::TextBuffer> buf_onaccess_report_;
Displays filtered real-time ClamAV on-access events and scan results.
5.5 Footer and Update Status
Gtk::Box* footer_box_;
Gtk::Label lbl_update_status_;
Provides application update state feedback and bottom-level status messaging.
6. Update Checking Mechanism
sigc::connection update_check_timer_;
void check_updates_async();
bool on_update_check_timer();
void set_update_status(const std::string& state);
bool update_check_in_progress_;
- update_check_timer_ – periodic timer connection
- check_updates_async() – performs asynchronous version check
- on_update_check_timer() – timer callback
- set_update_status() – updates UI status label
- update_check_in_progress_ – prevents concurrent checks
7. Periodic Refresh
sigc::connection refresh_timer_;
Timer used to periodically refresh logs and status indicators without blocking the GTK main loop.
8. Card Factory Helper
Gtk::Frame* make_card(const std::string& icon_path,
Gtk::Widget& content,
const Glib::ustring& title);
Utility method that builds a standardized dashboard card with:
- Icon
- Title
- Content widget
Ensures visual consistency and reusable card layout pattern.
9. Runtime and Security Considerations
- Non-blocking UI: update checks and refresh timers must avoid blocking the GTK main loop.
- Concurrency control:
update_check_in_progress_prevents overlapping asynchronous operations. - Read-only presentation layer: dashboard does not modify security services; it reflects backend state.
- Log safety: displayed logs should be filtered to avoid rendering untrusted content.
- Signal-driven design: timers use
sigc::connectionfor clean lifecycle management.