|
|
|
@ -292,7 +292,7 @@ void on_quotas_save(GtkWidget *self, dictionary *windows){
|
|
|
|
|
// main_window *widgets = yon_dictionary_get_data(windows->first->next,main_window*);
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
if (!strcmp(gtk_entry_get_text(GTK_ENTRY(window->ManualInputEntry)),"")){
|
|
|
|
|
yon_ubl_status_box_render(OPERATION_FAILED_EMPTY_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),OPERATION_FAILED_EMPTY_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const char *string = gtk_entry_get_text(GTK_ENTRY(window->ManualInputEntry));
|
|
|
|
@ -673,6 +673,7 @@ void on_add_open(GtkWidget *, main_window *widgets){
|
|
|
|
|
window->Window = yon_gtk_builder_get_widget(builder,"QuotasWindow");
|
|
|
|
|
|
|
|
|
|
window->TitleLabel = yon_gtk_builder_get_widget(builder,"TitleLabel");
|
|
|
|
|
window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox");
|
|
|
|
|
window->BlockUiBox = yon_gtk_builder_get_widget(builder,"BlockUiBox");
|
|
|
|
|
window->TargetTypeCombo = yon_gtk_builder_get_widget(builder,"TargetTypeCombo");
|
|
|
|
|
window->AddQuotaTargetBox = yon_gtk_builder_get_widget(builder,"AddQuotaTargetBox");
|
|
|
|
@ -845,9 +846,14 @@ void on_remove(GtkWidget *, main_window *widgets){
|
|
|
|
|
if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->MainTree)),&model,&iter)){
|
|
|
|
|
char *name;
|
|
|
|
|
gtk_tree_model_get(model,&iter,1,&name,-1);
|
|
|
|
|
yon_config_set(CGROUP_QUOTA(name),"");
|
|
|
|
|
gtk_list_store_remove(main_config.list,&iter);
|
|
|
|
|
yon_ubl_status_box_render(SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
|
dialog_confirmation_data *data = yon_confirmation_dialog_data_new();
|
|
|
|
|
data->title = REMOVE_TITLE_LABEL;
|
|
|
|
|
data->action_text = REMOVE_VALIDATION_LABEL(name);
|
|
|
|
|
if (yon_confirmation_dialog_call(widgets->Window,data)==GTK_RESPONSE_ACCEPT){
|
|
|
|
|
yon_config_remove_by_key(CGROUP_QUOTA(name));
|
|
|
|
|
gtk_list_store_remove(main_config.list,&iter);
|
|
|
|
|
yon_ubl_status_box_render(SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else yon_ubl_status_box_render(NOTHING_CHOSEN_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
|
|
|
|
@ -859,7 +865,7 @@ void on_quotas_edit(GtkWidget *self, dictionary *windows){
|
|
|
|
|
main_window *widgets = yon_dictionary_get_data(windows->first->next,main_window*);
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
if (!strcmp(gtk_entry_get_text(GTK_ENTRY(window->ManualInputEntry)),"")){
|
|
|
|
|
yon_ubl_status_box_render(OPERATION_FAILED_EMPTY_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),OPERATION_FAILED_EMPTY_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->MainTree)),&model,&iter)){
|
|
|
|
@ -868,7 +874,7 @@ void on_quotas_edit(GtkWidget *self, dictionary *windows){
|
|
|
|
|
char *soft = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->SoftRestrictionCheck)) ? yon_char_append(yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->SoftRestrictionSpin))),get_size_mod(GTK_COMBO_BOX(window->SoftRestrictionCombo))) : 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 *cpu = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->CpuLimitCheck)) ? 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_devices = "";
|
|
|
|
|
dictionary *dict;
|
|
|
|
@ -889,7 +895,7 @@ void on_quotas_edit(GtkWidget *self, dictionary *windows){
|
|
|
|
|
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);
|
|
|
|
|
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_set(CGROUP_QUOTA(target),(void*)yon_char_new((char*)string));
|
|
|
|
|
yon_config_register(CGROUP_QUOTA(target),CGROUP_QUOTA_comd(target),(char*)string);
|
|
|
|
|
on_subwindow_close(self);
|
|
|
|
|
yon_ubl_status_box_render(SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
|
}
|
|
|
|
@ -931,6 +937,7 @@ void on_edit_open(GtkWidget *, main_window *widgets){
|
|
|
|
|
window->Window = yon_gtk_builder_get_widget(builder,"QuotasWindow");
|
|
|
|
|
|
|
|
|
|
window->TitleLabel = yon_gtk_builder_get_widget(builder,"TitleLabel");
|
|
|
|
|
window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox");
|
|
|
|
|
window->BlockUiBox = yon_gtk_builder_get_widget(builder,"BlockUiBox");
|
|
|
|
|
window->TargetTypeCombo = yon_gtk_builder_get_widget(builder,"TargetTypeCombo");
|
|
|
|
|
window->AddQuotaTargetBox = yon_gtk_builder_get_widget(builder,"AddQuotaTargetBox");
|
|
|
|
@ -970,7 +977,8 @@ void on_edit_open(GtkWidget *, main_window *widgets){
|
|
|
|
|
|
|
|
|
|
window->devices = NULL;
|
|
|
|
|
|
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window->Window),TITLE_LABEL);
|
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window->Window),EDITING_LABEL);
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(window->TitleLabel),EDITING_LABEL);
|
|
|
|
|
|
|
|
|
|
gtk_widget_show(window->EditQuotaTargetBox);
|
|
|
|
|
gtk_widget_hide(window->AddQuotaTargetBox);
|
|
|
|
@ -1258,7 +1266,6 @@ void yon_main_window_complete(main_window *widgets){
|
|
|
|
|
|
|
|
|
|
/* Signal connection | Присоединение сигналов */
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->DocumentationMenuItem),"activate",G_CALLBACK(on_open_documentation_confirmation),WIKI_LINK);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->AboutMenuItem),"activate",G_CALLBACK(on_about),NULL);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->FiltersButton),"clicked",G_CALLBACK(on_filters_opened),widgets);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->InformationButton),"clicked",G_CALLBACK(on_information),widgets);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->RemoveButton),"clicked",G_CALLBACK(on_remove),widgets);
|
|
|
|
|