diff --git a/source/ublexec.cc b/source/ublexec.cc index 49ee207..6dc4d50 100644 --- a/source/ublexec.cc +++ b/source/ublexec.cc @@ -207,7 +207,7 @@ void MainWindow::event() { iconSystem->signal_selection_changed().connect(sigc::mem_fun(*this,&MainWindow::select_System)); btnSynopsis->signal_activate().connect(sigc::mem_fun(*this, &MainWindow::synopsis_show)); btnAbout->signal_activate().connect([&]() {aboutWindows->show();}); - cmbUser->signal_changed().connect([&]() {denamic_cmd();changed_user();}); + cmbUser->signal_changed().connect([&]() {changed_user();denamic_cmd();}); rbSudo->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::sudo_nice)); txtCmd->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_out_txt_cmd)); txtCmd->signal_focus_in_event().connect(sigc::mem_fun(*this, &MainWindow::focus_in_txt_cmd)); @@ -218,7 +218,8 @@ void MainWindow::event() { void MainWindow::sudo_nice(){ - if (geteuid() == 0 || cmbUser->get_active_text() == "root"){ + string response = this->call("id -Gn"); + if (geteuid() == 0 || cmbUser->get_active_text() == "root" ){ spinPriority->set_range(-20, 19); spinPriority->set_increments(1.0, -1.0); scalePriority->set_range(-20, 19); @@ -226,7 +227,7 @@ void MainWindow::sudo_nice(){ lblTimeEpriorityLow->set_text("19 (Низкий)"); lblTime4EpriorityHigh->set_text("-20 (Высокий)"); } - else if (rbSudo->get_active()){ + else if (rbSudo->get_active() && response.find("wheel") != string::npos){ spinPriority->set_range(-20, 19); spinPriority->set_increments(1.0, -1.0); scalePriority->set_range(-20, 19); @@ -255,7 +256,9 @@ void MainWindow::sudo_nice(){ void MainWindow::changed_user() { Glib::ustring entry_user = cmbUser->get_active_text(); - if (geteuid() == 0 || entry_user == "root") { + string response = this->call("id -Gn"); + bool flag_wheel_sudo = (rbSudo->get_active()==true && response.find("wheel") != string::npos); + if (geteuid() == 0 || entry_user == "root" || flag_wheel_sudo==true) { spinPriority->set_range(-20, 19); spinPriority->set_increments(1.0, -1.0); scalePriority->set_range(-20, 19);