You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ubl-settings-bootloader/source/ubl-settings-bootloader.cc

1265 lines
49 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include "ubl-settings-bootloader.h"
using namespace std;
string path_app = "/usr/bin/";
string path_glade= "/usr/share/ubl-settings-bootloader/ui/ubl-settings-bootloader.glade";
string path_css = "/usr/share/ubl-settings-bootloader/css/ubl-settings-bootloader.css";
string app_name = "ubl-settings-bootloader";
string path_resources = "/usr/share/ubl-settings-bootloader";
const string path_img_head_background = "/usr/share/ubl-settings-bootloader/images/logo-background.png";
int socket_ext_id_I = 0;
int socket_trd_id_I = 0;
string version_application = "1.0";
CmdArgParser::CmdArgParser(const std::string& p_name, const std::string& p_description, const std::string& p_help)
: Glib::OptionGroup{p_name, p_description, p_help} {
Glib::OptionEntry socketIDArg;
socketIDArg.set_long_name("socket-id");
socketIDArg.set_flags(Glib::OptionEntry::FLAG_IN_MAIN);
socketIDArg.set_description("Settings manager socket");
Glib::OptionEntry socketExtId;
socketExtId.set_long_name("socket-ext-id");
socketExtId.set_flags(Glib::OptionEntry::FLAG_IN_MAIN);
socketExtId.set_description("Settings manager secondary socket");
Glib::OptionEntry socketTrdId;
socketTrdId.set_long_name("socket-trd-id");
socketTrdId.set_flags(Glib::OptionEntry::FLAG_IN_MAIN);
socketTrdId.set_description("Settings manager secondary socket");
add_entry(socketIDArg, m_socketID);
add_entry(socketExtId, socket_ext_id_I);
add_entry(socketTrdId, socket_trd_id_I);
}
::Window CmdArgParser::GetSocketID() const{
return m_socketID;
}
SettingsPlug::SettingsPlug(::Window p_socketID, Glib::RefPtr<Gtk::Builder> builder)
: Gtk::Plug{p_socketID} {
MainWindow* wnd = nullptr;
builder->get_widget_derived("window", wnd);
builder->get_widget("plugBox", plugBox);
plugBox->get_parent()->remove(*plugBox);
add(*plugBox);
show_all_children();
}
int MainWindow::check_root() {
if (geteuid() != 0) {
//lblMessageSudo->set_text(_("The program must be run with \nsuperuser privileges!"));
//mess_sudo->show();
return 1;
}
return 0;
}
MainWindow::MainWindow(BaseObjectType* obj, Glib::RefPtr<Gtk::Builder> const& builder)
: Gtk::ApplicationWindow(obj), builder{builder} {
this->builder = builder;
this->settings();
}
MainWindow::MainWindow(Glib::RefPtr<Gtk::Builder> const& builder) {
this->builder = builder;
this->settings();
}
void MainWindow::settings(){
map_cmd_error[""] = "";
this->get_builder();
this->localization();
this->add_CSS();
Gtk::Widget *boxWidget;
builder->get_widget("boxColor", boxWidget);
overHead->add_overlay(*boxWidget);
btnBoxAboutDialog->set_visible(false);
ubl_make_plugs(boxSave,boxButton, socket_ext_id_I, socket_trd_id_I);
if (this->check_root() == 0) {
spbSecond->set_range(1, 60);
spbSecond->set_increments(1.0, 1.0);
spbSecond->set_value(1);
this->fill_in_view();
this->change_password_protecc();
this->change_security_login();
this->set_active_boot_second();
this->download_local_cfg();
this->download_globl_cfg();
this->event();
}
else{
boxWidgetAll->set_sensitive(false);
btnLoad->set_sensitive(false);
boxSave->set_sensitive(false);
imgInfo->set_from_icon_name("com.ublinux.ubl-settings-bootloader.warning", Gtk::ICON_SIZE_MENU);
info_status_app("boxInfoMessError");
lblWarning->set_text(_("The program must be run as root"));
this->set_active_boot_second();
this->event();
}
}
void MainWindow::fill_in_view() {
list_store_kernel = Gtk::ListStore::create(m_columns);
list_store_IPT = Gtk::ListStore::create(m_columns);
list_store_OTT = Gtk::ListStore::create(m_columns);
treeViewKernel->set_model(list_store_kernel);
treeViewIPT->set_model(list_store_IPT);
treeViewOTT->set_model(list_store_OTT);
vec_Option_kernel = this->read_file_and_view("cmdline-linux.csv", row_kernel, list_store_kernel);
vec_Option_IPT = this->read_file_and_view("grub-terminal-input.csv", row_IPT, list_store_IPT);
vec_Option_OTT = this->read_file_and_view("grub-terminal-output.csv", row_OTT, list_store_OTT);
size_kernel = vec_Option_kernel.size();
size_IPT = vec_Option_IPT.size();
size_OTT = vec_Option_OTT.size();
this->view_add_colums(*treeViewKernel);
this->view_add_colums(*treeViewIPT);
this->view_add_colums(*treeViewOTT);
}
void MainWindow::item_selected_kernel(const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator&) {
auto selection_IPT = treeViewIPT->get_selection();
auto selection_OTT = treeViewOTT->get_selection();
selection_IPT->unselect_all();
selection_OTT->unselect_all();
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
if (flag_blocked_tree_view == false) {
template_item_selected(map_cmd_selection, path, list_store_kernel);
string str_flags = this->dynamic_update_entry(map_cmd_selection, vec_Option_kernel);
entryKernel->set_text(str_flags);
}
}
void MainWindow::item_selected_OTT(const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator&) {
auto selection_kernel = treeViewKernel->get_selection();
auto selection_IPT = treeViewIPT->get_selection();
selection_kernel->unselect_all();
selection_IPT->unselect_all();
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
if (flag_blocked_tree_view == false) {
template_item_selected(map_cmd_selection , path, list_store_OTT);
string str_flags = this->dynamic_update_entry(map_cmd_selection, vec_Option_OTT);
entryOTT->set_text(str_flags);
}
}
void MainWindow::item_selected_IPT(const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator&) {
auto selection_kernel = treeViewKernel->get_selection();
auto selection_OTT = treeViewOTT->get_selection();
selection_kernel->unselect_all();
selection_OTT->unselect_all();
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
if (flag_blocked_tree_view == false) {
template_item_selected(map_cmd_selection , path, list_store_IPT);
string str_flags = this->dynamic_update_entry(map_cmd_selection, vec_Option_IPT);
entryIPT->set_text(str_flags);
}
}
void MainWindow::get_download_mode(string cmd, std::map <string, string> &map_temp) {
int start_error = index_error;
struct Result<string> res_response = this->wrapper_call(cmd);
if (res_response.error == 0) {
Utils::str_replace_all(res_response.response, "\"","");
if (res_response.response == "splash") {
cmbDownloadMode->set_active(0);
map_temp["GRUB_BOOT_SILENT"] = "splash";
}
else if (res_response.response == "splash quiet ub.silent") {
cmbDownloadMode->set_active(1);
map_temp["GRUB_BOOT_SILENT"] = "splash quiet ub.silent";
}
else if (res_response.response == "quiet ub.silent") {
cmbDownloadMode->set_active(2);
map_temp["GRUB_BOOT_SILENT"] = "quiet ub.silent";
}
else if (res_response.response == "plymouth.enable=0") {
cmbDownloadMode->set_active(3);
map_temp["GRUB_BOOT_SILENT"] = "plymouth.enable=0";
}
else{
cmbDownloadMode->set_active(-1);
map_temp["GRUB_BOOT_SILENT"] = "";
}
}
else if (res_response.error == 3) {
cmbDownloadMode->set_active(-1);
map_temp["GRUB_BOOT_SILENT"] = "";
if (start_error != index_error) {
index_error = start_error;
}
}
else {
cmbDownloadMode->set_active(-1);
map_temp["GRUB_BOOT_SILENT"] = "";
}
}
void MainWindow::set_download_mode(string cmd="") {
int index = cmbDownloadMode->get_active_row_number();
string key = "";
if (index == 0) {
key = "splash";
}
else if (index == 1) {
key = "splash quiet ub.silent";
}
else if (index == 2) {
key = "quiet ub.silent";
}
else if (index == 3) {
key = "plymouth.enable=0";
}
else{
return;
}
if (cmd.length() !=0 ) {
cmd += "\"" + key + "\"";
wrapper_system(cmd, "");
}
else {
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
}
map_cmd_selection["GRUB_BOOT_SILENT"] = key;
}
void MainWindow::set_security_login(string cmd = "", string cmd_remove = "") {
int index = chbSecurityLogin->get_active_row_number();
string key = "";
if (index == 0) {
key = "";
if (cmd_remove.length() != 0) {
wrapper_system(cmd_remove, "");
}
else {
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
}
}
else if (index == 1) {
key = entrySecurityLogin->get_text();
if (cmd.length() != 0) {
entrySecurityLogin->set_text(key);
cmd = cmd + "\"" + key + "\"";
wrapper_system(cmd, "");
}
else {
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
}
}
else if (index == -1) {
return;
}
map_cmd_selection["GRUB_USER"] = key;
}
void MainWindow::get_security_login(string cmd, std::map <string, string> &map_temp) {
int start_error = index_error;
struct Result<string> res_response = this->wrapper_call(cmd);
// TODO:
// Убрать в будущем
string default_login = "superadmin";
if (res_response.error == 0) {
Utils::str_replace_all(res_response.response, " ","");
Utils::str_replace_all(res_response.response, "\"","");
if (res_response.response.length() > 0) {
chbSecurityLogin->set_active(1);
map_temp["GRUB_USER"] = res_response.response;
entrySecurityLogin->set_sensitive(true);
entrySecurityLogin->set_text(res_response.response);
}
else {
chbSecurityLogin->set_active(-1);
map_temp["GRUB_USER"] = "";
}
}
else if (res_response.error == 3) {
map_temp["GRUB_USER"] = "";
if (start_error != index_error) {
index_error = start_error;
}
chbSecurityLogin->set_active(0);
entrySecurityLogin->set_text("");
entrySecurityLogin->set_sensitive(false);
}
else {
chbSecurityLogin->set_active(-1);
map_temp["GRUB_USER"] = "";
}
}
void MainWindow::set_password_protec(string cmd = "", string cmd_remove = "") {
int index = chbPasswordProtecc->get_active_row_number();
string key = "";
if (index == 0){
key = "";
if (cmd_remove.length() != 0) {
wrapper_system(cmd_remove, "");
}
else {
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
}
}
else if (index == 1) {
key = entryPasswordProtecc->get_text();
if (cmd.length() != 0 and key != "************") {
entryPasswordProtecc->set_text(key);
cmd = cmd + "\"" + key + "\"";
wrapper_system(cmd, "");
}
else {
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
}
}
else if (index == -1) {
return;
}
if (key!= "************") {
map_cmd_selection["GRUB_PASSWORD"] = key;
}
}
void MainWindow::get_password_protec(string cmd, std::map <string, string> &map_temp) {
int start_error = index_error;
struct Result<string> res_response = this->wrapper_call(cmd);
if (res_response.error == 0) {
Utils::str_replace_all(res_response.response, "\"","");
if (res_response.response.length() != 0) {
chbPasswordProtecc->set_active(1);
map_temp["GRUB_PASSWORD"] = res_response.response;
entryPasswordProtecc->set_text("************");
entryPasswordProtecc->set_sensitive(true);
}
else{
map_temp["GRUB_PASSWORD"] = "";
chbPasswordProtecc->set_active(-1);
}
}
else if (res_response.error == 3) {
chbPasswordProtecc->set_active(0);
map_temp["GRUB_PASSWORD"] = "";
entryPasswordProtecc->set_text("");
if (start_error != index_error) {
index_error = start_error;
}
}
else {
map_temp["GRUB_PASSWORD"] = "";
chbPasswordProtecc->set_active(-1);
}
}
void MainWindow::template_item_selected(std::map<string, string> &map_view, const Gtk::TreeModel::Path& path, Glib::RefPtr<Gtk::ListStore> &list_store) {
const auto iter = list_store->get_iter(path);
if(iter) {
const auto row = *iter;
Glib::ustring cmd;
bool check_btn = row[m_columns.check_button];
if (check_btn) {
cmd = "1";
}
else {
cmd = "0";
}
Glib::ustring name = row[m_columns.name];
map_view[name] = cmd;
}
}
string MainWindow::dynamic_update_entry(std::map<string, string> &map_view, vector<string> &vec_allowed) {
string keys = "";
for (auto &key: vec_allowed) {
if (map_view.find(key) != map_view.end()) {
if (map_view[key] == "1") {
keys += string(key) + ", ";
}
}
}
return keys;
}
vector<string> MainWindow::read_file_and_view(string file_name ,Gtk::TreeModel::Row &row, Glib::RefPtr<Gtk::ListStore> list_store_m) {
std::array<std::vector<std::string>, 5> arr_view = Utils::read_csv(path_resources + "/" + file_name);
std::vector<std::string> vec_Option = arr_view[0];
for (size_t index = 0; index < vec_Option.size(); index++) {
this->view_add_cell(row, list_store_m , arr_view, index);
}
return vec_Option;
}
void MainWindow::view_add_colums(Gtk::TreeView &treeView) {
treeView.append_column_editable(_("Active"), m_columns.check_button);
treeView.append_column(_("Option"), m_columns.name);
treeView.append_column(_("Description"), m_columns.description);
}
void MainWindow::view_add_cell(Gtk::TreeModel::Row &row, Glib::RefPtr<Gtk::ListStore> list_store_m , std::array<std::vector<std::string>, 5> &arr_view , size_t index) {
row = *(list_store_m->append());
bool flag_chb = false;
string name = arr_view[0][index];
row[m_columns.check_button] = flag_chb;
row[m_columns.name] = _(name.c_str());
row[m_columns.description] = _(arr_view[1][index].c_str());
}
void MainWindow::get_builder(){
builder->get_widget("chbLoadVariantSelectionTimer", chbLoadVariantSelectionTimer);
builder->get_widget("lblInfoCommand", lblInfoCommand);
builder->get_widget("lblInfoCommand1", lblInfoCommand1);
builder->get_widget("lblInfoCommand2", lblInfoCommand2);
builder->get_widget("lblInfoDefaultDonw", lblInfoDefaultDonw);
builder->get_widget("lblInfoSeconds", lblInfoSeconds);
builder->get_widget("lblLoadMenu", lblLoadMenu);
builder->get_widget("lblInfoInputTerminal", lblInfoInputTerminal);
builder->get_widget("lblInfoOutputTerminal", lblInfoOutputTerminal);
builder->get_widget("lblInfoSeconds", lblInfoSeconds);
builder->get_widget("lblHeaderName", lblHeaderName);
builder->get_widget("lblInfoHead", lblInfoHead);
builder->get_widget("spbSecond", spbSecond);
builder->get_widget("entryKernel", entryKernel);
builder->get_widget("entryIPT", entryIPT);
builder->get_widget("entryOTT", entryOTT);
builder->get_widget("boxColor", boxColor);
builder->get_widget("boxWidgetAll", boxWidgetAll);
builder->get_widget("aboutWindows", aboutWindows);
builder->get_widget("btnSynopsis", btnSynopsis);
builder->get_widget("btnAbout", btnAbout);
builder->get_widget("btnLoadLocal", btnLoadLocal);
builder->get_widget("btnLoadGlob", btnLoadGlob);
builder->get_widget("btnSaveLocalGlob", btnSaveLocalGlob);
builder->get_widget("btnSaveLocal", btnSaveLocal);
builder->get_widget("btnSaveGlob", btnSaveGlob);
builder->get_widget("btnSettings", btnSettings);
builder->get_widget("btnLoad", btnLoad);
builder->get_widget("btnSave", btnSave);
builder->get_widget("boxButton", boxButton);
builder->get_widget("boxSave", boxSave);
builder->get_widget("boxInfoError", boxInfoError);
builder->get_widget("lblWarning", lblWarning);
builder->get_widget("imgInfo", imgInfo);
builder->get_widget("btnBoxAboutDialog", btnBoxAboutDialog);
builder->get_widget("treeViewKernel", treeViewKernel);
builder->get_widget("treeViewOTT", treeViewOTT);
builder->get_widget("treeViewIPT", treeViewIPT);
builder->get_widget("imgBG", imgBG);
builder->get_widget("overHead", overHead);
builder->get_widget("lblDownloadMode", lblDownloadMode);
builder->get_widget("lblSecurityLogin", lblSecurityLogin);
builder->get_widget("lblPasswordProtec", lblPasswordProtec);
builder->get_widget("cmbDownloadMode", cmbDownloadMode);
builder->get_widget("chbSecurityLogin", chbSecurityLogin);
builder->get_widget("chbPasswordProtecc", chbPasswordProtecc);
builder->get_widget("entryPasswordProtecc", entryPasswordProtecc);
builder->get_widget("entrySecurityLogin", entrySecurityLogin);
builder->get_widget("cmbDefaultDonw", cmbDefaultDonw);
}
void MainWindow::localization(){
time_t now = time(0);
tm *ltm = localtime(&now);
unsigned int year = 1900+ ltm->tm_year;
string str_authors = string(_("Copyright © UBSoft LLC, 2022 - ")) + to_string(year);
aboutWindows->set_copyright(str_authors);
aboutWindows->set_comments(_("ubl-settings-bootloader"));
aboutWindows->set_website(_("https://wiki.ublinux.com"));
aboutWindows->set_version(_(version_application.c_str()));
aboutWindows->set_website_label(_("Project Home Page"));
lblInfoHead->set_text(_("Configuring system boot parameters"));
lblHeaderName->set_text(_("ubl-settings-bootloader"));
aboutWindows->set_comments(_("Setting bootloader"));
aboutWindows->set_website_label(_("Project Home Page"));
lblInfoCommand->set_text(_("Command line parameters:"));
lblInfoCommand1->set_text(_("Command line parameters:"));
lblInfoCommand2->set_text(_("Command line parameters:"));
lblInfoDefaultDonw->set_text(_("Load default:"));
lblInfoSeconds->set_text(_("Seconds"));
lblLoadMenu->set_text(_("Download menu"));
lblInfoInputTerminal->set_text(_("Terminal for input"));
lblInfoOutputTerminal->set_text(_("Terminal for output"));
chbLoadVariantSelectionTimer->set_label(_("Load option timer"));
btnSynopsis->set_label(_("Help"));
btnAbout->set_label(_("About"));
btnSaveLocalGlob->set_label(_("Save to global and local configuration"));
btnSaveLocal->set_label(_("Save local configuration"));
btnSaveGlob->set_label(_("Save global configuration"));
btnLoadGlob->set_label(_("Load global configuration"));
btnLoadLocal->set_label(_("Load local configuration"));
btnSave->set_label(_("Save"));
btnLoad->set_label(_("Load"));
this->set_title(_("ubl-settings-bootloader"));
lblSecurityLogin->set_tooltip_text(gettext("User name to enter boot configuration editing mode"));
lblDownloadMode->set_text(_("Load screen display mode:"));
lblSecurityLogin->set_text(_("Load menu user name:"));
lblPasswordProtec->set_text(_("Load menu user password:"));
chbSecurityLogin->append(_("Not available"));
chbSecurityLogin->append(_("Mine"));
chbPasswordProtecc->append(_("Not available"));
chbPasswordProtecc->append(_("Mine"));
cmbDownloadMode->append(_("Loading animation with the magazine"));
cmbDownloadMode->append(_("Loading animation without a magazine"));
cmbDownloadMode->append(_("Нет анимации загрузки, полный журнал"));
cmbDownloadMode->append(_("Lack of loading animation with the output of the abbreviated log"));
cmbDefaultDonw->append(_("Last Successful Download"));
}
vector<string> MainWindow::get_setting_entry_all(string key, string cmd, Gtk::Entry &entry_text, std::map <string, string> &map_temp) {
int start_error = index_error;
vector<string> vec_params;
struct Result<string> res_response = this->wrapper_call(cmd);
if (res_response.error == 0) {
Utils::str_replace_all(res_response.response, "\"", "");
vec_params = Utils::split(res_response.response, ' ');
Utils::str_replace_all(res_response.response, " ", ", ");
entry_text.set_text(res_response.response);
for (auto &param: vec_params) {
map_cmd_selection[param] = "1";
map_temp[param] = "1";
}
Utils::str_remove(res_response.response, ",");
map_temp[key] = res_response.response;
}
else if (res_response.error == 3) {
if (start_error != index_error) {
index_error = start_error;
}
}
else {
}
return vec_params;
}
bool MainWindow::focus_out_txt_password(GdkEventFocus*) {
if (entryPasswordProtecc->get_text().length() == 0) {
info_status_app("boxInfoMessError");
lblWarning->set_text(_("Enter your password"));
boxSave->set_sensitive(false);
}
else {
boxSave->set_sensitive(true);
string key = entryPasswordProtecc->get_text();
if (key != "************") {
map_cmd_selection["GRUB_PASSWORD"] = key;
}
}
return true;
}
bool MainWindow::focus_out_txt_login(GdkEventFocus*) {
if (entrySecurityLogin->get_text().length() == 0) {
info_status_app("boxInfoMessError");
lblWarning->set_text(_("Enter login"));
boxSave->set_sensitive(false);
}
else {
map_cmd_selection["GRUB_USER"] = entrySecurityLogin->get_text();
boxSave->set_sensitive(true);
}
return true;
}
bool MainWindow::focus_out_txt_kernel(GdkEventFocus*) {
this->set_entry_to_tree_view(list_store_kernel, *entryKernel, vec_Option_kernel, size_kernel);
return true;
}
bool MainWindow::focus_out_txt_IPT(GdkEventFocus*) {
this->set_entry_to_tree_view(list_store_IPT, *entryIPT, vec_Option_IPT, size_IPT);
return true;
}
bool MainWindow::focus_out_txt_OTT(GdkEventFocus*) {
this->set_entry_to_tree_view(list_store_OTT, *entryOTT, vec_Option_OTT, size_OTT);
return true;
}
void MainWindow::set_entry_to_tree_view(Glib::RefPtr<Gtk::ListStore> &list_store, Gtk::Entry &entry, std::vector<std::string> &vec_Option, int size) {
flag_blocked_tree_view = true;
vector<string> vec_params;
std::string text = entry.get_text();
Utils::str_replace_all(text, " ", "");
vec_params = Utils::split(text, ',');
for (auto &name: vec_Option) {
this->set_row(list_store, size, name, false);
}
for (auto &name: vec_params) {
this->set_row(list_store, size, name, true);
}
flag_blocked_tree_view = false;
}
void MainWindow::get_menu_boot(string cmd, std::map <string, string> &map_temp) {
int start_error = index_error;
struct Result<string> res_response = this->wrapper_call(cmd);
if (res_response.error == 0) {
map_temp["GRUB_TIMEOUT"] = res_response.response;
spbSecond->set_value(atoi(res_response.response.c_str()));
chbLoadVariantSelectionTimer->set_active(true);
spbSecond->set_sensitive(true);
lblInfoSeconds->set_sensitive(true);
}
else if (res_response.error == 3) {
if (start_error != index_error) {
index_error = start_error;
}
map_temp["GRUB_TIMEOUT"] = "";
chbLoadVariantSelectionTimer->set_active(false);
spbSecond->set_sensitive(false);
lblInfoSeconds->set_sensitive(true);
}
else {
map_temp["GRUB_TIMEOUT"] = "";
}
}
void MainWindow::set_menu_boot(string cmd = "", string cmd_remove = "") {
if (chbLoadVariantSelectionTimer->get_active()) {
int value = spbSecond->get_value();
if (cmd.length() != 0) {
cmd += to_string(value);
this->wrapper_system(cmd, "");
}
else {
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
}
map_cmd_selection["GRUB_TIMEOUT"] = to_string(value);
}
else if (chbLoadVariantSelectionTimer->get_active() == false) {
if (cmd_remove.length() != 0) {
this->wrapper_system(cmd_remove, "");
}
else {
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
}
map_cmd_selection["GRUB_TIMEOUT"] = "";
}
else {
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
map_cmd_selection["GRUB_TIMEOUT"] = "";
}
}
void MainWindow::cmd_entry_all(Gtk::Entry &entry, string cmd_settings, string cmd_remove) {
string cmds = entry.get_text();
Utils::str_remove(cmds, ",");
if (cmds.length() != 0) {
cmd_settings += "\"" + cmds + "\"";
Utils::str_replace_all(cmd_settings, " \"", "\"");
this->wrapper_system(cmd_settings, "");
}
else {
this->wrapper_system(cmd_remove, "");
}
}
void MainWindow::event(){
btnSynopsis->signal_activate().connect(sigc::mem_fun(*this, &MainWindow::synopsis_show));
btnAbout->signal_activate().connect([&]() {aboutWindows->show();});
btnLoadLocal->signal_activate().connect(sigc::mem_fun(*this, &MainWindow::download_local_cfg));
btnLoadGlob->signal_activate().connect(sigc::mem_fun(*this, &MainWindow::download_globl_cfg));
btnSaveLocalGlob->signal_activate().connect([&]() {wrapper_save_all_cfg();});
btnSaveLocal->signal_activate().connect([&]() {wrapper_save_local_cfg();});
btnSaveGlob->signal_activate().connect([&]() {wrapper_save_global_cfg();});
entryKernel->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_out_txt_kernel));
entryIPT->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_out_txt_IPT));
entryOTT->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_out_txt_OTT));
entrySecurityLogin->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_out_txt_login));
entryPasswordProtecc->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_out_txt_password));
chbPasswordProtecc->signal_changed().connect([&]() {change_password_protecc();set_password_protec();});
chbSecurityLogin->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::change_security_login));
cmbDownloadMode->signal_changed().connect([&]() {set_download_mode();});
chbSecurityLogin->signal_changed().connect([&]() {set_security_login();});
cmbDefaultDonw->signal_changed().connect([&]() {set_default_load("","");});
spbSecond->signal_changed().connect([&]() {set_menu_boot();});
if (this->check_root() == 0) {
Glib::RefPtr<Gtk::TreeModel> treeViewKernelModel = treeViewKernel->get_model();
treeViewKernelModel->signal_row_changed().connect(sigc::mem_fun(*this, &MainWindow::item_selected_kernel));
Glib::RefPtr<Gtk::TreeModel> treeViewIPTModel = treeViewIPT->get_model();
treeViewIPTModel->signal_row_changed().connect(sigc::mem_fun(*this, &MainWindow::item_selected_IPT));
Glib::RefPtr<Gtk::TreeModel> treeViewOTTModel = treeViewOTT->get_model();
treeViewOTTModel->signal_row_changed().connect(sigc::mem_fun(*this, &MainWindow::item_selected_OTT));
entryKernel->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_out_txt_kernel));
entryIPT->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_out_txt_IPT));
entryOTT->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_out_txt_OTT));
}
chbLoadVariantSelectionTimer->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::set_active_boot_second));
}
void MainWindow::change_security_login() {
int index = chbSecurityLogin->get_active_row_number();
if (index == 0) {
entrySecurityLogin->set_sensitive(false);
entrySecurityLogin->set_text("");
boxSave->set_sensitive(true);
}
else if (index == 1) {
entrySecurityLogin->set_sensitive(true);
entrySecurityLogin->set_text("");
boxSave->set_sensitive(true);
}
else {
entrySecurityLogin->set_sensitive(false);
entrySecurityLogin->set_text("");
boxSave->set_sensitive(true);
}
}
void MainWindow::set_default_load(string cmd = "", string cmd_remove = "") {
int index = cmbDefaultDonw->get_active_row_number();
if (index == 0) {
if (cmd.length() != 0) {
wrapper_system(cmd, "");
}
else {
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
}
}
else if (index > 0) {
if (cmd_remove.length() != 0) {
wrapper_system(cmd_remove, "");
}
else {
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
}
}
if (index != 0 && index != -1) {
map_cmd_selection["GRUB_DEFAULT"] = cmbDefaultDonw->get_active_text();
}
else {
map_cmd_selection["GRUB_DEFAULT"] = "";
}
}
void MainWindow::get_default_load(string cmd, std::map <string, string> &map_temp) {
int start_error = index_error;
struct Result<string> res_response = this->wrapper_call(cmd);
if (res_response.error == 0) {
map_temp["GRUB_DEFAULT"] = res_response.response;
cmbDefaultDonw->set_active_text(res_response.response);
}
else if (res_response.error == 3) {
if (start_error != index_error) {
index_error = start_error;
cmbDefaultDonw->set_active(0);
}
map_temp["GRUB_DEFAULT"] = "";
}
else {
map_temp["GRUB_DEFAULT"] = "";
}
}
void MainWindow::change_password_protecc() {
int index = chbPasswordProtecc->get_active_row_number();
if (index == 0 || index == 2 || index == -1) {
entryPasswordProtecc->set_sensitive(false);
entryPasswordProtecc->set_text("");
boxSave->set_sensitive(true);
}
else if (index == 1) {
entryPasswordProtecc->set_sensitive(true);
entryPasswordProtecc->set_text("");
boxSave->set_sensitive(true);
}
else {
boxSave->set_sensitive(true);
}
}
void MainWindow::set_active_boot_second() {
spbSecond->set_sensitive(chbLoadVariantSelectionTimer->get_active());
lblInfoSeconds->set_sensitive(chbLoadVariantSelectionTimer->get_active());
this->set_menu_boot();
}
void MainWindow::wrapper_save_all_cfg() {
bool _flag_local = this->save_local_cfg();
bool _flag_global = this->save_global_cfg();
if (_flag_local && _flag_global) {
this->info_warning_error(5);
flag_save_all = false;
}
else {
info_warning_error(4);
}
}
void MainWindow::wrapper_save_global_cfg() {
if (this->save_global_cfg()) {
this->info_warning_error(5);
}
else {
info_warning_error(3);
}
}
bool MainWindow::save_global_cfg() {
string flag_save = "global";
bool flag_no_save = true;
if (flag_save_global) {
if (flag_save_all) {
flag_save_global = false;
this->set_data_cfg();
if (this->check_save(flag_save, "GRUB_TIMEOUT")) {
std::string cmd_boot_time = "ubconfig --target global set boot GRUB_TIMEOUT=";
string cmd_remove = "ubconfig --target global remove boot GRUB_TIMEOUT";
this->set_menu_boot(cmd_boot_time, cmd_remove);
flag_no_save = false;
}
if (this->check_save(flag_save, "GRUB_CMDLINE_LINUX")) {
string cmd_settings_kernel = "ubconfig --target global set boot GRUB_CMDLINE_LINUX=";
string cmd_remove = "ubconfig --target global remove boot GRUB_CMDLINE_LINUX";
this->cmd_entry_all(*entryKernel, cmd_settings_kernel, cmd_remove);
flag_no_save = false;
}
if (this->check_save(flag_save, "GRUB_TERMINAL_OUTPUT")) {
string cmd_settings_IPT = "ubconfig --target global set boot GRUB_TERMINAL_OUTPUT=";
string cmd_remove = "ubconfig --target global remove boot GRUB_TERMINAL_OUTPUT";
this->cmd_entry_all(*entryIPT, cmd_settings_IPT,cmd_remove);
flag_no_save = false;
}
if (this->check_save(flag_save, "GRUB_TERMINAL_INPUT")) {
string cmd_settings_OTT = "ubconfig --target global set boot GRUB_TERMINAL_INPUT=";
string cmd_remove = "ubconfig --target global remove boot GRUB_TERMINAL_INPUT";
this->cmd_entry_all(*entryOTT, cmd_settings_OTT, cmd_remove);
flag_no_save = false;
}
if (this->check_save(flag_save, "GRUB_BOOT_SILENT")) {
this->set_download_mode("ubconfig --target global set boot GRUB_BOOT_SILENT=");
flag_no_save = false;
}
if (this->check_save(flag_save, "GRUB_USER")) {
string cmd_login = "ubconfig --target global set boot GRUB_USER=";
string cmd_remove_login = "ubconfig --target system remove boot GRUB_USER";
this->set_security_login(cmd_login, cmd_remove_login);
flag_no_save = false;
}
if (this->check_save(flag_save, "GRUB_PASSWORD")) {
string cmd_password = "ubconfig --target global set boot GRUB_PASSWORD=";
string cmd_password_remove = "ubconfig --target global remove boot GRUB_PASSWORD";
this->set_password_protec(cmd_password, cmd_password_remove);
flag_no_save = false;
}
if (this->check_save(flag_save, "GRUB_DEFAULT")) {
string cmd_load = "ubconfig --target global set boot GRUB_DEFAULT=";
string cmd_load_remove = "ubconfig --target global remove boot GRUB_DEFAULT";
this->set_default_load(cmd_load, cmd_load_remove);
flag_no_save = false;
}
}
}
map_global_cmd_selection = map_cmd_selection;
return flag_no_save;
}
void MainWindow::wrapper_save_local_cfg() {
if (this->save_local_cfg()){
this->info_warning_error(5);
}
else {
info_warning_error(2);
}
}
bool MainWindow::save_local_cfg() {
string flag_save = "local";
bool flag_no_save = true;
if (flag_save_local) {
if (flag_save_all) {
flag_save_local = false;
this->set_data_cfg();
if (this->check_save(flag_save, "GRUB_TIMEOUT")) {
std::string cmd_boot_time = "ubconfig --target system set boot GRUB_TIMEOUT=";
string cmd_remove = "ubconfig --target system remove boot GRUB_TIMEOUT";
this->set_menu_boot(cmd_boot_time, cmd_remove);
flag_no_save = false;
}
if (this->check_save(flag_save, "GRUB_CMDLINE_LINUX")) {
string cmd_settings_kernel = "ubconfig --target system set boot GRUB_CMDLINE_LINUX=";
string cmd_remove = "ubconfig --target system remove boot GRUB_CMDLINE_LINUX";
this->cmd_entry_all(*entryKernel, cmd_settings_kernel, cmd_remove);
flag_no_save = false;
}
if (this->check_save(flag_save, "GRUB_TERMINAL_OUTPUT")) {
string cmd_settings_IPT = "ubconfig --target system set boot GRUB_TERMINAL_OUTPUT=";
string cmd_remove = "ubconfig --target system remove boot GRUB_TERMINAL_OUTPUT";
this->cmd_entry_all(*entryIPT, cmd_settings_IPT, cmd_remove);
flag_no_save = false;
}
if (this->check_save(flag_save, "GRUB_TERMINAL_INPUT")) {
string cmd_settings_OTT = "ubconfig --target system set boot GRUB_TERMINAL_INPUT=";
string cmd_remove = "ubconfig --target system remove boot GRUB_TERMINAL_INPUT";
this->cmd_entry_all(*entryOTT, cmd_settings_OTT, cmd_remove);
flag_no_save = false;
}
if (this->check_save(flag_save, "GRUB_BOOT_SILENT")) {
this->set_download_mode("ubconfig --target system set boot GRUB_BOOT_SILENT=");
flag_no_save = false;
}
if (this->check_save(flag_save, "GRUB_USER")) {
string cmd_login = "ubconfig --target system set boot GRUB_USER=";
string cmd_remove_login = "ubconfig --target system remove boot GRUB_USER";
this->set_security_login(cmd_login, cmd_remove_login);
flag_no_save = false;
}
if (this->check_save(flag_save, "GRUB_PASSWORD")) {
string cmd_password = "ubconfig --target system set boot GRUB_PASSWORD=";
string cmd_password_remove = "ubconfig --target system remove boot GRUB_PASSWORD";
this->set_password_protec(cmd_password, cmd_password_remove);
flag_no_save = false;
}
if (this->check_save(flag_save, "GRUB_DEFAULT")) {
string cmd_load = "ubconfig --target system set boot GRUB_DEFAULT=";
string cmd_load_remove = "ubconfig --target system remove boot GRUB_DEFAULT";
this->set_default_load(cmd_load, cmd_load_remove);
flag_no_save = false;
}
}
}
map_local_cmd_selection = map_cmd_selection;
return flag_no_save;
}
void MainWindow::set_data_cfg() {
string str_flags = entryKernel->get_text();
Utils::str_remove(str_flags, ",");
Utils::str_replace_all(str_flags, " \"", "\"");
map_cmd_selection["GRUB_CMDLINE_LINUX"] = str_flags;
str_flags = entryIPT->get_text();
Utils::str_remove(str_flags, ",");
Utils::str_replace_all(str_flags, " \"", "\"");
map_cmd_selection["GRUB_TERMINAL_INPUT"] = str_flags;
str_flags = entryOTT->get_text();
Utils::str_remove(str_flags, ",");
Utils::str_replace_all(str_flags, " \"", "\"");
map_cmd_selection["GRUB_TERMINAL_OUTPUT"] = str_flags;
}
void MainWindow::download_globl_cfg() {
entryKernel->set_text("");
entryOTT->set_text("");
entryIPT->set_text("");
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
flag_load = true;
std::string cmd_boot_time = "ubconfig --default --source global get boot GRUB_TIMEOUT";
this->get_menu_boot(cmd_boot_time, map_global_cmd_selection);
string cmd_kernel_entry = "ubconfig --default --source global get boot GRUB_CMDLINE_LINUX";
this->get_setting_entry_all("GRUB_CMDLINE_LINUX",cmd_kernel_entry, *entryKernel, map_global_cmd_selection);
string cmd_ipt_entry = "ubconfig --default --source global get boot GRUB_TERMINAL_INPUT";
this->get_setting_entry_all("GRUB_TERMINAL_INPUT",cmd_ipt_entry, *entryIPT, map_global_cmd_selection);
string cmd_opt_entry = "ubconfig --default --source global get boot GRUB_TERMINAL_OUTPUT";
this->get_setting_entry_all("GRUB_TERMINAL_OUTPUT", cmd_opt_entry, *entryOTT, map_global_cmd_selection);
this->set_row_all(map_global_cmd_selection, list_store_kernel, vec_Option_kernel, size_kernel);
this->set_row_all(map_global_cmd_selection, list_store_IPT, vec_Option_IPT, size_IPT);
this->set_row_all(map_global_cmd_selection, list_store_OTT, vec_Option_OTT, size_OTT);
this->get_download_mode("ubconfig --default --source global get boot GRUB_BOOT_SILENT", map_global_cmd_selection);
this->get_security_login("ubconfig --default --source global get boot GRUB_USER", map_global_cmd_selection);
this->get_password_protec("ubconfig --default --source global get boot GRUB_PASSWORD", map_global_cmd_selection);
this->get_default_load("ubconfig --default --source global get boot GRUB_DEFAULT", map_global_cmd_selection);
info_warning_error(1);
map_cmd_selection = map_global_cmd_selection;
}
void MainWindow::download_local_cfg() {
entryKernel->set_text("");
entryOTT->set_text("");
entryIPT->set_text("");
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
flag_load = false;
std::string cmd_boot_time = "ubconfig --default --source system get boot GRUB_TIMEOUT";
this->get_menu_boot(cmd_boot_time, map_local_cmd_selection);
string cmd_kernel_entry = "ubconfig --default --source system get boot GRUB_CMDLINE_LINUX";
this->get_setting_entry_all("GRUB_CMDLINE_LINUX", cmd_kernel_entry, *entryKernel, map_local_cmd_selection);
string cmd_ipt_entry = "ubconfig --default --source system get boot GRUB_TERMINAL_INPUT";
this->get_setting_entry_all("GRUB_TERMINAL_INPUT", cmd_ipt_entry, *entryIPT, map_local_cmd_selection);
string cmd_opt_entry = "ubconfig --default --source system get boot GRUB_TERMINAL_OUTPUT";
this->get_setting_entry_all("GRUB_TERMINAL_OUTPUT", cmd_opt_entry, *entryOTT, map_local_cmd_selection);
this->set_row_all(map_local_cmd_selection, list_store_kernel, vec_Option_kernel, size_kernel);
this->set_row_all(map_local_cmd_selection, list_store_IPT, vec_Option_IPT, size_IPT);
this->set_row_all(map_local_cmd_selection, list_store_OTT, vec_Option_OTT, size_OTT);
this->get_download_mode("ubconfig --default --source system get boot GRUB_BOOT_SILENT", map_local_cmd_selection);
this->get_security_login("ubconfig --default --source system get boot GRUB_USER", map_local_cmd_selection);
this->get_password_protec("ubconfig --default --source system get boot GRUB_PASSWORD", map_local_cmd_selection);
this->get_default_load("ubconfig --default --source system get boot GRUB_DEFAULT", map_local_cmd_selection);
info_warning_error(0);
map_cmd_selection = map_local_cmd_selection;
}
bool MainWindow::check_save(string flag_save, string key_name="") {
std::map <string, string>:: iterator iter_map_data;
std::map <string, string>:: iterator iter_map_data_old;
std::map <string, string> map_config_data_old;
if (flag_save == "local") {
map_config_data_old = map_local_cmd_selection;
}
else if (flag_save == "global") {
map_config_data_old = map_global_cmd_selection;
}
iter_map_data = map_cmd_selection.find(key_name);
iter_map_data_old = map_config_data_old.find(key_name);
if (iter_map_data_old == map_config_data_old.end() && iter_map_data != map_cmd_selection.end()) {
cout << 2 << endl;
return true;
}
else if (iter_map_data->second != iter_map_data_old->second) {
cout << iter_map_data->second << " ||| " << iter_map_data_old->second << endl;
cout << 3 << endl;
return true;
}
else if (iter_map_data->second.length() == 0 && iter_map_data_old->second.length() == 0) {
cout << 4 << " " << key_name << endl;
return false;
}
else if (iter_map_data->second == iter_map_data_old->second) {
cout << 5 << " " << key_name << endl;
return false;
}
else {
cout << 6 << endl;
return true;
}
cout << 7 << endl;
return true;
}
void MainWindow::set_row_all(std::map <string, string> &map_cmd, Glib::RefPtr<Gtk::ListStore> &list_store, vector<string> &list_params, size_t size) {
for (auto &name: list_params) {
if (map_cmd.find(name) != map_cmd.end()){
this->set_row(list_store, size, name, true);
}
else {
this->set_row(list_store, size, name, false);
}
}
}
void MainWindow::set_row(Glib::RefPtr<Gtk::ListStore> &list_store, int size, std::string name, bool flag_chbox) {
for (int index = 0; index < size; index++) {
Gtk::TreeModel::Row row = list_store->children()[index];
if(row) {
if (row[m_columns.name] == name) {
row[m_columns.check_button] = flag_chbox;
}
}
}
}
void MainWindow::synopsis_show() {
string cmd = "xdg-open " + string(_("https://wiki.ublinux.com/ru/Программное_обеспечениерограммы_и_утилиты/Все/")) + app_name + " &";
if (geteuid() == 0) {
string response_user = getlogin();
cmd = "su -l " + response_user + " -c \" DISPLAY=$DISPLAY " + cmd + " \"";
}
wrapper_system(cmd, "&");
}
void MainWindow::wrapper_system(string cmd, string thread_str = "") {
string cmd_new = cmd + " " + thread_str;
int response_cmd = system(cmd_new.c_str());
if (response_cmd != 0) {
index_error += 1;
this->log_mess_error(cmd);
}
}
void MainWindow::info_status_app(string stule) {
boxInfo->remove_class("boxInfoMessOK");
boxInfo->remove_class("boxInfoMessError");
boxInfo->add_class(stule);
}
void MainWindow::info_warning_error(int mess) {
if (index_error > 0) {
info_status_app("boxInfoMessError");
imgInfo->set_from_icon_name("com.ublinux.ubl-settings-bootloader.warning", Gtk::ICON_SIZE_MENU);
index_error = 0;
string mess_error = "";
if (mess == 0) {
mess_error = string(_("Local configuration reading error")) + str_cmd_error;
lblWarning->set_text(mess_error);
}
else if (mess == 1) {
mess_error = string(_("Global configuration read error")) + str_cmd_error;
lblWarning->set_text(mess_error);
}
else if (mess == 2) {
mess_error = string(_("Local configuration write error")) + str_cmd_error;
lblWarning->set_text(mess_error);
}
else if (mess == 3) {
mess_error = string(_("Global configuration write error")) + str_cmd_error;
lblWarning->set_text(mess_error);
}
else if (mess == 4) {
mess_error = string(_("Error saved local and global configuration")) + str_cmd_error;
lblWarning->set_text(mess_error);
}
str_cmd_error = "";
}
else {
info_status_app("boxInfoMessOK");
imgInfo->set_from_icon_name("com.ublinux.ubl-settings-bootloader.checked", Gtk::ICON_SIZE_MENU);
if (mess == 0) {
lblWarning->set_text(_("Local configuration downloaded successfully"));
}
else if (mess == 1) {
lblWarning->set_text(_("Global configuration downloaded successfully"));
}
else if (mess == 2) {
lblWarning->set_text(_("Local configuration successfully written"));
}
else if (mess == 3) {
lblWarning->set_text(_("Global configuration successfully written"));
}
else if (mess == 4) {
lblWarning->set_text(_("Successfully saved local and global configuration"));
}
else if (mess == 5) {
lblWarning->set_text(_("Nothing to save!"));
}
}
}
struct MainWindow::Result<string> MainWindow::wrapper_call(string cmd) {
struct Result<string> obj_result;
string response = Utils::call(cmd);
if ((response.find("(null)") == std::string::npos) && (response.length() != 0 )) {
if (response.find("=") != std::string::npos) {
if (response.find("\n") != std::string::npos) {
response = response.substr(response.find("=")+1,response.length());
response = response.substr(0,response.find("\n"));
obj_result.response = response;
obj_result.error = 0;
}
else {
obj_result.response = response;
obj_result.error = 1;
index_error += 1;
this->log_mess_error(cmd);
}
}
else {
obj_result.response = response;
obj_result.error = 2;
index_error += 1;
str_cmd_error = cmd;
this->log_mess_error(cmd);
}
}
else {
obj_result.response = response;
obj_result.error = 3;
index_error += 1;
str_cmd_error = cmd;
this->log_mess_error(cmd);
}
return obj_result;
}
void MainWindow::log_mess_error(string &cmd) {
string key = "";
if (map_cmd_error.find(cmd) != map_cmd_error.end()){
str_cmd_error = map_cmd_error[cmd];
}
else {
for (const auto &map_iter: map_cmd_error) {
key = map_iter.first;
if (cmd.find(key) != std::string::npos){
str_cmd_error = map_iter.second;
break;
}
}
}
}
void MainWindow::add_CSS(){
Glib::RefPtr<Gtk::CssProvider> cssProvider = Gtk::CssProvider::create();
cssProvider->load_from_path(path_css);
Glib::RefPtr<Gtk::StyleContext> styleContext = Gtk::StyleContext::create();
Glib::RefPtr<Gdk::Screen> screen = Gdk::Screen::get_default();//get default screen
styleContext->add_provider_for_screen(screen, cssProvider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);//add provider for screen in all application
Glib::RefPtr<Gtk::StyleContext> lblInfoHead_css = lblInfoHead->get_style_context();
Glib::RefPtr<Gtk::StyleContext> boxButton_css = boxButton->get_style_context();
Glib::RefPtr<Gtk::StyleContext> boxSave_css = boxSave->get_style_context();
boxInfo = boxInfoError->get_style_context();
imgBG->set(path_img_head_background);
if (socket_trd_id_I == 0 && socket_ext_id_I == 0){
boxButton_css->add_class("bkim_no_plug");
boxSave_css->add_class("bkim_no_plug");
}
lblInfoHead_css->add_class("textHead");
}
void help() {
string version = string(_("ubl-settings-bootloader version: ")) + version_application + "\n";
cout << version.c_str();
string help;
help = "GTK settings bootloader for UBLinux\n\n"
"Usage: ubl-settings-bootloader [OPTIONS...]\n"
"Options:\n"
" -h, --help Show this help\n"
" -V, --version Show package version\n";
cout << _(help.c_str());
}