| @ -0,0 +1,3 @@ | ||||
| .vscode/ | ||||
| ubl-settings-diskquota.glade~ | ||||
| ubl-settings-diskquota_ru.po~ | ||||
| @ -0,0 +1,159 @@ | ||||
| #!/usr/bin/make -f
 | ||||
| 
 | ||||
| #SHELL := /bin/bash
 | ||||
| MAKEFILE_FILEPATH := $(abspath $(lastword $(MAKEFILE_LIST))) | ||||
| MAKEFILE_DIR := $(notdir $(patsubst %/,%,$(dir $(MAKEFILE_FILEPATH)))) | ||||
| MAKEFILE_PATH := $(dir $(MAKEFILE_FILEPATH)) | ||||
| 
 | ||||
| CMAKE_COMMAND = cmake | ||||
| CMAKE_SOURCE_DIR = $(MAKEFILE_PATH)source | ||||
| CMAKE_BUILD_DIR = $(MAKEFILE_PATH)compile | ||||
| #CMAKE_SOURCE_DIR = ./source
 | ||||
| #CMAKE_BUILD_DIR = ./compile
 | ||||
| FILE_VERSION = VERSION.md | ||||
| DEPENDS = /bin/cmake | ||||
| PREFIX ?= /usr | ||||
| PKGNAME = $(MAKEFILE_DIR) | ||||
| #PKGNAME = ubl-settings-diskquota
 | ||||
| 
 | ||||
| default_target: all | ||||
| 
 | ||||
| .PHONY: all init depend debug prepare check build uninstall install clean up_ver help | ||||
| 
 | ||||
| all: init build | ||||
| 
 | ||||
| init: | ||||
| 	@echo "Initialize ..."; \
 | ||||
| 	sed -r "s/(version_application = ).*/\1\"$$(grep 'VERSION' ${FILE_VERSION} | cut -d" " -f2)\";/" -i source/ubl-settings-diskquota.cc; \
 | ||||
| 	echo "-- Build path: ${CMAKE_BUILD_DIR}" | ||||
| 
 | ||||
| depend: | ||||
| 	@echo "Check depends ..." | ||||
| 	@for FILE_DEPEND in $(DEPENDS); do \
 | ||||
| 	    if [ ! -f $${FILE_DEPEND} ]; then \
 | ||||
| 		echo "ERROR: Depend '$${FILE_DEPEND}' not found !"; \
 | ||||
| 		exit 1; \
 | ||||
| 	    fi; \
 | ||||
| 	done; \
 | ||||
| 	echo "Check depends: OK" | ||||
| #	$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
 | ||||
| 
 | ||||
| debug: | ||||
| 	@echo "Debug ..." | ||||
| 	if [ ! -d ${CMAKE_BUILD_DIR} ]; then \
 | ||||
| 	    $(CMAKE_COMMAND) -S${CMAKE_SOURCE_DIR} -B${CMAKE_BUILD_DIR} -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX="${PREFIX}"; \
 | ||||
| 	fi; \
 | ||||
| 	echo "Debug: OK" | ||||
| 
 | ||||
| prepare: | ||||
| 	@echo "Prepare ..."; \
 | ||||
| 	if [ ! -d ${CMAKE_BUILD_DIR} ]; then \
 | ||||
| 	    $(CMAKE_COMMAND) -S${CMAKE_SOURCE_DIR} -B${CMAKE_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${PREFIX}"; \
 | ||||
| 	fi; \
 | ||||
| 	echo "Prepare: OK" | ||||
| 
 | ||||
| check: | ||||
| 	@echo "Check ..."; \
 | ||||
| 	if [ -f ${CMAKE_BUILD_DIR}/${PKGNAME} ]; then \
 | ||||
| 	    echo "Check: OK"; \
 | ||||
| 	else \
 | ||||
| 	    echo "Check: ${CMAKE_BUILD_DIR}/${PKGNAME} not found !"; \
 | ||||
| 	    exit 1; \
 | ||||
| 	fi | ||||
| 
 | ||||
| build: depend prepare | ||||
| 	@echo "Build ..."; \
 | ||||
| 	make --directory=${CMAKE_BUILD_DIR}; \
 | ||||
| 	echo "Build: OK" | ||||
| 
 | ||||
| uninstall: | ||||
| 	@echo "Uninstall ..." | ||||
| 	@for FILE_PO in $(wildcard *.po); do \
 | ||||
| 	    LANG=$${FILE_PO##*_};LANG=$${LANG%.*}; \
 | ||||
| 	    FILE_MO=$${FILE_PO##*/}; FILE_MO="$${FILE_MO%_*.po}.mo"; \
 | ||||
| 	    PATH_FILE_MO="${DESTDIR}${PREFIX}/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \
 | ||||
| 	    $(RM) "$${PATH_FILE_MO}"; \
 | ||||
| 	done | ||||
| 	@for SIZE in 16x16 32x32 48x48 scalable; do \
 | ||||
| 	    $(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}/apps/com.ublinux.${PKGNAME}.svg"; \
 | ||||
| 	    $(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}/apps/com.ublinux.${PKGNAME}.png"; \
 | ||||
| 	done | ||||
| 	@for FILE_SVG in $(wildcard *.svg); do \
 | ||||
| 	    for SIZE in 16x16 32x32 48x48 scalable; do \
 | ||||
| 	        $(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}/status/$${FILE_SVG%.*}".{svg,png,jpg}; \
 | ||||
| 	    done; \
 | ||||
| 	done | ||||
| 	@$(RM) "${DESTDIR}${PREFIX}/bin/${PKGNAME}" | ||||
| 	@$(RM) "${DESTDIR}${PREFIX}/share/applications/${PKGNAME}.desktop" | ||||
| 	@$(RM) "${DESTDIR}${PREFIX}/share/${PKGNAME}/images/logo-background.png" | ||||
| 	@$(RM) "${DESTDIR}${PREFIX}/share/polkit-1/actions/com.ublinux.pkexec.${PKGNAME}.exec.policy" | ||||
| 	@$(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/com.ublinux.${PKGNAME}.svg" | ||||
| 	@$(RM) -rd "${DESTDIR}${PREFIX}/share/${PKGNAME}" | ||||
| 	@if [ -z ${DESTDIR} ]; then \
 | ||||
| 	    [ -d "${DESTDIR}${PREFIX}/share/icons/hicolor/" ] && gtk-update-icon-cache -fiq "${DESTDIR}${PREFIX}/share/icons/hicolor/" &>/dev/null || true; \
 | ||||
| 	    update-desktop-database --quiet &>/dev/null || true; \
 | ||||
| 	    [ -d "${DESTDIR}${PREFIX}/share/applications" ] && touch "${DESTDIR}${PREFIX}/share/applications" &>/dev/null || true; \
 | ||||
| 	fi | ||||
| 	@echo "Uninstall: OK" | ||||
| 
 | ||||
| install: check uninstall | ||||
| 	@echo "Install ..." | ||||
| 	@for FILE_PO in $(wildcard *.po); do \
 | ||||
| 		LANG=$${FILE_PO##*_};LANG=$${LANG%.*}; \
 | ||||
| 		install -dm755 "${DESTDIR}${PREFIX}/share/locale/$${LANG}/LC_MESSAGES"; \
 | ||||
| 		FILE_MO=$${FILE_PO##*/}; FILE_MO="$${FILE_MO%_*.po}.mo"; \
 | ||||
| 		PATH_FILE_MO="${DESTDIR}${PREFIX}/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \
 | ||||
| 		echo "$${FILE_PO}"; \
 | ||||
| 		msgfmt "$${FILE_PO}" -v -f -o "$${PATH_FILE_MO}"; \
 | ||||
| 	done | ||||
| 	@for SIZE in 16 32 48; do \
 | ||||
| 		install -dm755 "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}x$${SIZE}/apps"; \
 | ||||
| 		rsvg-convert -w $${SIZE} -h $${SIZE} -f png --keep-image-data "com.ublinux.${PKGNAME}.svg" -o "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}x$${SIZE}/apps/com.ublinux.${PKGNAME}.png"; \
 | ||||
| 	done | ||||
| 	@install -dm755 "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps" | ||||
| 	@install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/" "com.ublinux.${PKGNAME}.svg" | ||||
| 	@install -Dm755 -t "${DESTDIR}${PREFIX}/bin/" "${CMAKE_BUILD_DIR}/${PKGNAME}" | ||||
| 	@install -dm755 "${DESTDIR}${PREFIX}/share/applications" | ||||
| 	@install -Dm644 -t "${DESTDIR}${PREFIX}/share/applications/" "${PKGNAME}.desktop" | ||||
| 	@install -dm755 "${DESTDIR}${PREFIX}/share/polkit-1/actions" | ||||
| 	@install -Dm644 -t "${DESTDIR}${PREFIX}/share/polkit-1/actions/" "com.ublinux.pkexec.${PKGNAME}.exec.policy" | ||||
| 	@install -dm755 "${DESTDIR}${PREFIX}/share/${PKGNAME}"/{ui,css,images} | ||||
| 	@install -Dm644 -t "${DESTDIR}${PREFIX}/share/${PKGNAME}/ui/" "${PKGNAME}.glade" | ||||
| 	@install -Dm644 -t "${DESTDIR}${PREFIX}/share/${PKGNAME}/css/" "${PKGNAME}.css" | ||||
| 	@install -Dm644 -t "${DESTDIR}${PREFIX}/share/${PKGNAME}/images/" "logo-background.png" | ||||
| 	@install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.checked.svg" | ||||
| 	@install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.warning.svg" | ||||
| 	@if [ -z ${DESTDIR} ]; then \
 | ||||
| 	    [ -d "${DESTDIR}${PREFIX}/share/icons/hicolor/" ] && gtk-update-icon-cache -fiq "${DESTDIR}${PREFIX}/share/icons/hicolor/" &>/dev/null || true; \
 | ||||
| 	    update-desktop-database --quiet &>/dev/null || true; \
 | ||||
| 	    [ -d "${DESTDIR}${PREFIX}/share/applications" ] && touch "${DESTDIR}${PREFIX}/share/applications" &>/dev/null || true; \
 | ||||
| 	fi | ||||
| 	@echo "Install: OK" | ||||
| 
 | ||||
| clean: | ||||
| 	@echo "Clean ..." | ||||
| 	@$(RM) -rd ${CMAKE_BUILD_DIR} | ||||
| 	@if [ -d ${CMAKE_BUILD_DIR} ]; then \
 | ||||
| 	    echo "Clean: error, compile directory exist ${CMAKE_BUILD_DIR}"; \
 | ||||
| 	else \
 | ||||
| 	    echo "Clean: OK"; \
 | ||||
| 	fi | ||||
| 
 | ||||
| up_ver: | ||||
| 	@CURRENT=$$(grep 'VERSION' ${FILE_VERSION} | cut -d" "  -f2); \
 | ||||
| 	MAJOR=$$(cut -d. -f1 <<< $${CURRENT}); \
 | ||||
| 	MINOR=$$(cut -d. -f2 <<< $${CURRENT}); \
 | ||||
| 	VER="$${MAJOR}.$$(($${MINOR}+1))"; \
 | ||||
| 	sed "s/VERSION *[[:digit:]]*.*/VERSION $${VER}/" -i ${FILE_VERSION}; \
 | ||||
| 	echo "Updated version to VERSION.md: $${CURRENT} to $${VER}" | ||||
| 
 | ||||
| help: | ||||
| 	@echo "The following are some of the valid targets for this Makefile:" | ||||
| 	@echo "... all (the default if no target is provided)" | ||||
| 	@echo "... init" | ||||
| 	@echo "... debug" | ||||
| 	@echo "... prepare" | ||||
| 	@echo "... compile" | ||||
| 	@echo "... install" | ||||
| 	@echo "... uninstall" | ||||
| 	@echo "... clean" | ||||
| @ -1,2 +1,49 @@ | ||||
| # ubl-settings-quotas | ||||
| # ubl-settings-diskquota | ||||
| # Настройки квот | ||||
| [RU] Утилита для настройки дисковых квот  | ||||
| 
 | ||||
| Utility for setting the disk quotas | ||||
| 
 | ||||
|  | ||||
| 
 | ||||
| # Build | ||||
| In order to build ubl-settings-diskquota 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 | ||||
| ``` | ||||
| # Usage | ||||
| ```sh | ||||
| $ ubl-settings-diskquota --help | ||||
| GTK settings disk quota for UBLinux                                | ||||
|                                                                    | ||||
| Usage:  ubl-settings-diskquota [OPTIONS...]                        | ||||
| Options:                                                            | ||||
|   -h, --help            Show this help                                       | ||||
|   -V, --version         Show package version                      | ||||
|     --lock-help         Lock utility help                           | ||||
|     --lock-save         Lock saving local and global configuration  | ||||
|     --lock-save-local   Lock save global configuration              | ||||
|     --lock-save-global  Lock load global configuration | ||||
|     --lock-load-global  Lock load global configuration | ||||
| 
 | ||||
| $ ubl-settings-diskquota --version | ||||
| ubl-settings-diskquota version: x.xx | ||||
| ``` | ||||
|  | ||||
| @ -0,0 +1 @@ | ||||
| VERSION 1.0 | ||||
| After Width: | Height: | Size: 7.4 KiB | 
| After Width: | Height: | Size: 218 KiB | 
| After Width: | Height: | Size: 2.1 KiB | 
| After Width: | Height: | Size: 33 KiB | 
| After Width: | Height: | Size: 76 KiB | 
| @ -0,0 +1,68 @@ | ||||
| cmake_minimum_required(VERSION 3.7) | ||||
| project(ubl-settings-diskquota) | ||||
| 
 | ||||
| find_package(PkgConfig REQUIRED) | ||||
| 
 | ||||
| pkg_check_modules(GTK REQUIRED gtkmm-3.0) | ||||
| include_directories(${GTK_INCLUDE_DIRS}) | ||||
| link_directories(${GTK_LIBRARY_DIRS}) | ||||
| add_definitions(${GTK_CFLAGS_OTHER}) | ||||
| 
 | ||||
| find_library(WEBKIT_LIBRARIES_FOUND webkit2gtk-4.0 webkit2gtk-web-extension-4.0) | ||||
| 
 | ||||
| option(WEBKIT_FOUND "No" OFF) | ||||
| 
 | ||||
| find_library(WEBKIT_LIBRARIES_FOUND webkit2gtk-4.0 webkit2gtk-web-extension-4.0) | ||||
| if(WEBKIT_LIBRARIES_FOUND) | ||||
|         option(WEBKIT_FOUND "Yes" ON) | ||||
|         PKG_CHECK_MODULES(WEBKIT REQUIRED webkit2gtk-4.0 webkit2gtk-web-extension-4.0) | ||||
|         include_directories(${WEBKIT_INCLUDE_DIRS}) | ||||
|         link_directories(${WEBKIT_LIBRARY_DIRS}) | ||||
|         add_definitions(${WEBKIT_CFLAGS_OTHER}) | ||||
| endif() | ||||
| configure_file(ubl-settings-diskquota.h.in ubl-settings-diskquota-cm.h) | ||||
| 
 | ||||
| #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always -std=c++2a -g") | ||||
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always \ | ||||
| 	-O2 -pipe -fno-plt -fexceptions \ | ||||
|         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \ | ||||
|         -fstack-clash-protection -fcf-protection -g") | ||||
| 
 | ||||
| set(SOURCE_FILES | ||||
|         ubl-settings-diskquota-cm.h | ||||
|         ubl-settings-diskquota.h  | ||||
|         ubl-settings-diskquota.cc | ||||
|         ubconfig_quotas.h | ||||
|         ubconfig_quotas.cc | ||||
|         system_quotas.h | ||||
|         system_quotas.cc | ||||
|         my_device.h | ||||
|         my_device.cc | ||||
|         project_lib.h | ||||
|         my_type.h | ||||
|         save.h | ||||
|         save.cc | ||||
|         load.h | ||||
|         load.cc | ||||
|         my_process.h | ||||
|         my_process.cc | ||||
|         util.h | ||||
|         util.cc | ||||
|         my_plug.h | ||||
|         my_plug.cc | ||||
|         ubl-util-standard.h | ||||
|         ubl-util-standard.c | ||||
|         main.cc)   | ||||
| 
 | ||||
| set(LIBRARIES | ||||
|         ${GTK_LIBRARIES} | ||||
|         pthread) | ||||
| 
 | ||||
| add_executable(ubl-settings-diskquota ${SOURCE_FILES}) | ||||
| 
 | ||||
| target_link_libraries(ubl-settings-diskquota PUBLIC ${WEBKIT_LIBRARIES} ${LIBRARIES}) | ||||
| target_include_directories(ubl-settings-diskquota PUBLIC | ||||
|                            "${PROJECT_BINARY_DIR}" | ||||
|                            ${WEBKIT_INCLUDE_DIRS} | ||||
|                            ) | ||||
| install(TARGETS ubl-settings-diskquota DESTINATION bin) | ||||
| @ -0,0 +1,46 @@ | ||||
| #include "controler.h" | ||||
| Back_Back::Back_Back() {} | ||||
| void Back_Back::set_mode(string flag_mode) { | ||||
|     this->flag_mode = flag_mode; | ||||
| } | ||||
| 
 | ||||
| void Back_Back::set_partition(string partition) { | ||||
|     this->partition = partition; | ||||
| } | ||||
| 
 | ||||
| void Back_Back::set_sys_flag(string sys_flag) { | ||||
|     this->sys_flag = sys_flag; | ||||
| } | ||||
| 
 | ||||
| bool Back_Back::wrapper_off_quotas(string quotas_type) { | ||||
|     bool flag_status = false; | ||||
|     quotas_type = this->handler_quotas_type(quotas_type); | ||||
|     if (flag_mode == "system") { | ||||
|         string cmd_hw = ""; | ||||
|         string cmd_sw = ""; | ||||
|         flag_status = obj_quotas_sys.off_quota(partition, cmd_hw, cmd_sw); | ||||
|     } | ||||
|     else if (flag_mode == "ubconfig") { | ||||
|         flag_status = obj_quotas_ubconfig.off_quota(partition, quotas_type, "disable"); | ||||
|     } | ||||
|     return flag_status; | ||||
| } | ||||
| bool Back_Back::wrapper_on_quotas(string quotas_type) { | ||||
|     bool flag_status = false; | ||||
|     quotas_type = this->handler_quotas_type(quotas_type); | ||||
|     if (flag_mode == "system") { | ||||
|         string cmd_hw = ""; | ||||
|         string cmd_sw = ""; | ||||
|         flag_status = obj_quotas_sys.on_quota_hw(partition, cmd_hw, cmd_sw); | ||||
|         flag_status = obj_quotas_sys.wrapper_on_quotas(partition, quotas_type); | ||||
|     } | ||||
|     else if (flag_mode == "ubconfig") { | ||||
|         flag_status = obj_quotas_sys.wrapper_on_quotas(partition, quotas_type, "enable"); | ||||
|         flag_status = obj_quotas_ubconfig.format_cmd_quotas(); | ||||
|     } | ||||
|     return flag_status; | ||||
| } | ||||
| 
 | ||||
| string Back_Back::handler_quotas_type(string quotas_type) { | ||||
|     return quotas_type; | ||||
| } | ||||
| @ -0,0 +1,19 @@ | ||||
| #include "system_quotas.h" | ||||
| #include "ubconfig_quotas.h" | ||||
| 
 | ||||
| class Back_Back{ | ||||
|     public: | ||||
|         string flag_mode; | ||||
|         string partition; | ||||
|         string sys_flag; | ||||
|         Quotas_sys::Quotas_sys obj_quotas_sys = Quotas_sys::Quotas_sys(); | ||||
|         Quotas_ubconfig::Quotas_ubconfig obj_quotas_ubconfig = Quotas_ubconfig::Quotas_ubconfig(); | ||||
|     public: | ||||
|         Back_Back(); | ||||
|         void set_mode(string flag_mode); | ||||
|         void set_partition(string partition); | ||||
|         void set_sys_flag(string sys_flag); | ||||
|         bool wrapper_off_quotas(string quotas_type); | ||||
|         string handler_quotas_type(string quotas_type); | ||||
|         bool wrapper_on_quotas(string quotas_type); | ||||
| }; | ||||
| @ -0,0 +1,39 @@ | ||||
| #include "load.h" | ||||
| 
 | ||||
| namespace Lib_Load{ | ||||
|     void Load::set_sections(string sections){ | ||||
|         this->sections = sections; | ||||
|     } | ||||
|     void Load::set_count_error(int count_error) { | ||||
|         process.set_count_error(count_error); | ||||
|     } | ||||
|     string Load::get_cmd_error() { | ||||
|         return process.get_cmd_error(); | ||||
|     } | ||||
|     map<string, string>& Load::get_load_data(std::map <string, string> &map_temp, string str_flag_load) { | ||||
|         string cmd = ""; | ||||
|         string response = ""; | ||||
|         string key = ""; | ||||
|         string value = ""; | ||||
|         cmd = "ubconfig  --default --source " + str_flag_load + " get " + this->sections; | ||||
|         response = process.call_all_sections(cmd); | ||||
|         vector<string> vec_str_key_value = Utils::split(response, '\n'); | ||||
|         for (const string ¶m: vec_str_key_value) { | ||||
|             if ((param.find("(null)") == std::string::npos) && (param.length() != 0 )) {  | ||||
|                 if (param.find("=") != std::string::npos) { | ||||
|                     size_t index = param.find("="); | ||||
|                     key = param.substr(0, index); | ||||
|                     value = param.substr(index + 1, param.length()); | ||||
|                     Utils::str_replace_all(value, " \"",""); | ||||
|                     Utils::str_replace_all(value, "\"",""); | ||||
|                     map_temp[key] = value; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         return map_temp; | ||||
|     } | ||||
|     int Load::get_count_error() { | ||||
|         return process.get_count_error(); | ||||
|     } | ||||
|      | ||||
| } | ||||
| @ -0,0 +1,21 @@ | ||||
| #ifndef LOAD_H | ||||
| #define LOAD_H | ||||
| 
 | ||||
| #include "my_process.h" | ||||
| namespace Lib_Load{ | ||||
|     class Load { | ||||
|          | ||||
|     private: | ||||
|         string sections; | ||||
|         My_Process::My_Process_call process = My_Process::My_Process_call(); | ||||
|     public: | ||||
|         void set_sections(string sections); | ||||
|         int get_count_error(); | ||||
|         void set_count_error(int count_error); | ||||
|         string get_cmd_error(); | ||||
|         map<string, string>& get_load_data(std::map <string, string> &map_temp, string str_flag_load); | ||||
|     }; | ||||
| 
 | ||||
|      | ||||
| } | ||||
| #endif | ||||
| @ -0,0 +1,93 @@ | ||||
| #include "my_plug.h" | ||||
| 
 | ||||
| void pars_flag(int index_start, int argc, char* argv[]); | ||||
| 
 | ||||
| int main(int argc, char** argv) { | ||||
|     string str_argv= ""; | ||||
|     string str_cmd_argv = ""; | ||||
|     for (int i=1; i<argc; i++){ | ||||
|         str_cmd_argv+= to_string(*argv[i]) + " "; | ||||
|     }   | ||||
|     if (argc > 1){ | ||||
|         str_argv = argv[1]; | ||||
|     } | ||||
|     bindtextdomain(app_name, "/usr/share/locale/"); | ||||
|     bind_textdomain_codeset(app_name, "UTF-8"); | ||||
|     textdomain(app_name); | ||||
|     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; | ||||
|      | ||||
|         CmdArgParser parser{ | ||||
|             "Socket ID", | ||||
|             "Command line argument for socket ID communication.", | ||||
|             "No help available, sorry" | ||||
|         }; | ||||
| 
 | ||||
|         context.set_main_group(parser); | ||||
|         context.parse(argc, argv);  | ||||
| 
 | ||||
|         ::Window socketID = parser.GetSocketID(); | ||||
| 
 | ||||
|         // Handle plug:
 | ||||
|         SettingsPlug plug{socketID, builder}; | ||||
|         plug.show(); | ||||
|      | ||||
|         app->run(plug); | ||||
|         return 0; | ||||
|     } | ||||
|     else if (str_argv.find("-") != std::string::npos || argc == 1) { | ||||
|         int len_argv = 1; | ||||
|         auto app = Gtk::Application::create(len_argv, argv, "org.gtkmm.example.plug"); | ||||
|         auto builder = Gtk::Builder::create_from_file(path_glade); | ||||
|         pars_flag(1, argc, argv); | ||||
|         MainWindow* wnd = nullptr; | ||||
|         builder->get_widget_derived("MainWindow", wnd); | ||||
|         auto r = app->run(*wnd); | ||||
|         delete wnd; | ||||
|         return r; | ||||
|     } | ||||
|      | ||||
| } | ||||
| void pars_flag(int index_start, int argc, char* argv[]) { | ||||
|     string str_argv = ""; | ||||
|     for (int i = index_start; i<argc; i++){ | ||||
|         str_argv = argv[i]; | ||||
|         if (str_argv == "--help" || str_argv == "-h"){ | ||||
|             help(); | ||||
|             exit(1); | ||||
|         } | ||||
|         else if (str_argv == "--version" || str_argv == "-v"){ | ||||
|             string version = string(str_version) + version_application + "\n"; | ||||
|             cout << version.c_str(); | ||||
|             exit(1); | ||||
|         } | ||||
|         else if (str_argv == "--lock-help") { | ||||
|             flag_lock_help = true; | ||||
|         } | ||||
|         else if (str_argv == "--lock-save") { | ||||
|             flag_save = true; | ||||
|             flag_save_local = true; | ||||
|             flag_save_global = true; | ||||
|         } | ||||
|         else if (str_argv == "--lock-save-local"){ | ||||
|             flag_save_local = true; | ||||
|         } | ||||
|         else if (str_argv == "--lock-save-global"){ | ||||
|             flag_save_global = true; | ||||
|         } | ||||
|         else if (str_argv == "--lock-load-global"){ | ||||
|             flag_load_global = true; | ||||
|         } | ||||
|         else{ | ||||
|             if (index_start == 1){ | ||||
|                 g_print(no_recognized); | ||||
|             } | ||||
|         } | ||||
|          | ||||
|              | ||||
|     } | ||||
| } | ||||
| @ -0,0 +1,29 @@ | ||||
| #include "my_device.h" | ||||
| 
 | ||||
| 
 | ||||
| namespace Devices { | ||||
|      | ||||
|     map_str_str Parted::get_parted() { | ||||
|         string cmd = "lsblk --fs --raw --output PATH,FSTYPE  --exclude 7,11,253"; | ||||
|         string response = obj_process_call.call_all_sections(cmd); | ||||
|         vector<string> vec_parted = Utils::split(response, '\n'); | ||||
|         map_str_str dict_parted; | ||||
|         string key = ""; | ||||
|         string value = ""; | ||||
|         if (vec_parted.size()>1) { | ||||
|             vec_parted.erase(vec_parted.begin()); | ||||
|         } | ||||
|         for (const string& str_parted : vec_parted) { | ||||
|             key = str_parted.substr(0, str_parted.find(" ")); | ||||
|             if (str_parted.find(" ") != string::npos) { | ||||
|                 value = str_parted.substr(str_parted.find(" ") + 1, str_parted.length()); | ||||
|                 if (value.length()>0) { | ||||
|                     dict_parted[key] = value; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|          | ||||
|         return dict_parted; | ||||
|     } | ||||
|      | ||||
| } | ||||
| @ -0,0 +1,20 @@ | ||||
| #ifndef MY_DEVICE_H | ||||
| #define MY_DEVICE_H | ||||
| 
 | ||||
| #include "project_lib.h" | ||||
| #include "my_process.h" | ||||
| #include "util.h" | ||||
| #include "my_type.h" | ||||
| 
 | ||||
| 
 | ||||
| namespace Devices { | ||||
|     class Parted{ | ||||
|         protected: | ||||
|             My_Process::My_Process_call obj_process_call = My_Process::My_Process_call(); | ||||
|         public: | ||||
|             map_str_str get_parted(); | ||||
|     }; | ||||
|      | ||||
| } | ||||
| #endif | ||||
| 
 | ||||
| @ -0,0 +1,38 @@ | ||||
| #ifndef MY_PLUG_H | ||||
| #define MY_PLUG_H | ||||
| 
 | ||||
| #include "my_plug.h" | ||||
| 
 | ||||
| 
 | ||||
| CmdArgParser::CmdArgParser(const std::string& p_name, const std::string& p_description, const std::string& p_help) | ||||
| : Glib::OptionGroup{p_name, p_description, p_help} { | ||||
|     Glib::OptionEntry socketIDArg; | ||||
|     socketIDArg.set_long_name("socket-id"); | ||||
|     socketIDArg.set_flags(Glib::OptionEntry::FLAG_IN_MAIN); | ||||
|     socketIDArg.set_description("Settings manager socket"); | ||||
|     Glib::OptionEntry socketExtId; | ||||
|     socketExtId.set_long_name("socket-ext-id"); | ||||
|     socketExtId.set_flags(Glib::OptionEntry::FLAG_IN_MAIN); | ||||
|     socketExtId.set_description("Settings manager secondary socket"); | ||||
|     Glib::OptionEntry socketTrdId; | ||||
|     socketTrdId.set_long_name("socket-trd-id"); | ||||
|     socketTrdId.set_flags(Glib::OptionEntry::FLAG_IN_MAIN); | ||||
|     socketTrdId.set_description("Settings manager secondary socket"); | ||||
|     add_entry(socketIDArg, m_socketID); | ||||
|     add_entry(socketExtId, socket_ext_id_I); | ||||
|     add_entry(socketTrdId, socket_trd_id_I); | ||||
| } | ||||
| ::Window CmdArgParser::GetSocketID() const{ | ||||
|     return m_socketID; | ||||
| } | ||||
| 
 | ||||
| SettingsPlug::SettingsPlug(::Window p_socketID, Glib::RefPtr<Gtk::Builder> builder) | ||||
|     :Gtk::Plug{p_socketID} { | ||||
|     MainWindow* wnd = nullptr; | ||||
|     builder->get_widget_derived("window", wnd); | ||||
|     builder->get_widget("plugBox", plugBox); | ||||
|     plugBox->get_parent()->remove(*plugBox); | ||||
|     add(*plugBox); | ||||
|     show_all_children(); | ||||
| } | ||||
| #endif | ||||
| @ -0,0 +1,20 @@ | ||||
| #include "project_lib.h" | ||||
| #include "ubl-settings-diskquota.h" | ||||
| 
 | ||||
| class CmdArgParser : public Glib::OptionGroup { | ||||
| public: | ||||
|     CmdArgParser(const std::string& p_name, const std::string& p_description, const std::string& p_help); | ||||
|     ::Window GetSocketID() const; | ||||
| private: | ||||
|     int m_socketID = 0; | ||||
| 
 | ||||
| }; | ||||
| class SettingsPlug : public Gtk::Plug{ | ||||
| public: | ||||
|     Gtk::Window *window; | ||||
|     SettingsPlug(::Window p_socketID, Glib::RefPtr<Gtk::Builder> builder); | ||||
| 
 | ||||
| private: | ||||
|     Gtk::Widget *plugBox; | ||||
|     Gtk::Widget *parent; | ||||
| }; | ||||
| @ -0,0 +1,84 @@ | ||||
| #include "my_process.h" | ||||
| #include "util.h" | ||||
| 
 | ||||
| namespace My_Process {  | ||||
| #define debug false | ||||
| struct Utils::Result<string> My_Process_call::call(string cmd) { | ||||
|     this->i_error_old = this->i_error; | ||||
|     struct Utils::Result<string> obj_result; | ||||
|     string response = Utils::call(cmd); | ||||
|     obj_result.response = response; | ||||
|     if ((response.find("(null)") == std::string::npos) && (response.length() != 0 )) { | ||||
|         if (response.find("=") != std::string::npos) { | ||||
|             if (response.find("\n") != std::string::npos) { | ||||
|                 response = response.substr(response.find("=")+1,response.length()); | ||||
|                 response = response.substr(0,response.find("\n")); | ||||
|                 obj_result.response = response; | ||||
|                 obj_result.error = 0; | ||||
|             } | ||||
|             else { | ||||
|                 obj_result.error = 1; | ||||
|                 this->i_error += 1; | ||||
|                 this->log_mess_error(cmd); | ||||
|             } | ||||
|         } | ||||
|         else { | ||||
|             obj_result.error = 2; | ||||
|             this->i_error += 1; | ||||
|             str_cmd_error = cmd; | ||||
|             this->log_mess_error(cmd); | ||||
|         } | ||||
|     } | ||||
|     else { | ||||
|         obj_result.error = 3; | ||||
|         this->i_error += 1; | ||||
|         str_cmd_error = cmd; | ||||
|         this->log_mess_error(cmd); | ||||
|     } | ||||
|     return obj_result; | ||||
| } | ||||
| 
 | ||||
| int My_Process::get_count_error() { | ||||
|     return this->i_error; | ||||
| } | ||||
| 
 | ||||
| void My_Process::set_back_count_error() { | ||||
|     this->i_error = this->i_error_old; | ||||
| } | ||||
| 
 | ||||
| void My_Process_system::call(string cmd, string thread_str = "") { | ||||
|     string cmd_new = cmd + " " + thread_str; | ||||
|     int response_cmd = system(cmd_new.c_str()); | ||||
|     if (response_cmd != 0) { | ||||
|         this->i_error += 1; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void My_Process::set_count_error(int count_error) { | ||||
|     this->i_error = count_error; | ||||
|     this->str_cmd_error = ""; | ||||
| } | ||||
| 
 | ||||
| void My_Process::log_mess_error(string) { | ||||
| } | ||||
| 
 | ||||
| string My_Process::get_cmd_error() { | ||||
|     return this->str_cmd_error; | ||||
| } | ||||
| string My_Process_call::call_all_sections(string cmd) { | ||||
|     char buffer[PATH_MAX] = {0}; | ||||
|     std::string result = ""; | ||||
|     FILE* pipe = popen(cmd.c_str(), "r"); | ||||
|     if (!pipe) throw std::runtime_error("popen() failed!"); | ||||
|     try { | ||||
|         while (fgets(buffer, sizeof buffer, pipe) != NULL) { | ||||
|             result += buffer; | ||||
|         } | ||||
|     } catch (...) { | ||||
|         pclose(pipe); | ||||
|         throw; | ||||
|     } | ||||
|     pclose(pipe); | ||||
|     return result; | ||||
| } | ||||
| } | ||||
| @ -0,0 +1,32 @@ | ||||
| #ifndef MY_PROCESS_H | ||||
| #define MY_PROCESS_H | ||||
| 
 | ||||
| #include "util.h" | ||||
| namespace My_Process {  | ||||
| class My_Process { | ||||
|     public: | ||||
|     int i_error = 0; | ||||
|     int i_error_old = 0; | ||||
|     string str_cmd_error = ""; | ||||
|     int get_count_error(); | ||||
|     void set_count_error(int count_error); | ||||
|     void set_back_count_error(); | ||||
|     void log_mess_error(string); | ||||
|     string get_cmd_error(); | ||||
| }; | ||||
|      | ||||
| 
 | ||||
| class My_Process_call: public My_Process { | ||||
|     public:  | ||||
|         struct Utils::Result<string> call(string cmd); | ||||
|         string call_all_sections(string cmd); | ||||
|      | ||||
| }; | ||||
| 
 | ||||
| class My_Process_system: public My_Process { | ||||
|     public: | ||||
|         void call(string cmd, string thread_str); | ||||
| 
 | ||||
| }; | ||||
| } | ||||
| #endif | ||||
| @ -0,0 +1,79 @@ | ||||
| #ifndef MY_TYPE_H | ||||
| #define MY_TYPE_H | ||||
| 
 | ||||
| #include "project_lib.h" | ||||
| #include <string> | ||||
| 
 | ||||
| using namespace std; | ||||
| 
 | ||||
| typedef unsigned long max_num_T; | ||||
| 
 | ||||
| struct users_grups{ | ||||
|         string name; | ||||
|         bool state; | ||||
|         max_num_T size_data; | ||||
|         max_num_T soft_limit_size; | ||||
|         max_num_T severe_restriction_size; | ||||
|         max_num_T postponement_size_brat; | ||||
|         max_num_T hard_limit_activation_time_size; | ||||
|         max_num_T file; | ||||
|         max_num_T soft_file_limitation; | ||||
|         max_num_T hard_file_restriction; | ||||
|         max_num_T postponement_hard_file_restriction; | ||||
|         max_num_T hard_limit_activation_time; | ||||
|         }; | ||||
| struct Mount { | ||||
|         std::string device; | ||||
|         std::string destination; | ||||
|         std::string fstype; | ||||
|         std::string options; | ||||
|         std::string dump; | ||||
|         std::string pass; | ||||
| }; | ||||
| struct partition_cmd { | ||||
|         string device; | ||||
|         string cmd; | ||||
| }; | ||||
| struct struct_quotas { | ||||
|         string device; | ||||
|         string cmd; | ||||
|         string type_quotas; | ||||
|         string name; | ||||
| }; | ||||
| struct status_quotas { | ||||
|         bool user; | ||||
|         bool group; | ||||
|         bool project; | ||||
|         bool status; | ||||
| }; | ||||
| struct data_all_quotas { | ||||
|         string username; | ||||
|         string status; | ||||
|         string block_used; | ||||
|         string block_soft; | ||||
|         string block_hard;   | ||||
|         string block_grace; | ||||
|         string file_used; | ||||
|         string file_soft; | ||||
|         string file_hard; | ||||
|         string file_grace; | ||||
|         bool is_validate; | ||||
| }; | ||||
| struct tv_g_u_p { | ||||
|         string name; | ||||
|         string quotas; | ||||
|         string size; | ||||
|         string soft_limit_size; | ||||
|         string hard_limit_size; | ||||
|         string deferring_size; | ||||
|         string files; | ||||
|         string soft_limit_files; | ||||
|         string hard_limit_delay; | ||||
|         string deferring_files; | ||||
| }; | ||||
| 
 | ||||
| typedef struct users_grups USER_GRUPS; | ||||
| typedef map <string, string> map_str_str; | ||||
| typedef map <string, string>* map_s_s_ptr; | ||||
| typedef std::map<std::string, Mount> map_str_device; | ||||
| #endif | ||||
| @ -0,0 +1,26 @@ | ||||
| #ifndef PROJECT_LIB_H | ||||
| #define PROJECT_LIB_H | ||||
| 
 | ||||
| #include <stdio.h> | ||||
| #include <sstream> | ||||
| #include <string> | ||||
| #include <array> | ||||
| #include <vector> | ||||
| #include <linux/limits.h> | ||||
| #include <unistd.h> | ||||
| #include <sys/types.h> | ||||
| #include <iostream> | ||||
| #include <fstream> | ||||
| #include <filesystem> | ||||
| #include <pwd.h> | ||||
| #include <cstddef> | ||||
| #include <gtkmm.h> | ||||
| #include <gtkmm/stock.h> | ||||
| #include <gtkmm/window.h> | ||||
| #include <gtkmm/plug.h> | ||||
| #include <locale.h> | ||||
| #include <libintl.h> | ||||
| #include <glibmm/i18n.h> | ||||
| #include <map> | ||||
| #include "ubl-util-standard.c" | ||||
| #endif | ||||
| @ -0,0 +1,199 @@ | ||||
| #include "save.h" | ||||
| 
 | ||||
| namespace Lib_save { | ||||
| 
 | ||||
| vector<string> Save::get_error() { | ||||
|     return this->vec_errors; | ||||
| } | ||||
| 
 | ||||
| bool Save::get_state_save() { | ||||
|     return this->flag_no_save; | ||||
| } | ||||
| 
 | ||||
| void Save::set_data_global(std::map <string, string> &map_global) { | ||||
|     this->map_global = &map_global; | ||||
| } | ||||
| 
 | ||||
| void Save::set_data_local(std::map <string, string> &map_local) { | ||||
|     this->map_local = &map_local; | ||||
| } | ||||
| 
 | ||||
| void Save::set_data_gui(std::map <string, string> &map_gui) { | ||||
|     this->map_gui = &map_gui; | ||||
| } | ||||
| 
 | ||||
| bool Save::check_save(string flag_save, string key_name) { | ||||
|     std::map <string, string>:: iterator iter_map_data; | ||||
|     std::map <string, string>:: iterator iter_map_data_old; | ||||
|     std::map <string, string> *map_data_old; | ||||
|     if (flag_save == "system") { | ||||
|         map_data_old = map_local; | ||||
|     } | ||||
|     else if (flag_save == "global") { | ||||
|         map_data_old = map_global; | ||||
|     } | ||||
|     iter_map_data = (*map_gui).find(key_name); | ||||
|     iter_map_data_old = (*map_data_old).find(key_name); | ||||
|     if ((*map_local).find(key_name) != (*map_local).end() && (*map_global).find(key_name) != (*map_global).end()) { | ||||
|         if ((*map_local)[key_name] != (*map_global)[key_name]) { | ||||
|             return true; | ||||
|         } | ||||
|     } | ||||
|     if (iter_map_data_old == (*map_data_old).end() && iter_map_data != (*map_gui).end()) { | ||||
|         return true; | ||||
|     } | ||||
|     else if (iter_map_data->second != iter_map_data_old->second) { | ||||
|         return true; | ||||
|     } | ||||
|     else if (iter_map_data->second.length() == 0 && iter_map_data_old->second.length() == 0) { | ||||
|         return false; | ||||
|     } | ||||
|     else if (iter_map_data->second == iter_map_data_old->second) { | ||||
|         return false; | ||||
|     } | ||||
|     else { | ||||
|         return true; | ||||
|     } | ||||
|     return true; | ||||
| } | ||||
| 
 | ||||
| int Save::get_count_error() { | ||||
|     return process.get_count_error(); | ||||
| } | ||||
| 
 | ||||
| string Save::get_cmd_error() { | ||||
|     return process.get_cmd_error(); | ||||
| } | ||||
| 
 | ||||
| void Save::set_count_error(int count_error) { | ||||
|     process.set_count_error(count_error); | ||||
| } | ||||
| 
 | ||||
| void Save::set_vec_params(vector<string>& vec_param_names) { | ||||
|     this->vec_param_names = &vec_param_names; | ||||
| } | ||||
| 
 | ||||
| void Save::save(string sections, string str_flag_save) { | ||||
|     string key = ""; | ||||
|     string value = ""; | ||||
|     string cmd = ""; | ||||
|     string str_error = ""; | ||||
|     this->flag_no_save = true; | ||||
|     for (const auto &key: *vec_param_names) { | ||||
|         if (map_gui->find(key) != map_gui->end()) { | ||||
|             value = (*map_gui)[key]; | ||||
|             if (this->check_save(str_flag_save, key)) { | ||||
|                 if (value.length() != 0) { | ||||
|                     cmd = "ubconfig --target  " + str_flag_save + " set " + sections + " " + | ||||
|                             key + "=\"" + value + "\""; | ||||
|                 } | ||||
|                 else if (value.length() == 0) { | ||||
|                     cmd = "ubconfig --target  " + str_flag_save + " remove " + sections + " " + key; | ||||
|                 } | ||||
|                 else { | ||||
|                     cmd = ""; | ||||
|                 } | ||||
|                 if (cmd.length() != 0) { | ||||
|                     process.call(cmd, ""); | ||||
|                     this->flag_no_save = false; | ||||
|                     str_error = process.get_cmd_error(); | ||||
|                     if (str_error.length() != 0) { | ||||
|                         this->vec_errors.push_back(str_error); | ||||
|                         str_error = ""; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|          | ||||
|     } | ||||
| } | ||||
| void Save::save_all(string sections, string str_flag_save) { | ||||
|     string key = ""; | ||||
|     string value = ""; | ||||
|     string cmd_all = "ubconfig --target  " + str_flag_save + " set " + sections; | ||||
|     size_t len_start_cmd_all = cmd_all.length();  | ||||
|     string str_error = ""; | ||||
|     this->flag_no_save = true; | ||||
|     string cmd = ""; | ||||
|     string cmd_remove = ""; | ||||
|     for (const auto &key: *vec_param_names) { | ||||
|         if (map_gui->find(key) != map_gui->end()) { | ||||
|             value = (*map_gui)[key]; | ||||
|             if (this->check_save(str_flag_save, key)) { | ||||
|                 if (value.length() != 0) { | ||||
|                     cmd_all += " " + key + "=\"" + value + "\""; | ||||
|                 } | ||||
|                 else if (value.length() == 0) { | ||||
|                     cmd = "ubconfig --target  " + str_flag_save + " remove " + sections + " " + key; | ||||
|                 } | ||||
|                 else { | ||||
|                     cmd = ""; | ||||
|                 } | ||||
|                 if (cmd.length() != 0) { | ||||
|                     process.call(cmd, ""); | ||||
|                     this->flag_no_save = false; | ||||
|                     str_error = process.get_cmd_error(); | ||||
|                     if (str_error.length() != 0) { | ||||
|                         this->vec_errors.push_back(str_error); | ||||
|                         str_error = ""; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|          | ||||
|     } | ||||
|     if (len_start_cmd_all != cmd_all.length()) { | ||||
|         process.call(cmd, ""); | ||||
|         this->flag_no_save = false; | ||||
|         str_error = process.get_cmd_error(); | ||||
|         if (str_error.length() != 0) { | ||||
|             this->vec_errors.push_back(str_error); | ||||
|             str_error = ""; | ||||
|         } | ||||
|     } | ||||
| } | ||||
| void Save::save_all_1(string sections, string str_flag_save) { | ||||
|     string key = ""; | ||||
|     string value = ""; | ||||
|     string cmd_all = "ubconfig --target  " + str_flag_save + " set " + sections; | ||||
|     size_t len_start_cmd_all = cmd_all.length();  | ||||
|     string str_error = ""; | ||||
|     this->flag_no_save = true; | ||||
|     string cmd = ""; | ||||
|     string cmd_remove = ""; | ||||
|     for (const auto &iter: (*map_gui)) { | ||||
|         value = iter.second;  | ||||
|         key = iter.first; | ||||
|         if (this->check_save(str_flag_save, key)) { | ||||
|             if (value.length() != 0) { | ||||
|                 cmd_all += " " + key + "=\"" + value + "\""; | ||||
|             } | ||||
|             else if (value.length() == 0) { | ||||
|                 cmd = "ubconfig --target  " + str_flag_save + " remove " + sections + " " + key; | ||||
|             } | ||||
|             else { | ||||
|                 cmd = ""; | ||||
|             } | ||||
|             if (cmd.length() != 0) { | ||||
|                 process.call(cmd, ""); | ||||
|                 this->flag_no_save = false; | ||||
|                 str_error = process.get_cmd_error(); | ||||
|                 if (str_error.length() != 0) { | ||||
|                     this->vec_errors.push_back(str_error); | ||||
|                     str_error = ""; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|      | ||||
|     } | ||||
|     if (len_start_cmd_all != cmd_all.length()) { | ||||
|         process.call(cmd, ""); | ||||
|         this->flag_no_save = false; | ||||
|         str_error = process.get_cmd_error(); | ||||
|         if (str_error.length() != 0) { | ||||
|             this->vec_errors.push_back(str_error); | ||||
|             str_error = ""; | ||||
|         } | ||||
|     } | ||||
| } | ||||
| } | ||||
| @ -0,0 +1,33 @@ | ||||
| #ifndef SAVE_H | ||||
| #define SAVE_H | ||||
| 
 | ||||
| #include "my_process.h" | ||||
| #include "project_lib.h" | ||||
| namespace Lib_save { | ||||
| 
 | ||||
| class Save { | ||||
|     private: | ||||
|         std::map <string, string> *map_global; | ||||
|         std::map <string, string> *map_local; | ||||
|         std::map <string, string> *map_gui; | ||||
|         vector<string> vec_errors; | ||||
|         vector<string>* vec_param_names; | ||||
|         My_Process::My_Process_system process = My_Process::My_Process_system(); | ||||
|         bool flag_no_save; | ||||
|     public: | ||||
|         void set_data_global(std::map <string, string> &map_global); | ||||
|         void set_data_local(std::map <string, string> &map_local); | ||||
|         void set_data_gui(std::map <string, string> &map_gui); | ||||
|         bool check_save(string flag_save, string key_name); | ||||
|         bool get_state_save(); | ||||
|         int get_count_error(); | ||||
|         string get_cmd_error(); | ||||
|         void save_all(string sections, string str_flag_save); | ||||
|         void save_all_1(string sections, string str_flag_save); | ||||
|         void set_count_error(int count_error); | ||||
|         void set_vec_params(vector<string>& vec_param_names); | ||||
|         void save(string sections, string str_flag_save) ; | ||||
|         vector<string> get_error(); | ||||
| }; | ||||
| } | ||||
| #endif | ||||
| @ -0,0 +1,35 @@ | ||||
| #ifndef SYSTEM_CMD_QUOTAS | ||||
| #define SYSTEM_CMD_QUOTAS | ||||
| #include "project_lib.h" | ||||
| #include "my_type.h" | ||||
| #include "my_process.h" | ||||
| #include "util.h" | ||||
| 
 | ||||
| namespace Quotas_sys { | ||||
| class Quotas_sys { | ||||
|     public: | ||||
|         map_str_str map_hw_or_sw; | ||||
|         map_str_str* map_device; | ||||
|         map_str_str* map_gui_cfg; | ||||
|         map<string, bool> disk_mount; | ||||
|         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(); | ||||
|     public: | ||||
|         Quotas_sys(); | ||||
|         void set_map_gui(map_str_str &map_gui); | ||||
|         void check_partition_mount(); | ||||
|         void format_cmd_quotas_system(struct struct_quotas& _struct_quota); | ||||
|         bool off_quota(string partition, string quota_hw, string quota_sw); | ||||
|         bool check_on_quotas_system(string cmd); | ||||
|         struct status_quotas check_on_quotas_system_2_hw(string params); | ||||
|         bool on_quota_hw(string partition, string cmd_hw, string cmd_sw); | ||||
|         bool on_quota_sw(string partition, int mode); | ||||
|         vector<data_all_quotas> pars_data(string cmd); | ||||
|         void set_map_device(map_str_str &map_device); | ||||
|         string wrapper_hw_sw(string partition); | ||||
|         bool wrapper_on_quotas(string partition, string flag_mode); | ||||
|     protected: | ||||
|         struct data_all_quotas part_quotas_line(string line); | ||||
| }; | ||||
| } | ||||
| #endif | ||||
| @ -0,0 +1,27 @@ | ||||
| #include "ubconfig_quotas.h" | ||||
| 
 | ||||
| namespace Quotas_ubconfig { | ||||
| 
 | ||||
| void Quotas_ubconfig::format_cmd_quotas(struct struct_quotas& _struct_quota) { | ||||
|     string key = "DISK_QUOTA["; | ||||
|     key += ":" + _struct_quota.device + "]"; | ||||
|     string value = _struct_quota.name + ":" + _struct_quota.cmd; | ||||
|     (*map_gui_cfg)[key] = value; | ||||
| } | ||||
| 
 | ||||
| bool Quotas_ubconfig::off_quota(string partition, string quota_type, string state) { | ||||
|     string key = "DISK_QUOTA[" + quota_type + ":" + partition + "]"; | ||||
|     string value = "disable"; | ||||
|     (*map_gui_cfg)[key] = state; | ||||
|     return true; | ||||
| } | ||||
| void Quotas_ubconfig::set_map_gui(map_str_str &map_gui) { | ||||
|     map_gui_cfg = &map_gui; | ||||
| } | ||||
| Quotas_ubconfig::Quotas_ubconfig() { | ||||
|     map_hw_or_sw["ext2"] = "hw"; | ||||
|     map_hw_or_sw["ext3"] = "hw"; | ||||
|     map_hw_or_sw["nfs"] = "sw"; | ||||
|     map_hw_or_sw["NFS"] = "sw"; | ||||
| } | ||||
| } | ||||
| @ -0,0 +1,25 @@ | ||||
| #ifndef UBCONFIG_QUOTAS | ||||
| #define UBCONFIG_QUOTAS | ||||
| 
 | ||||
| #include "project_lib.h" | ||||
| #include "my_type.h" | ||||
| #include "my_process.h" | ||||
| #include "util.h" | ||||
| 
 | ||||
| namespace Quotas_ubconfig { | ||||
| 
 | ||||
| 
 | ||||
| class Quotas_ubconfig{ | ||||
|     public: | ||||
|         map_str_str map_hw_or_sw; | ||||
| 
 | ||||
|         map_str_str* map_gui_cfg; | ||||
|         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(); | ||||
|     Quotas_ubconfig(); | ||||
|     bool off_quota(string partition, string quota_type, string state); | ||||
|     void format_cmd_quotas(struct struct_quotas& _struct_quota); | ||||
|     void set_map_gui(map_str_str &map_gui); | ||||
| }; | ||||
| } | ||||
| #endif | ||||
| @ -0,0 +1,915 @@ | ||||
| #include "ubl-settings-diskquota.h" | ||||
| using namespace std; | ||||
| 
 | ||||
| int socket_ext_id_I = 0; | ||||
| int socket_trd_id_I = 0; | ||||
| bool flag_save = false; | ||||
| bool flag_save_local = false; | ||||
| bool flag_save_global = false; | ||||
| bool flag_load_global = false; | ||||
| bool flag_lock_help = false; | ||||
| string version_application = "1.0"; | ||||
| 
 | ||||
| MainWindow::MainWindow(BaseObjectType* obj, Glib::RefPtr<Gtk::Builder> const& builder) | ||||
|     : Gtk::ApplicationWindow(obj), builder{builder} { | ||||
|         this->builder = builder; | ||||
|         this->settings();   | ||||
| } | ||||
| 
 | ||||
| MainWindow::MainWindow(Glib::RefPtr<Gtk::Builder> const& builder) { | ||||
|     this->builder =  builder; | ||||
|     this->settings(); | ||||
| } | ||||
| 
 | ||||
| void MainWindow::settings() { | ||||
|     this->get_builder(); | ||||
|     this->lacalization(); | ||||
|     this->add_CSS(); | ||||
|     this->flag_block_gui(); | ||||
|     btnBoxAboutDialog->set_visible(false); | ||||
|     map_device = obj_device.get_parted(); | ||||
|     this->filling_device_combo_box_template(groupsDeviceCombo, map_device); | ||||
|     this->filling_device_combo_box_template(usersDeviceCombo, map_device); | ||||
|     this->filling_device_combo_box_template(quotegroupDeviceCombo, map_device); | ||||
|     this->init_tree_view(); | ||||
|     this->init_spin_all(); | ||||
|     check_limit(quotegroupSizeSoftLimitCheck | ||||
|         ,quotegroupSizeSoftLimitSpin | ||||
|         ,quotegroupSizeSoftLimitCombo); | ||||
|     check_limit(quotegroupSizeHardLimitCheck | ||||
|         ,quotegroupSizeHardLimitSpin | ||||
|         ,quotegroupSizeHardLimitCombo); | ||||
|     check_limit(quotegroupFilesSoftLimitCheck | ||||
|         ,quotegroupFilesSoftLimitSpin | ||||
|         ,quotegroupFilesSoftLimitlabel); | ||||
|     check_limit(quotegroupFilesHardLimitCheck | ||||
|         ,quotegroupFilesHardLimitSpin | ||||
|         ,quotegroupFilesHarLimitLabel); | ||||
|     obj_quotas_sys.set_map_gui(map_gui_cfg); | ||||
|     obj_quotas_ubconfig.set_map_gui(map_gui_cfg); | ||||
|     #ifdef WEBKIT_FOUND | ||||
|         one =  WEBKIT_WEB_VIEW( webkit_web_view_new() ); | ||||
|         three = Glib::wrap(GTK_WIDGET(one)); | ||||
|         wndWeb->add(*three); | ||||
|     #endif | ||||
|     if (geteuid() == 0) { | ||||
|         this->load_system_cfg(); | ||||
|         this->load_global_cfg(); | ||||
|         this->event(); | ||||
|     } | ||||
|     else { | ||||
|         boxFuncs->set_sensitive(false); | ||||
|         btnSave->set_sensitive(false); | ||||
|         btnLoad->set_sensitive(false); | ||||
|         imgInfo->set_from_icon_name(icon_warning, Gtk::ICON_SIZE_MENU); | ||||
|         info_status_app(info_box_error_css); | ||||
|         lblWarning->set_text(program_as_root); | ||||
|     } | ||||
|     Gtk::Widget *boxWidget; | ||||
|     builder->get_widget("boxColor", boxWidget); | ||||
|     HeadOverlay->add_overlay(*boxWidget); | ||||
|     ubl_make_plugs(boxSave, boxButton, socket_ext_id_I, socket_trd_id_I); | ||||
|      | ||||
| } | ||||
| 
 | ||||
| void MainWindow::init_spin_all() { | ||||
|     generalGroupsSizeWeeksSpi->set_range(0, 52); | ||||
|     generalGroupsSizeWeeksSpi->set_increments(1.0, 1.0); | ||||
|     generalGroupsSizeWeeksSpi->set_value(0); | ||||
| 
 | ||||
|     generalGroupsFileWeeksSpin->set_range(0, 52); | ||||
|     generalGroupsFileWeeksSpin->set_increments(1.0, 1.0); | ||||
|     generalGroupsFileWeeksSpin->set_value(0); | ||||
| 
 | ||||
|     generalUsersSizWeeksSpin->set_range(0, 52); | ||||
|     generalUsersSizWeeksSpin->set_increments(1.0, 1.0); | ||||
|     generalUsersSizWeeksSpin->set_value(0); | ||||
| 
 | ||||
|     generalUsersFileWeeksSpin->set_range(0, 52); | ||||
|     generalUsersFileWeeksSpin->set_increments(1.0, 1.0); | ||||
|     generalUsersFileWeeksSpin->set_value(0); | ||||
| 
 | ||||
|     generalGroupsSizeDaySpin->set_range(0, 31); | ||||
|     generalGroupsSizeDaySpin->set_increments(1.0, 1.0); | ||||
|     generalGroupsSizeDaySpin->set_value(0); | ||||
| 
 | ||||
|     generalGroupsFilesDaySpin->set_range(0, 31); | ||||
|     generalGroupsFilesDaySpin->set_increments(1.0, 1.0); | ||||
|     generalGroupsFilesDaySpin->set_value(0); | ||||
| 
 | ||||
|     generalUsersSizeDaySpin->set_range(0, 31); | ||||
|     generalUsersSizeDaySpin->set_increments(1.0, 1.0); | ||||
|     generalUsersSizeDaySpin->set_value(0); | ||||
| 
 | ||||
|     generalUsersFilesDaySpin->set_range(0, 31); | ||||
|     generalUsersFilesDaySpin->set_increments(1.0, 1.0); | ||||
|     generalUsersFilesDaySpin->set_value(0); | ||||
| 
 | ||||
|     generalGroupsSizeHourSpin->set_range(0, 23); | ||||
|     generalGroupsSizeHourSpin->set_increments(1.0, 1.0); | ||||
|     generalGroupsSizeHourSpin->set_value(0); | ||||
|      | ||||
|     generalGroupsFilesHourSpin->set_range(0, 23); | ||||
|     generalGroupsFilesHourSpin->set_increments(1.0, 1.0); | ||||
|     generalGroupsFilesHourSpin->set_value(0); | ||||
| 
 | ||||
|     generalUsersSizeHourSpin->set_range(0, 23); | ||||
|     generalUsersSizeHourSpin->set_increments(1.0, 1.0); | ||||
|     generalUsersSizeHourSpin->set_value(0); | ||||
|      | ||||
|     generalUsersFilesHoursSpin->set_range(0, 23); | ||||
|     generalUsersFilesHoursSpin->set_increments(1.0, 1.0); | ||||
|     generalUsersFilesHoursSpin->set_value(0);  | ||||
|      | ||||
|     generalGroupsSizeMinuteSpin->set_range(0, 59); | ||||
|     generalGroupsSizeMinuteSpin->set_increments(1.0, 1.0); | ||||
|     generalGroupsSizeMinuteSpin->set_value(0);   | ||||
|      | ||||
|     generalGroupsFilesMinuteSpin->set_range(0, 59); | ||||
|     generalGroupsFilesMinuteSpin->set_increments(1.0, 1.0); | ||||
|     generalGroupsFilesMinuteSpin->set_value(0);  | ||||
|      | ||||
|     generalUsersSizeMinuteSpin->set_range(0, 59); | ||||
|     generalUsersSizeMinuteSpin->set_increments(1.0, 1.0); | ||||
|     generalUsersSizeMinuteSpin->set_value(0);   | ||||
|      | ||||
|     generalUsersFilesMinutesSpin->set_range(0, 59); | ||||
|     generalUsersFilesMinutesSpin->set_increments(1.0, 1.0); | ||||
|     generalUsersFilesMinutesSpin->set_value(0);     | ||||
| } | ||||
| 
 | ||||
| void MainWindow::init_tree_view() { | ||||
|     this->view_add_columns(*usersQuotasTree); | ||||
|     this->view_add_columns(*groupsQuotasTree); | ||||
|     this->view_add_columns(*ProjectQuotasTree); | ||||
|     this->init_tree_view_general(); | ||||
| } | ||||
| void MainWindow::init_tree_view_general() { | ||||
|     GeneralQuotasTree->append_column_editable(str_status, m_columnsGeneral.status); | ||||
|     GeneralQuotasTree->append_column(str_quota, m_columnsGeneral.type_quotas); | ||||
|     GeneralQuotasTree->append_column(str_device_project, m_columnsGeneral.device); | ||||
|     GeneralQuotasTree->append_column(str_user, m_columnsGeneral.user); | ||||
|     GeneralQuotasTree->append_column(str_group, m_columnsGeneral.group); | ||||
|     GeneralQuotasTree->append_column(str_projects, m_columnsGeneral.projects); | ||||
|     GeneralQuotasTree->append_column(str_tw_soft_limit, m_columnsGeneral.soft_limit_size); | ||||
|     GeneralQuotasTree->append_column(str_tw_severe_limitation, m_columnsGeneral.hard_limit_size); | ||||
|     GeneralQuotasTree->append_column(str_tw_soft_limit_files, m_columnsGeneral.soft_limit_files); | ||||
|     GeneralQuotasTree->append_column(str_tw_severe_limitation_files, m_columnsGeneral.hard_limit_files); | ||||
|     GeneralQuotasTree->append_column(str_tw_general_deferring_size, m_columnsGeneral.deferring_size); | ||||
|     GeneralQuotasTree->append_column(str_tw_general_deferring_files, m_columnsGeneral.deferring_files); | ||||
| } | ||||
| 
 | ||||
| void MainWindow::view_add_columns(Gtk::TreeView &treeView) { | ||||
|     treeView.append_column(str_name, m_columns.name); | ||||
|     treeView.append_column_editable(str_quotas, m_columns.quotas); | ||||
|     treeView.append_column(str_size, m_columns.size); | ||||
|     treeView.append_column(str_tw_soft_limit, m_columns.soft_limit_size); | ||||
|     treeView.append_column(str_tw_severe_limitation, m_columns.hard_limit_size); | ||||
|     treeView.append_column(str_tw_deferring_size, m_columns.deferring_size); | ||||
|     treeView.append_column(str_files, m_columns.files); | ||||
|     treeView.append_column(str_tw_soft_limit_files, m_columns.soft_limit_files); | ||||
|     treeView.append_column(str_tw_severe_limitation_files, m_columns.hard_limit_delay); | ||||
|     treeView.append_column(str_tw_deferring_files, m_columns.deferring_files); | ||||
| } | ||||
| 
 | ||||
| void MainWindow::lacalization() { | ||||
|     time_t now = time(0); | ||||
|     tm *ltm = localtime(&now); | ||||
|     unsigned int year = 1900 + ltm->tm_year; | ||||
|     string str_authors = string(copyright) + to_string(year);  | ||||
|     aboutWindows->set_copyright(str_authors); | ||||
|     aboutWindows->set_comments(str_setting_user); | ||||
|     aboutWindows->set_website(website); | ||||
|     aboutWindows->set_version(_(version_application.c_str())); | ||||
|     aboutWindows->set_website_label(project_Home_page); | ||||
|     generalTabLabel->set_text(str_general_settings); | ||||
|     GroupsTabLabel->set_text(str_groups); | ||||
|     headerAboutTopic->set_label(_(app_name)); | ||||
|     headerTopic->set_label(name_app); | ||||
|     UsersTabLabel->set_text(str_users); | ||||
|     generalGroupsSizeLabel->set_text(str_excess_size_delay); | ||||
|     generalGroupsFilesLabel->set_text(str_excess_files_delay); | ||||
|     generalUsersSizeLabel->set_text(str_excess_size_delay); | ||||
|     generalUsersFilesLabel->set_text(str_excess_files_delay); | ||||
|     generalGroupsSizeWeeksLabel->set_text(str_weeks); | ||||
|     generalGroupsFilesWeeksLabel->set_text(str_weeks); | ||||
|     generalUsersSizeWeeksLabel->set_text(str_weeks); | ||||
|     generalUsersFilesWeeksLabel->set_text(str_weeks); | ||||
|     generalGroupsSizeDaysLabel->set_text(str_days); | ||||
|     generalGroupsFilesDaysLabel->set_text(str_days); | ||||
|     generalUsersSizeDaysLabel->set_text(str_days); | ||||
|     generalUsersFilesDaysLabel->set_text(str_days); | ||||
|     generalGroupsSizeHoursLabel->set_text(str_hours); | ||||
|     generalGroupsFilesHoursLabel->set_text(str_hours); | ||||
|     generalUsersSizeHoursLabel->set_text(str_hours); | ||||
|     generalUsersFilesHoursLabel->set_text(str_hours); | ||||
|     generalGroupsSizeMinutesLabel->set_text(str_minutes); | ||||
|     generalGroupsFilesMinutesLabel->set_text(str_minutes); | ||||
|     generalUsersSizeMinutesLabel->set_text(str_minutes); | ||||
|     generalUsersFilesMinutesLabel->set_text(str_minutes); | ||||
|     lblLoad->set_text(str_load_local); | ||||
|     lblSave->set_text(str_save_local); | ||||
|     groupsDeviceLabel->set_label(str_device);  | ||||
|     usersDeviceLabel->set_label(str_device);  | ||||
|     headLabel->set_label(str_lb_head);    | ||||
|     filtersNameFilterCheckbox->set_label(str_name); | ||||
|     filtersQuotasFilterCheckbox->set_label(str_quotas); | ||||
|     filtersSizeFilterCheckbox->set_label(str_size); | ||||
|     filtersSoftSizeFilterCheckbox->set_label(str_soft_limit_size); | ||||
|     filtersHardSizeFilterCheckbox->set_label(str_hard_limit_size); | ||||
|     filtersHardSizeDelayFilterCheckbox->set_label(str_deferring_hard_limit_size); | ||||
|     filtersHardSizeActivationFilterCheckbox->set_label(str_hard_activation_size); | ||||
|     filtersFilesFilterCheckbox->set_label(str_files); | ||||
|     filtersSoftFilesFilterCheckbox->set_label(str_soft_restriction_files); | ||||
|     filtersHardFilesFilterCheckbox->set_label(str_severe_limitation_files); | ||||
|     filtersHardFilesDelayFilterCheckbox->set_label(str_deferring_limit_files); | ||||
|     filtersHardFilesActivationFilterCheckbox->set_label(str_hard_limit_time);  | ||||
|     quotegroupDeviceLabel->set_text(str_device); | ||||
|     quotegroupDiskQuotasLabel->set_text(str_disk_quotas_device); | ||||
|     quotegroupGroupQuotasLabel->set_text(str_group_quotas_device); | ||||
|     quotegroupSizeFrameLabel->set_text(str_size); | ||||
|     quotegroupFilesFrameLabel->set_text(str_files); | ||||
|     quotegroupSizeCurrentlyLabel->set_text(str_currently_using); | ||||
|     quotegroupSizeSoftLimitLabel->set_text(str_soft_limit); | ||||
|     quoteSizeHardLimitLabel->set_text(str_hard_limit); | ||||
|     quoteFilesHardLimitLabel->set_text(str_hard_limit); | ||||
|     quotegroupFilesSoftLimitLabel->set_text(str_soft_limit); | ||||
|     quotegroupFilesCurrentlyLabel->set_text(str_currently_using); | ||||
|     quoteuserDiskQuotasLabel->set_text(str_disk_quotas_device); | ||||
|     quoteuserDeviceLabel->set_text(str_device); | ||||
|     quoteuserGroupQuotasLabel->set_text(str_user_quotas_device); | ||||
|     quoteuserSizeFrameLabel->set_text(str_size); | ||||
|     quoteuserSizeCurrentlyLabel->set_text(str_currently_using); | ||||
|     quoteuserSizeSoftLimitLabel->set_text(str_soft_limit); | ||||
|     quoteuserSizeHardLimitLabel1->set_text(str_hard_limit); | ||||
|     quoteuserFileSystemLabel->set_text(str_file_system); | ||||
|     quoteuserFilesFrameLabel->set_text(str_files); | ||||
|     quoteuserFilesCurrentlyLabel->set_text(str_currently_using_space); | ||||
|     quoteuserFilesSoftLimitLabel->set_text(str_soft_limit); | ||||
|     quoteFilesHardLimitLabel1->set_text(str_hard_limit); | ||||
|     quoteuserFilesHarLimitLabel->set_text(str_files); | ||||
|     quoteuserFilesSoftLimitlabel->set_text(str_files); | ||||
|     quotegroupFileSystemLabel->set_text(str_file_system); | ||||
|     btnLoadGlob->set_label(load_global); | ||||
|     btnLoadLocal->set_label(load_local); | ||||
|     btnAbout->set_label(str_about_1); | ||||
|     btnSynopsis->set_label(str_help); | ||||
|     btnSaveLocalGlob->set_label(save_all); | ||||
|     btnSaveGlob->set_label(save_global); | ||||
|     btnSaveLocal->set_label(save_local); | ||||
|     lblHeadFiltersWindow->set_label(str_filters); | ||||
|     ProjectTabLabel->set_label(str_projects); | ||||
|     usersProjectLabel->set_text(str_device); | ||||
|     lblhelpHeader->set_text(read_documentation_web); | ||||
|     lblhelpText->set_text(redirected_documentation); | ||||
|     btnReadHelp->set_label(read_online); | ||||
|     btnCancelHelp->set_label(cancel); | ||||
|     chkAlwaysOpenHelp->set_label(always_redirect); | ||||
|     lblwebHeaderName->set_label(name_app); | ||||
|     chbMangSystemFile->set_label(str_quotas_mode); | ||||
|      | ||||
| } | ||||
| 
 | ||||
| void MainWindow::filling_device_combo_box_template(Gtk::ComboBoxText *combo_box, map_str_str &map_device) { | ||||
|     if (map_device.size() != 0) { | ||||
|         for (const auto &device : map_device) { | ||||
|             combo_box->append(device.first.c_str()); | ||||
|         } | ||||
|         combo_box->set_active(0); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void MainWindow::flag_block_gui() { | ||||
|     if (flag_load_global == true) { | ||||
|         btnLoadGlob->set_sensitive(false); | ||||
|     } | ||||
|     if (flag_save_local == true && flag_save_global == true) { | ||||
|         btnSave->set_sensitive(false); | ||||
|     } | ||||
|     if (flag_save == true) { | ||||
|         btnSave->set_sensitive(false); | ||||
|     } | ||||
|     if (flag_save_local == true) { | ||||
|         btnSaveLocal->set_sensitive(false); | ||||
|         btnSaveLocalGlob->set_sensitive(false); | ||||
|     } | ||||
|     if (flag_save_global == true) { | ||||
|         btnSaveGlob->set_sensitive(false); | ||||
|         btnSaveLocalGlob->set_sensitive(false); | ||||
|     } | ||||
|     if (flag_lock_help == true) { | ||||
|         btnSynopsis->set_sensitive(false); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void MainWindow::entry_combo_box_temp(Gtk::ComboBoxText *combo_box, Gtk::Label *label) { | ||||
|     string text = combo_box->get_active_text(); | ||||
|     if (map_device.find(text) != map_device.end()){ | ||||
|         label->set_text(map_device[text]); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void MainWindow::add_CSS() { | ||||
|     Glib::RefPtr<Gtk::CssProvider> cssProvider = Gtk::CssProvider::create(); | ||||
|     cssProvider->load_from_path(path_css);    | ||||
|     Glib::RefPtr<Gtk::StyleContext> styleContext = Gtk::StyleContext::create(); | ||||
|     Glib::RefPtr<Gdk::Screen> 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
 | ||||
|     HeadBackgroundImage->set(path_img_head_background); | ||||
|     Glib::RefPtr<Gtk::StyleContext> headLabel_css = headLabel->get_style_context(); | ||||
|     Glib::RefPtr<Gtk::StyleContext> boxButton_css = boxButton->get_style_context(); | ||||
|     Glib::RefPtr<Gtk::StyleContext> boxSave_css = boxSave->get_style_context(); | ||||
|     Glib::RefPtr<Gtk::StyleContext> headerBar_css = headerBar->get_style_context(); | ||||
|     if (socket_trd_id_I == 0 && socket_ext_id_I == 0){ | ||||
|         boxButton_css->add_class("bkim_no_plug"); | ||||
|         boxSave_css->add_class("bkim_no_plug"); | ||||
|     } | ||||
|     headLabel_css->add_class("textHead"); | ||||
| } | ||||
| 
 | ||||
| /*
 | ||||
| void init_treeview_user() { | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| void MainWindow::view_add_data(Gtk::TreeModel::Row &row, Glib::RefPtr<Gtk::ListStore> list_store_m , std::array<std::vector<std::string>, 5> &arr_view , size_t index) { | ||||
|     row = *(list_store_m->append()); | ||||
|     bool flag_chb = false; | ||||
|     string name = arr_view[0][index]; | ||||
|     row[m_columns.check_button] = flag_chb; | ||||
|     row[m_columns.name] = _(name.c_str()); | ||||
|     row[m_columns.description] = _(arr_view[1][index].c_str()); | ||||
| } | ||||
| */ | ||||
| 
 | ||||
| void MainWindow::get_builder() { | ||||
|     builder->set_translation_domain(path_app); | ||||
|     builder->get_widget("headerTopic", headerTopic); | ||||
|     builder->get_widget("boxButton", boxButton); | ||||
|     builder->get_widget("boxSave", boxSave); | ||||
|     builder->get_widget("aboutWindows", aboutWindows); | ||||
|     builder->get_widget("HeadOverlay", HeadOverlay); | ||||
|     builder->get_widget("headerBar", headerBar); | ||||
|     builder->get_widget("boxFuncs", boxFuncs); | ||||
|     builder->get_widget("btnLoad", btnLoad); | ||||
|     builder->get_widget("btnSave", btnSave); | ||||
|     builder->get_widget("btnBoxAboutDialog", btnBoxAboutDialog); | ||||
|     builder->get_widget("HeadBackgroundImage", HeadBackgroundImage); | ||||
|     builder->get_widget("imgInfo", imgInfo); | ||||
|     builder->get_widget("lblWarning", lblWarning); | ||||
|     builder->get_widget("boxInfoError", boxInfoError); | ||||
|     builder->get_widget("imgInfo", imgInfo); | ||||
|     builder->get_widget("generalTabLabel", generalTabLabel); | ||||
|     builder->get_widget("GroupsTabLabel", GroupsTabLabel); | ||||
|     builder->get_widget("UsersTabLabel", UsersTabLabel); | ||||
|     builder->get_widget("generalGroupsSizeLabel", generalGroupsSizeLabel); | ||||
|     builder->get_widget("generalGroupsFilesLabel", generalGroupsFilesLabel); | ||||
|     builder->get_widget("generalUsersSizeLabel", generalUsersSizeLabel); | ||||
|     builder->get_widget("generalUsersFilesLabel", generalUsersFilesLabel); | ||||
|     builder->get_widget("generalGroupsSizeWeeksLabel", generalGroupsSizeWeeksLabel); | ||||
|     builder->get_widget("generalGroupsFilesWeeksLabel", generalGroupsFilesWeeksLabel); | ||||
|     builder->get_widget("generalUsersSizeWeeksLabel", generalUsersSizeWeeksLabel); | ||||
|     builder->get_widget("generalUsersFilesWeeksLabel", generalUsersFilesWeeksLabel); | ||||
|     builder->get_widget("generalGroupsSizeDaysLabel", generalGroupsSizeDaysLabel); | ||||
|     builder->get_widget("generalGroupsFilesDaysLabel", generalGroupsFilesDaysLabel); | ||||
|     builder->get_widget("generalUsersSizeDaysLabel", generalUsersSizeDaysLabel); | ||||
|     builder->get_widget("generalUsersFilesDaysLabel", generalUsersFilesDaysLabel); | ||||
|     builder->get_widget("generalGroupsSizeHoursLabel", generalGroupsSizeHoursLabel); | ||||
|     builder->get_widget("generalGroupsFilesHoursLabel", generalGroupsFilesHoursLabel); | ||||
|     builder->get_widget("generalUsersSizeHoursLabel", generalUsersSizeHoursLabel); | ||||
|     builder->get_widget("generalUsersFilesHoursLabel", generalUsersFilesHoursLabel); | ||||
|     builder->get_widget("generalGroupsSizeMinutesLabel", generalGroupsSizeMinutesLabel); | ||||
|     builder->get_widget("generalGroupsFilesMinutesLabel", generalGroupsFilesMinutesLabel); | ||||
|     builder->get_widget("generalUsersSizeMinutesLabel", generalUsersSizeMinutesLabel); | ||||
|     builder->get_widget("generalUsersFilesMinutesLabel", generalUsersFilesMinutesLabel); | ||||
|     builder->get_widget("lblLoad", lblLoad); | ||||
|     builder->get_widget("lblSave", lblSave); | ||||
|     builder->get_widget("btnSettings", btnSettings); | ||||
|     builder->get_widget("btnSettings", btnSettings); | ||||
|     builder->get_widget("groupsDeviceLabel", groupsDeviceLabel); | ||||
|     builder->get_widget("usersDeviceLabel", usersDeviceLabel); | ||||
|     builder->get_widget("headLabel", headLabel); | ||||
|     builder->get_widget("FiltersWindow", FiltersWindow); | ||||
|     builder->get_widget("filtersNameFilterCheckbox", filtersNameFilterCheckbox); | ||||
|     builder->get_widget("filtersQuotasFilterCheckbox", filtersQuotasFilterCheckbox); | ||||
|     builder->get_widget("filtersSizeFilterCheckbox", filtersSizeFilterCheckbox); | ||||
|     builder->get_widget("filtersSoftSizeFilterCheckbox", filtersSoftSizeFilterCheckbox); | ||||
|     builder->get_widget("filtersHardSizeFilterCheckbox", filtersHardSizeFilterCheckbox); | ||||
|     builder->get_widget("filtersHardSizeDelayFilterCheckbox", filtersHardSizeDelayFilterCheckbox); | ||||
|     builder->get_widget("filtersHardSizeActivationFilterCheckbox", filtersHardSizeActivationFilterCheckbox); | ||||
|     builder->get_widget("filtersFilesFilterCheckbox", filtersFilesFilterCheckbox); | ||||
|     builder->get_widget("filtersSoftFilesFilterCheckbox", filtersSoftFilesFilterCheckbox); | ||||
|     builder->get_widget("filtersHardFilesFilterCheckbox", filtersHardFilesFilterCheckbox); | ||||
|     builder->get_widget("filtersHardFilesDelayFilterCheckbox", filtersHardFilesDelayFilterCheckbox); | ||||
|     builder->get_widget("filtersHardFilesActivationFilterCheckbox", filtersHardFilesActivationFilterCheckbox); | ||||
|     builder->get_widget("filtersHardFilesActivationFilterCheckbox", filtersHardFilesActivationFilterCheckbox); | ||||
|     builder->get_widget("btnLoadGlob", btnLoadGlob); | ||||
|     builder->get_widget("btnLoadLocal", btnLoadLocal); | ||||
|     builder->get_widget("btnSynopsis", btnSynopsis); | ||||
|     builder->get_widget("btnAbout", btnAbout); | ||||
|     builder->get_widget("btnSaveLocalGlob", btnSaveLocalGlob); | ||||
|     builder->get_widget("btnSaveGlob", btnSaveGlob); | ||||
|     builder->get_widget("btnSaveLocal", btnSaveLocal); | ||||
|     builder->get_widget("GroupsTabLabel", GroupsTabLabel); | ||||
|     builder->get_widget("groupsQuotasTree", groupsQuotasTree); | ||||
|     builder->get_widget("usersQuotasTree", usersQuotasTree); | ||||
|     builder->get_widget("quotegroupDeviceLabel", quotegroupDeviceLabel); | ||||
|     builder->get_widget("quotegroupFileSystemLabel", quotegroupFileSystemLabel); | ||||
|     builder->get_widget("quotegroupDiskQuotasLabel", quotegroupDiskQuotasLabel); | ||||
|     builder->get_widget("quotegroupGroupQuotasLabel", quotegroupGroupQuotasLabel); | ||||
|     builder->get_widget("quotegroupSizeFrameLabel", quotegroupSizeFrameLabel); | ||||
|     builder->get_widget("quotegroupFilesFrameLabel", quotegroupFilesFrameLabel); | ||||
|     builder->get_widget("quotegroupSizeCurrentlyLabel", quotegroupSizeCurrentlyLabel); | ||||
|     builder->get_widget("quotegroupFilesCurrentlyLabel", quotegroupFilesCurrentlyLabel); | ||||
|     builder->get_widget("quotegroupSizeSoftLimitLabel", quotegroupSizeSoftLimitLabel); | ||||
|     builder->get_widget("quoteSizeHardLimitLabel", quoteSizeHardLimitLabel); | ||||
|     builder->get_widget("quotegroupFilesSoftLimitLabel", quotegroupFilesSoftLimitLabel); | ||||
|     builder->get_widget("quoteFilesHardLimitLabel", quoteFilesHardLimitLabel); | ||||
|     builder->get_widget("quotegroupFilesHarLimitLabel", quotegroupFilesHarLimitLabel); | ||||
|     builder->get_widget("quoteuserDeviceLabel", quoteuserDeviceLabel); | ||||
|     builder->get_widget("quoteuserFileSystemLabel", quoteuserFileSystemLabel); | ||||
|     builder->get_widget("quoteuserDiskQuotasLabel", quoteuserDiskQuotasLabel); | ||||
|     builder->get_widget("quoteuserGroupQuotasLabel", quoteuserGroupQuotasLabel); | ||||
|     builder->get_widget("quoteuserSizeFrameLabel", quoteuserSizeFrameLabel); | ||||
|     builder->get_widget("quoteuserSizeCurrentlyLabel", quoteuserSizeCurrentlyLabel); | ||||
|     builder->get_widget("quoteuserSizeSoftLimitLabel", quoteuserSizeSoftLimitLabel); | ||||
|     builder->get_widget("quoteuserSizeHardLimitLabel1", quoteuserSizeHardLimitLabel1); | ||||
|     builder->get_widget("quoteuserFilesFrameLabel", quoteuserFilesFrameLabel); | ||||
|     builder->get_widget("quoteuserFilesCurrentlyLabel", quoteuserFilesCurrentlyLabel); | ||||
|     builder->get_widget("quoteuserFilesSoftLimitLabel", quoteuserFilesSoftLimitLabel); | ||||
|     builder->get_widget("quoteFilesHardLimitLabel1", quoteFilesHardLimitLabel1); | ||||
|     builder->get_widget("quoteuserFilesHarLimitLabel", quoteuserFilesHarLimitLabel); | ||||
|     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("usersDeviceCombo", usersDeviceCombo); | ||||
|     builder->get_widget("GroupsTabLabel", GroupsTabLabel); | ||||
|     builder->get_widget("generalTabLabel", generalTabLabel); | ||||
|     builder->get_widget("groupsDeviceCombo", groupsDeviceCombo); | ||||
|     builder->get_widget("generalGroupsSizeWeeksSpi", generalGroupsSizeWeeksSpi); | ||||
|     builder->get_widget("generalGroupsFileWeeksSpin", generalGroupsFileWeeksSpin); | ||||
|     builder->get_widget("generalGroupsSizeDaySpin", generalGroupsSizeDaySpin); | ||||
|     builder->get_widget("generalGroupsFilesDaySpin", generalGroupsFilesDaySpin); | ||||
|     builder->get_widget("generalGroupsSizeHourSpin", generalGroupsSizeHourSpin); | ||||
|     builder->get_widget("generalGroupsFilesHourSpin", generalGroupsFilesHourSpin); | ||||
|     builder->get_widget("generalGroupsSizeMinuteSpin", generalGroupsSizeMinuteSpin); | ||||
|     builder->get_widget("generalGroupsFilesMinuteSpin", generalGroupsFilesMinuteSpin); | ||||
|     builder->get_widget("generalUsersSizWeeksSpin", generalUsersSizWeeksSpin); | ||||
|     builder->get_widget("generalUsersFileWeeksSpin", generalUsersFileWeeksSpin); | ||||
|     builder->get_widget("generalUsersSizeDaySpin", generalUsersSizeDaySpin); | ||||
|     builder->get_widget("generalUsersFilesDaySpin", generalUsersFilesDaySpin); | ||||
|     builder->get_widget("generalUsersSizeHourSpin", generalUsersSizeHourSpin); | ||||
|     builder->get_widget("generalUsersFilesHoursSpin", generalUsersFilesHoursSpin); | ||||
|     builder->get_widget("generalUsersSizeMinuteSpin", generalUsersSizeMinuteSpin); | ||||
|     builder->get_widget("generalUsersFilesMinutesSpin", generalUsersFilesMinutesSpin); | ||||
|     builder->get_widget("lblEditWndFsys", lblEditWndFsys); | ||||
|     builder->get_widget("quotegroupSizeSoftLimitCheck", quotegroupSizeSoftLimitCheck); | ||||
|     builder->get_widget("quotegroupSizeHardLimitCheck", quotegroupSizeHardLimitCheck); | ||||
|     builder->get_widget("quotegroupFilesSoftLimitCheck", quotegroupFilesSoftLimitCheck); | ||||
|     builder->get_widget("quotegroupFilesHardLimitCheck", quotegroupFilesHardLimitCheck); | ||||
|     builder->get_widget("quotegroupSizeSoftLimitSpin", quotegroupSizeSoftLimitSpin); | ||||
|     builder->get_widget("quotegroupSizeSoftLimitCombo", quotegroupSizeSoftLimitCombo); | ||||
|     builder->get_widget("quotegroupSizeHardLimitSpin", quotegroupSizeHardLimitSpin); | ||||
|     builder->get_widget("quotegroupSizeHardLimitCombo", quotegroupSizeHardLimitCombo); | ||||
|     builder->get_widget("quotegroupFilesSoftLimitSpin", quotegroupFilesSoftLimitSpin); | ||||
|     builder->get_widget("quotegroupFilesSoftLimitlabel", quotegroupFilesSoftLimitlabel); | ||||
|     builder->get_widget("quotegroupFilesHardLimitSpin", quotegroupFilesHardLimitSpin); | ||||
|     builder->get_widget("quotegroupSaveButton", quotegroupSaveButton); | ||||
|     builder->get_widget("quotegroupCancelButton", quotegroupCancelButton); | ||||
|     builder->get_widget("quotegroupDeviceCombo", quotegroupDeviceCombo); | ||||
|     builder->get_widget("GeneralQuotasTree", GeneralQuotasTree); | ||||
|     builder->get_widget("ProjectQuotasTree", ProjectQuotasTree); | ||||
|     builder->get_widget("ProjectTabLabel", ProjectTabLabel); | ||||
|     builder->get_widget("usersProjectLabel", usersProjectLabel); | ||||
|     builder->get_widget("btnFilterProject", btnFilterProject); | ||||
|     builder->get_widget("btnFilterUsers", btnFilterUsers); | ||||
|     builder->get_widget("btnFilterGroups", btnFilterGroups); | ||||
|     #ifdef WEBKIT_FOUND | ||||
|         builder->get_widget("wndWeb", wndWeb); | ||||
|     #endif | ||||
|     builder->get_widget("lblHeadeWndWeb", lblHeadeWndWeb); | ||||
|     builder->get_widget("lblwebHeaderName", lblwebHeaderName); | ||||
|     builder->get_widget("lblhelpText", lblhelpText); | ||||
|     builder->get_widget("lblhelpHeader", lblhelpHeader); | ||||
|     builder->get_widget("chkAlwaysOpenHelp", chkAlwaysOpenHelp); | ||||
|     builder->get_widget("btnReadHelp", btnReadHelp); | ||||
|     builder->get_widget("btnCancelHelp", btnCancelHelp); | ||||
|     builder->get_widget("wndShowWeb", wndShowWeb); | ||||
|     builder->get_widget("chbMangSystemFile", chbMangSystemFile); | ||||
|     builder->get_widget("btnDelGroups", btnDelGroups); | ||||
|     builder->get_widget("btnDelProject", btnDelProject); | ||||
|     builder->get_widget("btnDelUsers", btnDelUsers); | ||||
|     builder->get_widget("btnAddGroups", btnAddGroups); | ||||
|     builder->get_widget("btnAddUsers", btnAddUsers); | ||||
|     builder->get_widget("btnAddProject", btnAddProject); | ||||
|      | ||||
| } | ||||
| 
 | ||||
| void MainWindow::event() { | ||||
|     btnCancelHelp->signal_clicked().connect([&]() {wndShowWeb->hide();}); | ||||
|     chkAlwaysOpenHelp->signal_toggled().connect([&]() {flag_open_browser = true;}); | ||||
|     btnReadHelp->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::open_browser)); | ||||
|     btnFilterGroups->signal_clicked().connect([&]() {this->groupsFilters_show();}); | ||||
|     btnFilterUsers->signal_clicked().connect([&]() {this->groupsFilters_show();}); | ||||
|     btnFilterProject->signal_clicked().connect([&]() {this->groupsFilters_show();}); | ||||
|     quotegroupSaveButton->signal_clicked().connect([&]() {}); | ||||
|     btnLoadGlob->signal_activate().connect([&]() {this->load_global_cfg();}); | ||||
|     btnLoadLocal->signal_activate().connect([&]() {this->load_system_cfg();}); | ||||
|     btnSynopsis->signal_activate().connect([&]() {this->synopsis_show();}); | ||||
|     btnAbout->signal_activate().connect([&]() {aboutWindows->show();}); | ||||
|     btnSaveLocalGlob->signal_activate().connect([&]() {this->wrapper_save_all_cfg();}); | ||||
|     btnSaveGlob->signal_activate().connect([&]() {this->wrapper_save_global_cfg();}); | ||||
|     btnSaveLocal->signal_activate().connect([&]() {this->wrapper_save_system_cfg();}); | ||||
|     chbMangSystemFile->signal_toggled().connect([&]() {this->mode_switch_quota();}); | ||||
|     quotegroupDeviceCombo->signal_changed().connect([&]() {entry_combo_box_temp(quotegroupDeviceCombo, lblEditWndFsys);}); | ||||
|     quotegroupSizeSoftLimitCheck->signal_toggled().connect([&]() { | ||||
|         check_limit(quotegroupSizeSoftLimitCheck | ||||
|         ,quotegroupSizeSoftLimitSpin | ||||
|         ,quotegroupSizeSoftLimitCombo); | ||||
|     }); | ||||
|     quotegroupSizeHardLimitCheck->signal_toggled().connect([&]() { | ||||
|         check_limit(quotegroupSizeHardLimitCheck | ||||
|         ,quotegroupSizeHardLimitSpin | ||||
|         ,quotegroupSizeHardLimitCombo); | ||||
|     }); | ||||
|     quotegroupFilesSoftLimitCheck->signal_toggled().connect([&]() { | ||||
|         check_limit(quotegroupFilesSoftLimitCheck | ||||
|         ,quotegroupFilesSoftLimitSpin | ||||
|         ,quotegroupFilesSoftLimitlabel); | ||||
|     }); | ||||
|     quotegroupFilesHardLimitCheck->signal_toggled().connect([&]() { | ||||
|         check_limit(quotegroupFilesHardLimitCheck | ||||
|         ,quotegroupFilesHardLimitSpin | ||||
|         ,quotegroupFilesHarLimitLabel); | ||||
|     }); | ||||
|     quotegroupCancelButton->signal_clicked().connect([&]() {QuotasEditWindow->hide();}); | ||||
|     // QuotasEditWindow->show();
 | ||||
|     btnDelGroups->signal_clicked().connect(  | ||||
|         sigc::bind<Glib::RefPtr<Gtk::ListStore>*, const Gtk::TreeModel::iterator*, bool&> (sigc::mem_fun( *this,  | ||||
|         &MainWindow::remove_template), &list_store_groups, &iter_groups, flag_validate_del_groups)); | ||||
|     btnDelUsers->signal_clicked().connect(  | ||||
|         sigc::bind<Glib::RefPtr<Gtk::ListStore>*, const Gtk::TreeModel::iterator*, bool&> (sigc::mem_fun( *this,  | ||||
|         &MainWindow::remove_template), &list_store_users, &iter_users, flag_validate_del_users)); | ||||
|     btnDelProject->signal_clicked().connect(  | ||||
|         sigc::bind<Glib::RefPtr<Gtk::ListStore>*, const Gtk::TreeModel::iterator*, bool&> (sigc::mem_fun( *this,  | ||||
|         &MainWindow::remove_template), &list_store_project, &iter_project, flag_validate_del_project)); | ||||
|     btnAddProject->signal_clicked().connect(  | ||||
|         sigc::bind<Gtk::TreeModel::Row&, Glib::RefPtr<Gtk::ListStore>,  struct tv_g_u_p> (sigc::mem_fun( *this,  | ||||
|         &MainWindow::set_add_tv_g_u_p), row, list_store_project, obj_tv_g_u_p)); | ||||
|     btnAddUsers->signal_clicked().connect(  | ||||
|         sigc::bind<Gtk::TreeModel::Row&, Glib::RefPtr<Gtk::ListStore>,  struct tv_g_u_p> (sigc::mem_fun( *this,  | ||||
|         &MainWindow::set_add_tv_g_u_p), row, list_store_users, obj_tv_g_u_p)); | ||||
|     btnAddGroups->signal_clicked().connect(  | ||||
|         sigc::bind<Gtk::TreeModel::Row&, Glib::RefPtr<Gtk::ListStore>,  struct tv_g_u_p> (sigc::mem_fun( *this,  | ||||
|         &MainWindow::set_add_tv_g_u_p), row, list_store_groups, obj_tv_g_u_p)); | ||||
|      | ||||
|      | ||||
| } | ||||
| 
 | ||||
| void MainWindow::remove_template(Glib::RefPtr<Gtk::ListStore>* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate_del) { | ||||
|     if (flag_validate_del && (*list_store)->iter_is_valid(*(iter))) { | ||||
|         Gtk::TreeModel::Row row = *(*iter); | ||||
|         if(row) { | ||||
|             string name = row[m_columns.name] + ""; | ||||
|             // TODO:
 | ||||
|             string key = "GRUB_PASSWORD[" + name + "]"; | ||||
|             map_gui_cfg[key] = ""; | ||||
|         } | ||||
|         (*list_store)->erase((*iter)); | ||||
|         flag_validate_del = false; | ||||
|         info_status_app(info_box_ok_css); | ||||
|         imgInfo->set_from_icon_name(icon_checked, Gtk::ICON_SIZE_MENU); | ||||
|         lblWarning->set_text(""); | ||||
|     } | ||||
|     flag_validate_del = false; | ||||
| } | ||||
| 
 | ||||
| void MainWindow::set_add_tv_g_u_p(Gtk::TreeModel::Row &row, Glib::RefPtr<Gtk::ListStore> list_store, struct tv_g_u_p obj_tv_g_u_p) { | ||||
|     row = *(list_store->append()); | ||||
|     row[m_columns.name] = obj_tv_g_u_p.name; | ||||
|     row[m_columns.quotas] = obj_tv_g_u_p.quotas; | ||||
|     row[m_columns.size] = obj_tv_g_u_p.size; | ||||
|     row[m_columns.soft_limit_size] = obj_tv_g_u_p.soft_limit_size;  | ||||
|     row[m_columns.hard_limit_size] = obj_tv_g_u_p.hard_limit_size;  | ||||
|     row[m_columns.deferring_size] = obj_tv_g_u_p.deferring_size;  | ||||
|     row[m_columns.files] = obj_tv_g_u_p.files;  | ||||
|     row[m_columns.soft_limit_files] = obj_tv_g_u_p.soft_limit_files;  | ||||
|     row[m_columns.hard_limit_delay] = obj_tv_g_u_p.hard_limit_delay;  | ||||
|     row[m_columns.deferring_files] = obj_tv_g_u_p.deferring_files;  | ||||
| } | ||||
| 
 | ||||
| void MainWindow::mode_switch_quota() { | ||||
|     if (chbMangSystemFile->get_active()) { | ||||
|         mode_quota = "filesystem"; | ||||
|     } | ||||
|     else { | ||||
|         mode_quota = "ubconfig"; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void MainWindow::wrapper_settings_quotas_temp(string save_user_or_group) { | ||||
|     struct partition_cmd _struct_partition_cmd = this->wrapper_settings_quotas(); | ||||
|     string device = _struct_partition_cmd.device; | ||||
|     string cmd = _struct_partition_cmd.cmd; | ||||
|     string type_quotas = save_user_or_group; | ||||
|     string user = ""; | ||||
|     struct struct_quotas _struct_quota; | ||||
|     _struct_quota.device = device; | ||||
|     _struct_quota.cmd = cmd; | ||||
|     _struct_quota.type_quotas = type_quotas; | ||||
|     _struct_quota.name = user; | ||||
|     obj_quotas_ubconfig.format_cmd_quotas(_struct_quota); | ||||
| } | ||||
| 
 | ||||
| void MainWindow::save_quotegroupSaveButton() { | ||||
|     if (sys_or_ubconfig == "ubconfig") { | ||||
|         if (save_user_or_group == "usrquota") { | ||||
|             this->wrapper_settings_quotas_temp(save_user_or_group); | ||||
|         } | ||||
|         else { | ||||
|             this->wrapper_settings_quotas_temp(save_user_or_group); | ||||
|         } | ||||
|     } | ||||
|     else { | ||||
|         if (save_user_or_group == "usrquota") { | ||||
|              | ||||
|         } | ||||
|         else { | ||||
| 
 | ||||
|         } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| struct partition_cmd MainWindow::wrapper_settings_quotas() { | ||||
|     string str_parted = quotegroupDeviceCombo->get_active_text(); | ||||
|     string value = ""; | ||||
|     if (quotegroupSizeSoftLimitCheck->get_active()) { | ||||
|         value = Utils::format_str_size(quotegroupSizeSoftLimitSpin->get_value(), quotegroupSizeSoftLimitCombo->get_active_row_number()); | ||||
|         value += ":"; | ||||
|     } | ||||
|     else { | ||||
|         value += "0:"; | ||||
|     } | ||||
|     if (quotegroupSizeHardLimitCheck->get_active()) { | ||||
|         value += Utils::format_str_size(quotegroupSizeHardLimitSpin->get_value(), quotegroupSizeHardLimitCombo->get_active_row_number()); | ||||
|         value += ":"; | ||||
|     } | ||||
|     else { | ||||
|         value += "0:"; | ||||
|     } | ||||
|     if (quotegroupFilesSoftLimitCheck->get_active()) { | ||||
|         value += to_string(quotegroupFilesSoftLimitSpin->get_value()); | ||||
|         value += ":"; | ||||
|     } | ||||
|     else { | ||||
|         value += "0:"; | ||||
|     } | ||||
|     if (quotegroupFilesHardLimitCheck->get_active()) { | ||||
|         value += to_string(quotegroupFilesHardLimitSpin->get_value()); | ||||
|         value += ":"; | ||||
|     } | ||||
|     else { | ||||
|         value += "0:"; | ||||
|     } | ||||
|     struct partition_cmd _struct_partition_cmd; | ||||
|     _struct_partition_cmd.device = str_parted; | ||||
|     _struct_partition_cmd.cmd = value; | ||||
|     return _struct_partition_cmd; | ||||
| } | ||||
| 
 | ||||
| void MainWindow::groupsFilters_show() { | ||||
|     FiltersWindow->show_all(); | ||||
| } | ||||
| 
 | ||||
| void MainWindow::check_limit(Gtk::CheckButton *check_button, Gtk::SpinButton *spin, Gtk::ComboBoxText *combo_box) { | ||||
|     spin->set_sensitive(check_button->get_active()); | ||||
|     combo_box->set_sensitive(check_button->get_active()); | ||||
| } | ||||
| void MainWindow::check_limit(Gtk::CheckButton *check_button, Gtk::SpinButton *spin, Gtk::Label *combo_box) { | ||||
|     spin->set_sensitive(check_button->get_active()); | ||||
|     combo_box->set_sensitive(check_button->get_active()); | ||||
| } | ||||
| 
 | ||||
| void MainWindow::info_status_app(string stule) { | ||||
|     Glib::RefPtr<Gtk::StyleContext> boxInfo = boxInfoError->get_style_context(); | ||||
|     boxInfo->remove_class(info_box_ok_css); | ||||
|     boxInfo->remove_class(info_box_error_css); | ||||
|     boxInfo->add_class(stule); | ||||
| } | ||||
| 
 | ||||
| void MainWindow::init_dict(string flag_load) { | ||||
|     std::map<std::string, std::string> map_gui_cfg_n; | ||||
|     map_gui_cfg_n[""] = ""; | ||||
| 
 | ||||
|     map_gui_cfg = map_gui_cfg_n; | ||||
|     if (flag_load == "global") { | ||||
|         map_global_cfg = map_gui_cfg_n; | ||||
|     } | ||||
|     else if (flag_load == "system") { | ||||
|         map_system_cfg = map_gui_cfg_n; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| bool MainWindow::save_template(string section, string flag_save) { | ||||
|     bool flag_no_save = true; | ||||
|     obj_save.set_data_local(map_system_cfg); | ||||
|     obj_save.set_data_global(map_global_cfg); | ||||
|     obj_save.set_data_gui(map_gui_cfg); | ||||
|     obj_save.set_vec_params(vec_param_names); | ||||
|     obj_save.save(section, flag_save); | ||||
|     vector<string> obj_vec_error = obj_save.get_error(); | ||||
|     flag_no_save = obj_save.get_state_save(); | ||||
|     return flag_no_save; | ||||
| } | ||||
| 
 | ||||
| void MainWindow::wrapper_save_all_cfg() { | ||||
|     this->set_data_cfg(); | ||||
|     bool _flag_save_global = this->save_template("boot", "global");; | ||||
|     bool _flag_save_local = this->save_template("boot", "system"); | ||||
|     if (_flag_save_global && _flag_save_local) { | ||||
|         this->info_warning_error(5); | ||||
|     } | ||||
|     else { | ||||
|         info_warning_error(4); | ||||
|     } | ||||
|     map_global_cfg = map_gui_cfg; | ||||
|     map_system_cfg = map_gui_cfg; | ||||
|      | ||||
| } | ||||
| 
 | ||||
| void MainWindow::load_global_cfg() { | ||||
|     this->load_template(&map_global_cfg, "global"); | ||||
|     info_warning_error(1); | ||||
|     map_gui_cfg = map_global_cfg; | ||||
| } | ||||
| 
 | ||||
| void MainWindow::load_system_cfg() { | ||||
|     this->load_template(&map_system_cfg, "system"); | ||||
|     info_warning_error(0); | ||||
|     map_gui_cfg = map_system_cfg; | ||||
| } | ||||
| 
 | ||||
| void MainWindow::set_data_cfg() { | ||||
|     // TODO:
 | ||||
|     // Написать функцию
 | ||||
| } | ||||
| void MainWindow::wrapper_save_global_cfg() { | ||||
|     this->set_data_cfg(); | ||||
|     if (this->save_template("boot", "global")) { | ||||
|         this->info_warning_error(5); | ||||
|     } | ||||
|     else { | ||||
|         info_warning_error(3); | ||||
|     } | ||||
|     map_global_cfg = map_gui_cfg; | ||||
|      | ||||
| } | ||||
| 
 | ||||
| void MainWindow::synopsis_show() { | ||||
|     if (flag_open_browser == true) { | ||||
|         this->open_browser(); | ||||
|     } | ||||
|     else { | ||||
|         wndShowWeb->show_all();  | ||||
|     } | ||||
|      | ||||
| } | ||||
| 
 | ||||
| void MainWindow::open_browser() { | ||||
|     #ifdef WEBKIT_FOUND | ||||
|         webkit_web_view_load_uri(one, link_doc); | ||||
|         wndWeb->show_all(); | ||||
|     #else | ||||
|         this->template_open_browser(); | ||||
|     #endif | ||||
| } | ||||
| 
 | ||||
| void MainWindow::template_open_browser() { | ||||
|     string cmd = cmd_xdg + string(_(link_doc)) + " &"; | ||||
|     string buf = ""; | ||||
|     if (geteuid() == 0) { | ||||
|         string response_user = getlogin(); | ||||
|         int size_s = std::snprintf(nullptr, 0, cmd_execute, response_user.c_str(), cmd.c_str()) + 1; | ||||
|         auto size = static_cast<size_t>(size_s); | ||||
|         std::unique_ptr<char[]> buf(new char[ size ]); | ||||
|         std::snprintf( buf.get(), size, cmd_execute, response_user.c_str(), cmd.c_str() ); | ||||
|         cmd = std::string( buf.get(), buf.get() + size - 1 ); | ||||
|     } | ||||
|     obj_process_system.call(cmd, ""); | ||||
| } | ||||
| 
 | ||||
| void MainWindow::wrapper_save_system_cfg() { | ||||
|     this->set_data_cfg(); | ||||
|     if (this->save_template("boot", "system")) { | ||||
|         this->info_warning_error(5); | ||||
|     } | ||||
|     else { | ||||
|         info_warning_error(2); | ||||
|     } | ||||
|     map_system_cfg = map_gui_cfg; | ||||
| } | ||||
| 
 | ||||
| void MainWindow::init_work_tv_g_u_p() { | ||||
|     groupsQuotasTree->remove_all_columns(); | ||||
|     ProjectQuotasTree->remove_all_columns(); | ||||
|     usersQuotasTree->remove_all_columns(); | ||||
|     list_store_groups = Gtk::ListStore::create(m_columns); | ||||
|     list_store_project = Gtk::ListStore::create(m_columns); | ||||
|     list_store_users = Gtk::ListStore::create(m_columns); | ||||
|     groupsQuotasTree->set_model(list_store_groups); | ||||
|     ProjectQuotasTree->set_model(list_store_project); | ||||
|     usersQuotasTree->set_model(list_store_users); | ||||
|     Glib::RefPtr<Gtk::TreeModel> groupsQuotasTreeModel = groupsQuotasTree->get_model(); | ||||
|     groupsQuotasTreeModel->signal_row_changed().connect(sigc::bind<Gtk::TreeModel::iterator&, bool&>  | ||||
|     (sigc::mem_fun(*this, &MainWindow::remove_line_template), iter_groups, flag_validate_del_groups)); | ||||
|     Glib::RefPtr<Gtk::TreeModel> ProjectQuotasTreeModel = ProjectQuotasTree->get_model(); | ||||
|     ProjectQuotasTreeModel->signal_row_changed().connect(sigc::bind<Gtk::TreeModel::iterator&, bool&>  | ||||
|     (sigc::mem_fun(*this, &MainWindow::remove_line_template), iter_project, flag_validate_del_project)); | ||||
|     Glib::RefPtr<Gtk::TreeModel> usersQuotasTreeModel = usersQuotasTree->get_model(); | ||||
|     usersQuotasTreeModel->signal_row_changed().connect(sigc::bind<Gtk::TreeModel::iterator&, bool&>  | ||||
|     (sigc::mem_fun(*this, &MainWindow::remove_line_template),iter_users, flag_validate_del_users)); | ||||
|     this->view_add_columns(*groupsQuotasTree); | ||||
|     this->view_add_columns(*ProjectQuotasTree); | ||||
|     this->view_add_columns(*usersQuotasTree); | ||||
| } | ||||
| 
 | ||||
| void MainWindow::load_template(map_str_str* map_temp, string str_load) { | ||||
|     this->init_work_tv_g_u_p(); | ||||
|     this->init_dict(str_load); | ||||
|     string sections; | ||||
|     sections = "security"; | ||||
|     obj_load.set_sections(sections); | ||||
|     *map_temp = obj_load.get_load_data(*map_temp, str_load); | ||||
| } | ||||
| 
 | ||||
| void MainWindow::remove_line_template(const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator& iter, Gtk::TreeModel::iterator& iter_del, bool& flag_del) { | ||||
|     iter_del = iter; | ||||
|     flag_del = true; | ||||
| } | ||||
| 
 | ||||
| void MainWindow::info_warning_error(int mess) { | ||||
|     if (obj_load.get_count_error() > 0 || obj_save.get_count_error() > 0) { | ||||
|         info_status_app(info_box_error_css); | ||||
|         imgInfo->set_from_icon_name(icon_warning, Gtk::ICON_SIZE_MENU); | ||||
|         string mess_error = ""; | ||||
|         if (mess == 0) { | ||||
|             mess_error = string(local_read_error) + str_cmd_error; | ||||
|             lblWarning->set_text(mess_error); | ||||
|         } | ||||
|         else if (mess == 1) { | ||||
|             mess_error = string(global_read_error) + str_cmd_error; | ||||
|             lblWarning->set_text(mess_error); | ||||
|         } | ||||
|         else if (mess == 2) { | ||||
|             mess_error = string(local_write_error) + str_cmd_error; | ||||
|             lblWarning->set_text(mess_error); | ||||
|         } | ||||
|         else if (mess == 3) { | ||||
|             mess_error = string(global_write_error) + str_cmd_error; | ||||
|             lblWarning->set_text(mess_error); | ||||
|         } | ||||
|         else if (mess == 4) { | ||||
|             mess_error = string(error_save_all) + str_cmd_error; | ||||
|             lblWarning->set_text(mess_error); | ||||
|         } | ||||
|         str_cmd_error = ""; | ||||
|         obj_load.set_count_error(0); | ||||
|         obj_save.set_count_error(0); | ||||
|     } | ||||
|     else { | ||||
|         info_status_app(info_box_ok_css); | ||||
|         imgInfo->set_from_icon_name(icon_checked, Gtk::ICON_SIZE_MENU); | ||||
|         if (mess == 0) { | ||||
|             lblWarning->set_text(local_load_ok); | ||||
|         } | ||||
|         else if (mess == 1) { | ||||
|             lblWarning->set_text(global_load_ok); | ||||
|         } | ||||
|         else if (mess == 2) { | ||||
|             lblWarning->set_text(local_ok_written); | ||||
|         } | ||||
|         else if (mess == 3) { | ||||
|             lblWarning->set_text(global_ok_written); | ||||
|         } | ||||
|         else if (mess == 4) { | ||||
|             lblWarning->set_text(successfully_save_all); | ||||
|         } | ||||
|         else if (mess == 5) { | ||||
|             lblWarning->set_text(nothing_save); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| MainWindow::~MainWindow() {} | ||||
| 
 | ||||
| void help() { | ||||
|     string version = string(str_version) + version_application + "\n"; | ||||
|     cout << version.c_str(); | ||||
|     cout << str_help_h; | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| @ -0,0 +1 @@ | ||||
| #cmakedefine WEBKIT_FOUND | ||||
| @ -0,0 +1,91 @@ | ||||
| #include "ubl-util-standard.h" | ||||
| #ifndef __cplusplus | ||||
| #ifndef UBL_GET_STANDARD_UI | ||||
| #define UBL_GET_STANDARD_UI | ||||
| 
 | ||||
| 
 | ||||
| inline returnstruct *ubl_make_plugs(GtkWidget *LeftWidget, GtkWidget *RightWidget, int left_plug_id, int right_plug_id){ | ||||
|     returnstruct *ret=(returnstruct*)malloc(sizeof(returnstruct*)); | ||||
|     if (left_plug_id>0&&LeftWidget){ | ||||
|         GtkWidget *plug=gtk_plug_new(left_plug_id); | ||||
|         GtkWidget *toplug=LeftWidget; | ||||
|         if (gtk_widget_get_parent(GTK_WIDGET(toplug))){ | ||||
|             g_object_ref(G_OBJECT(toplug)); | ||||
|             GtkWidget *parent=gtk_widget_get_parent(toplug); | ||||
|             gtk_container_remove(GTK_CONTAINER(parent),toplug); | ||||
|             gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug)); | ||||
|         } else  | ||||
|             gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug)); | ||||
|         gtk_widget_show(GTK_WIDGET(plug)); | ||||
|         ret->plugLeft=plug; | ||||
|     } | ||||
|     if (right_plug_id>0&&RightWidget){ | ||||
|         GtkWidget *plug=gtk_plug_new(right_plug_id); | ||||
|         GtkWidget *toplug=RightWidget; | ||||
|         if (gtk_widget_get_parent(GTK_WIDGET(toplug))){ | ||||
|             g_object_ref(G_OBJECT(toplug)); | ||||
|             GtkWidget *parent=gtk_widget_get_parent(toplug); | ||||
|             gtk_container_remove(GTK_CONTAINER(parent),toplug); | ||||
|             gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug)); | ||||
|         } else  | ||||
|             gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug)); | ||||
|         gtk_widget_show(GTK_WIDGET(plug)); | ||||
|         ret->plugRight=plug; | ||||
|     } | ||||
|     return ret; | ||||
| } | ||||
| 
 | ||||
| #endif | ||||
| 
 | ||||
| #else | ||||
| 
 | ||||
| 
 | ||||
| inline void ubl_make_plugs(Gtk::Widget *LeftWidget, Gtk::Widget *RightWidget, int left_plug_id, int right_plug_id){ | ||||
|     if (left_plug_id>0&&LeftWidget){ | ||||
|         GtkWidget *plug=gtk_plug_new(left_plug_id); | ||||
|         GtkWidget *toplug=GTK_WIDGET(LeftWidget->gobj()); | ||||
|         {GdkScreen *screen = gtk_widget_get_screen(plug); | ||||
|         gtk_widget_set_app_paintable(plug,TRUE); | ||||
|         GdkVisual *colormap = gdk_screen_get_rgba_visual(screen); | ||||
|         gtk_widget_set_visual(plug, colormap);} | ||||
|         {GdkScreen *screen = gtk_widget_get_screen(toplug); | ||||
|         gtk_widget_set_app_paintable(toplug,TRUE); | ||||
|         GdkVisual *colormap = gdk_screen_get_rgba_visual(screen); | ||||
|         gtk_widget_set_visual(toplug, colormap);} | ||||
|         if (gtk_widget_get_parent(GTK_WIDGET(toplug))){ | ||||
|             g_object_ref(G_OBJECT(toplug)); | ||||
|             GtkWidget *parent=gtk_widget_get_parent(toplug); | ||||
|             gtk_container_remove(GTK_CONTAINER(parent),toplug); | ||||
|             gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug)); | ||||
|         } else  | ||||
|             gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug)); | ||||
|         gtk_widget_show(GTK_WIDGET(plug)); | ||||
|         gtk_style_context_add_class(gtk_widget_get_style_context(plug),"bkim"); | ||||
|         gtk_style_context_add_class(gtk_widget_get_style_context(toplug),"bkim"); | ||||
|         gtk_style_context_add_class(gtk_widget_get_style_context(plug),"primary-toolbar"); | ||||
|     } | ||||
|     if (right_plug_id>0&&RightWidget){ | ||||
|         GtkWidget *plug=gtk_plug_new(right_plug_id); | ||||
|         GtkWidget *toplug=GTK_WIDGET(RightWidget->gobj()); | ||||
|         {GdkScreen *screen = gtk_widget_get_screen(plug); | ||||
|         gtk_widget_set_app_paintable(plug,TRUE); | ||||
|         GdkVisual *colormap = gdk_screen_get_rgba_visual(screen); | ||||
|         gtk_widget_set_visual(plug, colormap);} | ||||
|         {GdkScreen *screen = gtk_widget_get_screen(toplug); | ||||
|         gtk_widget_set_app_paintable(toplug,TRUE); | ||||
|         GdkVisual *colormap = gdk_screen_get_rgba_visual(screen); | ||||
|         gtk_widget_set_visual(toplug, colormap);} | ||||
|         if (gtk_widget_get_parent(GTK_WIDGET(toplug))){ | ||||
|             g_object_ref(G_OBJECT(toplug)); | ||||
|             GtkWidget *parent=gtk_widget_get_parent(toplug); | ||||
|             gtk_container_remove(GTK_CONTAINER(parent),toplug); | ||||
|             gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug)); | ||||
|         } else  | ||||
|             gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug)); | ||||
|         gtk_widget_show(GTK_WIDGET(plug)); | ||||
|         gtk_style_context_add_class(gtk_widget_get_style_context(plug),"bkim"); | ||||
|         gtk_style_context_add_class(gtk_widget_get_style_context(toplug),"bkim"); | ||||
|         gtk_style_context_add_class(gtk_widget_get_style_context(plug),"primary-toolbar"); | ||||
|     } | ||||
| } | ||||
| #endif | ||||
| @ -0,0 +1,20 @@ | ||||
| #ifndef __cplusplus | ||||
| #include <gtk/gtk.h> | ||||
| #include <gtk/gtkx.h> | ||||
| 
 | ||||
| typedef struct { | ||||
|     GtkWidget *plugLeft; | ||||
|     GtkWidget *plugRight; | ||||
| 
 | ||||
| 
 | ||||
| } returnstruct; | ||||
| static returnstruct *ubl_make_plugs(GtkWidget *LeftWidget, GtkWidget *RightWidget, int left_plug_id, int right_plug_id); | ||||
| #else | ||||
| #include <gtkmm.h> | ||||
| #include <gtkmm/stock.h> | ||||
| #include <gtkmm/window.h> | ||||
| #include <gtkmm/plug.h> | ||||
| 
 | ||||
| 
 | ||||
| static void ubl_make_plugs(Gtk::Widget *LeftWidget, Gtk::Widget *RightWidget, int left_plug_id, int right_plug_id); | ||||
| #endif | ||||
| @ -0,0 +1,30 @@ | ||||
| #ifndef UTIL_H | ||||
| #define UTIL_H | ||||
| #include "project_lib.h" | ||||
| 
 | ||||
| using namespace std; | ||||
| 
 | ||||
| namespace Utils { | ||||
| template<typename Type> | ||||
| struct Result{ | ||||
|     Type response; | ||||
|     int error; | ||||
| }; | ||||
| 
 | ||||
| struct Passwd { | ||||
|     string user; | ||||
|     int uid; | ||||
| }; | ||||
| 
 | ||||
| string format_str_size(int num, int index); | ||||
| std::array<std::vector<std::string>, 5> read_csv(const std::string& filename); | ||||
| std::string call(std::string cmd); | ||||
| vector<int> find_all(string &str_ntp, string substr); | ||||
| void str_remove(std::string& source, std::string to_remove); | ||||
| void str_replace_all(string &str_base, string str_find, string str_replace); | ||||
| std::vector<std::string> split(std::string text, char delim); | ||||
| vector <string> pars_users(); | ||||
| int synopsis_show(string str_link); | ||||
| string file_read(string filename); | ||||
| } | ||||
| #endif | ||||
| @ -0,0 +1,149 @@ | ||||
| .textHead{ | ||||
|   text-shadow: 2px 2px @theme_bg_color; | ||||
|   color: @theme_text_color; | ||||
| } | ||||
| .boxInfoMessError{ | ||||
|   background-color: #ea9999; | ||||
| } | ||||
| .boxInfoMessOK{ | ||||
|   background-color: #f3f0ac; | ||||
| } | ||||
| .bannerbackground { | ||||
|   background-color: #404040; | ||||
| } | ||||
| .textHead{ | ||||
|   text-shadow: 1px 1px #ffffff; | ||||
| } | ||||
| .view_app { | ||||
|   background-color: @theme_bg_color; | ||||
| } | ||||
| .view_app.view.cell:selected { | ||||
|   background-color:@theme_selected_bg_color; | ||||
| 	color:@theme_selected_text_color; | ||||
| 	transition: 10ms ease-out; | ||||
|   border-radius: 3px; | ||||
| } | ||||
| #GnomeIcon{ | ||||
|   border-style:solid; | ||||
|   border-bottom-width: 1px; | ||||
|   border-image: linear-gradient(90deg, alpha(@theme_text_color,0.4) 55%, alpha(@theme_bg_color, 0) 100%); | ||||
|   border-image-slice: 1; | ||||
| } | ||||
| 
 | ||||
| #SepIcon{ | ||||
|   background-color: alpha(@theme_text_color, 0.6); | ||||
| } | ||||
| 
 | ||||
| #iconlabel { | ||||
|   font-size:14px; | ||||
|   font-weight: bold; | ||||
|    | ||||
| } | ||||
| .roundborder * { | ||||
|   border-width:0px; | ||||
|   border-radius:5px; | ||||
| } | ||||
| .noborder { | ||||
|   border: none; | ||||
| } | ||||
| .menu:hover {	 | ||||
|     border-color:alpha(@theme_text_color, 0.01); | ||||
| } | ||||
| .menu {	 | ||||
|     border-color:alpha(@theme_text_color, 0.01); | ||||
| } | ||||
| .menu:hover >* { | ||||
|   border-color:alpha(@theme_text_color, 0.01); | ||||
| } | ||||
| .menuitembottom{ | ||||
|   margin-top:0px; | ||||
|   margin-bottom:3px; | ||||
| } | ||||
| .menuitemmiddle{ | ||||
|   margin-top:0px; | ||||
|   margin-bottom:0px; | ||||
| } | ||||
| 
 | ||||
| .menuitemtop{ | ||||
|   margin-bottom:0px; | ||||
| } | ||||
| .menuitemtop *{ | ||||
|   margin:2px 2px 0 2px; | ||||
|   padding: 5px 10px 3px 5px; | ||||
| } | ||||
| .menuitemmiddle *{ | ||||
|   margin:0 2px 0 2px; | ||||
|   padding: 3px 10px 3px 5px; | ||||
| } | ||||
| .menuitembottom *{ | ||||
|   margin:0 2px 2px 2px; | ||||
|   padding: 3px 10px 5px 5px; | ||||
| } | ||||
| .menuitemtop:hover { | ||||
|   background:@theme_bg_color; | ||||
|   border-color:inherit; | ||||
|   border-left-width:inherit; | ||||
|   border-right-width:inherit; | ||||
| } | ||||
| .menuitemmiddle:hover { | ||||
|   background:@theme_bg_color; | ||||
|   border-color:inherit; | ||||
|   border-left-width:inherit; | ||||
|   border-right-width:inherit; | ||||
| } | ||||
| .menuitembottom:hover { | ||||
|   background:@theme_bg_color; | ||||
|   border-color:inherit; | ||||
|   border-left-width:inherit; | ||||
|   border-right-width:inherit; | ||||
|    | ||||
| } | ||||
| .menuitemtop:hover* { | ||||
|   margin:2px 2px 0 2px; | ||||
|   padding: 5px 10px 3px 5px; | ||||
|   background:@theme_selected_bg_color; | ||||
|   border-radius:2px; | ||||
| } | ||||
| .menuitemmiddle:hover* { | ||||
|   margin:0 2px 0 2px; | ||||
|   padding: 3px 10px 3px 5px; | ||||
|   background:@theme_selected_bg_color; | ||||
|   border-radius:2px; | ||||
| } | ||||
| .menuitembottom:hover* { | ||||
|   margin:0 2px 2px 2px; | ||||
|   padding: 3px 10px 5px 5px; | ||||
|   background:@theme_selected_bg_color; | ||||
|   border-radius:2px; | ||||
| } | ||||
| 
 | ||||
| .workingbg, #workingbg { | ||||
|   background-color:@theme_base_color; | ||||
| } | ||||
| .workingbg.view.cell:selected { | ||||
|   background-color:@theme_selected_bg_color; | ||||
| } | ||||
| .workingbg.view.cell:hover { | ||||
|   background-color:darker(@theme_selected_bg_color); | ||||
|   color:@theme_selected_text_color; | ||||
|   border-radius:3px; | ||||
| } | ||||
| .bkim { | ||||
|   transition: 200ms ease-out; | ||||
|       background-image: none; | ||||
| } | ||||
| .noborder{ | ||||
| border:none; | ||||
| } | ||||
| 
 | ||||
| .bkim{ | ||||
| opacity:0.99; | ||||
| border:none; | ||||
| } | ||||
| 
 | ||||
| .bkim_no_plug{ | ||||
| background-color: transparent; | ||||
| opacity:0.99; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| @ -0,0 +1,15 @@ | ||||
| [Desktop Entry] | ||||
| Encoding=UTF-8 | ||||
| Name=ubl-settings-diskquota | ||||
| Name[ru]=Настройка дисковых квот | ||||
| GenericName=ubl-settings-diskquota | ||||
| GenericName[ru]=Настройка дисковых квот | ||||
| Comment=Application for managing and configuring disk quotas | ||||
| Comment[ru]=Приложение по управлению и настройке дисковых квот | ||||
| Type=Application | ||||
| Exec=pkexec ubl-settings-diskquota | ||||
| Icon=com.ublinux.ubl-settings-diskquota | ||||
| Terminal=false | ||||
| X-XfcePluggable=true | ||||
| X-UBLPluggable=true | ||||
| Categories=XFCE;GTK;Settings;DesktopSettings;X-XFCE-SettingsDialog;X-XFCE-SystemSettings;X-UBL-SettingsManager;X-UBL-SystemSettings; | ||||
											
												
													File diff suppressed because it is too large
													Load Diff
												
											
										
									
								
					Loading…
					
					
				
		Reference in new issue
	
	