|
|
|
@ -5,12 +5,56 @@ custom_window cfg_custom_gui;
|
|
|
|
|
config_settings_gui main_config;
|
|
|
|
|
config_all* all_config;
|
|
|
|
|
|
|
|
|
|
void wrapper_filters_user_show() {
|
|
|
|
|
filters_set_name("user");
|
|
|
|
|
filters_show(NULL, glade_path);
|
|
|
|
|
}
|
|
|
|
|
void wrapper_filters_group_show() {
|
|
|
|
|
filters_set_name("group");
|
|
|
|
|
filters_show(NULL, glade_path);
|
|
|
|
|
}
|
|
|
|
|
void wrapper_filters_project_show() {
|
|
|
|
|
filters_set_name("project");
|
|
|
|
|
filters_show(NULL, glade_path);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void wrapper_add_user_show() {
|
|
|
|
|
set_temp_menu("user", "add");
|
|
|
|
|
temp_show(NULL, glade_path);
|
|
|
|
|
}
|
|
|
|
|
void wrapper_edit_user_show() {
|
|
|
|
|
int index = wrapper_select_tree_view(&cfg_custom_gui.user);
|
|
|
|
|
set_temp_menu("user", "edit");
|
|
|
|
|
temp_show(NULL, glade_path);
|
|
|
|
|
set_edit_gui_data_base(all_config, index);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int fill_tree_view_project(config_all* all_config, char* disk, GtkWidget* tree_view, char* str_fill ,GtkListStore* list, int flag_gui_add) {
|
|
|
|
|
GtkTreeModel *model = GTK_TREE_MODEL(list);
|
|
|
|
|
void wrapper_add_group_show() {
|
|
|
|
|
set_temp_menu("group", "add");
|
|
|
|
|
temp_show(NULL, glade_path);
|
|
|
|
|
}
|
|
|
|
|
void wrapper_edit_group_show() {
|
|
|
|
|
int index = wrapper_select_tree_view(&cfg_custom_gui.group);
|
|
|
|
|
set_temp_menu("group", "edit");
|
|
|
|
|
temp_show(NULL, glade_path);
|
|
|
|
|
set_edit_gui_data_base(all_config, index);
|
|
|
|
|
}
|
|
|
|
|
void wrapper_add_project_show() {
|
|
|
|
|
set_temp_menu("project", "add");
|
|
|
|
|
temp_show(NULL, glade_path);
|
|
|
|
|
}
|
|
|
|
|
void wrapper_edit_project_show() {
|
|
|
|
|
int index = wrapper_select_tree_view(&cfg_custom_gui.project);
|
|
|
|
|
set_temp_menu("project", "edit");
|
|
|
|
|
temp_show(NULL, glade_path);
|
|
|
|
|
set_edit_gui_data_base(all_config, index);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int fill_tree_view_project(config_all* all_config, char* disk, hotebook* widget , char* str_fill, int flag_gui_add) {
|
|
|
|
|
GtkTreeModel *model = GTK_TREE_MODEL(widget->liststore);
|
|
|
|
|
if (flag_gui_add == 0) {
|
|
|
|
|
g_object_ref(list);
|
|
|
|
|
gtk_list_store_clear(list);
|
|
|
|
|
g_object_ref(widget->liststore);
|
|
|
|
|
gtk_list_store_clear(widget->liststore);
|
|
|
|
|
}
|
|
|
|
|
int flag_searhc = 0;
|
|
|
|
|
for (int i = 0; i < all_config->v_u_g_p.pfVectorTotal(&all_config->v_u_g_p); i++) {
|
|
|
|
@ -18,19 +62,19 @@ int fill_tree_view_project(config_all* all_config, char* disk, GtkWidget* tree_v
|
|
|
|
|
if (strcmp(_config->type_arr, str_fill) == 0 && strstr(_config->UNIX_file, disk)) {
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
flag_searhc++;
|
|
|
|
|
gtk_list_store_append(list,&iter);
|
|
|
|
|
gtk_list_store_append(widget->liststore,&iter);
|
|
|
|
|
char* deferring_size = wrapper_str_time(_config->deferring_size);
|
|
|
|
|
char* deferring_file = wrapper_str_time(_config->deferring_file);
|
|
|
|
|
gtk_list_store_set(list,&iter,
|
|
|
|
|
gtk_list_store_set(widget->liststore,&iter,
|
|
|
|
|
0,fill_tree_view_id(_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),
|
|
|
|
|
5,philos_format_cfg_str_size_memory("", _config->severe_limitation_size,_config->severe_limitation_size_pow),
|
|
|
|
|
6,yon_char_from_int(_config->soft_restriction_file),
|
|
|
|
|
7,_config->files,
|
|
|
|
|
8,philos_format_cfg_str_size_memory("", _config->severe_limitation_file, _config->severe_limitation_file_pow),
|
|
|
|
|
8,yon_char_from_int(_config->severe_limitation_file),
|
|
|
|
|
9,deferring_size,
|
|
|
|
|
10,deferring_file,
|
|
|
|
|
-1);
|
|
|
|
@ -38,16 +82,16 @@ int fill_tree_view_project(config_all* all_config, char* disk, GtkWidget* tree_v
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (flag_gui_add != 0) {
|
|
|
|
|
gtk_tree_view_set_model(GTK_TREE_VIEW(tree_view), model);
|
|
|
|
|
gtk_tree_view_set_model(GTK_TREE_VIEW(widget->spinWeeksFile), model);
|
|
|
|
|
}
|
|
|
|
|
return flag_searhc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int fill_tree_view_user_group(config_all* all_config, char* disk, GtkWidget* tree_view,char* str_fill ,GtkListStore* list, int flag_gui_add) {
|
|
|
|
|
GtkTreeModel *model = GTK_TREE_MODEL(list);
|
|
|
|
|
int fill_tree_view_user_group(config_all* all_config, char* disk, hotebook* widget,char* str_fill ,int flag_gui_add) {
|
|
|
|
|
GtkTreeModel *model = GTK_TREE_MODEL(widget->liststore);
|
|
|
|
|
if (flag_gui_add == 0) {
|
|
|
|
|
g_object_ref(list);
|
|
|
|
|
gtk_list_store_clear(list);
|
|
|
|
|
g_object_ref(widget->liststore);
|
|
|
|
|
gtk_list_store_clear(widget->liststore);
|
|
|
|
|
}
|
|
|
|
|
int flag_searhc = 0;
|
|
|
|
|
for (int i = 0; i < all_config->v_u_g_p.pfVectorTotal(&all_config->v_u_g_p); i++) {
|
|
|
|
@ -55,32 +99,32 @@ int fill_tree_view_user_group(config_all* all_config, char* disk, GtkWidget* tre
|
|
|
|
|
if (strcmp(_config->type_arr, str_fill) == 0 && strstr(_config->UNIX_file, disk)) {
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
flag_searhc++;
|
|
|
|
|
gtk_list_store_append(list,&iter);
|
|
|
|
|
gtk_list_store_append(widget->liststore,&iter);
|
|
|
|
|
char* deferring_size = wrapper_str_time(_config->deferring_size);
|
|
|
|
|
char* deferring_file = wrapper_str_time(_config->deferring_file);
|
|
|
|
|
gtk_list_store_set(list,&iter,
|
|
|
|
|
gtk_list_store_set(widget->liststore,&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),
|
|
|
|
|
4,philos_format_cfg_str_size_memory("", _config->severe_limitation_size,_config->severe_limitation_size_pow),
|
|
|
|
|
5,yon_char_from_int(_config->soft_restriction_file),
|
|
|
|
|
6,_config->files,
|
|
|
|
|
7,philos_format_cfg_str_size_memory("", _config->severe_limitation_file, _config->severe_limitation_file_pow),
|
|
|
|
|
7,yon_char_from_int(_config->severe_limitation_file),
|
|
|
|
|
8,deferring_size,
|
|
|
|
|
9,deferring_file,
|
|
|
|
|
-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (flag_gui_add != 0) {
|
|
|
|
|
gtk_tree_view_set_model(GTK_TREE_VIEW(tree_view), model);
|
|
|
|
|
gtk_tree_view_set_model(GTK_TREE_VIEW(widget->tree_view), model);
|
|
|
|
|
}
|
|
|
|
|
return flag_searhc;
|
|
|
|
|
}
|
|
|
|
|
void entry_user_disk() {
|
|
|
|
|
char* activ_text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(cfg_custom_gui.user.comboBox));
|
|
|
|
|
activ_text= yon_char_divide_search(activ_text, " ", -1);
|
|
|
|
|
int find = fill_tree_view_user_group(all_config, activ_text, cfg_custom_gui.user.tree_view,"usrquota", cfg_custom_gui.user.liststore, 0);
|
|
|
|
|
int find = fill_tree_view_user_group(all_config, activ_text, &cfg_custom_gui.user,"usrquota", 0);
|
|
|
|
|
if (find == 0) {
|
|
|
|
|
g_object_ref(cfg_custom_gui.user.liststore);
|
|
|
|
|
gtk_list_store_clear(cfg_custom_gui.user.liststore);
|
|
|
|
@ -89,7 +133,7 @@ void entry_user_disk() {
|
|
|
|
|
void entry_groups_disk() {
|
|
|
|
|
char* activ_text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(cfg_custom_gui.group.comboBox));
|
|
|
|
|
activ_text= yon_char_divide_search(activ_text, " ", -1);
|
|
|
|
|
int find = fill_tree_view_user_group(all_config, activ_text, cfg_custom_gui.group.tree_view,"grpquota", cfg_custom_gui.group.liststore, 0);
|
|
|
|
|
int find = fill_tree_view_user_group(all_config, activ_text, &cfg_custom_gui.group,"grpquota", 0);
|
|
|
|
|
if (find == 0) {
|
|
|
|
|
g_object_ref(cfg_custom_gui.group.liststore);
|
|
|
|
|
gtk_list_store_clear(cfg_custom_gui.group.liststore);
|
|
|
|
@ -99,43 +143,17 @@ void entry_groups_disk() {
|
|
|
|
|
void entry_project_disk() {
|
|
|
|
|
char* activ_text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(cfg_custom_gui.group.comboBox));
|
|
|
|
|
activ_text= yon_char_divide_search(activ_text, " ", -1);
|
|
|
|
|
int find = fill_tree_view_project(all_config, activ_text, cfg_custom_gui.project.tree_view,"prjquota", cfg_custom_gui.project.liststore, 0);
|
|
|
|
|
int find = fill_tree_view_project(all_config, activ_text, &cfg_custom_gui.project,"prjquota", 0);
|
|
|
|
|
if (find == 0) {
|
|
|
|
|
g_object_ref(cfg_custom_gui.project.liststore);
|
|
|
|
|
gtk_list_store_clear(cfg_custom_gui.project.liststore);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void set_time_spin(hotebook* widgets, size_t seconds_file, size_t seconds_size) {
|
|
|
|
|
me_time t_file = time_convert(seconds_file);
|
|
|
|
|
me_time t_size = time_convert(seconds_size);
|
|
|
|
|
if (seconds_file!=-1) {
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->spinWeeksFile), t_file.weeks);
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->spinDaysFile), t_file.days);
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->spinHoursFile), t_file.hours);
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->spinMinutesFile), t_file.minutes);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->spinWeeksFile), 0);
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->spinDaysFile), 0);
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->spinHoursFile), 0);
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->spinMinutesFile), 0);
|
|
|
|
|
}
|
|
|
|
|
if (seconds_size!=-1) {
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->spinWeeksSize), t_size.weeks);
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->spinDaysSize), t_size.days);
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->spinHoursSize), t_size.hours);
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->spinMinutesSize), t_size.minutes);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->spinWeeksSize), 0);
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->spinDaysSize), 0);
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->spinHoursSize), 0);
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->spinMinutesSize), 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void tree_view_select(hotebook* widgets) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void tree_view_select(GtkWidget* self, hotebook* widgets) {
|
|
|
|
|
tree_view_edit(all_config, widgets);
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
GtkTreeModel *model = GTK_TREE_MODEL(widgets->liststore);
|
|
|
|
@ -154,24 +172,20 @@ void tree_view_select(hotebook* widgets) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int tree_view_edit(config_all* _all_config, hotebook* widgets) {
|
|
|
|
|
|
|
|
|
|
int wrapper_select_tree_view(hotebook* widgets) {
|
|
|
|
|
int index = 0;
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
GtkTreeModel *model = GTK_TREE_MODEL(widgets->liststore);
|
|
|
|
|
|
|
|
|
|
GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->tree_view));
|
|
|
|
|
if(gtk_tree_selection_get_selected(selection, &model, &iter)) {
|
|
|
|
|
all_config->flag_set_data = 1;
|
|
|
|
|
all_config->flag_save = 2;
|
|
|
|
|
char* str_iter = gtk_tree_model_get_string_from_iter(model, &iter);
|
|
|
|
|
index = atoi(str_iter);
|
|
|
|
|
_all_config->v_u_g_p;
|
|
|
|
|
config_u_g_p* _config = (config_u_g_p*)_all_config->v_u_g_p.pfVectorGet(&_all_config->v_u_g_p, index);
|
|
|
|
|
set_time_spin(widgets,_config->deferring_file, _config->deferring_size);
|
|
|
|
|
return 1;
|
|
|
|
|
return index;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return 0;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -362,10 +376,14 @@ int main(int argc, char *argv[]){
|
|
|
|
|
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)
|
|
|
|
|
if (getuid()!=0) {
|
|
|
|
|
load_global_cfg();
|
|
|
|
|
yon_ubl_status_box_render(ROOT_WARNING_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
else
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
load_system_cfg();
|
|
|
|
|
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);
|
|
|
|
|