From 4f138eee7d1fc673919e9575d2c001ed4c78da85 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Tue, 14 Mar 2023 11:37:55 +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=20wheel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/ublexec.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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);