diff --git a/.gitignore b/.gitignore index d77f196..8879ccd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,9 @@ .vscode/ -ubl-settings-diskquota.glade~ -ubl-settings-diskquota_ru.po~ +ubl-settings-diskquota +*~ +build/ +compile/ +*# +terminal-commands/ +source/ubl-cmake.h +vgcore* \ No newline at end of file diff --git a/.install.sh b/.install.sh new file mode 100755 index 0000000..ad955f9 --- /dev/null +++ b/.install.sh @@ -0,0 +1,6 @@ +make +gcc compile/resources.c compile/ubl-cmake.h source/view_set_disk.h source/view_set_disk.c source/view_check_user_table.c source/view_check_user_table.h source/view_filters.c source/model/vector.c source/model/vector.h source/view_filters.h source/view_temp_u_g_p.c source/view_temp_u_g_p.h source/controler.h source/controler.c source/model/philos_utils.h source/model/philos_utils.c source/model/my_device.h source/model/save.h source/model/save.c source/model/my_device.c source/model/model.h source/model/load.h source/model/load.c source/model/model.c source/ubl-settings-diskquota.c source/ubl-settings-diskquota.h source/ubl-strings.h source/model/ubl-utils.c source/model/ubl-utils.h -o ubl-settings-diskquota `pkg-config --cflags --libs gtk+-3.0 vte-2.91 webkit2gtk-4.0 webkit2gtk-web-extension-4.0` -g +sudo make install clean +cd ./terminal-commands +make +cd ../ diff --git a/Makefile b/Makefile index eae48d9..c0be6ef 100644 --- a/Makefile +++ b/Makefile @@ -21,11 +21,11 @@ all: init build init: @echo "Initialize ..."; \ if [ -d ".git" ]; then \ - LATEST_TAG=$$(git describe --tags | sed 's/^v//'); \ + LATEST_TAG=$$(git describe --tags | sed 's/^v//'|grep -oE "^[0-9]{1,}.[0-9]{1,}"); \ else \ LATEST_TAG="0.0"; \ fi; \ - sed -r "s/^(string version_application = ).*/\1\"$${LATEST_TAG}\";/" -i source/${PKGNAME}.cc; \ + sed -r "s/^(string version_application).*/\1=\"$${LATEST_TAG}\";/" -i source/${PKGNAME}.h; \ echo "-- Build path: ${CMAKE_BUILD_DIR}" depend: @@ -43,6 +43,8 @@ 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}"; \ + @gcc compile/resources.c compile/ubl-cmake.h source/view_set_disk.h source/view_set_disk.c source/view_check_user_table.c source/view_check_user_table.h source/view_filters.c source/model/vector.c source/model/vector.h source/view_filters.h source/view_temp_u_g_p.c source/view_temp_u_g_p.h source/controler.h source/controler.c source/model/philos_utils.h source/model/philos_utils.c source/model/my_device.h source/model/save.h source/model/save.c source/model/my_device.c source/model/model.h source/model/load.h source/model/load.c source/model/model.c source/ubl-settings-diskquota.c source/ubl-settings-diskquota.h source/ubl-strings.h source/model/ubl-utils.c source/model/ubl-utils.h -o ubl-settings-diskquota `pkg-config --cflags --libs gtk+-3.0 vte-2.91 webkit2gtk-4.0 webkit2gtk-web-extension-4.0` -g + fi; \ echo "Debug: OK" @@ -86,10 +88,10 @@ uninstall: 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.${PKGNAME}.policy" @$(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/com.ublinux.${PKGNAME}.svg" - @$(RM) -rd "${DESTDIR}${PREFIX}/share/${PKGNAME}" + @$(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/status/com.ublinux.${PKGNAME}.checked.svg" + @$(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/status/com.ublinux.${PKGNAME}.warning.svg" + @$(RM) "${DESTDIR}${PREFIX}/share/polkit-1/actions/com.ublinux.${PKGNAME}.policy" @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; \ @@ -113,24 +115,23 @@ install: check uninstall 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.${PKGNAME}.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" @install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.funnel.svg" + @install -dm755 "${DESTDIR}${PREFIX}/share/polkit-1/actions" + @install -Dm644 -t "${DESTDIR}${PREFIX}/share/polkit-1/actions/" "com.ublinux.${PKGNAME}.policy" + @install -Dm644 -t "${DESTDIR}${PREFIX}/share/polkit-1/actions/" "gdb.policy" + @install -Dm755 -t "${DESTDIR}${PREFIX}/bin/" "${CMAKE_BUILD_DIR}/${PKGNAME}" + @install -dm755 "${DESTDIR}/etc/xdg" + @install -dm755 "${DESTDIR}${PREFIX}/share/applications" + @install -Dm644 -t "${DESTDIR}${PREFIX}/share/applications/" "${PKGNAME}.desktop" @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" + @sed -r "s/^(string version_application=\"*\").*/string version_application;/" -i source/${PKGNAME}.h; \ clean: @echo "Clean ..." @@ -151,3 +152,4 @@ help: echo "... install"; \ echo "... uninstall"; \ echo "... clean" + diff --git a/README.md b/README.md index 56811b5..85aef32 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,12 @@ # ubl-settings-diskquota -# Настройки квот -[RU] Утилита для настройки дисковых квот - -Utility for setting the disk quotas - -![alt text](screenshot/screenshot.png) - +# Выполнить # Build In order to build ubl-settings-diskquota you will need: - CMake - C compiler - GTK+ 3 & dependencies +- webkit2gtk (optional) Once you have all the necessary dependencies, you can use: ```sh @@ -29,21 +24,6 @@ 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 -``` +![alt text](screenshot/screenshot.png) + diff --git a/com.ublinux.ubl-settings-diskquota.policy b/com.ublinux.ubl-settings-diskquota.policy index 79dd276..de22da1 100644 --- a/com.ublinux.ubl-settings-diskquota.policy +++ b/com.ublinux.ubl-settings-diskquota.policy @@ -8,10 +8,10 @@ https://ublinux.ru - Run "ubl-settings-diskquota" as root - Запус ubl-settings-diskquota с правами root + Run ubl-settings-diskquota as root + Запуск утилиты ubl-settings-diskquota с правами root Authentication is required to run ubl-settings-diskquota - Требуется авторизация для запуска ubl-settings-diskquota с правами root + Требуется авторизация для запуска утилиты ubl-settings-diskquota с правами root auth_admin auth_admin diff --git a/gdb.policy b/gdb.policy new file mode 100644 index 0000000..c1a7da0 --- /dev/null +++ b/gdb.policy @@ -0,0 +1,24 @@ + + + + + UBLinux + https://ublinux.ru + + + Run ubl-settings-diskquota as root + Запуск утилиты ubl-settings-diskquota с правами root + Authentication is required to run ubl-settings-diskquota + Требуется авторизация для запуска утилиты ubl-settings-diskquota с правами root + + auth_admin + auth_admin + auth_admin + + /usr/bin/gdb + true + + + diff --git a/gresource.xml b/gresource.xml new file mode 100644 index 0000000..c640934 --- /dev/null +++ b/gresource.xml @@ -0,0 +1,12 @@ + + + + ubl-settings-diskquota.glade + + + ubl-settings-diskquota.css + + + ubl-settings-diskquota-banner.png + + \ No newline at end of file diff --git a/screenshot/screenshot.png b/screenshot/screenshot.png index 51bf4ab..fba0817 100644 Binary files a/screenshot/screenshot.png and b/screenshot/screenshot.png differ diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 4b3ebc2..49706e3 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -1,19 +1,21 @@ cmake_minimum_required(VERSION 3.7) -find_package(PkgConfig REQUIRED) project(ubl-settings-diskquota) +find_package(PkgConfig REQUIRED) -pkg_check_modules(GTK REQUIRED gtkmm-3.0) +pkg_check_modules(GTK REQUIRED gtk+-3.0) include_directories(${GTK_INCLUDE_DIRS}) link_directories(${GTK_LIBRARY_DIRS}) add_definitions(${GTK_CFLAGS_OTHER}) +#pkg_check_modules(VTE291 REQUIRED vte-2.91) +#include_directories(${VTE291_INCLUDE_DIRS}) +#link_directories(${VTE291_LIBRARY_DIRS}) +#add_definitions(${VTE291_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) @@ -21,64 +23,97 @@ if(WEBKIT_LIBRARIES_FOUND) 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") +configure_file(ubl-cmake.in ubl-cmake.h) + +file(COPY ${CMAKE_CURRENT_BINARY_DIR}/ubl-cmake.h DESTINATION ./) + +set(GRESOURCE_C resources.c) +set(GRESOURCE_XML gresource.xml) + +find_program(GLIB_COMPILE_RESOURCES NAMES glib-compile-resources REQUIRED) +add_custom_target(GLADE ubl-settings-diskquota.glade) + +set(DEPENDFILES + ../ubl-settings-diskquota.glade + ../gresource.xml + ../ubl-settings-diskquota-banner.png + ../ubl-settings-diskquota.css + ) + +file(COPY ${DEPENDFILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + +add_custom_command( + OUTPUT ${GRESOURCE_C} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${GLIB_COMPILE_RESOURCES} + ARGS + --generate-source + --target=${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C} + ${GRESOURCE_XML} + VERBATIM + MAIN_DEPENDENCY ${GRESOURCE_XML} + DEPENDS + ${GLADE} +) +add_custom_target( + dummy-resource + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C} +) + +#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always -std=c++2a") +#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always -lm") 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") + -fstack-clash-protection -fcf-protection") + set(SOURCE_FILES - view/view_edit_project.cc - view/view_edit_project.h - view/view_add_project.cc - view/view_add_project.h - view/view_edit_user_group.h - view/view_edit_user_group.cc - view/view_add_user_group.h - view/view_add_user_group.cc - view/view_edit_user_group.cc - view/view_edit_user_group.h - view/view_filters.cc - view/view_filters.h - view/ubl-settings-diskquota.h - view/ubl-settings-diskquota.cc - view/model/ubconfig_quota.cc - view/model/ubconfig_quota.h - view/model/save.h - view/model/save.cc - view/model/load.h - view/model/load.cc - view/model/my_process.h - view/model/my_process.cc - view/model/util.h - view/model/util.cc - view/ubl-util-standard.h - view/ubl-util-standard.c - view/model/wrapper_load_save.cc - view/model/wrapper_load_save.h - ubl-settings-diskquota-cm.h - view/view_open_browser.cc - view/view_open_browser.h - view/view_about.h - view/view_about.cc - controller.cc - controller.h - main.cc - var.h - project_lib.h - my_type.h) + view_set_disk.c + view_set_disk.h + controler.h + controler.c + view_check_user_table.c + view_check_user_table.h + model/model.h + model/model.c + model/save.h + model/save.c + model/load.h + model/load.c + model/vector.c + model/vector.h + ubl-strings.h + view_filters.c + view_filters.h + view_temp_u_g_p.c + view_temp_u_g_p.h + model/ubl-utils.h + model/ubl-utils.c + model/my_device.h + model/my_device.c + model/philos_utils.h + model/philos_utils.c + + ubl-settings-diskquota.c + ubl-settings-diskquota.h + ${CMAKE_CURRENT_BINARY_DIR}/ubl-cmake.h + ) set(LIBRARIES ${GTK_LIBRARIES} + ${WEBKIT_LIBRARIES} +# ${VTE291_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 +add_executable(${PROJECT_NAME} ${SOURCE_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C}) +target_link_libraries(${PROJECT_NAME} PUBLIC ${LIBRARIES}) +target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_BINARY_DIR}) +set_source_files_properties( + ${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C} + PROPERTIES GENERATED TRUE +) +install(TARGETS ${PROJECT_NAME} DESTINATION bin) +add_dependencies(${PROJECT_NAME} dummy-resource) \ No newline at end of file diff --git a/source/controler.c b/source/controler.c new file mode 100644 index 0000000..d4ab4ad --- /dev/null +++ b/source/controler.c @@ -0,0 +1,589 @@ +#include "controler.h" + +main_window cfg_main_gui; +custom_window cfg_custom_gui; +config_settings_gui main_config; +config_all all_config; +int index_selected = -1; +int note_selected = -1; +// note_selected = 0; user +// note_selected = 1; group +// note_selected = 2; project + +void update_time_table(vector* vec_temp) { + for (int index = 0; index < all_config.v_disk_status.vectorList.total; index++) { + disk_status* _config_device = (disk_status*)all_config.v_disk_status.pfVectorGet(&all_config.v_disk_status, index); + for (int i = 0; i < vec_temp->vectorList.total; i++) { + config_u_g_p* _config = (config_u_g_p*)vec_temp->pfVectorGet(vec_temp, i); + if (strstr(_config->UNIX_file, _config_device->device)) { + _config->deferring_size = _config_device->deferring_size; + _config->deferring_file = _config_device->deferring_file; + } + } + } +} + + +void entry_user_disk(GtkWidget *self, int* flag_update) { + update_time_table(&all_config.v_user); + if (flag_update) { + all_config.flag_set_data = 1; + all_config.flag_save = 3; + temp_on_destroy_subwindow(self); + } + int find = fill_tree_view_user_group(&all_config, &cfg_custom_gui.user, "usrquota", 0); + if (find == 0) { + g_object_ref(cfg_custom_gui.user.liststore); + gtk_list_store_clear(cfg_custom_gui.user.liststore); + } + wrapper_fill_tree_view_generate(&all_config, &cfg_custom_gui); +} + +void entry_device_disk(GtkWidget *self, int* flag_update) { + + if (flag_update) { + all_config.flag_set_data = 1; + all_config.flag_save = 3; + view_device_get_gui_data(); + view_device_on_destroy_subwindow(self); + } + int find = fill_tree_view_device(&all_config.v_disk_status, &cfg_custom_gui.device, 0); + if (find == 0) { + g_object_ref(cfg_custom_gui.device.liststore); + gtk_list_store_clear(cfg_custom_gui.device.liststore); + } + entry_user_disk(0, 0); + entry_groups_disk(0, 0); + entry_project_disk(0, 0); + wrapper_fill_tree_view_generate(&all_config, &cfg_custom_gui); + tree_view_select_user(NULL); + tree_view_select_group(NULL); + tree_view_select_project(NULL); +} + +void entry_groups_disk(GtkWidget *self,int* flag_update) { + update_time_table(&all_config.v_group); + if (flag_update) { + all_config.flag_set_data = 1; + all_config.flag_save = 3; + temp_on_destroy_subwindow(self); + } + int find = fill_tree_view_user_group(&all_config, &cfg_custom_gui.group,"grpquota", 0); + if (find == 0) { + g_object_ref(cfg_custom_gui.group.liststore); + gtk_list_store_clear(cfg_custom_gui.group.liststore); + } + wrapper_fill_tree_view_generate(&all_config, &cfg_custom_gui); +} + +void entry_project_disk(GtkWidget *self,int* flag_update) { + update_time_table(&all_config.v_project); + if (flag_update) { + all_config.flag_set_data = 1; + all_config.flag_save = 3; + temp_on_destroy_subwindow(self); + } + int find = fill_tree_view_project(&all_config, &cfg_custom_gui.project,"prjquota", 0); + if (find == 0) { + g_object_ref(cfg_custom_gui.project.liststore); + gtk_list_store_clear(cfg_custom_gui.project.liststore); + } + wrapper_fill_tree_view_generate(&all_config, &cfg_custom_gui); +} + +void wrapper_filters_user_show() { + filters_get_tree_view(cfg_custom_gui.user.tree_view); + filters_set_name("usrquota"); + filters_show(NULL, glade_path); +} +void wrapper_filters_group_show() { + filters_get_tree_view(cfg_custom_gui.group.tree_view); + filters_set_name("grpquota"); + filters_show(NULL, glade_path); +} +void wrapper_filters_project_show() { + filters_get_tree_view(cfg_custom_gui.project.tree_view); + filters_set_name("prjquota"); + filters_show(NULL, glade_path); +} + +void wrapper_add_user_show() { + set_temp_menu("usrquota", "add"); + set_all_config(&all_config); + set_vector(&all_config.v_user); + temp_show(NULL, glade_path); + int i = 0; + g_signal_connect(G_OBJECT(get_widget_temp()->btnSaveTempSave),"clicked",G_CALLBACK(entry_user_disk),&i); +} + +void wrapper_edit_user_show() { + int index = wrapper_select_tree_view(&cfg_custom_gui.user); + set_temp_menu("usrquota", "edit"); + temp_set_index(index); + set_all_config(&all_config); + set_vector(&all_config.v_user); + temp_show(NULL, glade_path); + set_edit_gui_data_base(&all_config, index); + int i = 0; + g_signal_connect(G_OBJECT(get_widget_temp()->btnSaveTempSave),"clicked",G_CALLBACK(entry_user_disk),&i); +} + +void wrapper_add_group_show() { + set_temp_menu("grpquota", "add"); + set_all_config(&all_config); + set_vector(&all_config.v_group); + temp_show(NULL, glade_path); + int i = 0; + g_signal_connect(G_OBJECT(get_widget_temp()->btnSaveTempSave),"clicked",G_CALLBACK(entry_groups_disk),&i); +} + +void wrapper_edit_group_show() { + int index = wrapper_select_tree_view(&cfg_custom_gui.group); + set_temp_menu("grpquota", "edit"); + temp_set_index(index); + set_all_config(&all_config); + set_vector(&all_config.v_group); + temp_show(NULL, glade_path); + set_edit_gui_data_base(&all_config, index); + int i = 0; + g_signal_connect(G_OBJECT(get_widget_temp()->btnSaveTempSave),"clicked",G_CALLBACK(entry_groups_disk),&i); + +} + +void wrapper_add_project_show() { + set_temp_menu("prjquota", "add"); + set_all_config(&all_config); + set_vector(&all_config.v_project); + temp_show(NULL, glade_path); + int i = 0; + g_signal_connect(G_OBJECT(get_widget_temp()->btnSaveTempSave),"clicked",G_CALLBACK(entry_project_disk),&i); +} + +void wrapper_edit_project_show(GtkWidget* self, vector* vec_temp) { + int index = wrapper_select_tree_view(&cfg_custom_gui.project); + set_temp_menu("prjquota", "edit"); + temp_set_index(index); + set_all_config(&all_config); + set_vector(&all_config.v_project); + temp_show(NULL, glade_path); + set_edit_gui_data_base(&all_config, index); + int i = 0; + g_signal_connect(G_OBJECT(get_widget_temp()->btnSaveTempSave),"clicked",G_CALLBACK(entry_project_disk),&i); +} + +void wrapper_edit_view_device_show(GtkWidget* self) { + view_device_set_vector_device(&all_config.v_disk_status); + view_device_set_index(index_selected); + set_view_device_menu("edit"); + view_device_all_config(&all_config); + view_device_show(NULL, glade_path); + int i = 0; + g_signal_connect(G_OBJECT(get_widget_view_device()->btnSaveTempSave),"clicked",G_CALLBACK(entry_device_disk),&i); +} + +void wrapper_add_view_device_show(GtkWidget* self) { + view_device_set_vector_device(&all_config.v_disk_status); + view_device_set_index(-1); + set_view_device_menu("add"); + view_device_all_config(&all_config); + view_device_show(NULL, glade_path); + int i = 0; + g_signal_connect(G_OBJECT(get_widget_view_device()->btnSaveTempSave),"clicked",G_CALLBACK(entry_device_disk),&i); +} + +void block_tree_view(hotebook* widgets,void (*f)()) { + g_signal_handlers_block_by_func(G_OBJECT(widgets->tree_view), G_CALLBACK(f), NULL); +} + +void unlock_tree_view(hotebook* widgets,void (*f)()) { + g_signal_handlers_unblock_by_func(G_OBJECT(widgets->tree_view), G_CALLBACK(f), NULL); +} + +void tree_view_select(GtkWidget* self, vector* vec_temp, hotebook* widgets) { + if (self) {} + if (vec_temp->vectorList.total > 0 && all_config.v_disk_status.vectorList.total>0) { + wrapper_select_tree_view(widgets); + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(widgets->liststore); + GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->tree_view)); + if(gtk_tree_selection_get_selected(selection, &model, &iter)) { + gtk_widget_set_sensitive(widgets->btnAdd, 1); + gtk_widget_set_sensitive(widgets->btnDel, 1); + gtk_widget_set_sensitive(widgets->btnEdit, 1); + } + else { + if (main_config.lock_save_global == 0 || main_config.lock_save_local == 0) { + gtk_widget_set_sensitive(widgets->btnAdd,1); + } + gtk_widget_set_sensitive(widgets->btnDel, 0); + gtk_widget_set_sensitive(widgets->btnEdit, 0); + } + } + if (vec_temp->vectorList.total > 0 && all_config.v_disk_status.vectorList.total==0) { + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(widgets->liststore); + GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->tree_view)); + if(gtk_tree_selection_get_selected(selection, &model, &iter)) { + gtk_widget_set_sensitive(widgets->btnDel, 1); + } + else { + if (main_config.lock_save_global == 0 || main_config.lock_save_local == 0) { + gtk_widget_set_sensitive(widgets->btnAdd,1); + } + gtk_widget_set_sensitive(widgets->btnAdd, 0); + gtk_widget_set_sensitive(widgets->btnDel, 0); + gtk_widget_set_sensitive(widgets->btnEdit, 0); + } + } + else if (!all_config.v_disk_status.vectorList.total && note_selected != 3) { + gtk_widget_set_sensitive(widgets->btnAdd, 0); + } + else if (all_config.v_disk_status.vectorList.total > 0 && note_selected != 3) { + gtk_widget_set_sensitive(widgets->btnAdd, 1); + } + else { + gtk_widget_set_sensitive(widgets->btnDel, 0); + gtk_widget_set_sensitive(widgets->btnEdit, 0); + } + if (widgets->note_selected == note_selected && index_selected>= 0) { + gtk_widget_set_sensitive(widgets->btnAdd, 1); + gtk_widget_set_sensitive(widgets->btnDel, 1); + gtk_widget_set_sensitive(widgets->btnEdit, 1); + } + else { + gtk_widget_set_sensitive(widgets->btnDel, 0); + gtk_widget_set_sensitive(widgets->btnEdit, 0); + } +} + +void device_remove() { + if (note_selected == 3) { + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(cfg_custom_gui.device.liststore); + GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(cfg_custom_gui.device.tree_view)); + if(gtk_tree_selection_get_selected(selection, &model, &iter)) { + int index = wrapper_select_tree_view(&cfg_custom_gui.device); + gtk_list_store_remove(cfg_custom_gui.device.liststore, &iter); + if (index!=-1) { + index_selected = -1; + disk_status* _config = (disk_status*)all_config.v_disk_status.pfVectorGet(&all_config.v_disk_status, index); + yon_window_config_erase_custom_parameter(_config->device, "deferring_size"); + yon_window_config_erase_custom_parameter(_config->device, "deferring_file"); + yon_window_config_erase_custom_parameter(_config->device, _config->device); + all_config.v_disk_remove.pfVectorAdd(&all_config.v_disk_remove, yon_char_new(_config->device)); + model_search_disk_remove(&all_config.v_user, &all_config.v_remove, _config->device); + model_search_disk_remove(&all_config.v_group, &all_config.v_remove, _config->device); + model_search_disk_remove_project(&all_config.v_project,&all_config.v_disk_status, &all_config.v_remove, _config->device); + model_clear_cfg_device(_config); + all_config.v_disk_status.pfVectorDelete(&all_config.v_disk_status, index); + all_config.flag_save = 1; + + } + } + } + entry_user_disk(0, 0); + entry_groups_disk(0, 0); + entry_project_disk(0, 0); + tree_view_select_user(NULL); + tree_view_select_group(NULL); + tree_view_select_project(NULL); +} + + +void user_remove() { + if (note_selected == 0) { + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(cfg_custom_gui.user.liststore); + GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(cfg_custom_gui.user.tree_view)); + if(gtk_tree_selection_get_selected(selection, &model, &iter)) { + int index = wrapper_select_tree_view(&cfg_custom_gui.user); + gtk_list_store_remove(cfg_custom_gui.user.liststore, &iter); + model_template_remove(&all_config.v_user, &all_config.v_remove, index); + index_selected = -1; + all_config.flag_save = 1; + } + + } +} + +void group_remove() { + if (note_selected == 1) { + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(cfg_custom_gui.group.liststore); + GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(cfg_custom_gui.group.tree_view)); + if(gtk_tree_selection_get_selected(selection, &model, &iter)) { + int index = wrapper_select_tree_view(&cfg_custom_gui.group); + gtk_list_store_remove(cfg_custom_gui.group.liststore, &iter); + model_template_remove(&all_config.v_group, &all_config.v_remove, index); + index_selected = -1; + all_config.flag_save = 1; + } + } +} + +void project_remove() { + if (note_selected == 2) { + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(cfg_custom_gui.project.liststore); + GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(cfg_custom_gui.project.tree_view)); + if(gtk_tree_selection_get_selected(selection, &model, &iter)) { + int index = wrapper_select_tree_view(&cfg_custom_gui.project); + gtk_list_store_remove(cfg_custom_gui.project.liststore, &iter); + model_template_remove(&all_config.v_project, &all_config.v_remove, index); + index_selected = -1; + all_config.flag_save = 1; + } + + } +} + +int wrapper_select_tree_view(hotebook* widgets) { + int index = -1; + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(widgets->liststore); + GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->tree_view)); + if(gtk_tree_selection_get_selected(selection, &model, &iter)) { + char* str_iter = gtk_tree_model_get_string_from_iter(model, &iter); + index = atoi(str_iter); + index_selected = index; + } + else { + index_selected = -1; + } + return index; +} + +void wrapper_all_save() { + int flag_mess_save = 0; + if (all_config.flag_load == 0) { + flag_mess_save = wrapper_template_save(&all_config, CMD_ALL_SAVE, CMD_ALL_REMOVE); + } + else { + flag_mess_save = wrapper_template_save(&all_config, CMD_ALL_SAVE, CMD_ALL_REMOVE); + } + if (flag_mess_save) { + yon_ubl_status_box_render(GLOBAL_LOCAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); + all_config.flag_load=0; + } + else { + yon_ubl_status_box_render(MESS_NOTHING_SAVE, BACKGROUND_IMAGE_SUCCESS_TYPE); + } +} +void wrapper_global_save() { + if (wrapper_template_save(&all_config, CMD_SAVE_GLOBAL, CMD_REMOVE_GLOBAL)) { + yon_ubl_status_box_render(GLOBAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); + all_config.flag_load-=1; + } + else { + yon_ubl_status_box_render(MESS_NOTHING_SAVE, BACKGROUND_IMAGE_SUCCESS_TYPE); + } +} +void wrapper_system_save() { + if (wrapper_template_save(&all_config, CMD_SAVE_SYSTEM, CMD_REMOVE_SYSTEM)) { + yon_ubl_status_box_render(LOCAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); + all_config.flag_load-=1; + } + else { + yon_ubl_status_box_render(MESS_NOTHING_SAVE, BACKGROUND_IMAGE_SUCCESS_TYPE); + } +} +void load_system_cfg() { + all_config.flag_load = 0; + load_template_load_cfg(&all_config, CMD_LOAD_SYSTEM); + yon_ubl_status_box_render(LOCAL_LOAD_SUCCESS_LABEL, BACKGROUND_IMAGE_SUCCESS_TYPE); + entry_device_disk(0, 0); + entry_user_disk(0, 0); + entry_groups_disk(0, 0); + entry_project_disk(0, 0); + tree_view_select_user(NULL); + tree_view_select_group(NULL); + tree_view_select_project(NULL); + tree_view_select_device(NULL); +} + +void load_global_cfg() { + all_config.flag_load = 1; + load_template_load_cfg(&all_config, CMD_LOAD_GLOBAL); + yon_ubl_status_box_render(GLOBAL_LOAD_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); + entry_device_disk(0, 0); + entry_user_disk(0, 0); + entry_groups_disk(0, 0); + entry_project_disk(0, 0); + tree_view_select_user(NULL); + tree_view_select_group(NULL); + tree_view_select_project(NULL); + tree_view_select_device(NULL); +} + +void tree_view_select_device(GtkWidget* self) { + note_selected = 3; + tree_view_select(NULL,&all_config.v_disk_status , &cfg_custom_gui.device); +} + +void tree_view_select_user(GtkWidget* self) { + note_selected = 0; + tree_view_select(NULL,&all_config.v_user , &cfg_custom_gui.user); +} +void tree_view_select_group(GtkWidget* self) { + note_selected = 1; + tree_view_select(NULL,&all_config.v_group ,&cfg_custom_gui.group); +} +void tree_view_select_project(GtkWidget* self) { + note_selected = 2; + tree_view_select(NULL,&all_config.v_project , &cfg_custom_gui.project); +} + +void control_event(main_window* _config_main_gui, custom_window* _config_custom_gui) { + g_signal_connect(G_OBJECT(_config_main_gui->LoadLocalMenuItem), "activate", G_CALLBACK(load_system_cfg), NULL); + g_signal_connect(G_OBJECT(_config_main_gui->LoadGlobalMenuItem), "activate", G_CALLBACK(load_global_cfg), NULL); + g_signal_connect(G_OBJECT(_config_main_gui->SaveGlobalMenuItem), "activate", G_CALLBACK(wrapper_global_save), NULL); + g_signal_connect(G_OBJECT(_config_main_gui->SaveLocalMenuItem), "activate", G_CALLBACK(wrapper_system_save), NULL); + g_signal_connect(G_OBJECT(_config_main_gui->SaveMenuItem), "activate", G_CALLBACK(wrapper_all_save), NULL); + g_signal_connect(G_OBJECT(_config_custom_gui->user.btnAdd),"clicked",G_CALLBACK(wrapper_add_user_show), glade_path); + g_signal_connect(G_OBJECT(_config_custom_gui->user.btnEdit),"clicked",G_CALLBACK(wrapper_edit_user_show), glade_path); + g_signal_connect(G_OBJECT(_config_custom_gui->user.btnDel),"clicked",G_CALLBACK(user_remove), glade_path); + g_signal_connect(G_OBJECT(_config_custom_gui->group.btnAdd),"clicked",G_CALLBACK(wrapper_add_group_show), glade_path); + g_signal_connect(G_OBJECT(_config_custom_gui->group.btnEdit),"clicked",G_CALLBACK(wrapper_edit_group_show), glade_path); + g_signal_connect(G_OBJECT(_config_custom_gui->group.btnDel),"clicked",G_CALLBACK(group_remove), glade_path); + g_signal_connect(G_OBJECT(_config_custom_gui->project.btnAdd),"clicked",G_CALLBACK(wrapper_add_project_show), glade_path); + g_signal_connect(G_OBJECT(_config_custom_gui->project.btnEdit),"clicked",G_CALLBACK(wrapper_edit_project_show), glade_path); + g_signal_connect(G_OBJECT(_config_custom_gui->project.btnDel),"clicked",G_CALLBACK(project_remove), glade_path); + g_signal_connect(G_OBJECT(_config_custom_gui->user.btnFilter),"clicked",G_CALLBACK(wrapper_filters_user_show), glade_path); + g_signal_connect(G_OBJECT(_config_custom_gui->group.btnFilter),"clicked",G_CALLBACK(wrapper_filters_group_show), glade_path); + g_signal_connect(G_OBJECT(_config_custom_gui->project.btnFilter),"clicked",G_CALLBACK(wrapper_filters_project_show), glade_path); + + g_signal_connect(G_OBJECT(_config_custom_gui->user.tree_view), "cursor-changed", G_CALLBACK(tree_view_select_user), NULL); + g_signal_connect(G_OBJECT(_config_custom_gui->group.tree_view), "cursor-changed", G_CALLBACK(tree_view_select_group), NULL); + g_signal_connect(G_OBJECT(_config_custom_gui->project.tree_view), "cursor-changed", G_CALLBACK(tree_view_select_project), NULL); + g_signal_connect(G_OBJECT(_config_custom_gui->device.tree_view), "cursor-changed", G_CALLBACK(tree_view_select_device), NULL); + g_signal_connect(G_OBJECT(_config_custom_gui->device.btnEdit), "clicked", G_CALLBACK(wrapper_edit_view_device_show), glade_path); + g_signal_connect(G_OBJECT(_config_custom_gui->device.btnAdd), "clicked", G_CALLBACK(wrapper_add_view_device_show), glade_path); + g_signal_connect(G_OBJECT(_config_custom_gui->device.btnDel),"clicked",G_CALLBACK(device_remove), glade_path); + +} + +int main(int argc, char *argv[]){ + all_config.flag_not_data = 0; + vector_init(&all_config.v_user); + vector_init(&all_config.v_group); + vector_init(&all_config.v_project); + vector_init(&all_config.v_disk_status); + vector_init(&all_config.v_remove); + local=setlocale(LC_ALL, ""); + textdomain(LocaleName); + config_init(&main_config); + int size_array_size_pow = 0; + array_size_pow = yon_char_parsed_append(array_size_pow,&size_array_size_pow, STR_KB); + array_size_pow = yon_char_parsed_append(array_size_pow,&size_array_size_pow, STR_MB); + array_size_pow = yon_char_parsed_append(array_size_pow,&size_array_size_pow, STR_GB); + array_size_pow = yon_char_parsed_append(array_size_pow,&size_array_size_pow, STR_TB); + + int option_index=0; + int show_help=0; + int debug_mode=0; + { + struct option long_options[] = { + {"help", 0, 0, 'h'}, + {"version", 0, 0, 'V'}, + {"lock-help", 0,0, 1}, + {"lock-save", 0,0, 2}, + {"lock-save-local", 0,0, 3}, + {"lock-save-global", 0,0, 4}, + {"lock-load-global", 0,0, 5}, + {"socket-id", 1, 0, 's'}, + {"socket-ext-id", 1,0, 'e'}, + {"socket-trd-id", 1,0, 't'}, + {"debug", 0,0, 'd'}, + { NULL, 0, NULL, 0 } + }; + for (int i=0;iHeadOverlay,widgets->HeadBox,widgets->HeadImage,banner_path); + + yon_ubl_status_box_setup(widgets->StatusIcon,widgets->StatusBox,widgets->StatusLabel); + yon_window_config_setup(GTK_WINDOW(widgets->Window)); + yon_window_config_load(config_path); + if (getuid()!=0) { + load_system_cfg(); + yon_ubl_status_box_render(ROOT_WARNING_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); + } + else { + yon_ubl_status_box_render(LOAD_LOCAL_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); + if (main_config.lock_load_global == 0) { + load_global_cfg(); + } + if (main_config.lock_save_local == 0) { + load_system_cfg(); + } + } + + yon_ubl_setup_sockets(widgets->PlugBox,widgets->LeftBox,widgets->RightBox,main_config.socket_id,main_config.load_socket_id,main_config.save_socket_id); + GtkCssProvider *css=gtk_css_provider_new(); + gtk_css_provider_load_from_resource(css,CssPath); + gtk_style_context_add_provider_for_screen(gdk_screen_get_default(), + GTK_STYLE_PROVIDER(css), + -1); + tree_view_select_user(NULL); + tree_view_select_group(NULL); + tree_view_select_project(NULL); + tree_view_select_device(NULL); + gtk_main(); +} \ No newline at end of file diff --git a/source/controler.h b/source/controler.h new file mode 100644 index 0000000..04ed1ed --- /dev/null +++ b/source/controler.h @@ -0,0 +1,38 @@ +#include "ubl-settings-diskquota.h" +#include "ubl-strings.h" +#include "view_set_disk.h" +char *local; + +int main(int argc, char *argv[]); +void load_global_cfg(); +void load_system_cfg(); +void control_event(main_window* _config_main_gui, custom_window* _config_custom_gui); +void wrapper_all_save(); +void wrapper_global_save(); +void wrapper_system_save(); +int fill_tree_view_project(config_all* all_config, hotebook* widget, char* str_fill , int flag_gui_add); +void entry_user_disk(GtkWidget *self,int* flag_update); +void entry_groups_disk(GtkWidget *self,int* flag_update); +void entry_project_disk(GtkWidget *self,int* flag_update); +void wrapper_add_user_show(); +void wrapper_edit_user_show(); +void wrapper_add_group_show(); +void wrapper_edit_group_show(); +void wrapper_add_project_show(); +void wrapper_edit_project_show(); +void wrapper_filters_user_show(); +void wrapper_filters_group_show(); +void wrapper_filters_project_show(); +void wrapper_get_spin_time_gui_user(); +void wrapper_get_spin_time_gui_group(); +void wrapper_get_spin_time_gui_project(); +void tree_view_select_user(GtkWidget* self); +void tree_view_select_group(GtkWidget* self); +void tree_view_select_project(GtkWidget* self); +void tree_view_select_device(GtkWidget* self); +void get_spin_time_gui(vector* vec_u_g_p, hotebook* widgets); +void tree_view_select(GtkWidget* self, vector* vec_temp, hotebook* widgets); +void block_spin_time(hotebook* widgets,void (*f)()); +void unlock_spin_time(hotebook* widgets,void (*f)()); +void template_set_status_disk(GtkWidget* self, hotebook* widgets); +void get_status_disk(hotebook* widgets); diff --git a/source/controller.cc b/source/controller.cc deleted file mode 100644 index 81040e4..0000000 --- a/source/controller.cc +++ /dev/null @@ -1,68 +0,0 @@ -#include "controller.h" - -int socket_ext_id_I = 0; -int socket_trd_id_I = 0; - -Controller::Controller(BaseObjectType* obj, Glib::RefPtr const& builder) - :Gtk::ApplicationWindow(obj), builder{builder} { - this->builder = builder; - this->settings(); -} - -Controller::Controller(Glib::RefPtr const& builder) { - this->builder = builder; - this->settings(); -} - -Controller::~Controller() -{ -} - -void Controller::settings() { - obj_open_browser->set_obj_about(obj_view_about); - obj_main_window = new MainWindow(builder, obj_open_browser, &socket_ext_id_I, &socket_trd_id_I); - obj_main_window->set_obj_wrapper_load_save(obj_wrapper_load_save); - obj_open_browser->settings(); - obj_main_window->set_map_gui(&map_gui_cfg); - obj_main_window->set_map_global(&map_global_cfg); - obj_main_window->set_map_local(&map_system_cfg); - obj_main_window->set_obj_view_filters(&obj_view_filters); - obj_main_window->set_obj_view_edit(&obj_view_edit); - obj_main_window->set_obj_view_add(&obj_view_add); - obj_main_window->set_obj_view_add_project(&obj_view_add_project); - obj_main_window->set_obj_view_edit_project(&obj_view_edit_project); - obj_main_window->settings(); -} - -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} { - Controller* wnd = nullptr; - builder->get_widget_derived("window", wnd); - builder->get_widget("plugBox", plugBox); - plugBox->get_parent()->remove(*plugBox); - add(*plugBox); - show_all_children(); -} \ No newline at end of file diff --git a/source/controller.h b/source/controller.h deleted file mode 100644 index b452ee4..0000000 --- a/source/controller.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef CONTROLLER_H -#define CONTROLLER_H -#include "my_type.h" -#include "view/view_open_browser.h" -#include "view/view_about.h" -#include "view/ubl-settings-diskquota.h" -#include "view/model/wrapper_load_save.h" -#include "view/view_filters.h" -#include "view/view_add_user_group.h" -#include "view/view_edit_user_group.h" -#include "view/view_edit_project.h" -#include "view/view_add_project.h" - -extern int socket_ext_id_I; -extern int socket_trd_id_I; - -class Controller : public Gtk::ApplicationWindow -{ -private: - Glib::RefPtr builder; - map_str_str map_gui_cfg; - map_str_str map_global_cfg; - map_str_str map_system_cfg; -public: - ~Controller(); - void settings(); - View_open_browser* obj_open_browser = new View_open_browser(); - View_about* obj_view_about = new View_about(); - MainWindow* obj_main_window; - Wrapper_load_save *obj_wrapper_load_save = new Wrapper_load_save(); - View_filters obj_view_filters = View_filters(); - View_add_user_group obj_view_add = View_add_user_group(); - View_edit_user_group obj_view_edit = View_edit_user_group(); - View_edit_project obj_view_edit_project = View_edit_project(); - View_add_project obj_view_add_project = View_add_project(); - Controller(BaseObjectType* obj, Glib::RefPtr const& builder); - Controller(Glib::RefPtr const& builder); - - -}; - -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; -}; -#endif \ No newline at end of file diff --git a/source/main.cc b/source/main.cc deleted file mode 100644 index 7c2362a..0000000 --- a/source/main.cc +++ /dev/null @@ -1,99 +0,0 @@ -#include "controller.h" -#include "var.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); - Controller* wnd = nullptr; - builder->get_widget_derived("window", 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; iv_user); + load_free_vector(_all_config, &_all_config->v_group); + load_free_vector(_all_config, &_all_config->v_project); + free_remove_vector(_all_config, &_all_config->v_remove); + model_free_vector_string(&_all_config->v_disk_remove); + device_disk_parsed(); + vector_init(&_all_config->v_user); + vector_init(&_all_config->v_group); + vector_init(&_all_config->v_project); + vector_init(&_all_config->v_disk_status); + vector_init(&_all_config->v_remove); + vector_init(&_all_config->v_disk_remove); + if (size == 1 && strcmp(cfg[0], "(null)") == 0) { + for (int index_1 = 0; index_1 < get_device_vec()->vectorList.total; index_1++) { + char* device = NULL; + device_config* _config_disk = (device_config*)get_device_vec()->pfVectorGet(get_device_vec(), index_1); + if (yon_window_config_get_parameter(_config_disk->name_disk, _config_disk->name_disk, &device, YON_TYPE_STRING)) { + if (strstr(device, _config_disk->name_disk)) { + size_t deferring_size = 0; + size_t deferring_file = 0; + disk_status* disk_cfg = malloc(sizeof(disk_status)); + disk_cfg->status = 1; + _all_config->v_disk_status.pfVectorAdd(&_all_config->v_disk_status, disk_cfg); + disk_cfg->device = yon_char_new(device); + disk_cfg->fs = yon_char_new(_config_disk->file_system); + disk_cfg->mount_point = yon_char_new(_config_disk->mounted); + disk_cfg->name = yon_char_new(_config_disk->type_dick); + if (yon_window_config_get_parameter("deferring_size", _config_disk->name_disk, &deferring_size, YON_TYPE_INT)) { + disk_cfg->deferring_size = deferring_size; + } + else { + disk_cfg->deferring_size = 0; + } + if (yon_window_config_get_parameter("deferring_file", _config_disk->name_disk, &deferring_file, YON_TYPE_INT)) { + disk_cfg->deferring_file = deferring_file; + } + else { + disk_cfg->deferring_file = 0; + } + } + } + } + } + for (int index = 0; index < size; index++) { + char* str_key_value = yon_char_new(cfg[index]); + char* str_key = yon_char_divide_search(str_key_value, "=",-1); + yon_char_divide_search(str_key, "[",-1); + str_key = yon_char_divide_search(str_key, "]",-1); + char* str_value = str_key_value; + int flag_find = 0; + for (int j=0; j < _all_config->v_disk_status.vectorList.total;j++) { + disk_status* config_disk_status = (disk_status*)_all_config->v_disk_status.pfVectorGet(&_all_config->v_disk_status, j); + if (strstr(str_key, config_disk_status->device)) { + flag_find = 1; + } + } + if (((strstr(str_value, "enable") || strstr(str_value, "disable")) || yon_char_find_count(str_key, ":") == 1) && flag_find == 0) { + disk_status* disk_cfg = malloc(sizeof(disk_status)); + disk_cfg->deferring_size = 0; + disk_cfg->deferring_file = 0; + load_pars_values_status(disk_cfg, str_key, str_value); + _all_config->v_disk_status.pfVectorAdd(&_all_config->v_disk_status, disk_cfg); + for (int index = 0; index < get_device_vec()->vectorList.total; index++) { + device_config* _config_disk = (device_config*)get_device_vec()->pfVectorGet(get_device_vec(), index); + for (int j=0; j < _all_config->v_disk_status.vectorList.total;j++) { + disk_status* config_disk_status = (disk_status*)_all_config->v_disk_status.pfVectorGet(&_all_config->v_disk_status, j); + if (strstr(config_disk_status->device, _config_disk->name_disk)) { + config_disk_status->device = yon_char_new(_config_disk->name_disk); + config_disk_status->fs = yon_char_new(_config_disk->file_system); + config_disk_status->mount_point = yon_char_new(_config_disk->mounted); + config_disk_status->name = yon_char_new(_config_disk->type_dick); + if (yon_char_find_count(str_key, ":") == 1 && (!strstr(str_value, "enable") && !strstr(str_value, "disable"))) { + int size_value = 0; + char** arr_values = philos_str_split(str_value, &size_value, ":"); + config_disk_status->deferring_size = atoll(arr_values[4]); + config_disk_status->deferring_file = atoll(arr_values[5]); + config_disk_status->status = 2; + philos_free_string_array(&arr_values, size_value); + } + else { + + } + + } + } + } + } + else if ((strstr(str_value, "enable") || strstr(str_value, "disable")) && flag_find) { + + } + else { + if (yon_char_find_count(str_key, ":") == 1) { + + } + else { + config_u_g_p* _config = malloc(sizeof(config_u_g_p)); + model_null_str_writing(_config); + _config->loaded_keys = yon_char_new(str_key); + load_pars_keys(_config, yon_char_new(str_key), index); + load_pars_values(_config, _all_config,str_key, yon_char_new(str_value), index); + + if (strstr(str_key, "prjquota")) { + _all_config->v_project.pfVectorAdd(&_all_config->v_project,_config); + } + else if (strstr(str_key, "usrquota")) { + _all_config->v_user.pfVectorAdd(&_all_config->v_user,_config); + } + else if (strstr(str_key, "grpquota")){ + _all_config->v_group.pfVectorAdd(&_all_config->v_group,_config); + } + } + + } + + } + _all_config->flag_set_data = 0; + _all_config->flag_not_data = 1; + _all_config->flag_save = 0; + +} + +void load_pars_keys(config_u_g_p* _config, char* str_key, int index) { + load_pars_keys_u_g(_config, yon_char_new(str_key), index); + load_pars_keys_p(_config, yon_char_new(str_key), index); +} + +void load_pars_keys_u_g(config_u_g_p* _config, char* str_key, int index) { + if (strstr(str_key, "prjquota")) { + return; + } + if (yon_char_find_count(str_key, ":") == 1) { + return; + } + if (yon_char_find_count(str_key, ":") || yon_char_find_count(str_key, ",")) { + int size_point = 0; + char** arr_keys = philos_str_split(yon_char_new(str_key), &size_point, ":"); + _config->type_arr = yon_char_new(arr_keys[0]); + int size_users = 0; + if (yon_char_find_count(str_key, ":") == 1) { + int size_comma = 0; + char** arr_user = philos_str_split(arr_keys[size_point-1], &size_comma, ","); + _config->UNIX_file = yon_char_new(arr_keys[1]); + } + else if (yon_char_find_count(str_key, ":") == 2) { + if (yon_char_find_count(str_key, ",")) { + int size_comma = 0; + char** arr_user = philos_str_split(arr_keys[size_point-1], &size_comma, ","); + _config->UNIX_file = yon_char_new(arr_keys[1]); + for (int i = 0; i < size_comma; i++) { + _config->actors.pfVectorAdd(&_config->actors,yon_char_new(arr_user[i])); + } + } + else { + _config->UNIX_file = yon_char_new(arr_keys[1]); + if (size_point == 3) { + _config->actors.pfVectorAdd(&_config->actors,yon_char_new(arr_keys[2])); + } + + } + } + } + else { + + } +} + +void load_pars_keys_p(config_u_g_p* _config, char* str_key, int index) { + if (yon_char_find_count(str_key, ":") == 1) { + return; + } + if (strstr(str_key, "prjquota")) { + if (yon_char_find_count(str_key, ":") || yon_char_find_count(str_key, ",")) { + int size_point = 0; + char** arr_keys = philos_str_split(yon_char_new(str_key), &size_point, ":"); + _config->type_arr = yon_char_new(arr_keys[0]); + int size_users = 0; + if (yon_char_find_count(str_key, ":") == 2) { + _config->UNIX_file = yon_char_new(arr_keys[1]); + int size_comma = 0; + if (yon_char_find_count(str_key, ",")) { + char** arr_user = philos_str_split(arr_keys[size_point-1], &size_comma, ","); + if (strstr(str_key, "AUTO")) { + _config->id = -1; + } + else { + _config->id = atoi(arr_user[0]); + } + _config->actors.pfVectorAdd(&_config->actors,yon_char_new(arr_user[size_comma-1])); + } + else { + if (strstr(str_key, "AUTO")) { + _config->id = -1; + } + else { + _config->id = atoi(arr_keys[size_point-1]); + } + } + } + } + } + else { + } +} + +void load_pars_values_status(disk_status* _config, char* key, char* value) { + _config->device = yon_char_new(key); + if (strstr(value,"enable")) { + _config->status = 2; + return; + } + else if (strstr(value,"disable")) { + _config->status = 1; + return; + } +} + +void load_pars_values(config_u_g_p* _config, config_all* _all_config, char* str_key, char* str_value, int index) { + int size_array_size_pow = 0; + char** array_size_pow = NULL; + array_size_pow = yon_char_parsed_append(array_size_pow,&size_array_size_pow, STR_KB); + array_size_pow = yon_char_parsed_append(array_size_pow,&size_array_size_pow, STR_MB); + array_size_pow = yon_char_parsed_append(array_size_pow,&size_array_size_pow, STR_GB); + array_size_pow = yon_char_parsed_append(array_size_pow,&size_array_size_pow, STR_TB); + int size = 0; + char* new_value = yon_char_new(str_value); + char** arr_values = philos_str_split(new_value, &size, ":"); + int index_split = yon_char_find_count(str_value, ":"); + if (index_split == 3 || index_split == 5) { + philos_set_pow_size_memory(yon_char_new(arr_values[0]), &_config->soft_restriction_size_pow, array_size_pow); + philos_set_size_memory_integer(yon_char_new(arr_values[0]), &_config->soft_restriction_size); + philos_set_pow_size_memory(yon_char_new(arr_values[1]), &_config->severe_limitation_size_pow, array_size_pow); + philos_set_size_memory_integer(yon_char_new(arr_values[1]), &_config->severe_limitation_size); + philos_set_size_memory_integer(yon_char_new(arr_values[2]), &_config->soft_restriction_file); + philos_set_size_memory_integer(yon_char_new(arr_values[3]), &_config->severe_limitation_file); + if (index_split == 5) { + _config->deferring_size = atoll(arr_values[4]); + _config->deferring_file = atoll(arr_values[5]); + } + else { + philos_set_size_memory_integer("-", &_config->deferring_size); + philos_set_size_memory_integer("-", &_config->deferring_file); + } + for (int j=0; j < _all_config->v_disk_status.vectorList.total;j++) { + disk_status* config_disk_status = (disk_status*)_all_config->v_disk_status.pfVectorGet(&_all_config->v_disk_status, j); + if (strstr(str_key, config_disk_status->device)){ + config_disk_status->deferring_file = _config->deferring_file; + config_disk_status->deferring_size = _config->deferring_size; + } + } + + } + else { + + } +} + +void load_free_vector(config_all* _all_config, vector* vec_config) { + + if (_all_config->flag_not_data == 1) { + for (int i = 0; i < vec_config->pfVectorTotal(vec_config); i++) { + config_u_g_p* _config = (config_u_g_p*)vec_config->pfVectorGet(vec_config, i); + model_clear_cfg(_config); + } + vec_config->pfVectorFree(vec_config); + } + +} + +void free_remove_vector(config_all* _all_config, vector* vec_remove) { + if (_all_config->flag_not_data == 1) { + if (vec_remove->vectorList.total > 0) { + for (int i = 0; i < vec_remove->vectorList.total; i++) { + char* str_remove = (char*)vec_remove->pfVectorGet(vec_remove, i); + free(str_remove); + } + vec_remove->pfVectorFree(vec_remove); + } + } +} + + + diff --git a/source/model/load.h b/source/model/load.h new file mode 100644 index 0000000..4ae62df --- /dev/null +++ b/source/model/load.h @@ -0,0 +1,16 @@ +#ifndef LOAD_H +#define LOAD_H +#include "ubl-utils.h" +#include "philos_utils.h" +#include "my_device.h" + +void load_template_load_cfg(config_all* _all_config, char* cmd); +void load_pars_keys(config_u_g_p* _config, char* str_key, int index); +void load_pars_keys_u_g(config_u_g_p* _config, char* str_key, int index); +void load_pars_keys_p(config_u_g_p* _config, char* str_key, int index); +void load_pars_values(config_u_g_p* _config, config_all* _all_config, char* str_key, char* str_value, int index); +void load_free_vector(config_all* _all_config,vector* vec_config); +void load_pars_values_status(disk_status* _config, char* key, char* value); +void free_remove_vector(config_all* _all_config, vector* vec_remove); + +#endif \ No newline at end of file diff --git a/source/model/model.c b/source/model/model.c new file mode 100644 index 0000000..8684eb8 --- /dev/null +++ b/source/model/model.c @@ -0,0 +1,425 @@ +#include "model.h" + +size_t check_null(size_t num) { + if (num == 0) { + return -1; + } + return num; +} + +char* check_null_to_str(size_t num) { + if (num == 0) { + return yon_char_new("-"); + } + return philos_char_from_size_t(num); +} + +void model_clear_cfg(config_u_g_p* _config) { + free(_config->quota); + free(_config->size_memory); + free(_config->device); + free(_config->UNIX_file); + free(_config->files); + model_free_vector_string(&_config->actors); + vectorFree(&_config->actors); + free(_config->loaded_keys); +} + +void model_clear_cfg_device(disk_status* _config) { + free(_config->device); + free(_config->fs); + free(_config->mount_point); + free(_config->name); +} + +void model_free_vector_string(vector* vec_str) { + if (vec_str) { + if (vec_str->vectorList.total> 0) { + for (int i = 0; i < vec_str->vectorList.total; i++) { + vectorDelete(vec_str, i); + } + } + } +} +void model_free_vector_disk_status(vector* vec_disk_status) { + if (vec_disk_status) { + if (vec_disk_status->vectorList.total> 0) { + for (int i = 0; i < vec_disk_status->vectorList.total; i++) { + disk_status* _config = (disk_status*)vec_disk_status->pfVectorGet(vec_disk_status, i); + // model_clear_cfg_device(_config); + vectorDelete(vec_disk_status, i); + } + } + } +} + +void model_tree_view_add(config_u_g_p* _config) { + model_null_str_writing(_config); +} + +void model_null_str_writing(config_u_g_p* _config) { + _config->type_arr = yon_char_new(empty_str); + _config->quota = yon_char_new(empty_str); + _config->size_memory = yon_char_new(empty_str); + _config->device = yon_char_new(empty_str); + _config->UNIX_file = yon_char_new(empty_str); + _config->files = yon_char_new(empty_str); + _config->loaded_keys = yon_char_new(empty_str); + _config->type_arr = yon_char_new(empty_str); + _config->id = 0; + _config->soft_restriction_size = 0; + _config->soft_restriction_file = 0; + _config->severe_limitation_size = 0; + _config->severe_limitation_file = 0; + _config->deferring_size = 0; + _config->deferring_file = 0; + _config->size_memory_pow = 0; + _config->soft_restriction_size_pow = 0; + _config->severe_limitation_size_pow = 0; + vector_init(&_config->actors); +} + +char* format_actors(vector* vec_actors) { + char* str_all = yon_char_new(""); + char split_simvol[2] = {0}; + split_simvol[0] = 0; + split_simvol[1] = 0; + char* str_actors = NULL; + if (vec_actors->vectorList.total> 0) { + for (int i = 0; i < vec_actors->vectorList.total; i++) { + str_actors = (char*)vec_actors->pfVectorGet(vec_actors, i); + if (str_actors) { + str_all = yon_char_unite(str_all,split_simvol, str_actors, NULL); + split_simvol[0] = ','; + split_simvol[1] = '\0'; + } + } + } + + if (strlen(str_all) < 3) { + return yon_char_new("-"); + } + return str_all; +} + +int fill_tree_view_project(config_all* all_config,hotebook* widget , char* str_fill, int flag_gui_add) { + GtkTreeModel *model = GTK_TREE_MODEL(widget->liststore); + if (flag_gui_add == 0) { + g_object_ref(widget->liststore); + gtk_list_store_clear(widget->liststore); + } + int flag_searhc = 0; + for (int i = 0; i < all_config->v_project.pfVectorTotal(&all_config->v_project); i++) { + config_u_g_p* _config = (config_u_g_p*)all_config->v_project.pfVectorGet(&all_config->v_project, i); + if (strcmp(_config->type_arr, str_fill) == 0) { + GtkTreeIter iter; + flag_searhc++; + gtk_list_store_append(widget->liststore,&iter); + char* deferring_size = wrapper_str_time(_config->deferring_size); + char* deferring_file = wrapper_str_time(_config->deferring_file); + gtk_list_store_set(widget->liststore,&iter, + 0,model_find_path_to_disk(&all_config->v_disk_status, _config->UNIX_file), + 1,_config->UNIX_file, + 2,fill_tree_view_id(_config->id), + 3,format_actors(&_config->actors), + 4,philos_format_cfg_str_size_memory("", check_null(_config->soft_restriction_size),_config->soft_restriction_size_pow), + 5,philos_format_cfg_str_size_memory("", check_null(_config->severe_limitation_size),_config->severe_limitation_size_pow), + 6,deferring_size, + 7,check_null_to_str(_config->soft_restriction_file), + 8,check_null_to_str(_config->severe_limitation_file), + 9,deferring_file, + -1); + + } + } + if (flag_gui_add != 0) { + gtk_tree_view_set_model(GTK_TREE_VIEW(widget->tree_view), model); + } + return flag_searhc; +} + +int fill_tree_view_user_group(config_all* all_config, hotebook* widget, char* str_fill ,int flag_gui_add) { + GtkTreeModel *model = GTK_TREE_MODEL(widget->liststore); + if (flag_gui_add == 0) { + g_object_ref(widget->liststore); + gtk_list_store_clear(widget->liststore); + } + int flag_searhc = 0; + vector* vec_temp = NULL; + if (strcmp(str_fill, "usrquota")==0) { + vec_temp = &all_config->v_user; + } + else { + vec_temp = &all_config->v_group; + } + if (vec_temp->vectorList.total > 0) { + for (int i = 0; i < vec_temp->vectorList.total; i++) { + config_u_g_p* _config = (config_u_g_p*)vec_temp->pfVectorGet(vec_temp, i); + if (strcmp(_config->type_arr, str_fill) == 0) { + GtkTreeIter iter; + flag_searhc++; + gtk_list_store_append(widget->liststore,&iter); + char* deferring_size = wrapper_str_time(_config->deferring_size); + char* deferring_file = wrapper_str_time(_config->deferring_file); + gtk_list_store_set(widget->liststore,&iter, + 0,format_actors(&_config->actors), + 1,_config->UNIX_file, + 2,philos_format_cfg_str_size_memory("", check_null(_config->soft_restriction_size),_config->soft_restriction_size_pow), + 3,philos_format_cfg_str_size_memory("", check_null(_config->severe_limitation_size),_config->severe_limitation_size_pow), + 4,deferring_size, + 5,check_null_to_str(_config->soft_restriction_file), + 6,check_null_to_str(_config->severe_limitation_file), + 7,deferring_file, + -1); + } + } + } + if (flag_gui_add != 0) { + gtk_tree_view_set_model(GTK_TREE_VIEW(widget->tree_view), model); + } + return flag_searhc; +} + +char* wrapper_str_time(size_t seconds) { + me_time t; + if (seconds>0) { + t = time_convert(seconds); + t.str_time = yon_char_unite(yon_char_from_int(t.weeks),WEEKS, + yon_char_from_int(t.days), DAYS, + yon_char_from_int(t.hours), HOURS, + yon_char_from_int(t.minutes), MINUTES, NULL); + } + else { + t.str_time = yon_char_new("-"); + } + + return t.str_time; +} + +char* quota_type(char* str_quota) { + if (strcmp(str_quota, "usrquota")==0) { + return STR_USER; + } + else if (strcmp(str_quota, "grpquota")==0) { + return STR_GROUP; + } + else if (strcmp(str_quota, "prjquota")==0) { + return STR_PROJECT; + } +} +char quota_fill_generate(char* str_quota, config_u_g_p* _config, GtkListStore* list_store, GtkTreeIter* iter) { + int index = -1; + if (strcmp(str_quota, "usrquota")==0) { + index = 4; + } + else if (strcmp(str_quota, "grpquota")==0) { + index = 5; + } + else if (strcmp(str_quota, "prjquota")==0) { + index = 6; + } + if (index != -1) { + gtk_list_store_set(list_store,iter,index,format_actors(&_config->actors), -1); + } + +} + +int pars_status_generate(vector* vec_status, config_u_g_p* _config_u_g_p) { + int flag = 0; + if (vec_status->vectorList.total > 0) { + for (int i = 0; i < vec_status->vectorList.total; i++) { + disk_status* _config = (disk_status*)vec_status->pfVectorGet(vec_status, i); + if (strstr(_config_u_g_p->type_arr,"prjquota")) { + if (strstr(_config_u_g_p->UNIX_file, _config->mount_point)) { + if (_config->status == 0 || _config->status == 1) { + flag = 0; + } + else { + flag = 1; + } + } + } + else { + if (strstr(_config_u_g_p->UNIX_file, _config->device)) { + if (_config->status == 0 || _config->status == 1) { + flag = 0; + } + else { + flag = 1; + } + } + } + + } + } + return flag; +} + +int fill_tree_view_generate(vector* vec_fill, vector* vec_status_disk, char* str_fill, GtkWidget* tree_view, GtkListStore* liststoreGeneral) { + GtkTreeModel *model = GTK_TREE_MODEL(liststoreGeneral); + if (vec_fill->vectorList.total > 0) { + for (int i = 0; i < vec_fill->vectorList.total; i++) { + config_u_g_p* _config = (config_u_g_p*)vec_fill->pfVectorGet(vec_fill, i); + GtkTreeIter iter; + gtk_list_store_append(liststoreGeneral,&iter); + char* deferring_size = wrapper_str_time(_config->deferring_size); + char* deferring_file = wrapper_str_time(_config->deferring_file); + quota_fill_generate(str_fill, _config,liststoreGeneral,&iter); + gtk_list_store_set(liststoreGeneral,&iter, + 0,pars_status_generate(vec_status_disk,_config), + 1,_config->quota, + 2,quota_type(str_fill), + 3,_config->UNIX_file, + 7,philos_format_cfg_str_size_memory("", check_null(_config->soft_restriction_size),_config->soft_restriction_size_pow), + 8,philos_format_cfg_str_size_memory("", check_null(_config->severe_limitation_size),_config->severe_limitation_size_pow), + 9,deferring_size, + 10,check_null_to_str(_config->soft_restriction_file), + 11,check_null_to_str(_config->severe_limitation_file), + 12,deferring_file, + -1); + } + } + gtk_tree_view_set_model(GTK_TREE_VIEW(tree_view), model); + return 1; +} + +int pars_status_device(disk_status* _config) { + if (_config->status == 2) { + return 1; + } + return 0; +} + +int fill_tree_view_device(vector* vec_device, hotebook* widget, int flag_gui_add) { + GtkTreeModel *model = GTK_TREE_MODEL(widget->liststore); + if (flag_gui_add == 0) { + g_object_ref(widget->liststore); + gtk_list_store_clear(widget->liststore); + } + int flag_searhc = 0; + if (vec_device->vectorList.total > 0) { + for (int i = 0; i < vec_device->vectorList.total; i++) { + disk_status* _config = (disk_status*)vec_device->pfVectorGet(vec_device, i); + GtkTreeIter iter; + flag_searhc++; + gtk_list_store_append(widget->liststore,&iter); + char* deferring_size = wrapper_str_time(_config->deferring_size); + char* deferring_file = wrapper_str_time(_config->deferring_file); + gtk_list_store_set(widget->liststore,&iter, + 0,pars_status_device(_config), + 1,_config->device, + 2,_config->mount_point, + 3,_config->fs, + 4,_config->name, + 5,deferring_size, + 6,deferring_file, + -1); + } + } + if (flag_gui_add != 0) { + gtk_tree_view_set_model(GTK_TREE_VIEW(widget->tree_view), model); + } + return flag_searhc; +} +void del_disk_to_vector_device(vector* vec_temp, char* str_disk) { + for (int i = 0; i < vec_temp->vectorList.total; i++) { + config_u_g_p* _config = (config_u_g_p*)vec_temp->pfVectorGet(vec_temp, i); + if (strstr(_config->UNIX_file, str_disk)) { + vec_temp->pfVectorDelete(vec_temp, i); + } + } +} + +char* format_str_del_config(config_u_g_p* _config) { + char* space = g_malloc0(sizeof(char)*2); + char* actors = yon_char_new(""); + char* cmd = NULL; + char* unix_file = NULL; + if (strstr(_config->UNIX_file, " ") && !strstr(_config->UNIX_file, "\"")) { + unix_file = yon_char_unite("\"", _config->UNIX_file, "\"", NULL); + } + else { + unix_file = yon_char_new(_config->UNIX_file); + } + for (int i = 0; i < _config->actors.vectorList.total; i++) { + actors = yon_char_unite(actors, space, _config->actors.pfVectorGet(&_config->actors, i), NULL); + space[0] = ','; + space[1] = '\0'; + } + if (strstr(_config->type_arr, "prjquota")) { + if (_config->actors.vectorList.total == 0) { + cmd = yon_char_unite(_config->type_arr, ":", unix_file, ":",fill_tree_view_id(_config->id), NULL); + } + else { + cmd = yon_char_unite(_config->type_arr, ":", unix_file, ":",fill_tree_view_id(_config->id), ",", actors, NULL); + } + + } + else { + cmd = yon_char_unite(_config->type_arr, ":", unix_file, ":", actors, NULL); + } + free(space); + free(unix_file); + return cmd; +} + +void model_template_remove(vector* vec_temp, vector* vec_remove, int index) { + if (index!=-1) { + config_u_g_p* _config = (config_u_g_p*)vec_temp->pfVectorGet(vec_temp, index); + vec_remove->pfVectorAdd(vec_remove, format_str_del_config(_config)); + model_clear_cfg(_config); + vec_temp->pfVectorDelete(vec_temp, index); + } +} + +void model_search_disk_remove(vector* vec_temp, vector* vec_remove, char* str_disk) { + for (int i = 0; i < vec_temp->vectorList.total; i++) { + config_u_g_p* _config = (config_u_g_p*)vec_temp->pfVectorGet(vec_temp, i); + if (strstr(_config->UNIX_file, str_disk)) { + model_template_remove(vec_temp,vec_remove, i); + } + } +} + +char* model_find_path_to_disk(vector* vec_temp, char* str_path) { + for (int i = 0; i < vec_temp->vectorList.total; i++) { + disk_status* _config = (disk_status*)vec_temp->pfVectorGet(vec_temp, i); + if (strstr(str_path, _config->mount_point)) { + return _config->device; + } + } + return "-"; +} + +void model_search_disk_remove_project(vector* vec_temp,vector* vec_status, vector* vec_remove, char* str_disk) { + for (int i = 0; i < vec_temp->vectorList.total; i++) { + config_u_g_p* _config_project = (config_u_g_p*)vec_temp->pfVectorGet(vec_temp, i); + for (int j = 0; j < vec_status->vectorList.total; j++) { + disk_status* _config = (disk_status*)vec_status->pfVectorGet(vec_status, j); + if (strstr(_config_project->UNIX_file, _config->mount_point)) { + model_template_remove(vec_temp,vec_remove, i); + } + } + } +} + +void model_format_del_str(config_u_g_p* _config) { + char* loaded_keys = yon_char_new(""); + if (strstr(_config->type_arr,"prjquota")) { + if (strcmp(format_actors(&_config->actors), "-") == 0) { + loaded_keys = yon_char_unite(_config->type_arr,":" , _config->UNIX_file,":", fill_tree_view_id(_config->id), ",", format_actors(&_config->actors), NULL); + } + else { + loaded_keys = yon_char_unite(_config->type_arr,":" , _config->UNIX_file,":", fill_tree_view_id(_config->id), NULL); + } + } + else { + if (strcmp(format_actors(&_config->actors), "-") == 0) { + loaded_keys = yon_char_unite(_config->type_arr,":" , _config->UNIX_file, NULL); + } + else { + loaded_keys = yon_char_unite(_config->type_arr,":" , _config->UNIX_file,":", format_actors(&_config->actors), NULL); + } + } + _config->loaded_keys = loaded_keys; +} \ No newline at end of file diff --git a/source/model/model.h b/source/model/model.h new file mode 100644 index 0000000..c85646b --- /dev/null +++ b/source/model/model.h @@ -0,0 +1,84 @@ +#ifndef MODEL_H +#define MODEL_H +#include "ubl-utils.h" +#include "philos_utils.h" +#include "vector.h" +#include "../ubl-strings.h" +typedef struct{ + char* type_arr; + int id; + char* quota; + char* size_memory; + char* UNIX_file; + char* files; + vector actors; + size_t actors_size; + char* loaded_keys; + size_t soft_restriction_size; + size_t soft_restriction_file; + size_t severe_limitation_size; + size_t severe_limitation_file; + size_t deferring_size; + size_t deferring_file; + + int size_memory_pow; + int soft_restriction_size_pow; + int severe_limitation_size_pow; + char* device; + size_t size; + +} config_u_g_p; + +typedef struct { + vector v_general; + vector v_user; + vector v_group; + vector v_project; + vector v_disk_status; + vector v_disk_remove; + vector v_remove; + int flag_set_data; + int flag_save; + int flag_load; + int count_remove; + int flag_not_data; +} config_all; + +typedef struct{ + char* device; + int status; + size_t deferring_size; + size_t deferring_file; + char* fs; + char* mount_point; + char* name; + +} disk_status; + +typedef struct{ + int flag_status; + int size; +} config_general; + +typedef struct{ + int flag_load; +} config_gui; + +void model_clear_cfg_device(disk_status* _config); +char* wrapper_str_time(size_t seconds); +void model_template_remove(vector* vec_temp, vector* vec_remove, int index); +void model_search_disk_remove(vector* vec_temp, vector* vec_remove, char* str_disk); +void model_null_str_writing(config_u_g_p* _config); +void model_clear_cfg(config_u_g_p* _config); +void model_array_size_memory(); +char* format_actors(vector* vec_actors); +char* model_find_path_to_disk(vector* vec_temp, char* str_path); +void model_search_disk_remove_project(vector* vec_temp,vector* vec_status, vector* vec_remove, char* str_disk); +void model_free_vector_string(vector* vec_str); +void model_format_del_str(config_u_g_p* _config); +void del_disk_to_vector_device(vector* vec_temp, char* str_disk); +int fill_tree_view_user_group(config_all* all_config, hotebook* widget,char* str_fill , int flag_gui_add); +int fill_tree_view_project(config_all* all_config, hotebook* widget, char* str_fill , int flag_gui_add); +int fill_tree_view_generate(vector* vec_fill, vector* vec_status_disk, char* str_fill, GtkWidget* tree_view, GtkListStore* liststoreGeneral); +int fill_tree_view_device(vector* vec_device, hotebook* widget, int flag_gui_add); +#endif \ No newline at end of file diff --git a/source/model/my_device.c b/source/model/my_device.c new file mode 100644 index 0000000..038dc79 --- /dev/null +++ b/source/model/my_device.c @@ -0,0 +1,99 @@ +#include "my_device.h" + +vector vec_disk; + +vector *get_device_vec() +{ + return &vec_disk; +} + +void device_disk_parsed() { + char *cmd = "findmnt -lo source,target,fstype,label,size -t ext4"; + device_device_config_free(get_device_vec()); + vector_init(get_device_vec()); + int size = 0; + char **responce = yon_config_load(cmd, &size); + char *split_simvol = " "; + for (int index = 1; index < size; index++) + { + char *disk = yon_char_divide_search(responce[index], "\n", -1); + if (yon_char_find_count(disk, " ") != 0 && !strstr(disk, "zram") && !strstr(disk, "[")) + { + int size_str = 0; + char** name_disk = yon_char_parse(disk, &size_str, " "); + int flag = 0; + device_config* obj_device_config = malloc(sizeof(device_config)); + for (int index_1 = 0; index_1 < size_str; index_1++) { + if (strlen(name_disk[index_1])) { + if (flag == 0) { + obj_device_config->name_disk = yon_char_new(name_disk[index_1]); + } + else if (flag == 1) { + obj_device_config->mounted = yon_char_new(name_disk[index_1]); + } + else if (flag == 2) { + obj_device_config->file_system = yon_char_new(name_disk[index_1]); + } + else if (flag == 3) { + obj_device_config->type_dick = yon_char_new(name_disk[index_1]); + } + else if (flag == 4) { + obj_device_config->size_disk = philos_convert_memory(yon_char_new(name_disk[index_1])); + } + flag+=1; + } + } + obj_device_config->description_disk = yon_char_unite(obj_device_config->name_disk,split_simvol, + obj_device_config->file_system, + split_simvol, + obj_device_config->mounted, + split_simvol, + obj_device_config->type_dick, NULL); + get_device_vec()->pfVectorAdd(get_device_vec(), obj_device_config); + philos_free_string_array(&name_disk, size_str); + } + free(disk); + } + philos_free_string_array(&responce, size); +} + + +void device_fill_disk(GtkWidget *combo_box_text, vector* vec_filt) +{ + vector vec; + vector_init(&vec); + vec.pfVectorCopy(&vec, get_device_vec()); + for (int i = 0; i < vec_filt->vectorList.total; i++) { + disk_status* _config_disk_remove = (disk_status*)vec_filt->pfVectorGet(vec_filt, i); + for (int index = 0; index < vec.vectorList.total; index++) { + device_config* _config_disk = (device_config*)vec.pfVectorGet(&vec, index); + if (strcmp(_config_disk->name_disk, _config_disk_remove->device) == 0) { + vec.pfVectorDelete(&vec, index); + } + + } + } + + if (vec.vectorList.total > 0) { + for (int index = 0; index < vec.vectorList.total; index++) + { + device_config* _config_disk_remove = (device_config*)vec.pfVectorGet(&vec, index); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box_text), yon_char_new(_config_disk_remove->description_disk)); + } + } +} + +void device_device_config_free() { + if (get_device_vec()) { + for (int i = 0; i < get_device_vec()->vectorList.total; i++) { + device_config* _config_disk_remove = (device_config*)get_device_vec()->pfVectorGet(get_device_vec(), i); + free(_config_disk_remove->description_disk); + free(_config_disk_remove->type_dick); + free(_config_disk_remove->mounted); + free(_config_disk_remove->file_system); + free(_config_disk_remove->name_disk); + get_device_vec()->pfVectorDelete(get_device_vec(), i); + } + } + +} \ No newline at end of file diff --git a/source/model/my_device.h b/source/model/my_device.h new file mode 100644 index 0000000..fcc5811 --- /dev/null +++ b/source/model/my_device.h @@ -0,0 +1,26 @@ +#ifndef MY_DEVICE_H +#define MY_DEVICE_H +#include "ubl-utils.h" +#include +#include +#include +#include "philos_utils.h" +#include "model.h" +typedef struct { + char* name_disk; + char* file_system; + char* mounted; + char* type_dick; + char* description_disk; + size_t size_disk; +} device_config; + +void device_disk_parsed(); +vector *get_device_vec(); +void device_fill_disk(GtkWidget* combo_box_text, vector* vec_filt); +size_t get_mem_total(); +float get_size_pow_memory(size_t size_memory, int size); +size_t get_resurs_total(char* cmd); +void device_device_config_free(); + +#endif \ No newline at end of file diff --git a/source/model/philos_utils.c b/source/model/philos_utils.c new file mode 100644 index 0000000..743f8c2 --- /dev/null +++ b/source/model/philos_utils.c @@ -0,0 +1,873 @@ +#include "philos_utils.h" + +void philos_array_string_remove_char(char*** array, char* str_remove, int size) { + for (int index = 0; index < size; index++) { + (*array)[index] = yon_char_divide_search((*array)[index], str_remove, -1); + } + +} + +void philos_set_pow_size_memory(char* str_find, int* array_size, char** array_size_pow) { + char* STR_KB = array_size_pow[0]; + char* STR_MB = array_size_pow[1]; + char* STR_GB = array_size_pow[2]; + char* STR_TB = array_size_pow[3]; + size_t length = strlen(str_find); + if (strstr(str_find,"K") != NULL) { + (*array_size) = 0; + str_find = yon_char_divide(str_find, length-1); + str_find = yon_char_unite(str_find, " ", STR_KB, NULL); + } + else if (strstr(str_find,"M") != NULL) { + (*array_size) = 1; + str_find = yon_char_divide(str_find, length-1); + str_find = yon_char_unite(str_find," ", STR_MB, NULL); + } + else if (strstr(str_find,"G") != NULL) { + (*array_size) = 2; + str_find = yon_char_divide(str_find, length-1); + str_find = yon_char_unite(str_find," ", STR_GB, NULL); + } + else if (strstr(str_find,"T") != NULL) { + (*array_size) = 3; + str_find = yon_char_divide(str_find, length-1); + + str_find = yon_char_unite(str_find," ", STR_TB, NULL); + } + else if (strstr(str_find,"%%") != NULL) { + (*array_size) = -1; + str_find = yon_char_divide(str_find, length-1); + } + else if (strstr(str_find,"-") != NULL) { + (*array_size) = -1; + } + else { + (*array_size) = 0; + } + +} + +void philos_set_size_memory_integer_char(char* str_find, char*** array_data, int index) { + char* simv_del_array[10] = {"K","M","G","T","k","m","g","t"," ","%"}; + for (size_t i = 0; i < 10; i++) { + if (strstr(str_find, simv_del_array[i])) { + str_find = yon_char_divide_search(str_find, simv_del_array[i], -1); + } + } + if (strstr(str_find, " ") != NULL) { + char* mem_s = yon_char_new(str_find); + yon_char_divide_search(mem_s, " ", -1); + *array_data = yon_char_parsed_append(*array_data, &index, mem_s); + } + if (strstr(str_find, "-") != NULL) { + *array_data = yon_char_parsed_append(*array_data, &index, "-"); + } + else { + if (str_find[0] == '\"') { + yon_char_divide(str_find, 0); + size_t length = strlen(str_find); + str_find = yon_char_divide(str_find, length-2); + } + if (strstr(str_find, " ") == NULL) { + *array_data = yon_char_parsed_append(*array_data, &index, str_find); + } + + } +} + +void philos_free_string_array(char ***array, int size) { + if ((*array) == NULL) { + return; + } + for (int i = 0; i < size; i++){ + free((*array)[i]); + } + if (size!= 0) { + free(*array); + (*array) = NULL; + } +} + +void philos_free_string_array_n3(char ****array, int size) { + if ((*array) == NULL || size == 0) { + return; + } + int index_to_l2 = 0; + for (int i = 0; i < size; i++){ + index_to_l2 = 0; + if ((*array)[i]!=NULL) { + while ((*array)[i][index_to_l2] != NULL) { + if ((*array)[i][index_to_l2] != NULL) { + free((*array)[i][index_to_l2]); + index_to_l2++; + } + + } + } + free((*array)[i]); + + } + if (size!= 0) { + free(*array); + (*array) = NULL; + } +} + +void philos_free_int_array(int **array, int size) { + if (size!= 0) { + free(*array); + *array = NULL; + } +} +void philos_free_int_array_n2(int ***array, int size) { + if ((*array) == NULL || size == 0) { + return; + } + for (int i = 0; i < size; i++){ + free((*array)[i]); + } + if (size!= 0) { + free(*array); + (*array) = NULL; + } +} + +config_str philos_list_user(int* size, int flag_lim) { + char* str_uid_min = "UID_MIN"; + char* str_uid_max = "UID_MAX"; + unsigned short uid_min = philos_read_uid_min_max(file_source_login_min_max, str_uid_min); + unsigned short uid_max = philos_read_uid_min_max(file_source_login_min_max, str_uid_max); + config_str str_users = malloc(1); + while (1) { + errno = 0; + struct passwd* entry = getpwent(); + if (!entry) { + if (errno) { + return str_users; + } + break; + } + if (flag_lim == 1) { + if ((entry->pw_uid >= uid_min && entry->pw_uid < uid_max) || entry->pw_uid == 0) { + str_users = yon_char_parsed_append(str_users, size, entry->pw_name); + } + } + else { + str_users = yon_char_parsed_append(str_users, size, entry->pw_name); + } + + } + endpwent(); + return str_users; +} + +unsigned short philos_read_uid_min_max(char* filename, char* search) { + int uid = 0; + char* remove_tab = "\t"; + char* remove_space = " "; + char* search_uid_min = "UID_MIN"; + int buff_size = 255; + char* line = g_malloc0(buff_size); + char* search_true = yon_char_get_augumented("SYS_", search); + FILE *fp = fopen(filename, "r"); + if(fp) { + while((fgets(line, buff_size, fp)) != NULL) { + try{ + if (yon_char_find_count(line, search) != 0 && yon_char_find_count(line, search_true) == 0) { + line = philos_str_remove(line, search); + line = philos_str_remove(line, remove_space); + line = philos_str_remove(line, remove_tab); + uid = atoi(line); + + } + } + catch (...) { + if (yon_char_find_count(search, search_uid_min) != 0){ + uid = 1000; + } + else{ + uid = 65534; + } + } + } + } + else{ + if (yon_char_find_count(search, search_uid_min) != 0) { + uid = 1000; + } + else{ + uid = 65534; + } + } + fclose(fp); + free(line); + free(search_true); + return uid; + +} + +config_str philos_list_group(int* size, int flag_lim) { + char* str_uid_min = "UID_MIN"; + char* str_uid_max = "UID_MAX"; + unsigned short uid_min = philos_read_uid_min_max(file_source_login_min_max, str_uid_min); + unsigned short uid_max = philos_read_uid_min_max(file_source_login_min_max, str_uid_max); + config_str str_users = malloc(1); + char *cmd = "cat /etc/group"; + int size_groups = 0; + size_t pw_gid = 0; + char **responce = yon_config_load(cmd, &size_groups); + for (int i = 0; i< size_groups; i++) { + char* str_data = yon_char_new(responce[i]); + char* str_group = yon_char_divide_search(str_data,":x:",-1); + char* num = yon_char_divide_search(str_data, ":", -1); + pw_gid = atoll(yon_char_divide_search(str_data, ":", -1)); + if (flag_lim == 1) { + if ((pw_gid >= uid_min && pw_gid < uid_max) || pw_gid == 0) { + str_users = yon_char_parsed_append(str_users, size, str_group); + } + } + else { + str_users = yon_char_parsed_append(str_users, size, str_group); + } + } + endpwent(); + return str_users; +} + +char* philos_str_size_pow_byte(GtkWidget *combo_box_text) { + int menu_id = gtk_combo_box_get_active(GTK_COMBO_BOX(combo_box_text)); + if (menu_id == 0) { + return "K"; + } + else if (menu_id == 1) { + return "M"; + } + else if (menu_id == 2) { + return "G"; + } + else if (menu_id == 3) { + return "T"; + } + else { + return " "; + } +} + +char* philos_str_remove(char *str, const char *sub) { + size_t len = strlen(sub); + if (len > 0) { + char *p = str; + size_t size = 0; + while ((p = strstr(p, sub)) != NULL) { + size = (size == 0) ? (p - str) + strlen(p + len) + 1 : size - len; + memmove(p, p + len, size - (p - str)); + } + } + return str; +} + + +void philos_split_size_memory(char* str_value, int* size, char* pow_memory) { + (*size) = atoi(yon_char_divide_search(pow_memory, " ", -1)); +} + +char* philos_format_cfg_str_size_memory(char* str_key, int value, int pow_size_memory) { + if (value == -1 || value == -3 || pow_size_memory == -3) { + return yon_char_new("-"); + } + char* str_value = yon_char_from_int(value); + if (value == 0) { + return str_value; + } + if (pow_size_memory==0) { + return yon_char_unite(str_key, str_value, "K" ,NULL); + } + else if (pow_size_memory==1) { + return yon_char_unite(str_key, str_value, "M" ,NULL); + } + else if (pow_size_memory==2){ + return yon_char_unite(str_key, str_value, "G" ,NULL); + } + else if (pow_size_memory== 3) { + return yon_char_unite(str_key, str_value, "T" ,NULL); + } + else if (pow_size_memory== -1) { + return yon_char_unite(str_key, str_value, "%" ,NULL); + } + else if (pow_size_memory== -3) { + return yon_char_new("-"); + } + else { + return yon_char_new("-"); + } +} + +char** philos_str_split(char *parameters, int *size, char *divider) { + char** array_split = NULL; + char* ch= NULL; + ch = strtok(parameters, divider); + if (ch != NULL) { + array_split = yon_char_parsed_append(array_split, size, ch); + while (ch != NULL) { + ch = strtok(NULL, divider); + array_split = yon_char_parsed_append(array_split, size, ch); + } + } + (*size) -= 1; + return array_split; +} + +void philos_array_str_copy(char*** source, char*** copy) { + int index = 0; + if (copy == NULL || source == NULL) { + return; + } + while (1) { + if ((*copy)[index] != NULL) { + (*source) = yon_char_parsed_append((*source), &index, yon_char_new((*copy)[index])); + } + else { + break; + } + } +} +void philos_array_int_copy(int** source, int** copy) { + int * new_int = g_malloc0(sizeof(int)*2); + if ((*copy)[0] != -2) { + new_int[0] = (*copy)[0]; + new_int[1] = -2; + int i = 2; + for (i=1;(*copy)[i]!=-2;i++) { + yon_int_array_append(&new_int,(*copy)[i]); + } + *source=new_int; + } + else { + new_int[0] = (*copy)[0]; + *source=new_int; + } + +} +char** philos_pars_terminal_systemd_cgls(char* CMD_GET_SLICE_SERVICE, char* str_find, int* size_array_data) { + int size = 0; + char** terminal_print = yon_config_load(CMD_GET_SLICE_SERVICE, &size); + char** array_data = NULL; + for (int index = 0; index < size; index++) { + if (strstr(terminal_print[index], str_find) != NULL) { + yon_char_divide_search(terminal_print[index],"─",-1); + terminal_print[index] = yon_char_divide_search(terminal_print[index]," ", -1); + yon_char_divide(terminal_print[index],1); + array_data = yon_char_parsed_append(array_data, size_array_data, terminal_print[index]); + + } + } + return array_data; +} +char* philos_pard_array_add_cmd(char* cmd, temp_config* _config, char* key, int* array_io, int* array_io_pow_size, char** disk, int size) { + char* split_simvol = g_malloc0(sizeof(char)*2); + int flag_format = 0; + char* cmd_old = yon_char_new(cmd); + char* cmd_new = ""; + if (disk && size && array_io && array_io_pow_size) { + int index_find = 0; + for (int index = 0; index < size; index++) { + if (array_io_pow_size[index] >= 0 && array_io[index]>= 0 && !strstr(disk[index], "-")) { + char* num_and_pow_size = philos_format_cfg_str_size_memory(" ", array_io[index], array_io_pow_size[index]); + if (!strstr(num_and_pow_size, "-")) { + cmd_new = yon_char_unite(cmd_new, + split_simvol, + disk[index], + num_and_pow_size, NULL); + split_simvol[0] = ','; + split_simvol[1] = '\0'; + flag_format = 1; + } + free(num_and_pow_size); + } + } + } + free(split_simvol); + if (flag_format) { + if (strlen(cmd_new)>2) { + if (strlen(cmd_old) > 3) { + cmd = yon_char_unite(cmd_old, ",", key, cmd_new, NULL); + } + else { + cmd = yon_char_unite(key, cmd_new, NULL); + } + + } + return cmd; + } + else { + return cmd_old; + } + +} + + +void philos_temp_config_init(temp_config* _config) { + if (_config->size_disk != 0) { + philos_free_string_array(&_config->disk_read, _config->size_disk); + philos_free_int_array(&_config->i_o_limit_read, _config->size_disk); + philos_free_int_array(&_config->i_o_limit_read_size, _config->size_disk); + } + else if (_config->size_disk != 0) { + philos_free_string_array(&_config->disk_write, _config->size_disk); + philos_free_int_array(&_config->i_o_limit_write, _config->size_disk); + philos_free_int_array(&_config->i_o_limit_write_size, _config->size_disk); + } + _config->disk_read = NULL; + _config->disk_write = NULL; + _config->i_o_limit_read = NULL; + _config->i_o_limit_write = NULL; + _config->i_o_limit_read_size = NULL; + _config->i_o_limit_write_size = NULL; + _config->size_disk = 0; + _config->size_disk = 0; +} + + +int find_null_array(temp_config* _config) { + int index = 0; + for (index = 0; (_config->disk_read[index]!=NULL && _config->disk_write[index]!=NULL); index++) { + if (strcmp(_config->disk_read[index], "-") == 0 && strcmp(_config->disk_write[index], "-") == 0) { + break; + } + } + return index; + + +} +int* philos_int_append(int* array, int* size, int value) { + array = yon_remalloc(array, (*size+1)*sizeof(int)); + array[(*size)] = value; + (*size)++; + return array; + +} + +int* remove_element_int_array(int* array, int* size, int item_to_delete) { + int *new_int_parsed=NULL; + new_int_parsed=malloc(sizeof(int)*((*size)-1)); + int flag = 0; + for (int i=0;i < (*size);i++){ + if (i==item_to_delete) { + flag = 1; + } + if (flag == 0) { + memcpy(&(new_int_parsed[i]),&(array[i]),sizeof(int)); + } + else if (flag == 1 && i!=item_to_delete) { + memcpy(&(new_int_parsed[i-1]),&(array[i]),sizeof(int)); + } + } + (*size)=(*size)-1; + return new_int_parsed; +} + +int** remove_element_int_array_n3(int** array, int* size, int item_to_delete) { + int **new_int_parsed=NULL; + new_int_parsed=malloc(sizeof(int*)*((*size)-1)); + int flag = 0; + for (int i=0;i < (*size);i++){ + if (i==item_to_delete) { + flag = 1; + } + if (flag == 0) { + philos_array_int_copy(&new_int_parsed[i],&array[i]); + } + else if (flag == 1 && i!=item_to_delete) { + philos_array_int_copy(&new_int_parsed[i-1],&array[i]); + } + } + (*size)=(*size)-1; + return new_int_parsed; +} +char* philos_get_size_bite(GtkWidget* chk_button, GtkWidget* spin, GtkWidget* combo_box_text) { + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chk_button))) { + char* size_prifics = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(combo_box_text)); + int size_bite = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin)); + char* str_size_bute = yon_char_unite(yon_char_from_int(size_bite), " ", size_prifics, NULL); + return str_size_bute; + } + else { + char* str = (char*)malloc(sizeof(char*)*2); + str[0] = '-'; + str[1] = '\0'; + return str; + } +} +void philos_fill_combo_box_text(GtkWidget *cbt, config_str list_data, int size) { + for (int index = 0; index < size; index++) { + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(cbt), list_data[index]); + } +} + +void philos_set_spin_adjustment(GtkWidget *check, GtkWidget *spin, GtkWidget *combo, size_t value) { + gboolean active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check)); + //guint value_spin = gtk_spin_button_get_digits(GTK_SPIN_BUTTON(spin)); + guint value_spin = atoi((char*)gtk_entry_get_text(GTK_ENTRY(spin))); + if (active != -1) { + GtkAdjustment* adjustment = NULL; + adjustment = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(spin)); + gtk_adjustment_set_lower(adjustment, 0.0); + gtk_adjustment_set_page_increment(adjustment, 1.0); + if (combo == NULL) { + gtk_adjustment_set_upper(adjustment, (value*100)); + if ((value*100)0) { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),1); + } + gtk_widget_set_sensitive(spin, active); + gtk_widget_set_sensitive(combo, active); + } + else { + gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), 0); + gtk_widget_set_sensitive(spin, 0); + gtk_widget_set_sensitive(combo, 0); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), 0); + } + philos_set_spin_adjustment(check, spin, combo, 12582912); +} +char *yon_char_get_augumented(char *source, char *append) +{ + if (source && append) + { + int size = strlen(source) + strlen(append) + 1; + char *final = malloc(size); + memset(final, 0, size); + if (strstr(source, "%%")) + sprintf(final, source, append); + else + sprintf(final, "%s%s", source, append); + return final; + } + else + return NULL; +} +dictionary *yon_dictionary_create_with_data_connected(dictionary *dict, char *key, void *data) { + dictionary *dct = yon_dictionary_create_conneced(dict); + dct->key = yon_char_new(key); + dct->data = data; + dct->data_type = DICTIONARY_OTHER_TYPE; + return dct; +} +char **yon_char_parsed_shrink(char **char_string, int *size, int item_to_delete) { + char **new_char_parsed=NULL; + new_char_parsed=malloc(sizeof(char*)*((*size)-1)); + int flag = 0; + for (int i=0;i < (*size);i++){ + if (i==item_to_delete) { + flag = 1; + } + if (flag == 0) { + new_char_parsed[i]=yon_char_new(char_string[i]); + } + else if (flag == 1 && i!=item_to_delete) { + new_char_parsed[i-1]=yon_char_new(char_string[i]); + } + } + (*size)=(*size)-1; + return new_char_parsed; +} +char*** yon_char_parsed_shrink_n3(char ***char_string, int *size, int item_to_delete) { + char ***new_char_parsed=NULL; + new_char_parsed=malloc(sizeof(char**)*((*size)-1)); + int flag = 0; + for (int i=0;i < (*size);i++){ + if (i==item_to_delete) { + flag = 1; + } + if (flag == 0) { + yon_char_parsed_copy(&new_char_parsed[i],&char_string[i]); + } + else if (flag == 1 && i!=item_to_delete) { + yon_char_parsed_copy(&new_char_parsed[i-1], &char_string[i]); + } + } + (*size)=(*size)-1; + return new_char_parsed; +} +dictionary *yon_dictionary_create_empty() { + dictionary *dict = malloc(sizeof(dictionary)); + dict->data = NULL; + dict->key = NULL; + dict->next = NULL; + dict->prev = NULL; + dict->first = dict; + dict->data_type = DICTIONARY_OTHER_TYPE; + return dict; +} +#ifdef VTE_TERMINAL +void yon_terminal_integrated_launch(GtkWidget *terminal, char* command, void *endwork_function, void* endwork_function_argument){ + char **commands=new_arr(char*,2); + gchar **envp = g_get_environ(); + commands[0]=(gchar *)g_strdup(g_environ_getenv(envp, "SHELL")); + commands[1]=NULL; + char **env=new_arr(char*,2); + env[0]=""; + env[1]=NULL; + vte_terminal_set_size(VTE_TERMINAL(terminal),10,15); + VtePty *pty = vte_pty_new_sync(VTE_PTY_DEFAULT,NULL,NULL); + vte_terminal_set_pty(VTE_TERMINAL(terminal),pty); + char *install_command=yon_char_unite("tput cup 0 0 && tput ed; ",command, "; exit 0\n",NULL); + if(endwork_function) + g_signal_connect(G_OBJECT(terminal), "child-exited", G_CALLBACK(endwork_function), endwork_function_argument); + vte_terminal_spawn_async(VTE_TERMINAL(terminal), + VTE_PTY_DEFAULT, + NULL, + commands, + NULL, + 0, + NULL, NULL, + NULL, + -1, + NULL, + child_ready, + install_command); + vte_pty_spawn_async(pty, + NULL, + commands, + NULL, + 0, + NULL, NULL, + NULL, + -1, + NULL, + NULL, + NULL); + vte_terminal_set_scrollback_lines(VTE_TERMINAL(terminal), -1); + vte_terminal_set_scroll_on_output(VTE_TERMINAL(terminal), TRUE); + vte_terminal_set_scroll_on_keystroke(VTE_TERMINAL(terminal), TRUE); + gtk_widget_show_all(terminal); +} +static void child_ready(VteTerminal *terminal, GPid pid, GError *error, gpointer user_data) +{ + if (!terminal) return; + if (pid == -1) printf("Error\n\n\n"); + else vte_terminal_feed_child(VTE_TERMINAL(terminal),(char*)user_data,strlen((char*)user_data)); +} +#endif +dictionary *yon_dictionary_create_conneced(dictionary *targetdict) +{ + targetdict = yon_dictionary_get_last(targetdict); + targetdict->next = yon_dictionary_create_empty(); + targetdict->next->prev = targetdict; + targetdict->next->first = targetdict->first; + targetdict->next->data_type = DICTIONARY_OTHER_TYPE; + return targetdict->next; +} +void yon_int_array_append(int **source, int append){ + int size=0; + for (size=0;(*source)[size]!=-2;size++); + *source = realloc(*source,(size+2)*sizeof(int)); + (*source)[size] = append; + (*source)[size+1] = -2; +} + +/**[EN] + * int yon_config_save(char *command) + * Saves config with [command] + * [RU] +*/ +int philos_config_save(char *command) +{ + FILE *output = popen(command, "r"); + return 1; +} + +void philos_array_int_pars_to(int** array, int to) { + int flag = 0; + int i = 0; + for (i = 0; (*array)[i] != -2; i++) { + if ((*array)[i]==-3) { + (*array)[i] = to; + flag = 1; + break; + } + } +} + +void philos_array_char_pars_to(char*** array, char* to) { + int flag = 0; + int i = 0; + for (i = 0; (*array)[i] != NULL; i++) { + if (strcmp((*array)[i], "-") == 0) { + (*array)[i] = yon_char_new(to); + flag = 1; + break; + } + } +} + +char** philos_char_parsed_append(char** parsed, int *size, char *string) { + parsed = yon_char_parsed_append(parsed, size, string); + (*size)--; + return parsed; +} + +void philos_set_size_memory_integer(char* str_find, size_t* array_data) { + if (strstr(str_find, " ")) { + yon_char_divide_search(str_find, " ", -1); + } + char* simv_del_array[9] = {"K","M","G","T","k","m","g","t","%"}; + for (size_t i = 0; i < 9; i++) { + if (strstr(str_find, simv_del_array[i])) { + str_find = yon_char_divide_search(str_find, simv_del_array[i], -1); + } + } + if (strstr(str_find, "-")==NULL) { + (*array_data) = atoll(str_find); + } + else { + (*array_data) = -1; + } +} + +me_time time_convert(size_t seconds) { + me_time t; + if (seconds != -1) { + double weeks = seconds / (7*24*60*60); + double days = seconds / (24*60*60) - 7*weeks; + double hours = seconds / (60*60) - 7*24*weeks - 24*days; + double minutes = seconds / 60 - 7*24*60*weeks - 24*60*days - 60*hours; + if (weeks>0) { + t.weeks = (int)weeks; + } + else { + t.weeks = 0; + } + if (days>0) { + t.days = (int)days; + } + else { + t.days = 0; + } + if (hours>0) { + t.hours = (int)hours; + } + else { + t.hours = 0; + } + if (minutes>0) { + t.minutes = (int)minutes; + } + else { + t.minutes = 0; + } + t.str_time = NULL; + } + else { + t.weeks = 0; + t.days = 0; + t.hours = 0; + t.hours = 0; + t.str_time = NULL; + } + + + return t; +} + +char* fill_tree_view_id(int id) { + if (id < 0) { + return yon_char_new("AUTO"); + } + else { + return yon_char_from_int(id); + } +} + + +char *philos_char_from_size_t(size_t int_to_convert) { + int i = 1; + float convert_check = (float)int_to_convert; + for (i = 1; convert_check >= 10; i++) + { + convert_check = convert_check / 10; + } + char *ch = g_malloc0(i * sizeof(char) + 1); + sprintf(ch, "%d", int_to_convert); + return ch; +} +size_t philos_convert_memory(char* num_memory_pow) { + float num_f = atof(yon_char_new(num_memory_pow)); + if (strstr(num_memory_pow,"K") != NULL) { + return (size_t)(num_f); + } + else if (strstr(num_memory_pow,"M") != NULL) { + return (size_t)(num_f*1024); + } + else if (strstr(num_memory_pow,"G") != NULL) { + return (size_t)(num_f*1024*1024); + } + else if (strstr(num_memory_pow,"T") != NULL) { + return (size_t)(num_f*1024*1024*1024); + } + return 0; +} + diff --git a/source/model/philos_utils.h b/source/model/philos_utils.h new file mode 100644 index 0000000..267205e --- /dev/null +++ b/source/model/philos_utils.h @@ -0,0 +1,158 @@ +#ifndef PHILOS_UTILS_H +#define PHILOS_UTILS_H +#include "ubl-utils.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef VTE_TERMINAL + #include +#endif + +#include +#include + +#define catch(x) ExitJmp:if(__HadError) +#define throw(x) {__HadError=true;goto ExitJmp;} +#define file_source_login_min_max "/etc/login.defs" +static char** array_size_pow; +typedef struct { + char** disk_read; + char** disk_write; + int* i_o_limit_read; + int* i_o_limit_write; + int* i_o_limit_read_size; + int* i_o_limit_write_size; + int size; + int size_disk; +} temp_config; + +typedef struct { + GtkWidget* Window; + GtkWidget* btnSaveTempSave; + GtkWidget* btnTempCancel; + GtkWidget* lblSetUGP; + GtkWidget* lblHeadQuotasEditWindow; + + GtkWidget* btnOpenUserGroup; + + GtkWidget* btnReviewProject; + GtkWidget* btnGenerateProject; + GtkWidget* entryCatalogProject; + GtkWidget* chbAuto; + GtkWidget* entryProjectName; + GtkWidget* boxProjectAddEdit; + GtkWidget* boxProject; + GtkWidget* lblCatalogProjectEdit; + GtkWidget* lblProjectIdValueEdit; + GtkWidget* entryProjectId; + GtkWidget* boxTempDevice; + + GtkWidget* wndChooseFileWallpaper; + GtkWidget* btnFilemangerOk; + GtkWidget* btnFilemangerExit; + GtkWidget* quotegroupSizeSoftLimitCheck; + GtkWidget* quotegroupSizeSoftLimitSpin; + GtkWidget* quotegroupSizeSoftLimitCombo; + GtkWidget* quotegroupSizeHardLimitCheck; + GtkWidget* quotegroupSizeHardLimitSpin; + GtkWidget* quotegroupSizeHardLimitCombo; + GtkWidget* quotegroupFilesSoftLimitCheck; + GtkWidget* quotegroupFilesSoftLimitSpin; + GtkWidget* quotegroupFilesHardLimitCheck; + GtkWidget* quotegroupFilesHardLimitSpin; + GtkWidget* lblSetNameDevice; + GtkWidget* boxProjectAddEditboxProjectId; + GtkWidget* entryUser; + GtkWidget* UserDeviceCombo; + GtkWidget* lblSetQuotasStatus; + GtkWidget* lblWarningText; + GtkWidget* WarrningWindow; + GtkWidget* CancelWarrningButton; + GtkWidget* boxBlockGuiAddEdit; +} temp_set_window; + +typedef struct { + char* name; + int note_selected; + GtkListStore *liststore; + GtkWidget* tree_view; + GtkWidget* btnAdd; + GtkWidget* btnEdit; + GtkWidget* btnDel; + GtkWidget* btnFilter; + GtkWidget* lblSetNameDevice; +} hotebook; +typedef struct { + int weeks; + int days; + int hours; + int minutes; + char* str_time; +} me_time; + +void philos_array_string_remove_char(char*** array, char* str_remove, int size); +void philos_set_pow_size_memory(char* str_find, int* array_size, char** array_size_pow); +void philos_set_size_memory_integer_char(char* str_find, char*** array_data, int index); +void philos_free_string_array(char ***array, int size); +void philos_free_string_array_n3(char ****array, int size); +void philos_free_int_array(int **array, int size); +void philos_free_int_array_n2(int ***array, int size); +unsigned short philos_read_uid_min_max(char* filename, char* search); +config_str philos_list_user(int* size, int flag_lim); +config_str philos_list_group(int* size, int flag_lim); +char* philos_str_size_pow_byte(GtkWidget *combo_box_text); +char* philos_str_remove(char *str, const char *sub); +void philos_split_size_memory(char* str_value, int* size, char* pow_memory); +char* philos_format_cfg_str_size_memory(char* str_key, int value, int pow_size_memory); +char** philos_str_split(char *parameters, int *size, char *divider); +void philos_array_str_copy(char*** source, char*** copy); +void philos_array_int_copy(int** source, int** copy); +char** philos_pars_terminal_systemd_cgls(char* CMD_GET_SLICE_SERVICE, char* str_find, int* size_array_data); +char* philos_pard_array_add_cmd(char* cmd, temp_config* _config, char* key, int* array_io, int* array_io_pow_size, char** disk, int size); +int philos_check_activ_disk(temp_set_window *widgets, temp_config* _config); +void philos_temp_generate_cmd(temp_set_window *widgets, temp_config* _config); +void philos_temp_del_disk(temp_set_window *widgets, temp_config* _config, int flag_check_array); +void philos_temp_config_init(temp_config* _config); +void philos_update_device_to_entry(temp_set_window *widgets, temp_config* _config, int flag_check_array); +void philos_temp_add_disk(temp_set_window *widgets, temp_config* _config, int flag_check_array); +int* philos_int_append(int* array, int* size, int value); +int* remove_element_int_array(int* array, int* size, int item_to_delete); +int** remove_element_int_array_n3(int** array, int* size, int item_to_delete); +char* philos_get_size_bite(GtkWidget* chk_button, GtkWidget* spin, GtkWidget* combo_box_text); +void philos_fill_combo_box_text(GtkWidget *cbt, config_str list_data, int size); +void philos_set_spin_adjustment(GtkWidget *check, GtkWidget *spin, GtkWidget *combo, size_t value); +void philos_set_active_widgets(GtkWidget *check, GtkWidget *spin, GtkWidget *combo); +size_t get_resurs_total(char* cmd); +float get_size_pow_memory(size_t size_memory, int size); +void philos_set_active_widgets_device_io(GtkWidget* combo_to_l2,GtkWidget *check, GtkWidget *spin, GtkWidget *combo); +char *yon_char_get_augumented(char *source, char *append); +dictionary *yon_dictionary_create_with_data_connected(dictionary *dict, char *key, void *data); +char **yon_char_parsed_shrink(char **char_string, int *size, int item_to_delete); +char*** yon_char_parsed_shrink_n3(char ***char_string, int *size, int item_to_delete); +dictionary *yon_dictionary_create_empty(); +void yon_terminal_integrated_launch(GtkWidget *terminal, char* command, void *endwork_function, void* endwork_function_argument); +dictionary *yon_dictionary_create_conneced(dictionary *targetdict); +void yon_int_array_append(int **source, int append); +#ifdef VTE_TERMINAL +static void child_ready(VteTerminal *terminal, GPid pid, GError *error, gpointer user_data); +#endif +int philos_config_save(char *command); +void philos_array_int_pars_to(int** array, int to); +void philos_array_char_pars_to(char*** array, char* to); +int find_null_array(temp_config* _config); +void init_device_disk(temp_config* _config); +char** philos_char_parsed_append(char** parsed, int *size, char *string); +void philos_set_size_memory_integer(char* str_find, size_t* array_data); +me_time time_convert(size_t seconds); +char* fill_tree_view_id(int id); +char *philos_char_from_size_t(size_t int_to_convert); +size_t philos_convert_memory(char* num_memory_pow); + +#endif \ No newline at end of file diff --git a/source/model/save.c b/source/model/save.c new file mode 100644 index 0000000..eade62c --- /dev/null +++ b/source/model/save.c @@ -0,0 +1,264 @@ +#ifndef SAVE_H +#define SAVE_H +#include "save.h" + +char* save_str_users(config_u_g_p* config, int index, char* start_split) { + char* cmd = yon_char_new(""); + char split_simvol[2] = {0}; + split_simvol[0] = 0; + split_simvol[1] = 0; + vector* vec_actors = &config->actors; + char* str_actors = NULL; + if (vec_actors->vectorList.total> 0) { + for (int i = 0; i < vec_actors->vectorList.total; i++) { + if (i==0) { + cmd = yon_char_unite(cmd, start_split, NULL); + } + str_actors = (char*)vec_actors->pfVectorGet(vec_actors, i); + cmd = yon_char_unite(cmd, split_simvol, str_actors, NULL); + split_simvol[0] = ','; + split_simvol[1] = '\0'; + } + } + return cmd; + +} + +char* template_format_save(vector* vec_temp) { + char* cmd = yon_char_new(""); + if (vec_temp->vectorList.total> 0) { + for (int i = 0; i < vec_temp->pfVectorTotal(vec_temp); i++) { + config_u_g_p* _config = (config_u_g_p*)vec_temp->pfVectorGet(vec_temp, i); + char* key = save_format_key(_config, i); + char* value = save_format_str_value(_config, i); + if (key!= NULL) { + cmd = yon_char_unite(cmd, key, "=" , value, " ", NULL); + free(key); + free(value); + } + } + } + return cmd; +} + +char* save_format_status_cmd_all(vector* vec_temp, vector* vec_status_disk) { + char* cmd = yon_char_new(""); + char* str_cmd_format = NULL; + if (vec_temp->vectorList.total > 0 && vec_status_disk->vectorList.total > 0) { + for (int i=0; i < vec_temp->vectorList.total; i++) { + config_u_g_p* _config = (config_u_g_p*)vec_temp->pfVectorGet(vec_temp, i); + for (int j=0; j < vec_status_disk->vectorList.total;j++) { + disk_status* config_disk_status = (disk_status*)vec_status_disk->pfVectorGet(vec_status_disk, j); + if (strstr(config_disk_status->device, _config->UNIX_file) ) { + str_cmd_format = save_format_status_cmd(config_disk_status, _config); + if (str_cmd_format) { + cmd = yon_char_unite(cmd, " ", str_cmd_format, NULL); + free(str_cmd_format); + } + } + } + } + } + return cmd; +} + +char* set_status_and_del(config_all* _all_config) { + char* cmd = yon_char_new(""); + for (int j=0; j < _all_config->v_disk_status.vectorList.total;j++) { + disk_status* config_disk_status = (disk_status*)_all_config->v_disk_status.pfVectorGet(&_all_config->v_disk_status, j); + if (config_disk_status->status == 2 && (config_disk_status->deferring_size == 0 && config_disk_status->deferring_file == 0)) { + cmd = yon_char_unite(cmd, "DISK_QUOTA[usrquota:" , config_disk_status->device, "]=enable ", NULL); + cmd = yon_char_unite(cmd, "DISK_QUOTA[grpquota:" , config_disk_status->device, "]=enable ", NULL); + cmd = yon_char_unite(cmd, "DISK_QUOTA[prjquota:" , config_disk_status->device, "]=enable ", NULL); + yon_window_config_erase_custom_parameter(config_disk_status->device, "deferring_size"); + yon_window_config_erase_custom_parameter(config_disk_status->device, "deferring_file"); + yon_window_config_erase_custom_parameter(config_disk_status->device, config_disk_status->device); + } + else if (config_disk_status->status == 1) { + cmd = yon_char_unite(cmd, "DISK_QUOTA[usrquota:" , config_disk_status->device, "]=disable ", NULL); + cmd = yon_char_unite(cmd, "DISK_QUOTA[grpquota:" , config_disk_status->device, "]=disable ", NULL); + cmd = yon_char_unite(cmd, "DISK_QUOTA[prjquota:" , config_disk_status->device, "]=disable ", NULL); + yon_window_config_erase_custom_parameter(config_disk_status->device, "deferring_size"); + yon_window_config_erase_custom_parameter(config_disk_status->device, "deferring_file"); + yon_window_config_erase_custom_parameter(config_disk_status->device, config_disk_status->device); + } + if (config_disk_status->status == 2 && (config_disk_status->deferring_size != 0 || config_disk_status->deferring_file != 0)) { + cmd = yon_char_unite(cmd, "DISK_QUOTA[usrquota:", config_disk_status->device, "]=0:0:0:0:",yon_char_from_int(config_disk_status->deferring_size), ":", yon_char_from_int(config_disk_status->deferring_file)," ", NULL); + cmd = yon_char_unite(cmd, "DISK_QUOTA[grpquota:", config_disk_status->device, "]=0:0:0:0:",yon_char_from_int(config_disk_status->deferring_size), ":", yon_char_from_int(config_disk_status->deferring_file)," ", NULL); + cmd = yon_char_unite(cmd, "DISK_QUOTA[prjquota:", config_disk_status->device, "]=0:0:0:0:",yon_char_from_int(config_disk_status->deferring_size), ":", yon_char_from_int(config_disk_status->deferring_file)," ", NULL); + } + } + return cmd; +} + +char* wrapper_save_format_status_cmd_all(config_all* _all_config) { + return set_status_and_del(_all_config); +} + +char* save_format_status_cmd(disk_status* config_disk_status, config_u_g_p* config) { + char* cmd = yon_char_unite("DISK_QUOTA[", config->type_arr, ":", config->UNIX_file,"]=", NULL);; + if (config_disk_status->status == 2) { + cmd = yon_char_unite(cmd,"enable", NULL); + return cmd; + } + else if (config_disk_status->status == 1) { + return yon_char_unite(cmd,"disable", NULL); + } + else { + return NULL; + } +} + +char* wrapper_template_format_save(config_all* _all_config, char* source_set_cmd) { + char* cmd_user = template_format_save(&_all_config->v_user); + char* cmd_group = template_format_save(&_all_config->v_group); + char* cmd_project = template_format_save(&_all_config->v_project); + char* cmd_status_disk = wrapper_save_format_status_cmd_all(_all_config); + if ((strlen(cmd_status_disk) > 3 || strlen(cmd_user) > 3 || strlen(cmd_group) > 3 || strlen(cmd_project) > 3) && !save_check_save(_all_config)) { + return yon_char_unite(source_set_cmd," ", cmd_status_disk, " ", cmd_user, " ", cmd_group, " ", cmd_project, NULL); + } + return NULL; + +} +char* template_format_remove_save(config_all* _all_config, char* source_remove_cmd) { + if (_all_config->v_remove.vectorList.total > 0) { + char* cmd = yon_char_new(source_remove_cmd); + for (int i = 0; i < _all_config->v_remove.vectorList.total; i++) { + char* str_remove = (char*)_all_config->v_remove.pfVectorGet(&_all_config->v_remove, i); + cmd = yon_char_unite(cmd, " DISK_QUOTA[" , str_remove, "] ", NULL); + } + if (strlen(cmd) > strlen(source_remove_cmd) && save_check_save(_all_config)== 0) { + return cmd; + } + } + return NULL; + +} +char* template_format_remove_save_device(config_all* _all_config, char* source_remove_cmd) { + char* cmd = yon_char_new(""); + if (_all_config->v_disk_remove.vectorList.total > 0) { + for (int i=0; i < _all_config->v_disk_remove.vectorList.total; i++) { + char* str_del = (char*)_all_config->v_disk_remove.pfVectorGet(&_all_config->v_disk_remove, i); + if (str_del) { + cmd = yon_char_unite(cmd, " DISK_QUOTA[usrquota:" , str_del, "] ", NULL); + cmd = yon_char_unite(cmd, " DISK_QUOTA[grpquota:" , str_del, "] ", NULL); + cmd = yon_char_unite(cmd, " DISK_QUOTA[prjquota:" , str_del, "] ", NULL); + yon_window_config_erase_custom_parameter(str_del, "deferring_size"); + yon_window_config_erase_custom_parameter(str_del, "deferring_file"); + yon_window_config_erase_custom_parameter(str_del, str_del); + } + + } + } + if (strlen(cmd)>5) { + for (int i=0; i < _all_config->v_disk_remove.vectorList.total; i++) { + _all_config->v_disk_remove.pfVectorDelete(&_all_config->v_disk_remove, i); + } + return cmd; + } + else { + return NULL; + } + +} + + +int wrapper_template_save(config_all* _all_config, char* source_set_cmd, char* source_remove_cmd) { + char* str_cmd_remove = template_format_remove_save(_all_config,source_remove_cmd); + char* str_cmd_remove_device = template_format_remove_save_device(_all_config,source_remove_cmd); + char* str_cmd_set = wrapper_template_format_save(_all_config,source_set_cmd); + if (str_cmd_set != NULL && str_cmd_remove != NULL && str_cmd_remove_device != NULL) { + philos_config_save(yon_char_unite(str_cmd_remove, " " ,str_cmd_remove_device, "; " , str_cmd_set, NULL)); + } + else { + if (str_cmd_remove != NULL) { + philos_config_save(str_cmd_remove); + } + if (str_cmd_remove_device != NULL) { + philos_config_save(yon_char_unite(source_remove_cmd, " " , str_cmd_remove_device, NULL)); + } + if (str_cmd_set != NULL) { + philos_config_save(str_cmd_set); + } + + } + + if (str_cmd_remove != NULL) { + free(str_cmd_remove); + } + if (str_cmd_set != NULL) { + free(str_cmd_set); + } + if (str_cmd_remove_device != NULL) { + free(str_cmd_remove_device); + } + vector_init(&_all_config->v_remove); + _all_config->flag_set_data = 0; + return 1; +} + +char* save_format_key(config_u_g_p* config, int index) { + char* value = yon_char_new(""); + char* key = yon_char_new(""); + int number = config->id; + key = yon_char_unite("DISK_QUOTA[", config->type_arr, ":", NULL); + char* unix_file = NULL; + if (strstr(config->UNIX_file, " ") && !strstr(config->UNIX_file, "\"") ) { + unix_file = yon_char_unite("\"", config->UNIX_file, "\"", NULL); + } + else { + unix_file = yon_char_new(config->UNIX_file); + } + if (strstr(config->type_arr, "prjquota")) { + if (number!=-1) { + key = yon_char_unite(key, unix_file,":",yon_char_from_int(number), NULL); + } + else { + key = yon_char_unite(key, unix_file,":AUTO", NULL); + } + key = yon_char_unite(key, save_str_users(config, index, ",") , "]", NULL); + } + else { + key = yon_char_unite(key, unix_file, NULL); + key = yon_char_unite(key, save_str_users(config, index, ":") , "]", NULL); + } + free(unix_file); + return key; +} + + +char* save_format_str_value(config_u_g_p* config, int index) { + char* value = NULL; + if (config->soft_restriction_size) { + value = yon_char_unite(philos_format_cfg_str_size_memory("", config->soft_restriction_size,config->soft_restriction_size_pow), NULL); + } + else { + value = yon_char_new("0"); + } + if (config->severe_limitation_size) { + value = yon_char_unite(value, ":", philos_format_cfg_str_size_memory("", config->severe_limitation_size,config->severe_limitation_size_pow), NULL); + } + else { + value = yon_char_unite(value,":0", NULL); + } + value = yon_char_unite(value, ":", yon_char_from_int(config->soft_restriction_file), NULL); + value = yon_char_unite(value, ":", NULL); + value = yon_char_unite(value, yon_char_from_int(config->severe_limitation_file), NULL); + value = yon_char_unite(value, ":", NULL); + value = yon_char_unite(value, philos_char_from_size_t(config->deferring_size), ":", NULL); + value = yon_char_unite(value, philos_char_from_size_t(config->deferring_file), NULL); + return value; +} + +int save_check_save(config_all* _all_config) { + if (_all_config->flag_set_data == 1 || _all_config->flag_save>0) { + return 0; + } + else if (_all_config->flag_set_data == 0 || _all_config->flag_save<=0) { + return 1; + } + return 0; +} + + +#endif \ No newline at end of file diff --git a/source/model/save.h b/source/model/save.h new file mode 100644 index 0000000..0e4a241 --- /dev/null +++ b/source/model/save.h @@ -0,0 +1,14 @@ +#ifndef SAVE +#define SAVE +#include "ubl-utils.h" +#include "model.h" +char* template_format_save(vector* vec_temp); +char* save_format_key(config_u_g_p* _config, int index); +char* save_str_users(config_u_g_p* _config, int index, char* start_split); +char* save_format_str_value(config_u_g_p* config, int index); +char* save_format_status_cmd(disk_status* config_disk_status, config_u_g_p* config); +char* template_format_remove_save(config_all* _all_config, char* source_remove_cmd); +void save_remove_array(config_all* _all_config); +int save_check_save(config_all* _all_config); +int wrapper_template_save(config_all* _all_config, char* source_set_cmd, char* source_remove_cmd); +#endif \ No newline at end of file diff --git a/source/model/ubl-utils.c b/source/model/ubl-utils.c new file mode 100644 index 0000000..ac34d72 --- /dev/null +++ b/source/model/ubl-utils.c @@ -0,0 +1,1927 @@ +#include "ubl-utils.h" + +// dictionary functions + +/**yon_dictionary_new(): + * [EN] + * Creates and returns empty dictionary + * [RU] + * Создаёт и возвращает пустой словарь. + */ +dictionary *yon_dictionary_new() +{ + dictionary *dict = malloc(sizeof(dictionary)); + dict->data = NULL; + dict->key = NULL; + dict->next = NULL; + dict->prev = NULL; + dict->first = dict; + dict->data_type = DICTIONARY_OTHER_TYPE; + return dict; +} + +/**yon_dictionary_copy(dictionary *dict) + * [EN] + * + * [RU] + * Создаёт и возвращает копию элемента словаря [dict] +*/ +dictionary *yon_dictinoary_copy(dictionary *dict){ + dictionary *dct = yon_dictionary_new_with_data(dict->key,dict->data); + dct->data_type= dict->data_type; + return dct; +} + +/**yon_dictionary_copy_deep(dictionary *dict) + * [EN] + * + * [RU] + * Создаёт полную копию словаря [dict] и возвращает первый элемент +*/ +dictionary *yon_dictionary_copy_deep(dictionary *dict){ + dictionary *dct = NULL; + dictionary *newone=NULL; + for_dictionaries(dct,dict){ + yon_dictionary_add_or_create_if_exists_with_data(newone,dct->key,dct->data); + newone->data_type=dct->data_type; + } + return newone->first; +} + +/**int yon_dictionary_set_data(dictionary *dict, void *data) + * [EN] + * + * [RU] + * Установить элементу словаря [dict] значение [data] +*/ +int yon_dictionary_set_data(dictionary *dict, void *data){ + dict->data=data; +} + +/**int yon_dictionary_set_key(dictionary *dict, char *key) + * [EN] + * + * [RU] + * Изменяет ключ элемента словаря [dict] на [key] +*/ +int yon_dictionary_set_key(dictionary *dict, char *key){ + dict->key=key; + return 1; +} + +/** int yon_dictionary_set(dictionary *dict, char *key, void *data) + * [EN] + * + * [RU] +* Устанавливает значение ключа элемента словаря [dict] на [key] и его данные на [data] +*/ +int yon_dictionary_set(dictionary *dict, char *key, void *data){ + dict->key=key; + dict->data=data; + return 1; +} + +/**int yon_dictionary_empty(dictionary *dict) + * [EN] + * + * [RU] + * Очищает элемент словаря [dict] от данных +*/ +int yon_dictionary_empty(dictionary *dict){ + dict->data=NULL; + dict->data_type=DICTIONARY_OTHER_TYPE; + return 1; +} + +/**yon_dictionary_switch_to_last(dictionary **dict) + * [EN] + * + * [RU] + * Переключает словарь [dict] на последний элемент. +*/ +void yon_dictionary_switch_to_last(dictionary **dict) +{ + dictionary *dct=NULL, *dact=*dict; + for_dictionaries(dct,dact); +} + +/**yon_dictionary_create_conneced(dictionary *targetdict) + * [EN] + * + * [RU] + * Создаёт новый элемент словаря [targetdict] +*/ +dictionary *yon_dictionary_append(dictionary *targetdict) +{ + targetdict = yon_dictionary_get_last(targetdict); + targetdict->next = yon_dictionary_new(); + targetdict->next->prev = targetdict; + targetdict->next->first = targetdict->first; + targetdict->next->data_type = DICTIONARY_OTHER_TYPE; + return targetdict->next; +} + +/**yon_dictionary_get_last(dictionary *dict) + * [EN] + * + * [RU] + * Возвращает последний элемент словаря [dict]. + * В отличае от yon_dictionary_switch_to_last() + * словарь [dict] остаётся на прежнем элементе. +*/ +dictionary *yon_dictionary_get_last(dictionary *dict) +{ + if (dict->next){ + dictionary *dct = NULL; + for_dictionaries(dct,dict); + return dct; + } else return dict; +} + +/**yon_dictionary_switch_places(dictionary *dict, int aim) + * [EN] + * + * [RU] + * Меняет элемент словаря [dict] местами с другим элементом. + * если [aim]<0 элемент меняется местами с левым элементом; + * если [aim]>0 элемент меняется местами с правым элементом; +*/ +dictionary *yon_dictionary_swap(dictionary *dict, int aim) +{ + if (aim < 0) + { + if (dict->prev) + { + if (dict->prev->prev) + { + dictionary *next = dict->next, *prev = dict->prev, *preprev = prev->prev; + if (next) + { + preprev->next = dict; + dict->prev = preprev; + dict->next = prev; + prev->prev = dict; + prev->next = next; + next->prev = prev; + } + else + { + preprev->next = dict; + dict->prev = preprev; + dict->next = prev; + prev->prev = dict; + prev->next = NULL; + } + return prev; + } + else + { + dictionary *next = dict->next, *prev = dict->prev; + if (next) + { + yon_dictionary_make_first(dict); + dict->prev = NULL; + dict->next = prev; + prev->prev = dict; + prev->next = next; + next->prev = prev; + } + else + { + dict->prev = NULL; + dict->next = prev; + prev->prev = dict; + prev->next = NULL; + } + return prev; + } + } + } + else if (aim > 0) + { + if (dict->next) + { + if (dict->next->next) + { + dictionary *next = dict->next, *prev = dict->prev, *afnext = next->next; + if (prev) + { + prev->next = next; + next->prev = prev; + next->next = dict; + dict->prev = next; + dict->next = afnext; + afnext->prev = dict; + } + else + { + yon_dictionary_make_first(next); + next->prev = NULL; + next->next = dict; + dict->prev = next; + dict->next = afnext; + afnext->prev = dict; + } + return next; + } + else + { + dictionary *next = dict->next, *prev = dict->prev; + if (prev) + { + prev->next = next; + next->prev = prev; + next->next = dict; + dict->prev = next; + dict->next = NULL; + } + else + { + next->prev = NULL; + next->next = dict; + dict->prev = next; + dict->next = NULL; + } + } + } + } +} + +/**yon_dictionary_make_first(dictionary *dict) + * [EN] + * + * [RU] + * Устанавливает указатель первого элемента словаря [dict] + * на текущий элемент. Не использовать. +*/ +void yon_dictionary_make_first(dictionary *dict) +{ + for (dictionary *dct = dict->first; dct != NULL; dct = dct->next) + { + dct->first = dict; + } +} + +/**yon_dictionary_make_nth(dictionary *dict, int nth) + * [EN] + * + * [RU] + * Перемещает элемент словаря [dict] на позицию [nth]. +*/ +void yon_dictionary_make_nth(dictionary *dict, int nth) +{ + dictionary *dct = dict->first; + for (int i = 0; i < nth; i++) + { + if (dct == NULL) + return; + else + dct = dct->next; + } + yon_dictionary_rip(dict); + dictionary *prev = dct->prev; + prev->next = dict; + dict->prev = prev; + dict->next = dct; + dct->prev = dict; +} + +/**yon_dictionary_create_with_data(char *key, void *data) + * [EN] + * + * [RU] + * Создаёт новый словарь с ключом [key] и указателем на данные [data] +*/ +dictionary *yon_dictionary_new_with_data(char *key, void *data) +{ + dictionary *dct = yon_dictionary_new(); + dct->key = yon_char_new(key); + dct->data = data; + dct->data_type = DICTIONARY_OTHER_TYPE; + return dct; +} + +/** void *yon_dictionary_free_all(dictionary *dictionary,void *data_manipulation) + * [EN] + * Frees whole [dictionary] and activates [data_manipulation] function if not NULL with [dictionary]->data argument for each dictionary. + * [RU] + * Освобождает память для всех элементов словаря [dictionary] и активирует функцию [data_manipulation], если она была передана, с аргументом [dictionary]->data на каждый элемент словаря. +*/ +void *yon_dictionary_free_all(dictionary *dictionary_to_free,void (*data_manipulation)(void*)){ + dictionary *dict=NULL; + for_dictionaries(dict,dictionary_to_free){ + if(data_manipulation) + data_manipulation(dict->data); + if(dict->prev) + free(dict->prev); + } + free(dict); + return NULL; +} + +/**yon_dictionary_create_with_data_connected(dictionary *dict, char *key, void *data) + * [EN] + * + * [RU] + * Создаёт новый элемент словаря, присоединяемый в конец словаря [dict] + * с ключом [key] и указателем на данные [data] +*/ +dictionary *yon_dictionary_append_with_data(dictionary *dict, char *key, void *data) +{ + dictionary *dct = yon_dictionary_append(dict); + dct->key = yon_char_new(key); + dct->data = data; + dct->data_type = DICTIONARY_OTHER_TYPE; + return dct; +} + +/**yon_dictionary_connect(dictionary *old, dictionary *toconnect) + * [EN] + * + * [RU] + * Присоединяет словарь [toconnect] в конец словаря [old]. +*/ +dictionary *yon_dictionary_connect(dictionary *old, dictionary *toconnect) +{ + dictionary *dict = yon_dictionary_get_last(old); + dict->next = toconnect; + toconnect->prev = dict; + toconnect->first = dict->first; + return toconnect; +} + +/**yon_dictionary_get(dictionary **dict, char *key) + * [EN] + * + * [RU] + * Возвращает элемент словаря [dict] с ключом [key]. + * Если такого элемента не было обнаружено, возвращается NULL +*/ +dictionary *yon_dictionary_get(dictionary **dict, char *key) +{ + dictionary *dct = *dict; + for (dictionary *pointer = dct->first; pointer != NULL; pointer = pointer->next) + { + if (strcmp(pointer->key, key) == 0) + { + *dict = pointer; + return pointer; + } + } + return NULL; +} + +/**yon_dictionary_rip(dictionary *dict) + * [EN] + * + * [RU] + * Вырезает элемент из словаря и возвращает вырезанный элемент. +*/ +dictionary *yon_dictionary_rip(dictionary *dict) +{ + if (!dict->next&&!dict->prev) return NULL; + else if (!dict->next) + { + dictionary *prev = dict->prev; + if (prev) + { + prev->next = NULL; + return prev; + } + else + return dict; + } + else if (!dict->prev) + { + dictionary *next = dict->next; + if (next) + { + yon_dictionary_make_first(next); + next->prev = NULL; + return next; + } + else + return dict; + } + else + { + dictionary *next = dict->next, *prev = dict->prev; + next->prev = prev; + prev->next = next; + return next; + } +} + +/**yon_dictionary_get_nth(dictionary *dict, int place) + * [EN] + * + * [RU] + * Возвращает [place]-й элемент словаря [dict] +*/ +dictionary *yon_dictionary_get_nth(dictionary *dict, int place) +{ + if (dict){ + dict = dict->first; + int i = 0; + for (i = 0; i < place; i++) + if (dict->next) + dict = dict->next; + else + break; + if (i == place) + return dict; + else + return NULL; + } else return NULL; +} + +// char functions + +int yon_char_find_last(char *source, char find){ + int size = strlen(source); + int i=size; + for (;source[i]!=find&&i>0;i--); + return i; +} + +/**[EN] + * + * creates new char string by combining two char strings. + */ +char *yon_char_append(char *source, char *append) +{ + if (source && append) + { + int size = strlen(source) + strlen(append) + 1; + char *final = malloc(size); + memset(final, 0, size); + if (strstr(source, "%%")) + sprintf(final, source, append); + else + sprintf(final, "%s%s", source, append); + return final; + } + else + return NULL; +} + +/**[EN] + * + * creates new char string by copying another char. + */ +char *yon_char_new(char *chr) +{ + if (chr){ + char *newchar = malloc(strlen(chr) + 1); + memset(newchar, 0, strlen(chr) + 1); + memcpy(newchar, chr, strlen(chr)); + return newchar; + } else + return NULL; +} + +/**yon_char_unite(char *source, ...) + * [En] + * + * [RU] + * Объединяет строку [source] со всеми строками, написанными в [...] +*/ +char *yon_char_unite(char *source, ...){ + va_list arglist; + char *new_char=NULL; + char *unite_char=NULL; + new_char=yon_char_new(source); + va_start(arglist,source); + unite_char = va_arg(arglist,char*); + while(unite_char){ + new_char = yon_char_append(new_char,unite_char); + unite_char = va_arg(arglist,char*); + } + va_end(arglist); + return new_char; +} + +/**yon_cut(char *source, int size, int startpos) + * [EN] + * cuts source string by size length from startpos position. + */ +char *yon_cut(char *source, int size, int startpos) +{ + char *cut = NULL; + cut = malloc(size + 1); + memset(cut, 0, size + 1); + memcpy(cut, source + startpos, size); + return cut; +} + +/**yon_char_divide(char *source, int dividepos) + * [EN] + * divides source string in dividepos position, + * returning left part of divided string and + * inserting right part to source string. + */ +char *yon_char_divide(char *source, int dividepos) +{ + char *cut = malloc(dividepos + 1); + memset(cut, 0, dividepos + 1); + memcpy(cut, source, dividepos); + char *left = malloc(strlen(source) - strlen(cut)); + memset(left, 0, strlen(source) - strlen(cut)); + memcpy(left, source + dividepos + 1, (strlen(source) - dividepos)); + memset(source, 0, strlen(source)); + memcpy(source, left, strlen(left)); + return cut; +} + +/**yon_char_find_count(char *source, char *find) + * [EN] + * + * [RU] + * Считает количество символов [find] в строке [source] +*/ +int yon_char_find_count(char *source, char *find){ + char *working_string=source; + int size=0; + while ((working_string = strstr(working_string, find))) { + if (working_string) { + working_string++; + size++; + } + } + return size; +} + +/**yon_char_divide_search(char *source, char *dividepos, int delete_divider) + * [EN] + * char *yon_char_divide_search(char *source, char *dividepos, int delete_divider) + * searches string [dividepos] in [source] string and divides it, + * returning left part of divided string and + * inserting right part to [source] string. + * if [delete_divider] is 0, left part will contain [delete_divider] substring, else + * if [delete_divider] is 1 it will stay in right part, else + * if [delete_divider] is -1 it will be deleted from string. + * + * [RU] + * char *yon_char_divide_search(char *source, char *dividepos, int delete_divider) + * Ищет строку [dividepos] в строке [source] и делит её в этом месте, + * возвращая левую часть разделённой строки и устанавливает в [source] правую часть. + * Если [delete_divider] равен 0, [dividepos] останется в левой строке, иначе + * если [delete_divider] равен 1, [dividepos] останется в правой строке, иначе + * если [delete_divider] равен -1, [dividepos] удаляется из строки. + */ +char *yon_char_divide_search(char *source, char *dividepos, int delete_divider) +{ + if (source&÷pos){ + char *cut = strstr(source, dividepos); + if (cut) + { + int leng = strlen(source) - strlen(cut); + cut = yon_char_divide(source, leng); + return cut; + } + } + return source; +} + +/**yon_char_from_int(int int_to_convert) + * [EN] + * char *yon_char_from_int(int int_to_convert) + * converts int to char*. + * + * [RU] + * char *yon_char_from_int(int int_to_convert) + * Конвертирует int в char* + */ +char *yon_char_from_int(int int_to_convert) +{ + int i = 1; + float convert_check = (float)int_to_convert; + for (i = 1; convert_check >= 10; i++) + { + convert_check = convert_check / 10; + } + char *ch = g_malloc0(i * sizeof(char) + 1); + sprintf(ch, "%d", int_to_convert); + return ch; +} + +/**yon_char_replace(char *source, char *find, char*replace) + * [EN] + * + * [RU] + * Заменяет в строке [source] все вхождения строки [find] на [replace] +*/ +char *yon_char_replace(char *source, char *find, char*replace){ + if (!strstr(replace,find)){ + + + char *final=NULL; + char *temp=NULL; + if(!strstr(replace,find)){ + while ((final=strstr(source,find))){ + temp=malloc(strlen(source)-strlen(final)); + memset(temp,0,strlen(source)-strlen(final)+strlen(replace)); + memcpy(temp,source,strlen(source)-strlen(final)); + temp=yon_char_append(temp,replace); + source=yon_char_append(temp,final+1); + } + + } + } + return source; +} + +/**yon_char_parse(char *parameters, int *size, char *divider) + * [EN] + * Parses string [parameters], divided by [divider], + * then returns parsed string array and sets [size] to + * size of returned array +*/ +char **yon_char_parse(char *parameters, int *size, char *divider){ + char **string=NULL; + if (!strstr(parameters, divider)) { + return NULL; + } + int i=1; + string=malloc(sizeof(char*)); + char *paramline=yon_char_new(parameters); + char *param; + while ((param=yon_char_divide_search(paramline,divider,1))){ + if (strcmp(param,paramline)==0) break; + string=realloc(string,sizeof(char*)*i); + string[i-1]=yon_char_new(param); + i++; + } + string=realloc(string,sizeof(char*)*i); + string[i-1]=yon_char_new(paramline); + i++; + // printf("%d\n",i); + *size=i-1; + return string; + +} + +/**yon_char_parsed_rip(char **char_string, int *size, int item_to_delete) + * [EN] + * + * [RU] + * Удаляет элемент [item_to_delete] из массива строк [char_string], размера [size] + * Возвращает получившийся массив, в [size] загружается размер нового массива. +*/ +char **yon_char_parsed_rip(char **char_string, int *size, int item_to_delete){ + char **new_char_parsed=NULL; + new_char_parsed=malloc(sizeof(char*)*((*size)-1)); + int flag = 0; + for (int i=0;i < (*size);i++){ + if (i==item_to_delete) { + flag = 1; + } + if (flag == 0) { + new_char_parsed[i]=yon_char_new(char_string[i]); + } + else if (flag == 1 && i!=item_to_delete) { + new_char_parsed[i-1]=yon_char_new(char_string[i]); + } + } + (*size)=(*size)-1; + return new_char_parsed; +} + +/**yon_char_parsed_check_exist(char **parameters, int size, char *param) + * [EN] + * Checks if [parameters] string array of length [size] + * has [param] element; + * [RU] + * Проверяет есть ли в массиве строк [parameters], размера [size] + * элемент [param] +*/ +int yon_char_parsed_check_exist(char **parameters, int size, char *param){ + + for (int i=0;id_name); + file = fopen(path, "r"); + if (strlen(de->d_name) > 9) + { + char *extension = strstr(path, "."); + if (extension != NULL) + { + if (strcmp(extension, ".desktop") == 0) + { + apps tempapp; + GKeyFile *gfile = g_key_file_new(); + GError *err = NULL; + g_key_file_load_from_file(gfile, path, G_KEY_FILE_KEEP_TRANSLATIONS, NULL); + char *Type = g_key_file_get_string(gfile, "Desktop Entry", "Type", &err); + if (err) + { + printf("%s\n", err->message); + } + if (strcmp(Type, "Application") == 0) + tempapp.Type = 1; + else if (strcmp(Type, "pyApplication") == 0) + tempapp.Type = 2; + else + continue; + tempapp.Name = g_key_file_get_locale_string(gfile, "Desktop Entry", "Name", setlocale(LC_ALL, NULL), NULL); + if (tempapp.Name == NULL) + continue; + tempapp.Categories = g_key_file_get_string(gfile, "Desktop Entry", "Categories", NULL); + if (tempapp.Categories == NULL) + continue; + tempapp.Exec = g_key_file_get_string(gfile, "Desktop Entry", "Exec", NULL); + if (tempapp.Exec == NULL) + continue; + tempapp.Icon = g_key_file_get_string(gfile, "Desktop Entry", "Icon", NULL); + if (tempapp.Icon == NULL) + continue; + tempapp.Pluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "Pluggable", NULL); + if (!tempapp.Pluggable) + tempapp.Pluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "X-XfcePluggable", NULL); + if (tempapp.Pluggable) + tempapp.DualPluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "X-UBLPluggable", NULL); + if (g_key_file_get_boolean(gfile, "Desktop Entry", "X-UBL-SettingsManager-Hidden", NULL) == 0) + if (size == 0) + { + applist = (apps *)malloc(size + 1 * sizeof(apps)); + applist[0].Name = yon_char_new(tempapp.Name); + applist[0].Categories = yon_char_new(tempapp.Categories); + applist[0].Exec = yon_char_new(tempapp.Exec); + applist[0].Icon = yon_char_new(tempapp.Icon); + applist[0].Type = tempapp.Type; + applist[0].Pluggable = tempapp.Pluggable; + applist[0].DualPluggable = tempapp.DualPluggable; + size++; + } + else + { + applist = (apps *)realloc(applist, (size + 1) * sizeof(apps)); + applist[size].Name = yon_char_new(tempapp.Name); + applist[size].Categories = yon_char_new(tempapp.Categories); + applist[size].Exec = yon_char_new(tempapp.Exec); + applist[size].Icon = yon_char_new(tempapp.Icon); + applist[size].Pluggable = tempapp.Pluggable; + applist[size].DualPluggable = tempapp.DualPluggable; + applist[size].Type = tempapp.Type; + size++; + } + } + } + } + } + } + *sizef = size; + return applist; +}; + +void yon_apps_sort(apps *applist, int size) +{ + apps tmp; + if (size > 2) + { + for (int i = 1; i < size; i++) + { + for (int j = 1; j < size; j++) + { + if (strcmp(applist[j].Name, applist[j - 1].Name) < 0) + { + tmp = applist[j]; + applist[j] = applist[j - 1]; + applist[j - 1] = tmp; + }; + } + }; + } +}; + +apps *yon_apps_get_by_name(apps *applist, char *name, int size) +{ + for (int i = 0; i < size; i++) + { + if (strcmp(applist[i].Name, name) == 0) + return &applist[i]; + } + return NULL; +}; + +//config functions + +/**yon_config_load_register(char *command) + * [EN] + * + * [RU] + * Выполняет команду [command]. + * Полученные данные парсятся и регистрируются в конфиг. +*/ +int yon_config_load_register(char *command){ + if (__yon__config__strings){ + __yon__config__strings = yon_dictionary_free_all(__yon__config__strings,NULL); + } + FILE *output = popen(command, "r"); + char **output_strings = NULL; + output_strings = malloc(sizeof(char)); + int i = 0; + char str[4096]; + memset(str, 0, 4096); + while (fgets(str, 4096, output)) + { + if (strcmp(str, "") != 0&& strcmp(str,"(null)\n")!=0) + { + char *key = yon_char_divide_search(str,"=",-1); + yon_dictionary_add_or_create_if_exists_with_data(__yon__config__strings,key,str); + __yon__config__strings->data_type=DICTIONARY_CHAR_TYPE; + } + } + check_config + return 0; + else return 1; +} + +/**yon_config_remove_by_key(char *key) + * [EN] + * + * [RU] + * Удаляет параметр конфига по ключу [key] +*/ +int yon_config_remove_by_key(char *key){ + check_config{ + dictionary *dict = yon_dictionary_get(&__yon__config__strings,key); + if (dict){ + yon_dictionary_rip(dict); + return 1; + }else return 0; + } + return 0; +} + +/**yon_config_remove_by_data(void *data) + * [EN] + * + * [RU] + * Производит поиск по конфигу на наличие параметра со значением [data] и удаляет найденное значение из конфига. +*/ +int yon_config_remove_by_data(void *data){ + check_config{ + dictionary *dict = NULL; + for_dictionaries(dict,__yon__config__strings){ + if (dict->data==data){ + yon_dictionary_rip(dict); + return 1; + } + } + return 0; + } + return 0; +} + +/**yon_config_remove_element(char *key, char *deleted) + * [EN] + * + * [RU] + * Удаляет элемент [deleted] из массива параметров с ключом [key] +*/ +int yon_config_remove_element(char *key, char *deleted){ + check_config{ + dictionary *dict = yon_dictionary_get(&__yon__config__strings,key); + char *data = (char*)dict->data; + char *found = strstr(data,deleted); + int size=strlen(data)-strlen(found)+1; + char *new_data = malloc(size); + memset(new_data,0,size); + if (strlen(found)!=strlen(deleted)){ + memcpy(new_data,data,size-1); + new_data = yon_char_append(new_data,found+strlen(deleted)+1); + } else { + memcpy(new_data,data,size-2); + new_data = yon_char_append(new_data,found+strlen(deleted)); + } + dict->data=(void*)(new_data); + free(data); + dict->flag1=1; + return 1; + } else return 0; +} + +/**yon_config_get_by_key(char *key) + * [EN] + * + * [RU] + * Возвращает значение параметра конфига с ключом [key] +*/ +void *yon_config_get_by_key(char *key){ + check_config{ + dictionary *dict = NULL; + for_dictionaries(dict, __yon__config__strings){ + if (strcmp(dict->key,key)==0){ + return dict->data; + } + } + } + return NULL; +} + +/**yon_config_get_key_by_data(char *data) + * [EN] + * + * [RU] + * Возвращает ключ параметра конфига со значением [data]. + * Если параметр с таким значением не найден, возвращается NULL +*/ +char *yon_config_get_key_by_data(char *data){ + check_config{ + dictionary *dict = NULL; + for_dictionaries(dict, __yon__config__strings){ + if (strcmp(((char*)dict->data),data)==0){ + return dict->key; + } + } + } + return NULL; +} + +/**yon_config_set(char *key, void *data) + * [EN] + * + * [RU] + * Производит поиск по конфигу и заменяет значение параметра с ключом [key] на новое значение [data]; +*/ +int yon_config_set(char *key, void *data){ + check_config{ + dictionary *dict = yon_dictionary_get(&__yon__config__strings,key); + dict->data=data; + return 1; + } else return 0; +} + +/**yon_config_clean() + * [EN] + * Erase all parameters from config; + * [RU] + * Удаляет все параметры из конфига; +*/ +int yon_config_clean(){ + check_config{ + __yon__config__strings = yon_dictionary_free_all(__yon__config__strings, NULL); + return 1; + } + else return 0; +} + +/**yon_config_register(char *key, void *data) + * [EN] + * + * [RU] + * Регистрирует новый параметр конфига. + * [key] - ключ параметра; + * [data] - значение параметра; +*/ +void yon_config_register(char *key, void *data){ + yon_dictionary_add_or_create_if_exists_with_data(__yon__config__strings,key,data); + __yon__config__strings->data_type=DICTIONARY_CHAR_TYPE; +} + +/**yon_config_load(char *command, int *str_len) + * [EN] + * + * [RU] + * Выполняет команду [command] и возвращает распаршеный результат выполнения команды. + * В [str_len] возвращается длина возвращаемого массива +*/ +config_str yon_config_load(char *command, int *str_len){ + FILE *output = popen(command, "r"); + char **output_strings = NULL; + output_strings = malloc(sizeof(char)); + int i = 0; + char str[4096]; + memset(str, 0, 4096); + while (fgets(str, 4096, output)) + { + if (strcmp(str, "") != 0) + { + output_strings = realloc(output_strings, sizeof(char *) * (i + 1)); + // printf("%s\n", str); + output_strings[i] = NULL; + output_strings[i] = yon_char_new(str); + memset(str, 0, 4096); + i++; + } + } + if (i>0){ + *str_len = i; + return output_strings; + } else{ + *str_len=-1; + return NULL; + } +} + +/**int yon_config_save(char *command) + * [EN] + * Saves config with [command] + * [RU] + * Выполняет команду [command], добавляя в конец все записи конфига в таком виде: + * [ПАРАМЕТР1]="[значения1]" [ПАРАМЕТР2]="[значения2]" +*/ +int yon_config_save_registered(char *command){ + check_config{ + dictionary *dict = NULL; + for_dictionaries(dict,__yon__config__strings){ + command = yon_char_unite(command, " ", yon_dictionary_get_data(dict,char*), NULL); + } + if (popen(command, "r")) return 1; + else return 0; + } else return 0; +} + +/**yon_config_get_all(int *size) + * [EN] + * + * [RU] + * Возвращает массив со всеми параметрами конфига, оканчивающаяся NULL + * [size] - указатель, в который выгружается длина массива +*/ +config_str yon_config_get_all(int *size){ + check_config{ + *size = 1; + config_str conf = NULL; + dictionary *dict = NULL; + for_dictionaries(dict,__yon__config__strings){ + conf = yon_remalloc(conf,sizeof(char*)*(*size)); + conf[(*size)-1] = yon_char_unite(dict->key,"=",(char*)dict->data,NULL); + size++; + } + conf = yon_remalloc(conf,sizeof(char*)*(*size+1)); + conf[*size] = NULL; + return conf; + } else return NULL; +} + +/**char *yon_config_get_parameter(config parameters, int size, char *param) + * [EN] + * Gets parameter [param] from parameter list [parameters] of size [size]; + * or NULL if nothing were found + * [RU] + * Возвращает параметр [param] из массива строк [parameters] размером [size] + * или NULL если такой не был найден +*/ +char *yon_config_get_parameter(config_str parameters, int size, char *param) +{ + if (param[0]==' ') + yon_char_divide_search(param," ",-1); + param=yon_char_divide_search(yon_char_new(param)," ",-1); + + char *str = NULL; + for (int j = 0; j < size; j++) + { + char *name = yon_char_divide_search(yon_char_new(parameters[j]), "=", 1); + if (name) + { + if (strcmp(name, param) == 0) + { + str = yon_char_divide_search(yon_char_new(parameters[j]), "\n", 1); + if (strcmp(str, "") != 0 && strcmp(str, "(null)") != 0) + return str; + else + return NULL; + } + } + } + return NULL; +} + + + +// terminal-using functions + +/**yon_launch_app_with_arguments(char *name, char *args) + * [EN] + * Execute [command] in separate thread; + * [RU] + * Выполнить команду [command] в отдельном потоке; +*/ +int yon_launch_app_with_arguments(char *name, char *args) +{ + char *path = yon_char_unite("/usr/bin/", name, " ", args,NULL); + pthread_t thread_id; + char *command = NULL; + command = path; + pthread_create(&thread_id, NULL, (void *)yon_launch, command); +}; + +/**yon_launch(char *command) + * [EN] + * Execute command [command] + * [RU] + * Выполнить команду [command] +*/ +void yon_launch(char *command) +{ + system(command); +} + +// Gtk functions + + +#ifdef __GTK_H__ + + +static render_data render; + +#ifdef VTE_TERMINAL + +static void child_ready(VteTerminal *terminal, GPid pid, GError *error, gpointer user_data) +{ + if (!terminal) return; + if (pid == -1) printf("Error\n\n\n"); + else vte_terminal_feed_child(VTE_TERMINAL(terminal),(char*)user_data,strlen((char*)user_data)); +} + +/** + * void yon_terminal_integrated_launch(GtkWidget *place_to_show, void *endwork_function, void* endwork_function_argument) + * [EN] + * launches terminal with specific [command], + * terminal is shown in [place_to_show] container, + * after terminal done its work [endwork_function] is called with [endwork_function_argument] argument. + * [RU] + * Запускает терминал с командой [command], + * терминал добавляется в контейнер [place_to_show] виджета, + * после завершения работы терминала вызывается функция [endwork_function] с аргументом [endwork_function_argument]. +*/ +void yon_terminal_integrated_launch(GtkWidget *place_to_show, char* command, void *endwork_function, void* endwork_function_argument){ + char **commands=new_arr(char*,2); + gchar **envp = g_get_environ(); + commands[0]=(gchar *)g_strdup(g_environ_getenv(envp, "SHELL")); + commands[1]=NULL; + char **env=new_arr(char*,2); + env[0]=""; + env[1]=NULL; + GtkWidget *terminal = vte_terminal_new(); + vte_terminal_set_size(VTE_TERMINAL(terminal),10,15); + VtePty *pty = vte_pty_new_sync(VTE_PTY_DEFAULT,NULL,NULL); + vte_terminal_set_pty(VTE_TERMINAL(terminal),pty); + gtk_container_add(GTK_CONTAINER(place_to_show),terminal); + char *install_command=yon_char_unite("tput cup 0 0 && tput ed; ",command," ; sleep 5;exit 0","\n",NULL); + printf("%s\n",install_command); + if(endwork_function) + g_signal_connect(G_OBJECT(terminal), "child-exited", G_CALLBACK(endwork_function), endwork_function_argument); + vte_terminal_spawn_async(VTE_TERMINAL(terminal), + VTE_PTY_DEFAULT, + NULL, + commands, + NULL, + 0, + NULL, NULL, + NULL, + -1, + NULL, + child_ready, + install_command); + vte_pty_spawn_async(pty, + NULL, + commands, + NULL, + 0, + NULL, NULL, + NULL, + -1, + NULL, + NULL, + NULL); + vte_terminal_set_scrollback_lines(VTE_TERMINAL(terminal), -1); + vte_terminal_set_scroll_on_output(VTE_TERMINAL(terminal), TRUE); + vte_terminal_set_scroll_on_keystroke(VTE_TERMINAL(terminal), TRUE); + gtk_widget_show_all(terminal); + } + +/**yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *endwork_function, void* endwork_function_argument) + * [EN] + * launches terminal with specific [command], + * terminal is shown in [place_to_show] container, + * after terminal done its work [endwork_function] is called with [endwork_function_argument] argument. + * [RU] + * Запускает терминал с командой [command], + * терминал добавляется в контейнер [place_to_show] виджета, + * после завершения работы терминала вызывается функция [endwork_function] с аргументом [endwork_function_argument]. +*/ +void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *endwork_function, void* endwork_function_argument){ + char **commands=new_arr(char*,2); + gchar **envp = g_get_environ(); + commands[0]=(gchar *)g_strdup(g_environ_getenv(envp, "SHELL")); + commands[1]=NULL; + char **env=new_arr(char*,2); + env[0]=""; + env[1]=NULL; + vte_terminal_set_size(VTE_TERMINAL(terminal),10,15); + VtePty *pty = vte_pty_new_sync(VTE_PTY_DEFAULT,NULL,NULL); + vte_terminal_set_pty(VTE_TERMINAL(terminal),pty); + char *install_command=yon_char_unite("tput cup 0 0 && tput ed; ",command," ; sleep 5;exit 0","\n",NULL); + if(endwork_function) + g_signal_connect(G_OBJECT(terminal), "child-exited", G_CALLBACK(endwork_function), endwork_function_argument); + vte_terminal_spawn_async(VTE_TERMINAL(terminal), + VTE_PTY_DEFAULT, + NULL, + commands, + NULL, + 0, + NULL, NULL, + NULL, + -1, + NULL, + child_ready, + install_command); + vte_pty_spawn_async(pty, + NULL, + commands, + NULL, + 0, + NULL, NULL, + NULL, + -1, + NULL, + NULL, + NULL); + vte_terminal_set_scrollback_lines(VTE_TERMINAL(terminal), 100); + vte_terminal_set_scroll_on_output(VTE_TERMINAL(terminal), TRUE); + vte_terminal_set_scroll_on_keystroke(VTE_TERMINAL(terminal), TRUE); + gtk_widget_show_all(terminal); + } +#endif + + // Window config functions + + #define check_window_config_setup if(__yon_window_config_target_window) + + typedef struct { + char *parameter_name; + enum YON_TYPE containing_type; + GtkWidget *track_widget; + char *property_name; + } __yon_listener_parameter; + + typedef struct { + char *parameter_name; + char *section; + enum YON_TYPE containing_type; + void *property; + } __yon_custom_parameter; + + struct { + int x; + int y; + int width; + int height; + int fullscreen; + dictionary *custom_listeners; + dictionary *custom_parameters; + dictionary *deleted_parameters; + } __yon_main_window_config; + + static GtkWindow *__yon_window_config_target_window = NULL; + static GKeyFile *__yon_window_config_file = NULL; + static char *__yon_window_config_path = NULL; + + void yon_window_config_save(){ + g_key_file_set_integer(__yon_window_config_file,"window","WindowPosX",__yon_main_window_config.x); + g_key_file_set_integer(__yon_window_config_file,"window","WindowPosY",__yon_main_window_config.y); + g_key_file_set_integer(__yon_window_config_file,"window","WindowWidth",__yon_main_window_config.width); + g_key_file_set_integer(__yon_window_config_file,"window","WindowHeight",__yon_main_window_config.height); + g_key_file_set_integer(__yon_window_config_file,"window","fullscreen",__yon_main_window_config.fullscreen); + dictionary *dict=NULL; + if (__yon_main_window_config.custom_listeners) + for_dictionaries(dict,__yon_main_window_config.custom_listeners){ + __yon_listener_parameter *param = yon_dictionary_get_data(dict,__yon_listener_parameter*); + GValue *val = g_malloc0(sizeof(GValue)); + g_object_get_property(G_OBJECT(param->track_widget),param->property_name,val); + switch(param->containing_type){ + case YON_TYPE_STRING: + g_key_file_set_string(__yon_window_config_file,"window",param->parameter_name, g_value_get_string(val)); + break; + case YON_TYPE_INT: + g_key_file_set_integer(__yon_window_config_file,"window",param->parameter_name, g_value_get_int(val)); + break; + case YON_TYPE_BOOLEAN: + g_key_file_set_boolean(__yon_window_config_file,"window",param->parameter_name, g_value_get_boolean(val)); + break; + case YON_TYPE_OTHER:printf("\033[0;31mCannot save %s property with %s key\033[0m\n",param->property_name,param->parameter_name);break; + } + } + if (__yon_main_window_config.custom_parameters) + for_dictionaries(dict,__yon_main_window_config.custom_parameters){ + __yon_custom_parameter *param = yon_dictionary_get_data(dict,__yon_custom_parameter*); + switch (param->containing_type){ + case YON_TYPE_STRING: + g_key_file_set_string(__yon_window_config_file,param->section,param->parameter_name, (char*)param->property); + break; + case YON_TYPE_INT: + g_key_file_set_integer(__yon_window_config_file,param->section,param->parameter_name, *(int*)param->property); + break; + case YON_TYPE_BOOLEAN: + g_key_file_set_boolean(__yon_window_config_file,param->section,param->parameter_name, *(gboolean*)param->property); + break; + default: + break; + } + } + if (__yon_main_window_config.deleted_parameters) + for_dictionaries(dict,__yon_main_window_config.deleted_parameters){ + __yon_custom_parameter *param = yon_dictionary_get_data(dict,__yon_custom_parameter*); + g_key_file_remove_key(__yon_window_config_file,param->section,param->parameter_name,NULL); + } + g_key_file_save_to_file(__yon_window_config_file,__yon_window_config_path,NULL); + } + + void yon_get_is_fullscreen(){ + gtk_window_is_maximized(__yon_window_config_target_window); + __yon_main_window_config.fullscreen = gtk_window_is_maximized(__yon_window_config_target_window); + if (!__yon_main_window_config.fullscreen) gtk_window_get_position(__yon_window_config_target_window,&__yon_main_window_config.x,&__yon_main_window_config.y); + } + + /**yon_on_configured_window_destroy(GtkWidget* self,GdkEvent* event) + * [EN] + * + * [RU] + * Сохраняет настройки основного окна. Вызывается когда основное окно уничтожается. + */ + void yon_on_configured_window_destroy(GtkWidget* self,GdkEvent* event){ + check_window_config_setup{ + yon_get_is_fullscreen(); + yon_window_config_save(); + } + gtk_main_quit(); + } + + void __yon_window_config_on_resize(){ + int max=0; + max=gtk_window_is_maximized(__yon_window_config_target_window); + if(max==0){ + gtk_window_get_size(__yon_window_config_target_window,&__yon_main_window_config.width,&__yon_main_window_config.height); + gtk_window_get_position(__yon_window_config_target_window,&__yon_main_window_config.x,&__yon_main_window_config.y); + } + } + + /**yon_window_config_setup(GtkWindow *window) + * [EN] + * + * [RU] + * Устанавливает указатель на окно для отслеживания его положения и размера + */ + void yon_window_config_setup(GtkWindow *window){ + __yon_window_config_target_window = window; + g_signal_connect(G_OBJECT(window),"delete-event",G_CALLBACK(yon_on_configured_window_destroy),NULL); + g_signal_connect(G_OBJECT(window),"check-resize"/*"configure-event"*/,G_CALLBACK(__yon_window_config_on_resize),NULL); + } + + void _yon_maximize(void *data){ + g_usleep(G_USEC_PER_SEC/10); + if(__yon_main_window_config.fullscreen ==1) gtk_window_maximize(__yon_window_config_target_window); + } + + /**yon_window_config_load(char *path) + * [EN] + * + * [RU] + * Загружает конфиг окна и инициализирует отслеживание его параметров + */ + int yon_window_config_load(char *path){ + __yon_window_config_file = g_key_file_new(); + __yon_window_config_path=yon_char_new(path); + if (!g_key_file_load_from_file(__yon_window_config_file,__yon_window_config_path,G_KEY_FILE_NONE,NULL)){ + struct stat st; + int size; + config_str conf = yon_char_parse(yon_char_new(__yon_window_config_path),&size,"/"); + char *path = yon_char_unite(conf[0],"/",conf[1],"/",conf[2],"/",conf[3],"/",conf[4],"/",NULL); + if (stat(path, &st) == -1) { + mkdir(path, 0777); + } + FILE *fp; + fp=fopen(__yon_window_config_path,"w"); + fclose(fp); + g_key_file_load_from_file(__yon_window_config_file,__yon_window_config_path,G_KEY_FILE_NONE,NULL); + } + __yon_main_window_config.x = g_key_file_get_integer(__yon_window_config_file,"window","WindowPosX",NULL); + __yon_main_window_config.y = g_key_file_get_integer(__yon_window_config_file,"window","WindowPosY",NULL); + __yon_main_window_config.width = g_key_file_get_integer(__yon_window_config_file,"window","WindowWidth",NULL); + __yon_main_window_config.height = g_key_file_get_integer(__yon_window_config_file,"window","WindowHeight",NULL); + __yon_main_window_config.fullscreen = g_key_file_get_integer(__yon_window_config_file,"window","fullscreen",NULL); + dictionary *dict=NULL; + if (__yon_main_window_config.custom_listeners) + for_dictionaries(dict,__yon_main_window_config.custom_listeners){ + __yon_listener_parameter *param = yon_dictionary_get_data(dict,__yon_listener_parameter*); + GValue *val = g_malloc0(sizeof(GValue)); + g_object_get_property(G_OBJECT(param->track_widget),param->property_name,val); + switch(param->containing_type){ + case YON_TYPE_STRING: + g_value_set_string(val,g_key_file_get_string(__yon_window_config_file,"window",param->parameter_name, NULL)); + break; + case YON_TYPE_INT: + g_value_set_int(val,g_key_file_get_integer(__yon_window_config_file,"window",param->parameter_name, NULL)); + break; + case YON_TYPE_BOOLEAN: + gboolean res = g_key_file_get_boolean(__yon_window_config_file,"window",param->parameter_name, NULL); + g_value_set_boolean(val,res); + break; + default:printf("\033[0;31mCannot load %s property with %s key\033[0m\n",param->property_name,param->parameter_name);break; + } + g_object_set_property(G_OBJECT(param->track_widget),param->property_name,val); + } + if (__yon_main_window_config.width==0) __yon_main_window_config.width=800; + if (__yon_main_window_config.height==0) __yon_main_window_config.height=600; + gtk_window_resize(__yon_window_config_target_window,__yon_main_window_config.width,__yon_main_window_config.height); + gtk_window_move(__yon_window_config_target_window,__yon_main_window_config.x,__yon_main_window_config.y); + pthread_t tid; + pthread_create(&tid,NULL,(void *)_yon_maximize,NULL); + return 1; + } + + void yon_window_config_apply(){ + dictionary *dict=NULL; + gtk_window_move(__yon_window_config_target_window,__yon_main_window_config.x,__yon_main_window_config.y); + gtk_window_resize(__yon_window_config_target_window,__yon_main_window_config.width,__yon_main_window_config.height); + } + + config_str yon_window_config_get_section(char *section, gsize *size){ + config_str key = g_key_file_get_keys(__yon_window_config_file,section,size,NULL); + return key; + } + + /**yon_window_config_add_listener(GtkWidget *widget, char *param_name, char *widget_property, enum YON_TYPE val_type) + * [EN] + * + * [RU] + * Добавляет параметр виджета [widget] по названию [widget_property] для отслеживания и сохраняет его в конфиг под ключом [param_name]. + */ + void yon_window_config_add_listener(GtkWidget *widget, char *param_name, char *widget_property, enum YON_TYPE val_type){ + __yon_listener_parameter *param = NULL; + param = yon_remalloc(param,sizeof(__yon_listener_parameter)); + param->parameter_name = yon_char_new(param_name); + param->track_widget = widget; + param->property_name = yon_char_new(widget_property); + param->containing_type = val_type; + yon_dictionary_add_or_create_if_exists_with_data(__yon_main_window_config.custom_listeners,param->parameter_name,param); + } + + void yon_window_config_add_custom_parameter(char *param_name, char *section, void *tracked_value, enum YON_TYPE val_type){ + __yon_custom_parameter *param = NULL; + param = yon_remalloc(param,sizeof(__yon_custom_parameter)); + param->parameter_name = yon_char_new(param_name); + param->section=section; + param->property = tracked_value; + param->containing_type = val_type; + yon_dictionary_add_or_create_if_exists_with_data(__yon_main_window_config.custom_parameters,param->parameter_name,param); + } + + void yon_window_config_erase_custom_parameter(char *param_name, char *section){ + __yon_custom_parameter *param = NULL; + param = yon_remalloc(param,sizeof(__yon_custom_parameter)); + param->parameter_name=param_name; + param->section=section; + yon_dictionary_add_or_create_if_exists_with_data(__yon_main_window_config.deleted_parameters,param->parameter_name,param); + } + + int yon_window_config_get_parameter(char *section, char *config_parameter, void *return_value, enum YON_TYPE type){ + GError *err=NULL; + switch (type){ + case YON_TYPE_BOOLEAN: + *((int*)return_value) = g_key_file_get_boolean(__yon_window_config_file,section,config_parameter,&err); + if (err) return 0; else return 1; + break; + case YON_TYPE_INT: + *((int*)return_value) = g_key_file_get_integer(__yon_window_config_file,section,config_parameter,&err); + if (err) return 0; else return 1; + break; + case YON_TYPE_STRING: + *((char**)return_value) = g_key_file_get_string(__yon_window_config_file,section,config_parameter,&err); + if (err) return 0; else return 1; + break; + case YON_TYPE_STRING_LIST: + gsize size=0; + *((char***)return_value) = g_key_file_get_string_list(__yon_window_config_file,section,config_parameter,&size,&err); + *((char***)return_value)=yon_remalloc(return_value,size+1); + *((char***)return_value)[size]=NULL; + if (err) return 0; else return 1; + break; + } + } + +GtkWidget *yon_ubl_menu_item_about_new(char *buttonname){ + GtkWidget *menu_item = gtk_menu_item_new(); + gtk_style_context_add_class(gtk_widget_get_style_context(menu_item),"menuitembottom"); + GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); + GtkWidget *label = gtk_label_new(buttonname); + GtkWidget *image = gtk_image_new_from_icon_name("dialog-information-symbolic",GTK_ICON_SIZE_BUTTON); + gtk_label_set_xalign(GTK_LABEL(label),0.0); + gtk_box_pack_start(GTK_BOX(box),image,0,0,5); + gtk_box_pack_start(GTK_BOX(box),label,0,0,5); + gtk_container_add(GTK_CONTAINER(menu_item),box); + gtk_widget_show_all(menu_item); + return menu_item; +} + +GtkWidget *yon_ubl_menu_item_documentation_new(char *buttonname){ + GtkWidget *menu_item = gtk_menu_item_new(); + gtk_style_context_add_class(gtk_widget_get_style_context(menu_item),"menuitemtop"); + GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); + GtkWidget *label = gtk_label_new(buttonname); + GtkWidget *image = gtk_image_new_from_icon_name("dialog-question-symbolic",GTK_ICON_SIZE_BUTTON); + gtk_label_set_xalign(GTK_LABEL(label),0.0); + gtk_box_pack_start(GTK_BOX(box),image,0,0,5); + gtk_box_pack_start(GTK_BOX(box),label,0,0,5); + gtk_container_add(GTK_CONTAINER(menu_item),box); + gtk_widget_show_all(menu_item); + return menu_item; +} + + +// other Gtk functions + +/**yon_gtk_combo_box_text_fill(GtkWidget *combo, config_str parameters,int size) + * [EN] + * + * [RU] + * Добавляет в Комбобокс [combo] все строки из массива строк [parameters] размера [size] +*/ +int yon_gtk_combo_box_text_fill(GtkWidget *combo, config_str parameters,int size){ + if (combo&¶meters){ + for (int i=0;imessage); + g_error_free(err); + } + if (type == BACKGROUND_IMAGE_SUCCESS_TYPE||! type) + { + gtk_style_context_remove_class(gtk_widget_get_style_context(data.box), "boxInfoMessError"); + gtk_style_context_add_class(gtk_widget_get_style_context(data.box), "boxInfoMessOK"); + gtk_image_set_from_pixbuf(GTK_IMAGE(data.icon), gtk_icon_theme_load_icon_for_scale(ictheme, "com.ublinux.ubl-settings-video.checked", 25, 1, GTK_ICON_LOOKUP_FORCE_SIZE, &err)); + } + else if (type == BACKGROUND_IMAGE_FAIL_TYPE) + { + gtk_style_context_remove_class(gtk_widget_get_style_context(data.box), "boxInfoMessOK"); + gtk_style_context_add_class(gtk_widget_get_style_context(data.box), "boxInfoMessError"); + gtk_image_set_from_pixbuf(GTK_IMAGE(data.icon), gtk_icon_theme_load_icon_for_scale(ictheme, "com.ublinux.ubl-settings-video.warning", 25, 1, GTK_ICON_LOOKUP_FORCE_SIZE, &err)); + } + if (text) + gtk_label_set_text(GTK_LABEL(data.label), text); +} + +void yon_ubl_status_box_render(char *text, BACKGROUND_IMAGE_TYPE type){ + _yon_ubl_status_box_render(text,type); +} + +/**yon_ubl_setup_sockets(GtkWidget *main_window, GtkWidget *left_window, GtkWidget *right_window, int socket_main_id, int socket_left_id, int socket_right_id) + * [EN] + * Set up plugs for using with GtkSockets insine ubl-settings-manager. + * [main_window] is container widget, which holds main application functionality. + * [left_window] is container widget, which holds widgets, have to be shown at left part of ubl-settings-manager header. + * [right_window] is container widget, which holds widgets, have to be shown at right part of ubl-settings-manager header. + * [socket_main_id] is id of socket for [main_window]. + * [socket_left_id] is id of socket for [left_window]. + * [socket_right_id] is id of socket for [right_window]. + * [RU] + * Настраивает плаги для работы с сокетами в утилите ubl-settings-manager. + * [main_window] - контейнер основного интерфейса приложения. + * [left_window] - контейнер для виджетов которые должны отображаться в левой части шапки ubl-settings-manager. + * [right_window] - контейнер для виджетов которые должны отображаться в правой части шапки ubl-settings-manager. + * [socket_main_id] - id сокета для [main_window]. + * [socket_left_id] - id сокета для [left_window]. + * [socket_right_id] - id сокета для [right_window]. +*/ +void yon_ubl_setup_sockets(GtkWidget *main_window, GtkWidget *left_window, GtkWidget *right_window, int socket_main_id, int socket_left_id, int socket_right_id){ + if (main_window&&socket_main_id>-1){ + gtk_widget_hide(gtk_widget_get_toplevel(main_window)); + GtkWidget *plug_main=gtk_plug_new(socket_main_id); + GtkWidget *plug_left=NULL; + GtkWidget *plug_right=NULL; + GtkWidget *box=NULL; + g_signal_connect(G_OBJECT(plug_main), "destroy", G_CALLBACK(gtk_main_quit),NULL); + if (socket_left_id>-1&&left_window){ + plug_left=gtk_plug_new(socket_left_id); + g_object_ref(left_window); + gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(left_window)),left_window); + gtk_container_add(GTK_CONTAINER(plug_left),left_window); + gtk_style_context_add_class(gtk_widget_get_style_context(plug_left),"primary-toolbar"); + gtk_style_context_add_class(gtk_widget_get_style_context(left_window),"button"); + gtk_style_context_add_class(gtk_widget_get_style_context(left_window),"opacited"); + gtk_style_context_add_class(gtk_widget_get_style_context(left_window),"color"); + gtk_style_context_add_class(gtk_widget_get_style_context(plug_left),"noborder"); + gtk_widget_show(plug_left); + } + else if (left_window){ + if (box==NULL){ + box=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5); + gtk_box_pack_start(GTK_BOX(main_window),box,0,0,5); + gtk_box_reorder_child(GTK_BOX(main_window),box,0); + gtk_widget_show(box); + } + gtk_style_context_add_class(gtk_widget_get_style_context(left_window),"inherited"); + gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(left_window)),left_window); + gtk_box_pack_end(GTK_BOX(box),left_window,0,0,5); + } + if (socket_right_id>-1&&right_window){ + plug_right=gtk_plug_new(socket_right_id); + g_object_ref(right_window); + gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(right_window)),right_window); + gtk_container_add(GTK_CONTAINER(plug_right),right_window); + gtk_style_context_add_class(gtk_widget_get_style_context(plug_right),"primary-toolbar"); + gtk_style_context_add_class(gtk_widget_get_style_context(right_window),"button"); + gtk_style_context_add_class(gtk_widget_get_style_context(right_window),"opacited"); + gtk_style_context_add_class(gtk_widget_get_style_context(right_window),"color"); + gtk_style_context_add_class(gtk_widget_get_style_context(plug_right),"noborder"); + gtk_widget_show(plug_right); + } + else if (right_window){ + if (box==NULL){ + box=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5); + gtk_box_pack_start(GTK_BOX(main_window),box,0,0,5); + gtk_box_reorder_child(GTK_BOX(main_window),box,0); + gtk_widget_show(box); + } + gtk_style_context_add_class(gtk_widget_get_style_context(right_window),"inherited"); + gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(right_window)),right_window); + gtk_box_pack_start(GTK_BOX(box),right_window,0,0,5); + } + g_object_ref(main_window); + gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(main_window)),main_window); + gtk_container_add(GTK_CONTAINER(plug_main),main_window); + gtk_widget_show(plug_main); + } +} + +#ifdef WEBKIT_FOUND + +/**yon_ubl_browser_window_open(char *link, char *browser_window_name) + * [EN] + * Launches integrated browser window, named [browser_window_name] at header with [link]. + * [RU] + * Открывает встроенный браузер с именем [browser_window_name] и показываемой страницей по ссылке [link] +*/ +void yon_ubl_browser_window_open(char *link, char *browser_window_name){ + GtkWidget *browser=gtk_window_new(GTK_WINDOW_TOPLEVEL); + GtkWidget *web_place=gtk_box_new(GTK_ORIENTATION_VERTICAL,0); + GtkWidget *header=gtk_header_bar_new(); + GtkWidget *header_label=gtk_label_new(browser_window_name); + GtkWidget *WebView=webkit_web_view_new(); + gtk_container_add(GTK_CONTAINER(browser),web_place); + gtk_window_set_titlebar(GTK_WINDOW(browser),header); + gtk_window_set_title(GTK_WINDOW(browser),browser_window_name); + gtk_widget_set_size_request(browser,800,600); + gtk_header_bar_set_custom_title(GTK_HEADER_BAR(header),header_label); + gtk_header_bar_set_show_close_button(GTK_HEADER_BAR(header),1); + webkit_web_view_load_uri(WEBKIT_WEB_VIEW(WebView),link); + gtk_box_pack_start(GTK_BOX(web_place),WebView,1,1,0); + gtk_widget_show_all(browser); +} +#else + +/**yon_ubl_browser_window_open(char *link, char *browser_window_name) + * [EN] + * Launches browser with [link]. + * [browser_window_name] is't used. It's needed for compatibility with webkit version of that function. + * [RU] + * Открывает браузер со страницей по ссылке [link] + * [browser_window_name] не используется. Нужна для совместимости с webkit версией этой функции. +*/ +void yon_ubl_browser_window_open(char *link, char *browser_window_name){ + char *user=getenv("SUDO_USER"); + if (!user) + user=getlogin(); + char *command=yon_char_unite("sudo -u ",user," xdg-open ", link,NULL); + yon_launch_app(command); +} +#endif + +#endif diff --git a/source/model/ubl-utils.h b/source/model/ubl-utils.h new file mode 100644 index 0000000..b956787 --- /dev/null +++ b/source/model/ubl-utils.h @@ -0,0 +1,368 @@ +#ifndef UBL_UTILS +#define UBL_UTILS +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#define try bool __HadError=false; +#define catch(x) ExitJmp:if(__HadError) +#define throw(x) {__HadError=true;goto ExitJmp;} + +#include "../../compile/ubl-cmake.h" +#ifdef WEBKIT_FOUND + #include +#endif +#define DesktopPath "/usr/share/applications/" + +#define for_dictionaries(obj, obj1) for (obj = obj1->first; obj != NULL; obj = obj->next) + +#define new(type) malloc(sizeof(type)) +#define new_arr(type,size) malloc(sizeof(type)*size) + +#define get_home_dir_command yon_char_unite("getent passwd \"",yon_ubl_root_user_get(),"\" | cut -d: -f6",NULL) + +typedef enum +{ + #ifdef __GTK_H__ + DICTIONARY_GTK_WIDGETS_TYPE, + #endif + DICTIONARY_OTHER_TYPE=0, + DICTIONARY_CHAR_TYPE, + DICTIONARY_INT_TYPE, + DICTIONARY_BOOL_TYPE, + +} DICT_TYPE; + +typedef struct dictionary +{ + char *key; + void *data; + struct dictionary *next; + struct dictionary *prev; + struct dictionary *first; + DICT_TYPE data_type; + int flag1; +} dictionary; + +typedef struct apps +{ + char *Name; + int Type; + char *Categories; + char *Exec; + char *Icon; + int Pluggable; + int DualPluggable; +} apps; + +typedef char** config_str; + +static dictionary *__yon__config__strings = NULL; +#define check_config if(__yon__config__strings&&__yon__config__strings->data_type==DICTIONARY_CHAR_TYPE) + +#define config(key) yon_config_get_by_key(key) + +#define for_config dictionary temp = NULL; for_dictionary(temp,__yon__config__strings) + +#define yon_remalloc(pointer, size) (!pointer) ? malloc(size) : realloc(pointer, size) +// dictionary functions + +/**yon_dictionary_get_data(dictionary, type) + * [EN] + * Gets data from dictionary. + * [dictionary] is dictionary, from which data should be extracted; + * [type] is type of data, [dictionary] contains. + * [RU] + * Возвращает данные из словаря. + * [dictionary] - словарь из которого достаются данные. + * [type] - тип данных, хранящихся в словаре [dictionary]. +*/ +#define yon_dictionary_get_data(dictionary, type) ((type)dictionary->data) + +/**yon_dictionary_add_or_create_if_exists_with_data(dict,key,data) + * [EN] + * + * [RU] + * Добавляет элемент словаря в конец словаря [dict] c ключом [key] и данными [data]. + * Если словарь не существует, создаёт его +*/ +#define yon_dictionary_add_or_create_if_exists_with_data(dict,key,data) {if (!dict) dict=yon_dictionary_new_with_data(key,data); \ + else dict=yon_dictionary_append_with_data(dict,key,data);} + +dictionary *yon_dictionary_new(); + +dictionary *yon_dictionary_append(dictionary *targetdict); + +dictionary *yon_dictionary_get_last(dictionary *dict); + +dictionary *yon_dictionary_swap(dictionary *dict, int aim); + +void yon_dictionary_make_first(dictionary *dict); + +void yon_dictionary_make_nth(dictionary *dict, int nth); + +dictionary *yon_dictionary_new_with_data(char *key, void *data); + +dictionary *yon_dictionary_append_with_data(dictionary *dict, char *key, void *data); + +dictionary *yon_dictionary_connect(dictionary *old, dictionary *toconnect); + +dictionary *yon_dictionary_get(dictionary **dict, char *key); + +dictionary *yon_dictionary_rip(dictionary *dict); + +dictionary *yon_dictionary_get_nth(dictionary *dict, int place); + +void *yon_dictionary_free_all(dictionary *dictionary,void (data_manipulation)(void*)); + +// char functions + +int yon_char_find_last(char *source, char find); + +char *yon_char_append(char *source, char *append); + +char *yon_char_new(char *chr); + +char *yon_char_unite(char *source, ...); + +char *yon_cut(char *source, int size, int startpos); + +char *yon_char_divide(char *source, int dividepos); + +char *yon_char_divide_search(char *source, char *dividepos, int delete_divider); + +char *yon_char_from_int(int int_to_convert); + +char *yon_char_replace(char *source, char *find, char*replace); + +char **yon_char_parse(char *parameters, int *size, char *divider); + +char **yon_char_parsed_rip(char **char_string, int *size, int item_to_delete); + +int yon_char_parsed_check_exist(char **parameters, int size, char *param); + +int yon_char_find_count(char *source, char *find); + +int yon_char_parsed_includes_char_parsed (config_str source, config_str to_check, int source_size, int check_size); + +config_str yon_char_parsed_new (int *size, ...); + +void yon_char_parsed_copy(config_str *source, config_str *to_copy); + +config_str yon_char_parsed_append(config_str parsed, int *size, char *string); + +int yon_ubl_check_root(); + +char *yon_ubl_root_user_get(); + +char *yon_ubl_user_get_home_directory(); + +// parsing functions + +apps *yon_apps_scan_and_parse_desktops(int *sizef); + +void yon_apps_sort(apps *applist, int size); + +apps *yon_apps_get_by_name(apps *applist, char *name, int size); + +config_str yon_config_load(char *command, int *str_len); + +int yon_config_save_registered(char *command); + +char *yon_config_get_parameter(config_str parameters, int size, char *param); + +int yon_config_load_register(char *command); + +int yon_config_remove_by_key(char *key); + +int yon_config_remove_by_data(void *data); + +int yon_config_remove_element(char *key, char *deleted); + +void *yon_config_get_by_key(char *key); + +char *yon_config_get_key_by_data(char *data); + +int yon_config_set(char *key, void *data); + +int yon_config_clean(); + +void yon_config_register(char *key, void *data); + +config_str yon_config_get_all(); + +// terminal-using functions + +int yon_launch_app_with_arguments(char *name, char *args); + +void yon_launch(char *command); + +// Gtk functions + +#ifdef __GTK_H__ +#ifdef VTE_TERMINAL +void yon_terminal_integrated_launch(GtkWidget *place_to_show, char* command, void *endwork_function, void* endwork_function_argument); + +void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *endwork_function, void* endwork_function_argument); + +#endif + +enum YON_TYPE{ + YON_TYPE_STRING, + YON_TYPE_INT, + YON_TYPE_STRING_LIST, + YON_TYPE_BOOLEAN, + YON_TYPE_OTHER +}; + +GtkWidget *yon_ubl_menu_item_about_new(char *buttonname); +GtkWidget *yon_ubl_menu_item_documentation_new(char *buttonname); + +/**yon_gtk_builder_get_widget(builder, widget_name) + * [EN] + * Returns GtkWidget from GtkBuilder *[builder]. + * [builder] is GtkBuilder*; + * [widget_name] is id of widget; +*/ +#define yon_gtk_builder_get_widget(builder, widget_name) GTK_WIDGET(gtk_builder_get_object(builder, widget_name)) + +typedef struct +{ + GtkWidget *Icon; + GtkWidget *Label; + GtkWidget *IconView; + GtkListStore *List; +} expander_icon_view; + +void yon_window_config_setup(GtkWindow *window); + +int yon_window_config_load(char *path); + +config_str yon_window_config_get_section(char *section, gsize *size); + +void yon_window_config_add_listener(GtkWidget *widget, char *param_name, char *widget_property, enum YON_TYPE val_type); + +void yon_window_config_add_custom_parameter(char *param_name, char *section, void *tracked_value, enum YON_TYPE val_type); + +void yon_window_config_erase_custom_parameter(char *param_name, char *section); + +int yon_window_config_get_parameter(char *section, char *config_parameter, void *return_value, enum YON_TYPE type); + +int yon_gtk_combo_box_fill(GtkWidget *combo, char **parameters,int size); + +int yon_gtk_combo_box_text_find(GtkWidget *combo_box, char *text_to_find); + +int yon_gtk_icon_view_hide_empty(dictionary *icon_view_segment); + +int yon_dictionary_gtk_pack_start_multiple_widgets(GtkBox *destination, gboolean expand, gboolean fill, int padding, ...); + +int yon_dictionary_gtk_pack_end_multiple_widgets(GtkBox *destination, gboolean expand, gboolean fill, int padding, ...); + + + +typedef enum +{ + BACKGROUND_IMAGE_SUCCESS_TYPE, + BACKGROUND_IMAGE_FAIL_TYPE +} BACKGROUND_IMAGE_TYPE; + +typedef struct { + BACKGROUND_IMAGE_TYPE type; + GtkWidget *icon; + GtkWidget *box; + GtkWidget *label; + char* text_to_render; +} render_data; + + +/**yon_ubl_status_box_setup(render,icon,box,label) + * [EN] + * Sets up [render] structure of type render_data. + * [icon] is GtkImage widget of status box for showing status icons; + * [box] is GtkBox widget of status box for showing status color; + * [label] is GtkLabel widget of status box for showing status text; + * [RU] + * Настраивает структуру [render] типа render_data. + * [icon] - виджет типа GtkIcon в котором будут отображаться статусные иконки; + * [box] - виджет типа GtkBox в котором будет отображаться цвет статуса; + * [label] - виджет типа GtkLabel в котором будет отображаться текст статусного сообщения; +*/ +int yon_ubl_status_box_setup(GtkWidget *icon, GtkWidget *box, GtkWidget *label); + +/**yon_ubl_status_box_render(render,text,type) + * [EN] + * Renders message in status box; + * [render] is render_data structure of status box; + * [text] is text to be shown in status box; + * [type] if type of message. Can be BACKGROUND_IMAGE_FAIL_TYPE or BACKGROUND_IMAGE_SUCCESS_TYPE + * [RU] + * Отображает сообщение в статусном окне. + * [render] - структура типа render_data для нужного статусного окна; + * [text] - текст, отображаемый в статусном окне; + * [type] - тип сообщения. Может быть: + * BACKGROUND_IMAGE_FAIL_TYPE (красный фон,иконка - восклицательный знак) + * или + * BACKGROUND_IMAGE_SUCCESS_TYPE (Жёлтный фон, иконка - галка) +*/ +void yon_ubl_status_box_render(char *text, BACKGROUND_IMAGE_TYPE type); + +#ifdef __cplusplus + +/**yon_ubl_header_setup(overlay, head, image, imag_path) + * [EN] + * Sets up header of app. + * [overlay] is overlay for app header; + * [head] is box of header, which connects to [overlay] + * [image] is header background image; + * [imag_path] is path of image, shown in [image] + * [RU] + * Настраивает заголовок приложения. + * [overlay] - оверлей заголовка приложения; + * [head] - шапка заголовка, присоединяемая к [overlay] + * [image] - виджет картинки для заднего фона; + * [imag_path] - путь до картинки, загружаемой в [image] +*/ +#define yon_ubl_header_setup(overlay, head, image, imag_path) _yon_ubl_header_setup(GTK_WIDGET(overlay.gobj()), GTK_WIDGET(head.gobj()), GTK_WIDGET(image.gobj()), (char *)imag_path) +#else + +/**yon_ubl_header_setup(overlay, head, image, imag_path) + * [EN] + * Sets up header of app. + * [overlay] is overlay for app header; + * [head] is box of header, which connects to [overlay] + * [image] is header background image; + * [imag_path] is path of image, shown in [image] + * [RU] + * Настраивает заголовок приложения. + * [overlay] - оверлей заголовка приложения; + * [head] - шапка заголовка, присоединяемая к [overlay] + * [image] - виджет картинки для заднего фона; + * [imag_path] - путь до картинки, загружаемой в [image] +*/ +#define yon_ubl_header_setup(overlay, head, image, imag_path) _yon_ubl_header_setup(GTK_WIDGET(overlay), GTK_WIDGET(head), GTK_WIDGET(image), (char *)imag_path) +#define yon_ubl_header_setup_resource(overlay, head, image, imag_path) _yon_ubl_header_setup_resource(GTK_WIDGET(overlay), GTK_WIDGET(head), GTK_WIDGET(image), (char *)imag_path) +#endif + +void _yon_ubl_header_setup(GtkWidget *Overlay, GtkWidget *Head, GtkWidget *Image, char *image_path); + +void _yon_ubl_header_setup_resource(GtkWidget *Overlay, GtkWidget *Head, GtkWidget *Image, char *image_path); + +void yon_ubl_setup_sockets(GtkWidget *main_window, GtkWidget *left_window, GtkWidget *right_window, int socket_main_id, int socket_left_id, int socket_right_id); +#ifdef WEBKIT_FOUND + +void yon_ubl_browser_window_open(char *link, char *browser_window_name); +#else +void yon_ubl_browser_window_open(char *link, char *browser_window_name); +#endif +#endif +#endif diff --git a/source/model/vector.c b/source/model/vector.c new file mode 100644 index 0000000..8e5ac91 --- /dev/null +++ b/source/model/vector.c @@ -0,0 +1,128 @@ +#include "vector.h" + +int vectorTotal(vector *v) +{ + int totalCount = UNDEFINE; + if(v) + { + totalCount = v->vectorList.total; + } + return totalCount; +} +int vectorResize(vector *v, int capacity) +{ + int status = UNDEFINE; + if(v) + { + void **items = realloc(v->vectorList.items, sizeof(void *) * capacity); + if (items) + { + v->vectorList.items = items; + v->vectorList.capacity = capacity; + status = SUCCESS; + } + } + return status; +} +int vectorPushBack(vector *v, void *item) +{ + int status = UNDEFINE; + if(v) + { + if (v->vectorList.capacity == v->vectorList.total) + { + status = vectorResize(v, v->vectorList.capacity * 2); + if(status != UNDEFINE) + { + v->vectorList.items[v->vectorList.total++] = item; + } + } + else + { + v->vectorList.items[v->vectorList.total++] = item; + status = SUCCESS; + } + } + return status; +} +int vectorSet(vector *v, int index, void *item) +{ + int status = UNDEFINE; + if(v) + { + if ((index >= 0) && (index < v->vectorList.total)) + { + v->vectorList.items[index] = item; + status = SUCCESS; + } + } + return status; +} +void *vectorGet(vector *v, int index) +{ + void *readData = NULL; + if(v) + { + if ((index >= 0) && (index < v->vectorList.total)) + { + readData = v->vectorList.items[index]; + } + } + return readData; +} +int vectorDelete(vector *v, int index) +{ + int status = UNDEFINE; + int i = 0; + if(v) + { + if ((index < 0) || (index >= v->vectorList.total)) + return status; + v->vectorList.items[index] = NULL; + for (i = index; (i < v->vectorList.total - 1); ++i) + { + v->vectorList.items[i] = v->vectorList.items[i + 1]; + v->vectorList.items[i + 1] = NULL; + } + v->vectorList.total--; + if ((v->vectorList.total > 0) && ((v->vectorList.total) == (v->vectorList.capacity / 4))) + { + vectorResize(v, v->vectorList.capacity / 2); + } + status = SUCCESS; + } + return status; +} +int vectorFree(vector *v) +{ + int status = UNDEFINE; + if(v) + { + free(v->vectorList.items); + v->vectorList.items = NULL; + status = SUCCESS; + } + return status; +} +void vectorCopy(vector* v_to_copy, vector* v_from_copy) { + for (int i = 0; i < v_from_copy->vectorList.total; i++) { + vectorPushBack(v_to_copy, vectorGet(v_from_copy, i)); + } +} + +void vector_init(vector *v) +{ + //init function pointers + v->pfVectorTotal = vectorTotal; + v->pfVectorResize = vectorResize; + v->pfVectorAdd = vectorPushBack; + v->pfVectorSet = vectorSet; + v->pfVectorGet = vectorGet; + v->pfVectorFree = vectorFree; + v->pfVectorDelete = vectorDelete; + v->pfVectorCopy = vectorCopy; + //initialize the capacity and allocate the memory + v->vectorList.capacity = VECTOR_INIT_CAPACITY; + v->vectorList.total = 0; + v->vectorList.items = malloc(sizeof(void *) * v->vectorList.capacity); +} diff --git a/source/model/vector.h b/source/model/vector.h new file mode 100644 index 0000000..1682777 --- /dev/null +++ b/source/model/vector.h @@ -0,0 +1,40 @@ +#include +#include + +// https://aticleworld.com/implement-vector-in-c/ + +#define VECTOR_INIT_CAPACITY 7 +#define UNDEFINE -1 +#define SUCCESS 0 +//Store and track the stored data +typedef struct sVectorList +{ + void **items; + int capacity; + int total; +} sVectorList; +//structure contain the function pointer +typedef struct sVector vector; +struct sVector +{ + sVectorList vectorList; +//function pointers + int (*pfVectorTotal)(vector *); + int (*pfVectorResize)(vector *, int); + int (*pfVectorAdd)(vector *, void *); + int (*pfVectorSet)(vector *, int, void *); + void *(*pfVectorGet)(vector *, int); + int (*pfVectorDelete)(vector *, int); + int (*pfVectorFree)(vector *); + void (*pfVectorCopy)(vector *,vector *); + +}; +void vector_init(vector *v); +int vectorFree(vector *v); +int vectorDelete(vector *v, int index); +void *vectorGet(vector *v, int index); +int vectorSet(vector *v, int index, void *item); +int vectorPushBack(vector *v, void *item); +int vectorResize(vector *v, int capacity); +int vectorTotal(vector *v); +void vectorCopy(vector* v_to_copy, vector* v_from_copy); \ No newline at end of file diff --git a/source/my_type.h b/source/my_type.h deleted file mode 100644 index 6355b2f..0000000 --- a/source/my_type.h +++ /dev/null @@ -1,79 +0,0 @@ -#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 deleted file mode 100644 index 9bd1546..0000000 --- a/source/project_lib.h +++ /dev/null @@ -1,27 +0,0 @@ -#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 -#include "ubl-settings-diskquota-cm.h" - -#endif \ No newline at end of file diff --git a/source/ubl-cmake.in b/source/ubl-cmake.in new file mode 100644 index 0000000..d4623a7 --- /dev/null +++ b/source/ubl-cmake.in @@ -0,0 +1 @@ +#cmakedefine WEBKIT_FOUND diff --git a/source/ubl-settings-diskquota.c b/source/ubl-settings-diskquota.c new file mode 100644 index 0000000..d8823fd --- /dev/null +++ b/source/ubl-settings-diskquota.c @@ -0,0 +1,241 @@ +#include "ubl-settings-diskquota.h" + +config_settings_gui* _main_config; + +//signal emmit handlers - no header initialization + +/**on_close_subwindow(GtkWidget *self) + * [EN] + * Closes window in which [self] is contained. + * [RU] + * Закрывает окно, в котором расположен виджет [self]. +*/ +void on_close_subwindow(GtkWidget *self){ + gtk_widget_destroy(gtk_widget_get_toplevel(self)); +} + +/**yon_open_browser(GtkWidget *self, char *link) + * [EN] + * Opens browser with [link] link. + * [RU] + * Открывает браузер с [link] ссылкой. +*/ +void yon_open_browser(GtkWidget *self, char *link){ + yon_ubl_browser_window_open(link,TITLE_LABEL); +} + +/**on_open_documentation_confirmation(GtkWidget *self, char *link) + * [EN] + * Opens confirmation window for [link] link. + * [RU] + * Открывает окно подтверждение перехода по ссылке [link]. +*/ +void on_open_documentation_confirmation(GtkWidget *self, char *link){ + if (_main_config->always_open_documentation==0){ + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path); + documentation_confirmation_window *widgets = malloc(sizeof(documentation_confirmation_window)); + widgets->Window = yon_gtk_builder_get_widget(builder,"helpConfirmationWindow"); + widgets->AcceptButton = yon_gtk_builder_get_widget(builder,"ReadHelpButton"); + widgets->CloseButton = yon_gtk_builder_get_widget(builder,"CancelHelpButton"); + widgets->HatText = yon_gtk_builder_get_widget(builder,"webHeaderNameLabel"); + widgets->HeaderText = yon_gtk_builder_get_widget(builder,"helpHeader"); + widgets->InfoText = yon_gtk_builder_get_widget(builder,"helpText"); + widgets->AlwaysOpenCheck = yon_gtk_builder_get_widget(builder,"AlwaysOpenDocumentationCheckbox"); + gtk_label_set_text(GTK_LABEL(widgets->HatText),TITLE_LABEL); + gtk_label_set_text(GTK_LABEL(widgets->HeaderText),HELP_TITLE_LABEL); + gtk_label_set_text(GTK_LABEL(widgets->InfoText),HELP_INFO_LABEL); + gtk_button_set_label(GTK_BUTTON(widgets->AcceptButton),OPEN_HELP_LABEL); + gtk_button_set_label(GTK_BUTTON(widgets->AlwaysOpenCheck),HELP_ALWAYS_OPEN_LABEL); + gtk_button_set_label(GTK_BUTTON(widgets->CloseButton),CANCEL_LABEL); + gtk_widget_show_all(widgets->Window); + g_signal_connect(G_OBJECT(widgets->CloseButton),"clicked",G_CALLBACK(on_close_subwindow),NULL); + g_signal_connect(G_OBJECT(widgets->AcceptButton),"clicked",G_CALLBACK(yon_open_browser),yon_char_new(link)); + g_signal_connect(G_OBJECT(widgets->AcceptButton),"clicked",G_CALLBACK(on_close_subwindow),NULL); + + + } else { + yon_open_browser(self,link); + } +} + +/**on_link(GtkWidget *self, char* uri, gpointer user_data) + * [EN] + * Signal for hadnling AboutDialog links. + * Connect to "activate-link" signal. + * [self] is AboutDialog window; + * [uri] is activated link; + * [user_data] is pointer for user data, hasn't used in standard handler; + * [RU] + * Функция для обработки сигнала нажатия на ссылку окна AboutDialog. + * Присоединять к сигналу "activate-link". + * [self] - окно AboutDialog; + * [uri] - ссылка, по которой совершается переход; + * [user_data] - указатель на любые другие данные, не используется в стандартном обработчике; +*/ +void on_link(GtkWidget *self, char* uri, gpointer user_data){ + gtk_widget_destroy(self); + on_open_documentation_confirmation(self,uri); +} + +/**on_about() + * [EN] + * Function for setting up and showing AboutDialog. + * Connect it to "activate" signal of Documentation MenuItem. + * [RU] + * Функиця для настройки и показа окна AboutDialog. + * Присоединять к сигналу "activate" кнопки справки типа MenuItem. +*/ +void on_about(){ + GtkBuilder *builder=gtk_builder_new_from_resource(glade_path); + GtkWidget *window=yon_gtk_builder_get_widget(builder,"AboutWindow"); + GtkWidget *title=yon_gtk_builder_get_widget(builder,"headerAboutTopic"); + GtkWidget *hideButtonBox=yon_gtk_builder_get_widget(builder,"buttonBoxHide"); + gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(window),version_application); + gtk_about_dialog_set_website_label(GTK_ABOUT_DIALOG(window),PROJECT_HOME_LABEL); + gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(window),TITLE_LABEL); + gtk_label_set_text(GTK_LABEL(title),TITLE_LABEL); + g_signal_connect(G_OBJECT(window),"activate-link",G_CALLBACK(on_link),NULL); + gtk_widget_set_visible(hideButtonBox,0); + gtk_widget_destroy(hideButtonBox); + gtk_widget_show(window); +} + +//functions + +void yon_load_proceed(char *command){ + if (yon_config_load_register(command)) + yon_ubl_status_box_render(LOCAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); + else + yon_ubl_status_box_render(LOAD_FAILED_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); + +} + +// standard functions + +void config_init(config_settings_gui* main_config){ + _main_config = main_config; + _main_config->always_open_documentation=0; + _main_config->win_height=0; + _main_config->win_width=0; + _main_config->win_pos_x=0; + _main_config->win_pos_y=0; + _main_config->socket_id=-1; + _main_config->save_socket_id=-1; + _main_config->load_socket_id=-1; + _main_config->lock_help=0; + _main_config->lock_help=0; + _main_config->lock_load_global=0; + _main_config->lock_save_global=0; + _main_config->lock_save_local=0; +} + +void wrapper_fill_tree_view_generate(config_all* all_config, custom_window* custom) { + g_object_ref(custom->liststoreGeneral); + gtk_list_store_clear(custom->liststoreGeneral); + fill_tree_view_generate(&all_config->v_user, &all_config->v_disk_status, "usrquota",custom->treeViewGeneral, custom->liststoreGeneral); + fill_tree_view_generate(&all_config->v_group, &all_config->v_disk_status, "grpquota",custom->treeViewGeneral, custom->liststoreGeneral); + fill_tree_view_generate(&all_config->v_project, &all_config->v_disk_status, "prjquota",custom->treeViewGeneral, custom->liststoreGeneral); + +} + +main_window *setup_window(main_window* widgets, custom_window* custom_widgets){ + /* Widgets getting | Получение виджетов */ + widgets = malloc(sizeof(main_window)); + device_disk_parsed(); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path); + gtk_builder_set_translation_domain(builder, LocaleName); + widgets->Window = yon_gtk_builder_get_widget(builder,"MainWindow"); + widgets->HatLabel = yon_gtk_builder_get_widget(builder,"headerTopic"); + widgets->PlugBox = yon_gtk_builder_get_widget(builder,"plugBox"); + + widgets->HeadOverlay = yon_gtk_builder_get_widget(builder,"HeadOverlay"); + widgets->HeadImage = yon_gtk_builder_get_widget(builder,"HeadBackgroundImage"); + widgets->HeadBox = yon_gtk_builder_get_widget(builder,"HeaderBox"); + widgets->HeadTitleLabel = yon_gtk_builder_get_widget(builder,"HeaderTitleLabel"); + widgets->HeadInfoLabel = yon_gtk_builder_get_widget(builder,"HeaderInfoLabel"); + + widgets->StatusBox = yon_gtk_builder_get_widget(builder,"mainStatusBox"); + widgets->StatusIcon = yon_gtk_builder_get_widget(builder,"mainStatusIcon"); + widgets->StatusLabel = yon_gtk_builder_get_widget(builder,"mainStatusLabel"); + + widgets->SaveLabel = yon_gtk_builder_get_widget(builder,"headerSaveConfigLabel"); + widgets->SaveMenuItem = yon_gtk_builder_get_widget(builder,"SaveGlobalLocalConfigurationMenuItem"); + widgets->SaveGlobalMenuItem = yon_gtk_builder_get_widget(builder,"SaveGlobalConfigurationMenuItem"); + widgets->SaveLocalMenuItem = yon_gtk_builder_get_widget(builder,"SaveLocalConfigurationMenuItem"); + widgets->RightBox = yon_gtk_builder_get_widget(builder,"HeaderRightBox"); + + widgets->LoadLabel = yon_gtk_builder_get_widget(builder,"headerLoadConfigLabel"); + widgets->LoadGlobalMenuItem = yon_gtk_builder_get_widget(builder,"LoadGlobalConfigurationMenuItem"); + widgets->LoadLocalMenuItem = yon_gtk_builder_get_widget(builder,"LoadLocalConfigurationMenuItem"); + widgets->LeftBox = yon_gtk_builder_get_widget(builder,"HeaderLeftBox"); + + widgets->DocumentationMenuItem = yon_ubl_menu_item_documentation_new(DOCUMENTATION_LABEL); // yon_gtk_builder_get_widget(builder,"DocumentationMenuItem"); + widgets->AboutMenuItem = yon_ubl_menu_item_about_new(ABOUT_LABEL); // yon_gtk_builder_get_widget(builder,"AboutMenuItem"); + + GtkWidget *menu = yon_gtk_builder_get_widget(builder,"menu2"); + gtk_menu_shell_append(GTK_MENU_SHELL(menu),widgets->DocumentationMenuItem); + gtk_menu_shell_append(GTK_MENU_SHELL(menu),widgets->AboutMenuItem); + + if (_main_config->lock_load_global == 1){ + gtk_widget_set_sensitive(widgets->LoadGlobalMenuItem,0); + } + if (_main_config->lock_save_global == 1){ + gtk_widget_set_sensitive(widgets->SaveGlobalMenuItem,0); + gtk_widget_set_sensitive(widgets->SaveMenuItem,0); + } + if (_main_config->lock_save_local == 1){ + gtk_widget_set_sensitive(widgets->SaveLocalMenuItem,0); + gtk_widget_set_sensitive(widgets->SaveMenuItem,0); + } + + /* Signal connection | Присоединение сигналов */ + g_signal_connect(G_OBJECT(widgets->Window), "destroy", G_CALLBACK(gtk_main_quit), NULL); + g_signal_connect(G_OBJECT(widgets->DocumentationMenuItem),"activate",G_CALLBACK(on_open_documentation_confirmation),WIKI_LINK); + g_signal_connect(G_OBJECT(widgets->AboutMenuItem),"activate",G_CALLBACK(on_about),NULL); + + setup_window_custom(custom_widgets, builder); + gtk_widget_show(widgets->Window); + return widgets; +} + + +custom_window *setup_window_custom(custom_window* custom_widgets, GtkBuilder *builder) { + custom_widgets->user.name = yon_char_new("usrquota"); + custom_widgets->group.name = yon_char_new("grpquota"); + custom_widgets->project.name = yon_char_new("grpquota"); + + custom_widgets->user.note_selected = 0; + custom_widgets->group.note_selected = 1; + custom_widgets->project.note_selected = 2; + custom_widgets->device.note_selected = 3; + + custom_widgets->user.btnAdd = yon_gtk_builder_get_widget(builder,"btnAddUsers"); + custom_widgets->user.btnEdit = yon_gtk_builder_get_widget(builder,"btnEditUsers"); + custom_widgets->user.btnDel = yon_gtk_builder_get_widget(builder,"btnDelUsers"); + custom_widgets->user.btnFilter = yon_gtk_builder_get_widget(builder,"btnFilterUsers"); + + custom_widgets->group.btnAdd = yon_gtk_builder_get_widget(builder,"btnAddGroups"); + custom_widgets->group.btnEdit = yon_gtk_builder_get_widget(builder,"btnEditGroups"); + custom_widgets->group.btnDel = yon_gtk_builder_get_widget(builder,"btnDelGroups"); + custom_widgets->group.btnFilter = yon_gtk_builder_get_widget(builder,"btnFilterGroups"); + + custom_widgets->project.btnAdd = yon_gtk_builder_get_widget(builder,"btnAddProject"); + custom_widgets->project.btnEdit = yon_gtk_builder_get_widget(builder,"btnEditProject"); + custom_widgets->project.btnDel = yon_gtk_builder_get_widget(builder,"btnDelProject"); + custom_widgets->project.btnFilter = yon_gtk_builder_get_widget(builder,"btnFilterProject"); + + custom_widgets->user.tree_view = yon_gtk_builder_get_widget(builder,"usersQuotasTree"); + custom_widgets->group.tree_view = yon_gtk_builder_get_widget(builder,"groupsQuotasTree"); + custom_widgets->project.tree_view = yon_gtk_builder_get_widget(builder,"ProjectQuotasTree"); + custom_widgets->user.liststore = GTK_LIST_STORE(gtk_builder_get_object(builder, "liststoreUser")); + custom_widgets->group.liststore = GTK_LIST_STORE(gtk_builder_get_object(builder, "liststoreGroups")); + custom_widgets->project.liststore = GTK_LIST_STORE(gtk_builder_get_object(builder, "liststoreProject")); + custom_widgets->liststoreGeneral = GTK_LIST_STORE(gtk_builder_get_object(builder, "liststoreGeneral")); + custom_widgets->treeViewGeneral = yon_gtk_builder_get_widget(builder,"GeneralQuotasTree"); + custom_widgets->device.btnEdit = yon_gtk_builder_get_widget(builder,"btnEditDevice"); + custom_widgets->device.btnAdd = yon_gtk_builder_get_widget(builder,"btnAddDevice"); + custom_widgets->device.btnDel = yon_gtk_builder_get_widget(builder,"btnDelDevice"); + custom_widgets->device.tree_view = yon_gtk_builder_get_widget(builder,"DeviceQuotasTree"); + custom_widgets->device.liststore = GTK_LIST_STORE(gtk_builder_get_object(builder, "liststoreDevice")); + return custom_widgets; +} diff --git a/source/ubl-settings-diskquota.h b/source/ubl-settings-diskquota.h new file mode 100755 index 0000000..dc27156 --- /dev/null +++ b/source/ubl-settings-diskquota.h @@ -0,0 +1,131 @@ +#ifndef UBL_SETTINGS_DISKQUOTA_H +#define UBL_SETTINGS_DISKQUOTA_H +#include +#include +#include "model/ubl-utils.h" +#include +#include +#include +#include +#include +#include +#include +#include "../compile/ubl-cmake.h" +#include "model/model.h" +#include "model/load.h" +#include "model/save.h" +#include "ubl-strings.h" +#include "model/philos_utils.h" +#ifdef WEBKIT_FOUND + #include +#endif +#include "view_filters.h" + +#include "view_temp_u_g_p.h" +#include "model/my_device.h" + +#define WIKI_LINK "https://wiki.ublinux.ru/ru/Программное_обеспечение/Программы_и_утилиты/Все/ubl-settings-diskquota" + +#define LocalePath "/usr/share/locale" +#define LocaleName "ubl-settings-diskquota" +#define _(String) gettext(String) +#define VERSION_LABEL yon_char_unite(_("Version:")," ",version_application,"\n",NULL) +#define glade_path "/com/ublinux/ui/ubl-settings-diskquota.glade" +#define banner_path "/com/ublinux/images/ubl-settings-diskquota-banner.png" +#define CssPath "/com/ublinux/css/ubl-settings-diskquota.css" +#define config_path yon_char_unite("/home/",yon_ubl_root_user_get(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL) + +typedef struct { + int always_open_documentation; + int win_pos_x; + int win_pos_y; + int win_width; + int win_height; + + int socket_id; + int load_socket_id; + int save_socket_id; + + int lock_help; + int lock_save_local; + int lock_save_global; + int lock_load_global; +} config_settings_gui; + +typedef struct { + //Standard + GtkWidget *Window; + GtkWidget *HatLabel; + GtkWidget *PlugBox; + + GtkWidget *HeadOverlay; + GtkWidget *HeadImage; + GtkWidget *HeadBox; + GtkWidget *HeadTitleLabel; + GtkWidget *HeadInfoLabel; + + GtkWidget *StatusBox; + GtkWidget *StatusIcon; + GtkWidget *StatusLabel; + + GtkWidget *SaveLabel; + GtkWidget *SaveMenuItem; + GtkWidget *SaveGlobalMenuItem; + GtkWidget *SaveLocalMenuItem; + GtkWidget *RightBox; + + GtkWidget *LoadLabel; + GtkWidget *LoadGlobalMenuItem; + GtkWidget *LoadLocalMenuItem; + GtkWidget *LeftBox; + + GtkWidget *DocumentationMenuItem; + GtkWidget *AboutMenuItem; + // Custom +} main_window; + +typedef struct { + GtkWidget *treeViewGeneral; + GtkListStore *liststoreGeneral; + hotebook device; + hotebook user; + hotebook group; + hotebook project; + +} +custom_window; + + +typedef struct { + GtkWidget *Window; + + GtkWidget *HatText; + GtkWidget *HeaderText; + GtkWidget *InfoText; + GtkWidget *AlwaysOpenCheck; + + GtkWidget *CloseButton; + GtkWidget *AcceptButton; +} documentation_confirmation_window; + +typedef char* string; +static string version_application=""; + + +main_window *setup_window(main_window* widgets, custom_window* custom_widgets); +void on_about(); +void yon_open_browser(GtkWidget *self, char *link); +void on_close_subwindow(GtkWidget *self); +void on_link(GtkWidget *self, char* uri, gpointer user_data); +void on_open_documentation_confirmation(GtkWidget *self, char *link); +void yon_load_proceed(char *command); +void event(main_window *widgets); +custom_window *setup_window_custom(custom_window* custom_widgets, GtkBuilder *builder); +void on_link(GtkWidget *self, char* uri, gpointer user_data); +void config_init(config_settings_gui* main_config); +int wrapper_select_tree_view(hotebook* widgets); +int tree_view_edit(config_all* _all_config, vector* vec_temp, hotebook* widgets); +void set_time_spin(hotebook* widgets, size_t seconds_file, size_t seconds_size); +void template_set_status_disk(GtkWidget* self,hotebook* widgets); +void wrapper_fill_tree_view_generate(config_all* all_config, custom_window* custom); +#endif diff --git a/source/ubl-settings-diskquota.h.in b/source/ubl-settings-diskquota.h.in deleted file mode 100644 index 17ba454..0000000 --- a/source/ubl-settings-diskquota.h.in +++ /dev/null @@ -1 +0,0 @@ -#cmakedefine WEBKIT_FOUND \ No newline at end of file diff --git a/source/ubl-strings.h b/source/ubl-strings.h new file mode 100644 index 0000000..a300675 --- /dev/null +++ b/source/ubl-strings.h @@ -0,0 +1,101 @@ +#include +#include +#include +#include +#include +#include +#define _(String) gettext(String) + + +#define HELP_LABEL yon_char_unite(_("ubl-settings-diskquota version:")," ", version_application,"\n","\n",_("Usage:"), " ubl-settings-diskquota ",_("[OPTIONS]"),"\n",_("Options:"),"\n\t--help, -h\t\t\t",_("Show this help"),"\n\t--version, -V\t\t\t",_("Show package version"),"\n\t--lock-help\t\t\t",_("Lock this help menu"),"\n\t--lock-save\t\t\t",_("Lock configuration saving"),"\n\t--lock-save-local\t\t",_("Lock local configration saving"),"\n\t--lock-save-global\t\t",_("Lock global configration saving"),"\n\t--lock-load-global\t\t",_("Lock global configration loading"),"\n",NULL) + +#define TITLE_LABEL _("Disk quotas") +#define TITLE_INFO_LABEL _("Configuring disk quota settings for system groups and users") + +#define SUCCESS_LABEL _("Operation succeeded") +#define ROOT_WARNING_LABEL _("Warning! Application was launched without root - root-dependent actions are locked.") + +#define ABOUT_LABEL _("About") +#define DOCUMENTATION_LABEL _("Documentation") + +#define SAVE_LOCAL_LABEL _("Save to local configuration") +#define SAVE_GLOBAL_LABEL _("Save to global configuration") +#define SAVE_CONFIGURATION_LABEL _("Save configuration") +#define SAVE_LABEL _("Save") + +#define LOAD_LOCAL_LABEL _("Load local configuration") +#define LOAD_GLOBAL_LABEL _("Load global configuration") +#define LOAD_LABEL _("Load") + +#define CANCEL_LABEL _("Cancel") + +#define HELP_TITLE_LABEL _("Would you like to read documentation in the Web?") +#define HELP_INFO_LABEL _("You will be redirected to documentation website where documentation is\ntranslated and supported by community.") +#define HELP_ALWAYS_OPEN_LABEL _("Always redirect to online documentation") +#define OPEN_HELP_LABEL _("Open documentation") +#define PROJECT_HOME_LABEL _("Project Home Page") +#define NOTHING_CHOSEN_LABEL _("Nothing were chosen") + + +#define GLOBAL_LOAD_SUCCESS_LABEL _("Global configuration loading succseeded.") +#define LOCAL_LOAD_SUCCESS_LABEL _("Local configuration loading succseeded.") +#define LOAD_FAILED_LABEL _("Config loading failed") + +#define GLOBAL_LOCAL_SAVE_SUCCESS_LABEL _("Local and global configuration saving succseeded.") +#define GLOBAL_SAVE_SUCCESS_LABEL _("Global configuration saving succseeded.") +#define LOCAL_SAVE_SUCCESS_LABEL _("Local configuration saving succseeded.") +#define MESS_NOTHING_SAVE _("Nothing to save!") + +#define STR_KB _("Kb") +#define STR_MB _("Mb") +#define STR_GB _("Gb") +#define STR_TB _("Tb") + + +#define CMD_LOAD_GLOBAL "ubconfig --default --source global get security DISK_QUOTA[*]" +#define CMD_LOAD_SYSTEM "ubconfig --default --source system get security DISK_QUOTA[*]" +#define CMD_SAVE_GLOBAL "ubconfig --target global set security" +#define CMD_SAVE_SYSTEM "ubconfig --target system set security" +#define CMD_ALL_SAVE "ubconfig set security " +#define CMD_ALL_REMOVE "ubconfig remove security " +#define CMD_REMOVE_GLOBAL "ubconfig --target global --noexecute remove security " +#define CMD_REMOVE_SYSTEM "ubconfig --target system remove security " + +#define empty_str "-" +#define WEEKS _("w ") +#define DAYS _("d ") +#define HOURS _("h ") +#define MINUTES _("m ") + +#define STR_ON _("On") +#define STR_OFF _("Off") +#define STR_NOT_SET _("Not set") +#define STR_TITLE_ADD_QUOTAS _("Settings quotas - Addition") +#define STR_TITLE_EDIT_QUOTAS _("Settings quotas - Editing") + +#define SAVE_FAILED_LABEL + +#define STR_TITLE_FILE_MANGER _("Please select folder") + +#define STR_USER _("User") +#define STR_GROUP _("Group") +#define STR_PROJECT _("Project") +#define STR_USERS _("Users") +#define STR_GROUPS _("Groups") + +#define STR_ERROR_MESS_NOT_DIR _("Is not a directory") +#define STR_CHK_LABEL_WRITE_ALL_USERS _("Withdraw all users") +#define STR_CHK_LABEL_WRITE_ALL_GROUPS _("Withdraw all groups") + +#define STR_ERROR_ERROR_PROJECT_ID _("Project ID mandatory field") +#define STR_ERROR_PATH_IS_DISK_FALSE_1 _("The path does not match the specified disk") +#define STR_ERROR_PROJECT_NAME_VALUE_NULL _("Project name mandatory field") +#define STR_ERROR_PROJECT_NAME_ENTER_VALUE _("Project name required field") +#define STR_ERROR_LIST_USER_NULL _("The list of users is empty") +#define STR_ERROR_NO_SELECTED_DISK _("To save, you need to select a disk") +#define STR_ERROR_ENTRY_VALUE_VOLUME_OR_FILES _("The volume and files fields must have at least one value") +#define STR_ERROR_PATH_IS_DISK_FALSE _("The selected directory is not located on the target device") + + + + diff --git a/source/var.h b/source/var.h deleted file mode 100644 index f26c1ff..0000000 --- a/source/var.h +++ /dev/null @@ -1,161 +0,0 @@ -#ifndef VAE_H -#define VAE_H -#include "project_lib.h" -using namespace std; -extern string version_application; -#define name_app _("ubl-settings-diskquota") -#define configuring_system_boot _("Configuring system boot parameters") -#define system_boot _("System boot") -#define str_about _("About ubl-settings-diskquota") -#define command_line_parameters _("Command line parameters:") -#define load_default _("Load default:") -#define seconds _("seconds") -#define download_menu _("Download menu") -#define terminal_for_input _("Terminal for input") -#define terminal_for_output _("Terminal for output") -#define boot_selection_menu_timer _("Boot selection menu timer") -#define str_help _("Help") -#define str_about_1 _("About") -#define str_save_local _("Save") -#define str_load_local _("Load") -#define save_all _("Save in global and local configuration") -#define save_local _("Save in local configuration") -#define save_global _("Save in global configuration") -#define load_global _("Load global configuration") -#define load_local _("Load local configuration") -#define read_online _("Read online") -#define cancel _("Cancel") -#define always_redirect _("Always redirect") -#define boot_screen_display_mode _("Boot screen display mode:") -#define no_loading_animation _("No loading animation, full log") -#define boot_menu_user_name _("Boot menu user name:") -#define boot_menu_user_password _("Boot menu user password:") -#define last_successful_upload _("Last successful upload") -#define read_documentation_web _("Would you like to read documentation in the Web?") -#define redirected_documentation _("You will be redirected to documentation website where documentation is\ntranslated and supported by community.") -#define local_read_error _("Local configuration reading error") -#define global_read_error _("Global configuration read error") -#define local_write_error _("Local configuration write error") -#define global_write_error _("Global configuration write error") -#define error_save_all _("Error saved local and global configuration") -#define local_load_ok _("Local configuration downloaded successfully") -#define global_load_ok _("Global configuration downloaded successfully") -#define local_ok_written _("Local configuration successfully written") -#define global_ok_written _("Global configuration successfully written") -#define successfully_save_all _("Successfully saved local and global configuration") -#define nothing_save _("Nothing to save!") -#define program_as_root _("The program must be run as root") - -#define str_weeks _("weeks") -#define str_days _("days") -#define str_hours _("hours") -#define str_minutes _("minutes") -#define str_device _("Device:") -#define str_users _("Users") -#define str_groups _("Groups") -#define str_files _("files") -#define str_hard_limit _("Hard limit") -#define str_file_system _("File system:") -#define str_name _("Name") -#define str_size _("Size") -#define str_quotas_mode _("Direct control of the file system") -#define str_lb_head _("Setting user quotas") -#define str_soft_limit _("Soft limit") -#define str_currently_using _("Currently using:") -#define str_currently_using_space _("Currently using: ") -#define str_filters _("Filters") -#define str_quotas _("Quotas") -#define str_help_h _("GTK settings disk quota for UBLinux\n" \ - "\n" \ - "Usage: ubl-settings-diskquota [OPTIONS...]\n" \ - "Options:\n" \ - " -h, --help\t Show this help\n" \ - " -V, --version\t Show package version\n" \ - " --lock-help Lock utility help\n" \ - " --lock-save Lock saving local and global configuration\n" \ - " --lock-save-local Lock save global configuration\n" \ - " --lock-save-global Lock load global configuration\n" \ - " --lock-load-global Lock load global configuration\n") - -#define str_user _("User") -#define str_group _("Group") -#define str_projects _("Projects") -#define str_user_1 _("User:") -#define str_group_1 _("Group:") -#define str_project_1 _("Projects:") -#define str_device_project _("Device\nProject") -#define str_quota _("Quota type") -#define str_status _("Status") -#define str_excess_size_delay _("Excess size delay period") -#define str_excess_files_delay _("Excess files delay period") -#define str_disk_quotas_device _("Disk quotas for this device:") -#define str_user_quotas_device _("User quotas for this device: ") - -#define str_soft_limit_size _("Soft limit (size)") -#define str_tw_soft_limit _("Soft limit\n(size)") -#define str_hard_limit_size _("Hard limit (size)") -#define str_deferring_hard_limit_size _("Deferring a hard limit (size)") -#define str_hard_activation_size _("Hard limit activation time (size)") -#define str_hard_limit_time _("Hard limit (file) activation time") -#define str_group_quotas_device _("Group quotas for this device:") - -#define str_tw_severe_limitation _("Severe\nlimitation\n(size)") -#define str_tw_general_deferring_size _("Deferring\n(size)") -#define str_tw_general_deferring_files _("Deferring\n(files)") -#define str_tw_deferring_size _("Deferring\na hard\nlimit\n(files)") -#define str_tw_deferring_files _("Deferring\na hard\nlimit\n(files)") -#define str_tw_soft_limit_files _("Soft limit\n(files)") -#define str_tw_severe_limitation_files _("Severe\nlimitation\n(files)") -#define str_soft_restriction_files _("Soft Restriction (files)") -#define str_severe_limitation_files _("Severe limitation (files)") -#define str_deferring_limit_files _("Deferring a hard limit (files)") -#define info_box_ok_css "boxInfoMessOK" -#define info_box_error_css "boxInfoMessError" -#define icon_checked "com.ublinux.ubl-settings-diskquota.checked" -#define icon_warning "com.ublinux.ubl-settings-diskquota.warning" - -#define str_version _("ubl-settings-diskquota version: ") -#define path_app "/usr/bin/" -#define path_glade "/usr/share/ubl-settings-diskquota/ui/ubl-settings-diskquota.glade" -#define path_css "/usr/share/ubl-settings-diskquota/css/ubl-settings-diskquota.css" -#define app_name "ubl-settings-diskquota" -#define path_resources "/usr/share/ubl-settings-diskquota" -#define path_img_head_background "/usr/share/ubl-settings-diskquota/images/logo-background.png" -#define no_recognized _("Argument not recognized\n") - -#define str_device _("Device:") -#define str_quota_status _("Quota use status:") -#define str_size _("Size") -#define str_files _("files") -#define str_currently_using _("Currently using:") -#define str_soft_limit _("Soft limit") -#define str_hard_limit _("Hard limit") -#define str_hard_limit _("Hard limit") -#define str_prefix_KB _("Kb") -#define str_prefix_MB _("Mb") -#define str_prefix_GB _("Gb") -#define str_prefix_TB _("Tb") - -#define const_link_doc "https://wiki.ublinux.com/ru/Программное_обеспечение/Программы_и_утилиты/Все/ubl-settings-diskquota" -#define cmd_xdg "xdg-open " -#define cmd_execute "su -l %s -c \" DISPLAY=$DISPLAY %s \"" - - -#define str_name _("Name") -#define str_size _("Size") -#define str_filters _("Filters") -#define str_quotas _("Quotas") -#define str_soft_limit_size _("Soft limit (size)") -#define str_hard_limit_size _("Hard limit (size)") -#define str_hard_limit_size_delay _("Hard limit (size) delay") -#define str_soft_limit_files _("Soft limit (files)") - -#define copyright _("Copyright © UBSoft LLC, 2022 - ") -#define str_setting_user _("Setting user quotas") -#define website _("https://wiki.ublinux.com") -#define project_Home_page _("Project Home Page") - -#define open_dir_file_manager "/home/" - - -#endif \ No newline at end of file diff --git a/source/view/model/load.cc b/source/view/model/load.cc deleted file mode 100644 index 77873dc..0000000 --- a/source/view/model/load.cc +++ /dev/null @@ -1,34 +0,0 @@ -#include "load.h" - -namespace Lib_Load{ - 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 cmd) { - string response = ""; - string key = ""; - string value = ""; - 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(); - } - -} \ No newline at end of file diff --git a/source/view/model/load.h b/source/view/model/load.h deleted file mode 100644 index b4d4a38..0000000 --- a/source/view/model/load.h +++ /dev/null @@ -1,20 +0,0 @@ -#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: - 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/view/model/my_process.cc b/source/view/model/my_process.cc deleted file mode 100644 index 658afd5..0000000 --- a/source/view/model/my_process.cc +++ /dev/null @@ -1,84 +0,0 @@ -#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/view/model/my_process.h b/source/view/model/my_process.h deleted file mode 100644 index 3cc6f81..0000000 --- a/source/view/model/my_process.h +++ /dev/null @@ -1,32 +0,0 @@ -#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/view/model/save.cc b/source/view/model/save.cc deleted file mode 100644 index c824093..0000000 --- a/source/view/model/save.cc +++ /dev/null @@ -1,151 +0,0 @@ -#include "save.h" - -namespace Lib_save { - -vector Save::get_error() { - return this->vec_errors; -} - -bool Save::get_state_save() { - return this->flag_no_save; -} - -void Save::set_data_global(std::map &map_global) { - this->map_global = &map_global; -} - -void Save::set_data_local(std::map &map_local) { - this->map_local = &map_local; -} - -void Save::set_data_gui(std::map &map_gui) { - this->map_gui = &map_gui; -} - -bool Save::check_save(string flag_save, string key_name) { - std::map :: iterator iter_map_data; - std::map :: iterator iter_map_data_old; - std::map *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& 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_one_cmd(string cmd1, string cmd_remove, string str_flag_save) { - string key = ""; - string value = ""; - string cmd = ""; - this->flag_no_save = true; - cmd = cmd1; - string remove = 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 = cmd + key + "=\"" + value + "\" "; - } - else if (value.length() == 0) { - remove = remove + key + " "; - } - - } - } - } - if (cmd.length() != cmd1.length()) { - this->template_save(cmd); - } - if (cmd_remove.length() != remove.length()) { - this->template_save(remove); - } -} - -void Save::template_save(string cmd) { - string str_error = ""; - 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 = ""; - } - -} - -} diff --git a/source/view/model/save.h b/source/view/model/save.h deleted file mode 100644 index d6c8c04..0000000 --- a/source/view/model/save.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef MY_SAVE_H -#define MY_SAVE_H - -#include "my_process.h" -namespace Lib_save { - -class Save { -private: - std::map *map_global; - std::map *map_local; - std::map *map_gui; - vector vec_errors; - vector* vec_param_names; - My_Process::My_Process_system process = My_Process::My_Process_system(); - bool flag_no_save; - void template_save(string cmd); -public: - void set_data_global(std::map &map_global); - void set_data_local(std::map &map_local); - void set_data_gui(std::map &map_gui); - bool check_save(string flag_save, string key_name); - bool get_state_save(); - - void save_one_cmd(string cmd1, string cmd_remove, string str_flag_save); - int get_count_error(); - string get_cmd_error(); - void set_count_error(int count_error); - void set_vec_params(vector& vec_param_names); - void save(string sections, string str_flag_save) ; - vector get_error(); -}; -} -#endif \ No newline at end of file diff --git a/source/view/model/ubconfig_quota.cc b/source/view/model/ubconfig_quota.cc deleted file mode 100644 index 653ff88..0000000 --- a/source/view/model/ubconfig_quota.cc +++ /dev/null @@ -1,39 +0,0 @@ -#include "ubconfig_quota.h" - - - -Ubconfig_quota::Ubconfig_quota(/* args */) -{ -} - -Ubconfig_quota::~Ubconfig_quota() -{ -} - -void Ubconfig_quota::set_map_global(map_str_str* map_global_cfg) { - this->map_global_cfg = map_global_cfg; -} - -void Ubconfig_quota::set_map_local(map_str_str* map_system_cfg) { - this->map_system_cfg = map_system_cfg; -} - -void Ubconfig_quota::remove_key_to_vec(string key) { - cout << key << endl; -} - -void Ubconfig_quota::add_key_to_vec(string key) { - cout << key << endl; -} - -void Ubconfig_quota::set_vec_key(vector* vec_param_names) { - this->vec_param_names = vec_param_names; -} - -void Ubconfig_quota::format_data() { - -} - - - - diff --git a/source/view/model/ubconfig_quota.h b/source/view/model/ubconfig_quota.h deleted file mode 100644 index 08d63ce..0000000 --- a/source/view/model/ubconfig_quota.h +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef UBCONFIG_QUOTAS_H -#define UBCONFIG_QUOTAS_H - -#include "../../my_type.h" -#include "../../project_lib.h" - -class Ubconfig_quota -{ -private: - map_str_str* map_gui_cfg = NULL; - map_str_str* map_global_cfg = NULL; - map_str_str* map_system_cfg = NULL; - vector* vec_param_names = NULL; - struct Size { - int size_0; - int size_1; - int size_2; - int size_3; - int size_4; - int size_5; - }; - struct User { - bool active; - string device; - vector users; - struct Size obj_size; - }; - struct Group { - bool active; - string device; - vector groups; - struct Size obj_size; - }; - struct Prjquota { - bool active; - string device; - vector prjquota_name; - struct Size obj_size; - }; - struct Quotas { - struct User obj_user; - struct Group obj_group; - struct Prjquota obj_prjquota; - }; -public: - Ubconfig_quota(/* args */); - ~Ubconfig_quota(); - void set_map_gui(map_str_str* map_gui_cfg); - void set_map_global(map_str_str* map_global_cfg); - void set_map_local(map_str_str* map_system_cfg); - void set_vec_key(vector* vec_param_names); - void remove_key_to_vec(string key); - void add_key_to_vec(string key); - void format_data(); - -}; - -#endif \ No newline at end of file diff --git a/source/view/model/util.cc b/source/view/model/util.cc deleted file mode 100644 index 34f622b..0000000 --- a/source/view/model/util.cc +++ /dev/null @@ -1,228 +0,0 @@ -#include "util.h" - -namespace Utils { - -string format_str_size(int num, int index) { - string value = ""; - value = to_string(num); - if (num == 0) { - return value; - } - if (index == 1) { - value += "M"; - } - else if (index == 2) { - value += "G"; - } - else if (index == 3) { - value += "T"; - } - return value; -} - -array, 5> read_csv(const string& filename) { - array, 5> array_vectors; - vector vec_option; - vector vec_opcision; - ifstream file(filename); - string line; - char delimiter = ','; - getline(file, line); - while (getline(file, line)) { - stringstream stream(line); - string option; - string opcision; - getline(stream, option, delimiter); - string line_local = stream.str(); - if (line_local.find("\"") != string::npos) { - string str_delimiter = "\""; - vector point = find_all(line_local, str_delimiter); - size_t len = point.size(); - if (len >= 2) { - int index_start = point[len-2]; - int index_end = point[len-1]; - opcision = line_local.substr(index_start, index_end); - index_end = opcision.find("\""); - if (opcision.find("\"") != string::npos) { - opcision.replace(index_end, opcision.length(), ""); - } - - } - else { - opcision = "error"; - } - - - } - else{ - getline(stream, opcision, delimiter); - } - - - vec_option.push_back(option); - vec_opcision.push_back(opcision); - } - - array_vectors[0] = vec_option; - array_vectors[1] = vec_opcision; - return array_vectors; -} - -string call(string cmd) { - FILE *fp; - int status; - char path[PATH_MAX] = {0}; - fp = popen(cmd.c_str(), "r"); - if (fp == NULL) { - exit(1); - } - while (fgets(path, PATH_MAX, fp) != NULL) { - break; - } - status = pclose(fp); - if (status == -1) { - exit(1); - } - return path; -} - -vector find_all(string &str_ntp, string substr) { - size_t index = 0; - vector sub_index; - while ((index = str_ntp.find(substr, index)) != std::string::npos) { - index += substr.length(); - sub_index.push_back(index); - } - return sub_index; -} - -void str_remove(std::string& source, std::string to_remove) { - string::size_type n = to_remove.length(); - for (string::size_type i = source.find(to_remove); - i != string::npos; - i = source.find(to_remove)) - source.erase(i, n); -} - -void str_replace_all(std::string& str_base, string str_find, string sReplacement) -{ - size_t pos = 0, fpos; - while ((fpos = str_base.find(str_find, pos)) != std::string::npos) - { - str_base.replace(fpos, str_find.size(), sReplacement); - pos = fpos + sReplacement.size(); - } -} -std::vector split(std::string text, char delim) { - std::string line; - std::vector vec; - std::stringstream ss(text); - while(std::getline(ss, line, delim)) { - vec.push_back(line); - } - return vec; -} - -int synopsis_show(string str_link) { - // gettext("https://wiki.ublinux.com/ru/Программное_обеспечение/Программы_и_утилиты/Все/") - string cmd = "xdg-open " + str_link; - if (geteuid() == 0) { - string response_user = getlogin(); - cmd = "su -l " + response_user + " -c \" DISPLAY=$DISPLAY " + cmd + " \""; - } - return system(cmd.c_str()); -} - -string file_read(string filename) { - string line; - string buffer; - std::ifstream in(filename); // окрываем файл для чтения - if (in.is_open()) - { - while (getline(in, line)) - { - buffer += line; - } - } - return buffer; -} - -unsigned short read_uid_min_max(string filename, string search) { - std::string line; - int uid = 0; - string remove_tab = "\t"; - string remove_space = " "; - std::ifstream in(filename); // окрываем файл для чтения - if (in.is_open()){ - while (getline(in, line)){ - try{ - if (line.find(search) != string::npos && (line.find("SYS_"+search) == string::npos)) { - Utils::str_remove(line, search); - Utils::str_remove(line, remove_space); - Utils::str_remove(line, remove_tab); - uid = atoi(line.c_str()); - } - } - catch (int x) { - if (search == "UID_MIN"){ - uid = 1000; - } - else{ - uid = 65534; - } - - } - - } - } - else{ - if (search == "UID_MIN") { - uid = 1000; - } - else{ - uid = 65534; - } - } - in.close(); - return uid; - -} - -vector pars_users() { - unsigned short uid_min = Utils::read_uid_min_max(file_source_login_min_max, "UID_MIN"); - unsigned short uid_max = Utils::read_uid_min_max(file_source_login_min_max, "UID_MAX"); - vector vec_user; - while (true) { - errno = 0; - passwd* entry = getpwent(); - if (!entry) { - if (errno) { - break; - } - break; - } - if ((entry->pw_uid >= uid_min && entry->pw_uid < uid_max) || entry->pw_uid == 0) { - vec_user.push_back(entry->pw_name); - } - } - endpwent(); - return vec_user; -} -vector pars_group() { - vector vec_group; - while (true) { - errno = 0; // so we can distinguish errors from no more entries - passwd* entry = getpwent(); - if (!entry) { - if (errno) { - std::cerr << "Error reading password database\n"; - break; - } - break; - } - vec_group.push_back(entry->pw_name); - } - endpwent(); - return vec_group; -} -} \ No newline at end of file diff --git a/source/view/model/util.h b/source/view/model/util.h deleted file mode 100644 index 5f2fa9d..0000000 --- a/source/view/model/util.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef UTIL_H -#define UTIL_H -#include "../../project_lib.h" - -using namespace std; - -namespace Utils { -#define file_source_login_min_max "/etc/login.defs" -template -struct Result{ - Type response; - int error; -}; - -struct Passwd { - string user; - int uid; -}; - -string format_str_size(int num, int index); -std::array, 5> read_csv(const std::string& filename); -std::string call(std::string cmd); -vector 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 split(std::string text, char delim); -vector pars_users(); -int synopsis_show(string str_link); -string file_read(string filename); -unsigned short read_uid_min_max(string filename, string search); -vector pars_users(); -vector pars_group(); -} -#endif \ No newline at end of file diff --git a/source/view/model/wrapper_load_save.cc b/source/view/model/wrapper_load_save.cc deleted file mode 100644 index 5988735..0000000 --- a/source/view/model/wrapper_load_save.cc +++ /dev/null @@ -1,133 +0,0 @@ -#include "wrapper_load_save.h" - - - -Wrapper_load_save::Wrapper_load_save(/* args */) { - //obj_quotas_sys.set_map_gui(map_gui_cfg); - //obj_quotas_ubconfig.set_map_gui(map_gui_cfg); -} - -Wrapper_load_save::~Wrapper_load_save() -{ -} - -void Wrapper_load_save::set_map_gui(map_str_str* map_gui_cfg) { - this->map_gui_cfg = map_gui_cfg; -} - -void Wrapper_load_save::set_map_global(map_str_str* map_global_cfg) { - this->map_global_cfg = map_global_cfg; -} - -void Wrapper_load_save::set_map_local(map_str_str* map_system_cfg) { - this->map_system_cfg = map_system_cfg; -} - -void Wrapper_load_save::set_vec_key(vector vec_param_names) { - this->vec_param_names = vec_param_names; -} - -int Wrapper_load_save::load_global_cfg() { - this->load_template(map_global_cfg, global_load); - *map_gui_cfg = *map_global_cfg; - return 1; - -} - -int Wrapper_load_save::load_system_cfg() { - this->load_template(map_system_cfg, system_load); - *map_gui_cfg = *map_system_cfg; - return 0; - -} - -void Wrapper_load_save::load_template(map_str_str* map_temp, string cmd) { - if (cmd.find("system") != string::npos) { - this->init_dict("system"); - } - else { - this->init_dict("global"); - } - *map_temp = obj_load.get_load_data(*map_temp, cmd); -} - -int Wrapper_load_save::wrapper_save_global_cfg() { - this->set_data_cfg(); - if (this->save_template("boot", "global")) { - *map_global_cfg = *map_gui_cfg; - return 5; - } - else { - *map_global_cfg = *map_gui_cfg; - return 3; - } -} - -int Wrapper_load_save::wrapper_save_system_cfg() { - this->set_data_cfg(); - if (this->save_template("boot", "system")) { - *map_system_cfg = *map_gui_cfg; - return 5; - } - else { - *map_system_cfg = *map_gui_cfg; - return 2; - } - -} - - -int Wrapper_load_save::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) { - *map_global_cfg = *map_gui_cfg; - *map_system_cfg = *map_gui_cfg; - return 5; - } - else { - *map_global_cfg = *map_gui_cfg; - *map_system_cfg = *map_gui_cfg; - return 4; - } - - -} - -int Wrapper_load_save::get_error_load() { - return obj_load.get_count_error(); -} -int Wrapper_load_save::get_error_save() { - return obj_save.get_count_error(); -} - -bool Wrapper_load_save::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 obj_vec_error = obj_save.get_error(); - flag_no_save = obj_save.get_state_save(); - return flag_no_save; -} - -void Wrapper_load_save::init_dict(string flag_load) { - map_str_str 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; - } - else if (flag_load == "system") { - *map_system_cfg = *map_gui_cfg; - } -} - -void Wrapper_load_save::set_data_cfg() { - // TODO: - // Написать функцию -} \ No newline at end of file diff --git a/source/view/model/wrapper_load_save.h b/source/view/model/wrapper_load_save.h deleted file mode 100644 index 5562ff4..0000000 --- a/source/view/model/wrapper_load_save.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef WRAPPER_LOAD_SAVE_H -#define WRAPPER_LOAD_SAVE_H -#include "../../my_type.h" -#include "../../project_lib.h" -#include "load.h" -#include "save.h" -#include "my_process.h" -#include "util.h" -#define global_load "ubconfig --default --source global get boot" -#define system_load "ubconfig --default --source system get boot" -#define global_save "ubconfig --target global --noexecute set boot " -#define system_save "ubconfig --target system set boot " -#define all_save "ubconfig set boot " -#define all_remove "ubconfig set/remove boot " -#define global_remove "ubconfig --target global --noexecute set/remove boot " -#define system_remove "ubconfig --target system --noexecute set/remove boot " - - - -class Wrapper_load_save { -private: - string str_cmd_error; -private: - map_str_str* map_gui_cfg = NULL; - map_str_str* map_global_cfg = NULL; - map_str_str* map_system_cfg = NULL; - vector vec_param_names; - 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(); - Lib_save::Save obj_save = Lib_save::Save(); - Lib_Load::Load obj_load = Lib_Load::Load(); -public: - Wrapper_load_save(/* args */); - ~Wrapper_load_save(); - int load_global_cfg(); - int load_system_cfg(); - int wrapper_save_system_cfg(); - int wrapper_save_global_cfg(); - int wrapper_save_all_cfg(); - int get_error_load(); - int get_error_save(); - void set_map_gui(map_str_str* map_gui_cfg); - void set_map_global(map_str_str* map_global_cfg); - void set_map_local(map_str_str* map_system_cfg); - void set_vec_key(vector vec_param_names); -private: - void load_template(map_str_str* map_temp, string cmd); - void init_dict(string flag_load); - void set_data_cfg(); - bool save_template(string section, string flag_save); - -}; - - -#endif \ No newline at end of file diff --git a/source/view/ubl-settings-diskquota.cc b/source/view/ubl-settings-diskquota.cc deleted file mode 100644 index bc5d23d..0000000 --- a/source/view/ubl-settings-diskquota.cc +++ /dev/null @@ -1,620 +0,0 @@ -#ifndef UBL_SETTINGS_DISKQUOTA_H -#define UBL_SETTINGS_DISKQUOTA_H -#include "ubl-settings-diskquota.h" - -string version_application = "1.7"; -bool flag_save = false; -bool flag_save_local = false; -bool flag_save_global = false; -bool flag_load_global = false; -bool flag_lock_help = false; - -MainWindow::MainWindow(Glib::RefPtr builder, View_open_browser* obj_open_browser, int* socket_ext_id_I, int* socket_trd_id_I) { - this->builder = builder; - this->socket_ext_id_I = socket_ext_id_I; - this->socket_trd_id_I = socket_trd_id_I; - this->set_obj_browser(obj_open_browser); - // this->settings(); -} - -void MainWindow::set_map_gui(map_str_str* map_gui_cfg) { - this->map_gui_cfg = map_gui_cfg; - obj_wrapper_load_save->set_map_gui(map_gui_cfg); -} - -void MainWindow::set_map_global(map_str_str* map_global_cfg) { - this->map_global_cfg = map_global_cfg; - obj_wrapper_load_save->set_map_global(map_global_cfg); -} - -void MainWindow::set_map_local(map_str_str* map_system_cfg) { - this->map_system_cfg = map_system_cfg; - obj_wrapper_load_save->set_map_local(map_system_cfg); -} - -void MainWindow::set_obj_wrapper_load_save(Wrapper_load_save* obj_wrapper_load_save) { - this->obj_wrapper_load_save = obj_wrapper_load_save; -} - -void MainWindow::set_obj_view_filters(View_filters* obj_view_filters) { - this->obj_view_filters = obj_view_filters; -} - -void MainWindow::set_obj_view_add(View_add_user_group* obj_view_add) { - this->obj_view_add = obj_view_add; -} - -void MainWindow::set_obj_view_edit(View_edit_user_group* obj_view_edit) { - this->obj_view_edit = obj_view_edit; -} -void MainWindow::set_obj_view_add_project(View_add_project* obj_view_add_project) { - this->obj_view_add_project = obj_view_add_project; -} -void MainWindow::set_obj_view_edit_project(View_edit_project* obj_view_edit_project) { - this->obj_view_edit_project = obj_view_edit_project; -} - -void MainWindow::settings() { - this->get_builder(); - this->lacalization(); - 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)); - this->add_CSS(); - this->flag_block_gui(); - this->init_tree_view(); - this->init_spin_all(); - if (geteuid() == 0) { - this->wrapper_load_system(); - this->wrapper_load_global(); - 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); - } - -} - - - -void MainWindow::set_obj_browser(View_open_browser* obj_open_browser) { - this->obj_open_browser = obj_open_browser; - obj_open_browser->get_about()->set_version(version_application); -} - -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_editable(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() { - GroupsTabLabel->set_text(str_groups); - headerTopic->set_label(name_app); - UsersTabLabel->set_text(str_users); - generalGroupsFilesLabel->set_text(str_excess_files_delay); - generalUsersSizeLabel->set_text(str_excess_size_delay); - generalUsersFilesLabel->set_text(str_excess_files_delay); - 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); - 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); - ProjectTabLabel->set_label(str_projects); - usersProjectLabel->set_text(str_device); - chbMangSystemFile->set_label(str_quotas_mode); - -} - -void MainWindow::info_warning_error(int mess, int error_save, int error_load) { - if (error_save > 0 || error_load > 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 = ""; - } - 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); - } - } -} - -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 cssProvider = Gtk::CssProvider::create(); - cssProvider->load_from_path(path_css); - Glib::RefPtr styleContext = Gtk::StyleContext::create(); - Glib::RefPtr screen = Gdk::Screen::get_default();//get default screen - styleContext->add_provider_for_screen(screen, cssProvider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);//add provider for screen in all application - HeadBackgroundImage->set(path_img_head_background); - Glib::RefPtr headLabel_css = headLabel->get_style_context(); - Glib::RefPtr boxButton_css = boxButton->get_style_context(); - Glib::RefPtr boxSave_css = boxSave->get_style_context(); - Glib::RefPtr 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 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("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("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("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("groupsDeviceLabel", groupsDeviceLabel); - builder->get_widget("usersDeviceLabel", usersDeviceLabel); - builder->get_widget("headLabel", headLabel); - 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("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("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); - 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); - builder->get_widget("btnEditProject", btnEditProject); - builder->get_widget("btnEditUsers", btnEditUsers); - builder->get_widget("btnEditGroups", btnEditGroups); - builder->get_widget("usersProjectCombo", usersProjectCombo); - builder->get_widget("boxResize", boxResize); - builder->get_widget("boxGroupsWeeks", boxGroupsWeeks); - builder->get_widget("boxGroupsDays", boxGroupsDays); - builder->get_widget("boxGroupsHours", boxGroupsHours); - builder->get_widget("boxGroupsMinutes", boxGroupsMinutes); - builder->get_widget("boxUsersWeeks", boxUsersWeeks); - builder->get_widget("boxUsersDays", boxUsersDays); - builder->get_widget("boxUsersHours", boxUsersHours); - builder->get_widget("boxUsersMinutes", boxUsersMinutes); - builder->get_widget("boxProjectWeeks", boxProjectWeeks); - builder->get_widget("boxProjectDays", boxProjectDays); - builder->get_widget("boxProjectHours", boxProjectHours); - builder->get_widget("boxProjectMinutes", boxProjectMinutes); -} - -void MainWindow::open_browser() { - obj_open_browser->open_help(); -} - -void MainWindow::wrapper_save_system() { - int id_mess = obj_wrapper_load_save->wrapper_save_system_cfg(); - int error_save = obj_wrapper_load_save->get_error_save(); - int error_load = obj_wrapper_load_save->get_error_load(); - this->info_warning_error(id_mess, error_save, error_load); -} -void MainWindow::wrapper_save_global() { - int id_mess = obj_wrapper_load_save->wrapper_save_global_cfg(); - int error_save = obj_wrapper_load_save->get_error_save(); - int error_load = obj_wrapper_load_save->get_error_load(); - this->info_warning_error(id_mess, error_save, error_load); -} - -void MainWindow::wrapper_save_all() { - int id_mess = obj_wrapper_load_save->wrapper_save_all_cfg(); - int error_save = obj_wrapper_load_save->get_error_save(); - int error_load = obj_wrapper_load_save->get_error_load(); - this->info_warning_error(id_mess, error_save, error_load); -} - -void MainWindow::wrapper_load_system() { - int id_mess = obj_wrapper_load_save->load_system_cfg(); - int error_save = obj_wrapper_load_save->get_error_save(); - int error_load = obj_wrapper_load_save->get_error_load(); - this->info_warning_error(id_mess, error_save, error_load); - this->init_work_tv_g_u_p(); -} - -void MainWindow::wrapper_load_global() { - int id_mess = obj_wrapper_load_save->load_global_cfg(); - int error_save = obj_wrapper_load_save->get_error_save(); - int error_load = obj_wrapper_load_save->get_error_load(); - this->info_warning_error(id_mess, error_save, error_load); - this->init_work_tv_g_u_p(); -} - -void MainWindow::event() { - boxResize->signal_check_resize().connect(sigc::mem_fun(*this, &MainWindow::resize_widget)); - btnFilterGroups->signal_clicked().connect([&]() {this->filters_show();}); - btnFilterUsers->signal_clicked().connect([&]() {this->filters_show();}); - btnFilterProject->signal_clicked().connect([&]() {this->filters_show();}); - btnSynopsis->signal_activate().connect([&]() {this->open_browser();}); - btnAbout->signal_activate().connect([&]() {obj_open_browser->get_about()->aboutWindows->show();}); - btnSaveLocalGlob->signal_activate().connect([&]() {this->wrapper_save_all();}); - btnSaveGlob->signal_activate().connect([&]() {this->wrapper_save_global();}); - btnSaveLocal->signal_activate().connect([&]() {this->wrapper_save_system();}); - btnLoadGlob->signal_activate().connect([&]() {this->wrapper_load_global();}); - btnLoadLocal->signal_activate().connect([&]() {this->wrapper_load_system();}); - btnEditGroups->signal_clicked().connect(sigc::bind (sigc::mem_fun( *this, - &MainWindow::edit_quota_show), str_groups)); - btnEditUsers->signal_clicked().connect(sigc::bind (sigc::mem_fun( *this, - &MainWindow::edit_quota_show), str_users)); - btnEditProject->signal_clicked().connect([&]() {this->edit_quota_project_show();}); - chbMangSystemFile->signal_toggled().connect([&]() {this->mode_switch_quota();}); - btnDelGroups->signal_clicked().connect( - sigc::bind*, 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*, 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*, 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([&]() {this->obj_view_add_project->show();}); - btnAddUsers->signal_clicked().connect( - sigc::bind&, struct tv_g_u_p> (sigc::mem_fun( *this, - &MainWindow::set_add_tv_g_u_p), str_users, usersQuotasTree, row, list_store_users, obj_tv_g_u_p)); - btnAddGroups->signal_clicked().connect( - sigc::bind&, struct tv_g_u_p> (sigc::mem_fun( *this, - &MainWindow::set_add_tv_g_u_p), str_groups, groupsQuotasTree, row, list_store_groups, obj_tv_g_u_p)); -} - -void MainWindow::resize_widget() { - // boxGroupsWeeks = boxGroupsWeeks(Gtk::ORIENTATION_HORIZONTAL); -} - -void MainWindow::add_quota_show(string name) { - obj_view_add->set_label_type_quota(name); - obj_view_add->show(); -} - -void MainWindow::edit_quota_show(string name) { - obj_view_edit->set_label_type_quota(name); - obj_view_edit->show(); -} -void MainWindow::edit_quota_project_show() { - obj_view_edit_project->show(); -} -void MainWindow::remove_template(Glib::RefPtr* 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: : check - // 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(string name, Gtk::TreeView* tree_view, Gtk::TreeModel::Row &row, Glib::RefPtr& list_store, struct tv_g_u_p obj_tv_g_u_p) { - if (this->check_space(tree_view)) { - 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; - this->add_quota_show(name); - } -} - -void MainWindow::mode_switch_quota() { - // Todo: check - if (chbMangSystemFile->get_active()) { - mode_quota = "filesystem"; - } - else { - mode_quota = "ubconfig"; - } -} - -void MainWindow::filters_show() { - obj_view_filters->show(); -} - -bool MainWindow::check_space(Gtk::TreeView* tree_view) { - Glib::RefPtr tree_view_model = tree_view->get_model(); - Gtk::TreeModel::Children children = tree_view_model->children(); - string name = ""; - string quotas = ""; - for(Gtk::TreeModel::iterator iter = children.begin(); iter != children.end(); ++iter) { - Gtk::TreeModel::Row row = *iter; - name = row[m_columns.name] + ""; - quotas = row[m_columns.quotas] + ""; - if (name.length() == 0 || quotas.length() == 0) { - return false; - } - } - return true; -} - -void MainWindow::info_status_app(string stule) { - Glib::RefPtr 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_work_tv_g_u_p() { - // Todo: remove - 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 groupsQuotasTreeModel = groupsQuotasTree->get_model(); - groupsQuotasTreeModel->signal_row_changed().connect(sigc::bind - (sigc::mem_fun(*this, &MainWindow::remove_line_template), iter_groups, flag_validate_del_groups)); - Glib::RefPtr ProjectQuotasTreeModel = ProjectQuotasTree->get_model(); - ProjectQuotasTreeModel->signal_row_changed().connect(sigc::bind - (sigc::mem_fun(*this, &MainWindow::remove_line_template), iter_project, flag_validate_del_project)); - Glib::RefPtr usersQuotasTreeModel = usersQuotasTree->get_model(); - usersQuotasTreeModel->signal_row_changed().connect(sigc::bind - (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::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 help() { - string version = string(str_version) + version_application + "\n"; - cout << version.c_str(); - cout << str_help_h; -} - -MainWindow::~MainWindow() {} - -#endif - diff --git a/source/view/ubl-settings-diskquota.h b/source/view/ubl-settings-diskquota.h deleted file mode 100644 index 76f9e9e..0000000 --- a/source/view/ubl-settings-diskquota.h +++ /dev/null @@ -1,273 +0,0 @@ -#ifndef UBL_SETTINGS_QUOTAS_H -#define UBL_SETTINGS_QUOTAS_H - -#include -#include "view_open_browser.h" -#include "../project_lib.h" -#include "../my_type.h" -#include "ubl-util-standard.c" -#include "../var.h" -#include "model/wrapper_load_save.h" -#include "view_filters.h" -#include "view_add_user_group.h" -#include "view_edit_user_group.h" -#include "view_add_project.h" -#include "view_edit_project.h" - -using namespace std; - - - -extern bool flag_save; -extern bool flag_save_local; -extern bool flag_save_global; -extern bool flag_load_global; -extern bool flag_lock_help; - - - -class MainWindow { - public: - class ModelColumns : public Gtk::TreeModel::ColumnRecord { - public: - ModelColumns() {add(name), add(quotas); add(size), - add(soft_limit_size), add(hard_limit_size); add(deferring_size), - add(files); add(soft_limit_files), - add(hard_limit_delay), add(deferring_files); } - Gtk::TreeModelColumn name; - Gtk::TreeModelColumn quotas; - Gtk::TreeModelColumn size; - Gtk::TreeModelColumn soft_limit_size; - Gtk::TreeModelColumn hard_limit_size; - Gtk::TreeModelColumn deferring_size; - Gtk::TreeModelColumn files; - Gtk::TreeModelColumn soft_limit_files; - Gtk::TreeModelColumn hard_limit_delay; - Gtk::TreeModelColumn deferring_files; - }; - class ModelColumnsGeneral : public Gtk::TreeModel::ColumnRecord { - public: - ModelColumnsGeneral() {add(status), add(type_quotas); add(device), - add(user), add(group), add(projects); add(soft_limit_size), - add(hard_limit_size); add(soft_limit_files), add(hard_limit_files), add(deferring_size), - add(deferring_files); } - Gtk::TreeModelColumn status; - Gtk::TreeModelColumn type_quotas; - Gtk::TreeModelColumn device; - Gtk::TreeModelColumn user; - Gtk::TreeModelColumn group; - Gtk::TreeModelColumn projects; - Gtk::TreeModelColumn soft_limit_size; - Gtk::TreeModelColumn hard_limit_size; - Gtk::TreeModelColumn soft_limit_files; - Gtk::TreeModelColumn hard_limit_files; - Gtk::TreeModelColumn deferring_size; - Gtk::TreeModelColumn deferring_files; - }; - ModelColumns m_columns; - ModelColumnsGeneral m_columnsGeneral; - Glib::RefPtr builder; - template - struct Result{ - Type response; - int error; - }; - Gtk::Label *headerTopic; - Gtk::Overlay *HeadOverlay; - Gtk::HeaderBar *headerBar; - Gtk::Widget *boxSave; - Gtk::Widget *boxButton; - Gtk::Box *boxFuncs; - Gtk::Box* boxResize; - Gtk::MenuButton *btnSave; - Gtk::MenuButton *btnLoad; - Gtk::MenuButton *btnSettings; - Gtk::Image *HeadBackgroundImage; - Gtk::Image *imgInfo; - Gtk::Box *boxInfoError; - Gtk::Label *lblWarning; - Gtk::Label *generalTabLabel; - Gtk::Label *UsersTabLabel; - Gtk::Label *GroupsTabLabel; - Gtk::Label *generalGroupsFilesLabel; - Gtk::Label *generalUsersSizeLabel; - Gtk::Label *generalUsersFilesLabel; - Gtk::Label *generalGroupsSizeWeeksLabel; - Gtk::Label *generalGroupsFilesWeeksLabel; - Gtk::Label *generalUsersSizeWeeksLabel; - Gtk::Label *generalUsersFilesWeeksLabel; - Gtk::Label *generalGroupsSizeDaysLabel; - Gtk::Label *generalGroupsFilesDaysLabel; - Gtk::Label *generalUsersSizeDaysLabel; - Gtk::Label *generalUsersFilesDaysLabel; - Gtk::Label *generalGroupsSizeHoursLabel; - Gtk::Label *generalGroupsFilesHoursLabel; - Gtk::Label *generalUsersSizeHoursLabel; - Gtk::Label *generalUsersFilesHoursLabel; - Gtk::Label *generalGroupsSizeMinutesLabel; - Gtk::Label *generalGroupsFilesMinutesLabel; - Gtk::Label *generalUsersSizeMinutesLabel; - Gtk::Label *generalUsersFilesMinutesLabel; - Gtk::Label *ProjectTabLabel; - Gtk::Label *usersProjectLabel; - Gtk::Label *lblLoad; - Gtk::Label *lblSave; - Gtk::MenuItem *btnLoadGlob; - Gtk::MenuItem *btnLoadLocal; - Gtk::MenuItem *btnSynopsis; - Gtk::MenuItem *btnAbout; - Gtk::MenuItem *btnSaveLocalGlob; - Gtk::MenuItem *btnSaveGlob; - Gtk::MenuItem *btnSaveLocal; - Gtk::Label *groupsDeviceLabel; - Gtk::Label *usersDeviceLabel; - Gtk::Label *headLabel; - - Gtk::TreeView *groupsQuotasTree; - Gtk::TreeView *usersQuotasTree; - Gtk::TreeView *ProjectQuotasTree; - Gtk::TreeView *GeneralQuotasTree; - Gtk::Label *quotegroupGroupQuotasLabel; - - - Gtk::ComboBoxText *usersDeviceCombo; - Gtk::ComboBoxText *groupsDeviceCombo; - Gtk::ComboBoxText *generalDeviceCombo; - Gtk::ComboBoxText *usersProjectCombo; - Gtk::Label *lblFstypeGroups; - Gtk::SpinButton *generalGroupsSizeWeeksSpi; - Gtk::SpinButton *generalGroupsFileWeeksSpin; - Gtk::SpinButton *generalGroupsSizeDaySpin; - Gtk::SpinButton *generalGroupsFilesDaySpin; - Gtk::SpinButton *generalGroupsSizeHourSpin; - Gtk::SpinButton *generalGroupsFilesHourSpin; - Gtk::SpinButton *generalGroupsSizeMinuteSpin; - Gtk::SpinButton *generalGroupsFilesMinuteSpin; - Gtk::SpinButton *generalUsersSizWeeksSpin; - Gtk::SpinButton *generalUsersFileWeeksSpin; - Gtk::SpinButton *generalUsersSizeDaySpin; - Gtk::SpinButton *generalUsersFilesDaySpin; - Gtk::SpinButton *generalUsersSizeHourSpin; - Gtk::SpinButton *generalUsersFilesHoursSpin; - Gtk::SpinButton *generalUsersSizeMinuteSpin; - Gtk::SpinButton *generalUsersFilesMinutesSpin; - - - Gtk::Button *btnFilterGroups; - Gtk::Button *btnFilterUsers; - Gtk::Button *btnFilterProject; - Gtk::CheckMenuItem *chbMangSystemFile; - Gtk::Button* btnDelGroups; - Gtk::Button* btnDelProject; - Gtk::Button* btnDelUsers; - Gtk::Button* btnAddGroups; - Gtk::Button* btnAddUsers; - Gtk::Button* btnAddProject; - Gtk::Button* btnEditProject; - Gtk::Button* btnEditUsers; - Gtk::Button* btnEditGroups; - - Gtk::Box* boxGroupsWeeks; - Gtk::Box* boxGroupsDays; - Gtk::Box* boxGroupsHours; - Gtk::Box* boxGroupsMinutes; - Gtk::Box* boxUsersWeeks; - Gtk::Box* boxUsersDays; - Gtk::Box* boxUsersHours; - Gtk::Box* boxUsersMinutes; - Gtk::Box* boxProjectWeeks; - Gtk::Box* boxProjectDays; - Gtk::Box* boxProjectHours; - Gtk::Box* boxProjectMinutes; - - public: - map_str_str* map_gui_cfg = NULL; - map_str_str* map_global_cfg = NULL; - map_str_str* map_system_cfg = NULL; - Wrapper_load_save* obj_wrapper_load_save = NULL; - View_edit_user_group* obj_view_edit = NULL; - View_filters* obj_view_filters = NULL; - View_add_user_group* obj_view_add = NULL; - View_add_project* obj_view_add_project = NULL; - View_edit_project* obj_view_edit_project = NULL; - //Devices::Parted obj_device = Devices::Parted(); - //Quotas_sys::Quotas_sys obj_quotas_sys = Quotas_sys::Quotas_sys(); - //Quotas_ubconfig::Quotas_ubconfig obj_quotas_ubconfig = Quotas_ubconfig::Quotas_ubconfig(); - vector vec_param_names; - map_str_str map_device; - string str_cmd_error; - string save_user_or_group; - string sys_or_ubconfig; - string hw_or_sw = ""; - string mode_quota = "ubconfig"; - Glib::RefPtr list_store_groups; - Glib::RefPtr list_store_users; - Glib::RefPtr list_store_project; - Gtk::TreeModel::iterator iter_groups; - Gtk::TreeModel::iterator iter_users; - Gtk::TreeModel::iterator iter_project; - bool flag_validate_del_groups = false; - bool flag_validate_del_users = false; - bool flag_validate_del_project = false; - Gtk::TreeModel::Row row; - int* socket_ext_id_I = NULL; - int* socket_trd_id_I = NULL; - View_open_browser* obj_open_browser; - const struct tv_g_u_p obj_tv_g_u_p {"", "", "", "", "", "", "", "", "",""}; - public: - // MainWindow(BaseObjectType* obj, Glib::RefPtr const& builder); - MainWindow(Glib::RefPtr builder, View_open_browser* obj_open_browser, int* socket_ext_id_I, int* socket_trd_id_I); - ~MainWindow(); - void settings(); - void flag_block_gui(); - void lacalization(); - void add_CSS(); - void resize_widget(); - void get_builder(); - void event(); - void open_browser(); - void info_warning_error(int mess, int error_save, int error_load); - void init_work_tv_g_u_p(); - void remove_line_template(const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator& iter, Gtk::TreeModel::iterator& iter_del, bool& flag_del); - void remove_template(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate_del); - void init_tree_view_general(); - void entry_combo_box_temp(Gtk::ComboBoxText *combo_box, Gtk::Label *label); - void info_status_app(string stule); - void filters_show(); - void set_obj_wrapper_load_save(Wrapper_load_save* obj_wrapper_load_save); - void init_tree_view(); - void del_columns(); - void set_obj_browser(View_open_browser* obj_open_browser); - void set_add_tv_g_u_p(string name, Gtk::TreeView* tree_view, Gtk::TreeModel::Row &row, Glib::RefPtr& list_store, struct tv_g_u_p obj_tv_g_u_p); - void off_quota_system(Gtk::ComboBoxText* combo_box, string quota_type); - void mode_switch_quota(); - void save_quotegroupSaveButton(); - void filling_device_combo_box_template(Gtk::ComboBoxText *combo_box, map_str_str &map_device); - void wrapper_settings_quotas_temp(string save_user_or_group); - void off_quota_ubconfig(Gtk::ComboBoxText* combo_box, string quota_type); - void init_spin_all(); - void view_add_columns(Gtk::TreeView &treeView); - void format_cmd_quotas_system(struct struct_quotas& _struct_quota); - void format_cmd_quotas_ubconfig(struct struct_quotas& _struct_quota); - struct partition_cmd wrapper_settings_quotas(); - void set_map_gui(map_str_str* map_gui_cfg); - void set_map_global(map_str_str* map_global_cfg); - void set_map_local(map_str_str* map_system_cfg); - void wrapper_load_system(); - void wrapper_load_global(); - void wrapper_save_all(); - void wrapper_save_system(); - void wrapper_save_global(); - void set_obj_view_filters(View_filters* obj_view_filters); - bool check_space(Gtk::TreeView* tree_view); - void set_obj_view_add(View_add_user_group* obj_view_edit); - void add_quota_show(string name); - void edit_quota_show(string name); - void set_obj_view_edit(View_edit_user_group* obj_view_edit); - void set_obj_view_add_project(View_add_project* obj_view_add_project); - void set_obj_view_edit_project(View_edit_project* obj_view_edit_project); - void edit_quota_project_show(); -}; -void wrapper_help_show(GtkWidget *self, char* link, gpointer user_data); -void help(); -#endif diff --git a/source/view/ubl-util-standard.c b/source/view/ubl-util-standard.c deleted file mode 100644 index 3b753b1..0000000 --- a/source/view/ubl-util-standard.c +++ /dev/null @@ -1,91 +0,0 @@ -#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 \ No newline at end of file diff --git a/source/view/ubl-util-standard.h b/source/view/ubl-util-standard.h deleted file mode 100644 index 3209625..0000000 --- a/source/view/ubl-util-standard.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __cplusplus -#include -#include - -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 -#include -#include -#include - - -static void ubl_make_plugs(Gtk::Widget *LeftWidget, Gtk::Widget *RightWidget, int left_plug_id, int right_plug_id); -#endif \ No newline at end of file diff --git a/source/view/view_about.cc b/source/view/view_about.cc deleted file mode 100644 index 23e00bb..0000000 --- a/source/view/view_about.cc +++ /dev/null @@ -1,47 +0,0 @@ -#include "view_about.h" - - - -View_about::View_about() { - builder = Gtk::Builder::create_from_file(path_glade); - this->settings(); -} - -View_about::~View_about() { -} - -void View_about::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); - headerAboutTopic->set_label(_(app_name)); -} - -void View_about::set_version(string version_application) { - version_application = version_application; -} - -void View_about::show() { - aboutWindows->show(); -} -void View_about::get_builder() { - builder->get_widget("btnBoxAboutDialog", btnBoxAboutDialog); - builder->get_widget("aboutWindows", aboutWindows); - builder->get_widget("headerAboutTopic", headerAboutTopic); -} - -void View_about::settings() { - this->get_builder(); - this->lacalization(); - btnBoxAboutDialog->set_visible(false); -} - -View_about* View_about::get_self() { - return this; -} \ No newline at end of file diff --git a/source/view/view_about.h b/source/view/view_about.h deleted file mode 100644 index c3b44ff..0000000 --- a/source/view/view_about.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef VIEW_ABOUT_H -#define VIEW_ABOUT_H -#include "../project_lib.h" -#include "model/util.h" -#include "../var.h" - -class View_about -{ -private: - string version_application; -private: - Glib::RefPtr builder; - Gtk::Label *headerAboutTopic; - Gtk::ButtonBox *btnBoxAboutDialog; -public: - Gtk::AboutDialog *aboutWindows; -public: - View_about(); - ~View_about(); - void lacalization(); - void event(); - View_about* get_self(); - void get_builder(); - void settings(); - void show(); - void set_path_glade(string str_path_glade); - void set_version(string version_application); -}; -#endif \ No newline at end of file diff --git a/source/view/view_add_project.cc b/source/view/view_add_project.cc deleted file mode 100644 index 80751d6..0000000 --- a/source/view/view_add_project.cc +++ /dev/null @@ -1,139 +0,0 @@ -#include "view_add_project.h" - -View_add_project::View_add_project(/* args */) { - builder = Gtk::Builder::create_from_file(path_glade); - this->setting(); -} - -View_add_project::~View_add_project() -{ -} - -void View_add_project::setting() { - this->get_builder(); - this->lacalization(); - check_limit(quotegroupSizeSoftLimitCheckProject - ,quotegroupSizeSoftLimitSpinProject - ,quotegroupSizeSoftLimitComboProject); - check_limit(quotegroupSizeHardLimitCheckProject - ,quotegroupSizeHardLimitSpin1 - ,quotegroupSizeHardLimitComboProject); - check_limit(quotegroupFilesSoftLimitCheckProject - ,quotegroupFilesSoftLimitSpinProject - ,quotegroupFilesSoftLimitlabelProject); - check_limit(quotegroupFilesHardLimitCheckProject - ,quotegroupFilesHardLimitSpinProject - ,quotegroupFilesHarLimitLabelProject); - this->event(); -} - -void View_add_project::event() { - quotegroupSizeSoftLimitCheckProject->signal_toggled().connect([&]() { - check_limit(quotegroupSizeSoftLimitCheckProject - ,quotegroupSizeSoftLimitSpinProject - ,quotegroupSizeSoftLimitComboProject); - }); - quotegroupSizeHardLimitCheckProject->signal_toggled().connect([&]() { - check_limit(quotegroupSizeHardLimitCheckProject - ,quotegroupSizeHardLimitSpin1 - ,quotegroupSizeHardLimitComboProject); - }); - quotegroupFilesSoftLimitCheckProject->signal_toggled().connect([&]() { - check_limit(quotegroupFilesSoftLimitCheckProject - ,quotegroupFilesSoftLimitSpinProject - ,quotegroupFilesSoftLimitlabelProject); - }); - quotegroupFilesHardLimitCheckProject->signal_toggled().connect([&]() { - check_limit(quotegroupFilesHardLimitCheckProject - ,quotegroupFilesHardLimitSpinProject - ,quotegroupFilesHarLimitLabelProject); - }); - quotegroupCancelButtonAdd->signal_clicked().connect([&]() {this->close_wnd();}); - quotegroupSaveButtonAdd->signal_clicked().connect([&]() {this->save();}); - btnReviewProject->signal_clicked().connect([&]() {show_file_manager();}); - btnFilemangerOk->signal_clicked().connect([&]() {save_file_manager();}); - btnFilemangerExit->signal_clicked().connect([&]() {wndChooseFileWallpaper->hide();}); -} - -void View_add_project::show_file_manager() { - wndChooseFileWallpaper->set_current_folder(open_dir_file_manager); - wndChooseFileWallpaper->show(); -} - -void View_add_project::save_file_manager() { - entryCatalogProject->set_text(wndChooseFileWallpaper->get_filename()); - wndChooseFileWallpaper->hide(); -} -void View_add_project::close_wnd() { - wndQuotasAddProject->hide(); -} - -void View_add_project::save() { - wndQuotasAddProject->hide(); -} - -void View_add_project::show() { - wndQuotasAddProject->show(); -} - -void View_add_project::get_builder() { - builder->get_widget("wndQuotasAddProject", wndQuotasAddProject); - builder->get_widget("quotegroupSizeFrameLabelProject", quotegroupSizeFrameLabelProject); - builder->get_widget("quotegroupFilesFrameLabelProject", quotegroupFilesFrameLabelProject); - builder->get_widget("quotegroupSizeCurrentlyLabelProject", quotegroupSizeCurrentlyLabelProject); - builder->get_widget("quotegroupFilesCurrentlyLabelProject", quotegroupFilesCurrentlyLabelProject); - builder->get_widget("quotegroupSizeSoftLimitLabelProject", quotegroupSizeSoftLimitLabelProject); - builder->get_widget("quotegroupFilesSoftLimitLabelProject", quotegroupFilesSoftLimitLabelProject); - builder->get_widget("quoteSizeHardLimitLabelProject", quoteSizeHardLimitLabelProject); - builder->get_widget("quoteFilesHardLimitLabelProject", quoteFilesHardLimitLabelProject); - builder->get_widget("quotegroupFilesSoftLimitlabelProject", quotegroupFilesSoftLimitlabelProject); - builder->get_widget("quotegroupFilesHarLimitLabelProject", quotegroupFilesHarLimitLabelProject); - builder->get_widget("quotegroupCancelButtonAdd", quotegroupCancelButtonAdd); - builder->get_widget("quotegroupSaveButtonAdd", quotegroupSaveButtonAdd); - builder->get_widget("lblDeviceProject", lblDeviceProject); - builder->get_widget("lblStatusQuotaProject", lblStatusQuotaProject); - builder->get_widget("lblCatalogProject", lblCatalogProject); - builder->get_widget("lblProjectId", lblProjectId); - builder->get_widget("lblProjectName", lblProjectName); - builder->get_widget("btnReviewProject", btnReviewProject); - builder->get_widget("btnGenerateProject", btnGenerateProject); - builder->get_widget("chbAuto", chbAuto); - builder->get_widget("entryCatalogProject", entryCatalogProject); - builder->get_widget("entryProjectId", entryProjectId); - builder->get_widget("entryProjectName", entryProjectName); - builder->get_widget("quotegroupSizeSoftLimitCheckProject", quotegroupSizeSoftLimitCheckProject); - builder->get_widget("quotegroupSizeHardLimitCheckProject", quotegroupSizeHardLimitCheckProject); - builder->get_widget("quotegroupFilesSoftLimitCheckProject", quotegroupFilesSoftLimitCheckProject); - builder->get_widget("quotegroupFilesHardLimitCheckProject", quotegroupFilesHardLimitCheckProject); - builder->get_widget("quotegroupSizeSoftLimitSpinProject", quotegroupSizeSoftLimitSpinProject); - builder->get_widget("quotegroupSizeHardLimitSpin1", quotegroupSizeHardLimitSpin1); - builder->get_widget("quotegroupFilesSoftLimitSpinProject", quotegroupFilesSoftLimitSpinProject); - builder->get_widget("quotegroupFilesHardLimitSpinProject", quotegroupFilesHardLimitSpinProject); - builder->get_widget("quotegroupSizeSoftLimitComboProject", quotegroupSizeSoftLimitComboProject); - builder->get_widget("quotegroupSizeHardLimitComboProject", quotegroupSizeHardLimitComboProject); - builder->get_widget("wndChooseFileWallpaper", wndChooseFileWallpaper); - builder->get_widget("btnFilemangerExit", btnFilemangerExit); - builder->get_widget("btnFilemangerOk", btnFilemangerOk); -} - -void View_add_project::lacalization() { - this->fill_in_pow_memory(quotegroupSizeSoftLimitComboProject); - this->fill_in_pow_memory(quotegroupSizeHardLimitComboProject); -} - - -void View_add_project::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 View_add_project::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 View_add_project::fill_in_pow_memory(Gtk::ComboBoxText *cb_text) { - cb_text->append(str_prefix_KB); - cb_text->append(str_prefix_MB); - cb_text->append(str_prefix_GB); - cb_text->append(str_prefix_TB); -} diff --git a/source/view/view_add_project.h b/source/view/view_add_project.h deleted file mode 100644 index 8ab125f..0000000 --- a/source/view/view_add_project.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef VIEW_ADD_PROJECT_H -#define VIEW_ADD_PROJECT_H -#include "../project_lib.h" -#include "../var.h" -class View_add_project -{ -private: - Glib::RefPtr builder; - Gtk::Window* wndQuotasAddProject; - Gtk::Label* quotegroupSizeFrameLabelProject; - Gtk::Label* quotegroupFilesFrameLabelProject; - Gtk::Label* quotegroupSizeCurrentlyLabelProject; - Gtk::Label* quotegroupFilesCurrentlyLabelProject; - Gtk::Label* quotegroupSizeSoftLimitLabelProject; - Gtk::Label* quotegroupFilesSoftLimitLabelProject; - Gtk::Label* quoteSizeHardLimitLabelProject; - Gtk::Label* quoteFilesHardLimitLabelProject; - Gtk::Label* quotegroupFilesSoftLimitlabelProject; - Gtk::Label* quotegroupFilesHarLimitLabelProject; - Gtk::Label* lblDeviceProject; - Gtk::Label* lblStatusQuotaProject; - Gtk::Label* lblCatalogProject; - Gtk::Label* lblProjectId; - Gtk::Label* lblProjectName; - Gtk::Button* quotegroupCancelButtonAdd; - Gtk::Button* quotegroupSaveButtonAdd; - Gtk::Button* btnReviewProject; - Gtk::Button* btnGenerateProject; - Gtk::Entry* entryCatalogProject; - Gtk::Entry* entryProjectId; - Gtk::Entry* entryProjectName; - Gtk::CheckButton* chbAuto; - Gtk::CheckButton* quotegroupSizeSoftLimitCheckProject; - Gtk::CheckButton* quotegroupSizeHardLimitCheckProject; - Gtk::CheckButton* quotegroupFilesSoftLimitCheckProject; - Gtk::CheckButton* quotegroupFilesHardLimitCheckProject; - Gtk::SpinButton* quotegroupSizeSoftLimitSpinProject; - Gtk::SpinButton* quotegroupSizeHardLimitSpin1; - Gtk::SpinButton* quotegroupFilesSoftLimitSpinProject; - Gtk::SpinButton* quotegroupFilesHardLimitSpinProject; - Gtk::ComboBoxText* quotegroupSizeSoftLimitComboProject; - Gtk::ComboBoxText* quotegroupSizeHardLimitComboProject; - Gtk::FileChooserDialog* wndChooseFileWallpaper; - Gtk::Button* btnFilemangerOk; - Gtk::Button* btnFilemangerExit; - -public: - View_add_project(/* args */); - ~View_add_project(); - void setting(); - void lacalization(); - void event(); - void show(); - void close_wnd(); - void save(); - void get_builder(); - void check_limit(Gtk::CheckButton *check_button, Gtk::SpinButton *spin, Gtk::ComboBoxText *combo_box); - void check_limit(Gtk::CheckButton *check_button, Gtk::SpinButton *spin, Gtk::Label *combo_box); - void fill_in_pow_memory(Gtk::ComboBoxText *cb_text); - void show_file_manager(); - void save_file_manager(); -}; - - - - -#endif \ No newline at end of file diff --git a/source/view/view_add_user_group.cc b/source/view/view_add_user_group.cc deleted file mode 100644 index c70f838..0000000 --- a/source/view/view_add_user_group.cc +++ /dev/null @@ -1,118 +0,0 @@ -#include "view_add_user_group.h" - - -View_add_user_group::View_add_user_group(/* args */) { - builder = Gtk::Builder::create_from_file(path_glade); - this->settings(); -} - -View_add_user_group::~View_add_user_group() { -} - -void View_add_user_group::settings() { - this->get_builder(); - this->lacalization(); - check_limit(quotegroupSizeSoftLimitCheck - ,quotegroupSizeSoftLimitSpin - ,quotegroupSizeSoftLimitCombo); - check_limit(quotegroupSizeHardLimitCheck - ,quotegroupSizeHardLimitSpin - ,quotegroupSizeHardLimitCombo); - check_limit(quotegroupFilesSoftLimitCheck - ,quotegroupFilesSoftLimitSpin - ,quotegroupFilesSoftLimitlabel); - check_limit(quotegroupFilesHardLimitCheck - ,quotegroupFilesHardLimitSpin - ,quotegroupFilesHarLimitLabel); - this->event(); -} - -void View_add_user_group::event() { - quotegroupCancelButton->signal_clicked().connect([&]() {QuotasEditWindow->hide();}); - quotegroupSaveButton->signal_clicked().connect([&]() {}); - 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); - }); - -} - -void View_add_user_group::get_builder() { - builder->get_widget("lblSetDevice", lblSetDevice); - builder->get_widget("lblQuotasStatus", lblQuotasStatus); - builder->get_widget("lblSetUGP", lblSetUGP); - builder->get_widget("lblSetNameDevice", lblSetNameDevice); - builder->get_widget("lblSetQuotasStatus", lblSetQuotasStatus); - builder->get_widget("cmbSetNameUGP", cmbSetNameUGP); - 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("QuotasEditWindow", QuotasEditWindow); - builder->get_widget("lblHeadQuotasEditWindow", lblHeadQuotasEditWindow); - builder->get_widget("quotegroupCancelButton", quotegroupCancelButton); - builder->get_widget("quotegroupSaveButton", quotegroupSaveButton); - builder->get_widget("quotegroupSizeSoftLimitSpin", quotegroupSizeSoftLimitSpin); - builder->get_widget("quotegroupSizeHardLimitSpin", quotegroupSizeHardLimitSpin); - builder->get_widget("quotegroupFilesSoftLimitSpin", quotegroupFilesSoftLimitSpin); - builder->get_widget("quotegroupFilesHardLimitSpin", quotegroupFilesHardLimitSpin); - builder->get_widget("quotegroupFilesSoftLimitlabel", quotegroupFilesSoftLimitlabel); - builder->get_widget("quotegroupSizeSoftLimitCombo", quotegroupSizeSoftLimitCombo); - builder->get_widget("quotegroupSizeHardLimitCombo", quotegroupSizeHardLimitCombo); - builder->get_widget("quotegroupSizeSoftLimitCheck", quotegroupSizeSoftLimitCheck); - builder->get_widget("quotegroupSizeHardLimitCheck", quotegroupSizeHardLimitCheck); - builder->get_widget("quotegroupFilesSoftLimitCheck", quotegroupFilesSoftLimitCheck); - builder->get_widget("quotegroupFilesHardLimitCheck", quotegroupFilesHardLimitCheck); - -} - -void View_add_user_group::show() { - QuotasEditWindow->show(); -} - -void View_add_user_group::lacalization() { - this->fill_in_pow_memory(quotegroupSizeSoftLimitCombo); - this->fill_in_pow_memory(quotegroupSizeHardLimitCombo); - -} - -void View_add_user_group::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 View_add_user_group::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 View_add_user_group::fill_in_pow_memory(Gtk::ComboBoxText *cb_text) { - cb_text->append(str_prefix_KB); - cb_text->append(str_prefix_MB); - cb_text->append(str_prefix_GB); - cb_text->append(str_prefix_TB); -} - -void View_add_user_group::set_label_type_quota(string name) { - lblSetUGP->set_text(name); -} diff --git a/source/view/view_add_user_group.h b/source/view/view_add_user_group.h deleted file mode 100644 index 27a4b99..0000000 --- a/source/view/view_add_user_group.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef VIEW_SET_USER_GROUP_H -#define VIEW_SET_USER_GROUP_H -#include "../project_lib.h" -#include "../var.h" - -using namespace std; -class View_add_user_group -{ -private: - string str_path_glade; -private: - Glib::RefPtr builder; - Gtk::Label* lblSetDevice; - Gtk::Label* lblQuotasStatus; - Gtk::Label* lblSetUGP; - Gtk::Label* lblSetNameDevice; - Gtk::Label* lblSetQuotasStatus; - Gtk::ComboBoxText* cmbSetNameUGP; - Gtk::Label *quotegroupSizeFrameLabel; - Gtk::Label *quotegroupSizeCurrentlyLabel; - Gtk::Label *quoteSizeHardLimitLabel; - Gtk::Label *quotegroupFilesFrameLabel; - Gtk::Label *quotegroupFilesCurrentlyLabel; - Gtk::Label *quotegroupFilesSoftLimitLabel; - Gtk::Label *quoteFilesHardLimitLabel; - Gtk::Label *quotegroupFilesHarLimitLabel; - Gtk::Label *quotegroupSizeSoftLimitLabel; - Gtk::Window *QuotasEditWindow; - Gtk::Label *lblHeadQuotasEditWindow; - Gtk::Button *quotegroupCancelButton; - Gtk::Button *quotegroupSaveButton; - Gtk::SpinButton *quotegroupSizeSoftLimitSpin; - Gtk::SpinButton *quotegroupSizeHardLimitSpin; - Gtk::SpinButton *quotegroupFilesSoftLimitSpin; - Gtk::SpinButton *quotegroupFilesHardLimitSpin; - Gtk::Label *quotegroupFilesSoftLimitlabel; - Gtk::ComboBoxText *quotegroupSizeSoftLimitCombo; - Gtk::ComboBoxText *quotegroupSizeHardLimitCombo; - Gtk::CheckButton *quotegroupSizeSoftLimitCheck; - Gtk::CheckButton *quotegroupSizeHardLimitCheck; - Gtk::CheckButton *quotegroupFilesSoftLimitCheck; - Gtk::CheckButton *quotegroupFilesHardLimitCheck; -public: - View_add_user_group(/* args */); - ~View_add_user_group(); - void lacalization(); - void event(); - void get_builder(); - void settings(); - void show(); - void set_path_glade(string str_path_glade); - void set_label_type_quota(string name); -private: - void set_change_gui(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate, Gtk::ComboBoxText *combo_box); - void fill_in_pow_memory(Gtk::ComboBoxText *cb_text); - void check_limit(Gtk::CheckButton *check_button, Gtk::SpinButton *spin, Gtk::ComboBoxText *combo_box); - void check_limit(Gtk::CheckButton *check_button, Gtk::SpinButton *spin, Gtk::Label *combo_box); - void edit_tree_view_U(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate); - void edit_tree_view_G(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate); - void edit_tree_view_P(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate); -}; - -#endif \ No newline at end of file diff --git a/source/view/view_edit_project.cc b/source/view/view_edit_project.cc deleted file mode 100644 index 51ad84e..0000000 --- a/source/view/view_edit_project.cc +++ /dev/null @@ -1,124 +0,0 @@ -#include "view_edit_project.h" - -View_edit_project::View_edit_project(/* args */) { - builder = Gtk::Builder::create_from_file(path_glade); - this->setting(); -} - -View_edit_project::~View_edit_project() -{ -} - -void View_edit_project::setting() { - this->get_builder(); - this->lacalization(); - check_limit(quoteSizeSoftLimitCheckProjectEdit - ,quoteSizeSoftLimitSpinProjectEdit - ,quoteSizeSoftLimitComboProjectEdit); - check_limit(quoteSizeHardLimitCheckProjectEdit - ,quoteSizeHardLimitSpinEdit - ,quoteSizeHardLimitComboProjectEdit); - check_limit(quoteFilesSoftLimitCheckProjectEdit - ,quoteFilesSoftLimitSpinProjectEdit - ,quoteFilesProjectEdit); - check_limit(quoteFilesHardLimitCheckProjectEdit - ,quoteFilesHardLimitSpinProjectEdit - ,quoteFiles1ProjectEdit); - this->event(); -} - -void View_edit_project::event() { - - quoteCancelButtonEdit->signal_clicked().connect([&]() {this->close_wnd();}); - quoteSaveButtonEdit->signal_clicked().connect([&]() {this->save();}); - quoteSizeSoftLimitCheckProjectEdit->signal_toggled().connect([&]() { - check_limit(quoteSizeSoftLimitCheckProjectEdit - ,quoteSizeSoftLimitSpinProjectEdit - ,quoteSizeSoftLimitComboProjectEdit); - }); - quoteSizeHardLimitCheckProjectEdit->signal_toggled().connect([&]() { - check_limit(quoteSizeHardLimitCheckProjectEdit - ,quoteSizeHardLimitSpinEdit - ,quoteSizeHardLimitComboProjectEdit); - }); - quoteFilesSoftLimitCheckProjectEdit->signal_toggled().connect([&]() { - check_limit(quoteFilesSoftLimitCheckProjectEdit - ,quoteFilesSoftLimitSpinProjectEdit - ,quoteFilesProjectEdit); - }); - quoteFilesSoftLimitCheckProjectEdit->signal_toggled().connect([&]() { - check_limit(quoteFilesSoftLimitCheckProjectEdit - ,quoteFilesHardLimitSpinProjectEdit - ,quoteFiles1ProjectEdit); - }); -} - -void View_edit_project::close_wnd() { - wndQuotasEditProject->hide(); -} - -void View_edit_project::save() { - wndQuotasEditProject->hide(); -} - -void View_edit_project::show() { - wndQuotasEditProject->show(); -} - -void View_edit_project::get_builder() { - builder->get_widget("lblDeviceProjectEdit", lblDeviceProjectEdit); - builder->get_widget("lblEditDeviceProjectValue", lblEditDeviceProjectValue); - builder->get_widget("lblStatusQuotaProjectEdit", lblStatusQuotaProjectEdit); - builder->get_widget("lblStatusQuotaProjectValueEdit", lblStatusQuotaProjectValueEdit); - builder->get_widget("lblCatalogProjectEdit", lblCatalogProjectEdit); - builder->get_widget("lblCatalogProjectEdit", lblCatalogProjectEdit); - builder->get_widget("lblProjectIdEdit", lblProjectIdEdit); - builder->get_widget("lblProjectIdValueEdit", lblProjectIdValueEdit); - builder->get_widget("lblProjectNameEdit", lblProjectNameEdit); - builder->get_widget("entryProjectNameEditValue", entryProjectNameEditValue); - builder->get_widget("quoteSizeFrameLabelProjectEdit", quoteSizeFrameLabelProjectEdit); - builder->get_widget("quoteSizeCurrentlyLabelProjectEdit", quoteSizeCurrentlyLabelProjectEdit); - builder->get_widget("quoteSizeSoftLimitLabelProjectEdit", quoteSizeSoftLimitLabelProjectEdit); - builder->get_widget("quoteSizeSoftLimitCheckProjectEdit", quoteSizeSoftLimitCheckProjectEdit); - builder->get_widget("quoteSizeSoftLimitSpinProjectEdit", quoteSizeSoftLimitSpinProjectEdit); - builder->get_widget("quoteSizeSoftLimitComboProjectEdit", quoteSizeSoftLimitComboProjectEdit); - builder->get_widget("quoteSizeHardLimitLabelProjectEdit", quoteSizeHardLimitLabelProjectEdit); - builder->get_widget("quoteSizeHardLimitCheckProjectEdit", quoteSizeHardLimitCheckProjectEdit); - builder->get_widget("quoteSizeHardLimitSpinEdit", quoteSizeHardLimitSpinEdit); - builder->get_widget("quoteSizeHardLimitComboProjectEdit", quoteSizeHardLimitComboProjectEdit); - builder->get_widget("quoteFilesFrameLabelProjectEdit", quoteFilesFrameLabelProjectEdit); - builder->get_widget("quoteFilesCurrentlyLabelProjectEdit", quoteFilesCurrentlyLabelProjectEdit); - builder->get_widget("quoteFilesSoftLimitLabelProjectEdit", quoteFilesSoftLimitLabelProjectEdit); - builder->get_widget("quoteFilesSoftLimitCheckProjectEdit", quoteFilesSoftLimitCheckProjectEdit); - builder->get_widget("quoteFilesSoftLimitSpinProjectEdit", quoteFilesSoftLimitSpinProjectEdit); - builder->get_widget("quoteFilesHardLimitCheckProjectEdit", quoteFilesHardLimitCheckProjectEdit); - builder->get_widget("quoteFilesHardLimitSpinProjectEdit", quoteFilesHardLimitSpinProjectEdit); - builder->get_widget("quoteCancelButtonEdit", quoteCancelButtonEdit); - builder->get_widget("quoteSaveButtonEdit", quoteSaveButtonEdit); - builder->get_widget("quoteFilesProjectEdit", quoteFilesProjectEdit); - builder->get_widget("quoteFiles1ProjectEdit", quoteFiles1ProjectEdit); - builder->get_widget("wndQuotasEditProject", wndQuotasEditProject); - builder->get_widget("quoteFilesHardLimitLabelProject1", quoteFilesHardLimitLabelProject1); -} - -void View_edit_project::lacalization() { - this->fill_in_pow_memory(quoteSizeSoftLimitComboProjectEdit); - this->fill_in_pow_memory(quoteSizeHardLimitComboProjectEdit); -} - - -void View_edit_project::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 View_edit_project::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 View_edit_project::fill_in_pow_memory(Gtk::ComboBoxText *cb_text) { - cb_text->append(str_prefix_KB); - cb_text->append(str_prefix_MB); - cb_text->append(str_prefix_GB); - cb_text->append(str_prefix_TB); -} \ No newline at end of file diff --git a/source/view/view_edit_project.h b/source/view/view_edit_project.h deleted file mode 100644 index d7977e1..0000000 --- a/source/view/view_edit_project.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef VIEW_EDIT_PROJECT_H -#define VIEW_EDIT_PROJECT_H -#include "../project_lib.h" -#include "../var.h" -class View_edit_project -{ -private: - Glib::RefPtr builder; - Gtk::Window* wndQuotasEditProject; - Gtk::Label* lblDeviceProjectEdit; - Gtk::Label* lblEditDeviceProjectValue; - Gtk::Label* lblStatusQuotaProjectEdit; - Gtk::Label* lblStatusQuotaProjectValueEdit; - Gtk::Label* lblCatalogProjectEdit; - Gtk::Label* lblProjectIdEdit; - Gtk::Label* lblProjectIdValueEdit; - Gtk::Label* lblProjectNameEdit; - Gtk::Label* quoteSizeFrameLabelProjectEdit; - Gtk::Label* quoteFilesFrameLabelProjectEdit; - Gtk::Label* quoteSizeCurrentlyLabelProjectEdit; - Gtk::Label* quoteSizeSoftLimitLabelProjectEdit; - Gtk::Label* quoteSizeHardLimitLabelProjectEdit; - Gtk::Label* quoteFilesCurrentlyLabelProjectEdit; - Gtk::Label* quoteFilesSoftLimitLabelProjectEdit; - Gtk::Label* quoteFilesHardLimitLabelProject1; - Gtk::Label* quoteFilesProjectEdit; - Gtk::Label* quoteFiles1ProjectEdit; - Gtk::CheckButton* quoteSizeSoftLimitCheckProjectEdit; - Gtk::CheckButton* quoteSizeHardLimitCheckProjectEdit; - Gtk::CheckButton* quoteFilesSoftLimitCheckProjectEdit; - Gtk::CheckButton* quoteFilesHardLimitCheckProjectEdit; - Gtk::SpinButton* quoteSizeSoftLimitSpinProjectEdit; - Gtk::SpinButton* quoteSizeHardLimitSpinEdit; - Gtk::SpinButton* quoteFilesSoftLimitSpinProjectEdit; - Gtk::SpinButton* quoteFilesHardLimitSpinProjectEdit; - Gtk::ComboBoxText* quoteSizeSoftLimitComboProjectEdit; - Gtk::ComboBoxText* quoteSizeHardLimitComboProjectEdit; - Gtk::Button* quoteSaveButtonEdit; - Gtk::Button* quoteCancelButtonEdit; - Gtk::Entry* entryProjectNameEditValue; -public: - View_edit_project(/* args */); - ~View_edit_project(); - void setting(); - void event(); - void show(); - void get_builder(); - void lacalization(); - void check_limit(Gtk::CheckButton *check_button, Gtk::SpinButton *spin, Gtk::ComboBoxText *combo_box); - void check_limit(Gtk::CheckButton *check_button, Gtk::SpinButton *spin, Gtk::Label *combo_box); - void fill_in_pow_memory(Gtk::ComboBoxText *cb_text); - void close_wnd(); - void save(); -}; - - - - -#endif \ No newline at end of file diff --git a/source/view/view_edit_user_group.cc b/source/view/view_edit_user_group.cc deleted file mode 100644 index 7253b20..0000000 --- a/source/view/view_edit_user_group.cc +++ /dev/null @@ -1,115 +0,0 @@ -#include "view_edit_user_group.h" - -View_edit_user_group::View_edit_user_group(/* args */) { - builder = Gtk::Builder::create_from_file(path_glade); - this->setting(); -} - -View_edit_user_group::~View_edit_user_group() -{ -} - -void View_edit_user_group::setting() { - this->get_builder(); - this->lacalization(); - check_limit(quotegroupSizeSoftLimitCheckUser - ,quotegroupSizeSoftLimitSpinUser - ,quotegroupSizeSoftLimitComboUser); - check_limit(quotegroupSizeHardLimitCheckUser - ,quotegroupSizeHardLimitSpinUser - ,quotegroupSizeHardLimitComboUser); - check_limit(quotegroupFilesSoftLimitCheckUser - ,quotegroupFilesSoftLimitSpinUser - ,quotegroupFilesSoftLimitlabelUser); - check_limit(quotegroupFilesHardLimitCheckUser - ,quotegroupFilesHardLimitSpinUser - ,quotegroupFilesHarLimitLabelUser); - this->event(); -} - -void View_edit_user_group::event() { - btnCancelEditUser->signal_clicked().connect([&]() {wndQuotasEditUser->hide();}); - btnSaveEditUser->signal_clicked().connect([&]() {}); - quotegroupSizeSoftLimitCheckUser->signal_toggled().connect([&]() { - check_limit(quotegroupSizeSoftLimitCheckUser - ,quotegroupSizeSoftLimitSpinUser - ,quotegroupSizeSoftLimitComboUser); - }); - quotegroupSizeHardLimitCheckUser->signal_toggled().connect([&]() { - check_limit(quotegroupSizeHardLimitCheckUser - ,quotegroupSizeHardLimitSpinUser - ,quotegroupSizeHardLimitComboUser); - }); - quotegroupFilesSoftLimitCheckUser->signal_toggled().connect([&]() { - check_limit(quotegroupFilesSoftLimitCheckUser - ,quotegroupFilesSoftLimitSpinUser - ,quotegroupFilesSoftLimitlabelUser); - }); - quotegroupFilesHardLimitCheckUser->signal_toggled().connect([&]() { - check_limit(quotegroupFilesHardLimitCheckUser - ,quotegroupFilesHardLimitSpinUser - ,quotegroupFilesHarLimitLabelUser); - }); -} - -void View_edit_user_group::get_builder() { - builder->get_widget("wndQuotasEditUser", wndQuotasEditUser); - builder->get_widget("btnCancelEditUser", btnCancelEditUser); - builder->get_widget("btnSaveEditUser", btnSaveEditUser); - builder->get_widget("quotegroupSizeSoftLimitCheckUser", quotegroupSizeSoftLimitCheckUser); - builder->get_widget("quotegroupSizeHardLimitCheckUser", quotegroupSizeHardLimitCheckUser); - builder->get_widget("quotegroupFilesSoftLimitCheckUser", quotegroupFilesSoftLimitCheckUser); - builder->get_widget("quotegroupFilesHardLimitCheckUser", quotegroupFilesHardLimitCheckUser); - builder->get_widget("quotegroupSizeSoftLimitSpinUser", quotegroupSizeSoftLimitSpinUser); - builder->get_widget("quotegroupSizeHardLimitSpinUser", quotegroupSizeHardLimitSpinUser); - builder->get_widget("quotegroupFilesSoftLimitSpinUser", quotegroupFilesSoftLimitSpinUser); - builder->get_widget("quotegroupFilesHardLimitSpinUser", quotegroupFilesHardLimitSpinUser); - builder->get_widget("quotegroupSizeSoftLimitComboUser", quotegroupSizeSoftLimitComboUser); - builder->get_widget("quotegroupSizeHardLimitComboUser", quotegroupSizeHardLimitComboUser); - builder->get_widget("quotegroupFilesSoftLimitlabelUser", quotegroupFilesSoftLimitlabelUser); - builder->get_widget("quotegroupFilesHarLimitLabelUser", quotegroupFilesHarLimitLabelUser); - builder->get_widget("quotegroupSizeSoftLimitLabelUser", quotegroupSizeSoftLimitLabelUser); - builder->get_widget("quotegroupFilesSoftLimitLabelUser", quotegroupFilesSoftLimitLabelUser); - builder->get_widget("quotegroupSizeCurrentlyLabelUser", quotegroupSizeCurrentlyLabelUser); - builder->get_widget("quotegroupFilesCurrentlyLabelUser", quotegroupFilesCurrentlyLabelUser); - builder->get_widget("quotegroupSizeFrameLabelUser", quotegroupSizeFrameLabelUser); - builder->get_widget("quotegroupFilesFrameLabelUser", quotegroupFilesFrameLabelUser); - builder->get_widget("lblSetDeviceUser", lblSetDeviceUser); - builder->get_widget("lblQuotasStatusUser", lblQuotasStatusUser); - builder->get_widget("lblSetUGPUser", lblSetUGPUser); - builder->get_widget("lblSetNameDeviceUser", lblSetNameDeviceUser); - builder->get_widget("lblSetQuotasStatusUser", lblSetQuotasStatusUser); - builder->get_widget("lblSetUGPUserValue", lblSetUGPUserValue); - builder->get_widget("lblHeadQuotasEditWindowUser", lblHeadQuotasEditWindowUser); - builder->get_widget("quoteSizeHardLimitLabel1", quoteSizeHardLimitLabel1); - builder->get_widget("quoteFilesHardLimitLabelUser", quoteFilesHardLimitLabelUser); -} - -void View_edit_user_group::lacalization() { - this->fill_in_pow_memory(quotegroupSizeSoftLimitComboUser); - this->fill_in_pow_memory(quotegroupSizeHardLimitComboUser); -} - - -void View_edit_user_group::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 View_edit_user_group::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 View_edit_user_group::fill_in_pow_memory(Gtk::ComboBoxText *cb_text) { - cb_text->append(str_prefix_KB); - cb_text->append(str_prefix_MB); - cb_text->append(str_prefix_GB); - cb_text->append(str_prefix_TB); -} - -void View_edit_user_group::set_label_type_quota(string name) { - lblSetUGPUser->set_text(name); -} -void View_edit_user_group::show() { - wndQuotasEditUser->show(); -} \ No newline at end of file diff --git a/source/view/view_edit_user_group.h b/source/view/view_edit_user_group.h deleted file mode 100644 index 696ceb4..0000000 --- a/source/view/view_edit_user_group.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef VIEW_ADD_USER_GROUP_H -#define VIEW_ADD_USER_GROUP_H -#include "../project_lib.h" -#include "../var.h" -using namespace std; - -class View_edit_user_group -{ -private: - Glib::RefPtr builder; -private: - Gtk::Window* wndQuotasEditUser; - Gtk::Button* btnCancelEditUser; - Gtk::Button* btnSaveEditUser; - Gtk::CheckButton* quotegroupSizeSoftLimitCheckUser; - Gtk::CheckButton* quotegroupSizeHardLimitCheckUser; - Gtk::CheckButton* quotegroupFilesSoftLimitCheckUser; - Gtk::CheckButton* quotegroupFilesHardLimitCheckUser; - Gtk::SpinButton* quotegroupSizeSoftLimitSpinUser; - Gtk::SpinButton* quotegroupSizeHardLimitSpinUser; - Gtk::SpinButton* quotegroupFilesSoftLimitSpinUser; - Gtk::SpinButton* quotegroupFilesHardLimitSpinUser; - Gtk::ComboBoxText* quotegroupSizeSoftLimitComboUser; - Gtk::ComboBoxText* quotegroupSizeHardLimitComboUser; - Gtk::Label* quotegroupFilesSoftLimitlabelUser; - Gtk::Label* quotegroupFilesHarLimitLabelUser; - Gtk::Label* quotegroupSizeSoftLimitLabelUser; - Gtk::Label* quotegroupFilesSoftLimitLabelUser; - Gtk::Label* quotegroupSizeCurrentlyLabelUser; - Gtk::Label* quotegroupFilesCurrentlyLabelUser; - Gtk::Label* quotegroupSizeFrameLabelUser; - Gtk::Label* quotegroupFilesFrameLabelUser; - Gtk::Label* lblSetDeviceUser; - Gtk::Label* lblQuotasStatusUser; - Gtk::Label* lblSetUGPUser; - Gtk::Label* lblSetNameDeviceUser; - Gtk::Label* lblSetQuotasStatusUser; - Gtk::Label* lblSetUGPUserValue; - Gtk::Label* lblHeadQuotasEditWindowUser; - Gtk::Label* quoteSizeHardLimitLabel1; - Gtk::Label* quoteFilesHardLimitLabelUser; - - -public: - View_edit_user_group(/* args */); - ~View_edit_user_group(); - void setting(); - void event(); - void show(); - void get_builder(); - void check_limit(Gtk::CheckButton *check_button, Gtk::SpinButton *spin, Gtk::ComboBoxText *combo_box); - void check_limit(Gtk::CheckButton *check_button, Gtk::SpinButton *spin, Gtk::Label *combo_box); - void fill_in_pow_memory(Gtk::ComboBoxText *cb_text); - void set_label_type_quota(string name); - void lacalization(); -}; - - - - -#endif \ No newline at end of file diff --git a/source/view/view_filters.cc b/source/view/view_filters.cc deleted file mode 100644 index ee8d918..0000000 --- a/source/view/view_filters.cc +++ /dev/null @@ -1,123 +0,0 @@ -#include "view_filters.h" - -View_filters::View_filters(/* args */){ - builder = Gtk::Builder::create_from_file(path_glade); - this->settings(); -} - -View_filters::~View_filters() -{ -} - -void View_filters::settings() { - this->get_builder(); - this->lacalization(); - this->set_map_flag(chbFilterName); - this->set_map_flag(chbFilterQuotas); - this->set_map_flag(chbFilterSize); - this->set_map_flag(chbFilterSoftLimitSize); - this->set_map_flag(chbFilterHardLimitSize); - this->set_map_flag(chbFilterHardLimitSizeDelay); - this->set_map_flag(chbFilterFiles); - this->set_map_flag(chbFilterSoftLimitFile); - this->set_map_flag(chbFilterHardLimitFile); - this->set_map_flag(chbFilterHardLimitFileDelay); - this->event(); -} - -void View_filters::get_builder() { - builder->get_widget("wndFilters", wndFilters); - builder->get_widget("chbFilterName", chbFilterName); - builder->get_widget("chbFilterQuotas", chbFilterQuotas); - builder->get_widget("chbFilterSize", chbFilterSize); - builder->get_widget("chbFilterSoftLimitSize", chbFilterSoftLimitSize); - builder->get_widget("chbFilterHardLimitSize", chbFilterHardLimitSize); - builder->get_widget("chbFilterHardLimitSizeDelay", chbFilterHardLimitSizeDelay); - builder->get_widget("chbFilterFiles", chbFilterFiles); - builder->get_widget("chbFilterSoftLimitFile", chbFilterSoftLimitFile); - builder->get_widget("chbFilterHardLimitFile", chbFilterHardLimitFile); - builder->get_widget("chbFilterHardLimitFileDelay", chbFilterHardLimitFileDelay); - builder->get_widget("lblFiltersHead", lblFiltersHead); - builder->get_widget("btnFiltersSave", btnFiltersSave); - builder->get_widget("btnFiltersCancel", btnFiltersCancel); - lblFiltersHead->set_label(str_filters); -} - -void View_filters::show() { - this->set_map_flag_false(); - wndFilters->show(); -} - -void View_filters::lacalization() { - /* - chbFilterName->set_label(str_name); - chbFilterQuotas->set_label(str_quotas); - chbFilterSize->set_label(str_size); - chbFilterSoftLimitSize->set_label(str_soft_limit_size); - chbFilterHardLimitSize->set_label(str_hard_limit_size); - chbFilterHardLimitSizeDelay->set_label(str_deferring_hard_limit_size); - chbFilterFiles->set_label(str_files); - chbFilterSoftLimitFile->set_label(str_soft_restriction_files); - chbFilterHardLimitFile->set_label(str_severe_limitation_files); - chbFilterHardLimitFileDelay->set_label(str_deferring_limit_files); - */ -} - -void View_filters::event() { - chbFilterName->signal_toggled().connect( - sigc::bind (sigc::mem_fun(*this, - &View_filters::set_map_flag), chbFilterName)); - chbFilterQuotas->signal_toggled().connect( - sigc::bind (sigc::mem_fun(*this, - &View_filters::set_map_flag), chbFilterQuotas)); - chbFilterSize->signal_toggled().connect( - sigc::bind (sigc::mem_fun(*this, - &View_filters::set_map_flag), chbFilterSize)); - chbFilterSoftLimitSize->signal_toggled().connect( - sigc::bind (sigc::mem_fun(*this, - &View_filters::set_map_flag), chbFilterSoftLimitSize)); - chbFilterHardLimitSize->signal_toggled().connect( - sigc::bind (sigc::mem_fun(*this, - &View_filters::set_map_flag), chbFilterHardLimitSize)); - chbFilterHardLimitSizeDelay->signal_toggled().connect( - sigc::bind (sigc::mem_fun(*this, - &View_filters::set_map_flag), chbFilterHardLimitSizeDelay)); - chbFilterFiles->signal_toggled().connect( - sigc::bind (sigc::mem_fun(*this, - &View_filters::set_map_flag), chbFilterFiles)); - chbFilterSoftLimitFile->signal_toggled().connect( - sigc::bind (sigc::mem_fun(*this, - &View_filters::set_map_flag), chbFilterSoftLimitFile)); - chbFilterHardLimitFile->signal_toggled().connect( - sigc::bind (sigc::mem_fun(*this, - &View_filters::set_map_flag), chbFilterHardLimitFile)); - chbFilterHardLimitFileDelay->signal_toggled().connect( - sigc::bind (sigc::mem_fun(*this, - &View_filters::set_map_flag), chbFilterHardLimitFileDelay)); - btnFiltersSave->signal_clicked().connect(sigc::mem_fun(*this, - &View_filters::btn_save)); - btnFiltersCancel->signal_clicked().connect(sigc::mem_fun(*this, - &View_filters::btn_cancel)); -} - -void View_filters::set_map_flag(Gtk::CheckButton* check_button) { - map_filters_flag[check_button->get_label()] = check_button->get_active(); -} - -void View_filters::btn_save() { - wndFilters->hide(); -} - -void View_filters::btn_cancel() { - wndFilters->hide(); -} - -map View_filters::get_filters() { - return map_filters_flag; -} - -void View_filters::set_map_flag_false() { - for (auto& [key, value]: map_filters_flag) { - map_filters_flag[key] = false; - } -} \ No newline at end of file diff --git a/source/view/view_filters.h b/source/view/view_filters.h deleted file mode 100644 index 58a026b..0000000 --- a/source/view/view_filters.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef VIEW_FILTERS_H -#define VIEW_FILTERS_H -#include "../project_lib.h" -#include "../var.h" - -using namespace std; - -class View_filters -{ -private: - map map_filters_flag; -private: - Glib::RefPtr builder; - Gtk::Window *wndFilters; - Gtk::CheckButton *chbFilterName; - Gtk::CheckButton *chbFilterQuotas; - Gtk::CheckButton *chbFilterSize; - Gtk::CheckButton *chbFilterSoftLimitSize; - Gtk::CheckButton *chbFilterHardLimitSize; - Gtk::CheckButton *chbFilterHardLimitSizeDelay; - Gtk::CheckButton *filtersHardSizeActivationFilterCheckbox; - Gtk::CheckButton *chbFilterFiles; - Gtk::CheckButton *chbFilterSoftLimitFile; - Gtk::CheckButton *chbFilterHardLimitFile; - Gtk::CheckButton *chbFilterHardLimitFileDelay; - Gtk::Label *lblFiltersHead; - Gtk::Button *btnFiltersSave; - Gtk::Button *btnFiltersCancel; -public: - View_filters(/* args */); - ~View_filters(); - void lacalization(); - void event(); - void get_builder(); - void settings(); - void show(); -private: - void set_map_flag(Gtk::CheckButton* check_button); - void btn_save(); - void btn_cancel(); - void set_map_flag_false(); - map get_filters(); -}; -#endif - - diff --git a/source/view/view_open_browser.cc b/source/view/view_open_browser.cc deleted file mode 100644 index 45963aa..0000000 --- a/source/view/view_open_browser.cc +++ /dev/null @@ -1,121 +0,0 @@ -#include "view_open_browser.h" - - -View_open_browser* obj_open_browser; -View_about* obj_about; - -void wrapper_help_show(GtkWidget *self, char* link, gpointer user_data) { - if (self && user_data) {} - obj_open_browser->global_lick_doc = link; - obj_about->aboutWindows->hide(); - obj_open_browser->temp_help_show(); -} - -View_open_browser::View_open_browser(/* args */) { - builder = Gtk::Builder::create_from_file(path_glade); -} - -View_open_browser::~View_open_browser() { -} - -void View_open_browser::settings() { - obj_open_browser = this; - this->get_builder(); - #ifdef WEBKIT_FOUND - my_web_kit = WEBKIT_WEB_VIEW( webkit_web_view_new() ); - three = Glib::wrap(GTK_WIDGET(my_web_kit)); - wndWeb->add(*three); - #endif - this->lacalization(); - this->event(); -} - -void View_open_browser::set_obj_about(View_about* obj_view_about) { - this->obj_view_about = obj_view_about; - obj_about = obj_view_about; -} - -void View_open_browser::show() { - this->wndShowWeb->show(); -} -void View_open_browser::get_builder() { - #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); - -} -void View_open_browser::lacalization() { - lblwebHeaderName->set_label(name_app); - lblhelpText->set_text(redirected_documentation); - btnReadHelp->set_label(read_online); - btnCancelHelp->set_label(cancel); - chkAlwaysOpenHelp->set_label(always_redirect); - lblhelpHeader->set_text(read_documentation_web); -} - -void View_open_browser::event() { - g_signal_connect(G_OBJECT(obj_view_about->aboutWindows->gobj()), "activate-link", G_CALLBACK(wrapper_help_show), NULL); - btnCancelHelp->signal_clicked().connect([&]() {wndShowWeb->hide();}); - chkAlwaysOpenHelp->signal_toggled().connect([&]() {flag_open_browser = true;}); - btnReadHelp->signal_clicked().connect(sigc::mem_fun(*this, &View_open_browser::open_browser)); -} - -void View_open_browser::temp_help_show() { - if (flag_open_browser == true) { - this->open_browser(); - } - else { - wndShowWeb->show_all(); - } -} - -void View_open_browser::open_browser() { - #ifdef WEBKIT_FOUND - if (my_web_kit) { - gtk_widget_destroy(GTK_WIDGET(my_web_kit)); - } - my_web_kit = WEBKIT_WEB_VIEW(webkit_web_view_new()); - three = Glib::wrap(GTK_WIDGET(my_web_kit)); - wndWeb->add(*three); - webkit_web_view_load_uri(my_web_kit, _(global_lick_doc.c_str())); - wndWeb->show_all(); - webkit_web_view_load_uri(my_web_kit, _(global_lick_doc.c_str())); - wndWeb->show_all(); - webkit_web_view_load_uri(my_web_kit, _(global_lick_doc.c_str())); - wndWeb->show_all(); - #else - this->template_open_browser(global_lick_doc); - #endif - this->wndShowWeb->hide(); -} - -int View_open_browser::template_open_browser(string str_link_doc) { - string cmd = cmd_xdg + string(_(str_link_doc.c_str())) + " &"; - 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_s); - std::unique_ptr buf(new char[ size ]); - std::snprintf(buf.get(), size, cmd_execute, response_user.c_str(), cmd.c_str()); - cmd = string(buf.get(), buf.get() + size - 1); - } - return system(cmd.c_str()); - -} -void View_open_browser::open_help() { - global_lick_doc = const_link_doc; - temp_help_show(); -} - -View_about* View_open_browser::get_about() { - return obj_view_about; -} diff --git a/source/view/view_open_browser.h b/source/view/view_open_browser.h deleted file mode 100644 index 5f02ca6..0000000 --- a/source/view/view_open_browser.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef VIEW_OPEN_BROWSER_H -#define VIEW_OPEN_BROWSER_H - -#include "../project_lib.h" -#include "view_about.h" -#ifdef WEBKIT_FOUND -#include -#endif -#include "../var.h" - -class View_open_browser { -private: - bool flag_open_browser = false; - View_about* obj_view_about; -private: - Glib::RefPtr builder; - Gtk::Button *btnReadHelp; - Gtk::Button *btnCancelHelp; - Gtk::CheckButton *chkAlwaysOpenHelp; - Gtk::Label *lblwebHeaderName; - Gtk::Label *lblhelpText; - Gtk::Label *lblhelpHeader; - Gtk::Label *lblHeadeWndWeb; -public: - string global_lick_doc; - Gtk::Window *wndShowWeb; - #ifdef WEBKIT_FOUND - Gtk::Window *wndWeb; - Gtk::Widget *three; - WebKitWebView *my_web_kit = NULL; - #endif -public: - View_open_browser(/* args */); - ~View_open_browser(); - void lacalization(); - void event(); - void get_builder(); - void settings(); - void show(); - void open_help(); - void temp_help_show(); - void set_path_glade(string str_path_glade); - void set_obj_about(View_about* View_about); - View_about* get_about(); -private: - int template_open_browser(string str_link_doc); - void open_browser(); -}; -void wrapper_help_show(GtkWidget *self, char* link, gpointer user_data); -#endif \ No newline at end of file diff --git a/source/view_check_user_table.c b/source/view_check_user_table.c new file mode 100644 index 0000000..6acb005 --- /dev/null +++ b/source/view_check_user_table.c @@ -0,0 +1,178 @@ +#include "view_check_user_table.h" + +char* glade_path = NULL; +char* flag_u_g = NULL; +char* table_u_g_set_add_edit; +table_u_g* table_widgets; +vector* _actors; + +void table_u_g_get_actors(vector* actors) { + _actors = actors; +} + +table_u_g* get_widget_table_u_g() { + return table_widgets; +} + +void table_u_g_set_fill_user_group() { + int size = 0; + g_object_ref(table_widgets->liststoreUsersGroups); + gtk_list_store_clear(table_widgets->liststoreUsersGroups); + gboolean active1 = !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(table_widgets->chkActivUsersGroup)); + if (strcmp(flag_u_g, "grpquota")==0) { + gtk_button_set_label(GTK_BUTTON(table_widgets->chkActivUsersGroup), STR_CHK_LABEL_WRITE_ALL_GROUPS); + gtk_label_set_label(GTK_LABEL(table_widgets->lblHeadQuotaUsersGroups), STR_GROUPS); + char** array_groups = philos_list_group(&size,active1); + table_u_g_fill_tree_view(array_groups, size); + GtkTreeViewColumn* column = gtk_tree_view_get_column(GTK_TREE_VIEW(table_widgets->treeViewCheckUsersGroups), 1); + gtk_tree_view_column_set_title(column, STR_GROUPS); + } + else if (strcmp(flag_u_g, "usrquota") == 0) { + gtk_button_set_label(GTK_BUTTON(table_widgets->chkActivUsersGroup), STR_CHK_LABEL_WRITE_ALL_USERS); + gtk_label_set_label(GTK_LABEL(table_widgets->lblHeadQuotaUsersGroups), STR_USERS); + char** array_user = philos_list_user(&size, active1); + table_u_g_fill_tree_view(array_user, size); + } + set_actors(_actors); +} + +table_u_g *setup_table_u_g(){ + /* Widgets getting | Получение виджетов */ + table_widgets = malloc(sizeof(table_u_g)); + device_disk_parsed(); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path); + table_widgets->Window = yon_gtk_builder_get_widget(builder,"tableUserGroupWindow"); + table_widgets->chkActivUsersGroup = yon_gtk_builder_get_widget(builder,"chkActivUsersGroup"); + table_widgets->btnCancel = yon_gtk_builder_get_widget(builder,"quotegroupCancelButton1"); + table_widgets->btnSave = yon_gtk_builder_get_widget(builder,"quotegroupSaveButton1"); + table_widgets->lblHeadQuotaUsersGroups = yon_gtk_builder_get_widget(builder,"lblHeadQuotaUsersGroups"); + table_widgets->treeViewCheckUsersGroups = yon_gtk_builder_get_widget(builder,"treeViewCheckUsersGroups"); + table_widgets->checkColUserGroup = GTK_CELL_RENDERER_TOGGLE(gtk_builder_get_object(builder,"checkColUserGroup")); + table_widgets->liststoreUsersGroups = GTK_LIST_STORE(gtk_builder_get_object(builder, "liststoreUsersGroups")); + table_u_g_set_fill_user_group(); + table_u_g_event(); + g_signal_connect(G_OBJECT(table_widgets->chkActivUsersGroup), "toggled", G_CALLBACK(table_u_g_set_fill_user_group), NULL); +} + + +void table_u_g_set_glade_path(char* _glade_path) { + glade_path = _glade_path; +} + +void table_u_g_set_flag(char* _flag_u_g, char* _table_u_g_set_add_edit) { + flag_u_g = _flag_u_g; + table_u_g_set_add_edit = _table_u_g_set_add_edit; +} + + +void table_u_g_fill_tree_view(char** array, int size) { + GtkTreeModel *model = GTK_TREE_MODEL(table_widgets->liststoreUsersGroups); + g_object_ref(table_widgets->liststoreUsersGroups); + gtk_list_store_clear(table_widgets->liststoreUsersGroups); + for (int i=0; iliststoreUsersGroups,&iter); + gtk_list_store_set(table_widgets->liststoreUsersGroups,&iter, + 0,0, + 1,array[i], + -1); + } + gtk_tree_view_set_model(GTK_TREE_VIEW(table_widgets->treeViewCheckUsersGroups), model); +} + +void table_u_g_show(GtkWidget *self, char* glade_path) { + if (table_widgets != NULL) { + gtk_widget_show(table_widgets->Window); + } + else { + setup_table_u_g(glade_path); + gtk_widget_show(table_widgets->Window); + } +} +void chk_toggled_user_group ( + GtkCellRendererToggle* self, + gchar* path, + gpointer user_data +) { + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(table_widgets->liststoreUsersGroups); + gtk_tree_model_get_iter_from_string(model,&iter,path); + gboolean flag; + gtk_tree_model_get(model,&iter,0, &flag,-1); + gtk_list_store_set(table_widgets->liststoreUsersGroups,&iter, 0,!flag,-1); + gtk_tree_view_set_model(GTK_TREE_VIEW(table_widgets->treeViewCheckUsersGroups), model); +} + + + +vector* get_actors_table(vector* actors) { + model_free_vector_string(actors); + vectorFree(actors); + actors = malloc(sizeof(vector)); + vector_init(actors); + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(table_widgets->liststoreUsersGroups); + int valid = 1; + for(gtk_tree_model_get_iter_first(GTK_TREE_MODEL(table_widgets->liststoreUsersGroups),&iter);valid==1;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(table_widgets->liststoreUsersGroups),&iter)){ + int is_active=0; + char* user_group; + gtk_tree_model_get(model,&iter,0,&is_active,-1); + gtk_tree_model_get(model,&iter,1,&user_group,-1); + if (is_active){ + actors->pfVectorAdd(actors, yon_char_new(user_group)); + } + } + return actors; +} + +void table_u_g_destroy(GtkWidget *self) { + table_widgets = NULL; +} + +void table_u_g_localization(table_u_g *widgets) { + +} + +void table_u_g_on_hide_subwindow(GtkWidget *self) { + gtk_widget_destroy(gtk_widget_get_toplevel(self)); + table_widgets = NULL; +} + +table_u_g *table_u_g_get_widget_filters() { + return table_widgets; +} + +void set_actors(vector* actors) { + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(table_widgets->liststoreUsersGroups); + int valid = 1; + for(gtk_tree_model_get_iter_first(GTK_TREE_MODEL(table_widgets->liststoreUsersGroups),&iter);valid==1;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(table_widgets->liststoreUsersGroups),&iter)){ + char* user_group; + gtk_tree_model_get(model,&iter,1,&user_group,-1); + if (actors->vectorList.total> 0) { + for (int i = 0; i < actors->vectorList.total; i++) { + char* str_actors = (char*)actors->pfVectorGet(actors, i); + if (strcmp(str_actors, user_group)==0){ + gtk_list_store_set(table_widgets->liststoreUsersGroups,&iter, 0,1,-1); + } + } + } + } + gtk_tree_view_set_model(GTK_TREE_VIEW(table_widgets->treeViewCheckUsersGroups), model); +} + +void table_btn_block_save() { + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(table_widgets->liststoreUsersGroups); + int valid = 1; + int flag_activ = 0; + for(gtk_tree_model_get_iter_first(GTK_TREE_MODEL(table_widgets->liststoreUsersGroups),&iter);valid==1;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(table_widgets->liststoreUsersGroups),&iter)){ + int is_active=0; + gtk_tree_model_get(model,&iter,0,&is_active,-1); + char* user_group; + if (is_active){ + flag_activ = 1; + } + } + gtk_widget_set_sensitive(table_widgets->btnSave,flag_activ); +} \ No newline at end of file diff --git a/source/view_check_user_table.h b/source/view_check_user_table.h new file mode 100644 index 0000000..f335237 --- /dev/null +++ b/source/view_check_user_table.h @@ -0,0 +1,47 @@ +#include +#include +#include "model/ubl-utils.h" +#include +#include +#include +#include +#include +#include +#include +#include "../compile/ubl-cmake.h" +#include "model/model.h" +#include "model/load.h" +#include "ubl-strings.h" +#include "model/my_device.h" + +typedef struct { + GtkWidget* btnCancel; + GtkWidget* Window; + GtkWidget* btnSave; + GtkWidget* treeViewCheckUsersGroups; + GtkListStore* liststoreUsersGroups; + GtkCellRendererToggle* checkColUserGroup; + GtkWidget* chkActivUsersGroup; + GtkWidget* lblHeadQuotaUsersGroups; +} table_u_g; + +void table_u_g_table_u_g_event(table_u_g *widgets); +void table_u_g_on_hide_subwindow(GtkWidget *self); +table_u_g *table_u_g_get_widget_filters(); +void table_u_g_destroy(GtkWidget *self); +void table_u_g_event(); +void table_u_g_fill_tree_view(char** array, int size); +void table_u_g_set_flag(char* _flag_u_g, char* _table_u_g_set_add_edit); +void table_u_g_set_glade_path(char* _glade_path); +void table_u_g_show(GtkWidget *self, char* glade_path); +void set_vector(vector* _vec_temp); +vector* get_actors_table(vector* actors); +void table_u_g_get_actors(vector* actors); +void set_actors(vector* actors); +table_u_g* get_widget_table_u_g(); +void chk_toggled_user_group( + GtkCellRendererToggle* self, + gchar* path, + gpointer user_data +); +void table_btn_block_save(); \ No newline at end of file diff --git a/source/view_filters.c b/source/view_filters.c new file mode 100644 index 0000000..66f6ab6 --- /dev/null +++ b/source/view_filters.c @@ -0,0 +1,201 @@ +#include "view_filters.h" +char* flag_filters_u_g_p = NULL; +filters_window *filters_widgets = NULL; +GtkTreeView* _tree_view = NULL; +const int len_user_group = 8; +const int len_project = 10; +gboolean flag_filters_user[8]; +gboolean flag_filters_group[8]; +gboolean flag_filters_project[10]; +filters_window *filters_setup_window(char* glade_path){ + if (filters_widgets == NULL) { + filters_widgets = malloc(sizeof(filters_window)); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path); + filters_widgets->Window = yon_gtk_builder_get_widget(builder,"wndFilters"); + filters_widgets->chbFilterName = yon_gtk_builder_get_widget(builder,"chbFilterName"); + filters_widgets->chbFilterSoftLimitFile = yon_gtk_builder_get_widget(builder,"chbFilterSoftLimitFile"); + filters_widgets->chbFilterFiles = yon_gtk_builder_get_widget(builder,"chbFilterFiles"); + filters_widgets->chbFilterHardLimitSizeDelay = yon_gtk_builder_get_widget(builder,"chbFilterHardLimitSizeDelay"); + filters_widgets->chbFilterHardLimitSize = yon_gtk_builder_get_widget(builder,"chbFilterHardLimitSize"); + filters_widgets->chbFilterSoftLimitSize = yon_gtk_builder_get_widget(builder,"chbFilterSoftLimitSize"); + filters_widgets->chbFilterQuotas = yon_gtk_builder_get_widget(builder,"chbFilterQuotas"); + filters_widgets->chbFilterSize = yon_gtk_builder_get_widget(builder,"chbFilterSize"); + filters_widgets->btnFiltersCancel = yon_gtk_builder_get_widget(builder,"btnFiltersCancel"); + filters_widgets->btnFiltersSave = yon_gtk_builder_get_widget(builder,"btnFiltersSave"); + filters_widgets->chbFilterHardLimitFile = yon_gtk_builder_get_widget(builder,"chbFilterHardLimitFile"); + filters_widgets->chbFilterHardLimitFileDelay = yon_gtk_builder_get_widget(builder,"chbFilterHardLimitFileDelay"); + filters_widgets->chbProjectName = yon_gtk_builder_get_widget(builder,"chbProjectName"); + filters_widgets->chbFilterDevice = yon_gtk_builder_get_widget(builder,"chbFilterDevice"); + filters_widgets->chkFilterID = yon_gtk_builder_get_widget(builder,"chkFilterID"); + filters_widgets->chbFilterCatalog = yon_gtk_builder_get_widget(builder,"chbFilterCatalog"); + if (strcmp(flag_filters_u_g_p, "prjquota")==0) { + gtk_widget_hide(filters_widgets->chbFilterName); + } + else { + gtk_widget_hide(filters_widgets->chbProjectName); + gtk_widget_hide(filters_widgets->chkFilterID); + gtk_widget_hide(filters_widgets->chbFilterCatalog); + } + filters_event(filters_widgets); + } + filters_set_flag(); + return filters_widgets; +} + +gboolean* filters_get_flag_user() { + flag_filters_user[0] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterName)); + flag_filters_user[1] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterDevice)); + flag_filters_user[2] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterSoftLimitSize)); + flag_filters_user[3] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterHardLimitSize)); + flag_filters_user[4] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterSoftLimitFile)); + flag_filters_user[5] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterHardLimitFile)); + flag_filters_user[6] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterHardLimitSizeDelay)); + flag_filters_user[7] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterHardLimitFileDelay)); + return flag_filters_user; +} + + +gboolean* filters_get_flag_group() { + flag_filters_group[0] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterName)); + flag_filters_group[1] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterDevice)); + flag_filters_group[2] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterSoftLimitSize)); + flag_filters_group[3] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterHardLimitSize)); + flag_filters_group[4] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterSoftLimitFile)); + flag_filters_group[5] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterHardLimitFile)); + flag_filters_group[6] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterHardLimitSizeDelay)); + flag_filters_group[7] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterHardLimitFileDelay)); + return flag_filters_group; +} + + +gboolean* filters_get_flag_project() { + flag_filters_project[0] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterDevice)); + flag_filters_project[1] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterCatalog)); + flag_filters_project[2] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filters_widgets->chkFilterID)); + flag_filters_project[3] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filters_widgets->chbProjectName)); + flag_filters_project[4] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterSoftLimitSize)); + flag_filters_project[5] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterHardLimitSize)); + flag_filters_project[6] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterSoftLimitFile)); + flag_filters_project[7] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterHardLimitFile)); + flag_filters_project[8] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterHardLimitSizeDelay)); + flag_filters_project[9] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterHardLimitFileDelay)); + return flag_filters_project; +} + +void filters_set_name(char* _flag_filters_u_g_p) { + flag_filters_u_g_p = _flag_filters_u_g_p; + +} + +void filters_get_tree_view(GtkWidget *tree_view) { + _tree_view = GTK_TREE_VIEW(tree_view); +} + +void filters_tree_view_update() { + int n_end = len_user_group; + gboolean* array_flags = NULL; + if (strcmp(flag_filters_u_g_p, "prjquota")==0) { + n_end = len_project; + array_flags = filters_get_flag_project(); + } + else { + n_end = len_user_group; + if (strcmp(flag_filters_u_g_p, "usrquota")==0) { + array_flags = filters_get_flag_user(); + } + else { + array_flags = filters_get_flag_group(); + } + } + for (int i = 0; i < n_end; i++) { + GtkTreeViewColumn* column = gtk_tree_view_get_column(_tree_view, i); + gtk_tree_view_column_set_visible(column, array_flags[i]); + } +} +void filters_save(GtkWidget *self) { + filters_tree_view_update(); + filters_on_hide_subwindow(self); + +} + +void filters_event(filters_window *widgets) { + g_signal_connect(G_OBJECT(widgets->btnFiltersSave), "clicked",G_CALLBACK(filters_save),widgets->Window); + g_signal_connect(G_OBJECT(widgets->btnFiltersCancel), "clicked",G_CALLBACK(filters_on_hide_subwindow),widgets->Window); + g_signal_connect(G_OBJECT(widgets->Window), "destroy", G_CALLBACK(filters_destroy), NULL); +} + +void filters_destroy(GtkWidget *self) { + filters_widgets = NULL; +} + +void filters_localization(filters_window *widgets) { + +} + +void filters_on_hide_subwindow(GtkWidget *self) { + gtk_widget_destroy(gtk_widget_get_toplevel(self)); + filters_widgets = NULL; +} + +filters_window *get_widget_filters() { + return filters_widgets; +} + +void filters_show(GtkWidget *self, char* glade_path) { + if (filters_widgets != NULL) { + gtk_widget_show(filters_widgets->Window); + } + else { + filters_setup_window(glade_path); + gtk_widget_show(filters_widgets->Window); + } +} + + + +void filters_init_flag() { + for (int i=0; ichbFilterName),array_flags[0] ); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterDevice), array_flags[1]); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterSoftLimitSize), array_flags[2]); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterHardLimitSize), array_flags[3]); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterSoftLimitFile), array_flags[4]); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterHardLimitFile), array_flags[5]); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterHardLimitSizeDelay), array_flags[6]); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterHardLimitFileDelay), array_flags[7]); + } + else if (strcmp(flag_filters_u_g_p,"prjquota")==0) { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterDevice),array_flags[0] ); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterCatalog), array_flags[1]); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(filters_widgets->chkFilterID), array_flags[2]); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(filters_widgets->chbProjectName), array_flags[3]); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterSoftLimitSize), array_flags[4]); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterHardLimitSize), array_flags[5]); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterSoftLimitFile), array_flags[6]); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterHardLimitFile), array_flags[7]); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterHardLimitSizeDelay), array_flags[8]); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(filters_widgets->chbFilterHardLimitFileDelay), array_flags[9]); + } +} \ No newline at end of file diff --git a/source/view_filters.h b/source/view_filters.h new file mode 100644 index 0000000..66a3544 --- /dev/null +++ b/source/view_filters.h @@ -0,0 +1,52 @@ +#ifndef VIEW_FILTERS_H +#define VIEW_FILTERS_H +#include +#include +#include "model/ubl-utils.h" +#include +#include +#include +#include +#include +#include +#include +#include "../compile/ubl-cmake.h" +#include "model/model.h" +#include "model/load.h" + +// Переменные +typedef struct { + GtkWidget* Window; + GtkWidget* btnFiltersSave; + GtkWidget* btnFiltersCancel; + GtkWidget* chbFilterName; + GtkWidget* chbFilterQuotas; + GtkWidget* chbFilterSize; + GtkWidget* chbFilterSoftLimitSize; + GtkWidget* chbFilterHardLimitSize; + GtkWidget* chbFilterHardLimitSizeDelay; + GtkWidget* chbFilterFiles; + GtkWidget* chbFilterSoftLimitFile; + GtkWidget* chbFilterHardLimitFile; + GtkWidget* chbFilterHardLimitFileDelay; + GtkWidget* chbProjectName; + GtkWidget* chbFilterDevice; + GtkWidget* chkFilterID; + GtkWidget* chbFilterCatalog; + char* name; +} filters_window; + +// Функции +filters_window *filters_setup_window(char* glade_path); +void filters_event(filters_window *widgets); +void filters_localization(filters_window *widgets); +void filters_on_hide_subwindow(GtkWidget *self); +filters_window *get_widget_filters(); +void filters_show(GtkWidget *self, char* glade_path); +void filters_destroy(GtkWidget *self); +void filters_init_flag(); +void filters_set_name(char* _flag_u_g_p); +void filters_show(GtkWidget *self, char* glade_path); +void filters_set_flag(); +void filters_get_tree_view(GtkWidget *tree_view); +#endif \ No newline at end of file diff --git a/source/view_set_disk.c b/source/view_set_disk.c new file mode 100644 index 0000000..5d9a68c --- /dev/null +++ b/source/view_set_disk.c @@ -0,0 +1,250 @@ +#include "view_set_disk.h" + +view_device_set_window *obj_view_device_widgets = NULL; +char* view_device_glade_path = NULL; +int view_device_index = 0; +char* view_device_set_add_edit = NULL; +vector* vec_device = NULL; +config_all* view_device_all_config_temp = NULL; + +void set_view_device_menu(char* _set_add_edit) { + view_device_set_add_edit = _set_add_edit; +} +void view_device_set_vector_device(vector* _vec_device) { + vec_device = _vec_device; +} +view_device_set_window* get_widget_view_device() { + return obj_view_device_widgets; +} + +void view_device_all_config(config_all* _all_config) { + view_device_all_config_temp = _all_config; +} + +void view_device_set_index(int _index) { + view_device_index = _index; +} + +view_device_set_window *view_device_setup_window_base(char* __glade_path) { + view_device_glade_path = __glade_path; + if (obj_view_device_widgets == NULL) { + obj_view_device_widgets = malloc(sizeof(view_device_set_window)); + GtkBuilder *builder = gtk_builder_new_from_resource(__glade_path); + obj_view_device_widgets->Window = yon_gtk_builder_get_widget(builder,"SetDeviceWindow"); + obj_view_device_widgets->btnSaveTempSave = yon_gtk_builder_get_widget(builder,"SetDeviceSaveButton"); + obj_view_device_widgets->btnTempCancel = yon_gtk_builder_get_widget(builder,"SetDeviceCancelButton"); + view_device_setup_window_custom(obj_view_device_widgets, builder); + view_device_event(obj_view_device_widgets); + } + return obj_view_device_widgets; +} +view_device_set_window *view_device_setup_window_custom(view_device_set_window* view_device_view_device_widgets, GtkBuilder *builder) { + obj_view_device_widgets->spinWeeksFile = yon_gtk_builder_get_widget(builder,"spinWeeksFile"); + obj_view_device_widgets->spinDaysFile = yon_gtk_builder_get_widget(builder,"spinDaysFile"); + obj_view_device_widgets->spinHoursFile = yon_gtk_builder_get_widget(builder,"spinHoursFile"); + obj_view_device_widgets->spinMinutesFile = yon_gtk_builder_get_widget(builder,"spinMinutesFile"); + + obj_view_device_widgets->spinWeeksSize = yon_gtk_builder_get_widget(builder,"spinWeeksSize"); + obj_view_device_widgets->spinDaysSize = yon_gtk_builder_get_widget(builder,"spinDaysSize"); + obj_view_device_widgets->spinHoursSize = yon_gtk_builder_get_widget(builder,"spinHoursSize"); + obj_view_device_widgets->spinMinutesSize = yon_gtk_builder_get_widget(builder,"spinMinutesSize"); + obj_view_device_widgets->lblNameDevice = yon_gtk_builder_get_widget(builder,"lblNameDevice"); + obj_view_device_widgets->cmbDeviceSetStatus = yon_gtk_builder_get_widget(builder,"cmbDeviceSetStatus"); + obj_view_device_widgets->DeviceCombo = yon_gtk_builder_get_widget(builder,"DeviceCombo"); + obj_view_device_widgets->lblHeadQuotasEditDeviceWindow = yon_gtk_builder_get_widget(builder,"lblHeadQuotasEditDeviceWindow"); + obj_view_device_widgets->boxBlockGuiAddEditDevice = yon_gtk_builder_get_widget(builder,"boxBlockGuiAddEditDevice"); + if (strcmp(view_device_set_add_edit, "add") == 0) { + gtk_label_set_label(GTK_LABEL(obj_view_device_widgets->lblHeadQuotasEditDeviceWindow), STR_TITLE_ADD_QUOTAS); + gtk_widget_hide(obj_view_device_widgets->lblNameDevice); + device_fill_disk(obj_view_device_widgets->DeviceCombo,vec_device); + gtk_combo_box_set_active(GTK_COMBO_BOX(obj_view_device_widgets->cmbDeviceSetStatus),-1); + } + else { + gtk_label_set_label(GTK_LABEL(obj_view_device_widgets->lblHeadQuotasEditDeviceWindow), STR_TITLE_EDIT_QUOTAS); + gtk_widget_hide(obj_view_device_widgets->DeviceCombo); + } + view_device_fill_gui(); + view_device_set_combo_box_device(); +} + +void view_device_show(GtkWidget *self, char* __glade_path) { + if (obj_view_device_widgets != NULL) { + gtk_widget_show(obj_view_device_widgets->Window); + } + else { + view_device_setup_window_base(__glade_path); + gtk_widget_show(obj_view_device_widgets->Window); + } +} + +void view_device_save() { + view_device_get_gui_data(); + view_device_on_destroy_subwindow(obj_view_device_widgets->Window); +} + + + +void view_device_event(view_device_set_window* view_device_view_device_widgets) { + g_signal_connect(G_OBJECT(obj_view_device_widgets->DeviceCombo), "changed", G_CALLBACK(view_device_set_combo_box_device), NULL); + g_signal_connect(G_OBJECT(obj_view_device_widgets->Window), "destroy", G_CALLBACK(view_device_destroy), obj_view_device_widgets->Window); + g_signal_connect(G_OBJECT(obj_view_device_widgets->btnTempCancel),"clicked",G_CALLBACK(view_device_on_destroy_subwindow), NULL); + g_signal_connect(G_OBJECT(obj_view_device_widgets->spinWeeksSize), "value-changed", G_CALLBACK(view_device_update_gui_spin_time), NULL); + g_signal_connect(G_OBJECT(obj_view_device_widgets->spinDaysSize), "value-changed", G_CALLBACK(view_device_update_gui_spin_time), NULL); + g_signal_connect(G_OBJECT(obj_view_device_widgets->spinHoursSize), "value-changed", G_CALLBACK(view_device_update_gui_spin_time), NULL); + g_signal_connect(G_OBJECT(obj_view_device_widgets->spinMinutesSize), "value-changed", G_CALLBACK(view_device_update_gui_spin_time), NULL); + g_signal_connect(G_OBJECT(obj_view_device_widgets->spinWeeksFile), "value-changed", G_CALLBACK(view_device_update_gui_spin_time), NULL); + g_signal_connect(G_OBJECT(obj_view_device_widgets->spinDaysFile), "value-changed", G_CALLBACK(view_device_update_gui_spin_time), NULL); + g_signal_connect(G_OBJECT(obj_view_device_widgets->spinHoursFile), "value-changed", G_CALLBACK(view_device_update_gui_spin_time), NULL); + g_signal_connect(G_OBJECT(obj_view_device_widgets->spinMinutesFile), "value-changed", G_CALLBACK(view_device_update_gui_spin_time), NULL); +} + +void view_device_set_combo_box_device() { + if (strcmp(view_device_set_add_edit, "add")==0) { + int disk_id = gtk_combo_box_get_active(GTK_COMBO_BOX(obj_view_device_widgets->DeviceCombo)); + if (disk_id == -1) { + gtk_widget_set_sensitive(obj_view_device_widgets->boxBlockGuiAddEditDevice, 0); + gtk_widget_set_sensitive(obj_view_device_widgets->btnSaveTempSave, 0); + } + else { + gtk_widget_set_sensitive(obj_view_device_widgets->boxBlockGuiAddEditDevice, 1); + gtk_widget_set_sensitive(obj_view_device_widgets->btnSaveTempSave, 1); + int status_id = gtk_combo_box_get_active(GTK_COMBO_BOX(obj_view_device_widgets->cmbDeviceSetStatus)); + if (status_id == -1) { + gtk_combo_box_set_active(GTK_COMBO_BOX(obj_view_device_widgets->cmbDeviceSetStatus), 0); + } + } + } +} + +void view_device_on_destroy_subwindow(GtkWidget *self) { + if (self) { + gtk_widget_destroy(gtk_widget_get_toplevel(self)); + obj_view_device_widgets = NULL; + + } +} + +void view_device_destroy(GtkWidget *self) { + if (self) { + obj_view_device_widgets = NULL; + } +} + +void view_device_update_gui_spin_time() { + +} + +void view_device_fill_gui() { + size_t second_file = 0; + size_t second_size = 0; + if (strcmp(view_device_set_add_edit, "edit") == 0) { + if (view_device_index != -1) { + disk_status* _config = (disk_status*)vec_device->pfVectorGet(vec_device, view_device_index); + second_size = _config->deferring_size; + second_file = _config->deferring_file; + gtk_combo_box_set_active(GTK_COMBO_BOX(obj_view_device_widgets->cmbDeviceSetStatus), _config->status); + gtk_label_set_label(GTK_LABEL(obj_view_device_widgets->lblNameDevice), _config->device); + } + } + view_device_set_time_spin(second_file, second_size); +} +void view_device_get_spin_time(size_t* second_file, size_t* second_size) { + int spin_week_size = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(obj_view_device_widgets->spinWeeksSize)); + int spin_days_size = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(obj_view_device_widgets->spinDaysSize)); + int spin_hours_size = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(obj_view_device_widgets->spinHoursSize)); + int spin_minutes_size = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(obj_view_device_widgets->spinMinutesSize)); + *second_size = spin_week_size*7*24*3600+spin_days_size*24*3600+spin_hours_size*3600+spin_minutes_size*60; + int spin_week_file = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(obj_view_device_widgets->spinWeeksFile)); + int spin_days_file = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(obj_view_device_widgets->spinDaysFile)); + int spin_hours_file = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(obj_view_device_widgets->spinHoursFile)); + int spin_minutes_file = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(obj_view_device_widgets->spinMinutesFile)); + *second_file = spin_week_file*7*24*3600+spin_days_file*24*3600+spin_hours_file*3600+spin_minutes_file*60; + view_device_set_time_spin(*second_file, *second_size); +} + +void view_device_get_gui_data() { + char* disk = NULL; + disk_status* _config = NULL; + int status_id = gtk_combo_box_get_active(GTK_COMBO_BOX(obj_view_device_widgets->cmbDeviceSetStatus)); + if (status_id != -1) { + size_t second_file = 0; + size_t second_size = 0; + view_device_get_spin_time(&second_file, &second_size); + if (view_device_index != -1) { + _config = (disk_status*)vec_device->pfVectorGet(vec_device, view_device_index); + + } + else { + _config = malloc(sizeof(disk_status)); + disk = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(obj_view_device_widgets->DeviceCombo)); + if (get_device_vec()->vectorList.total > 0) { + for (int index = 0; index < get_device_vec()->vectorList.total; index++) + { + device_config* obj_device_config = (device_config*)get_device_vec()->pfVectorGet(get_device_vec(), index); + if (strstr(disk, obj_device_config->name_disk)) { + _config->device = yon_char_new(obj_device_config->name_disk); + _config->fs = yon_char_new(obj_device_config->file_system); + _config->mount_point = yon_char_new(obj_device_config->mounted); + _config->name = yon_char_new(obj_device_config->type_dick); + } + + } + } + } + _config->deferring_size = second_size; + _config->deferring_file = second_file; + if (strcmp(view_device_set_add_edit, "add") == 0) { + if (status_id == 0) { + _config->status = 1; + } + else { + _config->status = status_id; + } + } + else { + if (status_id == 0) { + yon_window_config_erase_custom_parameter(_config->device, "deferring_size"); + yon_window_config_erase_custom_parameter(_config->device, "deferring_file"); + yon_window_config_erase_custom_parameter(_config->device, _config->device); + model_search_disk_remove(&view_device_all_config_temp->v_user, &view_device_all_config_temp->v_remove, _config->device); + model_search_disk_remove(&view_device_all_config_temp->v_group, &view_device_all_config_temp->v_remove, _config->device); + model_search_disk_remove_project(&view_device_all_config_temp->v_project,&view_device_all_config_temp->v_disk_status, &view_device_all_config_temp->v_remove, _config->device); + _config->status = 1; + } + else { + _config->status = status_id; + } + } + if (view_device_index == -1) { + vec_device->pfVectorAdd(vec_device, _config); + } + } +} +void view_device_set_time_spin(size_t seconds_file, size_t seconds_size) { + me_time t_file = time_convert(seconds_file); + me_time t_size = time_convert(seconds_size); + if (seconds_file!=-1) { + gtk_spin_button_set_value(GTK_SPIN_BUTTON(obj_view_device_widgets->spinWeeksFile), t_file.weeks); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(obj_view_device_widgets->spinDaysFile), t_file.days); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(obj_view_device_widgets->spinHoursFile), t_file.hours); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(obj_view_device_widgets->spinMinutesFile), t_file.minutes); + } + else { + gtk_spin_button_set_value(GTK_SPIN_BUTTON(obj_view_device_widgets->spinWeeksFile), 0); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(obj_view_device_widgets->spinDaysFile), 0); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(obj_view_device_widgets->spinHoursFile), 0); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(obj_view_device_widgets->spinMinutesFile), 0); + } + if (seconds_size!=-1) { + gtk_spin_button_set_value(GTK_SPIN_BUTTON(obj_view_device_widgets->spinWeeksSize), t_size.weeks); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(obj_view_device_widgets->spinDaysSize), t_size.days); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(obj_view_device_widgets->spinHoursSize), t_size.hours); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(obj_view_device_widgets->spinMinutesSize), t_size.minutes); + } + else { + gtk_spin_button_set_value(GTK_SPIN_BUTTON(obj_view_device_widgets->spinWeeksSize), 0); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(obj_view_device_widgets->spinDaysSize), 0); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(obj_view_device_widgets->spinHoursSize), 0); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(obj_view_device_widgets->spinMinutesSize), 0); + } +} diff --git a/source/view_set_disk.h b/source/view_set_disk.h new file mode 100644 index 0000000..34c08dd --- /dev/null +++ b/source/view_set_disk.h @@ -0,0 +1,58 @@ + +#include +#include +#include "model/ubl-utils.h" +#include +#include +#include +#include +#include +#include +#include +#include "../compile/ubl-cmake.h" +#include "model/model.h" +#include "model/load.h" +#include "model/my_device.h" + + + +typedef struct { + GtkWidget* Window; + GtkWidget* btnSaveTempSave; + GtkWidget* btnTempCancel; + + GtkWidget* spinWeeksFile; + GtkWidget* spinDaysFile; + GtkWidget* spinHoursFile; + GtkWidget* spinMinutesFile; + + GtkWidget* spinWeeksSize; + GtkWidget* spinDaysSize; + GtkWidget* spinHoursSize; + GtkWidget* spinMinutesSize; + GtkWidget* lblNameDevice; + GtkWidget* DeviceCombo; + GtkWidget* cmbDeviceSetStatus; + GtkWidget* lblHeadQuotasEditDeviceWindow; + GtkWidget* boxBlockGuiAddEditDevice; + char* name; +} view_device_set_window; + +view_device_set_window* get_widget_view_device(); +void view_device_get_gui_data(); +void view_device_all_config(config_all* _all_config); +void view_device_get_vector_u_g_p(vector* _vec_u_g_p); +void view_device_set_time_spin(size_t seconds_file, size_t seconds_size); +void view_device_update_gui_spin_time(); +void view_device_fill_gui(); +void view_device_set_index(int _index); +void set_view_device_menu(char* _set_add_edit); +void view_device_set_combo_box_device(); +void view_device_set_vector_device(vector* _vec_device); +void set_view_device_menu(char* _set_add_edit); +void view_device_show(GtkWidget *self, char* __glade_path); +void view_device_event(view_device_set_window* view_device_view_device_widgets); +void view_device_on_destroy_subwindow(GtkWidget *self); +void view_device_destroy(GtkWidget *self); +view_device_set_window *view_device_setup_window_base(char* __glade_path); +view_device_set_window *view_device_setup_window_custom(view_device_set_window* view_device_view_device_widgets, GtkBuilder *builder); \ No newline at end of file diff --git a/source/view_temp_u_g_p.c b/source/view_temp_u_g_p.c new file mode 100644 index 0000000..a296659 --- /dev/null +++ b/source/view_temp_u_g_p.c @@ -0,0 +1,863 @@ +#include "view_temp_u_g_p.h" + +temp_set_window *temp_widgets = NULL; +char* flag_temp_u_g_p; +char* set_add_edit; +char* _glade_path = NULL; +vector* vec_temp = NULL; +config_all* _all_config_temp = NULL; +int table_index = 0; +char* disk = NULL; + +vector* temp_vec_actors = NULL; + +void temp_check_activ_disk() { + int menu_id = gtk_combo_box_get_active(GTK_COMBO_BOX(temp_widgets->UserDeviceCombo)); + if (menu_id == -1) { + gtk_widget_set_sensitive(temp_widgets->entryCatalogProject, 0); + gtk_widget_set_sensitive(temp_widgets->btnReviewProject, 0); + } + else { + gtk_widget_set_sensitive(temp_widgets->entryCatalogProject, 1); + gtk_widget_set_sensitive(temp_widgets->btnReviewProject, 1); + } +} +void destroy_show_warning(GtkWidget *self) { + gtk_widget_destroy(gtk_widget_get_toplevel(self)); + temp_widgets->WarrningWindow = NULL; + temp_widgets->CancelWarrningButton = NULL; + temp_widgets->lblWarningText = NULL; +} + +void show_warning_no_fill(char* text_mess) { + GtkBuilder *builder = gtk_builder_new_from_resource(_glade_path); + temp_widgets->WarrningWindow = yon_gtk_builder_get_widget(builder,"WarrningWindow"); + temp_widgets->lblWarningText = yon_gtk_builder_get_widget(builder,"lblWarningText"); + temp_widgets->CancelWarrningButton = yon_gtk_builder_get_widget(builder,"CancelWarrningButton"); + gtk_label_set_label(GTK_LABEL(temp_widgets->lblWarningText), text_mess); + gtk_widget_show(temp_widgets->WarrningWindow); + g_signal_connect(G_OBJECT(temp_widgets->WarrningWindow), "destroy", G_CALLBACK(destroy_show_warning), temp_widgets->WarrningWindow); + g_signal_connect(G_OBJECT(temp_widgets->CancelWarrningButton),"clicked",G_CALLBACK(destroy_show_warning),temp_widgets->WarrningWindow); +} + +void show_warning_disk() { + char* text_mess = NULL; + char* str_disk = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(temp_widgets->UserDeviceCombo)); + for (int i = 0; i < _all_config_temp->v_disk_status.vectorList.total; i++) { + disk_status* _config = (disk_status*)_all_config_temp->v_disk_status.pfVectorGet(&_all_config_temp->v_disk_status, i); + if (strstr(str_disk, _config->device)) { + text_mess = STR_ERROR_PATH_IS_DISK_FALSE; + text_mess = yon_char_unite(text_mess, " ", _config->device, NULL); + show_warning_no_fill(text_mess); + } + } +} + + +void set_disk(char* _disk) { + disk = yon_char_new(_disk); +} + +void set_all_config(config_all* _all_config) { + _all_config_temp = _all_config; +} + +temp_set_window* get_widget_temp() { + return temp_widgets; +} + +void set_vector(vector* _vec_temp) { + vec_temp = _vec_temp; +} + +void temp_set_index(int _index) { + table_index = _index; +} + +temp_set_window *temp_setup_window_base(char* __glade_path) { + _glade_path = __glade_path; + if (temp_widgets == NULL) { + temp_widgets = malloc(sizeof(temp_set_window)); + GtkBuilder *builder = gtk_builder_new_from_resource(_glade_path); + temp_widgets->Window = yon_gtk_builder_get_widget(builder,"QuotasEditWindow"); + temp_widgets->btnSaveTempSave = yon_gtk_builder_get_widget(builder,"quotegroupSaveButton"); + temp_widgets->btnTempCancel = yon_gtk_builder_get_widget(builder,"quotegroupCancelButton"); + temp_setup_window_custom(temp_widgets, builder); + temp_init_windows(); + temp_localization(temp_widgets); + temp_event(temp_widgets); + } + return temp_widgets; +} + +void temp_check_path() { + char* str_disk = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(temp_widgets->UserDeviceCombo)); + for (int i = 0; i < _all_config_temp->v_disk_status.vectorList.total; i++) { + disk_status* _config = (disk_status*)_all_config_temp->v_disk_status.pfVectorGet(&_all_config_temp->v_disk_status, i); + if (strstr(str_disk, _config->device)) { + const char* str_path = gtk_entry_get_text(GTK_ENTRY(temp_widgets->entryCatalogProject)); + if (strstr(str_path,_config->mount_point)) { + } + else { + gtk_widget_set_sensitive(temp_widgets->btnSaveTempSave, 0); + show_warning_disk(); + } + } + } +} + +temp_set_window *temp_setup_window_custom(temp_set_window* temp_widgets, GtkBuilder *builder) { + temp_vec_actors = malloc(sizeof(vector)); + vector_init(temp_vec_actors); + if (strcmp(set_add_edit, "add")==0) { + table_u_g_get_actors(temp_vec_actors); + } + else { + config_u_g_p* _config = (config_u_g_p*)vec_temp->pfVectorGet(vec_temp, table_index); + _config->actors.pfVectorCopy(temp_vec_actors, &_config->actors); + table_u_g_get_actors(temp_vec_actors); + } + temp_widgets->lblSetUGP = yon_gtk_builder_get_widget(builder, "lblSetUGP"); + temp_widgets->btnOpenUserGroup = yon_gtk_builder_get_widget(builder, "btnOpenUserGroup"); + temp_widgets->btnReviewProject = yon_gtk_builder_get_widget(builder, "btnReviewProject"); + temp_widgets->btnGenerateProject = yon_gtk_builder_get_widget(builder, "btnGenerateProject"); + temp_widgets->entryCatalogProject = yon_gtk_builder_get_widget(builder, "entryCatalogProject"); + temp_widgets->chbAuto = yon_gtk_builder_get_widget(builder, "chbAuto"); + temp_widgets->entryProjectName = yon_gtk_builder_get_widget(builder, "entryProjectName"); + temp_widgets->boxProjectAddEdit = yon_gtk_builder_get_widget(builder, "boxProjectAddEdit"); + temp_widgets->boxProject = yon_gtk_builder_get_widget(builder, "boxProject"); + temp_widgets->boxProjectAddEditboxProjectId = yon_gtk_builder_get_widget(builder, "boxProjectAddEditboxProjectId"); + temp_widgets->lblHeadQuotasEditWindow = yon_gtk_builder_get_widget(builder, "lblHeadQuotasEditWindow"); + + temp_widgets->quotegroupSizeSoftLimitCheck = yon_gtk_builder_get_widget(builder, "quotegroupSizeSoftLimitCheck"); + temp_widgets->quotegroupSizeSoftLimitSpin = yon_gtk_builder_get_widget(builder, "quotegroupSizeSoftLimitSpin"); + temp_widgets->quotegroupSizeSoftLimitCombo = yon_gtk_builder_get_widget(builder, "quotegroupSizeSoftLimitCombo"); + temp_widgets->quotegroupSizeHardLimitCheck = yon_gtk_builder_get_widget(builder, "quotegroupSizeHardLimitCheck"); + temp_widgets->quotegroupSizeHardLimitSpin = yon_gtk_builder_get_widget(builder, "quotegroupSizeHardLimitSpin"); + temp_widgets->quotegroupSizeHardLimitCombo = yon_gtk_builder_get_widget(builder, "quotegroupSizeHardLimitCombo"); + temp_widgets->quotegroupFilesSoftLimitCheck = yon_gtk_builder_get_widget(builder, "quotegroupFilesSoftLimitCheck"); + temp_widgets->quotegroupFilesSoftLimitSpin = yon_gtk_builder_get_widget(builder, "quotegroupFilesSoftLimitSpin"); + temp_widgets->quotegroupFilesHardLimitCheck = yon_gtk_builder_get_widget(builder, "quotegroupFilesHardLimitCheck"); + temp_widgets->quotegroupFilesHardLimitSpin = yon_gtk_builder_get_widget(builder, "quotegroupFilesHardLimitSpin"); + temp_widgets->entryProjectId = yon_gtk_builder_get_widget(builder, "entryProjectId"); + temp_widgets->lblSetNameDevice = yon_gtk_builder_get_widget(builder, "lblSetNameDevice"); + temp_widgets->lblCatalogProjectEdit = yon_gtk_builder_get_widget(builder, "lblCatalogProjectEdit"); + temp_widgets->lblProjectIdValueEdit = yon_gtk_builder_get_widget(builder, "lblProjectIdValueEdit"); + temp_widgets->boxTempDevice = yon_gtk_builder_get_widget(builder, "boxTempDevice"); + temp_widgets->entryUser = yon_gtk_builder_get_widget(builder,"entryUser"); + temp_widgets->UserDeviceCombo = yon_gtk_builder_get_widget(builder,"UserDeviceCombo"); + temp_widgets->lblSetQuotasStatus = yon_gtk_builder_get_widget(builder,"lblSetQuotasStatus"); + temp_widgets->boxBlockGuiAddEdit = yon_gtk_builder_get_widget(builder,"boxBlockGuiAddEdit"); + table_u_g_set_flag(flag_temp_u_g_p,set_add_edit); + table_u_g_set_glade_path(_glade_path); + temp_settings(); +} + +void temp_select_disk() { + char* str_disk = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(temp_widgets->UserDeviceCombo)); + for (int i = 0; i < _all_config_temp->v_disk_status.vectorList.total; i++) { + disk_status* _config = (disk_status*)_all_config_temp->v_disk_status.pfVectorGet(&_all_config_temp->v_disk_status, i); + if (strstr(str_disk, _config->device)) { + if (_config->status == 2) { + gtk_label_set_label(GTK_LABEL(temp_widgets->lblSetQuotasStatus), STR_ON); + } + else if (_config->status == 1){ + gtk_label_set_label(GTK_LABEL(temp_widgets->lblSetQuotasStatus), STR_OFF); + } + else { + gtk_label_set_label(GTK_LABEL(temp_widgets->lblSetQuotasStatus), STR_NOT_SET); + } + } + + } +} + +void temp_settings() { + char *split_simvol = " "; + for (int i = 0; i < _all_config_temp->v_disk_status.vectorList.total; i++) { + disk_status* _config = (disk_status*)_all_config_temp->v_disk_status.pfVectorGet(&_all_config_temp->v_disk_status, i); + char* str_disk = yon_char_unite(_config->device,split_simvol, + _config->fs, + split_simvol, + _config->mount_point, + split_simvol, + _config->name, NULL); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(temp_widgets->UserDeviceCombo), yon_char_new(str_disk)); + free(str_disk); + } + if (strcmp(flag_temp_u_g_p,"prjquota")==0) { + gtk_widget_hide(temp_widgets->lblSetUGP); + gtk_widget_hide(temp_widgets->btnOpenUserGroup); + gtk_widget_hide(temp_widgets->entryUser); + if (strcmp(set_add_edit, "add")==0) { + gtk_widget_hide(temp_widgets->lblCatalogProjectEdit); + gtk_widget_hide(temp_widgets->lblProjectIdValueEdit); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(temp_widgets->chbAuto),1); + gtk_label_set_label(GTK_LABEL(temp_widgets->lblHeadQuotasEditWindow), STR_TITLE_ADD_QUOTAS); + } + else { + gtk_widget_hide(temp_widgets->btnReviewProject); + gtk_widget_hide(temp_widgets->entryCatalogProject); + gtk_widget_hide(temp_widgets->chbAuto); + gtk_widget_hide(temp_widgets->entryProjectId); + gtk_widget_hide(temp_widgets->btnGenerateProject); + gtk_widget_hide(temp_widgets->UserDeviceCombo); + gtk_label_set_label(GTK_LABEL(temp_widgets->lblHeadQuotasEditWindow), STR_TITLE_EDIT_QUOTAS); + } + } + else { + gtk_widget_hide(temp_widgets->boxProjectAddEditboxProjectId); + if (strcmp(flag_temp_u_g_p, "usrquota")==0) { + gtk_label_set_label(GTK_LABEL(temp_widgets->lblSetUGP), yon_char_unite(STR_USER,":",NULL)); + } + else if (strcmp(flag_temp_u_g_p, "grpquota")==0) { + gtk_label_set_label(GTK_LABEL(temp_widgets->lblSetUGP), yon_char_unite(STR_GROUP,":",NULL)); + + } + if (strcmp(set_add_edit, "add")==0) { + gtk_widget_hide(temp_widgets->boxProject); + gtk_widget_hide(temp_widgets->boxProjectAddEdit); + gtk_label_set_label(GTK_LABEL(temp_widgets->lblHeadQuotasEditWindow), STR_TITLE_ADD_QUOTAS); + + } + else { + gtk_widget_hide(temp_widgets->boxProject); + gtk_widget_hide(temp_widgets->boxProjectAddEdit); + gtk_widget_hide(temp_widgets->UserDeviceCombo); + gtk_label_set_label(GTK_LABEL(temp_widgets->lblHeadQuotasEditWindow), STR_TITLE_EDIT_QUOTAS); + } + } + temp_on_set_combo_box_device(); +} + +void set_temp_menu(char* _flag_temp_u_g_p, char* _set_add_edit) { + flag_temp_u_g_p = _flag_temp_u_g_p; + set_add_edit = _set_add_edit; +} + +void temp_show(GtkWidget *self, char* _glade_path) { + if (temp_widgets != NULL) { + gtk_widget_show(temp_widgets->Window); + set_activ_project_id(); + temp_init_windows(); + event_toggled_all(); + } + else { + temp_setup_window_base(_glade_path); + gtk_widget_show(temp_widgets->Window); + set_activ_project_id(); + event_toggled_all(); + } +} + +void temp_localization(temp_set_window* temp_widgets) { + +} + +void temp_init_windows() { +} + +void wrapper_table_u_g_show() { + table_u_g_get_actors(temp_vec_actors); + table_u_g_show(NULL, _glade_path); +} + +void temp_event(temp_set_window* temp_widgets) { + g_signal_connect(G_OBJECT(temp_widgets->UserDeviceCombo), "changed", G_CALLBACK(temp_on_set_combo_box_device), NULL); + g_signal_connect(G_OBJECT(temp_widgets->btnTempCancel),"clicked",G_CALLBACK(temp_destroy),temp_widgets->Window); + g_signal_connect(G_OBJECT(temp_widgets->Window), "destroy", G_CALLBACK(temp_destroy), temp_widgets->Window); + g_signal_connect(G_OBJECT(temp_widgets->quotegroupSizeSoftLimitCheck), "toggled", G_CALLBACK(event_toggled_all), NULL); + g_signal_connect(G_OBJECT(temp_widgets->quotegroupSizeHardLimitCheck), "toggled", G_CALLBACK(event_toggled_all), NULL); + g_signal_connect(G_OBJECT(temp_widgets->quotegroupFilesSoftLimitCheck), "toggled", G_CALLBACK(event_toggled_all), NULL); + g_signal_connect(G_OBJECT(temp_widgets->quotegroupFilesHardLimitCheck), "toggled", G_CALLBACK(event_toggled_all), NULL); + g_signal_connect(G_OBJECT(temp_widgets->UserDeviceCombo), "changed", G_CALLBACK(temp_select_disk), NULL); + int flag = 3; + g_signal_connect(G_OBJECT(temp_widgets->quotegroupSizeSoftLimitCombo), "changed", G_CALLBACK(update_max_size_spin), &flag); + g_signal_connect(G_OBJECT(temp_widgets->quotegroupSizeHardLimitCombo), "changed", G_CALLBACK(update_max_size_spin), &flag); + g_signal_connect(G_OBJECT(temp_widgets->quotegroupSizeSoftLimitSpin), "changed", G_CALLBACK(update_max_size_spin), NULL); + g_signal_connect(G_OBJECT(temp_widgets->quotegroupSizeHardLimitSpin), "changed", G_CALLBACK(update_max_size_spin), NULL); + if (strstr(flag_temp_u_g_p,"prjquota")) { + g_signal_connect(G_OBJECT(temp_widgets->btnReviewProject),"clicked",G_CALLBACK(wrapper_show_file_manager),NULL); + g_signal_connect(G_OBJECT(temp_widgets->btnGenerateProject),"clicked",G_CALLBACK(wrapper_generate_id),NULL); + g_signal_connect(G_OBJECT(temp_widgets->chbAuto),"toggled",G_CALLBACK(set_activ_project_id),NULL); + g_signal_connect(G_OBJECT(temp_widgets->entryCatalogProject), "changed", G_CALLBACK(temp_check_path), NULL); + g_signal_connect(G_OBJECT(temp_widgets->entryProjectId), "changed", G_CALLBACK(check_generate_id), NULL); + } + else { + g_signal_connect(G_OBJECT(temp_widgets->btnOpenUserGroup),"clicked",G_CALLBACK(wrapper_table_u_g_show),NULL); + } +} + +void temp_on_set_combo_box_device() { + if (strcmp(set_add_edit, "add")==0) { + int menu_id = gtk_combo_box_get_active(GTK_COMBO_BOX(temp_widgets->UserDeviceCombo)); + if (menu_id == -1) { + gtk_widget_set_sensitive(temp_widgets->boxBlockGuiAddEdit, 0); + gtk_widget_set_sensitive(temp_widgets->btnSaveTempSave, 0); + } + else { + gtk_widget_set_sensitive(temp_widgets->boxBlockGuiAddEdit, 1); + gtk_widget_set_sensitive(temp_widgets->btnSaveTempSave, 1); + } + } +} + +void temp_on_destroy_subwindow(GtkWidget *self) { + if (self) { + if (wrapper_check_save()) { + if (strcmp(set_add_edit, "add")==0) { + get_add_gui_data_base(_all_config_temp); + } + else { + get_edit_gui_data_base(_all_config_temp, table_index); + } + gtk_widget_destroy(gtk_widget_get_toplevel(self)); + temp_widgets = NULL; + } + else { + + } + + } +} + +void update_max_size_spin(GtkWidget *self, int* flag) { + if (flag) { + gtk_spin_button_set_digits(GTK_SPIN_BUTTON(temp_widgets->quotegroupSizeSoftLimitSpin), 0); + gtk_spin_button_set_digits(GTK_SPIN_BUTTON(temp_widgets->quotegroupSizeHardLimitSpin), 0); + } + char* str_disk = NULL; + if (strcmp(set_add_edit, "add")==0) { + str_disk = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(temp_widgets->UserDeviceCombo)); + } + else { + str_disk = (char*)gtk_label_get_label(GTK_LABEL(temp_widgets->lblSetNameDevice)); + } + if (!str_disk) { + return; + } + for (int i = 0; i < get_device_vec()->vectorList.total; i++) { + device_config* _config = (device_config*)get_device_vec()->pfVectorGet(get_device_vec(), i); + if (strstr(str_disk, _config->name_disk)) { + philos_set_spin_adjustment(temp_widgets->quotegroupSizeSoftLimitCheck, + temp_widgets->quotegroupSizeSoftLimitSpin, + temp_widgets->quotegroupSizeSoftLimitCombo, _config->size_disk); + philos_set_spin_adjustment(temp_widgets->quotegroupSizeHardLimitCheck, + temp_widgets->quotegroupSizeHardLimitSpin, + temp_widgets->quotegroupSizeHardLimitCombo, _config->size_disk); + } + } + +} + +void event_toggled_all() { + philos_set_active_widgets(temp_widgets->quotegroupSizeSoftLimitCheck, + temp_widgets->quotegroupSizeSoftLimitSpin, + temp_widgets->quotegroupSizeSoftLimitCombo); + philos_set_active_widgets(temp_widgets->quotegroupSizeHardLimitCheck, + temp_widgets->quotegroupSizeHardLimitSpin, + temp_widgets->quotegroupSizeHardLimitCombo + ); + philos_set_active_widgets(temp_widgets->quotegroupFilesSoftLimitCheck, + temp_widgets->quotegroupFilesSoftLimitSpin, + NULL + ); + philos_set_active_widgets(temp_widgets->quotegroupFilesHardLimitCheck, + temp_widgets->quotegroupFilesHardLimitSpin, + NULL); + update_max_size_spin(NULL, NULL); +} + +void block_btn_save() { + if (wrapper_check_save()) { + gtk_widget_set_sensitive(temp_widgets->btnSaveTempSave, 1); + } + else { + gtk_widget_set_sensitive(temp_widgets->btnSaveTempSave, 0); + } +} + +void wrapper_show_file_manager() { + GtkBuilder *builder = gtk_builder_new_from_resource(_glade_path); + show_file_manger(temp_widgets, builder); + gtk_widget_show(temp_widgets->wndChooseFileWallpaper); + gtk_window_set_title(GTK_WINDOW(temp_widgets->wndChooseFileWallpaper), STR_TITLE_FILE_MANGER); + char* str_disk = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(temp_widgets->UserDeviceCombo)); + for (int i = 0; i < _all_config_temp->v_disk_status.vectorList.total; i++) { + disk_status* _config = (disk_status*)_all_config_temp->v_disk_status.pfVectorGet(&_all_config_temp->v_disk_status, i); + if (strstr(str_disk, _config->device)) { + gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(temp_widgets->wndChooseFileWallpaper),_config->mount_point); + } + } +} + +void temp_destroy(GtkWidget *self) { + if (self) { + gtk_widget_destroy(gtk_widget_get_toplevel(self)); + if (temp_vec_actors) { + model_free_vector_string(temp_vec_actors); + vectorFree(temp_vec_actors); + temp_vec_actors = NULL; + } + temp_widgets = NULL; + } + +} + + + +void show_file_manger(temp_set_window* temp_widgets, GtkBuilder *builder) { + temp_widgets->wndChooseFileWallpaper = yon_gtk_builder_get_widget(builder,"wndChooseFileWallpaper"); + temp_widgets->btnFilemangerOk = yon_gtk_builder_get_widget(builder,"btnFilemangerOk"); + temp_widgets->btnFilemangerExit = yon_gtk_builder_get_widget(builder,"btnFilemangerExit"); + + g_signal_connect(G_OBJECT(temp_widgets->btnFilemangerOk),"clicked",G_CALLBACK(btn_ok_file_manager), NULL); + g_signal_connect(G_OBJECT(temp_widgets->btnFilemangerExit),"clicked",G_CALLBACK(destroy_file_manager), NULL); +} + +void destroy_file_manager(GtkWidget *self) { + gtk_widget_destroy(gtk_widget_get_toplevel(self)); + temp_widgets->wndChooseFileWallpaper = NULL; + temp_widgets->btnFilemangerOk = NULL; + temp_widgets->btnFilemangerExit = NULL; +} + +void btn_ok_file_manager(GtkWidget *self) { + char* path_project = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(temp_widgets->wndChooseFileWallpaper)); + gtk_entry_set_text(GTK_ENTRY(temp_widgets->entryCatalogProject), path_project); + destroy_file_manager(self); + +} + + +void set_edit_gui_data_base(config_all* all_config, int index) { + config_u_g_p* _config = (config_u_g_p*)vec_temp->pfVectorGet(vec_temp, index); + + if (_config && index >= 0) { + set_widget(temp_widgets->quotegroupSizeSoftLimitCheck, + temp_widgets->quotegroupSizeSoftLimitSpin, + temp_widgets->quotegroupSizeSoftLimitCombo, + _config->soft_restriction_size, + _config->soft_restriction_size_pow + ); + set_widget(temp_widgets->quotegroupSizeHardLimitCheck, + temp_widgets->quotegroupSizeHardLimitSpin, + temp_widgets->quotegroupSizeHardLimitCombo, + _config->severe_limitation_size, + _config->severe_limitation_size_pow + ); + set_widget(temp_widgets->quotegroupFilesSoftLimitCheck, + temp_widgets->quotegroupFilesSoftLimitSpin, + NULL, + _config->soft_restriction_file, + 0 + ); + set_widget(temp_widgets->quotegroupFilesHardLimitCheck, + temp_widgets->quotegroupFilesHardLimitSpin, + NULL, + _config->severe_limitation_file, + 0 + ); + for (int i = 0; i < _all_config_temp->v_disk_status.vectorList.total; i++) { + disk_status* _config_disk = (disk_status*)_all_config_temp->v_disk_status.pfVectorGet(&_all_config_temp->v_disk_status, i); + if (strstr(_config->type_arr, "prjquota")) { + if (strstr(_config_disk->device, model_find_path_to_disk(&all_config->v_disk_status, _config->UNIX_file))) { + if (_config_disk->status == 1) { + gtk_label_set_label(GTK_LABEL(temp_widgets->lblSetQuotasStatus), STR_OFF); + } + else if (_config_disk->status == 2) { + gtk_label_set_label(GTK_LABEL(temp_widgets->lblSetQuotasStatus), STR_ON); + } + } + } + else { + if (strstr(_config_disk->device, _config->UNIX_file)) { + if (_config_disk->status == 1) { + gtk_label_set_label(GTK_LABEL(temp_widgets->lblSetQuotasStatus), STR_OFF); + } + else if (_config_disk->status == 2) { + gtk_label_set_label(GTK_LABEL(temp_widgets->lblSetQuotasStatus), STR_ON); + } + } + } + + } + if (strstr(flag_temp_u_g_p,"prjquota")) { + if (strstr(set_add_edit, "add")) { + } + else { + char* id = fill_tree_view_id(_config->id); + char* actors = format_actors(&_config->actors); + gtk_label_set_label(GTK_LABEL(temp_widgets->lblProjectIdValueEdit), id); + gtk_label_set_label(GTK_LABEL(temp_widgets->lblCatalogProjectEdit), _config->UNIX_file); + if (strcmp(actors,"-")!=0) { + gtk_entry_set_text(GTK_ENTRY(temp_widgets->entryProjectName), actors); + } + gtk_label_set_label(GTK_LABEL(temp_widgets->lblSetNameDevice), model_find_path_to_disk(&all_config->v_disk_status, _config->UNIX_file)); + } + } + else { + if (strcmp(set_add_edit, "add")==0) { + } + else { + gtk_label_set_label(GTK_LABEL(temp_widgets->lblSetNameDevice), _config->UNIX_file); + gtk_entry_set_text(GTK_ENTRY(temp_widgets->entryUser), format_actors(&_config->actors)); + + } + } + + } +} + +void set_widget(GtkWidget* check, GtkWidget* spin, GtkWidget* combo, int value_spin, int pow_mem_size) { + if (value_spin>0) { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),1); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), value_spin); + if (combo) { + gtk_combo_box_set_active(GTK_COMBO_BOX(combo), pow_mem_size); + } + } + else { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),0); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), 0); + if (combo) { + gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0); + } + } + +} +void get_edit_gui_data_base(config_all* all_config, int index) { + config_u_g_p* _config = (config_u_g_p*)vec_temp->pfVectorGet(vec_temp, index); + if (_config && index >= 0) { + char* str_user = (char*)gtk_entry_get_text(GTK_ENTRY(temp_widgets->entryUser)); + if (strlen(str_user)>2) { + vectorFree(&_config->actors); + vector_init(&_config->actors); + int size_str = 0; + char** name_disk = yon_char_parse(str_user, &size_str, ","); + vector t; + vector_init(&t); + if (name_disk) { + for (int i=0; i< size_str; i++) { + t.pfVectorAdd(&t, yon_char_new(name_disk[i])); + } + _config->actors.pfVectorCopy(&_config->actors, &t); + } + else { + t.pfVectorAdd(&t, yon_char_new(str_user)); + _config->actors.pfVectorCopy(&_config->actors, &t); + } + } + get_temp_gui_data_base(_config); + vec_temp->pfVectorSet(vec_temp, index, _config); + } + +} +void get_add_gui_data_base(config_all* all_config) { + config_u_g_p* _config = malloc(sizeof(config_u_g_p)); + model_null_str_writing(_config); + get_temp_gui_data_base(_config); + char* str_user = (char*)gtk_entry_get_text(GTK_ENTRY(temp_widgets->entryUser)); + if (strlen(str_user)>2) { + int size_str = 0; + char** name_disk = yon_char_parse(str_user, &size_str, ","); + vector t; + vector_init(&t); + if (name_disk) { + for (int i=0; i< size_str; i++) { + t.pfVectorAdd(&t, yon_char_new(name_disk[i])); + } + _config->actors.pfVectorCopy(&_config->actors, &t); + } + else { + t.pfVectorAdd(&t, yon_char_new(str_user)); + _config->actors.pfVectorCopy(&_config->actors, &t); + } + } + model_format_del_str(_config); + vec_temp->pfVectorAdd(vec_temp, _config); + + +} + +void save(GtkWidget *self) { + temp_vec_actors = get_actors_table(temp_vec_actors); + gtk_entry_set_text(GTK_ENTRY(temp_widgets->entryUser), format_actors(temp_vec_actors)); + table_u_g_on_hide_subwindow(self); +} + +int check_save() { + gboolean active1 = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(temp_widgets->quotegroupSizeSoftLimitCheck)); + gboolean active2 = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(temp_widgets->quotegroupSizeHardLimitCheck)); + gboolean active3 = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(temp_widgets->quotegroupFilesSoftLimitCheck)); + gboolean active4 = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(temp_widgets->quotegroupFilesHardLimitCheck)); + + char* value1 = (char*)gtk_entry_get_text(GTK_ENTRY(temp_widgets->quotegroupSizeSoftLimitSpin)); + char* value2 = (char*)gtk_entry_get_text(GTK_ENTRY(temp_widgets->quotegroupSizeHardLimitSpin)); + char* value3 = (char*)gtk_entry_get_text(GTK_ENTRY(temp_widgets->quotegroupFilesSoftLimitSpin)); + char* value4 = (char*)gtk_entry_get_text(GTK_ENTRY(temp_widgets->quotegroupFilesHardLimitSpin)); + int menu_id = 0; + if (strcmp(set_add_edit, "add")==0) { + menu_id = gtk_combo_box_get_active(GTK_COMBO_BOX(temp_widgets->UserDeviceCombo)); + if (menu_id == -1) { + show_warning_no_fill(STR_ERROR_NO_SELECTED_DISK); + } + } + if (!active1 && !active2 && !active3 && !active4) { + show_warning_no_fill(STR_ERROR_ENTRY_VALUE_VOLUME_OR_FILES); + return 0; + } + if (menu_id == -1 || ((!strcmp(value1, "0") || !strcmp(value1, "")) && active1) + || ((!strcmp(value2, "0") || !strcmp(value2, "")) && active2) + || ((!strcmp(value3, "0") || !strcmp(value3, "")) && active3) + || ((!strcmp(value4, "0") || !strcmp(value4, "")) && active4)) { + show_warning_no_fill(STR_ERROR_ENTRY_VALUE_VOLUME_OR_FILES); + return 0; + } + return 1; +} + +int check_save_project() { + gboolean active1 = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(temp_widgets->chbAuto)); + char* project_name = (char*)gtk_entry_get_text(GTK_ENTRY(temp_widgets->entryProjectName)); + if (strcmp(set_add_edit, "add")==0) { + char* file_dir = (char*)gtk_entry_get_text(GTK_ENTRY(temp_widgets->entryCatalogProject)); + char* project_id = (char*)gtk_entry_get_text(GTK_ENTRY(temp_widgets->entryProjectId)); + struct stat buf; + int error_file = stat(file_dir, &buf); + if (error_file < 0 || !S_ISDIR(buf.st_mode) || !strlen(file_dir) || (!strlen(project_id) && !active1) || !strlen(project_name)) { + if (!strlen(project_id) && !active1) { + show_warning_no_fill(STR_ERROR_ERROR_PROJECT_ID); + } + else if (!strlen(file_dir)) { + show_warning_no_fill(STR_ERROR_PATH_IS_DISK_FALSE); + } + else if (!strlen(project_name)) { + show_warning_no_fill(STR_ERROR_PROJECT_NAME_VALUE_NULL); + } + else if(error_file < 0) { + // Если отработало условие то + // Нет такого файла или каталога + show_warning_no_fill(STR_ERROR_MESS_NOT_DIR); + } + else if (!S_ISDIR(buf.st_mode)) { + // Если отработало условие то + // Это файл, а не каталога + show_warning_no_fill(STR_ERROR_MESS_NOT_DIR); + } + return 0; + } + return 1; + } + else { + if (strlen(project_name)<=1) { + show_warning_no_fill(STR_ERROR_PROJECT_NAME_ENTER_VALUE); + return 0; + } + return 1; + } +} + +int wrapper_check_save() { + if (strstr(flag_temp_u_g_p,"prjquota")) { + temp_check_activ_disk(); + int flag_save_project = check_save_project(); + int flag_save = check_save(); + if (flag_save_project && flag_save) { + return 1; + } + return 0; + } + else { + const char* str_user = gtk_entry_get_text(GTK_ENTRY(temp_widgets->entryUser)); + if ((strlen(str_user)>2)) { + if (check_save()) { + return 1; + } + return 0; + } + else { + if (check_save()) { + return 1; + } + show_warning_no_fill(STR_ERROR_LIST_USER_NULL); + return 0; + } + } +} + +void table_u_g_event() { + g_signal_connect(G_OBJECT(get_widget_table_u_g()->checkColUserGroup),"toggled",G_CALLBACK(chk_toggled_user_group),NULL); + g_signal_connect(G_OBJECT(get_widget_table_u_g()->btnCancel), "clicked",G_CALLBACK(table_u_g_on_hide_subwindow),NULL); + g_signal_connect(G_OBJECT(get_widget_table_u_g()->btnSave), "clicked",G_CALLBACK(save),NULL); + g_signal_connect(G_OBJECT(get_widget_table_u_g()->Window), "destroy", G_CALLBACK(table_u_g_destroy), NULL); +} + +config_u_g_p* get_temp_gui_data_base(config_u_g_p* _config) { + update_max_size_spin(NULL, NULL); + check_generate_id(); + set_widget_config(temp_widgets->quotegroupSizeSoftLimitCheck, + temp_widgets->quotegroupSizeSoftLimitSpin, + temp_widgets->quotegroupSizeSoftLimitCombo, + &_config->soft_restriction_size, + &_config->soft_restriction_size_pow + ); + set_widget_config(temp_widgets->quotegroupSizeHardLimitCheck, + temp_widgets->quotegroupSizeHardLimitSpin, + temp_widgets->quotegroupSizeHardLimitCombo, + &_config->severe_limitation_size, + &_config->severe_limitation_size_pow + ); + set_widget_config(temp_widgets->quotegroupFilesSoftLimitCheck, + temp_widgets->quotegroupFilesSoftLimitSpin, + NULL, + &_config->soft_restriction_file, + NULL + ); + set_widget_config(temp_widgets->quotegroupFilesHardLimitCheck, + temp_widgets->quotegroupFilesHardLimitSpin, + NULL, + &_config->severe_limitation_file, + NULL + ); + char* str_disk = NULL; + if (strcmp(set_add_edit, "add")==0) { + str_disk = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(temp_widgets->UserDeviceCombo)); + } + else { + str_disk = (char*)gtk_label_get_label(GTK_LABEL(temp_widgets->lblSetNameDevice)); + } + for (int i = 0; i < _all_config_temp->v_disk_status.vectorList.total; i++) { + disk_status* _config_disk = (disk_status*)_all_config_temp->v_disk_status.pfVectorGet(&_all_config_temp->v_disk_status, i); + if (strstr(str_disk, _config_disk->device)) { + _config->deferring_size = _config_disk->deferring_size; + _config->deferring_file = _config_disk->deferring_file; + } + } + if (strstr(flag_temp_u_g_p,"prjquota")) { + char* actors = (char*)gtk_entry_get_text(GTK_ENTRY(temp_widgets->entryProjectName)); + if (strlen(actors)>1) { + if (_config->actors.vectorList.total > 0) { + _config->actors.pfVectorSet(&_config->actors,0, yon_char_new(actors)); + } + else { + _config->actors.pfVectorAdd(&_config->actors, yon_char_new(actors)); + } + + } + gboolean active = active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(temp_widgets->chbAuto)); + if (active) { + _config->id = -1; + } + else { + char* id = (char*)gtk_entry_get_text(GTK_ENTRY(temp_widgets->entryProjectId)); + if (strlen(id)) { + _config->id = atoi(id); + } + else { + _config->id = -1; + } + + } + if (strcmp(set_add_edit, "add")==0) { + char* file_dir = (char*)gtk_entry_get_text(GTK_ENTRY(temp_widgets->entryCatalogProject)); + _config->UNIX_file = yon_char_new(file_dir); + _config->type_arr = yon_char_new(flag_temp_u_g_p); + } + } + else { + char* activ_disk = NULL; + char* str_user = (char*)gtk_entry_get_text(GTK_ENTRY(temp_widgets->entryUser)); + table_u_g_get_actors(&_config->actors); + if (strcmp(set_add_edit, "add")==0) { + activ_disk = yon_char_new(gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(temp_widgets->UserDeviceCombo))); + } + else { + activ_disk = yon_char_new((char*)gtk_label_get_label(GTK_LABEL(temp_widgets->lblSetNameDevice))); + + } + activ_disk = yon_char_divide_search(activ_disk, " ", -1); + _config->UNIX_file = activ_disk; + _config->type_arr = yon_char_new(flag_temp_u_g_p); + } + return _config; +} + + + +void set_widget_config(GtkWidget* check, GtkWidget* spin, GtkWidget* combo, size_t* value, int* mem_size) { + gboolean active = active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check)); + if (active) { + (*value) = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin)); + if (combo) { + if ((*value) != 0) { + (*mem_size) = gtk_combo_box_get_active(GTK_COMBO_BOX(combo)); + } + else { + (*mem_size) = -3; + } + } + } + else { + (*value) = 0; + if (combo) { + (*mem_size) = -3; + } + } +} +void check_generate_id() { + if (strstr(flag_temp_u_g_p,"prjquota")) { + g_signal_handlers_block_by_func(G_OBJECT(temp_widgets->entryProjectId), G_CALLBACK(check_generate_id), NULL); + int active = gtk_widget_get_sensitive(temp_widgets->entryProjectId); + if (active) { + char* text = (char*)gtk_entry_get_text(GTK_ENTRY(temp_widgets->entryProjectId)); + if (strlen(text)) { + int id = atoi(text); + if (check_generate(vec_temp, id)) { + id = generate_id(vec_temp, id); + gtk_entry_set_text(GTK_ENTRY(temp_widgets->entryProjectId), yon_char_from_int(id)); + } + + } + } + g_signal_handlers_unblock_by_func(G_OBJECT(temp_widgets->entryProjectId), G_CALLBACK(check_generate_id), NULL); + } +} +void wrapper_generate_id() { + int id = generate_id(vec_temp, -1); + gtk_entry_set_text(GTK_ENTRY(temp_widgets->entryProjectId), yon_char_from_int(id)); +} + +int generate_id(vector* _vec_temp, int max_id) { + if (_vec_temp->vectorList.total> 0) { + for (int index = 0; index < _vec_temp->vectorList.total; index++) { + config_u_g_p* _config = (config_u_g_p*)_vec_temp->pfVectorGet(_vec_temp, index); + if (_config->id > max_id) { + max_id = _config->id; + } + } + } + max_id++; + return max_id; +} +int check_generate(vector* _vec_temp, int max_id) { + if (_vec_temp->vectorList.total> 0) { + for (int index = 0; index < _vec_temp->vectorList.total; index++) { + config_u_g_p* _config = (config_u_g_p*)_vec_temp->pfVectorGet(_vec_temp, index); + if (_config->id == max_id) { + return 1; + } + } + } + return 0; +} +void set_activ_project_id() { + gboolean active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(temp_widgets->chbAuto)); + if (active) { + gtk_entry_set_text(GTK_ENTRY(temp_widgets->entryProjectId), ""); + } + gtk_widget_set_sensitive(temp_widgets->entryProjectId, !active); + gtk_widget_set_sensitive(temp_widgets->btnGenerateProject, !active); +} + + diff --git a/source/view_temp_u_g_p.h b/source/view_temp_u_g_p.h new file mode 100644 index 0000000..cb2064f --- /dev/null +++ b/source/view_temp_u_g_p.h @@ -0,0 +1,51 @@ +#include +#include +#include "model/ubl-utils.h" +#include +#include +#include +#include +#include +#include +#include +#include "../compile/ubl-cmake.h" +#include "model/model.h" +#include "model/load.h" +#include "view_check_user_table.h" + +void temp_set_index(int _index); +temp_set_window* get_widget_temp(); +void set_disk(char* _disk); +temp_set_window *temp_setup_window_base(char* _glade_path); +void temp_on_destroy_subwindow(GtkWidget *self); +void temp_destroy(GtkWidget *self); +void temp_show(GtkWidget *self, char* _glade_path); +void temp_init_windows(); +void temp_event(temp_set_window* temp_widgets); +void temp_localization(temp_set_window* temp_widgets); +void btn_ok_file_manager(GtkWidget *self); +void set_temp_menu(char* _flag_u_g_p, char* _set_add_edit); +void destroy_file_manager(GtkWidget *self); +void show_file_manger(temp_set_window* temp_widgets, GtkBuilder *builder); +temp_set_window *temp_setup_window_custom(temp_set_window* temp_widgets, GtkBuilder *builder); +void wrapper_show_file_manager(); +void event_toggled_all(); +void set_all_config(config_all* _all_config); +void set_widget_config(GtkWidget* check, GtkWidget* spin, GtkWidget* combo, size_t* value, int* mem_size); +void set_edit_gui_data_base(config_all* all_config, int index); +config_u_g_p* get_temp_gui_data_base(config_u_g_p* _config); +void get_add_gui_data_base(config_all* all_config); +void get_edit_gui_data_base(config_all* all_config, int index); +void set_widget(GtkWidget* check, GtkWidget* spin, GtkWidget* combo, int value_spin, int pow_mem_size); +int generate_id(vector* _vec_temp, int max_id); +void wrapper_generate_id(); +int check_generate(vector* _vec_temp, int max_id); +void check_generate_id(); +void set_activ_project_id(); +int wrapper_check_save(); +void block_btn_save(); +int table_check_save(); +void temp_settings(); +void show_warning_no_fill(char* text_mess); +void update_max_size_spin(GtkWidget *self, int* flag); +void temp_on_set_combo_box_device(); \ No newline at end of file diff --git a/logo-background.png b/ubl-settings-diskquota-banner.png similarity index 100% rename from logo-background.png rename to ubl-settings-diskquota-banner.png diff --git a/ubl-settings-diskquota.css b/ubl-settings-diskquota.css index 6c44488..5853948 100644 --- a/ubl-settings-diskquota.css +++ b/ubl-settings-diskquota.css @@ -1,154 +1,108 @@ -.textHead{ - text-shadow: 2px 2px @theme_bg_color; - color: @theme_text_color; -} -.boxInfoMessError{ - background-color: #ea9999; -} -.boxInfoMessOK{ - background-color: #f3f0ac; -} -.bannerbackground { - background-color: #404040; -} -.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; +.thin { + margin:0px; + padding:0px; } .noborder { - border: none; + border:none; } -.menu:hover { - border-color:alpha(@theme_text_color, 0.01); +.nobackground { +background:transparent; } -.menu { - border-color:alpha(@theme_text_color, 0.01); +.nobackground:active { +background:transparent; } -.menu:hover >* { - border-color:alpha(@theme_text_color, 0.01); -} -.menuitembottom{ - margin-top:0px; - margin-bottom:3px; -} -.menuitemmiddle{ - margin-top:0px; - margin-bottom:0px; +.textHead{ + text-shadow: 2px 2px @theme_bg_color; + color: @theme_text_color; } -.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; +.inherited>* { + border:none; + background:inherit; } -.menuitembottom *{ - margin:0 2px 2px 2px; - padding: 3px 10px 5px 5px; +.workingbg { + background:@theme_base_color; } -.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; +.menuitembottom{ + margin-top:0px; + margin-bottom:3px; + border-color:inherit; + border-left-width:inherit; + border-right-width:inherit; + } + .menuitemmiddle{ + margin-top:0px; + margin-bottom:0px; + 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; + .menuitemtop{ + margin-bottom:0px; + border-color:inherit; + border-top-width:inherit; + border-left-width:inherit; + border-right-width:inherit; + } + .menuitemtop>*{ + margin:2px 2px 0 2px; + padding: 3px 10px 3px 5px; + border:transparent; + } + .menuitemmiddle>*{ + margin:0 2px 0 2px; + padding: 3px 10px 3px 5px; + border:transparent; + } + .menuitembottom>*{ + margin:0 2px 2px 2px; + padding: 3px 10px 3px 5px; + } + .menuitemtop:hover { + background:@theme_bg_color; + border-color:inherit; + border-top-width: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-bottom-width:0px; + border-left-width:inherit; + border-right-width:inherit; + + } + .menuitemtop:hover>* { + margin:2px 2px 0 2px; + padding: 3px 10px 3px 5px; + background:@theme_selected_bg_color; + border-radius:2px; + } + .menuitemmiddle:hover>* { + margin:0 2px 0px 2px; + padding: 3px 10px 3px 5px; + background:@theme_selected_bg_color; + border-radius:2px; + } + .menuitembottom:hover>* { + margin:0 2px 2px 2px; + padding: 3px 10px 3px 5px; + background:@theme_selected_bg_color; + border-radius:2px; + } + .boxInfoMessError{ + background-color: #ea9999; } -.bkim_no_plug{ -background-color: transparent; -opacity:0.99; -} -.thin{ - margin:0px; - padding: 0px; -} -.nobg{ - background: none; -} -.addbg * { - background-color: @theme_bg_color; +.boxInfoMessOK{ + background-color: #f3f0ac; } \ No newline at end of file diff --git a/ubl-settings-diskquota.desktop b/ubl-settings-diskquota.desktop index 409842d..8f9425b 100644 --- a/ubl-settings-diskquota.desktop +++ b/ubl-settings-diskquota.desktop @@ -1,15 +1,15 @@ [Desktop Entry] Encoding=UTF-8 -Name=Setting user quotas -Name[ru]=Настройка квот пользователей -GenericName=Setting user quotas -GenericName[ru]=Настройка квот пользователей -Comment=Configuring disk quota settings for system groups and users -Comment[ru]=Настройка параметров дисковых квот для системных групп и пользователей системы +Name=ubl-settings-diskquota +Name[ru]=Дисковые квоты +GenericName=ubl-settings-diskquota +GenericName[ru]=Дисковые квоты +Comment=Configuring disk quota settings for groups and users of the system +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; +Categories=XFCE;GTK;Settings;DesktopSettings;X-XFCE-SettingsDialog;X-XFCE-SystemSettings;X-UBL-SettingsManager;X-UBL-Personal-Settings; diff --git a/ubl-settings-diskquota.glade b/ubl-settings-diskquota.glade index 7ae92f2..7e349b7 100644 --- a/ubl-settings-diskquota.glade +++ b/ubl-settings-diskquota.glade @@ -1,37 +1,31 @@ - - + + - - - - - - - - - - - - - - Byte - - - Kb - - - Mb - - - Gb - - - Tb - - - - + + + + + False False True @@ -40,10 +34,10 @@ dialog True ubl-settings-diskquota - 1.0 + 1.1 Copyright © 2022 - 2023, UBSoft LLC - Setting user quotas - https://ublinux.ru/ + Disk quotas + https://wiki.ublinux.ru/ru/Программное_обеспечение/Программы_и_утилиты/Все/ubl-settings-diskquota Project Home Page Это приложение распространяется без каких-либо гарантий. Подробнее в <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.html">GNU General Public License, версии 2 или позднее</a>. @@ -59,7 +53,7 @@ vertical 2 - + False end @@ -85,7 +79,7 @@ 5 5 2 - ubl-settings-diskquota + Disk quotas @@ -94,12 +88,12 @@ - + True False + center - 90 True False 5 @@ -108,7 +102,7 @@ 5 6 6 - 69 + 64 com.ublinux.ubl-settings-diskquota @@ -129,14 +123,15 @@ True False + center vertical - + 255 True False end - Setting user quotas + Disk quotas 0 @@ -153,11 +148,13 @@ - + 255 True False start + 5 + 5 Configuring disk quota settings for system groups and users True 0 @@ -197,223 +194,202 @@ - - 5 + + 1000000 + 1 + 10 + + + 1000000 1 10 - - 23 + + 1000000 1 10 - - 59 + + 1000000 1 10 - - 100 + + 1000000 + 1 + 10 + + + 1000000 1 10 - - 5 + + 1000000 1 10 - - 23 + + 1000000 1 10 - - 59 + + 1000000 1 10 - - 100 + + 1000000 + 1 + 10 + + + 1000000 + 1 + 10 + + + 1000000 + 1 + 10 + + + 1000000 + 1 + 10 + + + 1000000 + 1 + 10 + + + 1000000 + 1 + 10 + + + 1000000 + 1 + 10 + + + 1000000 + 1 + 10 + + + 1000000 1 10 - - 5 + + 1000000 1 10 - - 23 + + 1000000 1 10 - - 59 + + 1000000 1 10 - + 100 1 10 - - 5 + + 1000000 1 10 - - 23 + + 100 1 10 - - 59 + + 100 1 10 - + 100 1 10 - - True - False - dialog-question-symbolic + + 100 + 1 + 10 - - True - False - ibus-panel + + 100 + 1 + 10 - - True - False - False - False - - - True - False - 4 - 4 - Direct control of the file system - True - - - - - Help - True - False - 5 - 5 - image2 - False - - - - - About - True - False - 5 - 5 - image3 - False - - + + 100 + 1 + 10 - - - True - False - False - - - True - False - Load from global configuration - True - - - - - - True - False - Load from local configuration - True - - - + + 1000000 + 1 + 10 - - True - False - False - - - True - False - Save to global and local configuration - True - - - - - - True - False - Save to global configuration - True - - - - - - True - False - Save to local configuration - True - - - + + 1000000 + 1 + 10 - - 800 - 500 + + 1000000 + 1 + 10 + + + 1000000 + 1 + 10 + + + 1000000 + 1 + 10 + + + 1000000 + 1 + 10 + + False - center + False + True com.ublinux.ubl-settings-diskquota - center - + True False vertical - + True False vertical - + True False - + True False 5 @@ -422,8 +398,7 @@ 5 5 5 - 25 - 1 + Device: False @@ -432,20 +407,15 @@ - + True False - start 5 5 5 5 5 5 - - - - True @@ -453,6 +423,24 @@ 1 + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + 0 + + + False + True + 2 + + False @@ -461,188 +449,107 @@ - + True False vertical - - 81 + True False - + True False - start + 5 + 5 + 5 + 5 + 5 + 5 + Quota use status: + 0 - -1 + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + 1 + 1 + + Not set + Off + On + + + + True + True + 1 False True - 0 + 1 - - - False - True - 1 - - - - - True - False - 5 - 5 - 5 - 5 - True - True - vertical - + True - True + False + 5 + 5 + 5 + 5 + 5 + 5 + 0.019999999552965164 + 0.5899999737739563 + in - + True False - vertical - - 300 - True - True - in - - - True - False - - - True - True - liststore1 - - - - - - - - - - False - True - 0 - - - - - - - True - False - General statistics - - - False - - - - - True - False - vertical - - + True False 5 5 5 5 - 5 - 5 - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Device: - - - False - True - 0 - - - - - True - False - - - True - True - 1 - - - - - True - False - 5 - 5 - 5 - 5 - - - False - True - 2 - - - - - False - True - 0 - - - - - True - False + 5 - + True False - vertical - 5 - True - + True - False + True 5 5 5 5 5 5 - Excess size delay period + 4 + 0 + adjustment35 False @@ -651,7 +558,7 @@ - + True False 5 @@ -660,12 +567,12 @@ 5 5 5 - Excess files delay period + weeks + 0 False True - end 1 @@ -677,51 +584,22 @@ - + True False - vertical - 5 - + True - False - - - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - weeks - 0 - - - False - True - 1 - - + True + 5 + 5 + 5 + 5 + 5 + 5 + 4 + 0 + adjustment34 False @@ -730,45 +608,17 @@ - + True False - - - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - weeks - 0 - - - False - True - 1 - - + 5 + 5 + 5 + 5 + 5 + 5 + days + 0 False @@ -784,51 +634,22 @@ - + True False - vertical - 5 - + True - False - - - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - days - 0 - - - False - True - 1 - - + True + 5 + 5 + 5 + 5 + 5 + 5 + 4 + 0 + adjustment33 False @@ -837,45 +658,17 @@ - + True False - - - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - days - 0 - - - False - True - 1 - - + 5 + 5 + 5 + 5 + 5 + 5 + hours + 0 False @@ -891,51 +684,22 @@ - + True False - vertical - 5 - + True - False - - - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - hours - 0 - - - False - True - 1 - - + True + 5 + 5 + 5 + 5 + 5 + 5 + 4 + 0 + adjustment32 False @@ -944,45 +708,17 @@ - + True False - - - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - hours - 0 - - - False - True - 1 - - + 5 + 5 + 5 + 5 + 5 + 5 + minutes + 0 False @@ -997,52 +733,66 @@ 3 + + + + + + + True + False + The postponement period for exceeding the volume: + + + + + False + True + 2 + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + 0.019999999552965164 + in + + + True + False + + + True + False + 5 + 5 + 5 + 5 + 5 - + True False - vertical - 5 - + True - False - - - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - minutes - 0 - - - False - True - 1 - - + True + 5 + 5 + 5 + 5 + 5 + 5 + 4 + 0 + adjustment5 False @@ -1051,45 +801,17 @@ - + True False - - - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - minutes - 0 - - - False - True - 1 - - + 5 + 5 + 5 + 5 + 5 + 5 + weeks + 0 False @@ -1098,96 +820,6 @@ - - False - True - 4 - - - - - False - True - 1 - - - - - 100 - True - True - in - - - True - False - - - True - True - liststore1 - - - - - - - - - - False - True - 2 - - - - - True - False - - - True - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - True - False - - - True - False - com.ublinux.ubl-settings-diskquota.funnel - - - False - True - 0 - - - - - True - False - 5 - 5 - Filters - - - False - True - 1 - - - - - False True @@ -1195,22 +827,22 @@ - + True False - - gtk-delete + True True - True 5 5 5 5 5 5 - True + 4 + 0 + adjustment7 False @@ -1219,52 +851,17 @@ - + True - True - True + False 5 5 5 5 5 5 - - - True - False - - - True - False - 5 - 5 - gtk-edit - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - Edit - - - False - True - 1 - - - - + days + 0 False @@ -1272,146 +869,30 @@ 1 - - - gtk-add - True - True - True - 5 - 5 - 5 - 5 - 5 - 5 - True - - - False - True - 2 - - - - - False - True - end - 1 - - - - - False - True - end - 3 - - - - - 1 - - - - - True - False - Users - - - 1 - False - - - - - True - False - vertical - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Device: False True - 0 - - - - - True - False - - - True - True 1 - - True - False - 5 - 5 - 5 - 5 - - - False - True - 2 - - - - - False - True - 0 - - - - - True - False - - + True False - vertical - 5 - True - + True - False + True 5 5 5 5 5 5 - Excess size delay period + 4 + 0 + adjustment9 False @@ -1420,7 +901,7 @@ - + True False 5 @@ -1429,12 +910,12 @@ 5 5 5 - Excess files delay period + hours + 0 False True - end 1 @@ -1442,55 +923,26 @@ False True - 0 + 2 - + True False - vertical - 5 - + True - False - - - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - weeks - 0 - - - False - True - 1 - - + True + 5 + 5 + 5 + 5 + 5 + 5 + 4 + 0 + adjustment11 False @@ -1499,45 +951,17 @@ - + True False - - - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - weeks - 0 - - - False - True - 1 - - + 5 + 5 + 5 + 5 + 5 + 5 + minutes + 0 False @@ -1549,3139 +973,106 @@ False True - 1 + 3 - - - True - False - vertical - 5 - - - True - False - - - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - days - 0 - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - - - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - days - 0 - - - False - True - 1 - - - - - False - True - 1 - - - - - False - True - 2 - - - - - True - False - vertical - 5 - - - True - False - - - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - hours - 0 - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - - - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - hours - 0 - - - False - True - 1 - - - - - False - True - 1 - - - - - False - True - 3 - - - - - True - False - vertical - 5 - - - True - False - - - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - minutes - 0 - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - - - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - minutes - 0 - - - False - True - 1 - - - - - False - True - 1 - - - - - False - True - 4 - - - - - False - True - 1 - - - - - 100 - True - True - in - - - True - False - - - True - True - liststore1 - - - - - - - - - - False - True - 2 - - - - - True - False - - - True - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - True - False - - - True - False - com.ublinux.ubl-settings-diskquota.funnel - - - False - True - 0 - - - - - True - False - 5 - 5 - Filters - - - False - True - 1 - - - - - - - False - True - 0 - - - - - True - False - - - gtk-delete - True - True - True - 5 - 5 - 5 - 5 - 5 - 5 - True - - - False - True - 0 - - - - - True - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - True - False - - - True - False - 5 - 5 - gtk-edit - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - Edit - - - False - True - 1 - - - - - - - False - True - 1 - - - - - gtk-add - True - True - True - 5 - 5 - 5 - 5 - 5 - 5 - True - - - False - True - 2 - - - - - False - True - end - 1 - - - - - False - True - end - 3 - - - - - 2 - - - - - True - False - Groups - - - 2 - False - - - - - True - False - vertical - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Device: - - - False - True - 0 - - - - - True - False - - - True - True - 1 - - - - - True - False - 5 - 5 - 5 - 5 - - - False - True - 2 - - - - - False - True - 0 - - - - - True - False - - - True - False - vertical - 5 - True - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Excess size delay period - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Excess files delay period - - - False - True - end - 1 - - - - - False - True - 0 - - - - - True - False - vertical - 5 - - - True - False - - - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - weeks - 0 - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - - - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - weeks - 0 - - - False - True - 1 - - - - - False - True - 1 - - - - - False - True - 1 - - - - - True - False - vertical - 5 - - - True - False - - - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - days - 0 - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - - - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - days - 0 - - - False - True - 1 - - - - - False - True - 1 - - - - - False - True - 2 - - - - - True - False - vertical - 5 - - - True - False - - - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - hours - 0 - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - - - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - hours - 0 - - - False - True - 1 - - - - - False - True - 1 - - - - - False - True - 3 - - - - - True - False - vertical - 5 - - - True - False - - - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - minutes - 0 - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - - - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - minutes - 0 - - - False - True - 1 - - - - - False - True - 1 - - - - - False - True - 4 - - - - - False - True - 1 - - - - - 100 - True - True - in - - - True - False - - - True - True - liststore1 - - - - - - - - - - False - True - 2 - - - - - True - False - - - True - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - True - False - - - True - False - com.ublinux.ubl-settings-diskquota.funnel - - - False - True - 0 - - - - - True - False - 5 - 5 - Filters - - - False - True - 1 - - - - - - - False - True - 0 - - - - - True - False - - - gtk-delete - True - True - True - 5 - 5 - 5 - 5 - 5 - 5 - True - - - False - True - 0 - - - - - True - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - True - False - - - True - False - 5 - 5 - gtk-edit - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - Edit - - - False - True - 1 - - - - - - - False - True - 1 - - - - - gtk-add - True - True - True - 5 - 5 - 5 - 5 - 5 - 5 - True - - - False - True - 2 - - - - - False - True - end - 1 - - - - - False - True - end - 3 - - - - - 3 - - - - - True - False - Project - - - 3 - False - - - - - True - True - 0 - - - - - False - True - 2 - - - - - True - True - 0 - - - - - - - True - False - True - - - True - False - 5 - 5 - 5 - 5 - 2 - ubl-settings-diskquota - - - - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - 32 - com.ublinux.ubl-settings-diskquota - - - - - True - False - - - True - True - False - True - menuLoad - - - True - False - - - True - False - Load - - - False - True - 0 - - - - - True - False - pan-down-symbolic - - - False - True - 1 - - - - - - - False - True - 0 - - - - - - 2 - - - - - True - False - - - True - True - False - True - menuSave - - - True - False - - - True - False - Save - - - False - True - 0 - - - - - True - False - pan-down-symbolic - - - False - True - 1 - - - - - - - False - True - 0 - - - - - True - True - True - False - True - True - menuAbout - none - - - True - False - open-menu-symbolic - - - - - False - True - 1 - - - - - - end - 3 - - - - - - - - - - - - - vertical - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1000000 - 1 - 10 - - - 1000000 - 1 - 10 - - - 1024 - 1 - 10 - - - 1024 - 1 - 10 - - - False - start - False - - - True - False - 5 - 5 - 5 - 5 - vertical - - - True - False - vertical - - - True - False - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Device: - - - False - True - 0 - - - - - True - False - 5 - 5 - - - True - True - 1 - - - - - True - True - 0 - - - - - True - False - - - True - False - 5 - 5 - 5 - Quota use status: - 0 - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 0 - - - True - True - 1 - - - - - True - True - 1 - - - - - True - False - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - UserGropProject: - 0 - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - - - True - True - 1 - - - - - False - True - 2 - - - - - False - True - 0 - - - - - True - False - True - - - True - False - 5 - 5 - 5 - 5 - 5 - 0.019999999552965164 - in - - - True - False - 5 - 5 - 5 - 5 - - - True - False - vertical - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Currently using: - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Soft limit - 0 - - - False - True - 1 - - - - - True - False - 5 - - - True - True - False - 5 - 5 - 5 - 5 - right - True - - - False - True - 0 - - - - - True - True - quotegroupSizeSoftLimitAdjustment - - - True - True - 1 - - - - - True - False - 5 - 5 - 5 - 5 - - - False - True - 2 - - - - - True - True - 2 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Hard limit - 0 - - - False - True - 3 - - - - - True - False - False - 5 - - - True - True - False - 5 - 5 - 5 - 5 - right - True - - - False - True - 0 - - - - - True - True - quotegroupSizeHardLimitAdjustment - - - True - True - 1 - - - - - True - False - 5 - 5 - 5 - 5 - - - False - True - 2 - - - - - True - True - 4 - - - - - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Size - - - - - True - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 0.019999999552965164 - in - - - True - False - 5 - 5 - 5 - 5 - - - True - False - vertical - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Currently using: - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Soft limit - 0 - - - False - True - 1 - - - - - True - False - 5 - - - True - True - False - right - True - - - False - True - 0 - - - - - True - True - quotegroupFilesSoftLimitAdjustment - - - True - True - 1 - - - - - True - False - 5 - 5 - 5 - 5 - files - - - False - True - 2 - - - - - True - True - 2 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Hard limit - 0 - - - False - True - 3 - - - - - True - False - 5 - - - True - True - False - right - True - - - False - True - 0 - - - - - True - True - quotegroupFilesHardLimitAdjustment - - - True - True - 1 - - - - - True - False - 5 - 5 - 5 - files - - - False - True - 2 - - - - - True - True - 4 - - - - - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Files - - - - - True - True - 1 - - - - - False - True - 1 - - - - - True - False - vertical - True - - - True - False - end - 5 - True - - - gtk-cancel - True - True - True - 5 - 5 - 5 - 5 - 5 - 5 - True - - - False - True - 0 - - - - - gtk-save - True - True - True - 5 - 5 - 5 - 5 - 5 - 5 - True - - - False - True - 1 - - - - - False - True - 0 - - - - - False - True - 2 - - - - - - - True - False - True - - - True - False - Settings disk quotas - Addition - - - - - - - - True - False - 32 - com.ublinux.ubl-settings-diskquota - 5 - - - - - - - False - start - False - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - vertical - - - True - False - vertical - - - True - False - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Device: - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - - - False - True - 1 - - - - - True - True - 0 - - - - - True - False - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Quota use status: - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - - - False - True - 1 - - - - - True - True - 1 - - - - - True - False - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Catalog - 0 - - - False - True - 0 - - - - - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - True - True - 1 - - - - - True - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - True - False - - - True - False - gtk-zoom-fit - - - False - True - 0 - - - - - True - False - Review - - - False - True - 1 - - - - - - - False - True - 2 - - - - - False - True - 2 - - - - - True - False - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Project ID - 0 - - - False - True - 0 - - - - - Auto - True - True - False - 5 - 5 - 5 - 5 - 5 - 5 - True - - - False - True - 1 - - - - - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - True - True - 2 - - - - - Generate - True - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - False - True - 3 - - - - - False - True - 3 - - - - - True - False - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Project Name - - - False - True - 0 - - - - - True - True - 5 - 5 - 5 - 5 - - - True - True - 1 - - - - - False - True - 4 - - - - - False - True - 0 - - - - - True - False - True - - - True - False - 5 - 5 - 5 - 5 - 5 - 0.019999999552965164 - in - - - True - False - 5 - 5 - 5 - 5 - - - True - False - vertical - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Currently using: - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Soft limit - 0 - - - False - True - 1 - - - - - True - False - 5 - - - True - True - False - 5 - 5 - 5 - 5 - right - True - - - False - True - 0 - - - - - True - True - 0 - quotegroupSizeSoftLimitAdjustment - - - True - True - 1 - - - - - True - False - 5 - 5 - 5 - 5 - - - False - True - 2 - - - - - True - True - 2 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Hard limit - 0 - - - False - True - 3 - - - - - True - False - False - 5 - - - True - True - False - 5 - 5 - 5 - 5 - right - True - - - False - True - 0 - - - - - True - True - 0 - quotegroupSizeHardLimitAdjustment - - - True - True - 1 - - - - - True - False - 5 - 5 - 5 - 5 - - - False - True - 2 - - - - - True - True - 4 - - - - - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Size - - - - - True - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 0.019999999552965164 - in - - - True - False - 5 - 5 - 5 - 5 - - - True - False - vertical - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Currently using: - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Soft limit - 0 - - - False - True - 1 - - - - - True - False - 5 - - - True - True - False - 5 - 5 - 5 - 5 - right - True - - - False - True - 0 - - - - - True - True - 0 - quotegroupFilesSoftLimitAdjustment - - - True - True - 1 - - - - - True - False - 5 - 5 - 5 - 5 - files - - - False - True - 2 - - - - - True - True - 2 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Hard limit - 0 - - - False - True - 3 - - - - - True - False - 5 - - - True - True - False - 5 - 5 - 5 - 5 - 5 - right - True - - - False - True - 0 - - - - - True - True - 0 - quotegroupFilesHardLimitAdjustment - - - True - True - 1 - - - - - True - False - 5 - 5 - 5 - 5 - files - - - False - True - 2 - - - - - True - True - 4 - - - - - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Files - - - - - True - True - 1 - - - - - False - True - 1 - - - - - True - False - vertical - True - - - True - False - end - 5 - True - - - gtk-cancel - True - True - True - 5 - 5 - 5 - 5 - 5 - 5 - True + + + + + + + True + False + The delay period for exceeding files: + + False True - 0 + 3 + + + True + True + 1 + + + + + True + False + vertical + True - - gtk-save + True - True - True - 5 - 5 - 5 - 5 - 5 - 5 - True + False + end + 5 + True + + + gtk-cancel + True + True + True + 5 + 5 + 5 + 5 + 5 + 5 + True + + + False + True + 0 + + + + + gtk-save + True + True + True + 5 + 5 + 5 + 5 + 5 + 5 + True + + + False + True + 1 + + False True - 1 + 0 False True - 0 + 2 - False + True True - 2 + 1 @@ -4692,10 +1083,10 @@ False True - + True False - Settings disk quotas - Addition + Settings device - Addition @@ -4713,25 +1104,16 @@ - - True - - - - - - - True - - - - - - - + + + + + False start False + True + com.ublinux.ubl-settings-diskquota True @@ -4744,91 +1126,37 @@ 5 vertical - + True False - vertical - + True False - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Device: - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - - - False - True - 1 - - + 5 + 5 + 5 + 5 + 5 + 5 + Device: - True + False True 0 - + True False - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Quota use status: - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - - - False - True - 1 - - + 5 + 5 + 5 + 5 + 5 + 5 True @@ -4836,170 +1164,182 @@ 1 - - - True - False - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Catalog - - - False - True - 0 - - - - - True - False - - - False - True - 1 - - - - - False - True - 2 - - - - - True - False - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Project ID - - - False - True - 0 - - - - - True - False - - - False - True - 1 - - - - - False - True - 3 - - - - - True - False - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Project Name - - - False - True - 0 - - - - - True - True - 5 - 5 - 5 - 5 - 5 - 5 - - - True - True - 1 - - + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + 0 False True - 4 + 2 - False + True True 0 - + True False - True + vertical - + True False - 5 - 5 - 5 - 5 - 5 - 0.019999999552965164 - in + vertical + + + + + + True + False + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + Quota use status: + 0 + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + 0 + + + True + True + 1 + + + + + True + True + 1 + + + + + + + + True + False + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + UserGropProject: + 0 + + + False + True + 0 + + + + + True + True + 5 + 5 + 5 + 5 + 5 + 5 + entrycompletion4 + + + True + True + 1 + + + + + True + True + True + 5 + 5 + 5 + 5 + 5 + 5 + + + True + False + avatar-default-symbolic + + + + + False + False + 2 + + + + + False + True + 3 + + - + True False - 5 - 5 - 5 - 5 + vertical + + + True False - vertical - + True False 5 @@ -5008,7 +1348,8 @@ 5 5 5 - Currently using: + Catalog: + 0 False @@ -5017,84 +1358,75 @@ - + True - False + True 5 5 5 5 5 5 - Soft limit - 0 + 255 + entrycompletion1 - False + True True 1 - + True - False - 5 - - - True - True - False - 5 - 5 - 5 - 5 - right - True - - - False - True - 0 - - - - - True - True - 0 - quotegroupSizeSoftLimitAdjustment - - - True - True - 1 - - + True + True + 5 + 5 + 5 + 5 + 5 + 5 - + True False - 5 - 5 - 5 - 5 + center + + + True + False + gtk-zoom-fit + + + False + True + 0 + + + + + True + False + Review + + + False + True + 1 + + - - False - True - 2 - - True + False True 2 - + True False 5 @@ -5103,8 +1435,7 @@ 5 5 5 - Hard limit - 0 + label False @@ -5112,115 +1443,33 @@ 3 - - - True - False - False - 5 - - - True - True - False - 5 - 5 - 5 - 5 - right - True - - - False - True - 0 - - - - - True - True - 0 - quotegroupSizeHardLimitAdjustment - - - True - True - 1 - - - - - True - False - 5 - 5 - 5 - 5 - - - False - True - 2 - - - - - True - True - 4 - - + + False + True + 1 + + + + - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Size - - - - - True - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 0.019999999552965164 - in + + False + True + 4 + + - + True False - 5 - 5 - 5 - 5 - + True False - vertical - + True False 5 @@ -5229,7 +1478,8 @@ 5 5 5 - Currently using: + Project ID: + 0 False @@ -5238,17 +1488,18 @@ - + + Auto True - False + True + False 5 5 5 5 5 5 - Soft limit - 0 + True False @@ -5256,44 +1507,258 @@ 1 + + + False + True + 1 + + + + + True + True + 5 + 5 + 5 + 5 + 5 + 5 + 5 + entrycompletion2 + number + + + True + True + 3 + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + label + 0 + + + False + True + 4 + + + + + Generate + True + True + True + 5 + 5 + 5 + 5 + 5 + 5 + + + False + True + end + 6 + + + + + False + True + 5 + + + + + + + + True + False + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + Project Name: + 0 + + + False + True + 0 + + + + + True + True + 5 + 5 + 5 + 5 + 5 + 5 + 12 + entrycompletion3 + + + True + True + 1 + + + + + False + True + 7 + + + + + + + + False + True + 0 + + + + + True + False + True + + + True + False + 5 + 5 + 5 + 5 + 5 + 0.019999999552965164 + in + + + True + False + 5 + 5 + 5 + 5 True False - 5 + vertical - + True - True - False + False 5 5 5 5 - right - True + 5 + 5 + Soft limit + 0 False True - 0 + 1 - + True - True - 0 - quotegroupFilesSoftLimitAdjustment + False + 5 + + + True + True + False + 5 + 5 + 5 + 5 + right + True + + + False + True + 0 + + + + + True + True + 7 + 0 + adjustment1 + + + True + True + 1 + + + + + True + False + 5 + 5 + 5 + 5 + 0 + 0 + + Kb + Mb + Gb + Tb + + + + False + True + 2 + + True True - 1 + 2 - + True False 5 @@ -5302,78 +1767,208 @@ 5 5 5 - files + Hard limit + 0 False True - 2 + 3 + + + + + True + False + False + 5 + + + True + True + False + 5 + 5 + 5 + 5 + right + True + + + False + True + 0 + + + + + True + True + 7 + 0 + adjustment2 + + + True + True + 1 + + + + + True + False + 5 + 5 + 5 + 5 + 0 + 0 + + Kb + Mb + Gb + Tb + + + + False + True + 2 + + + + + True + True + 4 - - True - True - 2 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Hard limit - 0 - - - False - True - 3 - + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + Size + + + + + True + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 0.019999999552965164 + in + + + True + False + 5 + 5 + 5 + 5 True False - 5 + vertical - + True - True - False + False 5 5 5 5 - right - True + 5 + 5 + Soft limit + 0 False True - 0 + 1 - + True - True - 0 - quotegroupFilesHardLimitAdjustment + False + 5 + + + True + True + False + right + True + + + False + True + 0 + + + + + True + True + 7 + 0 + adjustment3 + + + True + True + 1 + + + + + True + False + 5 + 5 + 5 + 5 + files + + + False + True + 2 + + True True - 1 + 2 - + True False 5 @@ -5382,41 +1977,98 @@ 5 5 5 - files + Hard limit + 0 False True - 2 + 3 + + + + + True + False + 5 + + + True + True + False + right + True + + + False + True + 0 + + + + + True + True + 7 + 0 + adjustment4 + + + True + True + 1 + + + + + True + False + 5 + 5 + 5 + 5 + files + + + False + True + 2 + + + + + True + True + 4 - - True - True - 4 - + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + Files + + - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Files - + + True + True + 1 + - True + False True 1 @@ -5442,7 +2094,7 @@ 5 True - + gtk-cancel True True @@ -5462,7 +2114,7 @@ - + gtk-save True True @@ -5483,7 +2135,179 @@ - False + False + True + 0 + + + + + False + True + 3 + + + + + + + True + False + True + + + True + False + Settings disk quotas - Addition + + + + + + + + True + False + 32 + com.ublinux.ubl-settings-diskquota + 5 + + + + + + + True + False + process-stop-symbolic + + + False + False + 450 + True + dialog-question-symbolic + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + vertical + 10 + + + True + False + + + True + False + start + 20 + 20 + dialog-information-symbolic + 6 + + + False + True + 0 + + + + + True + False + vertical + + + True + False + start + 10 + 5 + Warning + True + 0 + + + + + + + + False + True + 0 + + + + + True + False + start + start + 10 + 10 + The selected directory is not located on the target device + True + 0 + + + + False + True + 1 + + + + + + True + True + 1 + + + + + + True + True + 0 + + + + + True + False + 30 + True + + + Cancel + True + True + True + image1 + + + + True True 0 @@ -5492,73 +2316,95 @@ False True - 2 + 1 - + True False True - + True False - Settings disk quotas - Editing + Disk quotas - - - True - False - 32 - com.ublinux.ubl-settings-diskquota - 5 - - - + + True + False + process-stop-symbolic + + + True + False + emblem-ok-symbolic + + False - start False + 450 + dialog-question-symbolic True False - 5 - 5 5 5 5 5 vertical + 10 True False - vertical + + + True + False + start + 20 + 20 + dialog-question-symbolic + 6 + + + False + True + 0 + + True False + vertical - + True False - 5 - 5 - 5 - 5 - 5 + start + 10 5 - Device: + Would you like to read documentation in the Web? + True + 0 + + + + False @@ -5567,18 +2413,82 @@ - + True False - 5 - 5 + start + start + 10 + 10 + You will be redirected to documentation website where documentation is +translated and supported by community. + True + 0 + - True + False True 1 + + + Always redirect to online documentation + True + True + False + end + True + + + + False + True + end + 2 + + + + + + True + True + 1 + + + + + + True + True + 0 + + + + + True + False + 30 + True + + + Cancel + True + True + True + image8 + True @@ -5586,22 +2496,203 @@ 0 + + + Open documentation + True + True + True + image9 + + + + True + True + 1 + + + + + False + True + 1 + + + + + + + True + False + True + + + True + False + Disk quotas + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + False + 250 + 400 + com.ublinux.ubl-settings-diskquota + + + True + False + vertical + + + True + False + vertical True False + vertical - + + Withdraw all users True - False + True + False 5 5 5 5 5 5 - Quota use status: - 0 + True False @@ -5610,14 +2701,50 @@ - + True - False - 5 - 5 - 5 - 5 - 0 + True + external + always + in + + + True + False + + + True + True + liststoreUsersGroups + 0 + + + + + + + + + 0 + + + + + + + Users + + + + 1 + + + + + + + + True @@ -5629,269 +2756,201 @@ True True - 1 + 0 True False + vertical + True - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - UserGropProject: - 0 - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - - - False - True - 1 - - - - - False - True - 2 - - - - - False - True - 0 - - - - - True - False - True - - - True - False - 5 - 5 - 5 - 5 - 5 - 0.019999999552965164 - in - - + True False - 5 - 5 - 5 - 5 + end + 5 + True - + + gtk-cancel True - False - vertical - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Currently using: - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Soft limit - 0 - - - False - True - 1 - - - - - True - False - 5 - - - True - True - False - 5 - 5 - 5 - 5 - right - True - - - False - True - 0 - - - - - True - True - 0 - quotegroupSizeSoftLimitAdjustment - - - True - True - 1 - - - - - True - False - 5 - 5 - 5 - 5 - - - False - True - 2 - - - - - True - True - 2 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Hard limit - 0 - - - False - True - 3 - - - - - True - False - False - 5 - - - True - True - False - 5 - 5 - 5 - 5 - right - True - - - False - True - 0 - - - - - True - True - 0 - quotegroupSizeHardLimitAdjustment - - - True - True - 1 - - - - - True - False - 5 - 5 - 5 - 5 - - - False - True - 2 - - - - - True - True - 4 - - + True + True + 5 + 5 + 5 + 5 + 5 + 5 + True + + + False + True + 0 + + + + + gtk-save + True + True + True + 5 + 5 + 5 + 5 + 5 + 5 + True + + False + True + 1 + + + False + True + 0 + - - + + + False + True + 1 + + + + + True + True + 1 + + + + + + + True + False + True + + + True + False + Users + + + + + + + + True + False + 32 + com.ublinux.ubl-settings-diskquota + 5 + + + + + + + True + False + False + + + True + False + Load global configuration + + + + + + True + False + Load local configuration + + + + + + True + False + False + False + + + True + False + False + + + True + False + Save configuration + + + + + + True + False + Save to global configuration + + + + + + True + False + Save to local configuration + + + + + + 800 + 600 + False + 760 + 560 + com.ublinux.ubl-settings-diskquota + + + True + False + vertical + + + True + False + vertical + + + True + False + + True False 5 @@ -5900,18 +2959,80 @@ 5 5 5 - Size + 25 + + + False + True + 0 + + + + + True + False + start + 5 + 5 + 5 + 5 + 6 + 6 + True + + + + + + False + True + 1 + - True + False True 0 - + + True + False + vertical + + + 81 + True + False + + + True + False + start + + + -1 + + + + + False + True + 0 + + + + + False + True + 1 + + + + True False 5 @@ -5919,256 +3040,1659 @@ 5 5 5 - 0.019999999552965164 - in + 5 + True + True + vertical - + True False - 5 - 5 - 5 - 5 + 5 + 5 + 5 + 5 + 5 + 5 + True + True + vertical - + True False + 5 + 5 + 5 + 5 + 5 + 5 + True + True vertical - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Currently using: - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Soft limit - 0 - - - False - True - 1 - - - - + True - False - 5 + True - + + True + False + vertical + + + 300 + True + True + in + + + True + False + + + True + True + liststoreGeneral + 0 + + + + + + autosize + Status + True + + + + 0 + + + + + + + Quotas + + + + 1 + + + + + + + autosize + Quota type + True + + + word + + + 2 + + + + + + + autosize + Device/ +Project + True + + + + 3 + + + + + + + autosize + Users + True + + + word + + + 4 + + + + + + + autosize + Groups + True + + + word + + + 5 + + + + + + + autosize + Projects + True + + + word + + + 6 + + + + + + + autosize + Soft +restriction +(volume) + True + + + word + + + 7 + + + + + + + autosize + Hard +limit +(volume) + True + + + word + + + 8 + + + + + + + autosize + Postponing +the +hard +limit +(volume) + True + + + word + + + 9 + + + + + + + autosize + Soft +restriction +(files) + True + + + word + + + 10 + + + + + + + autosize + Hard +limit +(files) + True + + + word + + + 11 + + + + + + + autosize + Postponing +the +hard +limit +(files) + True + + + word + + + 12 + + + + + + + + + + + True + True + 0 + + + + + + True - True - False - 5 - 5 - 5 - 5 - right - True + False + General statistics - False - True - 0 + False - + + 100 True True - 0 - quotegroupFilesSoftLimitAdjustment + in + + + True + False + + + True + False + vertical + + + True + True + liststoreDevice + 0 + + + + + + autosize + Status + True + + + + 0 + + + + + + + Device + True + + + + 1 + + + + + + + autosize + Mount +point + True + + + word + + + 2 + + + + + + + autosize + FS + True + + + word + + + 3 + + + + + + + autosize + Name + True + + + word + + + 4 + + + + + + + autosize + The postponement period +for exceeding the volume + True + + + word + + + 5 + + + + + + + autosize + The delay period +for exceeding files + True + + + word + + + 6 + + + + + + + True + True + 2 + + + + + True + False + + + True + False + + + gtk-delete + True + True + True + 5 + 5 + 5 + 5 + 5 + 5 + True + + + False + True + 0 + + + + + True + True + True + 5 + 5 + 5 + 5 + 5 + 5 + + + True + False + + + True + False + 5 + 5 + gtk-edit + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + Edit + + + False + True + 1 + + + + + + + False + True + 1 + + + + + gtk-add + True + True + True + 5 + 5 + 5 + 5 + 5 + 5 + True + + + False + True + 2 + + + + + False + True + end + 1 + + + + + False + True + end + 3 + + + + + + - True - True 1 - - + + True False - 5 - 5 - 5 - 5 - 5 - 5 - files + Device - False - True - 2 + 1 + False - - - True - True - 2 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Hard limit - 0 - - - False - True - 3 - - - - - True - False - 5 - + + 100 True True - False - 5 - 5 - 5 - 5 - right - True + in + + + True + False + + + True + False + vertical + + + True + True + liststoreUser + 0 + + + + + + autosize + Name + True + + + word + + + 0 + + + + + + + Device + True + + + + 1 + + + + + + + autosize + Soft +restriction +(volume) + True + + + word + + + 2 + + + + + + + autosize + Hard +limit +(volume) + True + + + word + + + 3 + + + + + + + autosize + Postponing +the +hard +limit +(volume) + True + + + word + + + 4 + + + + + + + autosize + Soft +restriction +(files) + True + + + word + + + 5 + + + + + + + autosize + Hard +limit +(files) + True + + + word + + + 6 + + + + + + + autosize + Postponing +the +hard +limit +(files) + True + + + word + + + 7 + + + + + + + True + True + 2 + + + + + True + False + + + True + True + True + 5 + 5 + 5 + 5 + 5 + 5 + + + True + False + + + True + False + com.ublinux.ubl-settings-diskquota.funnel + + + False + True + 0 + + + + + True + False + 5 + 5 + Filters + + + False + True + 1 + + + + + + + False + True + 0 + + + + + True + False + + + gtk-delete + True + True + True + 5 + 5 + 5 + 5 + 5 + 5 + True + + + False + True + 0 + + + + + True + True + True + 5 + 5 + 5 + 5 + 5 + 5 + + + True + False + + + True + False + 5 + 5 + gtk-edit + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + Edit + + + False + True + 1 + + + + + + + False + True + 1 + + + + + gtk-add + True + True + True + 5 + 5 + 5 + 5 + 5 + 5 + True + + + False + True + 2 + + + + + False + True + end + 1 + + + + + False + True + end + 3 + + + + + + - False - True - 0 + 2 + + + + + True + False + Users + + + 2 + False - + + 100 True True - 0 - quotegroupFilesHardLimitAdjustment + in + + + True + False + + + True + False + vertical + + + True + True + liststoreGroups + 0 + + + + + + autosize + Name + True + + + word + + + 0 + + + + + + + Device + True + + + + 1 + + + + + + + autosize + Soft +restriction +(volume) + True + + + word + + + 2 + + + + + + + autosize + Hard +limit +(volume) + True + + + word + + + 3 + + + + + + + autosize + Postponing +the +hard +limit +(volume) + True + + + word + + + 4 + + + + + + + autosize + Soft +restriction +(files) + True + + + word + + + 5 + + + + + + + autosize + Hard +limit +(files) + True + + + word + + + 6 + + + + + + + autosize + Postponing +the +hard +limit +(files) + True + + + word + + + 7 + + + + + + + True + True + 2 + + + + + True + False + + + True + True + True + 5 + 5 + 5 + 5 + 5 + 5 + + + True + False + + + True + False + com.ublinux.ubl-settings-diskquota.funnel + + + False + True + 0 + + + + + True + False + 5 + 5 + Filters + + + False + True + 1 + + + + + + + False + True + 0 + + + + + True + False + + + gtk-delete + True + True + True + 5 + 5 + 5 + 5 + 5 + 5 + True + + + False + True + 0 + + + + + True + True + True + 5 + 5 + 5 + 5 + 5 + 5 + + + True + False + + + True + False + 5 + 5 + gtk-edit + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + Edit + + + False + True + 1 + + + + + + + False + True + 1 + + + + + gtk-add + True + True + True + 5 + 5 + 5 + 5 + 5 + 5 + True + + + False + True + 2 + + + + + False + True + end + 1 + + + + + False + True + end + 3 + + + + + + - True - True - 1 + 3 - - + + True False - 5 - 5 - 5 - 5 - 5 - 5 - files + Groups + True - False - True - 2 + 3 + False - - - True - True - 4 - - - - - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Files - - - - - True - True - 1 - - - - - False - True - 1 - - - - - True - False - vertical - True - - - True - False - end - 5 - True - - - gtk-cancel - True - True - True - 5 - 5 - 5 - 5 - 5 - 5 - True + + + 100 + True + True + in + + + True + False + + + True + False + vertical + + + True + True + liststoreProject + 0 + + + + + + Device + True + + + + 0 + + + + + + + Catalog + True + + + + 1 + + + + + + + autosize + ID + True + + + word + + + 2 + + + + + + + autosize + Project Name + True + + + + 3 + + + + + + + autosize + Soft +restriction +(volume) + True + + + word + + + 4 + + + + + + + autosize + Hard +limit +(volume) + True + + + word + + + 5 + + + + + + + autosize + Postponing +the +hard +limit +(volume) + True + + + word + + + 6 + + + + + + + autosize + Soft +restriction +(files) + True + + + word + + + 7 + + + + + + + autosize + Hard +limit +(files) + True + + + word + + + 8 + + + + + + + autosize + Postponing +the +hard +limit +(files) + True + + + word + + + 9 + + + + + + + True + True + 2 + + + + + True + False + + + True + True + True + 5 + 5 + 5 + 5 + 5 + 5 + + + True + False + + + True + False + com.ublinux.ubl-settings-diskquota.funnel + + + False + True + 0 + + + + + True + False + 5 + 5 + Filters + + + False + True + 1 + + + + + + + False + True + 0 + + + + + True + False + + + gtk-delete + True + True + True + 5 + 5 + 5 + 5 + 5 + 5 + True + + + False + True + 0 + + + + + True + True + True + 5 + 5 + 5 + 5 + 5 + 5 + + + True + False + + + True + False + 5 + 5 + gtk-edit + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + Edit + + + False + True + 1 + + + + + + + False + True + 1 + + + + + gtk-add + True + True + True + 5 + 5 + 5 + 5 + 5 + 5 + True + + + False + True + 2 + + + + + False + True + end + 1 + + + + + False + True + end + 3 + + + + + + + + + 4 + + + + + True + False + Projects + + + 4 + False + + + + + True + True + 0 + + + + + False + True + 0 + + False @@ -6176,52 +4700,37 @@ 0 - - - gtk-save - True - True - True - 5 - 5 - 5 - 5 - 5 - 5 - True - - - False - True - 1 - - False True - 0 + 2 - False + True True - 2 + 0 - + True False True - + True False - Settings disk quotas - Editing + 5 + 5 + 5 + 5 + 2 + Disk quotas @@ -6231,46 +4740,165 @@ True False + 5 + 5 + 5 + 5 + 6 + 6 32 com.ublinux.ubl-settings-diskquota - 5 + + + True + False + + + True + True + False + True + menu3 + + + True + False + + + True + False + Save + + + False + True + 0 + + + + + True + False + pan-down-symbolic + + + False + True + 1 + + + + + + + False + True + 0 + + + + + True + True + True + False + True + True + menu2 + none + + + + + + + False + True + 1 + + + + + end + 1 + + + + + True + False + + + True + True + False + True + menu1 + + + True + False + + + True + False + Load + + + False + True + 0 + + + + + True + False + pan-down-symbolic + + + False + True + 1 + + + + + + + False + True + 0 + + + + + 2 + + + - - 1000000 - 1 - 10 - - - 1000000 - 1 - 10 - - - 1024 - 1 - 10 - - - 1024 - 1 - 10 - False - Please select File + Please select folder True center 500 400 True - com.ublinux.ublexec + com.ublinux.ubl-settings-diskquota dialog True True + a select-folder @@ -6287,12 +4915,6 @@ True True True - 5 - 5 - 5 - 5 - 5 - 5 True @@ -6307,12 +4929,6 @@ True True True - 5 - 5 - 5 - 5 - 5 - 5 True @@ -6338,6 +4954,7 @@ False start False + com.ublinux.ubl-settings-diskquota True @@ -6366,13 +4983,68 @@ - - Quotas + True - True - False - start - True + False + vertical + + + Device + True + True + False + 0 + True + + + False + True + 0 + + + + + Catalog + True + True + False + True + + + False + True + 1 + + + + + ID + True + True + False + True + + + False + True + 4 + + + + + Project Name + True + True + False + start + True + + + False + True + 5 + + False @@ -6380,24 +5052,9 @@ 1 - - - Size - True - True - False - start - True - - - False - True - 2 - - - Soft limit (size) + Soft limit (volume) True True False @@ -6407,12 +5064,12 @@ False True - 3 + 2 - Hard limit (size) + Hard limit (volume) True True False @@ -6422,7 +5079,7 @@ False True - 4 + 3 @@ -6472,23 +5129,8 @@ - - Hard limit (size) delay - True - True - False - start - True - - - False - True - 5 - - - - - Files + + Postponing the hard limit (volume) True True False @@ -6498,11 +5140,11 @@ False True - 7 + 8 - + Soft limit (files) True True @@ -6513,11 +5155,11 @@ False True - 8 + 10 - + Hard limit (files) True True @@ -6528,12 +5170,12 @@ False True - 9 + 12 - Hard limit (files) delay + Postponing the hard limit (files) True True False @@ -6543,7 +5185,7 @@ False True - 10 + 13 @@ -6575,239 +5217,4 @@ - - False - start - start - False - 450 - 250 - dialog-question-symbolic - - - True - False - vertical - - - True - False - - - True - False - start - 20 - 20 - dialog-question-symbolic - 5 - - - False - True - 0 - - - - - True - False - vertical - - - True - False - start - 10 - 5 - Would you like to read documentation in the Web? - True - 0 - - - - - - - False - True - 0 - - - - - True - False - start - start - 10 - 10 - You will be redirected to documentation website where documentation is -translated and supported by community. - True - 0 - - - - True - True - 1 - - - - - Always redirect to online documentation - True - True - False - end - 10 - True - - - - False - True - 2 - - - - - - True - True - 1 - - - - - - True - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - 30 - True - - - Cancel - True - True - True - - - - True - True - 0 - - - - - Read Online - True - True - True - - - - True - True - 1 - - - - - False - True - 1 - - - - - - - True - False - True - - - True - False - ubl-settings-diskquota - - - - - - - - True - False - 32 - dialog-question-symbolic - - - - - - - 800 - 600 - False - True - True - com.ublinux.ubl-settings-diskquota - - - - - - True - False - True - - - True - False - ubl-settings-diskquota - - - - - True - False - 32 - com.ublinux.ubl-settings-diskquota - 5 - - - - - diff --git a/ubl-settings-diskquota.pot b/ubl-settings-diskquota.pot index de55d1c..ed07b6f 100644 --- a/ubl-settings-diskquota.pot +++ b/ubl-settings-diskquota.pot @@ -17,48 +17,160 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#: source/ubl-strings.h:1 +msgid "Version:" +msgstr "" + +#: source/ubl-strings.h:2 +msgid "ubl-settings-diskquota version:" +msgstr "" + +#: source/ubl-strings.h:2 +msgid "TEMPLATE settings" +msgstr "Настройки TEMPLATE" + +#: source/ubl-strings.h:2 +msgid "Usage:" +msgstr "" + +#: source/ubl-strings.h:2 +msgid "[OPTIONS]" +msgstr "" + +#: source/ubl-strings.h:2 +msgid "Options:" +msgstr "" + +#: source/ubl-strings.h:2 +msgid "Show this help" +msgstr "" + +#: source/ubl-strings.h:2 +msgid "Show package version" +msgstr "" + +#: source/ubl-strings.h:2 +msgid "Lock this help menu" +msgstr "" + +#: source/ubl-strings.h:2 +#, fuzzy +msgid "Lock configuration saving" +msgstr "" + +#: source/ubl-strings.h:2 +msgid "Lock local configration saving" +msgstr "" + +#: source/ubl-strings.h:2 +msgid "Lock global configration saving" +msgstr "" + +#: source/ubl-strings.h:2 +msgid "Lock global configration loading" +msgstr "" + +#: source/ubl-strings.h:5 +msgid "System TEMPLATE settings management" +msgstr "" + +#: source/ubl-strings.h:7 +msgid "Operation succeeded" +msgstr "" + +#: source/ubl-strings.h:8 msgid "" -"You will be redirected to documentation website where documentation is\n" -"translated and supported by community." +"Warning! Application was launched without root - root-dependent actions are " +"locked." msgstr "" -msgid "ubl-settings-diskquota" +#: source/ubl-strings.h:10 +msgid "About" msgstr "" -msgid "Settings disk quotas - Addition" +#: source/ubl-strings.h:11 +msgid "Documentation" msgstr "" -msgid "Settings disk quotas - Editing" +#: source/ubl-strings.h:12 +msgid "Save to local configuration" msgstr "" -msgid "Edit" +#: source/ubl-strings.h:13 +msgid "Save to global configuration" msgstr "" -msgid "Project ID" +#: source/ubl-strings.h:14 +msgid "Save configuration" msgstr "" -msgid "Catalog" +#: source/ubl-strings.h:15 +msgid "Save" msgstr "" -msgid "Project Name" +#: source/ubl-strings.h:16 +msgid "Load local configuration" msgstr "" -msgid "Auto" +#: source/ubl-strings.h:17 +msgid "Load global configuration" msgstr "" -msgid "Review" +#: source/ubl-strings.h:18 +msgid "Load" msgstr "" -msgid "Generate" +#: source/ubl-strings.h:20 +msgid "Cancel" msgstr "" -msgid "User:" +#: source/ubl-strings.h:22 +msgid "Would you like to read documentation in the Web?" msgstr "" -msgid "Group:" +#: source/ubl-strings.h:23 +msgid "" +"You will be redirected to documentation website where documentation is\n" +"translated and supported by community." msgstr "" -msgid "Projects:" +#: source/ubl-strings.h:24 +msgid "Always redirect to online documentation" +msgstr "" + +#: source/ubl-strings.h:25 +msgid "Open documentation" +msgstr "" + +#: source/ubl-strings.h:26 +msgid "Project Home Page" +msgstr "" + +#: source/ubl-strings.h:27 +msgid "Nothing were chosen" +msgstr "" + +#: source/ubl-strings.h:30 +msgid "Global configuration loading succseeded." +msgstr "" + +#: source/ubl-strings.h:31 +msgid "Local configuration loading succseeded." +msgstr "" + +#: source/ubl-strings.h:33 +msgid "Local and global configuration saving succseeded." +msgstr "" + +#: source/ubl-strings.h:34 +msgid "Global configuration saving succseeded." +msgstr "" + +#: source/ubl-strings.h:35 +msgid "Local configuration saving succseeded." +msgstr "" + +msgid "Edit" msgstr "" msgid "Kb" @@ -73,652 +185,257 @@ msgstr "" msgid "Tb" msgstr "" -msgid "Quota use status:" +msgid "Disk quotas" msgstr "" -#: source/ubl-settings-diskquota.cc:224 source/ubl-settings-diskquota.cc:154 -#: source/ubl-settings-diskquota.cc:144 -msgid "About" +msgid "Configuring disk quota settings for system groups and users" msgstr "" -#: source/ubl-settings-diskquota.cc:183 source/ubl-settings-diskquota.cc:113 -#: source/ubl-settings-diskquota.cc:103 source/ubl-settings-diskquota.cc:124 -#: source/ubl-settings-diskquota.cc:121 source/ubl-settings-diskquota.cc:118 -msgid "Configuration of disk quotas parameters for system groups and users" +msgid "Device" msgstr "" -#: source/ubl-settings-diskquota.cc:138 source/ubl-settings-diskquota.cc:68 -#: source/ubl-settings-diskquota.cc:60 source/ubl-settings-diskquota.cc:81 -#: source/ubl-settings-diskquota.cc:78 source/ubl-settings-diskquota.cc:75 -#: source/ubl-settings-diskquota.cc:74 -msgid "Copyright © UBSoft LLC, 2022 - " +msgid "Device:" msgstr "" -#: source/ubl-settings-diskquota.cc:201 source/ubl-settings-diskquota.cc:206 -#: source/ubl-settings-diskquota.cc:211 source/ubl-settings-diskquota.cc:131 -#: source/ubl-settings-diskquota.cc:136 source/ubl-settings-diskquota.cc:141 -#: source/ubl-settings-diskquota.cc:121 source/ubl-settings-diskquota.cc:126 -#: source/ubl-settings-diskquota.cc:142 source/ubl-settings-diskquota.cc:147 -#: source/ubl-settings-diskquota.cc:152 source/ubl-settings-diskquota.cc:139 -#: source/ubl-settings-diskquota.cc:144 source/ubl-settings-diskquota.cc:149 -msgid "Currently using:" +msgid "Catalog" msgstr "" -#: source/ubl-settings-diskquota.cc:216 source/ubl-settings-diskquota.cc:146 -#: source/ubl-settings-diskquota.cc:136 source/ubl-settings-diskquota.cc:157 -#: source/ubl-settings-diskquota.cc:154 -msgid "Currently using: " +msgid "Catalog:" msgstr "" -#: source/ubl-settings-diskquota.cc:62 source/ubl-settings-diskquota.cc:83 -#: source/ubl-settings-diskquota.cc:80 source/ubl-settings-diskquota.cc:77 -#: source/ubl-settings-diskquota.cc:76 -msgid "Date and Time" +msgid "Project Name" msgstr "" -#: source/ubl-settings-diskquota.cc:246 source/ubl-settings-diskquota.cc:381 -msgid "" -"Deferring\n" -"a hard\n" -"limit\n" -"(files)" +msgid "Project Name:" msgstr "" -#: source/ubl-settings-diskquota.cc:239 source/ubl-settings-diskquota.cc:374 -msgid "" -"Deferring\n" -"a hard\n" -"limit\n" -"(size)" -msgstr "" - -#: source/ubl-settings-diskquota.cc:194 -msgid "Deferring a hard limit (files)" -msgstr "" - -#: source/ubl-settings-diskquota.cc:189 -msgid "Deferring a hard limit (size)" -msgstr "" - -#: source/ubl-settings-diskquota.cc:149 source/ubl-settings-diskquota.cc:181 -#: source/ubl-settings-diskquota.cc:182 source/ubl-settings-diskquota.cc:196 -#: source/ubl-settings-diskquota.cc:208 source/ubl-settings-diskquota.cc:79 -#: source/ubl-settings-diskquota.cc:111 source/ubl-settings-diskquota.cc:112 -#: source/ubl-settings-diskquota.cc:126 source/ubl-settings-diskquota.cc:138 -#: source/ubl-settings-diskquota.cc:69 source/ubl-settings-diskquota.cc:101 -#: source/ubl-settings-diskquota.cc:102 source/ubl-settings-diskquota.cc:116 -#: source/ubl-settings-diskquota.cc:128 source/ubl-settings-diskquota.cc:90 -#: source/ubl-settings-diskquota.cc:122 source/ubl-settings-diskquota.cc:123 -#: source/ubl-settings-diskquota.cc:137 source/ubl-settings-diskquota.cc:87 -#: source/ubl-settings-diskquota.cc:119 source/ubl-settings-diskquota.cc:120 -#: source/ubl-settings-diskquota.cc:134 source/ubl-settings-diskquota.cc:146 -#: source/ubl-settings-diskquota.cc:84 source/ubl-settings-diskquota.cc:117 -#: source/ubl-settings-diskquota.cc:83 -msgid "Device:" +msgid "Auto" msgstr "" -#: source/ubl-settings-diskquota.cc:197 source/ubl-settings-diskquota.cc:207 -#: source/ubl-settings-diskquota.cc:127 source/ubl-settings-diskquota.cc:137 -#: source/ubl-settings-diskquota.cc:117 source/ubl-settings-diskquota.cc:138 -#: source/ubl-settings-diskquota.cc:148 source/ubl-settings-diskquota.cc:135 -#: source/ubl-settings-diskquota.cc:145 -msgid "Disk quotas for this device:" +msgid "Review" msgstr "" -#: source/ubl-settings-diskquota.cc:152 source/ubl-settings-diskquota.cc:153 -#: source/ubl-settings-diskquota.cc:82 source/ubl-settings-diskquota.cc:83 -#: source/ubl-settings-diskquota.cc:72 source/ubl-settings-diskquota.cc:73 -#: source/ubl-settings-diskquota.cc:93 source/ubl-settings-diskquota.cc:94 -#: source/ubl-settings-diskquota.cc:90 source/ubl-settings-diskquota.cc:91 -#: source/ubl-settings-diskquota.cc:87 source/ubl-settings-diskquota.cc:88 -#: source/ubl-settings-diskquota.cc:86 -msgid "Enable" +msgid "Generate" msgstr "" -#: source/ubl-settings-diskquota.cc:597 source/ubl-settings-diskquota.cc:510 -#: source/ubl-settings-diskquota.cc:444 -msgid "Error saved local and global configuration" +msgid "User" msgstr "" -#: source/ubl-settings-diskquota.cc:156 source/ubl-settings-diskquota.cc:158 -#: source/ubl-settings-diskquota.cc:86 source/ubl-settings-diskquota.cc:88 -#: source/ubl-settings-diskquota.cc:76 source/ubl-settings-diskquota.cc:78 -#: source/ubl-settings-diskquota.cc:97 source/ubl-settings-diskquota.cc:99 -#: source/ubl-settings-diskquota.cc:94 source/ubl-settings-diskquota.cc:96 -#: source/ubl-settings-diskquota.cc:91 source/ubl-settings-diskquota.cc:93 -#: source/ubl-settings-diskquota.cc:90 source/ubl-settings-diskquota.cc:92 -msgid "Excess files delay period" -msgstr "" - -#: source/ubl-settings-diskquota.cc:155 source/ubl-settings-diskquota.cc:157 -#: source/ubl-settings-diskquota.cc:85 source/ubl-settings-diskquota.cc:87 -#: source/ubl-settings-diskquota.cc:75 source/ubl-settings-diskquota.cc:77 -#: source/ubl-settings-diskquota.cc:96 source/ubl-settings-diskquota.cc:98 -#: source/ubl-settings-diskquota.cc:93 source/ubl-settings-diskquota.cc:95 -#: source/ubl-settings-diskquota.cc:90 source/ubl-settings-diskquota.cc:92 -#: source/ubl-settings-diskquota.cc:89 source/ubl-settings-diskquota.cc:91 -msgid "Excess size delay period" -msgstr "" - -#: source/ubl-settings-diskquota.cc:150 source/ubl-settings-diskquota.cc:175 -#: source/ubl-settings-diskquota.cc:176 source/ubl-settings-diskquota.cc:214 -#: source/ubl-settings-diskquota.cc:221 source/ubl-settings-diskquota.cc:80 -#: source/ubl-settings-diskquota.cc:105 source/ubl-settings-diskquota.cc:106 -#: source/ubl-settings-diskquota.cc:144 source/ubl-settings-diskquota.cc:151 -#: source/ubl-settings-diskquota.cc:70 source/ubl-settings-diskquota.cc:95 -#: source/ubl-settings-diskquota.cc:96 source/ubl-settings-diskquota.cc:134 -#: source/ubl-settings-diskquota.cc:141 source/ubl-settings-diskquota.cc:91 -#: source/ubl-settings-diskquota.cc:116 source/ubl-settings-diskquota.cc:117 -#: source/ubl-settings-diskquota.cc:155 source/ubl-settings-diskquota.cc:162 -#: source/ubl-settings-diskquota.cc:88 source/ubl-settings-diskquota.cc:113 -#: source/ubl-settings-diskquota.cc:114 source/ubl-settings-diskquota.cc:152 -#: source/ubl-settings-diskquota.cc:85 source/ubl-settings-diskquota.cc:110 -#: source/ubl-settings-diskquota.cc:111 source/ubl-settings-diskquota.cc:84 -msgid "File system:" +msgid "Group" msgstr "" -#: source/ubl-settings-diskquota.cc:191 source/ubl-settings-diskquota.cc:200 -#: source/ubl-settings-diskquota.cc:215 source/ubl-settings-diskquota.cc:243 -#: source/ubl-settings-diskquota.cc:121 source/ubl-settings-diskquota.cc:130 -#: source/ubl-settings-diskquota.cc:145 source/ubl-settings-diskquota.cc:378 -#: source/ubl-settings-diskquota.cc:111 source/ubl-settings-diskquota.cc:120 -#: source/ubl-settings-diskquota.cc:135 source/ubl-settings-diskquota.cc:321 -#: source/ubl-settings-diskquota.cc:132 source/ubl-settings-diskquota.cc:141 -#: source/ubl-settings-diskquota.cc:156 source/ubl-settings-diskquota.cc:325 -#: source/ubl-settings-diskquota.cc:129 source/ubl-settings-diskquota.cc:138 -#: source/ubl-settings-diskquota.cc:153 source/ubl-settings-diskquota.cc:317 -#: source/ubl-settings-diskquota.cc:264 source/ubl-settings-diskquota.cc:126 -msgid "Files" +msgid "User:" msgstr "" -#: source/ubl-settings-diskquota.cc:177 source/ubl-settings-diskquota.cc:178 -#: source/ubl-settings-diskquota.cc:107 source/ubl-settings-diskquota.cc:108 -#: source/ubl-settings-diskquota.cc:97 source/ubl-settings-diskquota.cc:98 -#: source/ubl-settings-diskquota.cc:118 source/ubl-settings-diskquota.cc:119 -#: source/ubl-settings-diskquota.cc:115 source/ubl-settings-diskquota.cc:116 -#: source/ubl-settings-diskquota.cc:112 source/ubl-settings-diskquota.cc:113 -msgid "Filters" +msgid "Users:" msgstr "" -msgid "" -"GTK settings quotas. for UBLinux\n" -"\n" -"Usage: ubl-settings-diskquota [OPTIONS...]\n" -"Options:\n" -" -h, --help\t Show this help\n" -" -V, --version\t Show package version\n" +msgid "Users" msgstr "" -#: source/ubl-settings-diskquota.cc:144 source/ubl-settings-diskquota.cc:74 -#: source/ubl-settings-diskquota.cc:66 source/ubl-settings-diskquota.cc:87 -#: source/ubl-settings-diskquota.cc:84 source/ubl-settings-diskquota.cc:81 -#: source/ubl-settings-diskquota.cc:80 -msgid "General settings" +msgid "Group:" msgstr "" -#: source/ubl-settings-diskquota.cc:611 source/ubl-settings-diskquota.cc:524 -#: source/ubl-settings-diskquota.cc:458 -msgid "Global configuration downloaded successfully" +msgid "Groups:" msgstr "" -#: source/ubl-settings-diskquota.cc:585 source/ubl-settings-diskquota.cc:498 -#: source/ubl-settings-diskquota.cc:432 -msgid "Global configuration read error" +msgid "Groups" msgstr "" -#: source/ubl-settings-diskquota.cc:617 source/ubl-settings-diskquota.cc:530 -#: source/ubl-settings-diskquota.cc:464 -msgid "Global configuration successfully written" +msgid "Projects:" msgstr "" -#: source/ubl-settings-diskquota.cc:593 source/ubl-settings-diskquota.cc:506 -#: source/ubl-settings-diskquota.cc:440 -msgid "Global configuration write error" +msgid "Quota type" msgstr "" -#: source/ubl-settings-diskquota.cc:198 source/ubl-settings-diskquota.cc:128 -#: source/ubl-settings-diskquota.cc:118 source/ubl-settings-diskquota.cc:139 -#: source/ubl-settings-diskquota.cc:136 -msgid "Group quotas for this device:" +msgid "Status" msgstr "" -#: source/ubl-settings-diskquota.cc:145 source/ubl-settings-diskquota.cc:75 -#: source/ubl-settings-diskquota.cc:67 source/ubl-settings-diskquota.cc:88 -#: source/ubl-settings-diskquota.cc:85 source/ubl-settings-diskquota.cc:82 -#: source/ubl-settings-diskquota.cc:81 -msgid "Groups" +msgid "Projects" msgstr "" -#: source/ubl-settings-diskquota.cc:203 source/ubl-settings-diskquota.cc:204 -#: source/ubl-settings-diskquota.cc:213 source/ubl-settings-diskquota.cc:218 -#: source/ubl-settings-diskquota.cc:133 source/ubl-settings-diskquota.cc:134 -#: source/ubl-settings-diskquota.cc:143 source/ubl-settings-diskquota.cc:148 -#: source/ubl-settings-diskquota.cc:123 source/ubl-settings-diskquota.cc:124 -#: source/ubl-settings-diskquota.cc:138 source/ubl-settings-diskquota.cc:144 -#: source/ubl-settings-diskquota.cc:145 source/ubl-settings-diskquota.cc:154 -#: source/ubl-settings-diskquota.cc:159 source/ubl-settings-diskquota.cc:141 -#: source/ubl-settings-diskquota.cc:142 source/ubl-settings-diskquota.cc:151 -#: source/ubl-settings-diskquota.cc:156 -msgid "Hard limit" +msgid "Error saved local and global configuration" msgstr "" -#: source/ubl-settings-diskquota.cc:320 source/ubl-settings-diskquota.cc:324 -#: source/ubl-settings-diskquota.cc:316 source/ubl-settings-diskquota.cc:263 -msgid "" -"Hard limit\n" -"(Size) activation\n" -"time" +msgid "The delay period for exceeding files:" msgstr "" -#: source/ubl-settings-diskquota.cc:323 source/ubl-settings-diskquota.cc:327 -#: source/ubl-settings-diskquota.cc:319 source/ubl-settings-diskquota.cc:266 -msgid "" -"Hard limit\n" -"(files)" +msgid "The postponement period for exceeding the volume:" msgstr "" -#: source/ubl-settings-diskquota.cc:325 source/ubl-settings-diskquota.cc:329 -#: source/ubl-settings-diskquota.cc:321 source/ubl-settings-diskquota.cc:268 -msgid "" -"Hard limit\n" -"(files) activation\n" -"time" +msgid "File system:" msgstr "" -#: source/ubl-settings-diskquota.cc:324 source/ubl-settings-diskquota.cc:328 -#: source/ubl-settings-diskquota.cc:320 source/ubl-settings-diskquota.cc:267 -msgid "" -"Hard limit\n" -"(files) delay" +msgid "Files" msgstr "" -#: source/ubl-settings-diskquota.cc:318 source/ubl-settings-diskquota.cc:322 -#: source/ubl-settings-diskquota.cc:314 source/ubl-settings-diskquota.cc:261 -msgid "" -"Hard limit\n" -"(size)" +msgid "Filters" msgstr "" -#: source/ubl-settings-diskquota.cc:319 source/ubl-settings-diskquota.cc:323 -#: source/ubl-settings-diskquota.cc:315 source/ubl-settings-diskquota.cc:262 -msgid "" -"Hard limit\n" -"(size) delay" +msgid "minutes" msgstr "" -#: source/ubl-settings-diskquota.cc:247 source/ubl-settings-diskquota.cc:382 -msgid "" -"Hard limit\n" -"activation\n" -"time (files)" +msgid "name" msgstr "" -#: source/ubl-settings-diskquota.cc:240 source/ubl-settings-diskquota.cc:375 -msgid "" -"Hard limit\n" -"activation\n" -"time (size)" +msgid "days" msgstr "" -#: source/ubl-settings-diskquota.cc:195 source/ubl-settings-diskquota.cc:125 -#: source/ubl-settings-diskquota.cc:115 source/ubl-settings-diskquota.cc:136 -#: source/ubl-settings-diskquota.cc:133 source/ubl-settings-diskquota.cc:130 -msgid "Hard limit (file) activation time" +msgid "files" msgstr "" -#: source/ubl-settings-diskquota.cc:123 source/ubl-settings-diskquota.cc:113 -#: source/ubl-settings-diskquota.cc:134 source/ubl-settings-diskquota.cc:131 -#: source/ubl-settings-diskquota.cc:128 -msgid "Hard limit (files)" +msgid "hours" msgstr "" -#: source/ubl-settings-diskquota.cc:124 source/ubl-settings-diskquota.cc:114 -#: source/ubl-settings-diskquota.cc:135 source/ubl-settings-diskquota.cc:132 -#: source/ubl-settings-diskquota.cc:129 -msgid "Hard limit (files) delay" +msgid "w " msgstr "" -#: source/ubl-settings-diskquota.cc:188 source/ubl-settings-diskquota.cc:118 -#: source/ubl-settings-diskquota.cc:108 source/ubl-settings-diskquota.cc:129 -#: source/ubl-settings-diskquota.cc:126 source/ubl-settings-diskquota.cc:123 -msgid "Hard limit (size)" +msgid "d " msgstr "" -#: source/ubl-settings-diskquota.cc:120 source/ubl-settings-diskquota.cc:110 -#: source/ubl-settings-diskquota.cc:131 source/ubl-settings-diskquota.cc:128 -#: source/ubl-settings-diskquota.cc:125 -msgid "Hard limit (size) activation time" +msgid "h " msgstr "" -#: source/ubl-settings-diskquota.cc:119 source/ubl-settings-diskquota.cc:109 -#: source/ubl-settings-diskquota.cc:130 source/ubl-settings-diskquota.cc:127 -#: source/ubl-settings-diskquota.cc:124 -msgid "Hard limit (size) delay" +msgid "m " msgstr "" -#: source/ubl-settings-diskquota.cc:190 -msgid "Hard limit activation time (size)" +msgid "weeks" msgstr "" -#: source/ubl-settings-diskquota.cc:225 source/ubl-settings-diskquota.cc:155 -#: source/ubl-settings-diskquota.cc:145 -msgid "Help" +msgid "General statistics" msgstr "" -#: source/ubl-settings-diskquota.cc:179 source/ubl-settings-diskquota.cc:109 -#: source/ubl-settings-diskquota.cc:99 source/ubl-settings-diskquota.cc:120 -#: source/ubl-settings-diskquota.cc:117 source/ubl-settings-diskquota.cc:114 -msgid "Load" +msgid "https://wiki.ublinux.com" msgstr "" -#: source/ubl-settings-diskquota.cc:222 source/ubl-settings-diskquota.cc:152 -#: source/ubl-settings-diskquota.cc:142 -msgid "Load global configuration" +msgid "Off" msgstr "" -msgid "Direct control of the file system" +msgid "Not set" msgstr "" -#: source/ubl-settings-diskquota.cc:223 source/ubl-settings-diskquota.cc:153 -#: source/ubl-settings-diskquota.cc:143 -msgid "Load local configuration" +msgid "Name" msgstr "" -#: source/ubl-settings-diskquota.cc:608 source/ubl-settings-diskquota.cc:521 -#: source/ubl-settings-diskquota.cc:455 -msgid "Local configuration downloaded successfully" +msgid "Nothing to save!" msgstr "" -#: source/ubl-settings-diskquota.cc:581 source/ubl-settings-diskquota.cc:494 -#: source/ubl-settings-diskquota.cc:428 -msgid "Local configuration reading error" +msgid "Project ID" msgstr "" -#: source/ubl-settings-diskquota.cc:614 source/ubl-settings-diskquota.cc:527 -#: source/ubl-settings-diskquota.cc:461 -msgid "Local configuration successfully written" +msgid "Project ID:" msgstr "" -#: source/ubl-settings-diskquota.cc:589 source/ubl-settings-diskquota.cc:502 -#: source/ubl-settings-diskquota.cc:436 -msgid "Local configuration write error" +msgid "Settings disk quotas - Addition" msgstr "" -#: source/ubl-settings-diskquota.cc:184 source/ubl-settings-diskquota.cc:234 -#: source/ubl-settings-diskquota.cc:114 source/ubl-settings-diskquota.cc:369 -#: source/ubl-settings-diskquota.cc:104 source/ubl-settings-diskquota.cc:314 -#: source/ubl-settings-diskquota.cc:125 source/ubl-settings-diskquota.cc:318 -#: source/ubl-settings-diskquota.cc:122 source/ubl-settings-diskquota.cc:310 -#: source/ubl-settings-diskquota.cc:119 -msgid "Name" +msgid "Settings disk quotas - Editing" msgstr "" -#: source/ubl-settings-diskquota.cc:623 source/ubl-settings-diskquota.cc:536 -#: source/ubl-settings-diskquota.cc:470 -msgid "Nothing to save!" +msgid "Quota use status:" msgstr "" -#: source/ubl-settings-diskquota.cc:143 source/ubl-settings-diskquota.cc:73 -#: source/ubl-settings-diskquota.cc:65 source/ubl-settings-diskquota.cc:86 -#: source/ubl-settings-diskquota.cc:83 source/ubl-settings-diskquota.cc:80 -#: source/ubl-settings-diskquota.cc:79 -msgid "Project Home Page" +msgid "Size" msgstr "" -#: source/ubl-settings-diskquota.cc:185 source/ubl-settings-diskquota.cc:235 -#: source/ubl-settings-diskquota.cc:115 source/ubl-settings-diskquota.cc:370 -#: source/ubl-settings-diskquota.cc:105 source/ubl-settings-diskquota.cc:315 -#: source/ubl-settings-diskquota.cc:126 source/ubl-settings-diskquota.cc:319 -#: source/ubl-settings-diskquota.cc:123 source/ubl-settings-diskquota.cc:311 -#: source/ubl-settings-diskquota.cc:258 source/ubl-settings-diskquota.cc:120 msgid "Quotas" msgstr "" -#: source/ubl-settings-diskquota.cc:151 source/ubl-settings-diskquota.cc:81 -#: source/ubl-settings-diskquota.cc:71 -msgid "Quotas for groups" +msgid "Mount\npoint" msgstr "" -#: source/ubl-settings-diskquota.cc:154 source/ubl-settings-diskquota.cc:84 -#: source/ubl-settings-diskquota.cc:74 -msgid "Quotas for users" +msgid "FS" msgstr "" -#: source/ubl-settings-diskquota.cc:180 source/ubl-settings-diskquota.cc:110 -#: source/ubl-settings-diskquota.cc:100 source/ubl-settings-diskquota.cc:121 -#: source/ubl-settings-diskquota.cc:118 source/ubl-settings-diskquota.cc:115 -msgid "Save" +msgid "The postponement period\nfor exceeding the volume" msgstr "" -#: source/ubl-settings-diskquota.cc:226 source/ubl-settings-diskquota.cc:156 -#: source/ubl-settings-diskquota.cc:146 -msgid "Save in global and local configuration" +msgid "The delay period\nfor exceeding files" msgstr "" -#: source/ubl-settings-diskquota.cc:227 source/ubl-settings-diskquota.cc:157 -#: source/ubl-settings-diskquota.cc:147 -msgid "Save in global configuration" +msgid "Soft\nrestriction\n(volume)" msgstr "" -#: source/ubl-settings-diskquota.cc:228 source/ubl-settings-diskquota.cc:158 -#: source/ubl-settings-diskquota.cc:148 -msgid "Save in local configuration" +msgid "Hard\nlimit\n(volume)" msgstr "" -#: source/ubl-settings-diskquota.cc:140 source/ubl-settings-diskquota.cc:70 -msgid "Setting user quotas" +msgid "Postponing\nthe\nhard\nlimit\n(volume)" msgstr "" -#: source/ubl-settings-diskquota.cc:245 source/ubl-settings-diskquota.cc:380 -msgid "" -"Severe\n" -"limitation\n" -"(files)" +msgid "Soft\nrestriction\n(files)" msgstr "" -#: source/ubl-settings-diskquota.cc:238 source/ubl-settings-diskquota.cc:373 -msgid "" -"Severe\n" -"limitation\n" -"(size)" -msgstr "" - -#: source/ubl-settings-diskquota.cc:193 -msgid "Severe limitation (files)" -msgstr "" - -#: source/ubl-settings-diskquota.cc:186 source/ubl-settings-diskquota.cc:199 -#: source/ubl-settings-diskquota.cc:210 source/ubl-settings-diskquota.cc:236 -#: source/ubl-settings-diskquota.cc:116 source/ubl-settings-diskquota.cc:129 -#: source/ubl-settings-diskquota.cc:140 source/ubl-settings-diskquota.cc:371 -#: source/ubl-settings-diskquota.cc:106 source/ubl-settings-diskquota.cc:119 -#: source/ubl-settings-diskquota.cc:130 source/ubl-settings-diskquota.cc:316 -#: source/ubl-settings-diskquota.cc:127 source/ubl-settings-diskquota.cc:151 -#: source/ubl-settings-diskquota.cc:320 source/ubl-settings-diskquota.cc:124 -#: source/ubl-settings-diskquota.cc:137 source/ubl-settings-diskquota.cc:148 -#: source/ubl-settings-diskquota.cc:312 source/ubl-settings-diskquota.cc:259 -#: source/ubl-settings-diskquota.cc:121 -msgid "Size" +msgid "Hard\nlimit\n(files)" msgstr "" -#: source/ubl-settings-diskquota.cc:244 source/ubl-settings-diskquota.cc:379 -msgid "" -"Soft\n" -"Restriction\n" -"(files)" +msgid "Postponing\nthe\nhard\nlimit\n(files)" msgstr "" -#: source/ubl-settings-diskquota.cc:192 -msgid "Soft Restriction (files)" +msgid "Device/\nProject" msgstr "" -#: source/ubl-settings-diskquota.cc:202 source/ubl-settings-diskquota.cc:205 -#: source/ubl-settings-diskquota.cc:212 source/ubl-settings-diskquota.cc:217 -#: source/ubl-settings-diskquota.cc:132 source/ubl-settings-diskquota.cc:135 -#: source/ubl-settings-diskquota.cc:142 source/ubl-settings-diskquota.cc:147 -#: source/ubl-settings-diskquota.cc:122 source/ubl-settings-diskquota.cc:125 -#: source/ubl-settings-diskquota.cc:137 source/ubl-settings-diskquota.cc:143 -#: source/ubl-settings-diskquota.cc:146 source/ubl-settings-diskquota.cc:153 -#: source/ubl-settings-diskquota.cc:158 source/ubl-settings-diskquota.cc:140 -#: source/ubl-settings-diskquota.cc:150 source/ubl-settings-diskquota.cc:155 msgid "Soft limit" msgstr "" -#: source/ubl-settings-diskquota.cc:322 source/ubl-settings-diskquota.cc:326 -#: source/ubl-settings-diskquota.cc:318 source/ubl-settings-diskquota.cc:265 -msgid "" -"Soft limit\n" -"(files)" +msgid "Hard limit" msgstr "" -#: source/ubl-settings-diskquota.cc:237 source/ubl-settings-diskquota.cc:372 -#: source/ubl-settings-diskquota.cc:317 source/ubl-settings-diskquota.cc:321 -#: source/ubl-settings-diskquota.cc:313 source/ubl-settings-diskquota.cc:260 -msgid "" -"Soft limit\n" -"(size)" +msgid "Soft limit (volume)" msgstr "" -#: source/ubl-settings-diskquota.cc:122 source/ubl-settings-diskquota.cc:112 -#: source/ubl-settings-diskquota.cc:133 source/ubl-settings-diskquota.cc:130 -#: source/ubl-settings-diskquota.cc:127 -msgid "Soft limit (files)" +msgid "Hard limit (volume)" msgstr "" -#: source/ubl-settings-diskquota.cc:187 source/ubl-settings-diskquota.cc:117 -#: source/ubl-settings-diskquota.cc:107 source/ubl-settings-diskquota.cc:128 -#: source/ubl-settings-diskquota.cc:125 source/ubl-settings-diskquota.cc:122 -msgid "Soft limit (size)" +msgid "Postponing the hard limit (volume)" msgstr "" -#: source/ubl-settings-diskquota.cc:620 source/ubl-settings-diskquota.cc:533 -#: source/ubl-settings-diskquota.cc:467 -msgid "Successfully saved local and global configuration" +msgid "Soft limit (files)" msgstr "" -#: source/ubl-settings-diskquota.cc:59 source/ubl-settings-diskquota.cc:55 -#: source/ubl-settings-diskquota.cc:47 source/ubl-settings-diskquota.cc:68 -#: source/ubl-settings-diskquota.cc:70 source/ubl-settings-diskquota.cc:67 -#: source/ubl-settings-diskquota.cc:66 -msgid "The program must be run as root" +msgid "Hard limit (files)" msgstr "" -#: source/ubl-settings-diskquota.cc:209 source/ubl-settings-diskquota.cc:139 -#: source/ubl-settings-diskquota.cc:129 source/ubl-settings-diskquota.cc:150 -#: source/ubl-settings-diskquota.cc:147 -msgid "User quotas for this device: " +msgid "Postponing the hard limit (files)" msgstr "" -#: source/ubl-settings-diskquota.cc:148 source/ubl-settings-diskquota.cc:78 -#: source/ubl-settings-diskquota.cc:68 source/ubl-settings-diskquota.cc:89 -#: source/ubl-settings-diskquota.cc:86 source/ubl-settings-diskquota.cc:83 -#: source/ubl-settings-diskquota.cc:82 -msgid "Users" +msgid "On" msgstr "" -#: source/ubl-settings-diskquota.cc:163 source/ubl-settings-diskquota.cc:164 -#: source/ubl-settings-diskquota.cc:165 source/ubl-settings-diskquota.cc:166 -#: source/ubl-settings-diskquota.cc:93 source/ubl-settings-diskquota.cc:94 -#: source/ubl-settings-diskquota.cc:95 source/ubl-settings-diskquota.cc:96 -#: source/ubl-settings-diskquota.cc:83 source/ubl-settings-diskquota.cc:84 -#: source/ubl-settings-diskquota.cc:85 source/ubl-settings-diskquota.cc:86 -#: source/ubl-settings-diskquota.cc:104 source/ubl-settings-diskquota.cc:105 -#: source/ubl-settings-diskquota.cc:106 source/ubl-settings-diskquota.cc:107 -#: source/ubl-settings-diskquota.cc:101 source/ubl-settings-diskquota.cc:102 -#: source/ubl-settings-diskquota.cc:103 source/ubl-settings-diskquota.cc:98 -#: source/ubl-settings-diskquota.cc:99 source/ubl-settings-diskquota.cc:100 -#: source/ubl-settings-diskquota.cc:97 -msgid "days" +msgid "Please select folder" msgstr "" -#: source/ubl-settings-diskquota.cc:219 source/ubl-settings-diskquota.cc:220 -#: source/ubl-settings-diskquota.cc:149 source/ubl-settings-diskquota.cc:150 -#: source/ubl-settings-diskquota.cc:139 source/ubl-settings-diskquota.cc:140 -#: source/ubl-settings-diskquota.cc:160 source/ubl-settings-diskquota.cc:161 -#: source/ubl-settings-diskquota.cc:157 source/ubl-settings-diskquota.cc:158 -msgid "files" +msgid "Warning" msgstr "" -msgid "Configuring disk quota settings for system groups and users" +msgid "The selected directory is not located on the target device" msgstr "" -#: source/ubl-settings-diskquota.cc:167 source/ubl-settings-diskquota.cc:168 -#: source/ubl-settings-diskquota.cc:169 source/ubl-settings-diskquota.cc:170 -#: source/ubl-settings-diskquota.cc:97 source/ubl-settings-diskquota.cc:98 -#: source/ubl-settings-diskquota.cc:99 source/ubl-settings-diskquota.cc:100 -#: source/ubl-settings-diskquota.cc:87 source/ubl-settings-diskquota.cc:88 -#: source/ubl-settings-diskquota.cc:89 source/ubl-settings-diskquota.cc:90 -#: source/ubl-settings-diskquota.cc:108 source/ubl-settings-diskquota.cc:109 -#: source/ubl-settings-diskquota.cc:110 source/ubl-settings-diskquota.cc:111 -#: source/ubl-settings-diskquota.cc:105 source/ubl-settings-diskquota.cc:106 -#: source/ubl-settings-diskquota.cc:107 source/ubl-settings-diskquota.cc:102 -#: source/ubl-settings-diskquota.cc:103 source/ubl-settings-diskquota.cc:104 -#: source/ubl-settings-diskquota.cc:101 -msgid "hours" +msgid "Withdraw all users" msgstr "" -#: source/ubl-settings-diskquota.cc:141 source/ubl-settings-diskquota.cc:71 -#: source/ubl-settings-diskquota.cc:63 source/ubl-settings-diskquota.cc:84 -#: source/ubl-settings-diskquota.cc:81 source/ubl-settings-diskquota.cc:78 -#: source/ubl-settings-diskquota.cc:77 -msgid "https://wiki.ublinux.com" +msgid "Withdraw all groups" msgstr "" -#: source/ubl-settings-diskquota.cc:548 source/ubl-settings-diskquota.cc:461 -msgid "" -"https://wiki.ublinux.com/ru/Программное_обеспечение/Программы_и_утилиты/Все/" -msgstr "" - -#: source/ubl-settings-diskquota.cc:171 source/ubl-settings-diskquota.cc:172 -#: source/ubl-settings-diskquota.cc:173 source/ubl-settings-diskquota.cc:174 -#: source/ubl-settings-diskquota.cc:101 source/ubl-settings-diskquota.cc:102 -#: source/ubl-settings-diskquota.cc:103 source/ubl-settings-diskquota.cc:104 -#: source/ubl-settings-diskquota.cc:91 source/ubl-settings-diskquota.cc:92 -#: source/ubl-settings-diskquota.cc:93 source/ubl-settings-diskquota.cc:94 -#: source/ubl-settings-diskquota.cc:112 source/ubl-settings-diskquota.cc:113 -#: source/ubl-settings-diskquota.cc:114 source/ubl-settings-diskquota.cc:115 -#: source/ubl-settings-diskquota.cc:109 source/ubl-settings-diskquota.cc:110 -#: source/ubl-settings-diskquota.cc:111 source/ubl-settings-diskquota.cc:106 -#: source/ubl-settings-diskquota.cc:107 source/ubl-settings-diskquota.cc:108 -#: source/ubl-settings-diskquota.cc:105 -msgid "minutes" +msgid "The list of users is empty" msgstr "" -#: source/ubl-settings-diskquota.cc:257 -msgid "name" +msgid "Project name required field" msgstr "" -#: source/ubl-settings-diskquota.cc:92 source/ubl-settings-diskquota.cc:89 -#: source/ubl-settings-diskquota.cc:86 source/ubl-settings-diskquota.cc:85 -msgid "quotas for groups" +msgid "Project ID mandatory field" msgstr "" -#: source/ubl-settings-diskquota.cc:95 source/ubl-settings-diskquota.cc:92 -#: source/ubl-settings-diskquota.cc:89 source/ubl-settings-diskquota.cc:88 -msgid "quotas for users" +msgid "The volume and files fields must have at least one value" msgstr "" -#: source/ubl-settings-diskquota.cc:629 source/ubl-settings-diskquota.cc:542 -#: source/ubl-settings-diskquota.cc:476 source/ubl-settings-diskquota.cc:350 -#: source/ubl-settings-diskquota.cc:371 source/ubl-settings-diskquota.cc:318 -#: source/ubl-settings-diskquota.cc:267 source/ubl-settings-diskquota.cc:213 -msgid "ubl-settings-diskquota version: " +msgid "The path does not match the specified disk" msgstr "" -#: source/ubl-settings-diskquota.cc:159 source/ubl-settings-diskquota.cc:160 -#: source/ubl-settings-diskquota.cc:161 source/ubl-settings-diskquota.cc:162 -#: source/ubl-settings-diskquota.cc:89 source/ubl-settings-diskquota.cc:90 -#: source/ubl-settings-diskquota.cc:91 source/ubl-settings-diskquota.cc:92 -#: source/ubl-settings-diskquota.cc:79 source/ubl-settings-diskquota.cc:80 -#: source/ubl-settings-diskquota.cc:81 source/ubl-settings-diskquota.cc:82 -#: source/ubl-settings-diskquota.cc:100 source/ubl-settings-diskquota.cc:101 -#: source/ubl-settings-diskquota.cc:102 source/ubl-settings-diskquota.cc:103 -#: source/ubl-settings-diskquota.cc:97 source/ubl-settings-diskquota.cc:98 -#: source/ubl-settings-diskquota.cc:99 source/ubl-settings-diskquota.cc:94 -#: source/ubl-settings-diskquota.cc:95 source/ubl-settings-diskquota.cc:96 -#: source/ubl-settings-diskquota.cc:93 -msgid "weeks" +msgid "Project name mandatory field" msgstr "" -msgid "General statistics" +msgid "Project" +msgstr "" + +msgid "Is not a directory" msgstr "" \ No newline at end of file diff --git a/ubl-settings-diskquota_ru.po b/ubl-settings-diskquota_ru.po index fdf80b6..1d56a7a 100644 --- a/ubl-settings-diskquota_ru.po +++ b/ubl-settings-diskquota_ru.po @@ -4,183 +4,213 @@ # UBLinux Team , 2022 # #, fuzzy -msgid "test" +msgid "" msgstr "" -"Project-Id-Version: ublexec 1.0\n" +"Project-Id-Version: ubl-settings-diskquota 1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-04-10 16:09+0000\n" +"POT-Creation-Date: 2023-05-22 16:12+0600\n" "PO-Revision-Date: 2023-01-01 00:00+0600\n" "Last-Translator: UBLinux Team \n" "Language-Team: Russian - UBLinux Team \n" "Language: Russian\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit" +"Content-Transfer-Encoding: 8bit\n" -msgid "ubl-settings-diskquota" -msgstr "Дисковые квоты" +#: source/ubl-strings.h:1 +msgid "Version:" +msgstr "Версия:" -msgid "Settings disk quotas - Addition" -msgstr "Настройка дисковых квот - Добавление" +#: source/ubl-strings.h:2 +msgid "ubl-settings-diskquota version:" +msgstr "Версия ubl-settings-diskquota: " -msgid "Settings disk quotas - Editing" -msgstr "Настройка дисковых квот - Редактирование" +#: source/ubl-strings.h:2 +msgid "TEMPLATE settings" +msgstr "Настройки TEMPLATE" -msgid "Edit" -msgstr "Редактировать" +#: source/ubl-strings.h:2 +msgid "Usage:" +msgstr "Использование:" -msgid "Kb" -msgstr "Кб" +#: source/ubl-strings.h:2 +msgid "[OPTIONS]" +msgstr "[АРГУМЕНТЫ]" -msgid "Mb" -msgstr "Мб" +#: source/ubl-strings.h:2 +msgid "Options:" +msgstr "Аргументы:" -msgid "Gb" -msgstr "Гб" +#: source/ubl-strings.h:2 +msgid "Show this help" +msgstr "Показать параметры справки" -msgid "Tb" -msgstr "Тб" +#: source/ubl-strings.h:2 +msgid "Show package version" +msgstr "Показать текущую версию" -msgid "Quota use status:" -msgstr "Статус использования квот:" +#: source/ubl-strings.h:2 +msgid "Lock this help menu" +msgstr "Блокировка вызова справки" + +#: source/ubl-strings.h:2 +#, fuzzy +msgid "Lock configuration saving" +msgstr "Блокировка сохранения локальной и глобальной конфигурации" + +#: source/ubl-strings.h:2 +msgid "Lock local configration saving" +msgstr "Блокировка сохранения локальной конфигурации" + +#: source/ubl-strings.h:2 +msgid "Lock global configration saving" +msgstr "Блокировка сохранения глобальной конфигурации" + +#: source/ubl-strings.h:2 +msgid "Lock global configration loading" +msgstr "Блокировка загрузки глобальной конфигурации" + +#: source/ubl-strings.h:5 +msgid "System TEMPLATE settings management" +msgstr "Настройки TEMPLATE" + +#: source/ubl-strings.h:7 +msgid "Operation succeeded" +msgstr "Операция завершена" + +#: source/ubl-strings.h:8 +msgid "" +"Warning! Application was launched without root - root-dependent actions are " +"locked." +msgstr "Внимание! Приложение было запущено без прав суперпользователя - действия, требующие их наличия заблокированы." + +#: source/ubl-strings.h:10 +msgid "About" +msgstr "О программе" +#: source/ubl-strings.h:11 +msgid "Documentation" +msgstr "Справка" + +#: source/ubl-strings.h:12 +msgid "Save to local configuration" +msgstr "Сохранить в локальную конфигурацию" + +#: source/ubl-strings.h:13 +msgid "Save to global configuration" +msgstr "Сохранить в глобальную конфигурацию" + +#: source/ubl-strings.h:14 +msgid "Save configuration" +msgstr "Сохранить конфигурацию" + +#: source/ubl-strings.h:15 +msgid "Save" +msgstr "Сохранить" + +#: source/ubl-strings.h:16 +msgid "Load local configuration" +msgstr "Загрузить локальную конфигурацию" + +#: source/ubl-strings.h:17 +msgid "Load global configuration" +msgstr "Загрузить глобальную конфигурацию" + +#: source/ubl-strings.h:18 +msgid "Load" +msgstr "Загрузить" + +#: source/ubl-strings.h:20 +msgid "Cancel" +msgstr "Отмена" + +#: source/ubl-strings.h:22 msgid "Would you like to read documentation in the Web?" msgstr "Вы хотите прочитать справку в Сети?" +#: source/ubl-strings.h:23 msgid "" "You will be redirected to documentation website where documentation is\n" "translated and supported by community." msgstr "" -"Вы будете перенаправлены на сайт с документацией где страницы помощи\n" +"Вы будете перенаправлены на сайт с документацией, где страницы помощи\n" "переводятся и поддерживаются сообществом." -msgid "Cancel" -msgstr "Отменить" - -msgid "Always redirect" +#: source/ubl-strings.h:24 +msgid "Always redirect to online documentation" msgstr "Всегда перенаправлять" -msgid "Read online" -msgstr "Прочитать онлайн" +#: source/ubl-strings.h:25 +msgid "Open documentation" +msgstr "Прочитать справку" -#: source/ubl-settings-quotas.cc:224 source/ubl-settings-quotas.cc:154 -#: source/ubl-settings-quotas.cc:144 -msgid "About" -msgstr "О программе" +#: source/ubl-strings.h:26 +msgid "Project Home Page" +msgstr "Домашняя страница проекта" -msgid "Projects" -msgstr "Проекты" +#: source/ubl-strings.h:27 +msgid "Nothing were chosen" +msgstr "Ничего не было выбрано" -#: source/ubl-settings-quotas.cc:183 source/ubl-settings-quotas.cc:113 -#: source/ubl-settings-quotas.cc:103 source/ubl-settings-quotas.cc:124 -#: source/ubl-settings-quotas.cc:121 source/ubl-settings-quotas.cc:118 -msgid "Configuration of disk quotas parameters for system groups and users" -msgstr "Настройка параметров дисковых квот для системных групп и пользователей" +#: source/ubl-strings.h:30 +msgid "Global configuration loading succseeded." +msgstr "Успешно загружена глобальная конфигурация" -msgid "Configuring disk quota settings for system groups and users" -msgstr "Настройка параметров дисковых квот для системных групп и пользователей системы" +#: source/ubl-strings.h:31 +msgid "Local configuration loading succseeded." +msgstr "Успешно загружена локальная конфигурация" -#: source/ubl-settings-quotas.cc:138 source/ubl-settings-quotas.cc:68 -#: source/ubl-settings-quotas.cc:60 source/ubl-settings-quotas.cc:81 -#: source/ubl-settings-quotas.cc:78 source/ubl-settings-quotas.cc:75 -#: source/ubl-settings-quotas.cc:74 -msgid "Copyright © UBSoft LLC, 2022 - " -msgstr "" +#: source/ubl-strings.h:33 +msgid "Local and global configuration saving succseeded." +msgstr "Успешно записаны локальная и глобальная конфигурация" -#: source/ubl-settings-quotas.cc:201 source/ubl-settings-quotas.cc:206 -#: source/ubl-settings-quotas.cc:211 source/ubl-settings-quotas.cc:131 -#: source/ubl-settings-quotas.cc:136 source/ubl-settings-quotas.cc:141 -#: source/ubl-settings-quotas.cc:121 source/ubl-settings-quotas.cc:126 -#: source/ubl-settings-quotas.cc:142 source/ubl-settings-quotas.cc:147 -#: source/ubl-settings-quotas.cc:152 source/ubl-settings-quotas.cc:139 -#: source/ubl-settings-quotas.cc:144 source/ubl-settings-quotas.cc:149 -msgid "Currently using:" -msgstr "В настоящее время используется:" - -#: source/ubl-settings-quotas.cc:216 source/ubl-settings-quotas.cc:146 -#: source/ubl-settings-quotas.cc:136 source/ubl-settings-quotas.cc:157 -#: source/ubl-settings-quotas.cc:154 -msgid "Currently using: " -msgstr "В настоящее время используется: " - -#: source/ubl-settings-quotas.cc:62 source/ubl-settings-quotas.cc:83 -#: source/ubl-settings-quotas.cc:80 source/ubl-settings-quotas.cc:77 -#: source/ubl-settings-quotas.cc:76 -msgid "Date and Time" -msgstr "Дата и время" - -#: source/ubl-settings-quotas.cc:246 source/ubl-settings-quotas.cc:381 -msgid "" -"Deferring\n" -"a hard\n" -"limit\n" -"(files)" -msgstr "" -"Отсрочка\n" -"жесткого\n" -"ограничения\n" -"(файлы)" +#: source/ubl-strings.h:34 +msgid "Global configuration saving succseeded." +msgstr "Успешно записана глобальная конфигурация" -msgid "" -"Deferring\n" -"(files)" -msgstr "" -"Отсрочка\n" -"(файлы)" +#: source/ubl-strings.h:35 +msgid "Local configuration saving succseeded." +msgstr "Успешно записана локальная конфигурация" -msgid "" -"Deferring\n" -"(size)" -msgstr "" -"Отсрочка\n" -"(объём)" +msgid "Edit" +msgstr "Редактировать" + +msgid "Kb" +msgstr "Кб" + +msgid "Mb" +msgstr "Мб" + +msgid "Gb" +msgstr "Гб" + +msgid "Tb" +msgstr "Тб" + +msgid "Disk quotas" +msgstr "Дисковые квоты" + +msgid "Configuring disk quota settings for system groups and users" +msgstr "Настройка параметров дисковых квот для групп и пользователей системы" + +msgid "Device" +msgstr "Устройство" -#: source/ubl-settings-quotas.cc:239 source/ubl-settings-quotas.cc:374 -msgid "" -"Deferring\n" -"a hard\n" -"limit\n" -"(size)" -msgstr "" -"Отсрочка\n" -"жесткого\n" -"ограничения\n" -"(объём)" - -#: source/ubl-settings-quotas.cc:194 -msgid "Deferring a hard limit (files)" -msgstr "Отсрочка жесткого ограничения (файлы)" - -#: source/ubl-settings-quotas.cc:189 -msgid "Deferring a hard limit (size)" -msgstr "Отсрочка жесткого ограничения (объём)" - -#: source/ubl-settings-quotas.cc:149 source/ubl-settings-quotas.cc:181 -#: source/ubl-settings-quotas.cc:182 source/ubl-settings-quotas.cc:196 -#: source/ubl-settings-quotas.cc:208 source/ubl-settings-quotas.cc:79 -#: source/ubl-settings-quotas.cc:111 source/ubl-settings-quotas.cc:112 -#: source/ubl-settings-quotas.cc:126 source/ubl-settings-quotas.cc:138 -#: source/ubl-settings-quotas.cc:69 source/ubl-settings-quotas.cc:101 -#: source/ubl-settings-quotas.cc:102 source/ubl-settings-quotas.cc:116 -#: source/ubl-settings-quotas.cc:128 source/ubl-settings-quotas.cc:90 -#: source/ubl-settings-quotas.cc:122 source/ubl-settings-quotas.cc:123 -#: source/ubl-settings-quotas.cc:137 source/ubl-settings-quotas.cc:87 -#: source/ubl-settings-quotas.cc:119 source/ubl-settings-quotas.cc:120 -#: source/ubl-settings-quotas.cc:134 source/ubl-settings-quotas.cc:146 -#: source/ubl-settings-quotas.cc:84 source/ubl-settings-quotas.cc:117 -#: source/ubl-settings-quotas.cc:83 msgid "Device:" msgstr "Устройство:" -msgid "Project ID" -msgstr "ID проекта" - msgid "Catalog" msgstr "Каталог" +msgid "Catalog:" +msgstr "Каталог:" + msgid "Project Name" msgstr "Имя проекта" +msgid "Project Name:" +msgstr "Имя проекта:" + msgid "Auto" msgstr "Авто" @@ -199,9 +229,21 @@ msgstr "Группа" msgid "User:" msgstr "Пользователь:" +msgid "Users:" +msgstr "Пользователи:" + +msgid "Users" +msgstr "Пользователи" + msgid "Group:" msgstr "Группа:" +msgid "Groups:" +msgstr "Группы:" + +msgid "Groups" +msgstr "Группы" + msgid "Projects:" msgstr "Проект:" @@ -211,662 +253,200 @@ msgstr "Тип квот" msgid "Status" msgstr "Статус" -msgid "Device\nProject" -msgstr "Устройство\nПроект" - -#: source/ubl-settings-quotas.cc:197 source/ubl-settings-quotas.cc:207 -#: source/ubl-settings-quotas.cc:127 source/ubl-settings-quotas.cc:137 -#: source/ubl-settings-quotas.cc:117 source/ubl-settings-quotas.cc:138 -#: source/ubl-settings-quotas.cc:148 source/ubl-settings-quotas.cc:135 -#: source/ubl-settings-quotas.cc:145 -msgid "Disk quotas for this device:" -msgstr "Дисковые квоты для этого устройства:" - -#: source/ubl-settings-quotas.cc:152 source/ubl-settings-quotas.cc:153 -#: source/ubl-settings-quotas.cc:82 source/ubl-settings-quotas.cc:83 -#: source/ubl-settings-quotas.cc:72 source/ubl-settings-quotas.cc:73 -#: source/ubl-settings-quotas.cc:93 source/ubl-settings-quotas.cc:94 -#: source/ubl-settings-quotas.cc:90 source/ubl-settings-quotas.cc:91 -#: source/ubl-settings-quotas.cc:87 source/ubl-settings-quotas.cc:88 -#: source/ubl-settings-quotas.cc:86 -msgid "Enable" -msgstr "Включить" - -#: source/ubl-settings-quotas.cc:597 source/ubl-settings-quotas.cc:510 -#: source/ubl-settings-quotas.cc:444 -#, fuzzy +msgid "Projects" +msgstr "Проекты" + msgid "Error saved local and global configuration" msgstr "Сохранить глобальную и локальную конфигурацию" -#: source/ubl-settings-quotas.cc:156 source/ubl-settings-quotas.cc:158 -#: source/ubl-settings-quotas.cc:86 source/ubl-settings-quotas.cc:88 -#: source/ubl-settings-quotas.cc:76 source/ubl-settings-quotas.cc:78 -#: source/ubl-settings-quotas.cc:97 source/ubl-settings-quotas.cc:99 -#: source/ubl-settings-quotas.cc:94 source/ubl-settings-quotas.cc:96 -#: source/ubl-settings-quotas.cc:91 source/ubl-settings-quotas.cc:93 -#: source/ubl-settings-quotas.cc:90 source/ubl-settings-quotas.cc:92 -msgid "Excess files delay period" -msgstr "Превышение периода задержки файлов" - -#: source/ubl-settings-quotas.cc:155 source/ubl-settings-quotas.cc:157 -#: source/ubl-settings-quotas.cc:85 source/ubl-settings-quotas.cc:87 -#: source/ubl-settings-quotas.cc:75 source/ubl-settings-quotas.cc:77 -#: source/ubl-settings-quotas.cc:96 source/ubl-settings-quotas.cc:98 -#: source/ubl-settings-quotas.cc:93 source/ubl-settings-quotas.cc:95 -#: source/ubl-settings-quotas.cc:90 source/ubl-settings-quotas.cc:92 -#: source/ubl-settings-quotas.cc:89 source/ubl-settings-quotas.cc:91 -msgid "Excess size delay period" -msgstr "Период задержки превышения размера" - -#: source/ubl-settings-quotas.cc:150 source/ubl-settings-quotas.cc:175 -#: source/ubl-settings-quotas.cc:176 source/ubl-settings-quotas.cc:214 -#: source/ubl-settings-quotas.cc:221 source/ubl-settings-quotas.cc:80 -#: source/ubl-settings-quotas.cc:105 source/ubl-settings-quotas.cc:106 -#: source/ubl-settings-quotas.cc:144 source/ubl-settings-quotas.cc:151 -#: source/ubl-settings-quotas.cc:70 source/ubl-settings-quotas.cc:95 -#: source/ubl-settings-quotas.cc:96 source/ubl-settings-quotas.cc:134 -#: source/ubl-settings-quotas.cc:141 source/ubl-settings-quotas.cc:91 -#: source/ubl-settings-quotas.cc:116 source/ubl-settings-quotas.cc:117 -#: source/ubl-settings-quotas.cc:155 source/ubl-settings-quotas.cc:162 -#: source/ubl-settings-quotas.cc:88 source/ubl-settings-quotas.cc:113 -#: source/ubl-settings-quotas.cc:114 source/ubl-settings-quotas.cc:152 -#: source/ubl-settings-quotas.cc:85 source/ubl-settings-quotas.cc:110 -#: source/ubl-settings-quotas.cc:111 source/ubl-settings-quotas.cc:84 +msgid "The delay period for exceeding files:" +msgstr "Период отсрочки по превышению файлов:" + +msgid "The postponement period for exceeding the volume:" +msgstr "Период отсрочки по превышению объема:" + msgid "File system:" msgstr "Файловая система:" -#: source/ubl-settings-quotas.cc:191 source/ubl-settings-quotas.cc:200 -#: source/ubl-settings-quotas.cc:215 source/ubl-settings-quotas.cc:243 -#: source/ubl-settings-quotas.cc:121 source/ubl-settings-quotas.cc:130 -#: source/ubl-settings-quotas.cc:145 source/ubl-settings-quotas.cc:378 -#: source/ubl-settings-quotas.cc:111 source/ubl-settings-quotas.cc:120 -#: source/ubl-settings-quotas.cc:135 source/ubl-settings-quotas.cc:321 -#: source/ubl-settings-quotas.cc:132 source/ubl-settings-quotas.cc:141 -#: source/ubl-settings-quotas.cc:156 source/ubl-settings-quotas.cc:325 -#: source/ubl-settings-quotas.cc:129 source/ubl-settings-quotas.cc:138 -#: source/ubl-settings-quotas.cc:153 source/ubl-settings-quotas.cc:317 -#: source/ubl-settings-quotas.cc:264 source/ubl-settings-quotas.cc:126 msgid "Files" msgstr "Файлы" -#: source/ubl-settings-quotas.cc:177 source/ubl-settings-quotas.cc:178 -#: source/ubl-settings-quotas.cc:107 source/ubl-settings-quotas.cc:108 -#: source/ubl-settings-quotas.cc:97 source/ubl-settings-quotas.cc:98 -#: source/ubl-settings-quotas.cc:118 source/ubl-settings-quotas.cc:119 -#: source/ubl-settings-quotas.cc:115 source/ubl-settings-quotas.cc:116 -#: source/ubl-settings-quotas.cc:112 source/ubl-settings-quotas.cc:113 msgid "Filters" msgstr "Фильтры" -msgid "Direct control of the file system" -msgstr "Прямое управление файловой системой" - -msgid "" -"GTK settings disk quota for UBLinux\n" -"\n" -"Usage: ubl-settings-diskquota [OPTIONS...]\n" -"Options:\n" -" -h, --help\t Show this help\n" -" -V, --version\t Show package version\n" -" --lock-help Lock utility help\n" -" --lock-save Lock saving local and global configuration\n" -" --lock-save-local Lock save global configuration\n" -" --lock-save-global Lock load global configuration\n" -" --lock-load-global Lock load global configuration\n" -msgstr "" -"GTK утилита настройки дисковых для UBLinux\n" -"\n" -"Использование: ubl-settings-diskquota [Параметры приложения...]\n" -"Параметры приложения:\n" -" -h, --help\t Показать параметры справки\n" -" -V, --version\t Показать версию пакета\n" -" --lock-help Блокировка вызова справки\n" -" --lock-save Блокировка сохранения локальной и глобальной " -"конфигурации\n" -" --lock-save-local Блокировка сохранения локальной конфигурации\n" -" --lock-save-global Блокировка сохранения глобальной конфигурации\n" -" --lock-load-global Блокировка загрузки глобальной конфигурации\n" - -#: source/ubl-settings-quotas.cc:144 source/ubl-settings-quotas.cc:74 -#: source/ubl-settings-quotas.cc:66 source/ubl-settings-quotas.cc:87 -#: source/ubl-settings-quotas.cc:84 source/ubl-settings-quotas.cc:81 -#: source/ubl-settings-quotas.cc:80 -msgid "General settings" -msgstr "Общие настройки" - -#: source/ubl-settings-quotas.cc:611 source/ubl-settings-quotas.cc:524 -#: source/ubl-settings-quotas.cc:458 -msgid "Global configuration downloaded successfully" -msgstr "Успешно загружена глобальная конфигурация" +msgid "minutes" +msgstr "минут" -#: source/ubl-settings-quotas.cc:585 source/ubl-settings-quotas.cc:498 -#: source/ubl-settings-quotas.cc:432 -#, fuzzy -msgid "Global configuration read error" -msgstr "Сохранить глобальную конфигурацию" +msgid "name" +msgstr "имя" -#: source/ubl-settings-quotas.cc:617 source/ubl-settings-quotas.cc:530 -#: source/ubl-settings-quotas.cc:464 -msgid "Global configuration successfully written" -msgstr "Успешно записана глобальная конфигурация" +msgid "days" +msgstr "дней" -#: source/ubl-settings-quotas.cc:593 source/ubl-settings-quotas.cc:506 -#: source/ubl-settings-quotas.cc:440 -#, fuzzy -msgid "Global configuration write error" -msgstr "Сохранить глобальную конфигурацию" - -#: source/ubl-settings-quotas.cc:198 source/ubl-settings-quotas.cc:128 -#: source/ubl-settings-quotas.cc:118 source/ubl-settings-quotas.cc:139 -#: source/ubl-settings-quotas.cc:136 -msgid "Group quotas for this device:" -msgstr "Групповые квоты для этого устройства:" - -#: source/ubl-settings-quotas.cc:145 source/ubl-settings-quotas.cc:75 -#: source/ubl-settings-quotas.cc:67 source/ubl-settings-quotas.cc:88 -#: source/ubl-settings-quotas.cc:85 source/ubl-settings-quotas.cc:82 -#: source/ubl-settings-quotas.cc:81 -msgid "Groups" -msgstr "Группы" +msgid "files" +msgstr "Файлы" -#: source/ubl-settings-quotas.cc:203 source/ubl-settings-quotas.cc:204 -#: source/ubl-settings-quotas.cc:213 source/ubl-settings-quotas.cc:218 -#: source/ubl-settings-quotas.cc:133 source/ubl-settings-quotas.cc:134 -#: source/ubl-settings-quotas.cc:143 source/ubl-settings-quotas.cc:148 -#: source/ubl-settings-quotas.cc:123 source/ubl-settings-quotas.cc:124 -#: source/ubl-settings-quotas.cc:138 source/ubl-settings-quotas.cc:144 -#: source/ubl-settings-quotas.cc:145 source/ubl-settings-quotas.cc:154 -#: source/ubl-settings-quotas.cc:159 source/ubl-settings-quotas.cc:141 -#: source/ubl-settings-quotas.cc:142 source/ubl-settings-quotas.cc:151 -#: source/ubl-settings-quotas.cc:156 -#, fuzzy -msgid "Hard limit" -msgstr "Жесткий предел" +msgid "hours" +msgstr "часов" -#: source/ubl-settings-quotas.cc:320 source/ubl-settings-quotas.cc:324 -#: source/ubl-settings-quotas.cc:316 source/ubl-settings-quotas.cc:263 -#, fuzzy -msgid "" -"Hard limit\n" -"(Size) activation\n" -"time" -msgstr "" -"Жесткий предел\n" -"(размер)" +msgid "w " +msgstr "н " -#: source/ubl-settings-quotas.cc:323 source/ubl-settings-quotas.cc:327 -#: source/ubl-settings-quotas.cc:319 source/ubl-settings-quotas.cc:266 -#, fuzzy -msgid "" -"Hard limit\n" -"(files)" -msgstr "" -"Жесткий лимит\n" -"(файлы)" +msgid "d " +msgstr "д " -#: source/ubl-settings-quotas.cc:325 source/ubl-settings-quotas.cc:329 -#: source/ubl-settings-quotas.cc:321 source/ubl-settings-quotas.cc:268 -#, fuzzy -msgid "" -"Hard limit\n" -"(files) activation\n" -"time" -msgstr "" -"Жесткий предел\n" -"(размер)" +msgid "h " +msgstr "ч " -#: source/ubl-settings-quotas.cc:324 source/ubl-settings-quotas.cc:328 -#: source/ubl-settings-quotas.cc:320 source/ubl-settings-quotas.cc:267 -#, fuzzy -msgid "" -"Hard limit\n" -"(files) delay" -msgstr "" -"Жесткий лимит\n" -"(файлы)" +msgid "m " +msgstr "м " -#: source/ubl-settings-quotas.cc:318 source/ubl-settings-quotas.cc:322 -#: source/ubl-settings-quotas.cc:314 source/ubl-settings-quotas.cc:261 -#, fuzzy -msgid "" -"Hard limit\n" -"(size)" -msgstr "" -"Жесткий предел\n" -"(размер) задержки" +msgid "weeks" +msgstr "недель" -#: source/ubl-settings-quotas.cc:319 source/ubl-settings-quotas.cc:323 -#: source/ubl-settings-quotas.cc:315 source/ubl-settings-quotas.cc:262 -#, fuzzy -msgid "" -"Hard limit\n" -"(size) delay" -msgstr "" -"Жесткий предел\n" -"(размер) задержки" +msgid "General statistics" +msgstr "Общая статистика" -#: source/ubl-settings-quotas.cc:247 source/ubl-settings-quotas.cc:382 -#, fuzzy -msgid "" -"Hard limit\n" -"activation\n" -"time (files)" -msgstr "" -"Время активации\n" -"жесткого лимита\n" -"(файла)" +msgid "https://wiki.ublinux.com" +msgstr "https://wiki.ublinux.ru" -#: source/ubl-settings-quotas.cc:240 source/ubl-settings-quotas.cc:375 -msgid "" -"Hard limit\n" -"activation\n" -"time (size)" -msgstr "" -"Время активации\n" -"жесткого лимита\n" -"(объём)" - -#: source/ubl-settings-quotas.cc:195 source/ubl-settings-quotas.cc:125 -#: source/ubl-settings-quotas.cc:115 source/ubl-settings-quotas.cc:136 -#: source/ubl-settings-quotas.cc:133 source/ubl-settings-quotas.cc:130 -msgid "Hard limit (file) activation time" -msgstr "Время активации жесткого лимита (файла)" - -#: source/ubl-settings-quotas.cc:123 source/ubl-settings-quotas.cc:113 -#: source/ubl-settings-quotas.cc:134 source/ubl-settings-quotas.cc:131 -#: source/ubl-settings-quotas.cc:128 -msgid "Hard limit (files)" -msgstr "Жесткий лимит (файлы)" - -#: source/ubl-settings-quotas.cc:124 source/ubl-settings-quotas.cc:114 -#: source/ubl-settings-quotas.cc:135 source/ubl-settings-quotas.cc:132 -#: source/ubl-settings-quotas.cc:129 -msgid "Hard limit (files) delay" -msgstr "Жесткий лимит (файлы)" - -#: source/ubl-settings-quotas.cc:188 source/ubl-settings-quotas.cc:118 -#: source/ubl-settings-quotas.cc:108 source/ubl-settings-quotas.cc:129 -#: source/ubl-settings-quotas.cc:126 source/ubl-settings-quotas.cc:123 -msgid "Hard limit (size)" -msgstr "Жесткий лимит (объём)" - -#: source/ubl-settings-quotas.cc:120 source/ubl-settings-quotas.cc:110 -#: source/ubl-settings-quotas.cc:131 source/ubl-settings-quotas.cc:128 -#: source/ubl-settings-quotas.cc:125 -msgid "Hard limit (size) activation time" -msgstr "Жесткий предел (размер)" - -#: source/ubl-settings-quotas.cc:119 source/ubl-settings-quotas.cc:109 -#: source/ubl-settings-quotas.cc:130 source/ubl-settings-quotas.cc:127 -#: source/ubl-settings-quotas.cc:124 -msgid "Hard limit (size) delay" -msgstr "Жесткий предел (размер) задержки" - -#: source/ubl-settings-quotas.cc:190 -msgid "Hard limit activation time (size)" -msgstr "Время активации жесткого ограничения (объём)" - -#: source/ubl-settings-quotas.cc:225 source/ubl-settings-quotas.cc:155 -#: source/ubl-settings-quotas.cc:145 -msgid "Help" -msgstr "Справка" +msgid "Off" +msgstr "Выключено" -#: source/ubl-settings-quotas.cc:179 source/ubl-settings-quotas.cc:109 -#: source/ubl-settings-quotas.cc:99 source/ubl-settings-quotas.cc:120 -#: source/ubl-settings-quotas.cc:117 source/ubl-settings-quotas.cc:114 -msgid "Load" -msgstr "Загрузить" +msgid "Not set" +msgstr "Не задано" -#: source/ubl-settings-quotas.cc:222 source/ubl-settings-quotas.cc:152 -#: source/ubl-settings-quotas.cc:142 -msgid "Load global configuration" -msgstr "Загрузить глобальную конфигурацию" +msgid "Name" +msgstr "Имя" -#: source/ubl-settings-quotas.cc:223 source/ubl-settings-quotas.cc:153 -#: source/ubl-settings-quotas.cc:143 -msgid "Load local configuration" -msgstr "Загрузить локальную конфигурацию" +msgid "Nothing to save!" +msgstr "Нечего сохранять!" -#: source/ubl-settings-quotas.cc:608 source/ubl-settings-quotas.cc:521 -#: source/ubl-settings-quotas.cc:455 -msgid "Local configuration downloaded successfully" -msgstr "Успешно загружена локальная конфигурация" +msgid "Project ID" +msgstr "ID проекта" -#: source/ubl-settings-quotas.cc:581 source/ubl-settings-quotas.cc:494 -#: source/ubl-settings-quotas.cc:428 -#, fuzzy -msgid "Local configuration reading error" -msgstr "Загрузить локальную конфигурацию" +msgid "Project ID:" +msgstr "ID проекта:" -#: source/ubl-settings-quotas.cc:614 source/ubl-settings-quotas.cc:527 -#: source/ubl-settings-quotas.cc:461 -msgid "Local configuration successfully written" -msgstr "Успешно записана локальная конфигурация" +msgid "Settings disk quotas - Addition" +msgstr "Настройка дисковых квот - Добавление" -#: source/ubl-settings-quotas.cc:589 source/ubl-settings-quotas.cc:502 -#: source/ubl-settings-quotas.cc:436 -#, fuzzy -msgid "Local configuration write error" -msgstr "Загрузить локальную конфигурацию" +msgid "Settings disk quotas - Editing" +msgstr "Настройка дисковых квот - Редактирование" -#: source/ubl-settings-quotas.cc:184 source/ubl-settings-quotas.cc:234 -#: source/ubl-settings-quotas.cc:114 source/ubl-settings-quotas.cc:369 -#: source/ubl-settings-quotas.cc:104 source/ubl-settings-quotas.cc:314 -#: source/ubl-settings-quotas.cc:125 source/ubl-settings-quotas.cc:318 -#: source/ubl-settings-quotas.cc:122 source/ubl-settings-quotas.cc:310 -#: source/ubl-settings-quotas.cc:119 -msgid "Name" -msgstr "Имя" +msgid "Quota use status:" +msgstr "Статус использования квот:" -#: source/ubl-settings-quotas.cc:623 source/ubl-settings-quotas.cc:536 -#: source/ubl-settings-quotas.cc:470 -msgid "Nothing to save!" -msgstr "Нечего сохранять!" +msgid "Size" +msgstr "Объём" -#: source/ubl-settings-quotas.cc:143 source/ubl-settings-quotas.cc:73 -#: source/ubl-settings-quotas.cc:65 source/ubl-settings-quotas.cc:86 -#: source/ubl-settings-quotas.cc:83 source/ubl-settings-quotas.cc:80 -#: source/ubl-settings-quotas.cc:79 -msgid "Project Home Page" -msgstr "Главная страница проекта" - -#: source/ubl-settings-quotas.cc:185 source/ubl-settings-quotas.cc:235 -#: source/ubl-settings-quotas.cc:115 source/ubl-settings-quotas.cc:370 -#: source/ubl-settings-quotas.cc:105 source/ubl-settings-quotas.cc:315 -#: source/ubl-settings-quotas.cc:126 source/ubl-settings-quotas.cc:319 -#: source/ubl-settings-quotas.cc:123 source/ubl-settings-quotas.cc:311 -#: source/ubl-settings-quotas.cc:258 source/ubl-settings-quotas.cc:120 msgid "Quotas" msgstr "Квоты" -#: source/ubl-settings-quotas.cc:151 source/ubl-settings-quotas.cc:81 -#: source/ubl-settings-quotas.cc:71 -msgid "Quotas for groups" -msgstr "Квоты для групп" +msgid "Mount\npoint" +msgstr "Точка монтирования" -#: source/ubl-settings-quotas.cc:154 source/ubl-settings-quotas.cc:84 -#: source/ubl-settings-quotas.cc:74 -msgid "Quotas for users" -msgstr "Квоты для пользователей" +msgid "FS" +msgstr "ФС" -#: source/ubl-settings-quotas.cc:180 source/ubl-settings-quotas.cc:110 -#: source/ubl-settings-quotas.cc:100 source/ubl-settings-quotas.cc:121 -#: source/ubl-settings-quotas.cc:118 source/ubl-settings-quotas.cc:115 -msgid "Save" -msgstr "Сохранить" +msgid "The postponement period\nfor exceeding the volume" +msgstr "Период отсрочки\nпо превышению объема" -#: source/ubl-settings-quotas.cc:226 source/ubl-settings-quotas.cc:156 -#: source/ubl-settings-quotas.cc:146 -msgid "Save in global and local configuration" -msgstr "Сохранить в глобальную и локальную конфигурацию" +msgid "The delay period\nfor exceeding files" +msgstr "Период отсрочки\nпо превышению файлов" -#: source/ubl-settings-quotas.cc:227 source/ubl-settings-quotas.cc:157 -#: source/ubl-settings-quotas.cc:147 -msgid "Save in global configuration" -msgstr "Сохранить в глобальную конфигурацию" +msgid "Soft\nrestriction\n(volume)" +msgstr "Мягкое\nограничение\n(объём)" -#: source/ubl-settings-quotas.cc:228 source/ubl-settings-quotas.cc:158 -#: source/ubl-settings-quotas.cc:148 -msgid "Save in local configuration" -msgstr "Сохранить в локальную конфигурацию" +msgid "Hard\nlimit\n(volume)" +msgstr "Жёсткое\nограничение\n(объём)" -#: source/ubl-settings-quotas.cc:140 source/ubl-settings-quotas.cc:70 -msgid "Setting user quotas" -msgstr "Настройка квот пользователей" +msgid "Postponing\nthe\nhard\nlimit\n(volume)" +msgstr "Отсрочка\nжёсткого\nограничения\n(объём)" -#: source/ubl-settings-quotas.cc:245 source/ubl-settings-quotas.cc:380 -msgid "" -"Severe\n" -"limitation\n" -"(files)" -msgstr "" -"Жесткое\n" -"лимит\n" -"(файлы)" +msgid "Soft\nrestriction\n(files)" +msgstr "Мягкое\nограничение\n(файлы)" -#: source/ubl-settings-quotas.cc:238 source/ubl-settings-quotas.cc:373 -msgid "" -"Severe\n" -"limitation\n" -"(size)" -msgstr "" -"Жесткое\n" -"лимит\n" -"(объём)" - -#: source/ubl-settings-quotas.cc:193 -msgid "Severe limitation (files)" -msgstr "Жесткое лимит (файлы)" - -#: source/ubl-settings-quotas.cc:186 source/ubl-settings-quotas.cc:199 -#: source/ubl-settings-quotas.cc:210 source/ubl-settings-quotas.cc:236 -#: source/ubl-settings-quotas.cc:116 source/ubl-settings-quotas.cc:129 -#: source/ubl-settings-quotas.cc:140 source/ubl-settings-quotas.cc:371 -#: source/ubl-settings-quotas.cc:106 source/ubl-settings-quotas.cc:119 -#: source/ubl-settings-quotas.cc:130 source/ubl-settings-quotas.cc:316 -#: source/ubl-settings-quotas.cc:127 source/ubl-settings-quotas.cc:151 -#: source/ubl-settings-quotas.cc:320 source/ubl-settings-quotas.cc:124 -#: source/ubl-settings-quotas.cc:137 source/ubl-settings-quotas.cc:148 -#: source/ubl-settings-quotas.cc:312 source/ubl-settings-quotas.cc:259 -#: source/ubl-settings-quotas.cc:121 -msgid "Size" -msgstr "Объём" +msgid "Hard\nlimit\n(files)" +msgstr "Жёсткое\nограничение\n(файлы)" + +msgid "Postponing\nthe\nhard\nlimit\n(files)" +msgstr "Отсрочка\nжёсткого\nограничения\n(файлы)" + +msgid "Device/\nProject" +msgstr "Устройство/\nПроект" -#: source/ubl-settings-quotas.cc:244 source/ubl-settings-quotas.cc:379 -msgid "" -"Soft\n" -"Restriction\n" -"(files)" -msgstr "" -"Мягкое\n" -"лимит\n" -"(файлы)" - -#: source/ubl-settings-quotas.cc:192 -msgid "Soft Restriction (files)" -msgstr "Мягкое лимит (файлы)" - -#: source/ubl-settings-quotas.cc:202 source/ubl-settings-quotas.cc:205 -#: source/ubl-settings-quotas.cc:212 source/ubl-settings-quotas.cc:217 -#: source/ubl-settings-quotas.cc:132 source/ubl-settings-quotas.cc:135 -#: source/ubl-settings-quotas.cc:142 source/ubl-settings-quotas.cc:147 -#: source/ubl-settings-quotas.cc:122 source/ubl-settings-quotas.cc:125 -#: source/ubl-settings-quotas.cc:137 source/ubl-settings-quotas.cc:143 -#: source/ubl-settings-quotas.cc:146 source/ubl-settings-quotas.cc:153 -#: source/ubl-settings-quotas.cc:158 source/ubl-settings-quotas.cc:140 -#: source/ubl-settings-quotas.cc:150 source/ubl-settings-quotas.cc:155 -#, fuzzy msgid "Soft limit" -msgstr "Мягкий лимит" +msgstr "Мягкое ограничение" -#: source/ubl-settings-quotas.cc:322 source/ubl-settings-quotas.cc:326 -#: source/ubl-settings-quotas.cc:318 source/ubl-settings-quotas.cc:265 -#, fuzzy -msgid "" -"Soft limit\n" -"(files)" -msgstr "" -"Мягкий\n" -"лимит\n" -"(файлы)" +msgid "Hard limit" +msgstr "Жёсткое ограничение" -#: source/ubl-settings-quotas.cc:237 source/ubl-settings-quotas.cc:372 -#: source/ubl-settings-quotas.cc:317 source/ubl-settings-quotas.cc:321 -#: source/ubl-settings-quotas.cc:313 source/ubl-settings-quotas.cc:260 -#, fuzzy -msgid "" -"Soft limit\n" -"(size)" -msgstr "" -"Мягкий лимит\n" -"(объём)" +msgid "Soft limit (volume)" +msgstr "Мягкое ограничение (объём)" -msgid "" -"Soft limit\n" -"(file)" -msgstr "" -"Мягкий лимит\n" -"(файлы)" +msgid "Hard limit (volume)" +msgstr "Жёсткое ограничение (объём)" + +msgid "Postponing the hard limit (volume)" +msgstr "Отсрочка жёсткого ограничения (объём)" -#: source/ubl-settings-quotas.cc:122 source/ubl-settings-quotas.cc:112 -#: source/ubl-settings-quotas.cc:133 source/ubl-settings-quotas.cc:130 -#: source/ubl-settings-quotas.cc:127 msgid "Soft limit (files)" -msgstr "" -"Мягкий лимит\n" -"(файлы)" +msgstr "Мягкое ограничение (файлы)" -#: source/ubl-settings-quotas.cc:187 source/ubl-settings-quotas.cc:117 -#: source/ubl-settings-quotas.cc:107 source/ubl-settings-quotas.cc:128 -#: source/ubl-settings-quotas.cc:125 source/ubl-settings-quotas.cc:122 -msgid "Soft limit (size)" -msgstr "Мягкий лимит (объём)" +msgid "Hard limit (files)" +msgstr "Жёсткое ограничение (файлы)" -#: source/ubl-settings-quotas.cc:620 source/ubl-settings-quotas.cc:533 -#: source/ubl-settings-quotas.cc:467 -#, fuzzy -msgid "Successfully saved local and global configuration" -msgstr "Сохранить глобальную и локальную конфигурацию" +msgid "Postponing the hard limit (files)" +msgstr "Отсрочка жёсткого ограничения (файлы)" -#: source/ubl-settings-quotas.cc:59 source/ubl-settings-quotas.cc:55 -#: source/ubl-settings-quotas.cc:47 source/ubl-settings-quotas.cc:68 -#: source/ubl-settings-quotas.cc:70 source/ubl-settings-quotas.cc:67 -#: source/ubl-settings-quotas.cc:66 -msgid "The program must be run as root" -msgstr "Программа должна быть запущена от имени root" - -#: source/ubl-settings-quotas.cc:209 source/ubl-settings-quotas.cc:139 -#: source/ubl-settings-quotas.cc:129 source/ubl-settings-quotas.cc:150 -#: source/ubl-settings-quotas.cc:147 -msgid "User quotas for this device: " -msgstr "Квоты пользователей для этого устройства: " - -#: source/ubl-settings-quotas.cc:148 source/ubl-settings-quotas.cc:78 -#: source/ubl-settings-quotas.cc:68 source/ubl-settings-quotas.cc:89 -#: source/ubl-settings-quotas.cc:86 source/ubl-settings-quotas.cc:83 -#: source/ubl-settings-quotas.cc:82 -msgid "Users" -msgstr "Пользователи" +msgid "On" +msgstr "Включено" -#: source/ubl-settings-quotas.cc:163 source/ubl-settings-quotas.cc:164 -#: source/ubl-settings-quotas.cc:165 source/ubl-settings-quotas.cc:166 -#: source/ubl-settings-quotas.cc:93 source/ubl-settings-quotas.cc:94 -#: source/ubl-settings-quotas.cc:95 source/ubl-settings-quotas.cc:96 -#: source/ubl-settings-quotas.cc:83 source/ubl-settings-quotas.cc:84 -#: source/ubl-settings-quotas.cc:85 source/ubl-settings-quotas.cc:86 -#: source/ubl-settings-quotas.cc:104 source/ubl-settings-quotas.cc:105 -#: source/ubl-settings-quotas.cc:106 source/ubl-settings-quotas.cc:107 -#: source/ubl-settings-quotas.cc:101 source/ubl-settings-quotas.cc:102 -#: source/ubl-settings-quotas.cc:103 source/ubl-settings-quotas.cc:98 -#: source/ubl-settings-quotas.cc:99 source/ubl-settings-quotas.cc:100 -#: source/ubl-settings-quotas.cc:97 -msgid "days" -msgstr "дни" +msgid "Please select folder" +msgstr "Выберите каталог" -#: source/ubl-settings-quotas.cc:219 source/ubl-settings-quotas.cc:220 -#: source/ubl-settings-quotas.cc:149 source/ubl-settings-quotas.cc:150 -#: source/ubl-settings-quotas.cc:139 source/ubl-settings-quotas.cc:140 -#: source/ubl-settings-quotas.cc:160 source/ubl-settings-quotas.cc:161 -#: source/ubl-settings-quotas.cc:157 source/ubl-settings-quotas.cc:158 -#, fuzzy -msgid "files" -msgstr "Файлы" +msgid "Warning" +msgstr "Внимание" -#: source/ubl-settings-quotas.cc:167 source/ubl-settings-quotas.cc:168 -#: source/ubl-settings-quotas.cc:169 source/ubl-settings-quotas.cc:170 -#: source/ubl-settings-quotas.cc:97 source/ubl-settings-quotas.cc:98 -#: source/ubl-settings-quotas.cc:99 source/ubl-settings-quotas.cc:100 -#: source/ubl-settings-quotas.cc:87 source/ubl-settings-quotas.cc:88 -#: source/ubl-settings-quotas.cc:89 source/ubl-settings-quotas.cc:90 -#: source/ubl-settings-quotas.cc:108 source/ubl-settings-quotas.cc:109 -#: source/ubl-settings-quotas.cc:110 source/ubl-settings-quotas.cc:111 -#: source/ubl-settings-quotas.cc:105 source/ubl-settings-quotas.cc:106 -#: source/ubl-settings-quotas.cc:107 source/ubl-settings-quotas.cc:102 -#: source/ubl-settings-quotas.cc:103 source/ubl-settings-quotas.cc:104 -#: source/ubl-settings-quotas.cc:101 -msgid "hours" -msgstr "часы" +msgid "The selected directory is not located on the target device" +msgstr "Выбранный каталог не расположен на целевом устройстве" -#: source/ubl-settings-quotas.cc:141 source/ubl-settings-quotas.cc:71 -#: source/ubl-settings-quotas.cc:63 source/ubl-settings-quotas.cc:84 -#: source/ubl-settings-quotas.cc:81 source/ubl-settings-quotas.cc:78 -#: source/ubl-settings-quotas.cc:77 -msgid "https://wiki.ublinux.com" -msgstr "https://wiki.ublinux.ru" +msgid "Withdraw all users" +msgstr "Вывести всех пользователей" -#: source/ubl-settings-quotas.cc:548 source/ubl-settings-quotas.cc:461 -msgid "" -"https://wiki.ublinux.com/ru/Программное_обеспечение/Программы_и_утилиты/Все/" -msgstr "" +msgid "Withdraw all groups" +msgstr "Вывести все группы" -#: source/ubl-settings-quotas.cc:171 source/ubl-settings-quotas.cc:172 -#: source/ubl-settings-quotas.cc:173 source/ubl-settings-quotas.cc:174 -#: source/ubl-settings-quotas.cc:101 source/ubl-settings-quotas.cc:102 -#: source/ubl-settings-quotas.cc:103 source/ubl-settings-quotas.cc:104 -#: source/ubl-settings-quotas.cc:91 source/ubl-settings-quotas.cc:92 -#: source/ubl-settings-quotas.cc:93 source/ubl-settings-quotas.cc:94 -#: source/ubl-settings-quotas.cc:112 source/ubl-settings-quotas.cc:113 -#: source/ubl-settings-quotas.cc:114 source/ubl-settings-quotas.cc:115 -#: source/ubl-settings-quotas.cc:109 source/ubl-settings-quotas.cc:110 -#: source/ubl-settings-quotas.cc:111 source/ubl-settings-quotas.cc:106 -#: source/ubl-settings-quotas.cc:107 source/ubl-settings-quotas.cc:108 -#: source/ubl-settings-quotas.cc:105 -msgid "minutes" -msgstr "минуты" +msgid "Settings quotas - Addition" +msgstr "Настройка квот - Добавление" -#: source/ubl-settings-quotas.cc:257 -msgid "name" -msgstr "имя" +msgid "Settings quotas - Editing" +msgstr "Настройка квот - Редактирование" -#: source/ubl-settings-quotas.cc:92 source/ubl-settings-quotas.cc:89 -#: source/ubl-settings-quotas.cc:86 source/ubl-settings-quotas.cc:85 -#, fuzzy -msgid "quotas for groups" -msgstr "Квоты для групп" +msgid "The list of users is empty" +msgstr "Список пользователей пуст" -#: source/ubl-settings-quotas.cc:95 source/ubl-settings-quotas.cc:92 -#: source/ubl-settings-quotas.cc:89 source/ubl-settings-quotas.cc:88 -#, fuzzy -msgid "quotas for users" -msgstr "Квоты для пользователей" - -#: source/ubl-settings-quotas.cc:629 source/ubl-settings-quotas.cc:542 -#: source/ubl-settings-quotas.cc:476 source/ubl-settings-quotas.cc:350 -#: source/ubl-settings-quotas.cc:371 source/ubl-settings-quotas.cc:318 -#: source/ubl-settings-quotas.cc:267 source/ubl-settings-quotas.cc:213 -msgid "ubl-settings-quotas version: " -msgstr "ubl-settings-quotas версия: " - -#: source/ubl-settings-quotas.cc:159 source/ubl-settings-quotas.cc:160 -#: source/ubl-settings-quotas.cc:161 source/ubl-settings-quotas.cc:162 -#: source/ubl-settings-quotas.cc:89 source/ubl-settings-quotas.cc:90 -#: source/ubl-settings-quotas.cc:91 source/ubl-settings-quotas.cc:92 -#: source/ubl-settings-quotas.cc:79 source/ubl-settings-quotas.cc:80 -#: source/ubl-settings-quotas.cc:81 source/ubl-settings-quotas.cc:82 -#: source/ubl-settings-quotas.cc:100 source/ubl-settings-quotas.cc:101 -#: source/ubl-settings-quotas.cc:102 source/ubl-settings-quotas.cc:103 -#: source/ubl-settings-quotas.cc:97 source/ubl-settings-quotas.cc:98 -#: source/ubl-settings-quotas.cc:99 source/ubl-settings-quotas.cc:94 -#: source/ubl-settings-quotas.cc:95 source/ubl-settings-quotas.cc:96 -#: source/ubl-settings-quotas.cc:93 -msgid "weeks" -msgstr "недели" +msgid "Project name required field" +msgstr "Имя проекта обязательное поле" -msgid "Argument not recognized\n" -msgstr "Аргумент не распознан\n" +msgid "Project ID mandatory field" +msgstr "ID проекта обязательное поле" -msgid "ubl-settings-diskquota version: " -msgstr "ubl-settings-diskquota версия: " +msgid "The volume and files fields must have at least one value" +msgstr "Поля объем и файлы должно быть указано хотя бы одно значение" -msgid "ubl-settings-quotas" -msgstr "Квоты" +msgid "The path does not match the specified disk" +msgstr "Путь не соответствует указанному диску" -msgid "General statistics" -msgstr "Общая статистика" +msgid "Project name mandatory field" +msgstr "Имя проекта обязательное поле" -#~ msgid "Severe limitation (size)" -#~ msgstr "Жесткое лимит (объём)" +msgid "To save, you need to select a disk" +msgstr "Для сохранения нужно выбрать диск" -#, fuzzy -#~ msgid "Hard limit activation time (files)" -#~ msgstr "Время активации жесткого граничения (файла)" +msgid "Project" +msgstr "Проект" + +msgid "Is not a directory" +msgstr "Не является каталогом" \ No newline at end of file