pull/34/head
Igor Belitskiy 3 years ago
parent c41ebe8968
commit e279a94672

@ -230,11 +230,13 @@ void MainWindow::item_selected_kernel(const Gtk::TreeModel::Path&, const Gtk::Tr
treeViewOTT->get_selection()->unselect_all(); treeViewOTT->get_selection()->unselect_all();
treeViewUser->get_selection()->unselect_all(); treeViewUser->get_selection()->unselect_all();
treeViewMelody->get_selection()->unselect_all(); treeViewMelody->get_selection()->unselect_all();
if (flag_blocked_tree_view == false) { if (flag_blocked_tree_view == false) {
string str_flags = template_item_selected(size_kernel, list_store_kernel, "GRUB_CMDLINE_LINUX"); if (this->intel_idle_cstate_check(size_kernel, list_store_kernel, "GRUB_CMDLINE_LINUX") == false) {
map_cmd_selection["GRUB_CMDLINE_LINUX"] = str_flags; string str_flags = template_item_selected(size_kernel, list_store_kernel, "GRUB_CMDLINE_LINUX");
// Utils::str_replace_all(str_flags, " ", ", "); map_cmd_selection["GRUB_CMDLINE_LINUX"] = str_flags;
entryKernel->set_text(str_flags); // Utils::str_replace_all(str_flags, " ", ", ");
entryKernel->set_text(str_flags);
}
} }
} }
@ -244,10 +246,12 @@ void MainWindow::item_selected_OTT(const Gtk::TreeModel::Path&, const Gtk::TreeM
treeViewUser->get_selection()->unselect_all(); treeViewUser->get_selection()->unselect_all();
treeViewMelody->get_selection()->unselect_all(); treeViewMelody->get_selection()->unselect_all();
if (flag_blocked_tree_view == false) { if (flag_blocked_tree_view == false) {
string str_flags = template_item_selected(size_OTT, list_store_OTT, "GRUB_TERMINAL_OUTPUT"); if (this->intel_idle_cstate_check(size_OTT, list_store_OTT, "GRUB_TERMINAL_OUTPUT") == false) {
map_cmd_selection["GRUB_TERMINAL_OUTPUT"] = str_flags; string str_flags = template_item_selected(size_OTT, list_store_OTT, "GRUB_TERMINAL_OUTPUT");
// Utils::str_replace_all(str_flags, " ", ", "); map_cmd_selection["GRUB_TERMINAL_OUTPUT"] = str_flags;
entryOTT->set_text(str_flags); // Utils::str_replace_all(str_flags, " ", ", ");
entryOTT->set_text(str_flags);
}
} }
} }
@ -257,10 +261,12 @@ void MainWindow::item_selected_IPT(const Gtk::TreeModel::Path&, const Gtk::TreeM
treeViewUser->get_selection()->unselect_all(); treeViewUser->get_selection()->unselect_all();
treeViewMelody->get_selection()->unselect_all(); treeViewMelody->get_selection()->unselect_all();
if (flag_blocked_tree_view == false) { if (flag_blocked_tree_view == false) {
string str_flags = template_item_selected(size_IPT, list_store_IPT, "GRUB_TERMINAL_INPUT"); if (this->intel_idle_cstate_check(size_IPT, list_store_IPT, "GRUB_TERMINAL_INPUT") == false) {
map_cmd_selection["GRUB_TERMINAL_INPUT"] = str_flags; string str_flags = template_item_selected(size_IPT, list_store_IPT, "GRUB_TERMINAL_INPUT");
// Utils::str_replace_all(str_flags, " ", ", "); map_cmd_selection["GRUB_TERMINAL_INPUT"] = str_flags;
entryIPT->set_text(str_flags); // Utils::str_replace_all(str_flags, " ", ", ");
entryIPT->set_text(str_flags);
}
} }
} }
@ -317,6 +323,44 @@ void MainWindow::set_download_mode() {
map_cmd_selection["GRUB_BOOT_SILENT"] = key; map_cmd_selection["GRUB_BOOT_SILENT"] = key;
} }
bool MainWindow::intel_idle_cstate_check(int size, Glib::RefPtr<Gtk::ListStore> &list_store, string key) {
string cmds_old = map_cmd_selection[key];
string cmds = "";
string param = "";
int index_1 = -1;
int index_4 = -1;
bool active = false;
for (int index = 0; index < size; index++) {
Gtk::TreeModel::Row row = list_store->children()[index];
if(row) {
param = row[m_columns.name] + "";
active = row[m_columns.check_button];
if (param == "intel_idle.max_cstate=1" && active == true) {
index_1 = index;
}
else if (param == "intel_idle.max_cstate=4" && active == true) {
index_4 = index;
}
}
}
if (index_1 != -1 && index_4 != -1) {
if (cmds_old.find("intel_idle.max_cstate=1") == string::npos) {
Gtk::TreeModel::Row row = list_store->children()[index_4];
row[m_columns.check_button] = false;
return true;
}
else if (cmds_old.find("intel_idle.max_cstate=4") == string::npos) {
Gtk::TreeModel::Row row = list_store->children()[index_1];
row[m_columns.check_button] = false;
return true;
}
else {
return false;
}
}
return false;
}
string MainWindow::template_item_selected(int size, Glib::RefPtr<Gtk::ListStore> &list_store, string key) { string MainWindow::template_item_selected(int size, Glib::RefPtr<Gtk::ListStore> &list_store, string key) {
string cmds_old = map_cmd_selection[key]; string cmds_old = map_cmd_selection[key];
string cmds = ""; string cmds = "";

Loading…
Cancel
Save