From a5867aa1f6dd9789b5287593fc087277c2107184 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Mon, 10 Apr 2023 11:42:14 +0000 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=D0=B0=20=D0=BB=D0=BE=D0=BA=D0=B0=D0=BB=D0=B8=D0=B7?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D1=8F,=20=D0=BD=D0=B0=D1=87=D0=B0=D0=BB=20?= =?UTF-8?q?=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=83=20=D0=BD=D0=B0=D0=B4=20?= =?UTF-8?q?=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=BE=D0=BD=D0=B0=D0=BB?= =?UTF-8?q?=D0=BE=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/CMakeLists.txt | 2 ++ source/project_lib.h | 1 - source/ubl-settings-quotas.cc | 40 +++++++++++++++++++++++++++++++---- source/ubl-settings-quotas.h | 15 +++++++++++-- ubl-settings-quotas_ru.po | 6 ++++++ 5 files changed, 57 insertions(+), 7 deletions(-) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 1223788..e3caf3b 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -16,6 +16,8 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissin -fstack-clash-protection -fcf-protection -g") set(SOURCE_FILES + my_device.h + my_device.cc project_lib.h ubl-settings-quotas.h ubl-settings-quotas.cc diff --git a/source/project_lib.h b/source/project_lib.h index da1025e..bc0b1d2 100644 --- a/source/project_lib.h +++ b/source/project_lib.h @@ -23,5 +23,4 @@ #include #include #include "ubl-util-standard.c" - #endif \ No newline at end of file diff --git a/source/ubl-settings-quotas.cc b/source/ubl-settings-quotas.cc index 9928ec8..f67757d 100755 --- a/source/ubl-settings-quotas.cc +++ b/source/ubl-settings-quotas.cc @@ -34,6 +34,8 @@ void MainWindow::settings() { builder->get_widget("boxColor", boxWidget); HeadOverlay->add_overlay(*boxWidget); ubl_make_plugs(boxSave, boxButton, socket_ext_id_I, socket_trd_id_I); + this->entry_generalGroupsEnableCheck(); + this->entry_generalUsersEnableCheck(); if (geteuid() == 0) { this->init_tree_view(); this->event(); @@ -56,15 +58,17 @@ void MainWindow::init_tree_view() { void MainWindow::lacalization() { time_t now = time(0); tm *ltm = localtime(&now); - unsigned int year = 1900+ ltm->tm_year; + unsigned int year = 1900 + ltm->tm_year; string str_authors = string(_("Copyright © UBSoft LLC, 2022 - ")) + to_string(year); aboutWindows->set_copyright(str_authors); - aboutWindows->set_comments(_("Date and Time")); + aboutWindows->set_comments(_("Setting user quotas")); aboutWindows->set_website(_("https://wiki.ublinux.com")); aboutWindows->set_version(gettext(version_application.c_str())); aboutWindows->set_website_label(_("Project Home Page")); generalTabLabel->set_text(_("General settings")); GroupsTabLabel->set_text(_("Groups")); + headerAboutTopic->set_label(_(app_name.c_str())); + headerTopic->set_label(_(app_name.c_str())); UsersTabLabel->set_text(_("Users")); generalDeviceLabel->set_text(_("Device:")); generalFileSystemLabel->set_text(_("File system:")); @@ -148,6 +152,14 @@ void MainWindow::lacalization() { btnSaveLocal->set_label(_("Save to local configuration")); } +void MainWindow::entry_generalGroupsEnableCheck() { + boxGeneralGroupsEnableCheck->set_sensitive(generalGroupsEnableCheck->get_active()); +} + +void MainWindow::entry_generalUsersEnableCheck() { + boxGeneralUsersEnableCheck->set_sensitive(generalUsersEnableCheck->get_active()); +} + void MainWindow::add_CSS() { Glib::RefPtr cssProvider = Gtk::CssProvider::create(); cssProvider->load_from_path(path_css); @@ -290,18 +302,29 @@ void MainWindow::get_builder() { builder->get_widget("quoteuserFilesSoftLimitlabel", quoteuserFilesSoftLimitlabel); builder->get_widget("QuotasEditWindow", QuotasEditWindow); builder->get_widget("QuotasUserEditWindow", QuotasUserEditWindow); + builder->get_widget("headerAboutTopic", headerAboutTopic); + builder->get_widget("lblHeadQuotasUserEditWindow", lblHeadQuotasUserEditWindow); + builder->get_widget("lblHeadQuotasEditWindow", lblHeadQuotasEditWindow); + builder->get_widget("lblHeadFiltersWindow", lblHeadFiltersWindow); + builder->get_widget("boxGeneralGroupsEnableCheck", boxGeneralGroupsEnableCheck); + builder->get_widget("generalGroupsEnableCheck", generalGroupsEnableCheck); + builder->get_widget("boxGeneralUsersEnableCheck", boxGeneralUsersEnableCheck); + } void MainWindow::event() { btnLoadGlob->signal_activate().connect([&]() {}); btnLoadLocal->signal_activate().connect([&]() {}); - btnSynopsis->signal_activate().connect([&]() {}); - btnAbout->signal_activate().connect([&]() {}); + btnSynopsis->signal_activate().connect([&]() {this->synopsis_show();}); + btnAbout->signal_activate().connect([&]() {aboutWindows->show();}); btnSaveLocalGlob->signal_activate().connect([&]() {}); btnSaveGlob->signal_activate().connect([&]() {}); btnSaveLocal->signal_activate().connect([&]() {}); groupsFiltersButton->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::groupsFilters_show)); usersFiltersButton->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::groupsFilters_show)); + generalGroupsEnableCheck->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::entry_generalGroupsEnableCheck)); + generalUsersEnableCheck->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::entry_generalUsersEnableCheck)); + } void MainWindow::groupsFilters_show() { @@ -400,6 +423,15 @@ void MainWindow::wrapper_save_global_cfg() { } +void MainWindow::synopsis_show() { + string cmd = "xdg-open " + string(_("https://wiki.ublinux.com/ru/Программное_обеспечение/Программы_и_утилиты/Все/")) + app_name; + if (geteuid() == 0) { + string response_user = getlogin(); + cmd = "su -l " + response_user + " -c \" DISPLAY=$DISPLAY " + cmd + " \""; + } + obj_process_system.call(cmd, "&"); +} + void MainWindow::wrapper_save_local_cfg() { this->set_data_cfg(); if (this->save_template("boot", "system")) { diff --git a/source/ubl-settings-quotas.h b/source/ubl-settings-quotas.h index b3ba81a..e55dd62 100644 --- a/source/ubl-settings-quotas.h +++ b/source/ubl-settings-quotas.h @@ -6,6 +6,7 @@ #include "save.h" #include "my_process.h" #include "my_type.h" +#include "my_device.h" extern int socket_ext_id_I; @@ -96,7 +97,6 @@ class MainWindow : public Gtk::ApplicationWindow { Gtk::Label *generalFileSystemLabel; Gtk::Label *lblLoad; Gtk::Label *lblSave; - Gtk::CheckButton *generalGroupsEnableCheck; Gtk::CheckButton *generalUsersEnableCheck; Gtk::MenuItem *btnLoadGlob; Gtk::MenuItem *btnLoadLocal; @@ -156,16 +156,24 @@ class MainWindow : public Gtk::ApplicationWindow { Gtk::Label *quoteuserFilesSoftLimitlabel; Gtk::Window *QuotasUserEditWindow; Gtk::Window *QuotasEditWindow; + Gtk::Label *headerAboutTopic; + Gtk::Label *lblHeadQuotasUserEditWindow; + Gtk::Label *lblHeadQuotasEditWindow; + Gtk::Label *lblHeadFiltersWindow; + Gtk::Box *boxGeneralGroupsEnableCheck; + Gtk::CheckButton *generalGroupsEnableCheck; + Gtk::Box *boxGeneralUsersEnableCheck; public: Lib_save::Save obj_save = Lib_save::Save(); Lib_Load::Load obj_load = Lib_Load::Load(); - vector vec_param_names; + Devices::Get_device obj_device = Devices::Get_device(); My_Process::My_Process_system obj_process_system = My_Process::My_Process_system(); My_Process::My_Process_call obj_process_call = My_Process::My_Process_call(); map_str_str map_gui_cfg; map_str_str map_global_cfg; map_str_str map_system_cfg; + vector vec_param_names; string str_cmd_error; @@ -177,7 +185,10 @@ class MainWindow : public Gtk::ApplicationWindow { void add_CSS(); void get_builder(); void event(); + void entry_generalGroupsEnableCheck(); + void synopsis_show(); void info_status_app(string stule); + void entry_generalUsersEnableCheck(); void groupsFilters_show(); void init_tree_view(); void load_template(map_str_str* map_temp, string str_load); diff --git a/ubl-settings-quotas_ru.po b/ubl-settings-quotas_ru.po index cd8e2f6..9bd1f21 100644 --- a/ubl-settings-quotas_ru.po +++ b/ubl-settings-quotas_ru.po @@ -17,6 +17,12 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +msgid "Setting user quotas" +msgstr "Настройка квот пользователей" + +msgid "ubl-settings-quotas" +msgstr "Квоты" + #: source/ubl-settings-quotas.cc:144 msgid "About" msgstr "О программе"