Skip to content
API Documentation
BastionGuard™
LogPage.cpp
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#include "Resource.hpp"
22#include "LogPage.hpp"
23#include "Backend.hpp"
24
26: Gtk::Box(Gtk::Orientation::VERTICAL)
27{
28 textView.set_editable(false);
29 textView.set_monospace(true);
30
31 buffer = Gtk::TextBuffer::create();
32 textView.set_buffer(buffer);
33
34 auto scrolled = Gtk::make_managed<Gtk::ScrolledWindow>();
35 scrolled->set_child(textView);
36 scrolled->set_expand(true);
37
38 append(*scrolled);
39
40 Glib::signal_timeout().connect_seconds(
41 sigc::mem_fun(*this, &LogPage::update_logs), 5);
42}
43
45 auto logs = Backend::getClamonaccLogs();
46
47 Glib::ustring text;
48 for (auto& line : logs) {
49 text += line + "\n";
50 }
51
52 buffer->set_text(text);
53
54 return true;
55}
static std::vector< std::string > getClamonaccLogs()
Definition Backend.cpp:505
Glib::RefPtr< Gtk::TextBuffer > buffer
Definition LogPage.hpp:30
bool update_logs()
Definition LogPage.cpp:44
Gtk::TextView textView
Definition LogPage.hpp:29
LogPage()
Definition LogPage.cpp:25