Добавлен метод получения списка ОС

pull/11/head
Igor Belitskiy 3 years ago
parent cf0200d95f
commit 33bd148f2c

@ -25,4 +25,6 @@
#define app_name "ubl-settings-bootloader"
#define path_resources "/usr/share/ubl-settings-bootloader"
#define path_img_head_background "/usr/share/ubl-settings-bootloader/images/logo-background.png"
#define cmd_pars_list_os "/usr/lib/ublinux/scripts/grub-functions exec_get_all_menuentry"
#define cmd_last_launched_os "/usr/lib/ublinux/scripts/grub-functions exec_get_last_menuentry"
#endif

@ -138,7 +138,6 @@ void Save::save_one_cmd(string cmd1, string cmd_remove, string str_flag_save) {
void Save::template_save(string cmd) {
string str_error = "";
cout << cmd << endl;
process.call(cmd, "");
this->flag_no_save = false;
str_error = process.get_cmd_error();

@ -100,6 +100,10 @@ void MainWindow::settings(){
this->change_password_protecc();
this->change_security_login();
this->set_active_boot_second();
this->str_last_launched_os = this->pars_last_launched_os();
vector<string> os_control_list;
this->pars_os(os_control_list);
this->write_list_entry_os(os_control_list);
this->download_local_cfg();
this->download_globl_cfg();
}
@ -116,6 +120,23 @@ void MainWindow::settings(){
this->event();
}
vector<string> MainWindow::pars_os(vector<string> &os_control_list) {
string str_list_os = obj_process_call.call_all_sections(cmd_pars_list_os);
os_control_list = Utils::split(str_list_os, '\n');
return os_control_list;
}
string MainWindow::pars_last_launched_os() {
string str_list_os = obj_process_call.call_all_sections(cmd_last_launched_os);
Utils::str_replace_all(str_list_os, "\n" , "");
return str_list_os;
}
void MainWindow::write_list_entry_os(vector<string> &os_control_list) {
for (string &name_os: os_control_list) {
cmbDefaultDonw->append(name_os);
}
}
void MainWindow::flag_block_gui() {
if (flag_load_global == true) {
btnLoadGlob->set_sensitive(false);
@ -851,6 +872,14 @@ void MainWindow::load_template(std::map<string, string>* map_temp, string cmd) {
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");
string str_last_launched_os_ubconfig = (*map_temp)["GRUB_DEFAULT"];
if (str_last_launched_os_ubconfig.length() != 0) {
cmbDefaultDonw->set_active_text(str_last_launched_os_ubconfig);
}
else {
cmbDefaultDonw->set_active_text(str_last_launched_os);
}
}
void MainWindow::set_entry(Gtk::Entry* entry , std::map<string, string> &map_temp, string key) {

@ -17,7 +17,6 @@
#include "util.h"
#include "save.h"
#include "load.h"
#include "ubl-settings-bootloader-cm.h"
#include <dlfcn.h>
#ifdef WEBKIT_FOUND
#include <webkit2/webkit2.h>
@ -148,6 +147,7 @@ class MainWindow : public Gtk::ApplicationWindow {
bool flag_blocked_tree_view = false;
bool flag_save_block = false;
bool flag_open_browser = false;
string str_last_launched_os = "";
int index_error = 0;
size_t size_kernel = 0;
size_t size_IPT = 0;
@ -176,7 +176,10 @@ class MainWindow : public Gtk::ApplicationWindow {
void localization();
void event();
void settings();
string pars_last_launched_os();
vector<string> pars_os(vector<string> &os_control_list);
void fn_event_intelMax1();
void write_list_entry_os(vector<string> &os_control_list);
void fn_event_intelMax4();
void synopsis_show();
void set_data_cfg();

@ -1 +0,0 @@
#cmakedefine WEBKIT_FOUND
Loading…
Cancel
Save