Skip to content
API Documentation
BastionGuard™
Utils.hpp
Go to the documentation of this file.
1/*
2 * BastionGuard™
3 * Copyright (C) 2025–2026 Calogero Scarnà
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, version 3.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 *
17 * BastionGuard™ is a trademark of Calogero Scarnà.
18 * The BastionGuard™ name and branding are not licensed under the GPL.
19 */
20
21#pragma once
22#include <string>
23#include <gtkmm/window.h>
24#include <gtkmm/messagedialog.h>
25
26class Utils {
27public:
28 static void notify(const std::string& title, const std::string& msg);
29
30 // Mostra un Gtk::MessageDialog gestendone correttamente il ciclo di
31 // vita in GTK4. In GTK4 Gtk::Dialog::run() non esiste più e present()
32 // è asincrono: un MessageDialog allocato sullo stack viene distrutto
33 // appena la funzione ritorna, facendo sparire (o non comparire) la
34 // finestra. Questo helper alloca il dialog sull'heap e lo libera
35 // automaticamente alla risposta dell'utente.
36 static void show_message(
37 Gtk::Window* parent,
38 const std::string& message,
39 Gtk::MessageType type = Gtk::MessageType::INFO,
40 const std::string& secondary = std::string());
41};
static void notify(const std::string &title, const std::string &msg)
Definition Utils.cpp:26
static void show_message(Gtk::Window *parent, const std::string &message, Gtk::MessageType type=Gtk::MessageType::INFO, const std::string &secondary=std::string())
Definition Utils.cpp:33