From d155af273380568d84b9c790035671ee60e0354a Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Wed, 22 Mar 2023 16:51:22 +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=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"