Частично работает заполнение таблицы

pull/24/head
Igor Belitskiy 2 years ago
parent 9fadf5ae2c
commit fb36e889ad

@ -105,7 +105,7 @@ uninstall:
install: check uninstall
@echo "Install ..."
#################################################### УДАЛИТЬ ПЕРЕД КОММИТОМ ################################################################################
@gcc source/ubl-cmake.h compile/resources.c compile/ubl-cmake.h source/view_filters.c source/view_filters.h source/view_temp_u_g_p.c source/view_temp_u_g_p.h source/controler.h source/controler.c source/model/philos_utils.h source/model/philos_utils.c source/model/my_device.h source/model/save.h source/model/save.c source/model/my_device.c source/model/model.h source/model/load.h source/model/load.c source/model/model.c source/ubl-settings-diskquota.c source/ubl-settings-diskquota.h source/ubl-strings.h source/model/ubl-utils.c source/model/ubl-utils.h -o ubl-settings-diskquota `pkg-config --cflags --libs gtk+-3.0 vte-2.91 webkit2gtk-4.0 webkit2gtk-web-extension-4.0` -g
@gcc source/ubl-cmake.h compile/resources.c compile/ubl-cmake.h source/view_filters.c source/model/vector.c source/model/vector.h source/view_filters.h source/view_temp_u_g_p.c source/view_temp_u_g_p.h source/controler.h source/controler.c source/model/philos_utils.h source/model/philos_utils.c source/model/my_device.h source/model/save.h source/model/save.c source/model/my_device.c source/model/model.h source/model/load.h source/model/load.c source/model/model.c source/ubl-settings-diskquota.c source/ubl-settings-diskquota.h source/ubl-strings.h source/model/ubl-utils.c source/model/ubl-utils.h -o ubl-settings-diskquota `pkg-config --cflags --libs gtk+-3.0 vte-2.91 webkit2gtk-4.0 webkit2gtk-web-extension-4.0` -g
#################################################### УДАЛИТЬ ПЕРЕД КОММИТОМ ################################################################################
@for FILE_PO in $(wildcard *.po); do \
LANG=$${FILE_PO##*_};LANG=$${LANG%.*}; \

@ -72,6 +72,14 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissin
set(SOURCE_FILES
controler.h
controler.c
model/model.h
model/model.c
model/save.h
model/save.c
model/load.h
model/load.c
model/vector.c
model/vector.h
ubl-strings.h
view_filters.c
view_filters.h
@ -79,16 +87,11 @@ set(SOURCE_FILES
view_temp_u_g_p.h
model/ubl-utils.h
model/ubl-utils.c
model/model.h
model/model.c
model/load.h
model/load.c
model/my_device.h
model/my_device.c
model/philos_utils.h
model/philos_utils.c
model/save.h
model/save.c
ubl-settings-diskquota.c
ubl-settings-diskquota.h
${CMAKE_CURRENT_BINARY_DIR}/ubl-cmake.h

@ -1,65 +1,60 @@
#include "controler.h"
config_u_g_p cfg_u_g_p;
config_general cfg_general;
main_window cfg_main_gui;
custom_window cfg_custom_gui;
config_settings_gui main_config;
config_all* all_config;
void fill_tree_view_u_g_p(custom_window* _config_gui, config_u_g_p* _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[index], "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(_config_gui->treeViewMain), model);
}
}
void fill_tree_view_u_g(custom_window* _config_gui, config_u_g_p* _config, int start,int flag_gui_add) {
GtkTreeModel *model = GTK_TREE_MODEL(_config_gui->list);
void fill_tree_view_u_g_p(custom_window* _config_gui,char* str_fill ,GtkListStore* list, config_all* all_config, int flag_gui_add) {
GtkTreeModel *model = GTK_TREE_MODEL(list);
if (flag_gui_add == 0) {
g_object_ref(_config_gui->list);
gtk_list_store_clear(_config_gui->list);
g_object_ref(list);
gtk_list_store_clear(list);
}
for (int index = start; index < _config->size; index++) {
for (int i = 0; i < all_config->v_u_g_p.pfVectorTotal(&all_config->v_u_g_p); i++) {
GtkTreeIter iter;
gtk_list_store_append(_config_gui->list,&iter);
if (strcmp(_config->type_arr[index], "project") != 0) { // Баг
gtk_list_store_set(_config_gui->list,&iter, -1);
config_u_g_p* _config = (config_u_g_p*)all_config->v_u_g_p.pfVectorGet(&all_config->v_u_g_p, i);
if (strcmp(_config->type_arr, str_fill) == 0) {
if (strcmp(_config->type_arr, "prjquota") != 0) {
gtk_list_store_append(list,&iter);
char* deferring_size = wrapper_str_time(_config->deferring_size);
char* deferring_file = wrapper_str_time(_config->deferring_file);
gtk_list_store_set(list,&iter,
0,_config->actors,
1,_config->quota,
2,_config->size_memory,
3,philos_format_cfg_str_size_memory("", _config->soft_restriction_size,_config->soft_restriction_size_pow),
4,philos_format_cfg_str_size_memory("", _config->soft_restriction_file,_config->soft_restriction_file_pow),
5,philos_format_cfg_str_size_memory("", _config->severe_limitation_size,_config->severe_limitation_size_pow),
6,_config->files,
7,philos_format_cfg_str_size_memory("", _config->severe_limitation_file, _config->severe_limitation_file_pow),
8,deferring_size,
9,deferring_file,
-1);
}
else {
gtk_list_store_append(list,&iter);
char* deferring_size = wrapper_str_time(_config->deferring_size);
char* deferring_file = wrapper_str_time(_config->deferring_file);
gtk_list_store_set(list,&iter,
0,yon_char_from_int(_config->id),
1,_config->actors,
2,_config->quota,
3,_config->size_memory,
4,philos_format_cfg_str_size_memory("", _config->soft_restriction_size,_config->soft_restriction_size_pow),
5,philos_format_cfg_str_size_memory("", _config->soft_restriction_file,_config->soft_restriction_file_pow),
6,philos_format_cfg_str_size_memory("", _config->severe_limitation_size,_config->severe_limitation_size_pow),
7,_config->files,
8,philos_format_cfg_str_size_memory("", _config->severe_limitation_file, _config->severe_limitation_file_pow),
9,deferring_size,
10,deferring_file,
-1);
}
}
}
}
if (flag_gui_add != 0) {
gtk_tree_view_set_model(GTK_TREE_VIEW(_config_gui->treeViewMain), model);
}
@ -106,14 +101,20 @@ void wrapper_system_save() {
*/
}
void load_system_cfg() {
cfg_u_g_p.flag_load = 0;
load_template_load_cfg(&cfg_u_g_p, CMD_LOAD_SYSTEM);
all_config->flag_load = 0;
load_template_load_cfg(all_config, CMD_LOAD_SYSTEM);
fill_tree_view_u_g_p(&cfg_custom_gui,"usrquota", cfg_custom_gui.liststoreUser, all_config, 0);
fill_tree_view_u_g_p(&cfg_custom_gui,"grpquota", cfg_custom_gui.liststoreGroups, all_config, 0);
fill_tree_view_u_g_p(&cfg_custom_gui,"prjquota", cfg_custom_gui.liststoreProject, all_config, 0);
yon_ubl_status_box_render(LOCAL_LOAD_SUCCESS_LABEL, BACKGROUND_IMAGE_SUCCESS_TYPE);
}
void load_global_cfg() {
cfg_u_g_p.flag_load = 1;
load_template_load_cfg(&cfg_u_g_p, CMD_LOAD_GLOBAL);
all_config->flag_load = 1;
fill_tree_view_u_g_p(&cfg_custom_gui,"usrquota", cfg_custom_gui.liststoreUser, all_config, 0);
fill_tree_view_u_g_p(&cfg_custom_gui,"grpquota", cfg_custom_gui.liststoreGroups, all_config, 0);
fill_tree_view_u_g_p(&cfg_custom_gui,"prjquota", cfg_custom_gui.liststoreProject, all_config, 0);
load_template_load_cfg(all_config, CMD_LOAD_GLOBAL);
yon_ubl_status_box_render(LOCAL_LOAD_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
}
@ -154,6 +155,8 @@ void main_visible_columns(GtkWidget *self) {
int main(int argc, char *argv[]){
all_config = malloc(sizeof(config_all));
all_config->flag_not_data = 0;
local=setlocale(LC_ALL, "");
bindtextdomain(LocaleName, yon_char_unite(LocalePath, "/", NULL));
//bind_textdomain_codeset(LocaleName, "UTF-8");

@ -4,6 +4,7 @@
char *local;
int main(int argc, char *argv[]);
void fill_tree_view_u_g_p(custom_window* _config_gui,char* str_fill ,GtkListStore* list, config_all* all_config, int flag_gui_add);
void load_global_cfg();
void load_system_cfg();
void control_event(main_window* _config_main_gui, custom_window* _config_custom_gui);

@ -1,33 +1,45 @@
#include "load.h"
void load_template_load_cfg(config_u_g_p* _config, char* cmd) {
model_clear_cfg(_config);
void load_template_load_cfg(config_all* _all_config, char* cmd) {
int size = 0;
char** cfg = yon_config_load(cmd, &size);
philos_array_string_remove_char(&cfg, "\n", size);
int size_loaded_keys = 0;
load_free_vector(_all_config);
vector_init(&_all_config->v_u_g_p);
vector_init(&_all_config->v_disk_status);
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);
_config->loaded_keys = yon_char_parsed_append(_config->loaded_keys, &size_loaded_keys, str_key);
yon_char_divide_search(str_key, "[",-1);
str_key = yon_char_divide_search(str_key, "]",-1);
char* str_value = str_key_value;
load_pars_keys(_config, yon_char_new(str_key), index);
load_pars_values(_config, yon_char_new(str_value), index);
if (strstr(str_value, "enable") || strstr(str_value, "disable")) {
disk_status* disk_cfg = malloc(sizeof(disk_status));
load_pars_values_status(disk_cfg, str_key, str_value);
_all_config->v_disk_status.pfVectorAdd(&_all_config->v_disk_status, disk_cfg);
}
else {
config_u_g_p* _config = malloc(sizeof(config_u_g_p));
model_null_str_writing(_config);
_config->loaded_keys = yon_char_new(str_key);
load_pars_keys(_config, yon_char_new(str_key), index);
load_pars_values(_config, yon_char_new(str_value), index);
_all_config->v_u_g_p.pfVectorAdd(&_all_config->v_u_g_p,_config);
}
}
_config->flag_set_data = 0;
_all_config->flag_set_data = 0;
_all_config->flag_not_data = 1;
}
void load_pars_keys(config_u_g_p* _config, char* str_key, int index) {
yon_char_divide_search(str_key, "[",-1);
str_key = yon_char_divide_search(str_key, "]",-1);
load_pars_keys_u_g(_config, str_key, index);
load_pars_keys_p(_config, str_key, index);
load_pars_keys_u_g(_config, yon_char_new(str_key), index);
load_pars_keys_p(_config, yon_char_new(str_key), index);
}
void load_pars_keys_u_g(config_u_g_p* _config, char* str_key, int index) {
if (strstr(str_key, "prjquota")) {
return;
@ -35,22 +47,21 @@ void load_pars_keys_u_g(config_u_g_p* _config, char* str_key, int index) {
if (yon_char_find_count(str_key, ":") || yon_char_find_count(str_key, ",")) {
int size_point = 0;
char** arr_keys = philos_str_split(str_key, &size_point, ":");
char** type_quota = philos_char_parsed_append(_config->type_arr, &index, arr_keys[0]);
_config->type_arr = yon_char_new(arr_keys[0]);
int size_users = 0;
if (yon_char_find_count(str_key, ":") == 2) {
_config->UNIX_file = philos_char_parsed_append(_config->UNIX_file,&index, arr_keys[1]);
}
if (yon_char_find_count(str_key, ",")) {
int size_comma = 0;
char** arr_user = philos_str_split(arr_keys[size_point-1], &size_comma, ",");
for (int i = 0; i < size_comma; i++) {
_config->actors = yon_char_parsed_append(_config->actors, &size_users, arr_user[i]);
if (yon_char_find_count(str_key, ",")) {
int size_comma = 0;
char** arr_user = philos_str_split(arr_keys[1], &size_comma, ",");
_config->UNIX_file = yon_char_new(arr_keys[0]);
for (int i = 1; i < size_comma; i++) {
_config->actors = yon_char_new(arr_user[i]);
}
}
else {
_config->UNIX_file = yon_char_new(arr_keys[1]);
}
_config->actors = yon_char_parsed_append(_config->actors, &size_users, NULL);
}
else {
_config->actors = yon_char_parsed_append(_config->actors, &size_users, NULL);
}
}
else {
@ -59,81 +70,104 @@ void load_pars_keys_u_g(config_u_g_p* _config, char* str_key, int index) {
}
void load_pars_keys_p(config_u_g_p* _config, char* str_key, int index) {
if (strstr(str_key, "usrquota") || strstr(str_key, "grpquota")) {
return;
}
if (yon_char_find_count(str_key, ":") || yon_char_find_count(str_key, ",")) {
int size_point = 0;
char** arr_keys = philos_str_split(str_key, &size_point, ":");
char** type_quota = philos_char_parsed_append(_config->type_arr,&index, arr_keys[0]);
int size_users = 0;
if (yon_char_find_count(str_key, ":") == 2) {
_config->UNIX_file = philos_char_parsed_append(_config->UNIX_file,&index, arr_keys[1]);
int size_comma = 0;
if (yon_char_find_count(str_key, ",")) {
char** arr_user = philos_str_split(arr_keys[size_point-1], &size_comma, ",");
if (strstr(str_key, "AUTO")) {
_config->number = philos_int_append(_config->number,&index, -1);
}
else {
_config->number = philos_int_append(_config->number,&index, atoi(arr_user[0]));
}
}
else {
if (strstr(str_key, "AUTO")) {
_config->number = philos_int_append(_config->number,&index, -1);
if (strstr(str_key, "prjquota")) {
if (yon_char_find_count(str_key, ":") || yon_char_find_count(str_key, ",")) {
int size_point = 0;
char** arr_keys = philos_str_split(str_key, &size_point, ":");
_config->type_arr = yon_char_new(arr_keys[0]);
int size_users = 0;
if (yon_char_find_count(str_key, ":") == 2) {
_config->UNIX_file = yon_char_new(arr_keys[1]);
int size_comma = 0;
if (yon_char_find_count(str_key, ",")) {
char** arr_user = philos_str_split(arr_keys[size_point], &size_comma, ",");
if (strstr(str_key, "AUTO")) {
_config->id = -1;
}
else {
_config->id = atoi(arr_user[0]);
}
}
else {
_config->number = philos_int_append(_config->number, &size_comma, atoi(arr_keys[size_point-1]));
if (strstr(str_key, "AUTO")) {
_config->id = -1;
}
else {
_config->id = atoi(arr_keys[size_point-1]);
}
}
}
}
}
}
}
else {
}
}
void load_pars_values_status(config_u_g_p* _config, int index, char*key, char* value) {
for (int i = 0; i < _config->size; i++) {
if (strstr(key, _config->loaded_keys[i])) {
if (strstr(key,"enable")) {
_config->status[index] = 1;
return;
}
else if (strstr(key,"disable")) {
_config->status[index] = 0;
return;
}
}
void load_pars_values_status(disk_status* _config, char* key, char* value) {
_config->device = yon_char_new(value);
if (strstr(key,"enable")) {
_config->status = 1;
return;
}
else if (strstr(key,"disable")) {
_config->status = 0;
return;
}
}
void load_pars_values(config_u_g_p* _config, char* str_value, int index) {
int size_array_size_pow = 0;
char** array_size_pow = NULL;
array_size_pow = yon_char_parsed_append(array_size_pow,&size_array_size_pow, STR_KB);
array_size_pow = yon_char_parsed_append(array_size_pow,&size_array_size_pow, STR_MB);
array_size_pow = yon_char_parsed_append(array_size_pow,&size_array_size_pow, STR_GB);
array_size_pow = yon_char_parsed_append(array_size_pow,&size_array_size_pow, STR_TB);
int size = 0;
char* new_value = yon_char_new(str_value);
char** arr_values = philos_str_split(new_value, &size, ":");
if (yon_char_find_count(str_value, ":") == 3 || yon_char_find_count(str_value, ":") == 5) {
philos_set_pow_size_memory(yon_char_new(arr_values[0]), &_config->soft_restriction_size, index, array_size_pow);
philos_set_size_memory_integer(yon_char_new(arr_values[0]), &_config->soft_restriction_size_pow, index);
philos_set_pow_size_memory(yon_char_new(arr_values[1]), &_config->soft_restriction_file, index, array_size_pow);
philos_set_size_memory_integer(yon_char_new(arr_values[1]), &_config->soft_restriction_file, index);
philos_set_pow_size_memory(yon_char_new(arr_values[2]), &_config->severe_limitation_size, index, array_size_pow);
philos_set_size_memory_integer(yon_char_new(arr_values[2]), &_config->severe_limitation_size_pow, index);
philos_set_pow_size_memory(yon_char_new(arr_values[3]), &_config->severe_limitation_file, index, array_size_pow);
philos_set_size_memory_integer(yon_char_new(arr_values[3]), &_config->severe_limitation_file_pow, index);
if (yon_char_find_count(str_value, ":") == 5) {
philos_set_pow_size_memory(yon_char_new(arr_values[3]), &_config->deferring_size, index, array_size_pow);
philos_set_size_memory_integer(yon_char_new(arr_values[3]), &_config->deferring_size_pow, index);
philos_set_pow_size_memory(yon_char_new(arr_values[3]), &_config->deferring_file, index, array_size_pow);
philos_set_size_memory_integer(yon_char_new(arr_values[3]), &_config->deferring_file_pow, index);
int index_split = yon_char_find_count(str_value, ":");
if (index_split == 3 || index_split == 5) {
philos_set_pow_size_memory(yon_char_new(arr_values[0]), &_config->soft_restriction_size_pow, array_size_pow);
philos_set_size_memory_integer(yon_char_new(arr_values[0]), &_config->soft_restriction_size);
philos_set_pow_size_memory(yon_char_new(arr_values[1]), &_config->soft_restriction_file_pow, array_size_pow);
philos_set_size_memory_integer(yon_char_new(arr_values[1]), &_config->soft_restriction_file);
philos_set_pow_size_memory(yon_char_new(arr_values[2]), &_config->severe_limitation_size_pow, array_size_pow);
philos_set_size_memory_integer(yon_char_new(arr_values[2]), &_config->severe_limitation_size);
philos_set_pow_size_memory(yon_char_new(arr_values[3]), &_config->severe_limitation_file_pow, array_size_pow);
philos_set_size_memory_integer(yon_char_new(arr_values[3]), &_config->severe_limitation_file);
if (index_split == 5) {
_config->deferring_size = atoll(arr_values[4]);
_config->deferring_file = atoll(arr_values[5]);
}
else {
philos_set_pow_size_memory("-", &_config->deferring_size, index, array_size_pow);
philos_set_size_memory_integer("-", &_config->deferring_size_pow, index);
philos_set_pow_size_memory("-", &_config->deferring_file, index, array_size_pow);
philos_set_size_memory_integer("-", &_config->deferring_file_pow, index);
philos_set_size_memory_integer("-", &_config->deferring_size);
philos_set_size_memory_integer("-", &_config->deferring_file);
}
}
else {
}
}
void load_free_vector(config_all* _all_config) {
if (_all_config->flag_not_data == 1) {
_all_config->v_u_g_p.pfVectorFree(&_all_config->v_u_g_p);
}
}
char* wrapper_str_time(size_t seconds) {
me_time t;
if (seconds!=-1) {
t = str_time(seconds);
t.str_time = yon_char_unite(yon_char_from_int(t.weeks),WEEKS,
yon_char_from_int(t.days), DAYS,
yon_char_from_int(t.hours), HOURS,
yon_char_from_int(t.minutes), MINUTES, NULL);
}
else {
t.str_time = yon_char_new("-");
}
return t.str_time;
}

@ -1,13 +1,16 @@
#ifndef LOAD_H
#define LOAD_H
#include "ubl-utils.h"
#include "../ubl-strings.h"
#include "model.h"
#include "philos_utils.h"
void load_template_load_cfg(config_u_g_p* _config, char* cmd);
void load_template_load_cfg(config_all* _all_config, char* cmd);
void load_pars_keys(config_u_g_p* _config, char* str_key, int index);
void load_pars_keys_u_g(config_u_g_p* _config, char* str_key, int index);
void load_pars_keys_p(config_u_g_p* _config, char* str_key, int index);
void load_pars_values(config_u_g_p* _config, char* str_value, int index);
void load_free_vector(config_all* _all_config);
void load_pars_values_status(disk_status* _config, char* key, char* value);
char* wrapper_str_time(size_t seconds);
#endif

@ -2,97 +2,42 @@
void model_clear_cfg(config_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(config_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;
}
free(_config->quota);
free(_config->size_memory);
free(_config->device);
free(_config->UNIX_file);
free(_config->files);
free(_config->actors);
free(_config->loaded_keys);
}
void model_clear_general(config_general* _config) {
philos_free_int_array(&_config->flag_status, _config->size);
_config->size = 0;
}
void model_null_general(config_general* _config) {
if (_config->size == 0) {
_config->flag_status = NULL;
}
}
void model_tree_view_add(config_u_g_p* _config) {
model_null_str_writing(_config, _config->size);
model_null_str_writing(_config);
}
void model_null_str_writing(config_u_g_p* _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_null_str_writing(config_u_g_p* _config) {
_config->quota = yon_char_new(empty_str);
_config->size_memory = yon_char_new(empty_str);
_config->device = yon_char_new(empty_str);
_config->UNIX_file = yon_char_new(empty_str);
_config->files = yon_char_new(empty_str);
_config->actors = yon_char_new(empty_str);
_config->loaded_keys = yon_char_new(empty_str);
_config->type_arr = yon_char_new(empty_str);
_config->id = -3;
_config->status_set = -3;
_config->soft_restriction_size = -3;
_config->soft_restriction_file = -3;
_config->severe_limitation_size = -3;
_config->severe_limitation_file = -3;
_config->deferring_size = -3;
_config->deferring_file = -3;
_config->size_memory_pow = -3;
_config->soft_restriction_size_pow = -3;
_config->soft_restriction_file_pow = -3;
_config->severe_limitation_size_pow = -3;
_config->severe_limitation_file_pow = -3;
}
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);
}

@ -1,55 +1,59 @@
#ifndef MODEL_H
#define MODEL_H
#include "ubl-utils.h"
#include "../ubl-strings.h"
#include "philos_utils.h"
static char** array_size_pow = NULL;
#include "vector.h"
#include "../ubl-strings.h"
typedef struct{
int* status;
char** type_arr;
int* id;
char** name;
char** quota;
char** size_memory;
char** UNIX_file;
char** files;
char** actors;
int* number;
int* status_set;
char** loaded_keys;
char* type_arr;
int id;
char* quota;
char* size_memory;
char* UNIX_file;
char* files;
char* actors;
char* loaded_keys;
int status_set;
/*
0 = not set
1 = del;
2 = update
*/
char** delete_key;
int* soft_restriction_size;
int* soft_restriction_file;
int* severe_limitation_size;
int* severe_limitation_file;
int* deferring_size;
int* deferring_file;
size_t soft_restriction_size;
size_t soft_restriction_file;
size_t severe_limitation_size;
size_t severe_limitation_file;
size_t deferring_size;
size_t deferring_file;
int* size_memory_pow;
int* soft_restriction_size_pow;
int* soft_restriction_file_pow;
int* severe_limitation_size_pow;
int* severe_limitation_file_pow;
int* deferring_size_pow;
int* deferring_file_pow;
char** device;
int size_memory_pow;
int soft_restriction_size_pow;
int soft_restriction_file_pow;
int severe_limitation_size_pow;
int severe_limitation_file_pow;
char* device;
size_t size;
} config_u_g_p;
typedef struct {
vector v_general;
vector v_u_g_p;
vector v_disk_status;
int flag_set_data;
int flag_save;
int flag_load;
} config_u_g_p;
int count_remove;
int flag_not_data;
} config_all;
typedef struct{
char* device;
int status;
} disk_status;
typedef struct{
int *flag_status;
int flag_status;
int size;
} config_general;
@ -57,7 +61,8 @@ typedef struct{
int flag_load;
} config_gui;
void model_null_str_writing(config_u_g_p* _config, int index);
void model_null_str_writing(config_u_g_p* _config);
void model_clear_cfg(config_u_g_p* _config);
void model_array_size_memory();
#endif

@ -7,94 +7,46 @@ 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_pow_size_memory(char* str_find, int* array_size, char** array_size_pow) {
char* STR_KB = array_size_pow[0];
char* STR_MB = array_size_pow[1];
char* STR_GB = array_size_pow[2];
char* STR_TB = array_size_pow[3];
size_t length = strlen(str_find);
if (strstr(str_find,"K") != NULL) {
*array_size = philos_int_append(*array_size, &index, 0);
(*array_size) = 0;
str_find = yon_char_divide(str_find, length-1);
str_find = yon_char_unite(str_find, " ", STR_KB, NULL);
index--;
}
else if (strstr(str_find,"M") != NULL) {
*array_size = philos_int_append(*array_size, &index, 1);
(*array_size) = 1;
str_find = yon_char_divide(str_find, length-1);
str_find = yon_char_unite(str_find," ", STR_MB, NULL);
index--;
}
else if (strstr(str_find,"G") != NULL) {
*array_size = philos_int_append(*array_size, &index, 2);
(*array_size) = 2;
str_find = yon_char_divide(str_find, length-1);
str_find = yon_char_unite(str_find," ", STR_GB, NULL);
index--;
}
else if (strstr(str_find,"T") != NULL) {
*array_size = philos_int_append(*array_size, &index, 3);
(*array_size) = 3;
str_find = yon_char_divide(str_find, length-1);
str_find = yon_char_unite(str_find," ", STR_TB, NULL);
index--;
}
else if (strstr(str_find,"%%") != NULL) {
*array_size = philos_int_append(*array_size, &index, -1);
(*array_size) = -1;
str_find = yon_char_divide(str_find, length-1);
index--;
}
else if (strstr(str_find,"-") != NULL) {
*array_size = philos_int_append(*array_size, &index, -1);
index--;
(*array_size) = -1;
}
else {
*array_size = philos_int_append(*array_size, &index, 0);
index--;
}
}
void philos_set_pow_size_memory_device(char* str_find, int** array_size,int index, char** array_size_pow) {
char* STR_KB = array_size_pow[0];
char* STR_MB = array_size_pow[1];
char* STR_GB = array_size_pow[2];
char* STR_TB = array_size_pow[3];
size_t length = strlen(str_find);
if (strstr(str_find,"K") != NULL) {
(*array_size)[index] = 0;
str_find = yon_char_divide(str_find, length-1);
str_find = yon_char_unite(str_find, " ", STR_KB, NULL);
index--;
}
else if (strstr(str_find,"M") != NULL) {
(*array_size)[index] = 1;
str_find = yon_char_divide(str_find, length-1);
str_find = yon_char_unite(str_find," ", STR_MB, NULL);
index--;
}
else if (strstr(str_find,"G") != NULL) {
(*array_size)[index] = 2;
str_find = yon_char_divide(str_find, length-1);
str_find = yon_char_unite(str_find," ", STR_GB, NULL);
index--;
}
else if (strstr(str_find,"T") != NULL) {
(*array_size)[index] = 3;
str_find = yon_char_divide(str_find, length-1);
str_find = yon_char_unite(str_find," ", STR_TB, NULL);
index--;
}
else if (strstr(str_find,"%%") != NULL) {
(*array_size)[index] = -1;
str_find = yon_char_divide(str_find, length-1);
index--;
}
else if (strstr(str_find,"-") != NULL) {
(*array_size)[index] = -1;
index--;
(*array_size) = 0;
}
}
void philos_set_size_memory_integer_char(char* str_find, char*** array_data, int index) {
char* simv_del_array[10] = {"K","M","G","T","k","m","g","t"," ","%"};
for (size_t i = 0; i < 10; i++) {
@ -841,7 +793,7 @@ char** philos_char_parsed_append(char** parsed, int *size, char *string) {
return parsed;
}
void philos_set_size_memory_integer(char* str_find, int** array_data, int index) {
void philos_set_size_memory_integer(char* str_find, size_t* array_data) {
if (strstr(str_find, " ")) {
yon_char_divide_search(str_find, " ", -1);
}
@ -852,9 +804,55 @@ void philos_set_size_memory_integer(char* str_find, int** array_data, int index)
}
}
if (strstr(str_find, "-")==NULL) {
*array_data = philos_int_append(*array_data, &index, atoi(str_find));
(*array_data) = atoll(str_find);
}
else {
(*array_data) = -1;
}
}
me_time str_time(size_t seconds) {
me_time t;
printf("%d\n", seconds);
if (seconds != -1) {
double weeks = seconds / (7*24*60*60);
double days = seconds / (24*60*60) - 7*weeks;
double hours = seconds / (60*60) - 7*24*weeks - 24*days;
double minutes = seconds / 60 - 7*24*60*weeks - 24*60*days - 60*hours;
if (weeks>0) {
t.weeks = (int)weeks;
}
else {
t.weeks = 0;
}
if (days>0) {
t.days = (int)days;
}
else {
t.days = 0;
}
if (hours>0) {
t.hours = (int)hours;
}
else {
t.hours = 0;
}
if (minutes>0) {
t.minutes = (int)minutes;
}
else {
t.minutes = 0;
}
t.str_time = NULL;
}
else {
*array_data = philos_int_append(*array_data, &index, -1);
t.weeks = 0;
t.days = 0;
t.hours = 0;
t.hours = 0;
t.str_time = NULL;
}
return t;
}

@ -62,8 +62,16 @@ typedef struct {
} temp_set_window;
typedef struct {
int weeks;
int days;
int hours;
int minutes;
char* str_time;
} me_time;
void philos_array_string_remove_char(char*** array, char* str_remove, int size);
void philos_set_pow_size_memory(char* str_find, int** array_size,int index, char** array_size_pow);
void philos_set_pow_size_memory(char* str_find, int* array_size, char** array_size_pow);
void philos_set_size_memory_integer_char(char* str_find, char*** array_data, int index);
void philos_free_string_array(char ***array, int size);
void philos_free_string_array_n3(char ****array, int size);
@ -78,7 +86,6 @@ 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);
@ -115,5 +122,6 @@ void philos_array_char_pars_to(char*** array, char* to);
int find_null_array(temp_config* _config);
void init_device_disk(temp_config* _config);
char** philos_char_parsed_append(char** parsed, int *size, char *string);
void philos_set_size_memory_integer(char* str_find, int** array_data, int index);
void philos_set_size_memory_integer(char* str_find, size_t* array_data);
me_time str_time(size_t seconds);
#endif

@ -3,89 +3,92 @@
#include "save.h"
char* template_format_save(config_u_g_p* config, char* source_set_cmd) {
char* template_format_save(config_all* _all_config, char* source_set_cmd) {
char* cmd = yon_char_new("");
for (int i = 0; i < config->size; i++) {
char* key = save_format_key(config, i);
char* value = save_format_str_value(config, i);
char* value_status = save_format_status_cmd(config, i);
for (int i = 0; i < _all_config->v_u_g_p.pfVectorTotal(&_all_config->v_u_g_p); i++) {
config_u_g_p* _config = (config_u_g_p*)_all_config->v_u_g_p.pfVectorGet(&_all_config->v_u_g_p, i);
char* key = save_format_key(_config, i);
char* value = save_format_str_value(_config, i);
//char* value_status = save_format_status_cmd(_config, i);
if (key!= NULL) {
// key = yon_char_unite(cmd, " " , key, "=\"" , value, "\" ", NULL);
cmd = yon_char_unite(cmd, key, "=" , value, " ", NULL);
cmd = yon_char_unite(cmd, key, "=" , value_status, " ", NULL);
//cmd = yon_char_unite(cmd, key, "=" , value_status, " ", NULL);
free(key);
free(value);
free(value_status);
//free(value_status);
}
}
if (strlen(cmd) > 8 && check_save()== 0) {
if (strlen(cmd) > 8 && save_check_save(_all_config)== 0) {
cmd = yon_char_unite(source_set_cmd, " " ,cmd, NULL);
return cmd;
}
free(cmd);
return NULL;
}
char* template_format_remove_save(config_u_g_p* config, char* source_remove_cmd) {
char* template_format_remove_save(config_all* _all_config, char* source_remove_cmd) {
char* cmd = yon_char_new(source_remove_cmd);
if (main_config.size_array_del_line == 0) {
if (_all_config->count_remove == 0) {
return NULL;
}
if (strlen(cmd) > strlen(source_remove_cmd) && check_save()== 0) {
for (int i = 0; i < _all_config->v_u_g_p.pfVectorTotal(&_all_config->v_u_g_p); i++) {
config_u_g_p* _config = (config_u_g_p*)_all_config->v_u_g_p.pfVectorGet(&_all_config->v_u_g_p, i);
if (_config->status_set >= 0) {
cmd = yon_char_unite(cmd, " " , _config->loaded_keys, " ", NULL);
}
}
if (strlen(cmd) > strlen(source_remove_cmd) && save_check_save(_all_config)== 0) {
return cmd;
}
return cmd;
}
char* wrapper_template_save(config_u_g_p* config, char* source_set_cmd, char* source_remove_cmd) {
char str_cmd_remove = template_format_remove_save(config,source_remove_cmd);
char str_cmd_set = template_format_save(config,source_set_cmd);
if (cmd_set != NULL && cmd_remove != NULL) {
philos_config_save(yon_char_unite(cmd_set, "; " , cmd_remove, NULL));
int wrapper_template_save(config_all* _all_config, char* source_set_cmd, char* source_remove_cmd) {
char* str_cmd_remove = template_format_remove_save(_all_config,source_remove_cmd);
char* str_cmd_set = template_format_save(_all_config,source_set_cmd);
if (str_cmd_set != NULL && str_cmd_remove != NULL) {
philos_config_save(yon_char_unite(str_cmd_remove, "; " , str_cmd_set, NULL));
}
else if (cmd_remove != NULL) {
philos_config_save(cmd_remove);
else if (str_cmd_remove != NULL) {
philos_config_save(str_cmd_remove);
}
else if (cmd_set != NULL) {
philos_config_save(cmd_set);
else if (str_cmd_set != NULL) {
philos_config_save(str_cmd_set);
}
else {
return 0;
}
if (cmd_remove != NULL) {
free(cmd_remove);
if (str_cmd_remove != NULL) {
free(str_cmd_remove);
}
if (cmd_set != NULL) {
free(cmd_set);
if (str_cmd_set != NULL) {
free(str_cmd_set);
}
main_config.flag_set_data = 0;
_all_config->flag_set_data = 0;
return 1;
}
char* save_format_key(config_u_g_p* config, int index) {
if (config->status_set[index] == 1) {
if (config->status_set == 1) {
return NULL;
}
char* cmd = yon_char_new("");
char* value = yon_char_new("");
char* key = yon_char_new("");
int number = config->number[index];
int number = config->id;
key = yon_char_unite("CGROUP_QUOTA[", config->type_arr[index], ":", NULL);
if (strstr(config->type_arr[index], "prjquota")) {
key = yon_char_unite("CGROUP_QUOTA[", config->type_arr, ":", NULL);
if (strstr(config->type_arr, "prjquota")) {
if (number!=-1) {
key = yon_char_unite(config->UNIX_file[index],":",yon_char_from_int(number), NULL);
key = yon_char_unite(config->UNIX_file,":",yon_char_from_int(number), NULL);
}
else {
key = yon_char_unite(config->UNIX_file[index],":AUTO", NULL);
key = yon_char_unite(config->UNIX_file,":AUTO", NULL);
}
}
else {
key = yon_char_unite(config->UNIX_file[index], NULL);
key = yon_char_unite(config->UNIX_file, NULL);
}
@ -96,21 +99,21 @@ char* save_format_key(config_u_g_p* config, int index) {
}
char* save_format_str_value(config_u_g_p* config, int index) {
if (config->status_set[index] == 1) {
if (config->status_set == 1) {
return NULL;
}
char* value = yon_char_new("");
value = philos_format_cfg_str_size_memory(value, config->soft_restriction_size[index],config->soft_restriction_size_pow[index]);
value = philos_format_cfg_str_size_memory(value, config->soft_restriction_size,config->soft_restriction_size_pow);
value = yon_char_unite(value, ",");
philos_format_cfg_str_size_memory(value, config->soft_restriction_file[index],config->soft_restriction_file_pow[index]);
philos_format_cfg_str_size_memory(value, config->soft_restriction_file,config->soft_restriction_file_pow);
value = yon_char_unite(value, ",");
philos_format_cfg_str_size_memory(value, config->severe_limitation_size[index],config->severe_limitation_size_pow[index]);
philos_format_cfg_str_size_memory(value, config->severe_limitation_size,config->severe_limitation_size_pow);
value = yon_char_unite(value, ",");
philos_format_cfg_str_size_memory(value, config->severe_limitation_file[index], config->severe_limitation_file_pow[index]);
philos_format_cfg_str_size_memory(value, config->severe_limitation_file, config->severe_limitation_file_pow);
value = yon_char_unite(value, ",");
philos_format_cfg_str_size_memory(value, config->deferring_size[index], config->deferring_size_pow[index]);
//philos_format_cfg_str_size_memory(value, config->deferring_size, config->deferring_size_pow);
value = yon_char_unite(value, ",");
value = philos_format_cfg_str_size_memory(value, config->deferring_file[index], config->deferring_file_pow[index]);
//value = philos_format_cfg_str_size_memory(value, config->deferring_file, config->deferring_file_pow);
return value;
}
@ -119,7 +122,7 @@ char* save_str_users(config_u_g_p* config, int index) {
char split_simvol[2] = {0};
split_simvol[0] = 0;
split_simvol[1] = 0;
if (strstr(config->type_arr[index], "prjquota")) {
if (strstr(config->type_arr, "prjquota")) {
for (int i=0; config->actors[i]; i++) {
cmd = yon_char_unite(":", split_simvol, config->actors[i], NULL);
split_simvol[0] = ',';
@ -130,12 +133,12 @@ char* save_str_users(config_u_g_p* config, int index) {
}
}
/*
char* save_format_status_cmd(config_u_g_p* config, int index) {
if (config->status_set[index] == 1) {
if (config->status_set == 1) {
return NULL;
}
if (config->status[index]) {
if (config->status) {
return yon_char_new("enable");
}
else {
@ -143,4 +146,28 @@ char* save_format_status_cmd(config_u_g_p* config, int index) {
}
return yon_char_new("disable");
}
*/
int save_check_save(config_all* _all_config) {
if (_all_config->flag_set_data == 1 || _all_config->flag_save>0) {
return 0;
}
else if (_all_config->flag_set_data == 0 || _all_config->flag_save<=0) {
return 1;
}
return 0;
}
void save_remove_array(config_all* _all_config) {
for (int i = 0; i < _all_config->v_u_g_p.pfVectorTotal(&_all_config->v_u_g_p); i++) {
config_u_g_p* _config = (config_u_g_p*)_all_config->v_u_g_p.pfVectorGet(&_all_config->v_u_g_p, i);
if (_config->status_set == 1) {
_all_config->v_u_g_p.pfVectorDelete(&_all_config->v_u_g_p, i);
}
if (_config->status_set == 2) {
_config->status_set = 0;
}
}
}
#endif

@ -1,13 +1,15 @@
#ifndef SAVE
#define SAVE
#include "ubl-utils.h"
#include "../ubl-strings.h"
#include "model.h"
char* template_format_save(config_u_g_p* _config, char* source_set_cmd);
char* template_format_save(config_all* _all_config, char* source_set_cmd);
char* save_format_key(config_u_g_p* _config, int index);
char* save_str_users(config_u_g_p* _config, int index);
char* save_format_str_value(config_u_g_p* config, int index);
char* save_format_status_cmd(config_u_g_p* config, int index);
char* template_format_remove_save(config_u_g_p* config, char* source_remove_cmd);
char* wrapper_template_save(config_u_g_p* config, char* source_set_cmd, char* source_remove_cmd);
char* template_format_remove_save(config_all* _all_config, char* source_remove_cmd);
char* template_format_remove_save(config_all* _all_config, char* source_remove_cmd);
void save_remove_array(config_all* _all_config);
int save_check_save(config_all* _all_config);
int wrapper_template_save(config_all* _all_config, char* source_set_cmd, char* source_remove_cmd);
#endif

@ -529,17 +529,15 @@ char *yon_char_divide(char *source, int dividepos)
* Считает количество символов [find] в строке [source]
*/
int yon_char_find_count(char *source, char *find){
char *working_string=yon_char_new(source);
int i=0;
char *working_string=source;
int size=0;
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++;
while ((working_string = strstr(working_string, find))) {
if (working_string) {
working_string++;
size++;
}
}
printf("%d\n",i);
return i;
return size;
}
/**yon_char_divide_search(char *source, char *dividepos, int delete_divider)

@ -119,37 +119,3 @@ void vector_init(vector *v)
v->vectorList.total = 0;
v->vectorList.items = malloc(sizeof(void *) * v->vectorList.capacity);
}
/*
int main(int argc, char *argv[])
{
int i =0;
//init vector
VECTOR_INIT(v);
//Add data in vector
v.pfVectorAdd(&v,"aticleworld.com\n");
v.pfVectorAdd(&v,"amlendra\n");
v.pfVectorAdd(&v,"Pooja\n");
v.pfVectorAdd(&v,"aticleworld.com\n");
v.pfVectorAdd(&v,"amlendra\n");
v.pfVectorAdd(&v,"Pooja\n");
v.pfVectorAdd(&v,"aticleworld.com\n");
v.pfVectorAdd(&v,"amlendra\n");
v.pfVectorAdd(&v,"Pooja\n");
//print the data and type cast it
for (i = 0; i < v.pfVectorTotal(&v); i++)
{
printf("%s", (char*)v.pfVectorGet(&v, i));
}
//Set the data at index 0
v.pfVectorSet(&v,0,"Apoorv\n");
printf("\n\n\nVector list after changes\n\n\n");
//print the data and type cast it
for (i = 0; i < v.pfVectorTotal(&v); i++)
{
printf("%s", (char*)v.pfVectorGet(&v, i));
}
vectorFree(&v);
return 0;
}
*/

@ -6,8 +6,6 @@
#define VECTOR_INIT_CAPACITY 6
#define UNDEFINE -1
#define SUCCESS 0
#define VECTOR_INIT(vec) vector vec;\
vector_init(&vec)
//Store and track the stored data
typedef struct sVectorList
{
@ -28,4 +26,5 @@ struct sVector
void *(*pfVectorGet)(vector *, int);
int (*pfVectorDelete)(vector *, int);
int (*pfVectorFree)(vector *);
};
};
void vector_init(vector *v);

@ -207,6 +207,10 @@ custom_window *setup_window_custom(custom_window* custom_widgets, GtkBuilder *bu
custom_widgets->btnEditProject = yon_gtk_builder_get_widget(builder,"btnEditProject");
custom_widgets->btnDelProject = yon_gtk_builder_get_widget(builder,"btnDelProject");
custom_widgets->btnFilterProject = yon_gtk_builder_get_widget(builder,"btnFilterProject");
custom_widgets->liststoreUser = GTK_LIST_STORE(gtk_builder_get_object(builder, "liststoreUser"));
custom_widgets->liststoreGroups = GTK_LIST_STORE(gtk_builder_get_object(builder, "liststoreGroups"));
custom_widgets->liststoreProject = GTK_LIST_STORE(gtk_builder_get_object(builder, "liststoreProject"));
custom_widgets->liststoreGeneral = GTK_LIST_STORE(gtk_builder_get_object(builder, "liststoreGeneral"));
return custom_widgets;
}
void wrapper_filters_user_show() {

@ -18,7 +18,6 @@
#include <webkit2/webkit2.h>
#endif
#include "view_filters.h"
#include "ubl-strings.h"
#include "view_temp_u_g_p.h"
#define WIKI_LINK "https://wiki.ublinux.ru/ru/Программное_обеспечениерограммы_и_утилиты/Все/ubl-settings-diskquota"
@ -87,7 +86,10 @@ typedef struct {
typedef struct {
GtkWidget *treeViewMain;
GtkListStore *list;
GtkListStore *liststoreUser;
GtkListStore *liststoreGroups;
GtkListStore *liststoreProject;
GtkListStore *liststoreGeneral;
GtkWidget* usersDeviceCombo;
GtkWidget* groupsDeviceCombo;
GtkWidget* ProjectDeviceCombo;

@ -59,4 +59,10 @@
#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_REMOVE_SYSTEM "ubconfig --target system remove security "
#define empty_str "-"
#define WEEKS _("w ")
#define DAYS _("d ")
#define HOURS _("h ")
#define MINUTES _("m ")

@ -13,7 +13,6 @@
#include "ubl-cmake.h"
#include "model/model.h"
#include "model/load.h"
#include "ubl-strings.h"
// Переменные
typedef struct {

@ -11,7 +11,6 @@
#include "ubl-cmake.h"
#include "model/model.h"
#include "model/load.h"
#include "ubl-strings.h"

Binary file not shown.

@ -1588,7 +1588,7 @@ translated and supported by community.</property>
</object>
</child>
</object>
<object class="GtkListStore" id="liststore1"/>
<object class="GtkListStore" id="liststoreGeneral"/>
<object class="GtkWindow" id="QuotasEditWindow1">
<property name="can-focus">False</property>
<property name="valign">start</property>
@ -1617,7 +1617,7 @@ translated and supported by community.</property>
<object class="GtkTreeView" id="treeViewCheckUsers">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="model">liststore1</property>
<property name="model">liststoreGeneral</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
@ -1743,9 +1743,80 @@ translated and supported by community.</property>
</object>
</child>
</object>
<object class="GtkListStore" id="liststore2"/>
<object class="GtkListStore" id="liststore3"/>
<object class="GtkListStore" id="liststore4"/>
<object class="GtkListStore" id="liststoreGroups">
<columns>
<!-- column-name gchararray1 -->
<column type="gchararray"/>
<!-- column-name gchararray2 -->
<column type="gchararray"/>
<!-- column-name gchararray3 -->
<column type="gchararray"/>
<!-- column-name gchararray4 -->
<column type="gchararray"/>
<!-- column-name gchararray5 -->
<column type="gchararray"/>
<!-- column-name gchararray6 -->
<column type="gchararray"/>
<!-- column-name gchararray7 -->
<column type="gchararray"/>
<!-- column-name gchararray8 -->
<column type="gchararray"/>
<!-- column-name gchararray9 -->
<column type="gchararray"/>
<!-- column-name gchararray10 -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="liststoreProject">
<columns>
<!-- column-name gchararray1 -->
<column type="gchararray"/>
<!-- column-name gchararray2 -->
<column type="gchararray"/>
<!-- column-name gchararray3 -->
<column type="gchararray"/>
<!-- column-name gchararray4 -->
<column type="gchararray"/>
<!-- column-name gchararray5 -->
<column type="gchararray"/>
<!-- column-name gchararray6 -->
<column type="gchararray"/>
<!-- column-name gchararray7 -->
<column type="gchararray"/>
<!-- column-name gchararray8 -->
<column type="gchararray"/>
<!-- column-name gchararray9 -->
<column type="gchararray"/>
<!-- column-name gchararray10 -->
<column type="gchararray"/>
<!-- column-name gchararray11 -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="liststoreUser">
<columns>
<!-- column-name gchararray1 -->
<column type="gchararray"/>
<!-- column-name gchararray2 -->
<column type="gchararray"/>
<!-- column-name gchararray3 -->
<column type="gchararray"/>
<!-- column-name gchararray4 -->
<column type="gchararray"/>
<!-- column-name gchararray5 -->
<column type="gchararray"/>
<!-- column-name gchararray6 -->
<column type="gchararray"/>
<!-- column-name gchararray7 -->
<column type="gchararray"/>
<!-- column-name gchararray8 -->
<column type="gchararray"/>
<!-- column-name gchararray9 -->
<column type="gchararray"/>
<!-- column-name gchararray10 -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkMenu" id="menu1">
<property name="visible">True</property>
<property name="can-focus">False</property>
@ -1964,7 +2035,7 @@ translated and supported by community.</property>
<object class="GtkTreeView" id="GeneralQuotasTree">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="model">liststore2</property>
<property name="model">liststoreUser</property>
<property name="search-column">0</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
@ -2701,7 +2772,7 @@ limitation
<object class="GtkTreeView" id="usersQuotasTree">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="model">liststore2</property>
<property name="model">liststoreUser</property>
<property name="search-column">0</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
@ -2712,6 +2783,9 @@ limitation
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
@ -2721,6 +2795,9 @@ limitation
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
@ -2730,6 +2807,9 @@ limitation
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">2</attribute>
</attributes>
</child>
</object>
</child>
@ -2741,6 +2821,9 @@ Restriction
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">3</attribute>
</attributes>
</child>
</object>
</child>
@ -2752,6 +2835,9 @@ limitation
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">4</attribute>
</attributes>
</child>
</object>
</child>
@ -2763,6 +2849,9 @@ Restriction
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">5</attribute>
</attributes>
</child>
</object>
</child>
@ -2771,6 +2860,9 @@ Restriction
<property name="title" translatable="yes">Files</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">6</attribute>
</attributes>
</child>
</object>
</child>
@ -2782,6 +2874,9 @@ limitation
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">7</attribute>
</attributes>
</child>
</object>
</child>
@ -2792,6 +2887,9 @@ limitation
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">8</attribute>
</attributes>
</child>
</object>
</child>
@ -2802,6 +2900,9 @@ limitation
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">9</attribute>
</attributes>
</child>
</object>
</child>
@ -3590,7 +3691,7 @@ limitation
<object class="GtkTreeView" id="groupsQuotasTree">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="model">liststore3</property>
<property name="model">liststoreGroups</property>
<property name="search-column">0</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
@ -3601,6 +3702,9 @@ limitation
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
@ -3610,6 +3714,9 @@ limitation
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
@ -3619,6 +3726,9 @@ limitation
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">2</attribute>
</attributes>
</child>
</object>
</child>
@ -3630,6 +3740,9 @@ Restriction
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">3</attribute>
</attributes>
</child>
</object>
</child>
@ -3641,6 +3754,9 @@ limitation
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">4</attribute>
</attributes>
</child>
</object>
</child>
@ -3652,6 +3768,9 @@ Restriction
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">5</attribute>
</attributes>
</child>
</object>
</child>
@ -3660,6 +3779,9 @@ Restriction
<property name="title" translatable="yes">Files</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">6</attribute>
</attributes>
</child>
</object>
</child>
@ -3671,6 +3793,9 @@ limitation
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">7</attribute>
</attributes>
</child>
</object>
</child>
@ -3681,6 +3806,9 @@ limitation
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">8</attribute>
</attributes>
</child>
</object>
</child>
@ -3691,6 +3819,9 @@ limitation
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">9</attribute>
</attributes>
</child>
</object>
</child>
@ -4479,7 +4610,7 @@ limitation
<object class="GtkTreeView" id="ProjectQuotasTree">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="model">liststore4</property>
<property name="model">liststoreProject</property>
<property name="search-column">0</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
@ -4490,6 +4621,9 @@ limitation
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
@ -4499,6 +4633,9 @@ limitation
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
@ -4508,6 +4645,9 @@ limitation
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">2</attribute>
</attributes>
</child>
</object>
</child>
@ -4517,6 +4657,9 @@ limitation
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">3</attribute>
</attributes>
</child>
</object>
</child>
@ -4528,6 +4671,9 @@ Restriction
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">4</attribute>
</attributes>
</child>
</object>
</child>
@ -4539,6 +4685,9 @@ limitation
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">5</attribute>
</attributes>
</child>
</object>
</child>
@ -4550,6 +4699,9 @@ Restriction
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">6</attribute>
</attributes>
</child>
</object>
</child>
@ -4558,6 +4710,9 @@ Restriction
<property name="title" translatable="yes">Files</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">7</attribute>
</attributes>
</child>
</object>
</child>
@ -4569,6 +4724,9 @@ limitation
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">8</attribute>
</attributes>
</child>
</object>
</child>
@ -4579,6 +4737,9 @@ limitation
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">9</attribute>
</attributes>
</child>
</object>
</child>
@ -4589,6 +4750,9 @@ limitation
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">10</attribute>
</attributes>
</child>
</object>
</child>

@ -18,6 +18,18 @@ msgstr ""
"Content-Transfer-Encoding: 8bit"
#: source/ubl-strings.h:1
msgid "w "
msgstr "н "
msgid "d "
msgstr "д "
msgid "h "
msgstr "ч "
msgid "m "
msgstr "м "
msgid "Version:"
msgstr "Версия:"

Loading…
Cancel
Save