1. Overview
Modal-style connection decision window that presents the requesting application, destination host/IP/port, proxy context, a countdown, and four explicit allow/deny verdict choices.
File role: Implementation. The file contains 265 lines and belongs to the dialogs/AlertDialog.cpp path.
The companion file is dialogs/AlertDialog.hpp.
2. Component Responsibilities
- Implement the behavior declared by the corresponding header or entry-point contract.
- Resolve the best display name and icon for the requesting process
- Build application and destination information
- Detect configured proxy endpoints where relevant
- Start the decision countdown
- Emit the selected Verdict signal
- Apply the default timeout behavior when the countdown expires
3. Dependencies and Integration
Project-level dependencies:
AlertDialog.hpp../util/ProxyDetect.hpp../util/AppResolver.hppglibmm/i18n.hglibmm/main.hgdkmm/pixbuf.h../Resource.hpp
System and library dependencies:
vector
4. Signals and Event Integration
The file exposes or connects the following signal-related elements:
closeBtn->signal_clicked().connect([this]() { emitVerdict(Verdict::DENY_ONCE); });m_allowOnce.signal_clicked().connect(m_allowAlways.signal_clicked().connect(m_denyOnce.signal_clicked().connect(m_denyAlways.signal_clicked().connect(m_timerConn = Glib::signal_timeout().connect(signal_verdict.emit(v);
GTK-facing callbacks must execute on the main UI context. Components with worker threads use dispatchers or idle callbacks to cross the thread boundary.
5. Functions and Methods
The file exposes or implements 7 detected function or method signatures.
1. AlertDialog
AlertDialog::AlertDialog(const std::string& appComm, const std::string& appPath, const std::vector<std::string>& appArgs, const std::string& destHost, const std::string& destIp, uint32_t destPort, int timeoutSecs) : Gtk::Window() , m_timeoutSecs(timeoutSecs) , m_remaining(timeoutSecs)
Implements the alert dialog operation declared by this component.
2. ~AlertDialog
AlertDialog::~AlertDialog()
Releases resources owned by the object and stops any active background integration.
3. buildHeaderBar
void AlertDialog::buildHeaderBar()
Builds and configures the header bar user-interface or internal structure.
4. buildUI
void AlertDialog::buildUI(const std::string& appComm, const std::string& appPath, const std::vector<std::string>& appArgs, const std::string& destHost, const std::string& destIp, uint32_t destPort)
Builds and configures the ui user-interface or internal structure.
5. startCountdown
void AlertDialog::startCountdown()
Starts countdown and activates the associated runtime resources.
6. onTick
bool AlertDialog::onTick()
Handles the tick callback or user event.
7. emitVerdict
void AlertDialog::emitVerdict(Verdict v)
Emits verdict to subscribed components.
6. Runtime Flow
- Resolve the best display name and icon for the requesting process
- Build application and destination information
- Detect configured proxy endpoints where relevant
- Start the decision countdown
- Emit the selected Verdict signal
- Apply the default timeout behavior when the countdown expires
7. Runtime and Security Considerations
- Separates one-time decisions from persistent rules.
- Shows both hostname and numeric IP to reduce destination ambiguity.
- Uses a countdown to avoid indefinitely pending daemon decisions.
8. Error Handling and Operational Notes
- Exceptions are caught locally in one or more operations to prevent application-wide termination.
- Boolean-returning operations use
falseto report recoverable failure.
9. Source Integrity
Relative source path: dialogs/AlertDialog.cpp
SHA-256:
c97ae744837cc5f7ee0ce2b7bcfc927bc653a471c8fe1117671fb2541b3855cc
10. Licensing
The source header identifies this component as distributed under the GNU General Public License version 3. BastionGuard branding and trademarks remain subject to the notices stated in the source file.
