|
|
|
|
@ -2,10 +2,11 @@
|
|
|
|
|
#include "ubl-settings-bootloader.h"
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
string path_app= "/usr/bin/";
|
|
|
|
|
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/style.css";
|
|
|
|
|
string app_name = "ubl-settings-bootloader";
|
|
|
|
|
string path_resources = "/usr/share/ubl-settings-bootloader";
|
|
|
|
|
int socket_ext_id_I = 0;
|
|
|
|
|
int socket_trd_id_I = 0;
|
|
|
|
|
|
|
|
|
|
@ -71,13 +72,12 @@ void MainWindow::settings(){
|
|
|
|
|
this->add_CSS();
|
|
|
|
|
this->event();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btnBoxAboutDialog->set_visible(false);
|
|
|
|
|
ubl_make_plugs(boxSave,boxButton, socket_ext_id_I, socket_trd_id_I);
|
|
|
|
|
if (this->check_root() == 0) {
|
|
|
|
|
this->add_colums(treeViewKernel, columns_Kernel);
|
|
|
|
|
this->add_colums(treeViewIPT, columns_IPT);
|
|
|
|
|
this->add_colums(treeViewOTT, columns_OTT);
|
|
|
|
|
this->add_cell(treeViewKernel, columns_Kernel, true, "name", "text");
|
|
|
|
|
this->fill_in_view();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
boxWidgetAll->set_sensitive(false);
|
|
|
|
|
@ -87,25 +87,61 @@ void MainWindow::settings(){
|
|
|
|
|
info_status_app("boxInfoMessError");
|
|
|
|
|
lblWarning->set_text(_("The program must be run as root"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::fill_in_view() {
|
|
|
|
|
list_store_kernel = Gtk::ListStore::create(columns_kernel);
|
|
|
|
|
list_store_IPT = Gtk::ListStore::create(columns_IPT);
|
|
|
|
|
list_store_OTT = Gtk::ListStore::create(columns_OTT);
|
|
|
|
|
treeViewKernel->set_model(list_store_kernel);
|
|
|
|
|
treeViewIPT->set_model(list_store_IPT);
|
|
|
|
|
treeViewOTT->set_model(list_store_OTT);
|
|
|
|
|
Gtk::TreeModel::Row row_kernel = *(list_store_kernel->append());
|
|
|
|
|
Gtk::TreeModel::Row row_IPT = *(list_store_IPT->append());
|
|
|
|
|
Gtk::TreeModel::Row row_OTT = *(list_store_OTT->append());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this->read_file_and_view("boot-options.csv",row_kernel, list_store_kernel , columns_kernel);
|
|
|
|
|
this->read_file_and_view("input-options.csv",row_IPT, list_store_IPT , columns_IPT);
|
|
|
|
|
this->read_file_and_view("output-options.csv", row_OTT, list_store_OTT , columns_OTT);
|
|
|
|
|
|
|
|
|
|
this->view_add_colums(*treeViewKernel, columns_kernel);
|
|
|
|
|
this->view_add_colums(*treeViewIPT, columns_IPT);
|
|
|
|
|
this->view_add_colums(*treeViewOTT, columns_OTT);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
void MainWindow::add_colums(Gtk::TreeView *treeView, ModelColumns *m_columns) {
|
|
|
|
|
treeView->append_column(_("Active"), m_columns->check_button);
|
|
|
|
|
treeView->append_column(_("Option"), m_columns->name);
|
|
|
|
|
treeView->append_column(_("Description"), m_columns->description);
|
|
|
|
|
|
|
|
|
|
void MainWindow::read_file_and_view(string file_name ,Gtk::TreeModel::Row &row, Glib::RefPtr<Gtk::ListStore> list_store_m , ModelColumns &m_colum) {
|
|
|
|
|
count_append_cell = 0;
|
|
|
|
|
std::array<std::vector<std::string>, 2> arr_view = read_csv(path_resources + "/" + file_name);
|
|
|
|
|
std::vector<std::string> vec_Option = arr_view[0];
|
|
|
|
|
std::vector<std::string> vec_Description = arr_view[1];
|
|
|
|
|
for (size_t index = 0; index < vec_Option.size(); index++) {
|
|
|
|
|
string str_option = _(vec_Option[index].c_str());
|
|
|
|
|
string str_description = _(vec_Description[index].c_str());
|
|
|
|
|
this->view_add_cell(row, list_store_m , m_colum, true, str_option, str_description);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::add_cell(Gtk::TreeView *tree_view, ModelColumns *m_colum, bool flag_chk_btn, string name, string desc) {
|
|
|
|
|
cout << flag_chk_btn << endl;
|
|
|
|
|
Glib::RefPtr<Gtk::ListStore> list_store;
|
|
|
|
|
list_store = Gtk::ListStore::create(*m_colum);
|
|
|
|
|
tree_view->set_model(list_store);
|
|
|
|
|
Gtk::TreeModel::Row row = *(list_store->append());
|
|
|
|
|
row[m_colum->check_button] = "flag_chk_btn";
|
|
|
|
|
row[m_colum->name] = name;
|
|
|
|
|
row[m_colum->description] = desc;
|
|
|
|
|
void MainWindow::view_add_colums(Gtk::TreeView &treeView, ModelColumns &m_columns) {
|
|
|
|
|
treeView.append_column(_("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 , ModelColumns &m_colum, bool flag_chk_btn, string name, string desc) {
|
|
|
|
|
;
|
|
|
|
|
if (count_append_cell != 0) {
|
|
|
|
|
row = *(list_store_m->append());
|
|
|
|
|
}
|
|
|
|
|
row[m_colum.check_button] = flag_chk_btn;
|
|
|
|
|
row[m_colum.name] = name;
|
|
|
|
|
row[m_colum.description] = desc;
|
|
|
|
|
|
|
|
|
|
count_append_cell += 1;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::get_monitor_size(){
|
|
|
|
|
|