Skip to content
API Documentation
BastionGuard™
Utils Class Reference

#include <Utils.hpp>

Static Public Member Functions

static void notify (const std::string &title, const std::string &msg)
static void show_message (Gtk::Window *parent, const std::string &message, Gtk::MessageType type=Gtk::MessageType::INFO, const std::string &secondary=std::string())

Detailed Description

Definition at line 26 of file Utils.hpp.

Member Function Documentation

◆ notify()

void Utils::notify ( const std::string & title,
const std::string & msg )
static

Definition at line 26 of file Utils.cpp.

26 {
27 GNotification* n = g_notification_new(title.c_str());
28 g_notification_set_body(n, msg.c_str());
29 GApplication* app = g_application_get_default();
30 if (app) g_application_send_notification(app, nullptr, n);
31}

◆ show_message()

void Utils::show_message ( Gtk::Window * parent,
const std::string & message,
Gtk::MessageType type = Gtk::MessageType::INFO,
const std::string & secondary = std::string() )
static

Definition at line 33 of file Utils.cpp.

38{
39 // Heap-allocato: vive finché l'utente non risponde. Si auto-distrugge
40 // nella callback di signal_response, evitando il classico bug GTK4 del
41 // dialog stack-local che sparisce subito.
42 Gtk::MessageDialog* dlg = parent
43 ? new Gtk::MessageDialog(*parent, message, /*use_markup*/false,
44 type, Gtk::ButtonsType::OK, /*modal*/true)
45 : new Gtk::MessageDialog(message, /*use_markup*/false,
46 type, Gtk::ButtonsType::OK, /*modal*/true);
47
48 if (!secondary.empty())
49 dlg->set_secondary_text(secondary);
50
51 dlg->signal_response().connect([dlg](int) {
52 dlg->hide();
53 delete dlg;
54 });
55
56 dlg->present();
57}

Referenced by SettingsPage::build_options_tab(), BastionGuard::wizard::WizardWindow::build_pages(), ScanPage::cloudCheckMalwareBazaarWorker(), BastionGuard::wizard::WizardWindow::finish_execution(), FirewallChoiceDialog::FirewallChoiceDialog(), ScanPage::handleInfectedFiles(), ScanPage::handleInfectedFileWithName(), Backend::moveToQuarantine(), BastionGuard::wizard::WizardWindow::on_finish(), SambaPage::onAddDir(), SettingsPage::saveAdvancedConfig(), SambaPage::saveConfig(), AntiRansomwarePage::sendAlert(), and ScanPage::showAlertWindow().


The documentation for this class was generated from the following files: