Исправлен баг с выполнением su от root

pull/3/head
Igor Belitskiy 3 years ago
parent 146b314d2f
commit f5206fb256

@ -113,7 +113,6 @@ void MainWindow::template_apps_obj(Gtk::IconView *icon, Glib::RefPtr<Gtk::ListSt
gtk_list_app->set_sort_column(m_Columns.m_col_description, Gtk::SORT_ASCENDING); gtk_list_app->set_sort_column(m_Columns.m_col_description, Gtk::SORT_ASCENDING);
icon->set_model(gtk_list_app); icon->set_model(gtk_list_app);
icon->set_text_column(m_Columns.m_col_description); icon->set_text_column(m_Columns.m_col_description);
//icon->set_pixbuf_column(m_Columns.m_col_pixbuf);
} }
void MainWindow::add_CSS(){ void MainWindow::add_CSS(){
@ -437,11 +436,18 @@ void MainWindow::start_cmd(){
} }
else if (rbSu->get_active()){ else if (rbSu->get_active()){
chbTerminal->set_active(true); chbTerminal->set_active(true);
string str_user = cmbUser->get_active_text();
if (str_user!="root"){
str_variants_root = "su -l " + cmbUser->get_active_text(); str_variants_root = "su -l " + cmbUser->get_active_text();
if (cbxExecuteEpriority->get_active()){
str_variants_root += " nice -n " + to_string(spinPriority->get_value_as_int());
} }
else{
str_variants_root = "su ";
}
str_variants_root += + " -c \" DISPLAY=$DISPLAY "; str_variants_root += + " -c \" DISPLAY=$DISPLAY ";
if (cbxExecuteEpriority->get_active()){
str_variants_root += "nice -n " + to_string(spinPriority->get_value_as_int()) + " ";
}
} }
else if (rbSudo->get_active()){ else if (rbSudo->get_active()){
chbTerminal->set_active(true); chbTerminal->set_active(true);
@ -486,7 +492,7 @@ void MainWindow::start_cmd(){
user_cmd = vec_user_cmd[vec_len-1]; user_cmd = vec_user_cmd[vec_len-1];
if (flag_xdg==false){ if (flag_xdg==false){
cmd = "nohup " + str_nice_cmd + str_cmd_terminal + str_variants_root + user_cmd; cmd = "nohup " + str_nice_cmd + str_cmd_terminal + str_variants_root + user_cmd;
if (str_variants_root.find("su -l") != string::npos){ if (cmd.find("-e su ") != string::npos){
cmd += "\""; cmd += "\"";
} }
} }

@ -2,6 +2,11 @@
<!-- Generated with glade 3.38.2 --> <!-- Generated with glade 3.38.2 -->
<interface> <interface>
<requires lib="gtk+" version="3.24"/> <requires lib="gtk+" version="3.24"/>
<object class="GtkIconView">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="margin">6</property>
</object>
<object class="GtkAboutDialog" id="aboutWindows"> <object class="GtkAboutDialog" id="aboutWindows">
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="title" translatable="yes">О Программе</property> <property name="title" translatable="yes">О Программе</property>
@ -528,6 +533,7 @@
<property name="margin">1</property> <property name="margin">1</property>
<property name="resize-mode">queue</property> <property name="resize-mode">queue</property>
<property name="item-orientation">horizontal</property> <property name="item-orientation">horizontal</property>
<property name="item-width">120</property>
<property name="item-padding">1</property> <property name="item-padding">1</property>
<child> <child>
<object class="GtkCellRendererPixbuf"/> <object class="GtkCellRendererPixbuf"/>

Loading…
Cancel
Save