|
|
@ -17,7 +17,7 @@ void on_save_done(main_window *, config_str output, int size){
|
|
|
|
case 1:
|
|
|
|
case 1:
|
|
|
|
yon_ubl_status_box_render(LOCAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
yon_ubl_status_box_render(LOCAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
case 3:
|
|
|
|
yon_ubl_status_box_render(GLOBAL_LOCAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
yon_ubl_status_box_render(GLOBAL_LOCAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -302,25 +302,25 @@ void on_quotas_save(GtkWidget *self, dictionary *windows){
|
|
|
|
char *hard = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->HardRestrictionCheck)) ? yon_char_append(yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->HardRestrictionSpin))),get_size_mod(GTK_COMBO_BOX(window->HardRestrictionCombo))) : NULL;
|
|
|
|
char *hard = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->HardRestrictionCheck)) ? yon_char_append(yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->HardRestrictionSpin))),get_size_mod(GTK_COMBO_BOX(window->HardRestrictionCombo))) : NULL;
|
|
|
|
char *paging = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->PagingLimitCheck)) ? yon_char_append(yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->PagingLimitSpin))),get_size_mod(GTK_COMBO_BOX(window->PagingLimitCombo))) : NULL;
|
|
|
|
char *paging = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->PagingLimitCheck)) ? yon_char_append(yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->PagingLimitSpin))),get_size_mod(GTK_COMBO_BOX(window->PagingLimitCombo))) : NULL;
|
|
|
|
char *cpu = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->CpuLimitCheck)) ? yon_char_append(yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->CpuLimitSpin))),"%") : NULL;
|
|
|
|
char *cpu = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->CpuLimitCheck)) ? yon_char_append(yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->CpuLimitSpin))),"%") : NULL;
|
|
|
|
char *read_limit = "";
|
|
|
|
char *read_limit = NULL;
|
|
|
|
char *read_devices = "";
|
|
|
|
char *read_devices = NULL;
|
|
|
|
dictionary *dict;
|
|
|
|
dictionary *dict;
|
|
|
|
for_dictionaries(dict,window->devices){
|
|
|
|
for_dictionaries(dict,window->devices){
|
|
|
|
if (dict->data&&yon_dictionary_get_data(dict,device_limits*)->read)
|
|
|
|
if (dict->data&&yon_dictionary_get_data(dict,device_limits*)->read)
|
|
|
|
read_devices = yon_char_unite(read_devices,"",yon_char_divide_search(yon_char_new(dict->key)," ",-1)," ",yon_dictionary_get_data(dict,device_limits*)->read,"\n",NULL);
|
|
|
|
read_devices = yon_char_unite(read_devices?read_devices:"","",yon_char_divide_search(yon_char_new(dict->key)," ",-1)," ",yon_dictionary_get_data(dict,device_limits*)->read,"\n",NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (read_devices[strlen(read_devices)-1]=='\n') read_devices[strlen(read_devices)-1]='\0';
|
|
|
|
if (!yon_char_is_empty(read_devices)&&read_devices[strlen(read_devices)-1]=='\n') read_devices[strlen(read_devices)-1]='\0';
|
|
|
|
read_limit = yon_char_unite(read_limit,read_devices,NULL);
|
|
|
|
read_limit = yon_char_unite(read_limit?read_limit:"",read_devices,NULL);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char *write_limit = "";
|
|
|
|
char *write_limit = NULL;
|
|
|
|
char *write_devices = "";
|
|
|
|
char *write_devices = NULL;
|
|
|
|
for_dictionaries(dict,window->devices){
|
|
|
|
for_dictionaries(dict,window->devices){
|
|
|
|
if (dict->data&&yon_dictionary_get_data(dict,device_limits*)->write)
|
|
|
|
if (dict->data&&yon_dictionary_get_data(dict,device_limits*)->write)
|
|
|
|
write_devices = yon_char_unite(write_devices,"",yon_char_divide_search(yon_char_new(dict->key)," ",-1)," ",yon_dictionary_get_data(dict,device_limits*)->write,"\n",NULL);
|
|
|
|
write_devices = yon_char_unite(write_devices?write_devices:"","",yon_char_divide_search(yon_char_new(dict->key)," ",-1)," ",yon_dictionary_get_data(dict,device_limits*)->write,"\n",NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (write_devices[strlen(write_devices)-1]=='\n') write_devices[strlen(write_devices)-1]='\0';
|
|
|
|
if (!yon_char_is_empty(write_devices)&&write_devices[strlen(write_devices)-1]=='\n') write_devices[strlen(write_devices)-1]='\0';
|
|
|
|
write_limit = yon_char_unite(write_limit,write_devices,NULL);
|
|
|
|
write_limit = yon_char_unite(write_limit?write_limit:"",write_devices,NULL);
|
|
|
|
gtk_list_store_append(main_config.list,&iter);
|
|
|
|
gtk_list_store_append(main_config.list,&iter);
|
|
|
|
gtk_list_store_set(main_config.list,&iter,0,type,1,target,2,soft,3,hard,4,paging,5,cpu,6,read_limit,7,write_limit,8,string,-1);
|
|
|
|
gtk_list_store_set(main_config.list,&iter,0,type,1,target,2,soft,3,hard,4,paging,5,cpu,6,read_limit,7,write_limit,8,string,-1);
|
|
|
|
yon_config_register(CGROUP_QUOTA((char*)target),CGROUP_QUOTA_comd((char*)target),yon_char_new((char*)string));
|
|
|
|
yon_config_register(CGROUP_QUOTA((char*)target),CGROUP_QUOTA_comd((char*)target),yon_char_new((char*)string));
|
|
|
@ -801,7 +801,7 @@ void on_add_open(GtkWidget *, main_window *widgets){
|
|
|
|
void on_information_chosen_changed(GtkWidget *self, main_window *widgets){
|
|
|
|
void on_information_chosen_changed(GtkWidget *self, main_window *widgets){
|
|
|
|
const char *chosen = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(self));
|
|
|
|
const char *chosen = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(self));
|
|
|
|
if (chosen){
|
|
|
|
if (chosen){
|
|
|
|
char *command = yon_char_unite(get_information_command, (char*)chosen," --no-pager",NULL);
|
|
|
|
char *command = get_information_command((char*)chosen);
|
|
|
|
main_config.last_info = yon_char_new((char*)chosen);
|
|
|
|
main_config.last_info = yon_char_new((char*)chosen);
|
|
|
|
vte_terminal_reset(VTE_TERMINAL(widgets->InformationTerminal),1,1);
|
|
|
|
vte_terminal_reset(VTE_TERMINAL(widgets->InformationTerminal),1,1);
|
|
|
|
yon_terminal_integrated_start(widgets->InformationTerminal, command);
|
|
|
|
yon_terminal_integrated_start(widgets->InformationTerminal, command);
|
|
|
@ -824,7 +824,7 @@ void on_information(GtkWidget *, main_window *widgets){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->TargetCombo),yon_gtk_combo_box_text_find(widgets->TargetCombo,name));
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->TargetCombo),yon_gtk_combo_box_text_find(widgets->TargetCombo,name));
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->TargetCombo),on_information_chosen_changed,widgets);
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->TargetCombo),on_information_chosen_changed,widgets);
|
|
|
|
char *command = yon_char_unite(get_information_command, (char*)name," --no-pager",NULL);
|
|
|
|
char *command = get_information_command((char*)name);
|
|
|
|
main_config.last_info = yon_char_new((char*)name);
|
|
|
|
main_config.last_info = yon_char_new((char*)name);
|
|
|
|
vte_terminal_reset(VTE_TERMINAL(widgets->InformationTerminal),1,1);
|
|
|
|
vte_terminal_reset(VTE_TERMINAL(widgets->InformationTerminal),1,1);
|
|
|
|
yon_terminal_integrated_start(widgets->InformationTerminal, command);
|
|
|
|
yon_terminal_integrated_start(widgets->InformationTerminal, command);
|
|
|
@ -835,7 +835,7 @@ void on_information(GtkWidget *, main_window *widgets){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_information_update(GtkWidget *, main_window *widgets){
|
|
|
|
void on_information_update(GtkWidget *, main_window *widgets){
|
|
|
|
char *command = yon_char_unite(get_information_command, main_config.last_info," --no-pager",NULL);
|
|
|
|
char *command = get_information_command(main_config.last_info);
|
|
|
|
vte_terminal_reset(VTE_TERMINAL(widgets->InformationTerminal),1,1);
|
|
|
|
vte_terminal_reset(VTE_TERMINAL(widgets->InformationTerminal),1,1);
|
|
|
|
yon_terminal_integrated_start(widgets->InformationTerminal, command);
|
|
|
|
yon_terminal_integrated_start(widgets->InformationTerminal, command);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -875,25 +875,25 @@ void on_quotas_edit(GtkWidget *self, dictionary *windows){
|
|
|
|
char *hard = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->HardRestrictionCheck)) ? yon_char_append(yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->HardRestrictionSpin))),get_size_mod(GTK_COMBO_BOX(window->HardRestrictionCombo))) : NULL;
|
|
|
|
char *hard = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->HardRestrictionCheck)) ? yon_char_append(yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->HardRestrictionSpin))),get_size_mod(GTK_COMBO_BOX(window->HardRestrictionCombo))) : NULL;
|
|
|
|
char *paging = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->PagingLimitCheck)) ? yon_char_append(yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->PagingLimitSpin))),get_size_mod(GTK_COMBO_BOX(window->PagingLimitCombo))) : NULL;
|
|
|
|
char *paging = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->PagingLimitCheck)) ? yon_char_append(yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->PagingLimitSpin))),get_size_mod(GTK_COMBO_BOX(window->PagingLimitCombo))) : NULL;
|
|
|
|
char *cpu = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->CpuLimitCheck)) ? yon_char_append(yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->CpuLimitSpin))),"%") : NULL;
|
|
|
|
char *cpu = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->CpuLimitCheck)) ? yon_char_append(yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->CpuLimitSpin))),"%") : NULL;
|
|
|
|
char *read_limit = "";
|
|
|
|
char *read_limit = NULL;
|
|
|
|
char *read_devices = "";
|
|
|
|
char *read_devices = NULL;
|
|
|
|
dictionary *dict;
|
|
|
|
dictionary *dict;
|
|
|
|
for_dictionaries(dict,window->devices){
|
|
|
|
for_dictionaries(dict,window->devices){
|
|
|
|
if (dict->data&&yon_dictionary_get_data(dict,device_limits*)->read)
|
|
|
|
if (dict->data&&yon_dictionary_get_data(dict,device_limits*)->read)
|
|
|
|
read_devices = yon_char_unite(read_devices,"",yon_char_divide_search(yon_char_new(dict->key)," ",-1)," ",yon_dictionary_get_data(dict,device_limits*)->read,"\n",NULL);
|
|
|
|
read_devices = yon_char_unite(read_devices?read_devices:"","",yon_char_divide_search(yon_char_new(dict->key)," ",-1)," ",yon_dictionary_get_data(dict,device_limits*)->read,"\n",NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (read_devices[strlen(read_devices)-1]=='\n') read_devices[strlen(read_devices)-1]='\0';
|
|
|
|
if (read_devices[strlen(read_devices)-1]=='\n') read_devices[strlen(read_devices)-1]='\0';
|
|
|
|
read_limit = yon_char_unite(read_limit,read_devices,NULL);
|
|
|
|
read_limit = yon_char_unite(read_limit?read_limit:"",read_devices,NULL);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char *write_limit = "";
|
|
|
|
char *write_limit = NULL;
|
|
|
|
char *write_devices = "";
|
|
|
|
char *write_devices = NULL;
|
|
|
|
for_dictionaries(dict,window->devices){
|
|
|
|
for_dictionaries(dict,window->devices){
|
|
|
|
if (dict->data&&yon_dictionary_get_data(dict,device_limits*)->write)
|
|
|
|
if (dict->data&&yon_dictionary_get_data(dict,device_limits*)->write)
|
|
|
|
write_devices = yon_char_unite(write_devices,"",yon_char_divide_search(yon_char_new(dict->key)," ",-1)," ",yon_dictionary_get_data(dict,device_limits*)->write,"\n",NULL);
|
|
|
|
write_devices = yon_char_unite(write_devices?write_devices:"","",yon_char_divide_search(yon_char_new(dict->key)," ",-1)," ",yon_dictionary_get_data(dict,device_limits*)->write,"\n",NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (write_devices[strlen(write_devices)-1]=='\n') write_devices[strlen(write_devices)-1]='\0';
|
|
|
|
if (write_devices[strlen(write_devices)-1]=='\n') write_devices[strlen(write_devices)-1]='\0';
|
|
|
|
write_limit = yon_char_unite(write_limit,write_devices,NULL);
|
|
|
|
write_limit = yon_char_unite(write_limit?write_limit:"",write_devices,NULL);
|
|
|
|
gtk_list_store_set(main_config.list,&iter,1,target,2,soft,3,hard,4,paging,5,cpu,6,read_limit,7,write_limit,8,string,-1);
|
|
|
|
gtk_list_store_set(main_config.list,&iter,1,target,2,soft,3,hard,4,paging,5,cpu,6,read_limit,7,write_limit,8,string,-1);
|
|
|
|
yon_config_register(CGROUP_QUOTA(target),CGROUP_QUOTA_comd(target),(char*)string);
|
|
|
|
yon_config_register(CGROUP_QUOTA(target),CGROUP_QUOTA_comd(target),(char*)string);
|
|
|
|
on_subwindow_close(self);
|
|
|
|
on_subwindow_close(self);
|
|
|
@ -1163,12 +1163,13 @@ void on_edit_open(GtkWidget *, main_window *widgets){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_dispatcher_update(GtkWidget *,main_window *widgets){
|
|
|
|
gboolean on_dispatcher_update(GtkWidget *,main_window *widgets){
|
|
|
|
int interval = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widgets->DispatcherUpdateSpin));
|
|
|
|
int interval = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widgets->DispatcherUpdateSpin));
|
|
|
|
if (interval>0) {
|
|
|
|
if (interval>0) {
|
|
|
|
char* str_second = yon_char_from_int(interval);
|
|
|
|
char* str_second = yon_char_from_int(interval);
|
|
|
|
char *command = yon_char_unite(get_dispatcher_command," -d ",str_second,NULL);
|
|
|
|
char *command = yon_char_unite(get_dispatcher_command," -d ",str_second,NULL);
|
|
|
|
if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->DispatcherUpdateCheck))) command = yon_char_append(command," -n 1");
|
|
|
|
if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->DispatcherUpdateCheck))) command = yon_char_append(command," -n 1");
|
|
|
|
|
|
|
|
vte_terminal_reset(VTE_TERMINAL(widgets->DispatcherTerminal),1,1);
|
|
|
|
yon_terminal_integrated_start_shell(widgets->DispatcherTerminal, command,NULL,NULL);
|
|
|
|
yon_terminal_integrated_start_shell(widgets->DispatcherTerminal, command,NULL,NULL);
|
|
|
|
free(str_second);
|
|
|
|
free(str_second);
|
|
|
|
GValue *val = g_malloc0(sizeof(GValue));
|
|
|
|
GValue *val = g_malloc0(sizeof(GValue));
|
|
|
@ -1177,6 +1178,7 @@ void on_dispatcher_update(GtkWidget *,main_window *widgets){
|
|
|
|
g_object_set_property(G_OBJECT(widgets->DispatcherUpdateSpin),"has-focus",val);
|
|
|
|
g_object_set_property(G_OBJECT(widgets->DispatcherUpdateSpin),"has-focus",val);
|
|
|
|
g_free(val);
|
|
|
|
g_free(val);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_processes_update(GtkWidget *,main_window *widgets){
|
|
|
|
void on_processes_update(GtkWidget *,main_window *widgets){
|
|
|
@ -1307,10 +1309,18 @@ void yon_main_window_complete(main_window *widgets){
|
|
|
|
main_config.users = yon_ubl_get_all_users(&main_config.users_size);
|
|
|
|
main_config.users = yon_ubl_get_all_users(&main_config.users_size);
|
|
|
|
main_config.processes = yon_config_load(get_processes_command,&main_config.processes_size);
|
|
|
|
main_config.processes = yon_config_load(get_processes_command,&main_config.processes_size);
|
|
|
|
main_config.slices = yon_config_load(get_slices_command,&main_config.slices_size);
|
|
|
|
main_config.slices = yon_config_load(get_slices_command,&main_config.slices_size);
|
|
|
|
|
|
|
|
for(int i=0;i<main_config.users_size;i++){
|
|
|
|
|
|
|
|
yon_char_remove_last_symbol(main_config.users[i],'\n');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for(int i=0;i<main_config.processes_size;i++){
|
|
|
|
|
|
|
|
yon_char_remove_last_symbol(main_config.processes[i],'\n');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for(int i=0;i<main_config.slices_size;i++){
|
|
|
|
|
|
|
|
yon_char_remove_last_symbol(main_config.slices[i],'\n');
|
|
|
|
|
|
|
|
}
|
|
|
|
on_info_target_type_switched(widgets->TargetTypeCombo,widgets);
|
|
|
|
on_info_target_type_switched(widgets->TargetTypeCombo,widgets);
|
|
|
|
gtk_widget_show(widgets->Window);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
on_config_local_load(NULL,widgets);
|
|
|
|
yon_root_button_setup((template_main_window*)widgets,main_config.launch_arguments,main_config.launch_size);
|
|
|
|
yon_root_button_setup((template_main_window*)widgets,main_config.launch_arguments,main_config.launch_size);
|
|
|
|
yon_save_window_set_postsave_function(on_save_done,widgets);
|
|
|
|
yon_save_window_set_postsave_function(on_save_done,widgets);
|
|
|
|
}
|
|
|
|
}
|
|
|
|