From 146b314d2f776b51819ed9f2ed0552c1daeb89ab Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Wed, 1 Mar 2023 12:22:15 +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=B4=D0=B8=D0=B7=D0=B0=D0=B9=D0=BD=20=D0=BE?= =?UTF-8?q?=D0=BA=D0=BD=D0=B0=20=D0=B2=D1=8B=D0=B7=D0=BE=D0=B2=D0=B0=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B8=D0=BB=D0=BE=D0=B6=D0=B5=D0=BD=D0=B8=D0=B9,?= =?UTF-8?q?=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=20?= =?UTF-8?q?=D0=B1=D0=B0=D0=B3=20=D1=81=20=D0=BF=D0=BE=D0=B2=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B5=D0=BD=D0=B8=D0=B5=D0=BC=20=D1=8D=D0=BB=D0=B5=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D1=82=D0=BE=D0=B2=20=D0=BE=D0=BA=D0=BD=D0=B0=20?= =?UTF-8?q?=D0=B2=D1=8B=D0=B7=D0=BE=D0=B2=D0=B0=20=D0=BF=D1=80=D0=B8=D0=BB?= =?UTF-8?q?=D0=BE=D0=B6=D0=B5=D0=BD=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/ublexec.cc | 45 ++-- source/ublexec.h | 5 +- ublexec.glade | 640 ++++++++++++++++++++++++++++------------------ 3 files changed, 422 insertions(+), 268 deletions(-) diff --git a/source/ublexec.cc b/source/ublexec.cc index 0795d13..a54e101 100644 --- a/source/ublexec.cc +++ b/source/ublexec.cc @@ -65,7 +65,6 @@ void MainWindow::get_builder(){ builder->get_widget("lblInfoNooPriority", lblInfoNooPriority); builder->get_widget("lblInfoExec", lblInfoExec); builder->get_widget("lblInfoPriority", lblInfoPriority); - builder->get_widget("lblInfoEnterProg", lblInfoEnterProg); builder->get_widget("boxColor", boxColor); builder->get_widget("lblGraphics", lblGraphics); builder->get_widget("lblTools", lblTools); @@ -113,8 +112,8 @@ void MainWindow::template_apps_obj(Gtk::IconView *icon, Glib::RefPtrset_sort_column(m_Columns.m_col_description, Gtk::SORT_ASCENDING); icon->set_model(gtk_list_app); - icon->set_markup_column(m_Columns.m_col_description); - icon->set_pixbuf_column(m_Columns.m_col_pixbuf); + icon->set_text_column(m_Columns.m_col_description); + //icon->set_pixbuf_column(m_Columns.m_col_pixbuf); } void MainWindow::add_CSS(){ @@ -150,7 +149,6 @@ void MainWindow::localization(){ lblInfoExec->set_text(_("Change startup priority")); lblInfoPriority->set_text(_("Priority")); lblMessageError->set_text(_("Select an executable file or program")); - lblInfoEnterProg->set_text(_("Selecting Programs")); lblGraphics->set_text(_("Graphics")); lblTools->set_text(_("Tools")); lblInternet->set_text(_("Internet")); @@ -205,7 +203,6 @@ void MainWindow::icon_clear(){ list_Multimedia->clear(); list_Settings->clear(); list_Education->clear(); - list_Graphics->clear(); list_Office->clear(); list_Other->clear(); list_Development->clear(); @@ -356,7 +353,6 @@ void MainWindow::tempalte_row(string Name, string Exec, string path , Glib::Ref Gtk::TreeModel::Row row = *(dtk_list->append()); row[m_Columns.m_col_filename] = path; row[m_Columns.m_col_description] = Name; - row[m_Columns.app_name_exec] = Exec; if (std::ifstream(path)){ row[m_Columns.m_col_pixbuf] = Gdk::Pixbuf::create_from_file(path); } @@ -364,6 +360,9 @@ void MainWindow::tempalte_row(string Name, string Exec, string path , Glib::Ref path = "/usr/share/icons/Faenza/emblems/16/emblem-danger.png"; row[m_Columns.m_col_pixbuf] = Gdk::Pixbuf::create_from_file(path); } + row[m_Columns.app_name_exec] = Exec; + row[m_Columns.float_h_align] = 0.5; + row[m_Columns.float_w_align] = 0.5; } void MainWindow::open_list_app(){ @@ -430,29 +429,31 @@ void MainWindow::start_cmd(){ //chbTerminal->set_active(true); } if (rbPkexec->get_active()){ - if ((chbAnotherUser->get_active()) && (cmbUser->get_active_text().length()==0)) { - str_variants_root = " pkexec --user ${USER} env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY "; - } - else if (chbAnotherUser->get_active()){ - str_variants_root = " pkexec --user " + cmbUser->get_active_text() + " env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY "; - } - else{ - str_variants_root = " pkexec --user ${USER} env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY "; + str_variants_root = " pkexec --user " + cmbUser->get_active_text(); + if (cbxExecuteEpriority->get_active()){ + str_variants_root += " nice -n " + to_string(spinPriority->get_value_as_int()); } + str_variants_root += " env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY "; } else if (rbSu->get_active()){ chbTerminal->set_active(true); - str_variants_root="su -l " + cmbUser->get_active_text() + " -c \" DISPLAY=$DISPLAY "; + 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()); + } + str_variants_root += + " -c \" DISPLAY=$DISPLAY "; } else if (rbSudo->get_active()){ chbTerminal->set_active(true); str_variants_root="sudo -u " + cmbUser->get_active_text() + " "; + if (cbxExecuteEpriority->get_active()){ + str_variants_root += " nice -n " + to_string(spinPriority->get_value_as_int()) + " "; + } } } - if (cbxExecuteEpriority->get_active()){ - str_nice_cmd = "nice -n " + to_string(spinPriority->get_value_as_int()); + if ((cbxExecuteEpriority->get_active()) && (chbAnotherUser->get_active()==false)){ + 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){ messageError->show(); return; @@ -466,10 +467,10 @@ void MainWindow::start_cmd(){ } string cmd = ""; if (path_file != ""){ - cmd = str_nice_cmd + " nohup " + str_cmd_terminal + str_variants_root + " xdg-open '" + path_file + "' "; + cmd = "nohup " + str_nice_cmd + str_cmd_terminal + str_variants_root + " xdg-open '" + path_file + "' "; } else if (name_app!=""){ - cmd = str_nice_cmd + " nohup " + str_cmd_terminal + str_variants_root + name_app; + cmd = "nohup " + str_nice_cmd + str_cmd_terminal + str_variants_root + name_app; } else{ bool flag_xdg = false; @@ -484,13 +485,13 @@ void MainWindow::start_cmd(){ size_t vec_len = vec_user_cmd.size(); user_cmd = vec_user_cmd[vec_len-1]; if (flag_xdg==false){ - cmd = str_nice_cmd + " nohup " + 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){ cmd += "\""; } } else{ - cmd = str_nice_cmd + " nohup " + str_cmd_terminal + str_variants_root + " xdg-open " + user_cmd ; + cmd = "nohup " + str_nice_cmd + str_cmd_terminal + str_variants_root + " xdg-open " + user_cmd ; } } diff --git a/source/ublexec.h b/source/ublexec.h index d4a1e0e..cda2475 100644 --- a/source/ublexec.h +++ b/source/ublexec.h @@ -94,12 +94,16 @@ public: add(m_col_description); add(m_col_pixbuf); add(app_name_exec); + add(float_h_align); + add(float_w_align); } Gtk::TreeModelColumn m_col_filename; Gtk::TreeModelColumn m_col_description; Gtk::TreeModelColumn app_name_exec; Gtk::TreeModelColumn > m_col_pixbuf; + Gtk::TreeModelColumn float_h_align; + Gtk::TreeModelColumn float_w_align; }; ModelColumns m_Columns; public: @@ -141,7 +145,6 @@ public: Gtk::Label *lblInfoNooPriority; Gtk::Label *lblInfoExec; Gtk::Label *lblInfoPriority; - Gtk::Label *lblInfoEnterProg; Gtk::Label *lblGraphics; Gtk::Label *lblTools; diff --git a/ublexec.glade b/ublexec.glade index 21c9d66..298e5e8 100644 --- a/ublexec.glade +++ b/ublexec.glade @@ -12,7 +12,7 @@ dialog True ublexec - 1.2 + 1.0 Copyright © 2023 - UBSoft Software LLC Setting the date and time https://ublinux.ru/ @@ -56,26 +56,14 @@ 10 - 500 - 400 + 450 + 240 False True False vertical - - - True - False - Selecting Programs - - - False - True - 0 - - True @@ -83,6 +71,7 @@ in + True False 5 5 @@ -110,321 +99,466 @@ False vertical - - True - False - start - Graphics - - - False - True - 0 - - - - + True True - 1 - queue - 1 - 1 - 1 - - - - True - True - 1 - - - - - True - False - start - Tools + + + True + True + 1 + horizontal + 120 + 1 + + + + 5 + 5 + 2 + + + + + + 4 + 5 + + + + + + + True + False + Graphics + + False True - 2 + 1 - + True True - 1 - queue - 1 - 1 - 1 - - - - True - True - 3 - - - - - True - False - start - Internet + + + True + True + 1 + queue + horizontal + 120 + 1 + + + + 5 + 5 + 2 + + + + + + 5 + 4 + + + + + + + + True + False + Tools + + False True - 4 + 3 - + True True - 1 - queue - 1 - 1 - 1 - - - - True - True - 5 - - - - - True - False - start - Multimedia + + + True + True + 1 + queue + horizontal + 120 + 1 + + + + 5 + 5 + 2 + + + + + + 5 + 4 + + + + + + + + True + False + Internet + + False True - 6 + 5 - + True True - 1 - queue - 1 - 1 - 1 - - - - True - True - 7 - - - - - True - False - start - Settings + + + True + True + 1 + queue + horizontal + 120 + 1 + + + + 5 + 5 + 2 + + + + + + 5 + 4 + + + + + + + + True + False + Multimedia + + False True - 8 + 7 - + True True - 1 - queue - 1 - 1 - 1 - - - - True - True - 9 - - - - - True - False - start - Education + + + True + True + 1 + queue + horizontal + 120 + 1 + + + + 5 + 5 + 2 + + + + + + 5 + 4 + + + + + + + + True + False + Settings + + False True - 10 + 9 - + True True - 1 - queue - 1 - 1 - 1 - - - - True - True - 11 - - - - - True - False - start - Office + + + True + True + 0 + queue + horizontal + 120 + 1 + + + + 5 + 5 + 2 + + + + + + 5 + 4 + + + + + + + + True + False + Education + + False True - 12 + 11 - + True True - 1 - queue - 1 - 1 - 1 - - - - True - True - 13 - - - - - True - False - start - Other + + + True + True + 1 + queue + horizontal + 120 + 1 + + + + 5 + 5 + 2 + + + + + + 5 + 4 + + + + + + + + True + False + Office + + False True - 14 + 13 - + True True - 1 - queue - 1 - 1 - 1 - - - - True - True - 15 - - - - - True - False - start - Development + + + True + True + 1 + queue + horizontal + 120 + 1 + + + + 5 + 5 + 2 + + + + + + 5 + 4 + + + + + + + + True + False + Other + + False True - 16 + 15 - + True True - 1 - queue - 1 - 1 - 1 - - - - True - True - 17 - - - - - True - False - start - System + + + True + True + 1 + queue + horizontal + 120 + 1 + + + + 5 + 5 + 2 + + + + + + 5 + 4 + + + + + + + + True + False + Development + + False True - 18 + 17 - + True True - 1 - queue - 1 - 1 - 1 - + + + True + True + 1 + queue + horizontal + 1 + + + + 5 + 5 + 2 + + + + + + 5 + 4 + + + + + + + + True + False + System + + - True + False True 19 @@ -517,6 +651,22 @@ 6 gtk-media-play + + + + + + + + + + + + + + + + False Внимание!