Перевел на код си

pull/24/head
Igor Belitskiy 2 years ago
parent a054be64e2
commit 2ab0555220

@ -105,7 +105,7 @@ uninstall:
install: check uninstall
@echo "Install ..."
#################################################### УДАЛИТЬ ПЕРЕД КОММИТОМ ################################################################################
# @g++ source/ubl-cmake.h compile/resources.cc compile/ubl-cmake.h source/ubl-settings-diskquota.cc source/ubl-settings-diskquota.h source/ubl-strings.h source/view/model/ubl-utils.cc source/view/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
@gcc source/ubl-cmake.h compile/resources.c compile/ubl-cmake.h 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
#################################################### УДАЛИТЬ ПЕРЕД КОММИТОМ ################################################################################
@for FILE_PO in $(wildcard *.po); do \
LANG=$${FILE_PO##*_};LANG=$${LANG%.*}; \

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 210 KiB

After

Width:  |  Height:  |  Size: 218 KiB

@ -8,10 +8,10 @@ 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})
#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)
@ -66,18 +66,15 @@ add_custom_target(
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/model/ubl-utils.h
view/model/ubl-utils.cc
ubl-settings-diskquota.cc
ubl-settings-diskquota.c
ubl-settings-diskquota.h
ubl-strings.h
model/ubl-utils.h
model/ubl-utils.c
${CMAKE_CURRENT_BINARY_DIR}/ubl-cmake.h
)

@ -0,0 +1,118 @@
#include "controler.h"
struct model_cfg_u_g_p* cfg_user = NULL;
struct model_cfg_u_g_p* cfg_group = NULL;
struct model_cfg_u_g_p* cfg_project = NULL;
struct model_cfg_general* cfg_general = NULL;
struct struct_gui* cfg_gui = NULL;
void load_system_cfg() {
cfg_gui->flag_load = 0;
template_load_cfg(CMD_LOAD_SYSTEM);
yon_ubl_status_box_render(LOCAL_LOAD_SUCCESS, BACKGROUND_IMAGE_SUCCESS_TYPE);
}
void load_global_cfg() {
cfg_gui->flag_load = 1;
template_load_cfg(CMD_LOAD_GLOBAL);
yon_ubl_status_box_render(GLOBAL_LOAD_SUCCESS,BACKGROUND_IMAGE_SUCCESS_TYPE);
}
int main(int argc, char *argv[]){
local=setlocale(LC_ALL, "");
textdomain (LocaleName);
config_init();
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;i<argc;i++){
int argument=getopt_long(argc,argv,"hVvs:e:t:d",long_options,&option_index);
switch(argument){
case 'h':
show_help=1;
break;
case 'v':
case 'V':
printf("%s\n",VERSION_LABEL);
exit(0);
break;
case 's':
if(optarg)
main_config.socket_id=atoi(optarg);
break;
case 'e':
if(optarg)
main_config.load_socket_id=atoi(optarg);
break;
case 't':
if(optarg)
main_config.save_socket_id=atoi(optarg);
break;
case 1:
main_config.lock_help=1;
break;
case 2:
main_config.lock_save_local=1;
main_config.lock_save_global=1;
break;
case 3:
main_config.lock_save_local=1;
break;
case 4:
main_config.lock_save_global=1;
break;
case 5:
main_config.lock_load_global=1;
break;
}
}
if (show_help==1&&main_config.lock_help!=1){
printf("%s\n",HELP_LABEL);
exit(0);
}
}
if (getuid()!=0){
main_config.lock_load_global=1;
main_config.lock_save_global=1;
main_config.lock_save_local=1;
}
gtk_init(&argc,&argv);
main_window *widgets = setup_window();
yon_ubl_header_setup_resource(widgets->HeadOverlay,widgets->HeadBox,widgets->HeadImage,banner_path);
yon_ubl_status_box_setup(widgets->StatusIcon,widgets->StatusBox,widgets->StatusLabel);
if (getuid()!=0)
yon_ubl_status_box_render(ROOT_WARNING_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
else
yon_ubl_status_box_render(TITLE_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
yon_ubl_setup_sockets(widgets->PlugBox,widgets->LeftBox,widgets->RightBox,main_config.socket_id,main_config.load_socket_id,main_config.save_socket_id);
yon_window_config_setup(GTK_WINDOW(widgets->Window));
yon_window_config_load(config_path);
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);
gtk_main();
}

@ -0,0 +1,7 @@
#include "ubl-settings-diskquota.h"
#include "model.h"
#include "load.h"
#include "ubl-strings.h"
int main(int argc, char *argv[]);

@ -0,0 +1,25 @@
#include "load.h"
void template_load_cfg(model_cfg_general* config, char* cmd) {
clear_array();
int size = 0;
char** cfg = yon_config_load(cmd, &size);
philos_array_string_remove_char(&cfg, "\n", size);
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);
if (yon_char_find_count(str_key, "CGROUP_QUOTA") != 0) {
if (str_key_value[0] == '\"') {
yon_char_divide(str_key_value, 0);
size_t length = strlen(str_key_value);
str_key_value = yon_char_divide(str_key_value, length-1);
}
str_split_value(str_key_value, config->size);
str_split_key(str_key, config->size);
config->size++;
}
}
config->flag_set_data = 0;
}

@ -0,0 +1,2 @@
#include "ubl-utils.h"
#include "ubl-strings.h"

@ -0,0 +1,156 @@
#include "model.h"
void model_clear_cfg(model_cfg_u_g_p* config) {
philos_free_int_array(config->id, config->size);
philos_free_string_array(config->name, config->size);
philos_free_string_array(config->quota, config->size);
philos_free_string_array(config->quota, config->size);
philos_free_string_array(config->size_memory, config->size);
philos_free_int_array(config->soft_restriction_size, config->size);
philos_free_int_array(config->soft_restriction_file, config->size);
philos_free_int_array(config->severe_limitation_size, config->size);
philos_free_int_array(config->severe_limitation_file, config->size);
philos_free_int_array(config->deferring_size, config->size);
philos_free_int_array(config->deferring_file, config->size);
philos_free_int_array(config->size_memory_pow, config->size);
philos_free_int_array(config->soft_restriction_size_pow, config->size);
philos_free_int_array(config->soft_restriction_file_pow, config->size);
philos_free_int_array(config->severe_limitation_size_pow, config->size);
philos_free_int_array(config->severe_limitation_file_pow, config->size);
philos_free_int_array(config->deferring_size_pow, config->size);
philos_free_int_array(config->deferring_file_pow, config->size);
philos_free_string_array(config->device, config->size);
config->size = 0;
}
void model_null_cfg(model_cfg_u_g_p* config) {
if (config->size == 0) {
config->id = NULL;
config->name = NULL;
config->quota = NULL;
config->size_memory = NULL;
config->files = NULL;
config->soft_restriction_size = NULL;
config->soft_restriction_file = NULL;
config->severe_limitation_size = NULL;
config->severe_limitation_file = NULL;
config->deferring_size = NULL;
config->deferring_file = NULL;
config->size_memory_pow = NULL;
config->soft_restriction_size_pow = NULL;
config->soft_restriction_file_pow = NULL;
config->severe_limitation_size_pow = NULL;
config->severe_limitation_file_pow = NULL;
config->deferring_size_pow = NULL;
config->deferring_file_pow = NULL;
config->device = NULL;
}
}
void model_clear_general(model_cfg_general* config) {
philos_free_int_array(config->flag_status, config->size);
config->size = 0;
}
void model_null_general(model_cfg_general* config) {
if (config->size == 0) {
config->flag_status = NULL;
}
}
void model_tree_view_add(model_cfg_general* config) {
model_null_str_writing(config, config->size);
}
void model_null_str_writing(model_cfg_general* config, int index) {
philos_set_size_memory_integer_char("-", config->name, index);
philos_set_size_memory_integer_char("-", config->quota, index);
philos_set_size_memory_integer_char("-", config->size_memory, index);
philos_set_size_memory_integer_char("-", config->files, index);
philos_set_size_memory_integer_char("-", config->device, index);
philos_set_pow_size_memory("-", config->soft_restriction_size, index, array_size_pow);
philos_set_pow_size_memory("-", config->soft_restriction_file, index, array_size_pow);
philos_set_pow_size_memory("-", config->severe_limitation_size, index, array_size_pow);
philos_set_pow_size_memory("-", config->severe_limitation_file, index, array_size_pow);
philos_set_pow_size_memory("-", config->deferring_size, index, array_size_pow);
philos_set_pow_size_memory("-", config->deferring_file, index, array_size_pow);
philos_set_pow_size_memory("-", config->size_memory_pow, index, array_size_pow);
philos_set_pow_size_memory("-", config->soft_restriction_size_pow, index, array_size_pow);
philos_set_pow_size_memory("-", config->soft_restriction_file_pow, index, array_size_pow);
philos_set_pow_size_memory("-", config->severe_limitation_size_pow, index, array_size_pow);
philos_set_pow_size_memory("-", config->severe_limitation_file_pow, index, array_size_pow);
philos_set_pow_size_memory("-", config->deferring_size_pow, index, array_size_pow);
philos_set_pow_size_memory("-", config->deferring_file_pow, index, array_size_pow);
}
void model_array_size_memory() {
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);
}
void fill_tree_view_u_g_p(struct_gui* config_gui, model_cfg_general* config, int start, int flag_gui_add) {
GtkTreeModel *model = GTK_TREE_MODEL(config_gui->list);
if (flag_gui_add == 0) {
g_object_ref(config_gui->list);
gtk_list_store_clear(config_gui->list);
}
for (int index = start; index < config->size; index++) {
GtkTreeIter iter;
gtk_list_store_append(config_gui->list,&iter);
if (strcmp(config->type_arr, "project") != 0) {
gtk_list_store_set(config_gui->list,&iter,
0,config->name[index],
1,config->quota[index],
2,config->files[index],
3,philos_format_cfg_str_size_memory("", config->soft_restriction_size[index],config->soft_restriction_size_pow[index]),
4,philos_format_cfg_str_size_memory("", config->soft_restriction_file[index],config->soft_restriction_file_pow[index]),
5,philos_format_cfg_str_size_memory("", config->severe_limitation_size[index],config->severe_limitation_size_pow[index]),
6,philos_format_cfg_str_size_memory("", config->severe_limitation_file[index], config->severe_limitation_file_pow[index]),
7,philos_format_cfg_str_size_memory("", config->deferring_size[index], config->deferring_size_pow[index]),
8,philos_format_cfg_str_size_memory("", config->deferring_file[index], config->deferring_file_pow[index]),
-1);
}
else {
gtk_list_store_set(config_gui->list,&iter,
0,config->id[index]
1,config->name[index],
2,config->quota[index],
3,config->files[index],
4,philos_format_cfg_str_size_memory("", config->soft_restriction_size[index],config->soft_restriction_size_pow[index]),
5,philos_format_cfg_str_size_memory("", config->soft_restriction_file[index],config->soft_restriction_file_pow[index]),
6,philos_format_cfg_str_size_memory("", config->severe_limitation_size[index],config->severe_limitation_size_pow[index]),
7,philos_format_cfg_str_size_memory("", config->severe_limitation_file[index], config->severe_limitation_file_pow[index]),
8,philos_format_cfg_str_size_memory("", config->deferring_size[index], config->deferring_size_pow[index]),
9,philos_format_cfg_str_size_memory("", config->deferring_file[index], config->deferring_file_pow[index]),
-1);
}
}
if (flag_gui_add != 0) {
gtk_tree_view_set_model(GTK_TREE_VIEW(widgets->treeViewMain), model);
}
}
void fill_tree_view_u_g_p(struct_gui* config_gui, model_cfg_general* config, int start,int flag_gui_add) {
GtkTreeModel *model = GTK_TREE_MODEL(config_gui->list);
if (flag_gui_add == 0) {
g_object_ref(config_gui->list);
gtk_list_store_clear(config_gui->list);
}
for (int index = start; index < config->size; index++) {
GtkTreeIter iter;
gtk_list_store_append(config_gui->list,&iter);
if (strcmp(config->type_arr, "project") != 0) {
gtk_list_store_set(config_gui->list,&iter, -1);
}
}
if (flag_gui_add != 0) {
gtk_tree_view_set_model(GTK_TREE_VIEW(widgets->treeViewMain), model);
}
}

@ -0,0 +1,43 @@
#include "ubl-utils.h"
#include "ubl-strings.h"
#include "model.h"
static char** array_size_pow = NULL;
struct model_cfg_u_g_p {
char* type_arr;
int* id;
char** name;
char** quota;
char** size_memory;
char** files;
int* soft_restriction_size;
int* soft_restriction_file;
int* severe_limitation_size;
int* severe_limitation_file;
int* deferring_size;
int* deferring_file;
int* size_memory_pow;
int* soft_restriction_size_pow;
int* soft_restriction_file_pow;
int* severe_limitation_size_pow;
int* severe_limitation_file_pow;
int* deferring_size_pow;
int* deferring_file_pow;
char** device;
size_t size;
int flag_set_data;
int flag_save;
int flag_load;
};
struct model_cfg_general{
int *flag_status;
}
struct struct_gui {
int flag_load;
}

@ -0,0 +1,50 @@
#include "my_device.h"
device_config obj_device_config;
device_config* get_device_cfg() {
return &obj_device_config;
}
void device_disk_parsed() {
char* cmd = "lsblk --fs --raw --output PATH,FSTYPE --exclude 7,11,253";
int size = 0;
char** responce = yon_config_load(cmd, &size);
obj_device_config.size_disk = 0;
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) {
char* name_disk = yon_char_divide_search(disk, " ", -1);
obj_device_config.name_disk = yon_char_parsed_append(obj_device_config.name_disk, &obj_device_config.size_disk, name_disk);
obj_device_config.size_disk--;
obj_device_config.file_system = yon_char_parsed_append(obj_device_config.file_system, &obj_device_config.size_disk, disk);
obj_device_config.size_disk--;
obj_device_config.mounted = yon_char_parsed_append(obj_device_config.mounted, &obj_device_config.size_disk, "");
obj_device_config.size_disk--;
obj_device_config.type_dick = yon_char_parsed_append(obj_device_config.type_dick, &obj_device_config.size_disk, "");
obj_device_config.size_disk--;
disk = yon_char_replace(disk," ", "");
if (strlen(disk)!=0) {
char* description_disk = yon_char_unite(name_disk,
split_simvol,
disk,
NULL);
obj_device_config.description_disk = yon_char_parsed_append(obj_device_config.description_disk, &obj_device_config.size_disk, description_disk);
free(description_disk);
}
free(name_disk);
}
free(disk);
}
philos_free_string_array(&responce, size);
}
void device_fill_disk(GtkWidget* combo_box_text) {
for (int index = 0; index < obj_device_config.size_disk; index++) {
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box_text), obj_device_config.description_disk[index]);
}
}

@ -0,0 +1,24 @@
#ifndef MY_DEVICE_H
#define MY_DEVICE_H
#include "ubl-utils.h"
#include <locale.h>
#include <stdio.h>
#include <unistd.h>
#include "philos_utils.h"
typedef struct {
char** name_disk;
char** file_system;
char** mounted;
char** type_dick;
char** description_disk;
int size_disk;
} device_config;
void device_disk_parsed();
device_config* get_device_cfg();
void device_fill_disk(GtkWidget* combo_box_text);
size_t get_mem_total();
float get_size_pow_memory(size_t size_memory, int size);
size_t get_resurs_total(char* cmd);
#endif

File diff suppressed because it is too large Load Diff

@ -0,0 +1,120 @@
#ifndef PHILOS_UTILS_H
#define PHILOS_UTILS_H
#include "ubl-utils.h"
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <pthread.h>
#include <string.h>
#include <dirent.h>
#include <locale.h>
#include <gtk/gtk.h>
#include <gtk/gtkx.h>
#include <vte/vte.h>
#include <pwd.h>
#include <stdbool.h>
#include "my_device.h"
#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* entryTempCmd;
GtkWidget* chbTempRead;
GtkWidget* spinTempRead;
GtkWidget* cbtTempRead;
GtkWidget* chbTempWrite;
GtkWidget* spinTempWrite;
GtkWidget* cbtTempWrite;
GtkWidget* chkSoftRestrictionTemp;
GtkWidget* spiSevereRestrictionTemp;
GtkWidget* cmSevereRestrictionTemp;
GtkWidget* chkSevereRestrictionTemp;
GtkWidget* spinSevereRestrictionTemp;
GtkWidget* cmbSevereRestrictionTemp;
GtkWidget* chkPaddingFLTemp;
GtkWidget* spinPaddingFLTemp;
GtkWidget* cmbPaddingFLTemp;
GtkWidget* chkCPULimitTemp;
GtkWidget* spinCPULimitTemp;
GtkWidget* lblCPULimitTemp;
GtkWidget* cbtTempDevice;
GtkWidget* cbxTempQuotaObj;
GtkWidget* cbxTempQuotaLevel2;
GtkWidget* boxBlockGui;
} temp_set_window;
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,int index, 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);
config_str philos_list_group(int* size);
unsigned short philos_read_uid_min_max(char* filename, char* search);
config_str philos_list_user(int* size);
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_set_pow_size_memory_device(char* str_find, int** array_size,int index, char** array_size_pow);
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, int flag_cpu, char* cmd);
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);
static void child_ready(VteTerminal *terminal, GPid pid, GError *error, gpointer user_data);
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);
#endif

@ -1,7 +1,4 @@
#include "ubl-utils.h"
static dictionary* __yon__config__strings = NULL;
#define check_config if(__yon__config__strings&&__yon__config__strings->data_type==DICTIONARY_CHAR_TYPE)
// dictionary functions
@ -11,12 +8,9 @@ static dictionary* __yon__config__strings = NULL;
* [RU]
* Создаёт и возвращает пустой словарь.
*/
dictionary *yon_dictionary_new()
{
dictionary *dict = (dictionary *)malloc(sizeof(dictionary));
dictionary *dict = malloc(sizeof(dictionary));
dict->data = NULL;
dict->key = NULL;
dict->next = NULL;
@ -26,7 +20,7 @@ dictionary *yon_dictionary_new()
return dict;
}
/**yon_dictionary_copy_deep(dictionary *dict)
/**yon_dictionary_copy(dictionary *dict)
* [EN]
*
* [RU]
@ -35,7 +29,6 @@ dictionary *yon_dictionary_new()
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)
@ -54,20 +47,44 @@ dictionary *yon_dictionary_copy_deep(dictionary *dict){
return newone->first;
}
void yon_dictionary_set_data(dictionary *dict, void *data){
/**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;
}
void yon_dictionary_set_key(dictionary *dict, char *key){
/**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;
}
void yon_dictionary_set(dictionary *dict, char *key, void *data){
/** 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;
}
void yon_dictionary_empty(dictionary *dict){
/**int yon_dictionary_empty(dictionary *dict)
* [EN]
*
* [RU]
* Очищает элемент словаря [dict] от данных
*/
int yon_dictionary_empty(dictionary *dict){
dict->data=NULL;
dict->data_type=DICTIONARY_OTHER_TYPE;
}
@ -224,7 +241,6 @@ dictionary *yon_dictionary_swap(dictionary *dict, int aim)
}
}
}
return dict;
}
/**yon_dictionary_make_first(dictionary *dict)
@ -426,7 +442,7 @@ char *yon_char_append(char *source, char *append)
if (source && append)
{
int size = strlen(source) + strlen(append) + 1;
char *final = (char*)malloc(size);
char *final = malloc(size);
memset(final, 0, size);
if (strstr(source, "%%"))
sprintf(final, source, append);
@ -445,7 +461,7 @@ char *yon_char_append(char *source, char *append)
char *yon_char_new(char *chr)
{
if (chr){
char *newchar = (char*)malloc(strlen(chr) + 1);
char *newchar = malloc(strlen(chr) + 1);
memset(newchar, 0, strlen(chr) + 1);
memcpy(newchar, chr, strlen(chr));
return newchar;
@ -453,8 +469,12 @@ char *yon_char_new(char *chr)
return NULL;
}
// char *yon_char_unite(char *source, ...)
/**yon_char_unite(char *source, ...)
* [En]
*
* [RU]
* Объединяет строку [source] со всеми строками, написанными в [...]
*/
char *yon_char_unite(char *source, ...){
va_list arglist;
char *new_char=NULL;
@ -477,7 +497,7 @@ char *yon_char_unite(char *source, ...){
char *yon_cut(char *source, int size, int startpos)
{
char *cut = NULL;
cut = (char*)malloc(size + 1);
cut = malloc(size + 1);
memset(cut, 0, size + 1);
memcpy(cut, source + startpos, size);
return cut;
@ -491,10 +511,10 @@ char *yon_cut(char *source, int size, int startpos)
*/
char *yon_char_divide(char *source, int dividepos)
{
char *cut = (char*)malloc(dividepos + 1);
char *cut = malloc(dividepos + 1);
memset(cut, 0, dividepos + 1);
memcpy(cut, source, dividepos);
char *left = (char*)malloc(strlen(source) - strlen(cut));
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));
@ -502,11 +522,18 @@ char *yon_char_divide(char *source, int dividepos)
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=yon_char_new(source);
int i=0;
int size=0;
config_str rtn = yon_char_parse(working_string,&size,(char*)"\n");
int pos=0;
config_str rtn = yon_char_parse(working_string,&size,"\n");
for (int j=0;j<size;j++){
if(strstr(rtn[j],find))
i++;
@ -535,7 +562,6 @@ int yon_char_find_count(char *source, char *find){
*/
char *yon_char_divide_search(char *source, char *dividepos, int delete_divider)
{
if (delete_divider) {}
if (source&&dividepos){
char *cut = strstr(source, dividepos);
if (cut)
@ -547,7 +573,6 @@ char *yon_char_divide_search(char *source, char *dividepos, int delete_divider)
else
return source;
}
return source;
}
/**yon_char_from_int(int int_to_convert)
@ -567,7 +592,7 @@ char *yon_char_from_int(int int_to_convert)
{
convert_check = convert_check / 10;
}
char *ch = (char*)g_malloc0(i * sizeof(char) + 1);
char *ch = g_malloc0(i * sizeof(char) + 1);
sprintf(ch, "%d", int_to_convert);
return ch;
}
@ -583,7 +608,7 @@ char *yon_char_replace(char *source, char *find, char*replace){
char *temp=NULL;
if(!strstr(replace,find)){
while ((final=strstr(source,find))){
temp=(char*)malloc(strlen(source)-strlen(final));
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);
@ -591,11 +616,10 @@ char *yon_char_replace(char *source, char *find, char*replace){
}
return source;
}
return source;
}
/**[EN]
* char **yon_char_parse(char *parameters, int *size, char *divider)
/**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
@ -603,16 +627,16 @@ char *yon_char_replace(char *source, char *find, char*replace){
char **yon_char_parse(char *parameters, int *size, char *divider){
char **string=NULL;
int i=1;
string=(char**)malloc(sizeof(char*));
string=malloc(sizeof(char*));
char *paramline=yon_char_new(parameters);
char *param;
while ((param=yon_char_divide_search(paramline,divider,1))){
string=(char**)realloc(string,sizeof(char*)*i);
string=realloc(string,sizeof(char*)*i);
string[i-1]=yon_char_new(param);
i++;
if (strcmp(param,paramline)==0) break;
}
string=(char**)realloc(string,sizeof(char*)*i);
string=realloc(string,sizeof(char*)*i);
string[i-1]=yon_char_new(paramline);
i++;
// printf("%d\n",i);
@ -630,7 +654,7 @@ char **yon_char_parse(char *parameters, int *size, char *divider){
*/
char **yon_char_parsed_rip(char **char_string, int *size, int item_to_delete){
char **new_char_parsed=NULL;
new_char_parsed=(char**)malloc(sizeof(char*)*((*size)-1));
new_char_parsed=malloc(sizeof(char*)*((*size)-1));
int flag = 0;
for (int i=0;i < (*size);i++){
if (i==item_to_delete) {
@ -703,7 +727,7 @@ config_str yon_char_parsed_new (int *size, ...){
char *newparse = va_arg(arglist,char*);
while (newparse){
new_size++;
new_parsed=(char**)realloc(new_parsed,new_size*sizeof(char*));
new_parsed=realloc(new_parsed,new_size*sizeof(char*));
new_parsed[new_size-1]=yon_char_new(newparse);
newparse=va_arg(arglist,char*);
}
@ -712,6 +736,12 @@ config_str yon_char_parsed_new (int *size, ...){
return new_parsed;
}
/**yon_char_parsed_copy(config_str *source, config_str *to_copy)
* [EN]
*
* [RU]
* Копирует массив строк [to_copy] в [source]
*/
void yon_char_parsed_copy(config_str *source, config_str *to_copy){
if (source&&!*source&&to_copy&&*to_copy){
int size=0;
@ -730,18 +760,30 @@ void yon_char_parsed_copy(config_str *source, config_str *to_copy){
* Добавляет строку [string] в конец массива строк [parsed] с длинной [size].
*/
config_str yon_char_parsed_append(config_str parsed, int *size, char *string){
config_str new_parsed=(char**)realloc(parsed,(*size+1)*sizeof(char*));
config_str new_parsed=realloc(parsed,(*size+1)*sizeof(char*));
new_parsed[(*size)]=yon_char_new(string);
(*size)++;
return new_parsed;
}
/**yon_ubl_check_root()
* [EN]
*
* [RU]
* Возвращает 1 если приложение было запущено от root
*/
int yon_ubl_check_root(){
if (getuid()==0) return 1;
else return 0;
}
/**yon_ubl_root_user_get()
* [EN]
*
* [RU]
* Возвращает имя пользователя.
* Если пользователь запустил приложение через root, выводится имя пользователя, запустившего приложение через root
*/
char *yon_ubl_root_user_get(){
char *user=NULL;
if (yon_ubl_check_root()){
@ -750,9 +792,9 @@ char *yon_ubl_root_user_get(){
return user;
}else {
FILE *file = popen("getent passwd $PKEXEC_UID | cut -d: -f1","r");
user=(char*)g_malloc0(4096);
if (fgets(user,4096,file)) {}
user=yon_char_divide_search(user,(char*)"\n",-1);
user=g_malloc0(4096);
fgets(user,4096,file);
user=yon_char_divide_search(user,"\n",-1);
if (user) return user;
}
}
@ -762,89 +804,90 @@ char *yon_ubl_root_user_get(){
// parsing functions
// apps *yon_apps_scan_and_parse_desktops(int *sizef)
// {
// int size = 0;
// struct apps *applist;
// {
// DIR *directory = opendir((char*)DesktopPath);
// struct dirent *de;
// while ((de = readdir(directory)))
// {
// char *path = yon_char_append((char*)DesktopPath, de->d_name);
// 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;
// };
apps *yon_apps_scan_and_parse_desktops(int *sizef)
{
int size = 0;
struct apps *applist;
{
DIR *directory = opendir(DesktopPath);
struct dirent *de;
while ((de = readdir(directory)))
{
FILE *file;
char *path = yon_char_append(DesktopPath, de->d_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)
{
@ -885,21 +928,21 @@ apps *yon_apps_get_by_name(apps *applist, char *name, int size)
* Выполняет команду [command].
* Полученные данные парсятся и регистрируются в конфиг.
*/
int yon_config_load_register(char *command){
if (__yon__config__strings){
__yon__config__strings = (dictionary *)yon_dictionary_free_all(__yon__config__strings,NULL);
__yon__config__strings = yon_dictionary_free_all(__yon__config__strings,NULL);
}
FILE *output = popen(command, "r");
//char **output_strings = (char **)malloc(sizeof(char));
// int i = 0;
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,(char*)"=",-1);
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;
}
@ -958,7 +1001,7 @@ int yon_config_remove_element(char *key, char *deleted){
char *data = (char*)dict->data;
char *found = strstr(data,deleted);
int size=strlen(data)-strlen(found)+1;
char *new_data = (char*)malloc(size);
char *new_data = malloc(size);
memset(new_data,0,size);
if (strlen(found)!=strlen(deleted)){
memcpy(new_data,data,size-1);
@ -1033,7 +1076,7 @@ int yon_config_set(char *key, void *data){
*/
int yon_config_clean(){
check_config{
__yon__config__strings = (dictionary *)yon_dictionary_free_all(__yon__config__strings, NULL);
__yon__config__strings = yon_dictionary_free_all(__yon__config__strings, NULL);
return 1;
}
else return 0;
@ -1062,7 +1105,7 @@ void yon_config_register(char *key, void *data){
config_str yon_config_load(char *command, int *str_len){
FILE *output = popen(command, "r");
char **output_strings = NULL;
output_strings = (char**)malloc(sizeof(char));
output_strings = malloc(sizeof(char));
int i = 0;
char str[4096];
memset(str, 0, 4096);
@ -1070,7 +1113,7 @@ config_str yon_config_load(char *command, int *str_len){
{
if (strcmp(str, "") != 0)
{
output_strings = (char**)realloc(output_strings, sizeof(char *) * (i + 1));
output_strings = realloc(output_strings, sizeof(char *) * (i + 1));
// printf("%s\n", str);
output_strings[i] = NULL;
output_strings[i] = yon_char_new(str);
@ -1094,54 +1137,41 @@ config_str yon_config_load(char *command, int *str_len){
* Выполняет команду [command], добавляя в конец все записи конфига в таком виде:
* [ПАРАМЕТР1]="[значения1]" [ПАРАМЕТР2]="[значения2]"
*/
int yon_config_save(char *command){
int yon_config_save_registered(char *command){
check_config{
dictionary *dict = NULL;
for_dictionaries(dict,__yon__config__strings){
command = yon_char_unite(command, (char*)" ", yon_dictionary_get_data(dict,char*), NULL);
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){
// if (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;
// }
/**[EN]
* int yon_config_save(char *command)
* Saves config with [command]
/**yon_config_get_all(int *size)
* [EN]
*
* [RU]
* Выполняет команду [command]
* Возвращает массив со всеми параметрами конфига, оканчивающаяся NULL
* [size] - указатель, в который выгружается длина массива
*/
// int yon_config_save(char *command)
// {
// FILE *output = popen(command, "r");
// return 1;
// }
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 parameter" "s, int size, char *param)
/**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
@ -1152,19 +1182,19 @@ int yon_config_save(char *command){
char *yon_config_get_parameter(config_str parameters, int size, char *param)
{
if (param[0]==' ')
yon_char_divide_search(param,(char*)" ",-1);
param=yon_char_divide_search(yon_char_new(param),(char*)" ",-1);
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]), (char*)"=", 1);
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]), (char*)"\n", 1);
if (strcmp(str, "") != 0 && strcmp(str, (char*)"(null)") != 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;
@ -1184,13 +1214,13 @@ char *yon_config_get_parameter(config_str parameters, int size, char *param)
* [RU]
* Выполнить команду [command] в отдельном потоке;
*/
void yon_launch_app_with_arguments(char *name, char *args)
int yon_launch_app_with_arguments(char *name, char *args)
{
char *path = yon_char_unite((char*)"/usr/bin/", name, (char*)" ", args,NULL);
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* (*)(void *))yon_launch, command);
pthread_create(&thread_id, NULL, (void *)yon_launch, command);
};
/**yon_launch(char *command)
@ -1199,10 +1229,9 @@ void yon_launch_app_with_arguments(char *name, char *args)
* [RU]
* Выполнить команду [command]
*/
void* yon_launch(void *command)
void yon_launch(char *command)
{
if (system((char*)command)){}
return NULL;
system(command);
}
// Gtk functions
@ -1332,8 +1361,11 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end
gtk_widget_show_all(terminal);
}
#endif
// Window config functions
#define check_window_config_setup if(__yon_window_config_target_window)
struct {
int x;
int y;
@ -1341,6 +1373,7 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end
int height;
int fullscreen;
} __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;
@ -1359,9 +1392,13 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end
__yon_main_window_config.fullscreen = gtk_window_is_maximized(__yon_window_config_target_window);
}
/**yon_on_configured_window_destroy(GtkWidget* self,GdkEvent* event)
* [EN]
*
* [RU]
* Сохраняет настройки основного окна. Вызывается когда основное окно уничтожается.
*/
void yon_on_configured_window_destroy(GtkWidget* self,GdkEvent* event){
if (self && event){}
check_window_config_setup{
yon_get_is_fullscreen();
yon_window_config_save();
@ -1378,26 +1415,36 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end
}
}
/**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){
if (data){}
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);
return NULL;
}
/**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*)"/");
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);
@ -1417,16 +1464,53 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end
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,&_yon_maximize,NULL);
pthread_create(&tid,NULL,(void *)_yon_maximize,NULL);
return 1;
}
void yon_window_config_apply(){
// dictionary *dict=NULL;
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);
}
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&&parameters){
for (int i=0;i<size;i++){
@ -1437,10 +1521,16 @@ int yon_gtk_combo_box_text_fill(GtkWidget *combo, config_str parameters,int size
return 0;
}
/*
/**yon_gtk_combo_box_text_find(GtkWidget *combo_box, char *text_to_find)
* [EN]
*
* [RU]
* Проивзодит поиск по GtkComboBoxText [combo_box]
* возвращает 1 если элемент [text_to_find] найден, иначе возвращает 0
*/
int yon_gtk_combo_box_text_find(GtkWidget *combo_box, char *text_to_find){
if (combo_box&&text_to_find){
// int active=gtk_combo_box_get_active(GTK_COMBO_BOX(combo_box));
int active=gtk_combo_box_get_active(GTK_COMBO_BOX(combo_box));
char *str="-1";
for (int i=0;strcmp(str,"")!=0;i++){
gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box),i);
@ -1450,13 +1540,12 @@ int yon_gtk_combo_box_text_find(GtkWidget *combo_box, char *text_to_find){
}
} return -1;
}
*/
/**yon_dictionary_gtk_pack_start_multiple_widgets(GtkBox *destination, gboolean expand, gboolean fill, int padding, ...)
* [EN]
*
* [RU]
* Добвляет в [destination] все виджеты, прописанные после [padding]
* Добвляет [destination] все виджеты, прописанные после [padding]. Добавление происходит с начала контейнера.
* [expand] - расширяемость выделенного для виджетов места
* [fill] - заполнять ли виджетом всё ему выделенное место
* [padding] - отступ од других элементов
@ -1472,6 +1561,15 @@ int yon_dictionary_gtk_pack_start_multiple_widgets(GtkBox *destination, gboolean
return 1;
}
/**yon_dictionary_gtk_pack_end_multiple_widgets(GtkBox *destination, gboolean expand, gboolean fill, int padding, ...)
* [EN]
*
* [RU]
* Добвляет в [destination] все виджеты, прописанные после [padding]. Добавление происходит с конца контейнера.
* [expand] - расширяемость выделенного для виджетов места
* [fill] - заполнять ли виджетом всё ему выделенное место
* [padding] - отступ од других элементов
*/
int yon_dictionary_gtk_pack_end_multiple_widgets(GtkBox *destination, gboolean expand, gboolean fill, int padding, ...){
va_list args;
va_start(args,padding);
@ -1496,7 +1594,6 @@ void _yon_ubl_header_setup_resource(GtkWidget *Overlay, GtkWidget *Head, GtkWidg
gtk_image_set_from_resource(GTK_IMAGE(Image), image_path);
}
int yon_ubl_status_box_setup(GtkWidget *icon, GtkWidget *box, GtkWidget *label)
{
if(icon&&box&&label){
@ -1651,13 +1748,12 @@ void yon_ubl_browser_window_open(char *link, char *browser_window_name){
* [browser_window_name] не используется. Нужна для совместимости с webkit версией этой функции.
*/
void yon_ubl_browser_window_open(char *link, char *browser_window_name){
if (browser_window_name) {}
char *user=getenv("SUDO_USER");
if (!user)
user=getlogin();
char *command=yon_char_unite((char*)"sudo -u ",user,(char*)" xdg-open ", link,NULL);
yon_launch(command);
char *command=yon_char_unite("sudo -u ",user," xdg-open ", link,NULL);
yon_launch_app(command);
}
#endif
#endif
#endif

@ -1,10 +1,7 @@
#ifndef UBL_UTILS
#define UBL_UTILS
#include <stdio.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <pthread.h>
@ -16,8 +13,7 @@
#include <gtk/gtk.h>
#include <gtk/gtkx.h>
#include "../../ubl-cmake.h"
#include "../ubl-cmake.h"
#ifdef WEBKIT_FOUND
#include <webkit2/webkit2.h>
#endif
@ -25,7 +21,7 @@
#define for_dictionaries(obj, obj1) for (obj = obj1->first; obj != NULL; obj = obj->next)
//#define new(type) malloc(sizeof(type))
#define new(type) malloc(sizeof(type))
#define new_arr(type,size) malloc(sizeof(type)*size)
@ -65,6 +61,8 @@ typedef struct 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)
@ -97,20 +95,6 @@ typedef char** config_str;
dictionary *yon_dictionary_new();
dictionary *yon_dictinoary_copy(dictionary *dict);
dictionary *yon_dictionary_copy_deep(dictionary *dict);
void yon_dictionary_set_data(dictionary *dict, void *data);
void yon_dictionary_set_key(dictionary *dict, char *key);
void yon_dictionary_set(dictionary *dict, char *key, void *data);
void yon_dictionary_empty(dictionary *dict);
void yon_dictionary_switch_to_last(dictionary **dict);
dictionary *yon_dictionary_append(dictionary *targetdict);
dictionary *yon_dictionary_get_last(dictionary *dict);
@ -185,7 +169,7 @@ 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(char *command);
int yon_config_save_registered(char *command);
char *yon_config_get_parameter(config_str parameters, int size, char *param);
@ -211,9 +195,9 @@ config_str yon_config_get_all();
// terminal-using functions
void yon_launch_app_with_arguments(char *name, char *args);
int yon_launch_app_with_arguments(char *name, char *args);
void* yon_launch(void *command);
void yon_launch(char *command);
// Gtk functions
@ -223,19 +207,11 @@ void yon_terminal_integrated_launch(GtkWidget *place_to_show, char* command, voi
void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *endwork_function, void* endwork_function_argument);
#endif
GtkWidget *yon_ubl_menu_item_about_new(char *buttonname);
GtkWidget *yon_ubl_menu_item_documentation_new(char *buttonname);
void __yon_window_config_on_resize();
void yon_get_is_fullscreen();
void yon_on_configured_window_destroy(GtkWidget* self,GdkEvent* event);
#endif
void yon_on_configured_window_destroy(GtkWidget* self,GdkEvent* event);
void yon_window_config_save();
void __yon_window_config_on_resize();
void yon_get_is_fullscreen();
/**yon_gtk_builder_get_widget(builder, widget_name)
* [EN]
* Returns GtkWidget from GtkBuilder *[builder].
@ -254,14 +230,8 @@ typedef struct
void yon_window_config_setup(GtkWindow *window);
void* _yon_maximize(void *data);
void yon_window_config_apply();
int yon_window_config_load(char *path);
int yon_gtk_combo_box_text_fill(GtkWidget *combo, config_str parameters,int size);
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);
@ -318,9 +288,6 @@ int yon_ubl_status_box_setup(GtkWidget *icon, GtkWidget *box, GtkWidget *label);
* или
* BACKGROUND_IMAGE_SUCCESS_TYPE (Жёлтный фон, иконка - галка)
*/
void _yon_ubl_status_box_render(char *text, BACKGROUND_IMAGE_TYPE type);
void yon_ubl_status_box_render(char *text, BACKGROUND_IMAGE_TYPE type);
#ifdef __cplusplus
@ -372,4 +339,4 @@ void yon_ubl_browser_window_open(char *link, char *browser_window_name);
void yon_ubl_browser_window_open(char *link, char *browser_window_name);
#endif
#endif
#endif
#endif

@ -20,7 +20,7 @@ void on_close_subwindow(GtkWidget *self){
* [RU]
* Открывает браузер с [link] ссылкой.
*/
void yon_open_browser(GtkWidget *, char *link){
void yon_open_browser(GtkWidget *self, char *link){
yon_ubl_browser_window_open(link,TITLE_LABEL);
}
@ -33,7 +33,7 @@ void yon_open_browser(GtkWidget *, char *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 = (documentation_confirmation_window*)malloc(sizeof(documentation_confirmation_window));
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");
@ -72,7 +72,7 @@ void on_open_documentation_confirmation(GtkWidget *self, char *link){
* [uri] - ссылка, по которой совершается переход;
* [user_data] - указатель на любые другие данные, не используется в стандартном обработчике;
*/
void on_link(GtkWidget *self, char* uri, gpointer){
void on_link(GtkWidget *self, char* uri, gpointer user_data){
gtk_widget_destroy(self);
on_open_documentation_confirmation(self,uri);
}
@ -130,7 +130,7 @@ void config_init(){
main_window *setup_window(){
/* Widgets getting | Получение виджетов */
main_window *widgets = (main_window*)malloc(sizeof(main_window));
main_window *widgets = malloc(sizeof(main_window));
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path);
widgets->Window = yon_gtk_builder_get_widget(builder,"MainWindow");
widgets->HatLabel = yon_gtk_builder_get_widget(builder,"headerTopic");
@ -157,9 +157,13 @@ main_window *setup_window(){
widgets->LoadLocalMenuItem = yon_gtk_builder_get_widget(builder,"LoadLocalConfigurationMenuItem");
widgets->LeftBox = yon_gtk_builder_get_widget(builder,"HeaderLeftBox");
widgets->DocumentationMenuItem = yon_gtk_builder_get_widget(builder,"DocumentationMenuItem");
widgets->AboutMenuItem = yon_gtk_builder_get_widget(builder,"AboutMenuItem");
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);
}
@ -173,128 +177,12 @@ main_window *setup_window(){
}
/* Signal connection | Присоединение сигналов */
event(widgets);
gtk_widget_show(widgets->Window);
return widgets;
}
void event(main_window *widgets) {
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),(char*)WIKI_LINK);
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);
//g_signal_connect(G_OBJECT(widgets->btnShowFilters),"clicked",G_CALLBACK(wrapper_filters_show), NULL);
}
/*
void main_visible_columns(main_window *widgets) {
gboolean *flags_filters = filters_get_flag();
gtk_tree_view_column_set_visible(widgets->tvc0, flags_filters[0]);
gtk_tree_view_column_set_visible(widgets->tvc1, flags_filters[1]);
gtk_tree_view_column_set_visible(widgets->tvc2, flags_filters[2]);
gtk_tree_view_column_set_visible(widgets->tvc3, flags_filters[3]);
gtk_tree_view_column_set_visible(widgets->tvc4, flags_filters[4]);
gtk_tree_view_column_set_visible(widgets->tvc5, flags_filters[5]);
gtk_tree_view_column_set_visible(widgets->tvc6, flags_filters[6]);
gtk_tree_view_column_set_visible(widgets->tvc7, flags_filters[7]);
filters_on_hide_subwindow(self);
}
void wrapper_filters_show(GtkWidget *self) {
filters_show(self, glade_path);
g_signal_connect(G_OBJECT(get_widget_filters()->btnFiltersSave),"clicked",G_CALLBACK(main_visible_columns), NULL);
}
*/
int main(int argc, char *argv[]){
config_path = yon_char_unite((char*)"/home",yon_ubl_root_user_get(),(char*)"/.config/",LocaleName,(char*)"/",LocaleName,(char*)".conf",NULL);
local=setlocale(LC_ALL, "");
textdomain (LocaleName);
config_init();
int option_index=0;
int show_help=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;i<argc;i++){
int argument=getopt_long(argc,argv,"hVvs:e:t:d",long_options,&option_index);
switch(argument){
case 'h':
show_help=1;
break;
case 'v':
case 'V':
printf("%s\n",VERSION_LABEL);
exit(0);
break;
case 's':
if(optarg)
main_config.socket_id=atoi(optarg);
break;
case 'e':
if(optarg)
main_config.load_socket_id=atoi(optarg);
break;
case 't':
if(optarg)
main_config.save_socket_id=atoi(optarg);
break;
case 1:
main_config.lock_help=1;
break;
case 2:
main_config.lock_save_local=1;
main_config.lock_save_global=1;
break;
case 3:
main_config.lock_save_local=1;
break;
case 4:
main_config.lock_save_global=1;
break;
case 5:
main_config.lock_load_global=1;
break;
}
}
if (show_help==1&&main_config.lock_help!=1){
printf("%s\n",HELP_LABEL);
exit(0);
}
}
if (getuid()!=0){
main_config.lock_load_global=1;
main_config.lock_save_global=1;
main_config.lock_save_local=1;
}
gtk_init(&argc,&argv);
main_window *widgets = setup_window();
_yon_ubl_header_setup_resource(GTK_WIDGET(widgets->HeadOverlay),GTK_WIDGET(widgets->HeadBox),GTK_WIDGET(widgets->HeadImage),(char*)banner_path);
yon_ubl_status_box_setup(widgets->StatusIcon,widgets->StatusBox,widgets->StatusLabel);
if (getuid()!=0)
yon_ubl_status_box_render(TITLE_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
else
yon_ubl_status_box_render(TITLE_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
yon_ubl_setup_sockets(widgets->PlugBox,widgets->LeftBox,widgets->RightBox,main_config.socket_id,main_config.load_socket_id,main_config.save_socket_id);
yon_window_config_setup(GTK_WINDOW(widgets->Window));
yon_window_config_load((char*)config_path.c_str());
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);
gtk_main();
gtk_widget_show(widgets->Window);
return widgets;
}

@ -1,9 +1,6 @@
#include <gtk/gtk.h>
#include <gtk/gtkx.h>
#include <iostream>
#include "view/model/ubl-utils.h"
#include "model/ubl-utils.h"
#include <locale.h>
#include <stdio.h>
#include <unistd.h>
@ -11,10 +8,7 @@
#include <libintl.h>
#include <getopt.h>
#include <libintl.h>
#include <vector>
#include <string.h>
#include "ubl-cmake.h"
using namespace std;
#ifdef WEBKIT_FOUND
#include <webkit2/webkit2.h>
#endif
@ -27,13 +21,12 @@ using namespace std;
#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"
static string config_path;
#define config_path yon_char_unite("/home/",yon_ubl_root_user_get(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL)
#define LocalePath "/usr/share/locale"
#define LocaleName "ubl-settings-diskquota"
char const* version_application="";
typedef char* string;
string version_application;
char *local;
@ -55,6 +48,7 @@ typedef struct {
} config;
typedef struct {
//Standard
GtkWidget *Window;
GtkWidget *HatLabel;
GtkWidget *PlugBox;
@ -82,6 +76,7 @@ typedef struct {
GtkWidget *DocumentationMenuItem;
GtkWidget *AboutMenuItem;
// Custom
} main_window;
@ -97,7 +92,6 @@ typedef struct {
GtkWidget *AcceptButton;
} documentation_confirmation_window;
main_window *setup_window();
void on_about();
void yon_open_browser(GtkWidget *self, char *link);
@ -106,6 +100,6 @@ 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);
int main(int argc, char *argv[]);
void on_link(GtkWidget *self, char* uri, gpointer user_data);
void config_init();

@ -1,8 +1,8 @@
#define VERSION_LABEL yon_char_unite(_("Version:")," ",version_application,"\n",NULL)
#define HELP_LABEL yon_char_unite(_("ubl-settings-diskquota version:")," ", version_application,"\n",_("TEMPLATE settings"),"\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 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 _("TEMPLATE Manager")
#define TITLE_INFO_LABEL _("System TEMPLATE settings management")
#define TITLE_LABEL _("")
#define TITLE_INFO_LABEL _("")
#define SUCCESS_LABEL _("Operation succeeded")
#define ROOT_WARNING_LABEL _("Warning! Application was launched without root - root-dependent actions are locked")
@ -36,4 +36,20 @@
#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 SAVE_FAILED_LABEL
#define SAVE_FAILED_LABEL
#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 --default --target global set security"
#define CMD_SAVE_SYSTEM "ubconfig --default --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 CMD_GET_SLICE_SERVICE "systemd-cgls --no-page"

@ -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<string, string>& Load::get_load_data(std::map <string, string> &map_temp, string cmd) {
string response = "";
string key = "";
string value = "";
response = process.call_all_sections(cmd);
vector<string> vec_str_key_value = Utils::split(response, '\n');
for (const string &param: 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();
}
}

@ -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<string, string>& get_load_data(std::map <string, string> &map_temp, string str_flag_load);
};
}
#endif

@ -1,84 +0,0 @@
#include "my_process.h"
#include "util.h"
namespace My_Process {
#define debug false
struct Utils::Result<string> My_Process_call::call(string cmd) {
this->i_error_old = this->i_error;
struct Utils::Result<string> obj_result;
string response = Utils::call(cmd);
obj_result.response = response;
if ((response.find("(null)") == std::string::npos) && (response.length() != 0 )) {
if (response.find("=") != std::string::npos) {
if (response.find("\n") != std::string::npos) {
response = response.substr(response.find("=")+1,response.length());
response = response.substr(0,response.find("\n"));
obj_result.response = response;
obj_result.error = 0;
}
else {
obj_result.error = 1;
this->i_error += 1;
this->log_mess_error(cmd);
}
}
else {
obj_result.error = 2;
this->i_error += 1;
str_cmd_error = cmd;
this->log_mess_error(cmd);
}
}
else {
obj_result.error = 3;
this->i_error += 1;
str_cmd_error = cmd;
this->log_mess_error(cmd);
}
return obj_result;
}
int My_Process::get_count_error() {
return this->i_error;
}
void My_Process::set_back_count_error() {
this->i_error = this->i_error_old;
}
void My_Process_system::call(string cmd, string thread_str = "") {
string cmd_new = cmd + " " + thread_str;
int response_cmd = system(cmd_new.c_str());
if (response_cmd != 0) {
this->i_error += 1;
}
}
void My_Process::set_count_error(int count_error) {
this->i_error = count_error;
this->str_cmd_error = "";
}
void My_Process::log_mess_error(string) {
}
string My_Process::get_cmd_error() {
return this->str_cmd_error;
}
string My_Process_call::call_all_sections(string cmd) {
char buffer[PATH_MAX] = {0};
std::string result = "";
FILE* pipe = popen(cmd.c_str(), "r");
if (!pipe) throw std::runtime_error("popen() failed!");
try {
while (fgets(buffer, sizeof buffer, pipe) != NULL) {
result += buffer;
}
} catch (...) {
pclose(pipe);
throw;
}
pclose(pipe);
return result;
}
}

@ -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<string> call(string cmd);
string call_all_sections(string cmd);
};
class My_Process_system: public My_Process {
public:
void call(string cmd, string thread_str);
};
}
#endif

@ -1,151 +0,0 @@
#include "save.h"
namespace Lib_save {
vector<string> Save::get_error() {
return this->vec_errors;
}
bool Save::get_state_save() {
return this->flag_no_save;
}
void Save::set_data_global(std::map <string, string> &map_global) {
this->map_global = &map_global;
}
void Save::set_data_local(std::map <string, string> &map_local) {
this->map_local = &map_local;
}
void Save::set_data_gui(std::map <string, string> &map_gui) {
this->map_gui = &map_gui;
}
bool Save::check_save(string flag_save, string key_name) {
std::map <string, string>:: iterator iter_map_data;
std::map <string, string>:: iterator iter_map_data_old;
std::map <string, string> *map_data_old;
if (flag_save == "system") {
map_data_old = map_local;
}
else if (flag_save == "global") {
map_data_old = map_global;
}
iter_map_data = (*map_gui).find(key_name);
iter_map_data_old = (*map_data_old).find(key_name);
if ((*map_local).find(key_name) != (*map_local).end() && (*map_global).find(key_name) != (*map_global).end()) {
if ((*map_local)[key_name] != (*map_global)[key_name]) {
return true;
}
}
if (iter_map_data_old == (*map_data_old).end() && iter_map_data != (*map_gui).end()) {
return true;
}
else if (iter_map_data->second != iter_map_data_old->second) {
return true;
}
else if (iter_map_data->second.length() == 0 && iter_map_data_old->second.length() == 0) {
return false;
}
else if (iter_map_data->second == iter_map_data_old->second) {
return false;
}
else {
return true;
}
return true;
}
int Save::get_count_error() {
return process.get_count_error();
}
string Save::get_cmd_error() {
return process.get_cmd_error();
}
void Save::set_count_error(int count_error) {
process.set_count_error(count_error);
}
void Save::set_vec_params(vector<string>& vec_param_names) {
this->vec_param_names = &vec_param_names;
}
void Save::save(string sections, string str_flag_save) {
string key = "";
string value = "";
string cmd = "";
string str_error = "";
this->flag_no_save = true;
for (const auto &key: *vec_param_names) {
if (map_gui->find(key) != map_gui->end()) {
value = (*map_gui)[key];
if (this->check_save(str_flag_save, key)) {
if (value.length() != 0) {
cmd = "ubconfig --target " + str_flag_save + " set " + sections + " " +
key + "=\"" + value + "\"";
}
else if (value.length() == 0) {
cmd = "ubconfig --target " + str_flag_save + " remove " + sections + " " + key;
}
else {
cmd = "";
}
if (cmd.length() != 0) {
process.call(cmd, "");
this->flag_no_save = false;
str_error = process.get_cmd_error();
if (str_error.length() != 0) {
this->vec_errors.push_back(str_error);
str_error = "";
}
}
}
}
}
}
void Save::save_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 = "";
}
}
}

@ -1,33 +0,0 @@
#ifndef MY_SAVE_H
#define MY_SAVE_H
#include "my_process.h"
namespace Lib_save {
class Save {
private:
std::map <string, string> *map_global;
std::map <string, string> *map_local;
std::map <string, string> *map_gui;
vector<string> vec_errors;
vector<string>* vec_param_names;
My_Process::My_Process_system process = My_Process::My_Process_system();
bool flag_no_save;
void template_save(string cmd);
public:
void set_data_global(std::map <string, string> &map_global);
void set_data_local(std::map <string, string> &map_local);
void set_data_gui(std::map <string, string> &map_gui);
bool check_save(string flag_save, string key_name);
bool get_state_save();
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<string>& vec_param_names);
void save(string sections, string str_flag_save) ;
vector<string> get_error();
};
}
#endif

@ -1,252 +0,0 @@
#include "util.h"
#define yon_gtk_builder_get_widget(builder, widget_name) GTK_WIDGET(gtk_builder_get_object(builder, widget_name))
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<vector<string>, 5> read_csv(const string& filename) {
array<vector<string>, 5> array_vectors;
vector<string> vec_option;
vector<string> 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<int> 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<int> find_all(string &str_ntp, string substr) {
size_t index = 0;
vector<int> 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<std::string> split(std::string text, char delim) {
std::string line;
std::vector<std::string> 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<string> 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<string> 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<string> list_groups() {
string str_uid_min = "UID_MIN";
string str_uid_max = "UID_MAX";
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<string> str_users;
while (1) {
errno = 0;
struct passwd* entry = getpwent();
if (!entry) {
if (errno) {
return str_users;
}
break;
}
if ((entry->pw_uid >= uid_min && entry->pw_uid < uid_max) || entry->pw_uid == 0) {
str_users.push_back(entry->pw_name);
}
}
endpwent();
return str_users;
}
vector<string> pars_group() {
vector<string> 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;
}
}

@ -1,35 +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<typename Type>
struct Result{
Type response;
int error;
};
struct Passwd {
string user;
int uid;
};
string format_str_size(int num, int index);
std::array<std::vector<std::string>, 5> read_csv(const std::string& filename);
std::string call(std::string cmd);
vector<int> find_all(string &str_ntp, string substr);
void str_remove(std::string& source, std::string to_remove);
void str_replace_all(string &str_base, string str_find, string str_replace);
std::vector<std::string> split(std::string text, char delim);
vector <string> pars_users();
int synopsis_show(string str_link);
string file_read(string filename);
unsigned short read_uid_min_max(string filename, string search);
vector<string> pars_users();
vector<string> pars_group();
vector<string> list_groups();
}
#endif

@ -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<string> 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<string> 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:
// Написать функцию
}

@ -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<string> 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<string> 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

@ -1,141 +0,0 @@
#include "view_add_project.h"
#include <vector>
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();
// ector<string> vec_user = pars_users();
}
void View_add_project::load_combo_box_UGP(vector<string> vec_UGP) {
cmbSetNameUGP->remove_all();
for (auto& iter: vec_UGP) {
cmbSetNameUGP->append(iter);
}
}
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::lacalization() {
}
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::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());
}

@ -1,69 +0,0 @@
#ifndef VIEW_ADD_PROJECT_H
#define VIEW_ADD_PROJECT_H
#include "../project_lib.h"
#include "model/util.h"
#include "../var.h"
class View_add_project
{
private:
Glib::RefPtr<Gtk::Builder> 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;
Gtk::ComboBoxText* cmbSetNameUGP;
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 show_file_manager();
void save_file_manager();
void load_combo_box_UGP(vector<string> vec_UGP);
};
#endif

@ -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);
}

@ -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<Gtk::Builder> 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<Gtk::ListStore>* 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<Gtk::ListStore>* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate);
void edit_tree_view_G(Glib::RefPtr<Gtk::ListStore>* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate);
void edit_tree_view_P(Glib::RefPtr<Gtk::ListStore>* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate);
};
#endif

@ -1,116 +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() {
}
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());
}

@ -1,58 +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<Gtk::Builder> 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 close_wnd();
void save();
};
#endif

@ -1,107 +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() {
}
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::set_label_type_quota(string name) {
lblSetUGPUser->set_text(name);
}
void View_edit_user_group::show() {
wndQuotasEditUser->show();
}

@ -1,60 +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<Gtk::Builder> 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 set_label_type_quota(string name);
void lacalization();
};
#endif

Binary file not shown.

@ -53,7 +53,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="buttonBoxHide">
<object class="GtkButtonBox">
<property name="can-focus">False</property>
<property name="layout-style">end</property>
</object>
@ -63,13 +63,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<property name="position">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
<child type="titlebar">
<object class="GtkHeaderBar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="show-close-button">True</property>
<child type="title">
<object class="GtkLabel" id="headerAboutTopic">
<property name="visible">True</property>
@ -79,7 +81,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-bottom">2</property>
<property name="label" translatable="yes">TEMPLATE Manager</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
@ -550,6 +551,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<object class="GtkSpinButton" id="quotegroupSizeSoftLimitSpin">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="width-chars">7</property>
<property name="text" translatable="yes">0</property>
</object>
<packing>
@ -566,6 +568,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<items>
<item translatable="yes">KB</item>
<item translatable="yes">MB</item>
<item translatable="yes">GB</item>
<item translatable="yes">TB</item>
</items>
</object>
<packing>
<property name="expand">False</property>
@ -627,6 +635,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<object class="GtkSpinButton" id="quotegroupSizeHardLimitSpin">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="width-chars">7</property>
<property name="text" translatable="yes">0</property>
</object>
<packing>
@ -643,6 +652,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<items>
<item translatable="yes">KB</item>
<item translatable="yes">MB</item>
<item translatable="yes">GB</item>
<item translatable="yes">TB</item>
</items>
</object>
<packing>
<property name="expand">False</property>
@ -765,6 +780,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<object class="GtkSpinButton" id="quotegroupFilesSoftLimitSpin">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="width-chars">7</property>
<property name="text" translatable="yes">0</property>
</object>
<packing>
@ -838,6 +854,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<object class="GtkSpinButton" id="quotegroupFilesHardLimitSpin">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="width-chars">7</property>
<property name="text" translatable="yes">0</property>
</object>
<packing>
@ -1127,6 +1144,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-top">5</property>
@ -1295,12 +1314,10 @@ translated and supported by community.</property>
<object class="GtkHeaderBar" id="SettingsBar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="show-close-button">True</property>
<child type="title">
<object class="GtkLabel" id="webHeaderNameLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">TEMPLATE Manager</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
@ -1339,28 +1356,6 @@ translated and supported by community.</property>
<property name="can-focus">False</property>
<property name="take-focus">False</property>
<property name="reserve-toggle-size">False</property>
<child>
<object class="GtkMenuItem" id="DocumentationMenuItem">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Documentation</property>
<property name="use-underline">True</property>
<style>
<class name="menuitemtop"/>
</style>
</object>
</child>
<child>
<object class="GtkMenuItem" id="AboutMenuItem">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">About</property>
<style>
<class name="menuitemsolo"/>
<class name="menuitembottom"/>
</style>
</object>
</child>
</object>
<object class="GtkMenu" id="menu3">
<property name="visible">True</property>
@ -1679,7 +1674,7 @@ limitation
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
@ -1841,6 +1836,7 @@ limitation
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="width-chars">4</property>
</object>
<packing>
<property name="expand">False</property>
@ -1888,6 +1884,7 @@ limitation
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="width-chars">4</property>
</object>
<packing>
<property name="expand">False</property>
@ -1948,6 +1945,7 @@ limitation
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="width-chars">4</property>
</object>
<packing>
<property name="expand">False</property>
@ -1995,6 +1993,7 @@ limitation
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="width-chars">4</property>
</object>
<packing>
<property name="expand">False</property>
@ -2055,6 +2054,7 @@ limitation
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="width-chars">4</property>
</object>
<packing>
<property name="expand">False</property>
@ -2102,6 +2102,7 @@ limitation
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="width-chars">4</property>
</object>
<packing>
<property name="expand">False</property>
@ -2162,6 +2163,7 @@ limitation
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="width-chars">4</property>
</object>
<packing>
<property name="expand">False</property>
@ -2209,6 +2211,7 @@ limitation
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="width-chars">4</property>
</object>
<packing>
<property name="expand">False</property>
@ -2380,7 +2383,7 @@ limitation
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
@ -2714,6 +2717,7 @@ limitation
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="width-chars">4</property>
</object>
<packing>
<property name="expand">False</property>
@ -2761,6 +2765,7 @@ limitation
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="width-chars">4</property>
</object>
<packing>
<property name="expand">False</property>
@ -2821,6 +2826,7 @@ limitation
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="width-chars">4</property>
</object>
<packing>
<property name="expand">False</property>
@ -2868,6 +2874,7 @@ limitation
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="width-chars">4</property>
</object>
<packing>
<property name="expand">False</property>
@ -2928,6 +2935,7 @@ limitation
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="width-chars">4</property>
</object>
<packing>
<property name="expand">False</property>
@ -2975,6 +2983,7 @@ limitation
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="width-chars">4</property>
</object>
<packing>
<property name="expand">False</property>
@ -3035,6 +3044,7 @@ limitation
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="width-chars">4</property>
</object>
<packing>
<property name="expand">False</property>
@ -3082,6 +3092,7 @@ limitation
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="width-chars">4</property>
</object>
<packing>
<property name="expand">False</property>
@ -3253,7 +3264,7 @@ limitation
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
@ -3587,6 +3598,7 @@ limitation
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="width-chars">4</property>
</object>
<packing>
<property name="expand">False</property>
@ -3634,6 +3646,7 @@ limitation
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="width-chars">4</property>
</object>
<packing>
<property name="expand">False</property>
@ -3694,6 +3707,7 @@ limitation
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="width-chars">4</property>
</object>
<packing>
<property name="expand">False</property>
@ -3741,6 +3755,7 @@ limitation
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="width-chars">4</property>
</object>
<packing>
<property name="expand">False</property>
@ -3801,6 +3816,7 @@ limitation
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="width-chars">4</property>
</object>
<packing>
<property name="expand">False</property>
@ -3848,6 +3864,7 @@ limitation
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="width-chars">4</property>
</object>
<packing>
<property name="expand">False</property>
@ -3908,6 +3925,7 @@ limitation
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="width-chars">4</property>
</object>
<packing>
<property name="expand">False</property>
@ -3955,6 +3973,7 @@ limitation
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="width-chars">4</property>
</object>
<packing>
<property name="expand">False</property>
@ -4016,7 +4035,7 @@ limitation
<object class="GtkTreeView" id="ProjectQuotasTree">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="model">ListProject</property>
<property name="model">ListGroups</property>
<property name="search-column">0</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
@ -4135,7 +4154,7 @@ limitation
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
@ -4564,35 +4583,6 @@ limitation
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkFileChooserDialog" id="wndChooseFileWallpaper">
<property name="can-focus">False</property>
<property name="title" translatable="yes">Please select File</property>
<property name="modal">True</property>
<property name="window-position">center</property>
<property name="default-width">500</property>
<property name="default-height">400</property>
<property name="destroy-with-parent">True</property>
<property name="icon-name">com.ublinux.ublexec</property>
<property name="type-hint">dialog</property>
<property name="skip-taskbar-hint">True</property>
<property name="urgency-hint">True</property>
<property name="action">select-folder</property>
<child internal-child="vbox">
<object class="GtkBox">
<property name="can-focus">False</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can-focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkWindow" id="wndFilters">
<property name="can-focus">False</property>
<property name="valign">start</property>
@ -4810,6 +4800,7 @@ limitation
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="halign">start</property>
<property name="draw-indicator">True</property>
</object>
<packing>
@ -5112,6 +5103,7 @@ limitation
<child>
<object class="GtkButton" id="btnGenerateProject">
<property name="label" translatable="yes">Generate</property>
<property name="related-action"/>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
@ -5279,6 +5271,7 @@ limitation
<object class="GtkSpinButton" id="quotegroupSizeSoftLimitSpinProject">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="width-chars">7</property>
<property name="text" translatable="yes">0</property>
</object>
<packing>
@ -5295,6 +5288,12 @@ limitation
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<items>
<item translatable="yes">KB</item>
<item translatable="yes">MB</item>
<item translatable="yes">GB</item>
<item translatable="yes">TB</item>
</items>
</object>
<packing>
<property name="expand">False</property>
@ -5356,6 +5355,7 @@ limitation
<object class="GtkSpinButton" id="quotegroupSizeHardLimitSpin1">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="width-chars">7</property>
<property name="text" translatable="yes">0</property>
</object>
<packing>
@ -5372,6 +5372,12 @@ limitation
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<items>
<item translatable="yes">KB</item>
<item translatable="yes">MB</item>
<item translatable="yes">GB</item>
<item translatable="yes">TB</item>
</items>
</object>
<packing>
<property name="expand">False</property>
@ -5498,6 +5504,7 @@ limitation
<object class="GtkSpinButton" id="quotegroupFilesSoftLimitSpinProject">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="width-chars">7</property>
<property name="text" translatable="yes">0</property>
</object>
<packing>
@ -5558,7 +5565,9 @@ limitation
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
@ -5575,6 +5584,7 @@ limitation
<object class="GtkSpinButton" id="quotegroupFilesHardLimitSpinProject">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="width-chars">7</property>
<property name="text" translatable="yes">0</property>
</object>
<packing>
@ -6066,6 +6076,7 @@ limitation
<object class="GtkSpinButton" id="quoteSizeSoftLimitSpinProjectEdit">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="width-chars">7</property>
<property name="text" translatable="yes">0</property>
</object>
<packing>
@ -6082,6 +6093,12 @@ limitation
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<items>
<item translatable="yes">KB</item>
<item translatable="yes">MB</item>
<item translatable="yes">GB</item>
<item translatable="yes">TB</item>
</items>
</object>
<packing>
<property name="expand">False</property>
@ -6143,6 +6160,7 @@ limitation
<object class="GtkSpinButton" id="quoteSizeHardLimitSpinEdit">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="width-chars">7</property>
<property name="text" translatable="yes">0</property>
</object>
<packing>
@ -6159,6 +6177,12 @@ limitation
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<items>
<item translatable="yes">KB</item>
<item translatable="yes">MB</item>
<item translatable="yes">GB</item>
<item translatable="yes">TB</item>
</items>
</object>
<packing>
<property name="expand">False</property>
@ -6285,6 +6309,7 @@ limitation
<object class="GtkSpinButton" id="quoteFilesSoftLimitSpinProjectEdit">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="width-chars">7</property>
<property name="text" translatable="yes">0</property>
</object>
<packing>
@ -6364,6 +6389,7 @@ limitation
<object class="GtkSpinButton" id="quoteFilesHardLimitSpinProjectEdit">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="width-chars">7</property>
<property name="text" translatable="yes">0</property>
</object>
<packing>
@ -6776,6 +6802,7 @@ limitation
<object class="GtkSpinButton" id="quotegroupSizeSoftLimitSpinUser">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="width-chars">7</property>
<property name="text" translatable="yes">0</property>
</object>
<packing>
@ -6792,6 +6819,12 @@ limitation
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<items>
<item translatable="yes">KB</item>
<item translatable="yes">MB</item>
<item translatable="yes">GB</item>
<item translatable="yes">TB</item>
</items>
</object>
<packing>
<property name="expand">False</property>
@ -6853,6 +6886,7 @@ limitation
<object class="GtkSpinButton" id="quotegroupSizeHardLimitSpinUser">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="width-chars">7</property>
<property name="text" translatable="yes">0</property>
</object>
<packing>
@ -6869,6 +6903,12 @@ limitation
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<items>
<item translatable="yes">KB</item>
<item translatable="yes">MB</item>
<item translatable="yes">GB</item>
<item translatable="yes">TB</item>
</items>
</object>
<packing>
<property name="expand">False</property>
@ -6995,6 +7035,7 @@ limitation
<object class="GtkSpinButton" id="quotegroupFilesSoftLimitSpinUser">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="width-chars">7</property>
<property name="text" translatable="yes">0</property>
</object>
<packing>
@ -7074,6 +7115,7 @@ limitation
<object class="GtkSpinButton" id="quotegroupFilesHardLimitSpinUser">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="width-chars">7</property>
<property name="text" translatable="yes">0</property>
</object>
<packing>

@ -16,6 +16,125 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit"
#: source/ubl-strings.h:1
msgid "Version:"
msgstr "Версия:"
#: source/ubl-strings.h:2
msgid "ubl-settings-TEMPLATE version:"
msgstr "Версия ubl-settings-TEMPLATE: "
#: 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:4
msgid "TEMPLATE Manager"
msgstr "Настройки TEMPLATE"
#: 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: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:24
msgid "Always redirect to online documentation"
msgstr "Всегда перенаправлять"
#: source/ubl-strings.h:25
msgid "Open documentation"
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 "Off"
msgstr "Выключено"

Loading…
Cancel
Save