diff --git a/Makefile b/Makefile index c71260d..494a4fd 100644 --- a/Makefile +++ b/Makefile @@ -104,9 +104,9 @@ install: check uninstall @install -Dm755 -t /usr/bin/ ${CMAKE_BUILD_DIR}/${PKGNAME} @install -Dm644 -t /usr/share/applications/ ${PKGNAME}.desktop @install -Dm644 -t /usr/share/polkit-1/actions/ org.ublinux.pkexec.${PKGNAME}.exec.policy - @install -dm755 /usr/share/${PKGNAME}/{ui,images} + @install -dm755 /usr/share/${PKGNAME}/{ui,css,images} @install -Dm644 -t /usr/share/${PKGNAME}/ui/ ${PKGNAME}.glade -# @install -Dm644 -t /usr/share/${PKGNAME}/css/ style.css + @install -Dm644 -t /usr/share/${PKGNAME}/css/ style.css # @install -Dm644 -t /usr/share/${PKGNAME}/images/ ${PKGNAME}.svg # @install -Dm644 -t /usr/share/${PKGNAME}/images/ ${PKGNAME}.png @gtk-update-icon-cache -fiq /usr/share/icons/hicolor/ diff --git a/README.md b/README.md index 141ec06..0072bc5 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,28 @@ # ublexec +# ВЫполнить +# Build +In order to build ublexec you will need: + +- CMake +- C compiler +- GTK+ 3 & dependencies + +Once you have all the necessary dependencies, you can use: +```sh +$ make +``` + +# Installation +After a successful build, just use: +```sh +$ sudo make install clean +``` + +# Uninstallation +After a successful build, just use: +```sh +$ sudo make uninstall +``` + +![alt text](screenshot/screenshot.png) diff --git a/screenshot/screenshot.png b/screenshot/screenshot.png new file mode 100644 index 0000000..1c2ec43 Binary files /dev/null and b/screenshot/screenshot.png differ diff --git a/source/ublexec.cc b/source/ublexec.cc index 9688acd..522a1e3 100644 --- a/source/ublexec.cc +++ b/source/ublexec.cc @@ -34,6 +34,7 @@ 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"; //string path_app = "/home/superadmin/Документы/Проект/ubconfig_new/ubcall/"; string app_name = "ublexec"; CmdArgParser::CmdArgParser(const std::string& p_name, const std::string& p_description, const std::string& p_help) @@ -70,7 +71,7 @@ void MainWindow::get_builder(){ builder->get_widget("rbSu", rbSu); builder->get_widget("rbSudo", rbSudo); builder->get_widget("txtCmd", txtCmd); - builder->get_widget("wndChooseDirWallpaper", wndChooseDirWallpaper); + builder->get_widget("wndChooseFileWallpaper", wndChooseFileWallpaper); builder->get_widget("btnFilemangerExit", btnFilemangerExit); builder->get_widget("btnFilemangerOk", btnFilemangerOk); builder->get_widget("lblTimeEpriorityLow", lblTimeEpriorityLow); @@ -85,7 +86,6 @@ void MainWindow::get_builder(){ builder->get_widget("btnStartMenuOK", btnStartMenuOK); builder->get_widget("btnStartMenuExit", btnStartMenuExit); builder->get_widget("boxlistProgramm", boxlistProgramm); - builder->get_widget("lblInfoHead", lblInfoHead); builder->get_widget("lblinfoCmd", lblinfoCmd); builder->get_widget("lblInfoTime", lblInfoTime); @@ -97,9 +97,23 @@ void MainWindow::get_builder(){ builder->get_widget("lblInfoExec", lblInfoExec); builder->get_widget("lblInfoPriority", lblInfoPriority); builder->get_widget("lblInfoPriority", lblInfoEnterProg); + builder->get_widget("boxColor", boxColor); +} + +void MainWindow::add_CSS(){ + Glib::RefPtr cssProvider = Gtk::CssProvider::create(); + cssProvider->load_from_path(path_css); + Glib::RefPtr styleContext = Gtk::StyleContext::create(); + Glib::RefPtr screen = Gdk::Screen::get_default();//get default screen + styleContext->add_provider_for_screen(screen, cssProvider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);//add provider for screen in all application + Glib::RefPtr context = boxColor->get_style_context(); + context->add_class("cssboxColor1"); } + void MainWindow::localization(){ this->set_title(gettext("ublexec")); + btnStart->set_label(gettext("Run")); + wndChooseFileWallpaper->set_title(gettext("Please select File")); dialogStartMenu->set_title(gettext("Warning!")); lblInfoHead->set_text(gettext("Running applications as a user with a specified priority")); lblinfoCmd->set_text(gettext("Command Line")); @@ -113,7 +127,7 @@ void MainWindow::localization(){ lblInfoPriority->set_text(gettext("Priority:")); lblMessageError->set_text(gettext("Select an executable file or program")); lblInfoEnterProg->set_text(gettext("Selecting Programs")); - btnStart->set_label(gettext("Run")); + } void MainWindow::event(){ @@ -138,6 +152,7 @@ void MainWindow::settings(){ this->get_builder(); this->event(); this->localization(); + this->add_CSS(); spinPriority->set_range(-20,19); spinPriority->set_increments(1.0,-1.0); scalePriority->set_inverted(true); @@ -167,13 +182,13 @@ void MainWindow::activ_or_block_execute_epriority(){ } void MainWindow::open_filemaneg(){ - wndChooseDirWallpaper->show(); + wndChooseFileWallpaper->show(); } void MainWindow::close_filemaneg(){ - wndChooseDirWallpaper->hide(); + wndChooseFileWallpaper->hide(); } void MainWindow::get_path_filemaneg(){ - path_file_name = wndChooseDirWallpaper->get_filename(); + path_file_name = wndChooseFileWallpaper->get_filename(); if (path_file_name.length()==0){} else{ this->close_filemaneg(); @@ -265,9 +280,6 @@ void MainWindow::start_cmd(){ } txtCmd->set_text(str_cmd_terminal + str_variants_root + str_nice_cmd); - - - path_file_name=""; } void MainWindow::changed_user(){ diff --git a/source/ublexec.h b/source/ublexec.h index eb62d22..49b9dec 100644 --- a/source/ublexec.h +++ b/source/ublexec.h @@ -34,6 +34,7 @@ using namespace std; extern string path_app; extern string app_name; extern string path_glade; +extern string path_css; class CmdArgParser : public Glib::OptionGroup @@ -62,6 +63,7 @@ public: MainWindow(BaseObjectType* obj, Glib::RefPtr const& builder); MainWindow(Glib::RefPtr const& builder); void get_builder(); + void add_CSS(); void localization(); void event(); void settings(); @@ -99,7 +101,7 @@ public: Gtk::RadioButton *rbSu; Gtk::RadioButton *rbSudo; Gtk::Entry *txtCmd; - Gtk::FileChooserDialog *wndChooseDirWallpaper; + Gtk::FileChooserDialog *wndChooseFileWallpaper; Gtk::Button *btnFilemangerExit; Gtk::Button *btnFilemangerOk; Gtk::Label *lblTimeEpriority; @@ -114,16 +116,17 @@ public: Gtk::Box *boxlistProgramm; Gtk::Dialog *dialogStartMenu; Gtk::Label *lblInfoHead; - Gtk::Label * lblinfoCmd; - Gtk::Label * lblInfoTime; - Gtk::Label * labInfoExecutTerm; - Gtk::Label * lblInfoUser; - Gtk::Label * lblInfoUserOther; - Gtk::Label * lblInfoUserName; - Gtk::Label * lblInfoNooPriority; - Gtk::Label * lblInfoExec; - Gtk::Label * lblInfoPriority; - Gtk::Label * lblInfoEnterProg; + Gtk::Label *lblinfoCmd; + Gtk::Label *lblInfoTime; + Gtk::Label *labInfoExecutTerm; + Gtk::Label *lblInfoUser; + Gtk::Label *lblInfoUserOther; + Gtk::Label *lblInfoUserName; + Gtk::Label *lblInfoNooPriority; + Gtk::Label *lblInfoExec; + Gtk::Label *lblInfoPriority; + Gtk::Label *lblInfoEnterProg; + Gtk::Box *boxColor; diff --git a/style.css b/style.css new file mode 100644 index 0000000..f3bdf4e --- /dev/null +++ b/style.css @@ -0,0 +1,4 @@ +.cssboxColor1{ + background-color: rgb(255, 255, 255); + background-size: 100% auto; +} \ No newline at end of file diff --git a/ublexec.glade b/ublexec.glade index 84fe9bc..552ef51 100644 --- a/ublexec.glade +++ b/ublexec.glade @@ -122,6 +122,7 @@ False + Выполнить True @@ -138,7 +139,7 @@ False vertical - + True False @@ -171,6 +172,9 @@ 6 6 Запуск приложений от имени пользователя с указанным приоритетом + + + True @@ -264,8 +268,8 @@ 5 5 5 - 6 - 6 + 3 + 3 True @@ -963,9 +967,9 @@ - + False - Пожалуйста Выберите Файл + Пожалуйста выберите Файл True center 500 diff --git a/ublexec_ru.po b/ublexec_ru.po index 591a127..e395e0c 100644 --- a/ublexec_ru.po +++ b/ublexec_ru.po @@ -67,7 +67,7 @@ msgid "Select an executable file or program" msgstr "Выберите исполняемый файл или программу" msgid "Please select File" -msgstr "Пожалуйста Выберите Файл" +msgstr "Пожалуйста выберите Файл" msgid "Warning!" msgstr "Внимание!"