From 8917c58931cc5a0ef7d21b7781a2d97706c4ac49 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Wed, 22 Mar 2023 15:47:28 +0600 Subject: [PATCH 1/6] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=BF=D0=B0=D1=80=D0=B0=D0=BC=D0=B5=D1=82=D1=80=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4=D0=BE=D0=B9=20=D1=81=D1=82?= =?UTF-8?q?=D1=80=D0=BE=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/main.cc | 20 ++++++++++++++------ source/ublexec.cc | 2 ++ source/ublexec.h | 1 + 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/source/main.cc b/source/main.cc index 50150ff..0908fe5 100644 --- a/source/main.cc +++ b/source/main.cc @@ -2,17 +2,19 @@ int main(int argc, char** argv) { + string str_argv= ""; string str_cmd_argv = ""; - for (int i=1; i 1){ + str_argv = argv[1]; + } + if (str_argv.find("--socket-id") != std::string::npos) { + auto app = Gtk::Application::create(argc, argv, "org.gtkmm.example.plug"); + auto builder = Gtk::Builder::create_from_file(path_glade); Glib::init(); setlocale(LC_ALL, ""); Glib::OptionContext context; @@ -31,6 +33,12 @@ int main(int argc, char** argv) { return 0; } else { + if (argc == 2) { + name_app_cmd = argv[1]; + } + int local_argc = 1; + auto app = Gtk::Application::create(local_argc, argv, "org.gtkmm.example.plug"); + auto builder = Gtk::Builder::create_from_file(path_glade); MainWindow* wnd = nullptr; builder->get_widget_derived("window", wnd); auto r = app->run(*wnd); diff --git a/source/ublexec.cc b/source/ublexec.cc index 3682eb3..6460465 100644 --- a/source/ublexec.cc +++ b/source/ublexec.cc @@ -5,6 +5,7 @@ const string path_app = "/usr/bin/"; const string path_glade = "/usr/share/ublexec/ui/ublexec.glade"; const string path_css = "/usr/share/ublexec/css/ublexec.css"; const string app_name = "ublexec"; +string name_app_cmd = ""; const string path_img_head_background = "/usr/share/ublexec/images/logo-background.png"; int socket_ext_id_I = 0; int socket_trd_id_I = 0; @@ -413,6 +414,7 @@ void MainWindow::unselect_icon(Gtk::IconView *icon_entry) { } void MainWindow::settings() { + user_cmd = name_app_cmd; this->pars_apps(); this->get_builder(); this->event(); diff --git a/source/ublexec.h b/source/ublexec.h index 065a420..49c1db5 100644 --- a/source/ublexec.h +++ b/source/ublexec.h @@ -24,6 +24,7 @@ extern const string path_app; extern const string app_name; extern const string path_glade; extern const string path_css; +extern string name_app_cmd; extern const string path_img_head_background; extern int socket_ext_id_I; extern int socket_trd_id_I; From 899f785e924363187396ebbe3472399c161dbe9b Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Wed, 22 Mar 2023 16:12:08 +0600 Subject: [PATCH 2/6] =?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=B4?= =?UTF-8?q?=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D1=8B=20=D1=82=D0=B5?= =?UTF-8?q?=D1=80=D0=BC=D0=B8=D0=BD=D0=B0=D0=BB=D1=8C=D0=BD=D1=8B=D0=B5=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 2 +- source/main.cc | 18 ++++++++++++++++++ source/ublexec.cc | 4 +++- source/ublexec.h | 3 ++- ublexec.glade | 2 ++ ublexec.pot | 4 ++++ ublexec_ru.po | 4 ++++ 7 files changed, 34 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 9be5cf4..181d2ea 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ all: init build init: @echo "Initialize ..."; \ - sed -r "s/(version_application = ).*/\1\"$$(grep 'VERSION' ${FILE_VERSION} | cut -d" " -f2)\";/" -i source/ublexec.h; \ + sed -r "s/(version_application = ).*/\1\"$$(grep 'VERSION' ${FILE_VERSION} | cut -d" " -f2)\";/" -i source/ublexec.cc; \ echo "-- Build path: ${CMAKE_BUILD_DIR}" depend: diff --git a/source/main.cc b/source/main.cc index 0908fe5..ad6da8b 100644 --- a/source/main.cc +++ b/source/main.cc @@ -1,5 +1,6 @@ #include "ublexec.h" +void pars_flag(int index_start, int argc, char* argv[]); int main(int argc, char** argv) { string str_argv= ""; @@ -36,6 +37,7 @@ int main(int argc, char** argv) { if (argc == 2) { name_app_cmd = argv[1]; } + pars_flag(1,argc, argv); int local_argc = 1; auto app = Gtk::Application::create(local_argc, argv, "org.gtkmm.example.plug"); auto builder = Gtk::Builder::create_from_file(path_glade); @@ -46,4 +48,20 @@ int main(int argc, char** argv) { return r; } +} + +void pars_flag(int index_start, int argc, char* argv[]) { + string str_argv = ""; + for (int i = index_start; i build show_all_children(); } - +void help() { +} diff --git a/source/ublexec.h b/source/ublexec.h index 49c1db5..c74ba00 100644 --- a/source/ublexec.h +++ b/source/ublexec.h @@ -28,6 +28,7 @@ extern string name_app_cmd; extern const string path_img_head_background; extern int socket_ext_id_I; extern int socket_trd_id_I; +extern string version_application; void me_thread(string cmd); class CmdArgParser : public Glib::OptionGroup { @@ -205,7 +206,6 @@ public: Gtk::Widget *boxAbout; public: string termunal_cmd[3] = {"konsole -e ", "xfce4-terminal -x ", "xterm -e "}; - string version_application = "2.23"; string cmd_old = ""; string user_exec_app = ""; string user_cmd = ""; @@ -245,5 +245,6 @@ private: Gtk::Widget *plugBox; Gtk::Widget *parent; }; +void help(); diff --git a/ublexec.glade b/ublexec.glade index 77b652e..9a8a46a 100644 --- a/ublexec.glade +++ b/ublexec.glade @@ -1678,10 +1678,12 @@ with the specified priority 5 5 5 + 9 adjustment1 20 0 0 + False True diff --git a/ublexec.pot b/ublexec.pot index 68ea1d7..42e4977 100644 --- a/ublexec.pot +++ b/ublexec.pot @@ -214,3 +214,7 @@ msgstr "" msgid "ОК" msgstr "" + +#: source/main.cc:60 source/main.cc:60 +msgid "ublexec version: " +msgstr "https://wiki.ublinux.ru" diff --git a/ublexec_ru.po b/ublexec_ru.po index 9acaf05..f4f0351 100644 --- a/ublexec_ru.po +++ b/ublexec_ru.po @@ -218,3 +218,7 @@ msgstr "pkexec" msgid "ОК" msgstr "ОК" + +#: source/main.cc:60 source/main.cc:60 +msgid "ublexec version: " +msgstr "ublexec версия: " From d155af273380568d84b9c790035671ee60e0354a Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Wed, 22 Mar 2023 16:51:22 +0600 Subject: [PATCH 3/6] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20help?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/main.cc | 11 +++++++++-- source/ublexec.cc | 17 ++++++++++++++++- source/ublexec.h | 1 + ublexec.pot | 6 +++++- ublexec_ru.po | 17 +++++++++++++++++ 5 files changed, 48 insertions(+), 4 deletions(-) diff --git a/source/main.cc b/source/main.cc index ad6da8b..3d19d28 100644 --- a/source/main.cc +++ b/source/main.cc @@ -34,8 +34,15 @@ int main(int argc, char** argv) { return 0; } else { - if (argc == 2) { - name_app_cmd = argv[1]; + if (argc == 3) { + name_app_cmd = argv[2]; + string str_flag = argv[1]; + if (str_flag == "-x") { + flag_prog_file = 1; + } + else if (str_flag == "-e") { + flag_prog_file = 2; + } } pars_flag(1,argc, argv); int local_argc = 1; diff --git a/source/ublexec.cc b/source/ublexec.cc index 9bd19b4..ead01c1 100644 --- a/source/ublexec.cc +++ b/source/ublexec.cc @@ -5,6 +5,7 @@ const string path_app = "/usr/bin/"; const string path_glade = "/usr/share/ublexec/ui/ublexec.glade"; const string path_css = "/usr/share/ublexec/css/ublexec.css"; const string app_name = "ublexec"; +int flag_prog_file = 0; string name_app_cmd = ""; string version_application = "2.23"; const string path_img_head_background = "/usr/share/ublexec/images/logo-background.png"; @@ -415,7 +416,13 @@ void MainWindow::unselect_icon(Gtk::IconView *icon_entry) { } void MainWindow::settings() { - user_cmd = name_app_cmd; + if (flag_prog_file == 1){ + user_cmd = name_app_cmd; + } + if (flag_prog_file == 2){ + path_file = name_app_cmd; + } + this->pars_apps(); this->get_builder(); this->event(); @@ -967,6 +974,14 @@ SettingsPlug::SettingsPlug(::Window p_socketID, Glib::RefPtr build } void help() { + string help = "GTK \"Run applications as another user with the specified priority\" for UBLinux\n\n" + "Usage: ublexec [OPTIONS...]\n" + "Options:\n" + " -h, --help Show this help\n" + " -V, --version Show package version\n" + " -x APP_NAME Running the program\n" + " -e FILE_NAME Running the file\n"; + cout << gettext(help.c_str()); } diff --git a/source/ublexec.h b/source/ublexec.h index c74ba00..a9af788 100644 --- a/source/ublexec.h +++ b/source/ublexec.h @@ -28,6 +28,7 @@ extern string name_app_cmd; extern const string path_img_head_background; extern int socket_ext_id_I; extern int socket_trd_id_I; +extern int flag_prog_file; extern string version_application; void me_thread(string cmd); class CmdArgParser : public Glib::OptionGroup diff --git a/ublexec.pot b/ublexec.pot index 42e4977..213feb7 100644 --- a/ublexec.pot +++ b/ublexec.pot @@ -215,6 +215,10 @@ msgstr "" msgid "ОК" msgstr "" -#: source/main.cc:60 source/main.cc:60 +#: source/main.cc:60 +msgid "ublexec version: " +msgstr "https://wiki.ublinux.ru" + +#: source/main.cc:970 msgid "ublexec version: " msgstr "https://wiki.ublinux.ru" diff --git a/ublexec_ru.po b/ublexec_ru.po index f4f0351..f7720a7 100644 --- a/ublexec_ru.po +++ b/ublexec_ru.po @@ -222,3 +222,20 @@ msgstr "ОК" #: source/main.cc:60 source/main.cc:60 msgid "ublexec version: " msgstr "ublexec версия: " + +msgid "" +"GTK \"Run applications as another user with the specified priority\" for UBLinux\n\n" +"Usage: ublexec [OPTIONS...]\n" +"Options:\n" +" -h, --help Show this help\n" +" -V, --version Show package version\n" +" -x APP_NAME Running the program\n" +" -e FILE_NAME Running the file\n" +msgstr "" +"GTK-утилита \"Запускать приложения от имени другого пользователя с указанным приоритетом\" для UBLinux\n\n" +"Использование: ublexec [Параметры приложения...]\n" +"Параметры приложения:\n" +" -h, --help\t Показать параметры справки\n" +" -V, --version\t Показать версию пакета\n" +" -x APP_NAME Запуск программ\n" +" -e FILE_NAME Запуск файла\n" From 998bc245668ca0de68713a93e823642c0147e940 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Wed, 22 Mar 2023 17:09:32 +0600 Subject: [PATCH 4/6] =?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=BF?= =?UTF-8?q?=D0=BE=D0=BB=D0=B7=D1=83=D0=BD=D0=BA=D0=B0.=20=D0=92=D1=8B?= =?UTF-8?q?=D1=80=D0=B0=D0=B2=D0=BD=D0=B5=D0=BD=D1=8B=20=D1=8D=D0=BB=D0=B5?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ublexec.glade | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ublexec.glade b/ublexec.glade index 9a8a46a..61c744e 100644 --- a/ublexec.glade +++ b/ublexec.glade @@ -1658,7 +1658,7 @@ with the specified priority 5 5 5 - 6 + 13 Priority: True 0 @@ -1678,12 +1678,10 @@ with the specified priority 5 5 5 - 9 adjustment1 20 0 0 - False True @@ -1699,7 +1697,7 @@ with the specified priority 5 5 5 - 6 + 15 True From 86e18588bc1cc6d954a00fd27bb457fb83f37236 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Wed, 22 Mar 2023 17:14:24 +0600 Subject: [PATCH 5/6] fix --- ublexec_ru.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ublexec_ru.po b/ublexec_ru.po index f7720a7..ed5156c 100644 --- a/ublexec_ru.po +++ b/ublexec_ru.po @@ -237,5 +237,5 @@ msgstr "" "Параметры приложения:\n" " -h, --help\t Показать параметры справки\n" " -V, --version\t Показать версию пакета\n" -" -x APP_NAME Запуск программ\n" +" -x APP_NAME Запуск программы\n" " -e FILE_NAME Запуск файла\n" From 1845812531f12d140452e14f5cf88666ea3e960f Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Thu, 23 Mar 2023 09:55:59 +0600 Subject: [PATCH 6/6] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=20=D0=B4=D0=B8=D0=B7=D0=B0=D0=B9=D0=BD=20=D0=BE=D0=BA=D0=BD?= =?UTF-8?q?=D0=B0=20"=D0=92=D0=BD=D0=B8=D0=BC=D0=B0=D0=BD=D0=B8=D0=B5"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/ublexec.cc | 9 ++-- source/ublexec.h | 2 +- ublexec.glade | 102 ++++++++++++++++++++++++++++++++-------------- ublexec.pot | 10 +++-- ublexec_ru.po | 8 +++- 5 files changed, 89 insertions(+), 42 deletions(-) diff --git a/source/ublexec.cc b/source/ublexec.cc index ead01c1..fe28f09 100644 --- a/source/ublexec.cc +++ b/source/ublexec.cc @@ -70,8 +70,6 @@ void MainWindow::get_builder() { builder->get_widget("messageError", messageError); builder->get_widget("lblMessageError", lblMessageError); builder->get_widget("btnMessageErrorOk", btnMessageErrorOk); - builder->get_widget("btnMessageErrorOk", btnMessageErrorOk); - builder->get_widget("btnMessageErrorOk", btnMessageErrorOk); builder->get_widget("dialogStartMenu", dialogStartMenu); builder->get_widget("btnStartMenuOK", btnStartMenuOK); builder->get_widget("btnStartMenuExit", btnStartMenuExit); @@ -180,7 +178,7 @@ void MainWindow::localization() { lblInfoExec->set_text(gettext("Change startup priority")); lblInfoPriority->set_text(gettext("Priority:")); lblMessageError->set_text(gettext("Select an executable file or program")); - messageError->set_title(gettext("Warning!")); + messageError->set_title(gettext("Attention")); lblGraphics->set_text(gettext("Graphics")); lblTools->set_text(gettext("Tools")); lblInternet->set_text(gettext("Internet")); @@ -194,6 +192,7 @@ void MainWindow::localization() { btnListApp->set_tooltip_text(gettext("Application Overview")); btnFilemaneg->set_tooltip_text(gettext("File Overview")); btnStartMenuExit->set_label(gettext("Cancel")); + btnMessageErrorOk->set_label(gettext("Close")); } void MainWindow::event() { @@ -638,7 +637,7 @@ string MainWindow::start_cmd(string user_cmd) { 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->set_title(gettext("Warning!")); + messageError->set_title(gettext("Attention")); messageError->show(); return ""; } @@ -707,7 +706,7 @@ void MainWindow::denamic_cmd() { name_app = ""; user_cmd = ""; txtCmd->set_text(user_cmd); - messageError->set_title(gettext("Warning!")); + messageError->set_title(gettext("Attention")); messageError->show(); } else{ diff --git a/source/ublexec.h b/source/ublexec.h index a9af788..407423d 100644 --- a/source/ublexec.h +++ b/source/ublexec.h @@ -147,7 +147,7 @@ public: Gtk::Label *lblTimeEpriorityLow; Gtk::Label *lblTime4EpriorityHigh; Gtk::Label *lblUserName; - Gtk::MessageDialog *messageError; + Gtk::Window *messageError; Gtk::Button *btnMessageErrorOk; Gtk::Label *lblMessageError; Gtk::Button *btnStartMenuOK; diff --git a/ublexec.glade b/ublexec.glade index 61c744e..98a67a5 100644 --- a/ublexec.glade +++ b/ublexec.glade @@ -1921,67 +1921,107 @@ with the specified priority - + False - Warning! - com.ublinux.ublexec - dialog - + start + False + + True False vertical - 2 - - + + + True False - True - end - + + True + False + center + start + 20 + 20 + 20 + 20 + 20 + 20 + dialog-warning-symbolic + 6 + + + False + True + 1 + - - OK + True - True - True - 5 - 5 - 5 - 5 - 6 - 6 + False + center + start + 10 + 25 + 10 + 25 + 34 + 20 + Select an executable file or program + True + 0 True True - 1 + 2 - False - False + True + True 0 - + + Close True - False - 10 - 10 - 15 - Select an executable file or program + True + True + 5 + 5 + 5 + 5 + 5 + 5 - True + False True 2 + + + True + False + Warning! + True + + + True + False + 32 + com.ublinux.ublexec + 5 + + + + False diff --git a/ublexec.pot b/ublexec.pot index 213feb7..9b8de70 100644 --- a/ublexec.pot +++ b/ublexec.pot @@ -187,7 +187,7 @@ msgid "User Name:" msgstr "" #: source/ublexec.cc:180 source/ublexec.cc:631 source/ublexec.cc:700 -msgid "Warning!" +msgid "Attention" msgstr "" #: source/ublexec.cc:157 source/ublexec.cc:154 @@ -217,8 +217,12 @@ msgstr "" #: source/main.cc:60 msgid "ublexec version: " -msgstr "https://wiki.ublinux.ru" +msgstr "" #: source/main.cc:970 msgid "ublexec version: " -msgstr "https://wiki.ublinux.ru" +msgstr "" + +#: source/main.cc:197 +msgid "Close" +msgstr "" diff --git a/ublexec_ru.po b/ublexec_ru.po index ed5156c..d069d6b 100644 --- a/ublexec_ru.po +++ b/ublexec_ru.po @@ -189,8 +189,8 @@ msgid "User Name:" msgstr "Имя пользователя:" #: source/ublexec.cc:180 source/ublexec.cc:631 source/ublexec.cc:700 -msgid "Warning!" -msgstr "Внимание!" +msgid "Attention" +msgstr "Внимание" #: source/ublexec.cc:157 source/ublexec.cc:154 msgid "https://wiki.ublinux.com" @@ -239,3 +239,7 @@ msgstr "" " -V, --version\t Показать версию пакета\n" " -x APP_NAME Запуск программы\n" " -e FILE_NAME Запуск файла\n" + +#: source/main.cc:197 +msgid "Close" +msgstr "Закрыть"