|
|
|
|
@ -227,6 +227,11 @@ void MainWindow::set_download_mode(string cmd="") {
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -250,6 +255,11 @@ void MainWindow::set_security_login(string cmd="") {
|
|
|
|
|
cmd = cmd + "\"" + key + "\"";
|
|
|
|
|
wrapper_system(cmd, "");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
flag_save_local = true;
|
|
|
|
|
flag_save_global = true;
|
|
|
|
|
flag_save_all = true;
|
|
|
|
|
}
|
|
|
|
|
map_cmd_selection["GRUB_USER"] = key;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -304,14 +314,14 @@ void MainWindow::set_password_protec(string cmd = "", string cmd_remove = "") {
|
|
|
|
|
key = entryPasswordProtecc->get_text();
|
|
|
|
|
}
|
|
|
|
|
else if (index == 2) {
|
|
|
|
|
key = "remove";
|
|
|
|
|
key = "";
|
|
|
|
|
if (cmd_remove.length() != 0) {
|
|
|
|
|
wrapper_system(cmd_remove, "");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
cmd = "";
|
|
|
|
|
}
|
|
|
|
|
else if (index == -1){
|
|
|
|
|
else if (index == -1) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (cmd.length() != 0 && cmd_remove.length() != 0) {
|
|
|
|
|
@ -319,6 +329,11 @@ void MainWindow::set_password_protec(string cmd = "", string cmd_remove = "") {
|
|
|
|
|
cmd = cmd + key;
|
|
|
|
|
wrapper_system(cmd, "");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
flag_save_local = true;
|
|
|
|
|
flag_save_global = true;
|
|
|
|
|
flag_save_all = true;
|
|
|
|
|
}
|
|
|
|
|
map_cmd_selection["GRUB_PASSWORD"] = key;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -523,7 +538,7 @@ void MainWindow::localization(){
|
|
|
|
|
cmbDownloadMode->append(gettext("No loading animation, minimal log."));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
vector<string> MainWindow::get_setting_entry_all(string cmd, Gtk::Entry &entry_text, std::map <string, string> &map_temp) {
|
|
|
|
|
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);
|
|
|
|
|
@ -536,6 +551,8 @@ vector<string> MainWindow::get_setting_entry_all(string cmd, Gtk::Entry &entry_t
|
|
|
|
|
map_cmd_selection[param] = "1";
|
|
|
|
|
map_temp[param] = "1";
|
|
|
|
|
}
|
|
|
|
|
str_remove(res_response.response, ",");
|
|
|
|
|
map_temp[key] = res_response.response;
|
|
|
|
|
}
|
|
|
|
|
else if (res_response.error == 3) {
|
|
|
|
|
if (start_error != index_error) {
|
|
|
|
|
@ -556,6 +573,7 @@ bool MainWindow::focus_out_txt_password(GdkEventFocus*) {
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
boxSave->set_sensitive(true);
|
|
|
|
|
map_cmd_selection["GRUB_PASSWORD"] = entryPasswordProtecc->get_text();
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
@ -566,6 +584,7 @@ bool MainWindow::focus_out_txt_login(GdkEventFocus*) {
|
|
|
|
|
boxSave->set_sensitive(false);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
map_cmd_selection["GRUB_USER"] = entrySecurityLogin->get_text();
|
|
|
|
|
boxSave->set_sensitive(true);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
@ -605,26 +624,46 @@ void MainWindow::get_menu_boot(string cmd, std::map <string, string> &map_temp)
|
|
|
|
|
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="") {
|
|
|
|
|
int value = spbSecond->get_value();
|
|
|
|
|
if (cmd.length() != 0) {
|
|
|
|
|
cmd += to_string(value);
|
|
|
|
|
this->wrapper_system(cmd, "");
|
|
|
|
|
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, "");
|
|
|
|
|
}
|
|
|
|
|
map_cmd_selection["GRUB_TIMEOUT"] = to_string(value);
|
|
|
|
|
}
|
|
|
|
|
else if (chbLoadVariantSelectionTimer->get_active() == false) {
|
|
|
|
|
if (cmd_remove.length() != 0) {
|
|
|
|
|
this->wrapper_system(cmd_remove, "");
|
|
|
|
|
}
|
|
|
|
|
map_cmd_selection["GRUB_TIMEOUT"] = "";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
flag_save_local = true;
|
|
|
|
|
flag_save_global = true;
|
|
|
|
|
flag_save_all = true;
|
|
|
|
|
map_cmd_selection["GRUB_TIMEOUT"] = "";
|
|
|
|
|
}
|
|
|
|
|
map_cmd_selection["GRUB_TIMEOUT"] = to_string(value);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::cmd_entry_all(Gtk::Entry &entry, string cmd_settings, string cmd_remove) {
|
|
|
|
|
@ -638,6 +677,7 @@ void MainWindow::cmd_entry_all(Gtk::Entry &entry, string cmd_settings, string cm
|
|
|
|
|
else {
|
|
|
|
|
this->wrapper_system(cmd_remove, "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::event(){
|
|
|
|
|
@ -653,8 +693,11 @@ void MainWindow::event(){
|
|
|
|
|
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(sigc::mem_fun(*this, &MainWindow::change_password_protecc));
|
|
|
|
|
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();});
|
|
|
|
|
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));
|
|
|
|
|
@ -711,11 +754,13 @@ void MainWindow::change_password_protecc() {
|
|
|
|
|
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() {
|
|
|
|
|
if (this->save_global_cfg() && this->save_local_cfg()) {
|
|
|
|
|
this->info_warning_error(5);
|
|
|
|
|
flag_save_all = false;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
info_warning_error(4);
|
|
|
|
|
@ -737,12 +782,12 @@ bool MainWindow::save_global_cfg() {
|
|
|
|
|
bool flag_no_save = true;
|
|
|
|
|
if (flag_save_global) {
|
|
|
|
|
if (flag_save_all) {
|
|
|
|
|
flag_save_all = false;
|
|
|
|
|
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=";
|
|
|
|
|
this->set_menu_boot(cmd_boot_time);
|
|
|
|
|
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")) {
|
|
|
|
|
@ -797,12 +842,12 @@ bool MainWindow::save_local_cfg() {
|
|
|
|
|
bool flag_no_save = true;
|
|
|
|
|
if (flag_save_local) {
|
|
|
|
|
if (flag_save_all) {
|
|
|
|
|
flag_save_all = false;
|
|
|
|
|
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=";
|
|
|
|
|
this->set_menu_boot(cmd_boot_time);
|
|
|
|
|
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")) {
|
|
|
|
|
@ -843,10 +888,6 @@ bool MainWindow::save_local_cfg() {
|
|
|
|
|
return flag_no_save;
|
|
|
|
|
}
|
|
|
|
|
void MainWindow::set_data_cfg() {
|
|
|
|
|
this->set_security_login();
|
|
|
|
|
this->set_download_mode();
|
|
|
|
|
this->set_password_protec();
|
|
|
|
|
this->set_menu_boot();
|
|
|
|
|
string str_flags = entryKernel->get_text();
|
|
|
|
|
str_remove(str_flags, ",");
|
|
|
|
|
str_replace_all(str_flags, " \"", "\"");
|
|
|
|
|
@ -859,6 +900,7 @@ void MainWindow::set_data_cfg() {
|
|
|
|
|
str_remove(str_flags, ",");
|
|
|
|
|
str_replace_all(str_flags, " \"", "\"");
|
|
|
|
|
map_cmd_selection["GRUB_TERMINAL_OUTPUT"] = str_flags;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::download_globl_cfg() {
|
|
|
|
|
@ -872,11 +914,11 @@ void MainWindow::download_globl_cfg() {
|
|
|
|
|
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(cmd_kernel_entry, *entryKernel, map_global_cmd_selection);
|
|
|
|
|
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(cmd_ipt_entry, *entryIPT, map_global_cmd_selection);
|
|
|
|
|
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(cmd_opt_entry, *entryOTT, map_global_cmd_selection);
|
|
|
|
|
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);
|
|
|
|
|
@ -885,6 +927,7 @@ void MainWindow::download_globl_cfg() {
|
|
|
|
|
this->get_password_protec("ubconfig --default --source global get boot GRUB_PASSWORD", map_global_cmd_selection);
|
|
|
|
|
info_warning_error(1);
|
|
|
|
|
map_cmd_selection = map_global_cmd_selection;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::download_local_cfg() {
|
|
|
|
|
@ -898,11 +941,11 @@ void MainWindow::download_local_cfg() {
|
|
|
|
|
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(cmd_kernel_entry, *entryKernel, map_local_cmd_selection);
|
|
|
|
|
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(cmd_ipt_entry, *entryIPT, map_local_cmd_selection);
|
|
|
|
|
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(cmd_opt_entry, *entryOTT, map_local_cmd_selection);
|
|
|
|
|
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);
|
|
|
|
|
@ -911,6 +954,7 @@ void MainWindow::download_local_cfg() {
|
|
|
|
|
this->get_password_protec("ubconfig --default --source system get boot GRUB_PASSWORD", 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="") {
|
|
|
|
|
@ -926,19 +970,16 @@ bool MainWindow::check_save(string flag_save, string key_name="") {
|
|
|
|
|
iter_map_data = map_cmd_selection.find(key_name);
|
|
|
|
|
iter_map_data_old = map_config_data_old.find(key_name);
|
|
|
|
|
|
|
|
|
|
if (iter_map_data == map_cmd_selection.end()) {
|
|
|
|
|
cout << 1 << endl;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (iter_map_data_old == map_config_data_old.end()) {
|
|
|
|
|
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) {
|
|
|
|
|
else if (iter_map_data->second.length() == 0 && iter_map_data_old->second.length() == 0) {
|
|
|
|
|
cout << 4 << " " << key_name << endl;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|