diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..d77f196
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+.vscode/
+ubl-settings-diskquota.glade~
+ubl-settings-diskquota_ru.po~
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..abf1568
--- /dev/null
+++ b/Makefile
@@ -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"
diff --git a/README.md b/README.md
index eaa8e8c..56811b5 100644
--- a/README.md
+++ b/README.md
@@ -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
+```
diff --git a/VERSION.md b/VERSION.md
new file mode 100644
index 0000000..12ebd01
--- /dev/null
+++ b/VERSION.md
@@ -0,0 +1 @@
+VERSION 1.0
diff --git a/com.ublinux.pkexec.ubl-settings-diskquota.exec.policy b/com.ublinux.pkexec.ubl-settings-diskquota.exec.policy
new file mode 100644
index 0000000..f7a538c
--- /dev/null
+++ b/com.ublinux.pkexec.ubl-settings-diskquota.exec.policy
@@ -0,0 +1,24 @@
+
+
+
+
+ UBLinux
+ https://ublinux.ru
+
+
+ Run "ubl-settings-quotas" as root
+ Запус "Загрузка системы" с правами root
+ Authentication is required to run "ubl-settings-quotas"
+ Требуется авторизация для запуска "Загрузка системы" с правами root
+
+ auth_admin
+ auth_admin
+ auth_admin
+
+ /usr/bin/ubl-settings-quotas
+ true
+
+
+
diff --git a/com.ublinux.ubl-settings-diskquota.checked.svg b/com.ublinux.ubl-settings-diskquota.checked.svg
new file mode 100644
index 0000000..e3cab42
--- /dev/null
+++ b/com.ublinux.ubl-settings-diskquota.checked.svg
@@ -0,0 +1,327 @@
+
+
diff --git a/com.ublinux.ubl-settings-diskquota.svg b/com.ublinux.ubl-settings-diskquota.svg
new file mode 100644
index 0000000..708bd05
--- /dev/null
+++ b/com.ublinux.ubl-settings-diskquota.svg
@@ -0,0 +1,5903 @@
+
+
diff --git a/com.ublinux.ubl-settings-diskquota.warning.svg b/com.ublinux.ubl-settings-diskquota.warning.svg
new file mode 100644
index 0000000..9a90dba
--- /dev/null
+++ b/com.ublinux.ubl-settings-diskquota.warning.svg
@@ -0,0 +1,55 @@
+
+
diff --git a/logo-background.png b/logo-background.png
new file mode 100644
index 0000000..8eb67cb
Binary files /dev/null and b/logo-background.png differ
diff --git a/screenshot/screenshot.png b/screenshot/screenshot.png
new file mode 100644
index 0000000..51bf4ab
Binary files /dev/null and b/screenshot/screenshot.png differ
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
new file mode 100644
index 0000000..0caeeb7
--- /dev/null
+++ b/source/CMakeLists.txt
@@ -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)
\ No newline at end of file
diff --git a/source/controler.cc b/source/controler.cc
new file mode 100644
index 0000000..38f889a
--- /dev/null
+++ b/source/controler.cc
@@ -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;
+}
\ No newline at end of file
diff --git a/source/controler.h b/source/controler.h
new file mode 100644
index 0000000..263493c
--- /dev/null
+++ b/source/controler.h
@@ -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);
+};
\ No newline at end of file
diff --git a/source/load.cc b/source/load.cc
new file mode 100644
index 0000000..200c4b3
--- /dev/null
+++ b/source/load.cc
@@ -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& Load::get_load_data(std::map &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 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();
+ }
+
+}
diff --git a/source/load.h b/source/load.h
new file mode 100644
index 0000000..26aaf96
--- /dev/null
+++ b/source/load.h
@@ -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& get_load_data(std::map &map_temp, string str_flag_load);
+ };
+
+
+}
+#endif
\ No newline at end of file
diff --git a/source/main.cc b/source/main.cc
new file mode 100644
index 0000000..85d79f4
--- /dev/null
+++ b/source/main.cc
@@ -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 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 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;
+ }
+
+}
\ No newline at end of file
diff --git a/source/my_device.h b/source/my_device.h
new file mode 100644
index 0000000..1db5317
--- /dev/null
+++ b/source/my_device.h
@@ -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
+
diff --git a/source/my_plug.cc b/source/my_plug.cc
new file mode 100644
index 0000000..6294ab4
--- /dev/null
+++ b/source/my_plug.cc
@@ -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 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
\ No newline at end of file
diff --git a/source/my_plug.h b/source/my_plug.h
new file mode 100644
index 0000000..5d9a3d1
--- /dev/null
+++ b/source/my_plug.h
@@ -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 builder);
+
+private:
+ Gtk::Widget *plugBox;
+ Gtk::Widget *parent;
+};
\ No newline at end of file
diff --git a/source/my_process.cc b/source/my_process.cc
new file mode 100644
index 0000000..658afd5
--- /dev/null
+++ b/source/my_process.cc
@@ -0,0 +1,84 @@
+#include "my_process.h"
+#include "util.h"
+
+namespace My_Process {
+#define debug false
+struct Utils::Result My_Process_call::call(string cmd) {
+ this->i_error_old = this->i_error;
+ struct Utils::Result 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;
+}
+}
\ No newline at end of file
diff --git a/source/my_process.h b/source/my_process.h
new file mode 100644
index 0000000..3cc6f81
--- /dev/null
+++ b/source/my_process.h
@@ -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 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
\ No newline at end of file
diff --git a/source/my_type.h b/source/my_type.h
new file mode 100644
index 0000000..6355b2f
--- /dev/null
+++ b/source/my_type.h
@@ -0,0 +1,79 @@
+#ifndef MY_TYPE_H
+#define MY_TYPE_H
+
+#include "project_lib.h"
+#include
+
+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 map_str_str;
+typedef map * map_s_s_ptr;
+typedef std::map map_str_device;
+#endif
\ No newline at end of file
diff --git a/source/project_lib.h b/source/project_lib.h
new file mode 100644
index 0000000..bc0b1d2
--- /dev/null
+++ b/source/project_lib.h
@@ -0,0 +1,26 @@
+#ifndef PROJECT_LIB_H
+#define PROJECT_LIB_H
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include