@ -1,6 +1,5 @@
# include "ublexec.h"
using namespace std ;
string path_app = " /usr/bin/ " ;
string path_glade = " /usr/share/ublexec/ui/ublexec.glade " ;
string path_css = " /usr/share/ublexec/css/style.css " ;
@ -95,7 +94,6 @@ void MainWindow::get_builder(){
builder - > get_widget ( " aboutWindows " , aboutWindows ) ;
builder - > get_widget ( " btnSettings " , btnSettings ) ;
builder - > get_widget ( " btnBoxAboutDialog " , btnBoxAboutDialog ) ;
}
void MainWindow : : set_icon_array ( ) {
@ -111,7 +109,6 @@ void MainWindow::set_icon_array(){
array_icon [ 9 ] = this - > iconSystem ;
}
void MainWindow : : template_apps_obj ( Gtk : : IconView * icon , Glib : : RefPtr < Gtk : : ListStore > & gtk_list_app ) {
gtk_list_app = Gtk : : ListStore : : create ( m_Columns ) ;
gtk_list_app - > set_sort_column ( m_Columns . m_col_description , Gtk : : SORT_ASCENDING ) ;
@ -120,9 +117,7 @@ void MainWindow::template_apps_obj(Gtk::IconView *icon, Glib::RefPtr<Gtk::ListSt
icon - > set_pixbuf_column ( m_Columns . m_col_pixbuf ) ;
}
void MainWindow : : add_CSS ( ) {
Glib : : RefPtr < Gtk : : CssProvider > cssProvider = Gtk : : CssProvider : : create ( ) ;
cssProvider - > load_from_path ( path_css ) ;
Glib : : RefPtr < Gtk : : StyleContext > styleContext = Gtk : : StyleContext : : create ( ) ;
@ -132,7 +127,6 @@ void MainWindow::add_CSS(){
Glib : : RefPtr < Gtk : : StyleContext > context_lbl_head = lblInfoHead - > get_style_context ( ) ;
context_box - > add_class ( " cssboxColor1 " ) ;
context_lbl_head - > add_class ( " textHead " ) ;
}
void MainWindow : : localization ( ) {
@ -201,8 +195,7 @@ void MainWindow::event(){
}
void MainWindow : : synopsis_show ( ) {
//wrapper_system("xdg-open https://wiki.ublinux.ru/ru/home");
system ( " xdg-open https://wiki.ublinux.ru/ru/home & " ) ;
}
void MainWindow : : icon_clear ( ) {
@ -312,17 +305,15 @@ void MainWindow::settings(){
rbSu - > set_sensitive ( false ) ;
rbSudo - > set_sensitive ( false ) ;
btnBoxAboutDialog - > set_visible ( false ) ;
//Gtk::Widget *standartHead;
//Gtk::Widget *plugBox;
//Gtk::Window *window;
//Gtk::Widget *btnSave;
//builder->get_widget("standartHead",standartHead);
//builder->get_widget("plugBox",plugBox);
//builder->get_widget("window",window);
//builder->get_widget("btnSave",btnSave);
//ubl_get_standard_ui(standartHead,plugBox,btnSave,window,"ublexec.svg",_("Running applications as a user with a\nspecified priority"),_("ublexec"),0,0);
/*
Gtk : : Widget * boxButton ;
Gtk : : Widget * boxAbout ;
builder - > get_widget ( " plugBox " , plugBox ) ;
builder - > get_widget ( " window " , window ) ;
builder - > get_widget ( " boxButton " , boxButton ) ;
builder - > get_widget ( " boxAbout " , boxAbout ) ;
ubl_make_plugs ( boxAbout , boxButton , socket_ext_id_I , socket_trd_id_I ) ;
*/
}
void MainWindow : : close_entry_app ( ) {
this - > icon_clear ( ) ;
@ -459,7 +450,7 @@ void MainWindow::start_cmd(){
}
}
if ( cbxExecuteEpriority - > get_active ( ) ) {
str_nice_cmd = " nice -n " + to_string ( spinPriority - > get_value_as_int ( ) ) + " " ;
str_nice_cmd = " nice -n " + to_string ( spinPriority - > get_value_as_int ( ) ) ;
}
if ( user_cmd . length ( ) = = 0 & & name_app . length ( ) = = 0 & & path_file . length ( ) = = 0 ) {
@ -468,7 +459,7 @@ void MainWindow::start_cmd(){
}
if ( chbTerminal - > get_active ( ) ) {
str_cmd_terminal = " xterm -e " ;
str_cmd_terminal = " xterm -e " ;
}
else {
str_cmd_terminal = " " ;
@ -481,16 +472,25 @@ void MainWindow::start_cmd(){
cmd = str_nice_cmd + " nohup " + str_cmd_terminal + str_variants_root + name_app ;
}
else {
bool flag_xdg = false ;
if ( user_cmd . find ( " xdg-open " ) ! = string : : npos ) {
flag_xdg = true ;
}
string str_del = " " ;
user_cmd = this - > str_remove ( user_cmd , str_del ) ;
this - > str_remove ( user_cmd , str_del ) ;
str_del = " \" " ;
this - > str_remove ( user_cmd , str_del ) ;
vector < std : : string > vec_user_cmd = this - > split ( user_cmd , ' ' ) ;
size_t vec_len = vec_user_cmd . size ( ) ;
user_cmd = vec_user_cmd [ vec_len - 1 ] ;
str_del = " \" " ;
user_cmd = this - > str_remove ( user_cmd , str_del ) ;
cmd = str_nice_cmd + " nohup " + str_cmd_terminal + str_variants_root + user_cmd ;
if ( str_variants_root . find ( " su -l " ) ! = string : : npos ) {
cmd + = " \" " ;
if ( flag_xdg = = false ) {
cmd = str_nice_cmd + " nohup " + str_cmd_terminal + str_variants_root + user_cmd ;
if ( str_variants_root . find ( " su -l " ) ! = string : : npos ) {
cmd + = " \" " ;
}
}
else {
cmd = str_nice_cmd + " nohup " + str_cmd_terminal + str_variants_root + " xdg-open " + user_cmd ;
}
}
@ -601,13 +601,12 @@ vector<std::string> MainWindow::split(const std::string &s, char delim) {
return elems ;
}
string MainWindow : : str_remove ( std : : string & source , const std : : string & to_remove ) {
auto begin = source . find ( to_remove ) ;
if ( begin ! = std : : string : : npos ) {
int len_to_remove = to_remove . length ( ) ;
source . erase ( begin , begin + len_to_remove ) ;
}
return source ;
void MainWindow : : str_remove ( std : : string & source , std : : string & to_remove ) {
string : : size_type n = to_remove . length ( ) ;
for ( string : : size_type i = source . find ( to_remove ) ;
i ! = string : : npos ;
i = source . find ( to_remove ) )
source . erase ( i , n ) ;
}
void MainWindow : : pars_apps ( ) {