44 :
vbox(Gtk::Orientation::VERTICAL, 15),
51{
54
55
56 set_title("");
57 set_default_size(520, 260);
58 set_resizable(false);
59 set_modal(true);
60
61 auto ctx = get_style_context();
62 ctx->add_class("app-dialog");
63 ctx->add_class("main-window");
64 ctx->add_class("app-window");
65
66
67 try {
68 auto css = Gtk::CssProvider::create();
70 Gtk::StyleContext::add_provider_for_display(
71 Gdk::Display::get_default(), css,
72 GTK_STYLE_PROVIDER_PRIORITY_APPLICATION
73 );
74 } catch (...) {
75 std::cerr <<
_(
"Errore caricamento CSS\n");
76 }
77
78 auto *header = Gtk::make_managed<Gtk::HeaderBar>();
79 header->set_show_title_buttons(false);
80 header->add_css_class("custom-headerbar");
81
82 auto *close_box = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::HORIZONTAL);
83 close_box->set_margin_end(6);
84
85 try {
86 auto px = Gdk::Pixbuf::create_from_file(
resource(
"icon-close.png"), 28, 28,
true);
87 auto *btn = Gtk::make_managed<Gtk::Button>();
88 btn->set_child(*Gtk::make_managed<Gtk::Image>(px));
89 btn->add_css_class("header-button");
90 btn->signal_clicked().connect([this]() { hide(); });
91 close_box->append(*btn);
92 } catch (...) {
93 std::cerr <<
_(
"Icona X non trovata\n");
94 }
95
96 header->pack_end(*close_box);
97
98 auto *header_wrapper = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::VERTICAL);
99 header_wrapper->append(*header);
100 set_titlebar(*header_wrapper);
101
104
108
113
114 auto *buttonBox = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::VERTICAL, 10);
115 buttonBox->set_halign(Gtk::Align::CENTER);
116
119
122
125
126 if (!cmd.empty()) {
128 Glib::ustring::compose(
129 _(
"Installa firewall (%1)"),
130 cmd
131 )
132 );
134 }
135 }
136
138
141 vbox.set_halign(Gtk::Align::CENTER);
142
145 vbox.append(*buttonBox);
146
147
150 hide();
151 });
152
153 ufwButton.signal_clicked().connect([
this]() {
155 hide();
156 });
157
160 this,
161 _(
"Per installare il firewall esegui il comando:\n\n") +
163 Gtk::MessageType::INFO
164 );
165 });
166
168 hide();
169 });
170
171}
static std::string firewall_choice_resolve_theme_css()
sigc::signal< void(FirewallType)> signal_firewall_selected
Gtk::Label descriptionLabel
Gtk::Button firewalldButton
Gtk::Button installButton
static bool isUfwPresent()
static bool isFirewalldPresent()
static FirewallType detectFirewall()
static std::string detectDistro()
static std::string getInstallCommand(const std::string &distro, bool preferFirewalld=true)
static void show_message(Gtk::Window *parent, const std::string &message, Gtk::MessageType type=Gtk::MessageType::INFO, const std::string &secondary=std::string())
std::string resource(const std::string &rel)