From b0593a3293f844cfbf64293b555461299a7b0dd9 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Thu, 4 May 2023 11:58:24 +0600 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20=D0=B1=D0=B0=D0=B3=20=D1=81=20=D0=B7=D0=B0=D0=BF?= =?UTF-8?q?=D1=8C=D1=8E=20=D0=BA=D0=BE=D0=BD=D1=84=D0=B8=D0=B3=20superuser?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- #ubl-settings-bootloader.glade# | 1944 +++++++++++++++++++++++++++++ source/menu_os.cc | 1 - source/ubl-settings-bootloader.cc | 85 +- 3 files changed, 2005 insertions(+), 25 deletions(-) create mode 100644 #ubl-settings-bootloader.glade# diff --git a/#ubl-settings-bootloader.glade# b/#ubl-settings-bootloader.glade# new file mode 100644 index 0000000..72d0071 --- /dev/null +++ b/#ubl-settings-bootloader.glade# @@ -0,0 +1,1944 @@ + + + + + + both + True + + + + + True + False + vertical + 5 + + + True + True + + + False + True + end + 0 + + + + + button + True + True + True + + + False + True + end + 1 + + + + + True + True + + + False + True + end + 2 + + + + + False + False + True + center + com.ublinux.ubl-settings-diskquota + dialog + True + True + ubl-settings-bootloader + 1.0 + Copyright © 2022 - 2023, UBSoft LLC + ubl-settings-bootloader + https://ublinux.ru/ + Project Home Page + Это приложение распространяется без каких-либо гарантий. +Подробнее в <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.html">GNU General Public License, версии 2 или позднее</a>. + UBGroup + UBGroup + UBGroup + UBGroup + com.ublinux.ubl-settings-bootloader + True + gpl-2-0 + + + True + False + vertical + 2 + + + False + end + + + False + False + 1 + + + + + + + + + + True + False + True + + + True + False + 5 + 5 + 5 + 5 + 2 + ubl-settings-bootloader + + + + + + + + + + True + False + + + True + False + 5 + 5 + 5 + 5 + 6 + 6 + 69 + com.ublinux.ubl-settings-bootloader + + + False + True + 0 + + + + + True + False + start + 5 + 5 + 5 + 5 + 6 + 6 + Running applications as a user with a +specified priority + + + + + + + + True + True + 1 + + + + + True + False + + + True + False + **** + 0.009999999776482582 + + + True + True + 0 + + + + + True + True + True + + + True + False + gtk-goto-last + + + + + + False + True + 1 + + + + + True + True + True + + + True + False + 0 + + + + + True + False + + + True + False + False + False + 4 + + + True + False + Load global configuration + + + + + + True + False + Load local configuration + + + + + + True + False + False + False + 4 + + + True + False + Help + + + + + + True + False + About + + + + + + True + False + False + False + 4 + + + True + False + Save to global and local configuration + + + + + + True + False + Save global configuration + + + + + + True + False + Save local configuration + + + + + + 750 + 550 + False + com.ublinux.ubl-settings-bootloader + + + True + False + vertical + + + True + False + + + True + False + 5 + 5 + 5 + 5 + 6 + 6 + 25 + 1 + + + False + True + 0 + + + + + True + False + start + 5 + 5 + 5 + 5 + 6 + 6 + + + + + + + True + True + 1 + + + + + False + True + 0 + + + + + True + False + + + 81 + True + False + start + + + -1 + + + + + False + True + 1 + + + + + True + True + in + + + True + False + + + True + False + vertical + + + True + False + vertical + + + True + False + 0.019999999552965164 + in + + + True + False + 12 + + + True + False + vertical + + + True + False + + + Boot selection menu timer + True + True + False + 3 + 5 + 3 + 5 + 6 + 6 + True + + + False + True + 0 + + + + + True + True + 5 + 5 + 5 + 5 + 6 + 6 + + + False + True + 1 + + + + + True + False + 5 + 5 + 5 + 5 + 6 + 6 + Seconds + + + False + True + 2 + + + + + False + True + 0 + + + + + True + False + + + True + False + start + 5 + 5 + 5 + 5 + 6 + 6 + Default load + start + 0 + + + False + True + 0 + + + + + True + True + 5 + 5 + 5 + 5 + 6 + 6 + + + True + True + 2 + + + + + True + True + True + 5 + 5 + 5 + 5 + 6 + 6 + + + True + False + open-menu-symbolic + + + + + False + True + 3 + + + + + False + True + 1 + + + + + True + False + + + True + False + start + 5 + 5 + 5 + 5 + 6 + 6 + Load screen display mode: + start + 0 + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + 6 + 6 + + + True + True + 1 + + + + + False + True + 2 + + + + + True + False + 0.019999999552965164 + in + + + True + False + + + True + False + 12 + + + True + False + vertical + + + 65 + True + True + 6 + in + + + True + False + + + True + True + + + + + + + + + + False + True + 0 + + + + + + + True + True + 0 + + + + + True + False + vertical + + + True + True + True + 5 + 5 + 5 + 5 + 6 + 6 + + + True + False + list-add + + + + + False + True + 0 + + + + + True + True + True + 5 + 5 + 5 + 5 + 3 + 6 + + + True + False + gtk-remove + + + + + False + True + 1 + + + + + False + True + 1 + + + + + + + True + False + start + 5 + 5 + 5 + 5 + 6 + 6 + Boot Menu Users + start + + + + + False + True + 5 + + + + + True + False + 0.019999999552965164 + in + + + True + False + + + True + False + 12 + + + True + False + vertical + + + 65 + True + True + 6 + in + + + True + False + + + True + True + + + + + + + + + + False + True + 0 + + + + + + + True + True + 0 + + + + + True + False + vertical + + + True + True + True + 5 + 5 + 5 + 5 + 6 + 6 + + + True + False + list-add + + + + + False + True + 0 + + + + + True + True + True + 5 + 5 + 5 + 5 + 3 + 6 + + + True + False + gtk-remove + + + + + False + True + 1 + + + + + False + True + 1 + + + + + + + True + False + start + 5 + 5 + 5 + 5 + 6 + 6 + Ringtone at startup + start + + + + + False + True + 6 + + + + + + + + + True + False + 5 + 5 + 5 + 5 + 6 + 6 + Download menu + + + + + False + True + 0 + + + + + True + False + 0.019999999552965164 + in + + + True + False + 12 + + + True + False + vertical + + + 140 + True + True + 5 + 5 + in + + + True + False + + + -1 + True + True + + + + + + + + + + False + True + 0 + + + + + True + False + + + True + False + 5 + 5 + 5 + 5 + 6 + 6 + Command line parameters: + + + False + True + 0 + + + + + True + True + 5 + 5 + 5 + 5 + 6 + 6 + + + True + True + 1 + + + + + False + True + 10 + + + + + + + + + True + False + start + 5 + 5 + 5 + 5 + 6 + 6 + Parameters passed to the kernel + start + + + + + False + True + 1 + + + + + True + False + 0.019999999552965164 + in + + + True + False + 12 + + + True + False + vertical + + + 140 + True + True + 5 + 5 + in + + + True + False + + + True + True + + + + + + + + + + False + True + 1 + + + + + True + False + + + True + False + 5 + 5 + 5 + 5 + 6 + 6 + Command line parameters: + + + False + True + 0 + + + + + True + True + 5 + 5 + 5 + 5 + 6 + 6 + + + True + True + 1 + + + + + False + True + 7 + + + + + + + + + True + False + start + 5 + 5 + 5 + 5 + 6 + 6 + Terminal for input + start + + + + + False + True + 2 + + + + + True + False + 0.019999999552965164 + in + + + True + False + 12 + + + True + False + vertical + + + 140 + True + True + 5 + 5 + in + + + True + False + + + True + True + + + + + + + + + + False + True + 0 + + + + + True + False + + + True + False + 5 + 5 + 5 + 5 + 6 + 6 + Command line parameters: + + + False + True + 0 + + + + + True + True + 5 + 5 + 5 + 5 + 6 + 6 + + + True + True + 1 + + + + + False + True + 7 + + + + + + + + + True + False + start + 5 + 5 + 5 + 5 + 6 + 6 + Terminal for output + start + + + + + False + True + 3 + + + + + False + True + 5 + + + + + + + + + True + True + 2 + + + + + + + True + False + True + + + True + False + ubl-settings-bootloader + + + + + + + + True + False + 32 + com.ublinux.ubl-settings-bootloader + + + + + True + False + + + True + False + + + True + True + False + True + True + menu2 + none + + + True + False + + + True + False + 5 + 5 + 5 + 5 + Save + + + + False + True + 0 + + + + + True + False + pan-down-symbolic + + + False + True + 1 + + + + + + + False + True + 0 + + + + + True + True + False + True + True + menu1 + none + + + True + False + open-menu-symbolic + + + + + False + True + 1 + + + + + + False + True + 0 + + + + + end + 1 + + + + + True + False + + + True + True + False + True + True + menu + none + + + True + False + + + True + False + 5 + 5 + 5 + 5 + Load + + + False + True + 0 + + + + + True + False + pan-down-symbolic + + + False + True + 1 + + + + + + + False + True + 0 + + + + + + 2 + + + + + + + both + True + + + + + + + + both + True + + + + + + + + False + btnOpenMenuOS + bottom + + + True + False + + + True + False + none + + + True + False + vertical + + + + + + + + True + True + 0 + + + + + True + False + none + True + + + True + False + vertical + + + True + True + True + + + True + False + start + 0 + gtk-goto-first + + + + + False + True + 0 + + + + + True + False + vertical + + + + + + False + True + 1 + + + + + + + False + True + 1 + + + + + + + False + Внимание! + center + dialog + + + True + False + vertical + + + True + False + 5 + 5 + 5 + 5 + + + True + False + 5 + 5 + 5 + 5 + 6 + 6 + 50 + gtk-dialog-warning + + + True + True + 0 + + + + + 160 + True + False + start + center + 5 + 5 + 5 + 5 + 6 + 6 + Warning! + + + True + True + 1 + + + + + False + True + 1 + + + + + OK + True + True + True + 5 + 5 + 5 + 5 + 3 + 3 + + + False + True + 1 + + + + + + + True + False + none + + + True + False + vertical + + + + + + + + False + start + start + False + 450 + 250 + dialog-question-symbolic + + + True + False + vertical + + + True + False + + + True + False + start + 20 + 20 + dialog-question-symbolic + 6 + + + False + True + 0 + + + + + True + False + vertical + + + True + False + start + 10 + 5 + Would you like to read documentation in the Web? + True + 0 + + + + + + + False + True + 0 + + + + + True + False + start + start + 10 + 10 + You will be redirected to documentation website where documentation is translated and supported by community. + True + 0 + + + + True + True + 1 + + + + + Always redirect to online documentation + True + True + False + end + 10 + True + + + + False + True + 2 + + + + + + True + True + 1 + + + + + + True + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + 30 + True + + + Cancel + True + True + True + + + + True + True + 0 + + + + + Read Online + True + True + True + + + + True + True + 1 + + + + + False + True + 1 + + + + + + + True + False + True + + + True + False + ubl-settings-bootloader + + + + + + + + True + False + 32 + dialog-question-symbolic + + + + + + + 800 + 600 + False + True + True + com.ublinux.ubl-settings-datetime + + + + + + True + False + True + + + True + False + ubl-settings-bootloader + + + + + True + False + 32 + com.ublinux.ubl-settings-bootloader + 5 + + + + + + diff --git a/source/menu_os.cc b/source/menu_os.cc index a9658a5..6fa884f 100644 --- a/source/menu_os.cc +++ b/source/menu_os.cc @@ -164,6 +164,5 @@ void Menu_os::html_last_launched_os(string name_os, Gtk::Label *label) { label->set_text(name_os); } } - } diff --git a/source/ubl-settings-bootloader.cc b/source/ubl-settings-bootloader.cc index d36566f..c50e581 100755 --- a/source/ubl-settings-bootloader.cc +++ b/source/ubl-settings-bootloader.cc @@ -98,7 +98,6 @@ void MainWindow::settings() { this->download_local_cfg(); this->download_globl_cfg(); //this->view_add_colums_melody(*treeViewMelody); - this->view_add_colums_user(*treeViewUser); std::map> map_list_os = format_os_list(os_control_list); obj_menu_os.set_builder(builder, path_glade); obj_menu_os.set_map(map_list_os); @@ -125,7 +124,6 @@ map> MainWindow::format_os_list(vector &os_contro std::map> map_list_os; set set_key; for (string& name_os : os_control_list) { - if (name_os.find(">") != string::npos) { set_key.insert(name_os.substr(0,name_os.find(">")+1)); } @@ -219,10 +217,10 @@ void MainWindow::view_add_colums_melody(Gtk::TreeView &treeView) { } void MainWindow::item_selected_kernel(const Gtk::TreeModel::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(); + treeViewIPT->get_selection()->unselect_all(); + treeViewOTT->get_selection()->unselect_all(); + treeViewUser->get_selection()->unselect_all(); + treeViewMelody->get_selection()->unselect_all(); if (flag_blocked_tree_view == false) { string str_flags = template_item_selected(size_kernel, list_store_kernel, "GRUB_CMDLINE_LINUX"); Utils::str_replace_all(str_flags, " \"", "\""); @@ -234,10 +232,10 @@ void MainWindow::item_selected_kernel(const Gtk::TreeModel::Path&, const Gtk::Tr } void MainWindow::item_selected_OTT(const Gtk::TreeModel::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(); + treeViewIPT->get_selection()->unselect_all(); + treeViewKernel->get_selection()->unselect_all(); + treeViewUser->get_selection()->unselect_all(); + treeViewMelody->get_selection()->unselect_all(); if (flag_blocked_tree_view == false) { string str_flags = template_item_selected(size_OTT, list_store_OTT, "GRUB_TERMINAL_OUTPUT"); Utils::str_replace_all(str_flags, " \"", "\""); @@ -250,9 +248,10 @@ void MainWindow::item_selected_OTT(const Gtk::TreeModel::Path&, const Gtk::TreeM void MainWindow::item_selected_IPT(const Gtk::TreeModel::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(); + treeViewKernel->get_selection()->unselect_all(); + treeViewOTT->get_selection()->unselect_all(); + treeViewUser->get_selection()->unselect_all(); + treeViewMelody->get_selection()->unselect_all(); if (flag_blocked_tree_view == false) { string str_flags = template_item_selected(size_IPT, list_store_IPT, "GRUB_TERMINAL_INPUT"); Utils::str_replace_all(str_flags, " \"", "\""); @@ -505,8 +504,8 @@ vector MainWindow::get_setting_entry_all(string key, std::map get_selection(); - selection_kernel->unselect_all(); + treeViewKernel->get_selection()->unselect_all(); + treeViewUser->get_selection()->unselect_all(); this->set_entry_to_tree_view(list_store_kernel, *entryKernel, vec_Option_kernel, size_kernel, "GRUB_CMDLINE_LINUX"); this->set_row_all(map_cmd_selection, list_store_kernel, vec_Option_kernel, size_kernel, "GRUB_CMDLINE_LINUX"); flag_blocked_tree_view = false; @@ -514,8 +513,8 @@ bool MainWindow::focus_out_txt_kernel(GdkEventFocus*) { } bool MainWindow::focus_out_txt_IPT(GdkEventFocus*) { - auto selection_IPT = treeViewIPT->get_selection(); - selection_IPT->unselect_all(); + treeViewIPT->get_selection()->unselect_all(); + treeViewUser->get_selection()->unselect_all(); this->set_entry_to_tree_view(list_store_IPT, *entryIPT, vec_Option_IPT, size_IPT, "GRUB_TERMINAL_INPUT"); this->set_row_all(map_cmd_selection, list_store_IPT, vec_Option_IPT, size_IPT, "GRUB_TERMINAL_INPUT"); flag_blocked_tree_view = false; @@ -523,8 +522,8 @@ bool MainWindow::focus_out_txt_IPT(GdkEventFocus*) { } bool MainWindow::focus_out_txt_OTT(GdkEventFocus*) { - auto selection_OTT = treeViewIPT->get_selection(); - selection_OTT->unselect_all(); + treeViewIPT->get_selection()->unselect_all(); + treeViewUser->get_selection()->unselect_all(); this->set_entry_to_tree_view(list_store_OTT, *entryOTT, vec_Option_OTT, size_OTT, "GRUB_TERMINAL_OUTPUT"); this->set_row_all(map_cmd_selection, list_store_OTT, vec_Option_OTT, size_OTT, "GRUB_TERMINAL_OUTPUT"); flag_blocked_tree_view = false; @@ -652,6 +651,8 @@ void MainWindow::event() { void MainWindow::set_tree_view_user() { string key = ""; string users_root = ""; + string password = ""; + bool flag_available = false; Glib::RefPtr treeViewUser_model = treeViewUser->get_model(); Gtk::TreeModel::Children children = treeViewUser_model->children(); for(Gtk::TreeModel::iterator iter = children.begin(); iter != children.end(); ++iter) { @@ -659,9 +660,20 @@ void MainWindow::set_tree_view_user() { if(row) { string superuser_name = row[m_columns_user.name] + ""; if (row[m_columns_user.check_button] && superuser_name.length() != 0) { - key = "GRUB_PASSWORD[" + superuser_name + "]="; - if ((row[m_columns_user.password] + "") != "************") { - map_cmd_selection[key] = row[m_columns_user.password] + ""; + key = "GRUB_PASSWORD[" + superuser_name + "]"; + password = row[m_columns_user.password] + ""; + if (password != "************") { + map_cmd_selection[key] = password; + flag_available = false; + for (size_t index = 0; index < vec_param_names.size(); index++) { + if (vec_param_names[index] == map_cmd_selection[key]) { + flag_available = true; + } + } + if (flag_available == false) { + vec_param_names.push_back(key); + } + } else { // map_cmd_selection[key] = ""; @@ -680,6 +692,9 @@ void MainWindow::set_tree_view_user() { if (users_root.length() != 0) { map_cmd_selection["GRUB_SUPERUSERS"] = users_root; } + else { + map_cmd_selection["GRUB_SUPERUSERS"] = ""; + } } void MainWindow::set_init_data_user(std::map &map_temp) { @@ -799,8 +814,17 @@ void MainWindow::set_add_data_melody(Gtk::TreeModel::Row &row, bool flag, string void MainWindow::remove_user() { if (flag_validate_del_user && list_store_user->iter_is_valid(iter_user_del)) { + Gtk::TreeModel::Row row = *iter_user_del; + if(row) { + string name = row[m_columns_user.name] + ""; + string key = "GRUB_PASSWORD[" + name + "]"; + map_cmd_selection[key] = ""; + } list_store_user->erase(iter_user_del); flag_validate_del_user = false; + info_status_app(info_box_ok_css); + imgInfo->set_from_icon_name(icon_checked, Gtk::ICON_SIZE_MENU); + lblWarning->set_text(""); } flag_validate_del_user = false; } @@ -809,11 +833,18 @@ void MainWindow::remove_melody() { if (flag_validate_del_melody && list_store_melody->iter_is_valid(iter_melody_del)) { list_store_melody->erase(iter_melody_del); flag_validate_del_melody = false; + info_status_app(info_box_ok_css); + imgInfo->set_from_icon_name(icon_checked, Gtk::ICON_SIZE_MENU); + lblWarning->set_text(""); } flag_validate_del_melody = false; } void MainWindow::remove_line_user(const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator& iter) { + treeViewKernel->get_selection()->unselect_all(); + treeViewOTT->get_selection()->unselect_all(); + treeViewIPT->get_selection()->unselect_all(); + treeViewMelody->get_selection()->unselect_all(); iter_user_del = iter; flag_validate_del_user = true; bool flag_error = false; @@ -825,7 +856,7 @@ void MainWindow::remove_line_user(const Gtk::TreeModel::Path&, const Gtk::TreeMo Gtk::TreeModel::Row row = *iter; name = row[m_columns_user.name] + ""; password = row[m_columns_user.password] + ""; - if (name.length() == 0 && password.length() == 0) { + if (name.length() == 0 || password.length() == 0) { flag_error = true; break; } @@ -843,16 +874,22 @@ void MainWindow::remove_line_user(const Gtk::TreeModel::Path&, const Gtk::TreeMo } void MainWindow::remove_line_melody(const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator& iter) { + treeViewKernel->get_selection()->unselect_all(); + treeViewOTT->get_selection()->unselect_all(); + treeViewIPT->get_selection()->unselect_all(); + treeViewUser->get_selection()->unselect_all(); iter_melody_del = iter; flag_validate_del_melody = true; string code_melodyes = ""; + string melody_title = ""; bool flag_error = false; Glib::RefPtr treeViewMelody_model = treeViewMelody->get_model(); Gtk::TreeModel::Children children = treeViewMelody_model->children(); for(Gtk::TreeModel::iterator iter = children.begin(); iter != children.end(); ++iter) { Gtk::TreeModel::Row row = *iter; code_melodyes = row[m_columns_melody.melody_code] + ""; - if (code_melodyes.length() == 0 && (row[m_columns_melody.title] + "").length() == 0) { + melody_title = row[m_columns_melody.title] + ""; + if (code_melodyes.length() == 0 || melody_title.length() == 0) { flag_error = true; break; }