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