Skip to content
API Documentation
BastionGuard™
RootGuardPage.hpp
Go to the documentation of this file.
1/*
2 * BastionGuard™ RootGuard GTK integration
3 * Copyright (C) 2025–2026 Calogero Scarnà
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6#pragma once
7
8#include "RootGuardClient.hpp"
9
10#include <gtkmm.h>
11
12#include <atomic>
13#include <chrono>
14#include <memory>
15#include <optional>
16#include <queue>
17#include <set>
18#include <string>
19#include <vector>
20
21class RootGuardPage : public Gtk::Box {
22public:
24 ~RootGuardPage() override;
25
26private:
31 void show_next_alert();
37 bool on_auto_refresh();
39
40 Gtk::Box* make_rule_editor(const Glib::ustring& title,
41 const Glib::ustring& description,
42 Gtk::ListBox& list,
43 Gtk::Entry& entry);
44 void add_rule_from_entry(Gtk::Entry& entry, Gtk::ListBox& list);
46 void remove_selected_rule(Gtk::ListBox& list);
47 void mark_rules_dirty();
50 std::vector<std::string> collect_rules(const Gtk::ListBox& list) const;
52
54
55 Gtk::Label title_;
56 Gtk::Label service_value_;
57 Gtk::Label mode_value_;
58 Gtk::Label init_value_;
59 Gtk::Label pid_value_;
60
61 Gtk::Stack page_stack_;
62 Gtk::StackSwitcher page_switcher_;
63
64 Gtk::Switch protection_switch_;
67 Gtk::MenuButton protection_info_button_;
70 Gtk::Button start_button_;
71 Gtk::Button stop_button_;
72 Gtk::Button reload_button_;
73 Gtk::Button restart_button_;
74 Gtk::Button refresh_button_;
75
76 Gtk::Label incidents_title_;
77 Gtk::ScrolledWindow incidents_scroller_;
78 Gtk::ListBox incidents_list_;
79
80 Gtk::CheckButton show_trusted_;
81 Gtk::ScrolledWindow events_scroller_;
82 Gtk::TextView events_view_;
83
84 Gtk::Stack rules_stack_;
85 Gtk::StackSwitcher rules_switcher_;
92 Gtk::Button save_rules_button_;
93 Gtk::Label rules_status_;
94
95 Gtk::Label status_;
96
97 sigc::connection client_update_connection_;
98 sigc::connection auto_refresh_connection_;
103 std::string rules_signature_;
104 std::optional<BastionGuard::RootGuard::Snapshot> last_snapshot_;
105 std::set<std::string> seen_events_;
106 std::set<std::string> dismissed_events_;
107 std::set<std::string> dismissed_paths_;
108 std::set<std::string> notified_paths_;
109 std::queue<BastionGuard::RootGuard::Event> alert_queue_;
110 std::chrono::steady_clock::time_point last_global_burst_alert_shown_{};
111 std::unique_ptr<Gtk::Window> current_alert_;
112 std::shared_ptr<std::atomic_bool> alive_{std::make_shared<std::atomic_bool>(true)};
113};
Gtk::CheckButton show_trusted_
std::optional< BastionGuard::RootGuard::Snapshot > last_snapshot_
Gtk::Entry trusted_executables_entry_
Gtk::Button refresh_button_
std::set< std::string > notified_paths_
Gtk::Label incidents_title_
void on_snapshot(const BastionGuard::RootGuard::Snapshot &snapshot)
std::set< std::string > dismissed_paths_
Gtk::ListBox denied_executables_list_
void on_protection_toggled()
void queue_new_alerts(const BastionGuard::RootGuard::Snapshot &snapshot)
void save_application_rules()
Gtk::Label home_scope_value_
Gtk::Entry denied_executables_entry_
Gtk::Label title_
std::string rules_signature_
Gtk::Button save_rules_button_
sigc::connection client_update_connection_
Gtk::StackSwitcher rules_switcher_
std::set< std::string > seen_events_
void render_incidents(const BastionGuard::RootGuard::Snapshot &snapshot)
void remove_event(const BastionGuard::RootGuard::Event &event)
Gtk::Label mode_value_
Gtk::Button start_button_
void dismiss_alert(const BastionGuard::RootGuard::Event &event)
Gtk::MenuButton protection_info_button_
Gtk::Button stop_button_
Gtk::Label init_value_
std::shared_ptr< std::atomic_bool > alive_
std::vector< std::string > collect_rules(const Gtk::ListBox &list) const
Gtk::Entry trusted_applications_entry_
Gtk::Label service_value_
std::chrono::steady_clock::time_point last_global_burst_alert_shown_
void restore_event(const BastionGuard::RootGuard::Event &event)
void render_events(const BastionGuard::RootGuard::Snapshot &snapshot)
Gtk::Stack page_stack_
Gtk::ListBox trusted_applications_list_
Gtk::ListBox trusted_executables_list_
Gtk::Button restart_button_
sigc::connection auto_refresh_connection_
Gtk::ListBox incidents_list_
Gtk::StackSwitcher page_switcher_
Gtk::Button reload_button_
void populate_application_rules(const BastionGuard::RootGuard::ApplicationRules &rules)
Gtk::Box * make_rule_editor(const Glib::ustring &title, const Glib::ustring &description, Gtk::ListBox &list, Gtk::Entry &entry)
std::queue< BastionGuard::RootGuard::Event > alert_queue_
Gtk::Label system_scope_value_
Gtk::Stack rules_stack_
Gtk::Switch protection_switch_
Gtk::ScrolledWindow events_scroller_
Gtk::Popover protection_info_popover_
Gtk::Label pid_value_
Gtk::Label rules_status_
BastionGuard::RootGuard::Client client_
void add_rule_from_entry(Gtk::Entry &entry, Gtk::ListBox &list)
Gtk::TextView events_view_
void add_installed_application_defaults()
std::unique_ptr< Gtk::Window > current_alert_
Gtk::Label protection_label_
Gtk::Label status_
std::set< std::string > dismissed_events_
void dismiss_event(const BastionGuard::RootGuard::Event &event)
void remove_selected_rule(Gtk::ListBox &list)
Gtk::ScrolledWindow incidents_scroller_