Fixed devices saving

pull/69/head
Ivan Yartsev 1 month ago
parent 6bd9009cd1
commit cca806a303

@ -53,9 +53,8 @@ void on_device_limits_update(GtkWidget *, quota_window *window){
} }
} }
void on_quota_configuration_update(GtkWidget *self, quota_window *window){ void on_quota_configuration_update(GtkWidget *, quota_window *window){
char *output_line = NULL; char *output_line = NULL;
on_device_limits_update(self,window);
long sft = (long)gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->SoftRestrictionSpin)); long sft = (long)gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->SoftRestrictionSpin));
long hrd = (long)gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->HardRestrictionSpin)); long hrd = (long)gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->HardRestrictionSpin));
long pgl = (long)gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->PagingLimitSpin)); long pgl = (long)gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->PagingLimitSpin));
@ -218,74 +217,111 @@ void yon_get_devices(quota_window *window){
for (int i=0; i<size;i++){ for (int i=0; i<size;i++){
yon_char_remove_last_symbol(devices_parsed[i],'\n'); yon_char_remove_last_symbol(devices_parsed[i],'\n');
char *pa = strstr(devices_parsed[i],"/"); char *pa = strstr(devices_parsed[i],"/");
yon_dictionary_add_or_create_if_exists_with_data(window->devices,pa,NULL); char *device_name = yon_char_new(pa);
char *id = yon_char_divide_search(device_name," ",-1);
free(device_name);
device_limits *limits = malloc(sizeof(device_limits));
limits->device_name = yon_char_new(pa);
limits->read=NULL;
limits->write=NULL;
yon_dictionary_add_or_create_if_exists_with_data(window->devices,id,limits);
} }
yon_char_parsed_free(devices_parsed,size); yon_char_parsed_free(devices_parsed,size);
} }
void on_device_current_changed(GtkWidget *, quota_window *window){ void on_device_set(GtkWidget *self, quota_window *window){
char *chosen = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->DeviceLimitCombo)); char *id = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->DeviceLimitCombo));
if (!window->devices->data){ if (!yon_char_is_empty(id)){
printf("%s\n",gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->DeviceLimitCombo))); dictionary *current = yon_dictionary_get(&window->devices,id);
yon_dictionary_get(&window->devices,chosen); if (current){
if (!window->devices->data){ device_limits *limits = yon_dictionary_get_data(current,device_limits*);
window->devices->data = g_malloc0(sizeof(device_limits)); if (self == window->DeviceLimitReadCheck||self == window->DeviceLimitReadSpin||self == window->DeviceLimitReadCombo){
} if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->DeviceLimitReadCheck))){
((device_limits*)window->devices->data)->write=NULL; long value = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->DeviceLimitReadSpin));
((device_limits*)window->devices->data)->read=NULL; if (!value) {
} else { yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
long read_lim = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->DeviceLimitReadSpin)); yon_ubl_status_highlight_incorrect(window->DeviceLimitReadSpin);
long write_lim = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->DeviceLimitWriteSpin)); return;
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->DeviceLimitReadCheck))){ }
if (read_lim) yon_dictionary_get_data(window->devices,device_limits*)->read=yon_char_append(yon_char_from_long(read_lim),get_size_mod(GTK_COMBO_BOX(window->DeviceLimitReadCombo))); char *value_str = yon_char_from_long(value);
} else yon_dictionary_get_data(window->devices,device_limits*)->read = NULL; char *full_str = yon_char_unite(value_str,yon_size_get_mod(gtk_combo_box_get_active(GTK_COMBO_BOX(window->DeviceLimitReadCombo))),NULL);
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->DeviceLimitWriteCheck))){ if (!yon_char_is_empty(limits->read)) free(limits->read);
if (write_lim) yon_dictionary_get_data(window->devices,device_limits*)->write=yon_char_append(yon_char_from_long(write_lim),get_size_mod(GTK_COMBO_BOX(window->DeviceLimitWriteCombo))); limits->read=full_str;
} else yon_dictionary_get_data(window->devices,device_limits*)->write = NULL; } else {
yon_dictionary_get(&window->devices,chosen); limits->read=NULL;
if (!window->devices->data){ }
window->devices->data = g_malloc0(sizeof(device_limits)); } else if (self == window->DeviceLimitWriteCheck||self == window->DeviceLimitWriteSpin||self == window->DeviceLimitWriteCombo){
} if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->DeviceLimitWriteCheck))){
((device_limits*)window->devices->data)->write=NULL; long value = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->DeviceLimitWriteSpin));
((device_limits*)window->devices->data)->read=NULL; if (!value) {
char *read = yon_dictionary_get_data(window->devices,device_limits*)->read; yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
char *write = yon_dictionary_get_data(window->devices,device_limits*)->write; yon_ubl_status_highlight_incorrect(window->DeviceLimitWriteSpin);
if (read) { return;
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->DeviceLimitReadSpin),atoi(read)); }
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DeviceLimitReadCheck),1); char *value_str = yon_char_from_long(value);
switch (read[strlen(read)-1]){ char *full_str = yon_char_unite(value_str,yon_size_get_mod(gtk_combo_box_get_active(GTK_COMBO_BOX(window->DeviceLimitWriteCombo))),NULL);
case 'K': gtk_combo_box_set_active(GTK_COMBO_BOX(window->DeviceLimitReadCombo),0); if (!yon_char_is_empty(limits->read)) free(limits->read);
break; limits->read=full_str;
case 'M': gtk_combo_box_set_active(GTK_COMBO_BOX(window->DeviceLimitReadCombo),1); } else {
break; limits->read=NULL;
case 'G': gtk_combo_box_set_active(GTK_COMBO_BOX(window->DeviceLimitReadCombo),2); }
break;
case 'T': gtk_combo_box_set_active(GTK_COMBO_BOX(window->DeviceLimitReadCombo),3);
break;
} }
} else {
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->DeviceLimitReadSpin),0);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DeviceLimitReadCheck),0);
gtk_combo_box_set_active(GTK_COMBO_BOX(window->DeviceLimitReadCombo),0);
} }
if (write) { }
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->DeviceLimitWriteSpin),atoi(write)); }
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DeviceLimitWriteCheck),1);
switch (write[strlen(write)-1]){ void on_device_current_changed(GtkWidget *, quota_window *window){
case 'K': gtk_combo_box_set_active(GTK_COMBO_BOX(window->DeviceLimitWriteCombo),0); char *chosen = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->DeviceLimitCombo));
break; if (!yon_char_is_empty(chosen)){
case 'M': gtk_combo_box_set_active(GTK_COMBO_BOX(window->DeviceLimitWriteCombo),1); dictionary *current = yon_dictionary_get(&window->devices,chosen);
break; if (current){
case 'G': gtk_combo_box_set_active(GTK_COMBO_BOX(window->DeviceLimitWriteCombo),2); device_limits *limits = yon_dictionary_get_data(current,device_limits*);
break; char *read = limits->read;
case 'T': gtk_combo_box_set_active(GTK_COMBO_BOX(window->DeviceLimitWriteCombo),3); char *write = limits->write;
break; if (!yon_char_is_empty(read)) {
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->DeviceLimitReadSpin),atoi(read));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DeviceLimitReadCheck),1);
switch (read[strlen(read)-1]){
case 'K': gtk_combo_box_set_active(GTK_COMBO_BOX(window->DeviceLimitReadCombo),0);
break;
case 'M': gtk_combo_box_set_active(GTK_COMBO_BOX(window->DeviceLimitReadCombo),1);
break;
case 'G': gtk_combo_box_set_active(GTK_COMBO_BOX(window->DeviceLimitReadCombo),2);
break;
case 'T': gtk_combo_box_set_active(GTK_COMBO_BOX(window->DeviceLimitReadCombo),3);
break;
}
} else {
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->DeviceLimitReadSpin),0);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DeviceLimitReadCheck),0);
gtk_combo_box_set_active(GTK_COMBO_BOX(window->DeviceLimitReadCombo),0);
}
if (!yon_char_is_empty(write)) {
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->DeviceLimitWriteSpin),atoi(write));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DeviceLimitWriteCheck),1);
switch (write[strlen(write)-1]){
case 'K': gtk_combo_box_set_active(GTK_COMBO_BOX(window->DeviceLimitWriteCombo),0);
break;
case 'M': gtk_combo_box_set_active(GTK_COMBO_BOX(window->DeviceLimitWriteCombo),1);
break;
case 'G': gtk_combo_box_set_active(GTK_COMBO_BOX(window->DeviceLimitWriteCombo),2);
break;
case 'T': gtk_combo_box_set_active(GTK_COMBO_BOX(window->DeviceLimitWriteCombo),3);
break;
}
} else {
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->DeviceLimitWriteSpin),0);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DeviceLimitWriteCheck),0);
gtk_combo_box_set_active(GTK_COMBO_BOX(window->DeviceLimitWriteCombo),0);
} }
} else {
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->DeviceLimitWriteSpin),0);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DeviceLimitWriteCheck),0);
gtk_combo_box_set_active(GTK_COMBO_BOX(window->DeviceLimitWriteCombo),0);
} }
} else {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DeviceLimitReadCheck),0);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->DeviceLimitReadSpin),0);
gtk_combo_box_set_active(GTK_COMBO_BOX(window->DeviceLimitReadCombo),0);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DeviceLimitWriteCheck),0);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->DeviceLimitWriteSpin),0);
gtk_combo_box_set_active(GTK_COMBO_BOX(window->DeviceLimitWriteCombo),0);
} }
} }
@ -314,7 +350,6 @@ void on_quotas_save(GtkWidget *self, dictionary *windows){
if (!yon_char_is_empty(read_devices)&&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_limit:"",read_devices,NULL); read_limit = yon_char_unite(read_limit?read_limit:"",read_devices,NULL);
char *write_limit = NULL; char *write_limit = NULL;
char *write_devices = NULL; char *write_devices = NULL;
for_dictionaries(dict,window->devices){ for_dictionaries(dict,window->devices){
@ -539,7 +574,7 @@ void on_quota_manual_input(GtkWidget *self, quota_window *window){
char *name = yon_char_divide_search(value, " ",-1); char *name = yon_char_divide_search(value, " ",-1);
dictionary *dict; dictionary *dict;
for_dictionaries(dict,window->devices){ for_dictionaries(dict,window->devices){
if (strstr(dict->key,name)){ if (!strcmp(dict->key,name)){
if (!((device_limits*)dict->data)){ if (!((device_limits*)dict->data)){
dict->data = g_malloc0(sizeof(device_limits)); dict->data = g_malloc0(sizeof(device_limits));
((device_limits*)dict->data)->write=NULL; ((device_limits*)dict->data)->write=NULL;
@ -553,7 +588,7 @@ void on_quota_manual_input(GtkWidget *self, quota_window *window){
char *name = yon_char_divide_search(value, " ",-1); char *name = yon_char_divide_search(value, " ",-1);
dictionary *dict; dictionary *dict;
for_dictionaries(dict,window->devices){ for_dictionaries(dict,window->devices){
if (strstr(dict->key,name)){ if (!strcmp(dict->key,name)){
if (!((device_limits*)dict->data)){ if (!((device_limits*)dict->data)){
dict->data = g_malloc0(sizeof(device_limits)); dict->data = g_malloc0(sizeof(device_limits));
((device_limits*)dict->data)->write=NULL; ((device_limits*)dict->data)->write=NULL;
@ -738,6 +773,12 @@ void on_add_open(GtkWidget *, main_window *widgets){
gtk_adjustment_set_upper(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(window->DeviceLimitWriteSpin)),main_config.avaliable_ram); gtk_adjustment_set_upper(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(window->DeviceLimitWriteSpin)),main_config.avaliable_ram);
g_signal_connect(G_OBJECT(window->DeviceLimitCombo),"changed",G_CALLBACK(on_device_current_changed),window); g_signal_connect(G_OBJECT(window->DeviceLimitCombo),"changed",G_CALLBACK(on_device_current_changed),window);
g_signal_connect(G_OBJECT(window->DeviceLimitReadCheck),"toggled",G_CALLBACK(on_device_set),window);
g_signal_connect(G_OBJECT(window->DeviceLimitReadSpin),"value-changed",G_CALLBACK(on_device_set),window);
g_signal_connect(G_OBJECT(window->DeviceLimitReadCombo),"changed",G_CALLBACK(on_device_set),window);
g_signal_connect(G_OBJECT(window->DeviceLimitWriteCheck),"toggled",G_CALLBACK(on_device_set),window);
g_signal_connect(G_OBJECT(window->DeviceLimitWriteSpin),"value-changed",G_CALLBACK(on_device_set),window);
g_signal_connect(G_OBJECT(window->DeviceLimitWriteCombo),"changed",G_CALLBACK(on_device_set),window);
g_signal_connect(G_OBJECT(window->TargetCombo),"changed",G_CALLBACK(on_target_check_chosen),window); g_signal_connect(G_OBJECT(window->TargetCombo),"changed",G_CALLBACK(on_target_check_chosen),window);
g_signal_connect(G_OBJECT(window->SoftRestrictionSpin),"change-value",G_CALLBACK(on_check_maximum),window->SoftRestrictionCombo); g_signal_connect(G_OBJECT(window->SoftRestrictionSpin),"change-value",G_CALLBACK(on_check_maximum),window->SoftRestrictionCombo);
@ -789,7 +830,8 @@ void on_add_open(GtkWidget *, main_window *widgets){
yon_get_devices(window); yon_get_devices(window);
dictionary *dict; dictionary *dict;
for_dictionaries(dict,window->devices){ for_dictionaries(dict,window->devices){
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(window->DeviceLimitCombo),dict->key); char *temp = yon_char_new(yon_dictionary_get_data(dict,device_limits*)->device_name);
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->DeviceLimitCombo),dict->key,temp);
} }
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);
@ -882,7 +924,7 @@ void on_quotas_edit(GtkWidget *self, dictionary *windows){
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?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:"","",dict->key," ",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_limit:"",read_devices,NULL); read_limit = yon_char_unite(read_limit?read_limit:"",read_devices,NULL);
@ -892,7 +934,7 @@ void on_quotas_edit(GtkWidget *self, dictionary *windows){
char *write_devices = NULL; 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?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:"","",dict->key," ",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_limit:"",write_devices,NULL); write_limit = yon_char_unite(write_limit?write_limit:"",write_devices,NULL);
@ -1040,18 +1082,19 @@ void on_edit_open(GtkWidget *, main_window *widgets){
yon_get_devices(window); yon_get_devices(window);
dictionary *dict; dictionary *dict;
gtk_widget_set_sensitive(window->BlockUiBox,1); gtk_widget_set_sensitive(window->BlockUiBox,1);
gtk_label_set_text(GTK_LABEL(window->TargetLabel),target); gtk_label_set_markup(GTK_LABEL(window->TargetLabel),yon_char_unite(type," <b>",target,"</b>",NULL));
int read_size=0; int read_size=0;
config_str read_parsed = yon_char_parse(read,&read_size,"\n"); config_str read_parsed = yon_char_parse(read,&read_size,"\n");
int write_size=0; int write_size=0;
config_str write_parsed = yon_char_parse(write,&write_size,"\n"); config_str write_parsed = yon_char_parse(write,&write_size,"\n");
for_dictionaries(dict,window->devices){ for_dictionaries(dict,window->devices){
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(window->DeviceLimitCombo),dict->key); char *temp = yon_char_new(yon_dictionary_get_data(dict,device_limits*)->device_name);
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->DeviceLimitCombo),dict->key,temp);
if (read_parsed) if (read_parsed)
for (int i=0; i<read_size;i++){ for (int i=0; i<read_size;i++){
char *read_limit = yon_char_new(read_parsed[i]); char *read_limit = yon_char_new(read_parsed[i]);
char *read_cur = yon_char_divide_search(read_limit," ",-1); char *read_cur = yon_char_divide_search(read_limit," ",-1);
if (strstr(dict->key,read_cur)){ if (strstr(temp,read_cur)){
if(!dict->data){ if(!dict->data){
dict->data = g_malloc0(sizeof(device_limits)); dict->data = g_malloc0(sizeof(device_limits));
((device_limits*)dict->data)->write=NULL; ((device_limits*)dict->data)->write=NULL;
@ -1063,7 +1106,7 @@ void on_edit_open(GtkWidget *, main_window *widgets){
else{ else{
char *read_limit = yon_char_new(read); char *read_limit = yon_char_new(read);
char *read_cur = yon_char_divide_search(read_limit," ",-1); char *read_cur = yon_char_divide_search(read_limit," ",-1);
if (strstr(dict->key,read_cur)){ if (strstr(temp,read_cur)){
if(!dict->data){ if(!dict->data){
dict->data = g_malloc0(sizeof(device_limits)); dict->data = g_malloc0(sizeof(device_limits));
((device_limits*)dict->data)->write=NULL; ((device_limits*)dict->data)->write=NULL;
@ -1076,7 +1119,7 @@ void on_edit_open(GtkWidget *, main_window *widgets){
for (int i=0; i<write_size;i++){ for (int i=0; i<write_size;i++){
char *write_limit = yon_char_new(write_parsed[i]); char *write_limit = yon_char_new(write_parsed[i]);
char *write_cur = yon_char_divide_search(write_limit," ",-1); char *write_cur = yon_char_divide_search(write_limit," ",-1);
if (strstr(dict->key,write_cur)){ if (strstr(temp,write_cur)){
if(!dict->data){ if(!dict->data){
dict->data = g_malloc0(sizeof(device_limits)); dict->data = g_malloc0(sizeof(device_limits));
((device_limits*)dict->data)->write=NULL; ((device_limits*)dict->data)->write=NULL;
@ -1088,7 +1131,7 @@ void on_edit_open(GtkWidget *, main_window *widgets){
else{ else{
char *write_limit = yon_char_new(write); char *write_limit = yon_char_new(write);
char *write_cur = yon_char_divide_search(write_limit," ",-1); char *write_cur = yon_char_divide_search(write_limit," ",-1);
if (strstr(dict->key,write_cur)){ if (strstr(temp,write_cur)){
if(!dict->data){ if(!dict->data){
dict->data = g_malloc0(sizeof(device_limits)); dict->data = g_malloc0(sizeof(device_limits));
((device_limits*)dict->data)->write=NULL; ((device_limits*)dict->data)->write=NULL;
@ -1103,6 +1146,12 @@ void on_edit_open(GtkWidget *, main_window *widgets){
window->devices=window->devices->first; window->devices=window->devices->first;
gtk_combo_box_set_active(GTK_COMBO_BOX(window->DeviceLimitCombo),0); gtk_combo_box_set_active(GTK_COMBO_BOX(window->DeviceLimitCombo),0);
g_signal_connect(G_OBJECT(window->DeviceLimitCombo),"changed",G_CALLBACK(on_device_current_changed),window); g_signal_connect(G_OBJECT(window->DeviceLimitCombo),"changed",G_CALLBACK(on_device_current_changed),window);
g_signal_connect(G_OBJECT(window->DeviceLimitReadCheck),"toggled",G_CALLBACK(on_device_set),window);
g_signal_connect(G_OBJECT(window->DeviceLimitReadSpin),"value-changed",G_CALLBACK(on_device_set),window);
g_signal_connect(G_OBJECT(window->DeviceLimitReadCombo),"changed",G_CALLBACK(on_device_set),window);
g_signal_connect(G_OBJECT(window->DeviceLimitWriteCheck),"toggled",G_CALLBACK(on_device_set),window);
g_signal_connect(G_OBJECT(window->DeviceLimitWriteSpin),"value-changed",G_CALLBACK(on_device_set),window);
g_signal_connect(G_OBJECT(window->DeviceLimitWriteCombo),"changed",G_CALLBACK(on_device_set),window);
if (((device_limits*)window->devices->data)->read&&strcmp(((device_limits*)window->devices->data)->read,"")!=0){ if (((device_limits*)window->devices->data)->read&&strcmp(((device_limits*)window->devices->data)->read,"")!=0){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DeviceLimitReadCheck),1); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DeviceLimitReadCheck),1);
char *rd = ((device_limits*)window->devices->data)->read; char *rd = ((device_limits*)window->devices->data)->read;

@ -177,6 +177,7 @@ typedef struct {
} filters_window; } filters_window;
typedef struct { typedef struct {
char *device_name;
char *read; char *read;
char *write; char *write;
} device_limits; } device_limits;
@ -221,4 +222,5 @@ void on_check_maximum(GtkWidget *self, GtkWidget *pair);
void on_limit_manual_input(GtkWidget *self, double *new_value, quota_window *window); void on_limit_manual_input(GtkWidget *self, double *new_value, quota_window *window);
void on_quota_configuration_update(GtkWidget *self, quota_window *window); void on_quota_configuration_update(GtkWidget *self, quota_window *window);
void on_device_limits_update(GtkWidget *, quota_window *window); void on_device_limits_update(GtkWidget *, quota_window *window);
void yon_widget_set_sensitive(GtkComboBox *toggle, GtkWidget *target); void yon_widget_set_sensitive(GtkComboBox *toggle, GtkWidget *target);
void on_device_set(GtkWidget *self, quota_window *window);

@ -87,6 +87,8 @@
#define VIEW_PROPERTIES_LABEL _("View properties for") #define VIEW_PROPERTIES_LABEL _("View properties for")
#define EMPTY_IMPORTANT_LABEL _("Important field is empty")
#define REMOVE_TITLE_LABEL _("Remove quota") #define REMOVE_TITLE_LABEL _("Remove quota")
#define REMOVE_VALIDATION_LABEL(target) yon_char_unite(_("Are you sure you want to remove quota")," <b>",target,"</b>?",NULL) #define REMOVE_VALIDATION_LABEL(target) yon_char_unite(_("Are you sure you want to remove quota")," <b>",target,"</b>?",NULL)
#define ADDING_LABEL _("Add quota") #define ADDING_LABEL _("Add quota")

@ -3,6 +3,57 @@
<interface domain="ubl-settings-resourcequota"> <interface domain="ubl-settings-resourcequota">
<requires lib="gtk+" version="3.24"/> <requires lib="gtk+" version="3.24"/>
<!-- interface-css-provider-path ubl-settings-resourcequota.css --> <!-- interface-css-provider-path ubl-settings-resourcequota.css -->
<object class="GtkAdjustment" id="adjustment1">
<property name="lower">1</property>
<property name="upper">1</property>
<property name="value">1</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustment2">
<property name="lower">1</property>
<property name="upper">1</property>
<property name="value">1</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustment3">
<property name="lower">1</property>
<property name="upper">1</property>
<property name="value">1</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustment4">
<property name="lower">1</property>
<property name="upper">1</property>
<property name="value">1</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustment5">
<property name="lower">1</property>
<property name="upper">1</property>
<property name="value">1</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustment6">
<property name="lower">1</property>
<property name="value">1</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">process-stop-symbolic</property>
</object>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">emblem-ok-symbolic</property>
</object>
<object class="GtkWindow" id="QuotasWindow"> <object class="GtkWindow" id="QuotasWindow">
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="valign">start</property> <property name="valign">start</property>
@ -941,55 +992,4 @@
<widget name="box1"/> <widget name="box1"/>
</widgets> </widgets>
</object> </object>
<object class="GtkAdjustment" id="adjustment1">
<property name="lower">1</property>
<property name="upper">1</property>
<property name="value">1</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustment2">
<property name="lower">1</property>
<property name="upper">1</property>
<property name="value">1</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustment3">
<property name="lower">1</property>
<property name="upper">1</property>
<property name="value">1</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustment4">
<property name="lower">1</property>
<property name="upper">1</property>
<property name="value">1</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustment5">
<property name="lower">1</property>
<property name="upper">1</property>
<property name="value">1</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustment6">
<property name="lower">1</property>
<property name="value">1</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">process-stop-symbolic</property>
</object>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">emblem-ok-symbolic</property>
</object>
</interface> </interface>

Loading…
Cancel
Save