|
|
|
|
@ -416,13 +416,13 @@ void MainWindow::localization(){
|
|
|
|
|
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_comments(_("System boot"));
|
|
|
|
|
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"));
|
|
|
|
|
lblInfoSeconds->set_text(_("seconds"));
|
|
|
|
|
lblLoadMenu->set_text(_("Download menu"));
|
|
|
|
|
lblInfoInputTerminal->set_text(_("Terminal for input"));
|
|
|
|
|
lblInfoOutputTerminal->set_text(_("Terminal for output"));
|
|
|
|
|
@ -452,18 +452,18 @@ void MainWindow::localization(){
|
|
|
|
|
cmbDefaultDonw->append(_("Last Successful Download"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
vector<string> MainWindow::get_setting_entry_all(string key, std::map <string, string> &map_temp) {
|
|
|
|
|
vector<string> MainWindow::get_setting_entry_all(string key, std::map <string, string>* map_temp) {
|
|
|
|
|
vector<string> vec_params;
|
|
|
|
|
std::map <string, string>:: iterator iter_map_data;
|
|
|
|
|
iter_map_data = map_temp.find(key);
|
|
|
|
|
if (iter_map_data != map_temp.end()) {
|
|
|
|
|
iter_map_data = (*map_temp).find(key);
|
|
|
|
|
if (iter_map_data != (*map_temp).end()) {
|
|
|
|
|
string value = iter_map_data->second;
|
|
|
|
|
if (value.length() != 0) {
|
|
|
|
|
Utils::str_replace_all(value, "\"", "");
|
|
|
|
|
vec_params = Utils::split(value, ' ');
|
|
|
|
|
Utils::str_replace_all(value, " ", ", ");
|
|
|
|
|
Utils::str_remove(value, ",");
|
|
|
|
|
map_temp[key] = value;
|
|
|
|
|
(*map_temp)[key] = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return vec_params;
|
|
|
|
|
@ -663,63 +663,55 @@ void MainWindow::set_active_boot_second() {
|
|
|
|
|
|
|
|
|
|
void MainWindow::wrapper_save_all_cfg() {
|
|
|
|
|
this->set_data_cfg();
|
|
|
|
|
bool _flag_save_global = this->save_global_cfg();
|
|
|
|
|
bool _flag_save_local = this->save_local_cfg();
|
|
|
|
|
bool _flag_save_global = this->save_template("boot", "global");;
|
|
|
|
|
bool _flag_save_local = this->save_template("boot", "system");
|
|
|
|
|
if (_flag_save_global && _flag_save_local) {
|
|
|
|
|
this->info_warning_error(5);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
info_warning_error(4);
|
|
|
|
|
}
|
|
|
|
|
map_global_cmd_selection = map_cmd_selection;
|
|
|
|
|
map_local_cmd_selection = map_cmd_selection;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::wrapper_save_global_cfg() {
|
|
|
|
|
this->set_data_cfg();
|
|
|
|
|
if (this->save_global_cfg()) {
|
|
|
|
|
if (this->save_template("boot", "global")) {
|
|
|
|
|
this->info_warning_error(5);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
info_warning_error(3);
|
|
|
|
|
}
|
|
|
|
|
map_global_cmd_selection = map_cmd_selection;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool MainWindow::save_global_cfg() {
|
|
|
|
|
bool MainWindow::save_template(string section, string flag_save) {
|
|
|
|
|
bool flag_no_save = true;
|
|
|
|
|
obj_save.set_data_local(map_local_cmd_selection);
|
|
|
|
|
obj_save.set_data_global(map_global_cmd_selection);
|
|
|
|
|
obj_save.set_data_gui(map_cmd_selection);
|
|
|
|
|
obj_save.set_vec_params(vec_param_names);
|
|
|
|
|
obj_save.save("boot", "global");
|
|
|
|
|
obj_save.save(section, flag_save);
|
|
|
|
|
vector<string> obj_vec_error = obj_save.get_error();
|
|
|
|
|
flag_no_save = obj_save.get_state_save();
|
|
|
|
|
map_global_cmd_selection = map_cmd_selection;
|
|
|
|
|
return flag_no_save;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::wrapper_save_local_cfg() {
|
|
|
|
|
this->set_data_cfg();
|
|
|
|
|
if (this->save_local_cfg()) {
|
|
|
|
|
if (this->save_template("boot", "system")) {
|
|
|
|
|
this->info_warning_error(5);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
info_warning_error(2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool MainWindow::save_local_cfg() {
|
|
|
|
|
bool flag_no_save = true;
|
|
|
|
|
obj_save.set_data_local(map_local_cmd_selection);
|
|
|
|
|
obj_save.set_data_global(map_global_cmd_selection);
|
|
|
|
|
obj_save.set_data_gui(map_cmd_selection);
|
|
|
|
|
obj_save.set_vec_params(vec_param_names);
|
|
|
|
|
obj_save.save("boot", "system");
|
|
|
|
|
vector<string> obj_vec_error = obj_save.get_error();
|
|
|
|
|
flag_no_save = obj_save.get_state_save();
|
|
|
|
|
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, ",");
|
|
|
|
|
@ -755,26 +747,28 @@ void MainWindow::set_data_cfg() {
|
|
|
|
|
void MainWindow::download_globl_cfg() {
|
|
|
|
|
this->load_template(&map_global_cmd_selection, "global");
|
|
|
|
|
info_warning_error(1);
|
|
|
|
|
map_cmd_selection = map_global_cmd_selection;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::download_local_cfg() {
|
|
|
|
|
this->load_template(&map_local_cmd_selection, "system");
|
|
|
|
|
info_warning_error(0);
|
|
|
|
|
map_cmd_selection = map_local_cmd_selection;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::load_template(std::map<string, string>* map_temp, string str_load) {
|
|
|
|
|
this->init_dict();
|
|
|
|
|
this->init_dict(str_load);
|
|
|
|
|
entryKernel->set_text("");
|
|
|
|
|
entryOTT->set_text("");
|
|
|
|
|
entryIPT->set_text("");
|
|
|
|
|
vector<string> vec_sections;
|
|
|
|
|
vec_sections.push_back("boot");
|
|
|
|
|
obj_load.set_sections(vec_sections);
|
|
|
|
|
string sections;
|
|
|
|
|
sections = "boot";
|
|
|
|
|
obj_load.set_sections(sections);
|
|
|
|
|
*map_temp = obj_load.get_load_data(*map_temp, str_load);
|
|
|
|
|
this->get_menu_boot(*map_temp);
|
|
|
|
|
this->get_setting_entry_all("GRUB_CMDLINE_LINUX", *map_temp);
|
|
|
|
|
this->get_setting_entry_all("GRUB_TERMINAL_INPUT", *map_temp);
|
|
|
|
|
this->get_setting_entry_all("GRUB_TERMINAL_OUTPUT", *map_temp);
|
|
|
|
|
this->get_setting_entry_all("GRUB_CMDLINE_LINUX", map_temp);
|
|
|
|
|
this->get_setting_entry_all("GRUB_TERMINAL_INPUT", map_temp);
|
|
|
|
|
this->get_setting_entry_all("GRUB_TERMINAL_OUTPUT", map_temp);
|
|
|
|
|
this->set_row_all(*map_temp, list_store_kernel, vec_Option_kernel, size_kernel, "GRUB_CMDLINE_LINUX");
|
|
|
|
|
this->set_row_all(*map_temp, list_store_IPT, vec_Option_IPT, size_IPT, "GRUB_TERMINAL_INPUT");
|
|
|
|
|
this->set_row_all(*map_temp, list_store_OTT, vec_Option_OTT, size_OTT, "GRUB_TERMINAL_OUTPUT");
|
|
|
|
|
@ -785,7 +779,6 @@ void MainWindow::load_template(std::map<string, string>* map_temp, string str_lo
|
|
|
|
|
this->set_entry(entryKernel, *map_temp, "GRUB_CMDLINE_LINUX");
|
|
|
|
|
this->set_entry(entryIPT, *map_temp, "GRUB_TERMINAL_INPUT");
|
|
|
|
|
this->set_entry(entryOTT, *map_temp, "GRUB_TERMINAL_OUTPUT");
|
|
|
|
|
map_cmd_selection = *map_temp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::set_entry(Gtk::Entry* entry , std::map<string, string> &map_temp, string key) {
|
|
|
|
|
@ -801,7 +794,7 @@ void MainWindow::set_entry(Gtk::Entry* entry , std::map<string, string> &map_tem
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::init_dict() {
|
|
|
|
|
void MainWindow::init_dict(string flag_load) {
|
|
|
|
|
std::map<std::string, std::string> map_cmd_selection_n;
|
|
|
|
|
map_cmd_selection_n["GRUB_TIMEOUT"] = "";
|
|
|
|
|
map_cmd_selection_n["GRUB_CMDLINE_LINUX"] = "";
|
|
|
|
|
@ -812,9 +805,13 @@ void MainWindow::init_dict() {
|
|
|
|
|
map_cmd_selection_n["GRUB_PASSWORD"] = "";
|
|
|
|
|
map_cmd_selection_n["GRUB_DEFAULT"] = "";
|
|
|
|
|
map_cmd_selection = map_cmd_selection_n;
|
|
|
|
|
if (flag_load == "global") {
|
|
|
|
|
map_global_cmd_selection = map_cmd_selection_n;
|
|
|
|
|
}
|
|
|
|
|
else if (flag_load == "system") {
|
|
|
|
|
map_local_cmd_selection = map_cmd_selection_n;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::set_row_all(std::map <string, string> &map_cmd, Glib::RefPtr<Gtk::ListStore> &list_store, vector<string> &list_params, size_t size,string key) {
|
|
|
|
|
for (auto &name: list_params) {
|
|
|
|
|
@ -856,7 +853,7 @@ void MainWindow::info_status_app(string stule) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::info_warning_error(int mess) {
|
|
|
|
|
if (index_error > 0) {
|
|
|
|
|
if (obj_process_system.get_count_error() > 0 || obj_process_call.get_count_error() > 0) {
|
|
|
|
|
info_status_app("boxInfoMessError");
|
|
|
|
|
imgInfo->set_from_icon_name("com.ublinux.ubl-settings-bootloader.warning", Gtk::ICON_SIZE_MENU);
|
|
|
|
|
index_error = 0;
|
|
|
|
|
|