AlertDialog.hpp

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: Header Interface. The file contains 71 lines and belongs to the dialogs/AlertDialog.hpp path.

The companion file is dialogs/AlertDialog.cpp.


2. Component Responsibilities

  • Declare the component API, owned state, callbacks, and data structures.
  • 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:

  • gtkmm.h

System and library dependencies:

  • string
  • cstdint
  • vector

4. Declared Types

AlertDialog

Declares a class derived from or associated with public Gtk::Window.

Verdict

Defines the following closed set of values:

  • ALLOW_ONCE
  • ALLOW_ALWAYS
  • DENY_ONCE
  • DENY_ALWAYS

5. Owned State and UI Members

User-interface members

  • Gtk::Box m_vbox { Gtk::Orientation::VERTICAL, 16 };
  • Gtk::Box m_infoBox { Gtk::Orientation::VERTICAL, 8 };
  • Gtk::Box m_btnBox { Gtk::Orientation::HORIZONTAL, 6 };
  • Gtk::Image m_appIcon;
  • Gtk::Label m_appName;
  • Gtk::Label m_appPath;
  • Gtk::Label m_hostLabel;
  • Gtk::Label m_ipLabel;
  • Gtk::Label m_portLabel;
  • Gtk::ProgressBar m_countdown;
  • Gtk::Button m_allowOnce;
  • Gtk::Button m_allowAlways;
  • Gtk::Button m_denyOnce;
  • Gtk::Button m_denyAlways;

Threading, dispatch, and callback state

  • sigc::connection m_timerConn;

Data and configuration state

  • int m_timeoutSecs;
  • int m_remaining;

6. Signals and Event Integration

The file exposes or connects the following signal-related elements:

  • sigc::signal<void(Verdict)> signal_verdict;

GTK-facing callbacks must execute on the main UI context. Components with worker threads use dispatchers or idle callbacks to cross the thread boundary.


7. Functions and Methods

The file exposes or implements 7 detected function or method signatures.

1. 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 = 15)

Implements the alert dialog operation declared by this component.

2. ~AlertDialog

~AlertDialog() override

Releases resources owned by the object and stops any active background integration.

3. buildHeaderBar

void buildHeaderBar()

Builds and configures the header bar user-interface or internal structure.

4. buildUI

void 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 startCountdown()

Starts countdown and activates the associated runtime resources.

6. onTick

bool onTick()

Handles the tick callback or user event.

7. emitVerdict

void emitVerdict(Verdict v)

Emits verdict to subscribed components.


8. Runtime Flow

  1. Resolve the best display name and icon for the requesting process
  2. Build application and destination information
  3. Detect configured proxy endpoints where relevant
  4. Start the decision countdown
  5. Emit the selected Verdict signal
  6. Apply the default timeout behavior when the countdown expires

9. 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.

10. Error Handling and Operational Notes

  • Errors are propagated through the return type, callbacks, or the owning controller.

11. Source Integrity

Relative source path: dialogs/AlertDialog.hpp

SHA-256:

5b2391d78926dc82b5f9875e402ae64ea58e649f4e033d7e596aa02b3384248f

12. 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.