Начата работа с дочерними окнами

pull/2/head
Igor Belitskiy 2 years ago
parent ca46e21374
commit 6c7432e698

@ -9,20 +9,52 @@ add_window *add_setup_window(char* glade_path) {
add_widgets->Window = yon_gtk_builder_get_widget(builder,"wndQuotasAdding"); add_widgets->Window = yon_gtk_builder_get_widget(builder,"wndQuotasAdding");
add_widgets->btnSaveAddSave = yon_gtk_builder_get_widget(builder,"btnSaveAddSave"); add_widgets->btnSaveAddSave = yon_gtk_builder_get_widget(builder,"btnSaveAddSave");
add_widgets->btnAddCancel = yon_gtk_builder_get_widget(builder,"btnAddCancel"); add_widgets->btnAddCancel = yon_gtk_builder_get_widget(builder,"btnAddCancel");
add_widgets->lblCPULimitAdd = yon_gtk_builder_get_widget(builder,"lblCPULimitAdd");
add_widgets->spinCPULimitAdd = yon_gtk_builder_get_widget(builder,"spinCPULimitAdd");
add_widgets->chkCPULimitAdd = yon_gtk_builder_get_widget(builder,"chkCPULimitAdd");
add_widgets->chkPaddingFLAdd = yon_gtk_builder_get_widget(builder,"chkPaddingFLAdd");
add_widgets->spinCPULimitAdd = yon_gtk_builder_get_widget(builder,"spinPaddingFLAdd");
add_widgets->chkCPULimitAdd = yon_gtk_builder_get_widget(builder,"cmbPaddingFLAdd");
add_widgets->chkSevereRestrictionAdd = yon_gtk_builder_get_widget(builder,"chkSevereRestrictionAdd");
add_widgets->spinSevereRestrictionAdd = yon_gtk_builder_get_widget(builder,"spinSevereRestrictionAdd");
add_widgets->cmbSevereRestrictionAdd = yon_gtk_builder_get_widget(builder,"cmbSevereRestrictionAdd");
add_widgets->chkSoftRestrictionAdd = yon_gtk_builder_get_widget(builder,"chkSoftRestrictionAdd");
add_widgets->spiSevereRestrictionAdd = yon_gtk_builder_get_widget(builder,"spiSevereRestrictionAdd");
add_widgets->cmSevereRestrictionAdd = yon_gtk_builder_get_widget(builder,"cmSevereRestrictionAdd");
add_event(add_widgets); add_event(add_widgets);
//add_init_windows();
} }
return add_widgets; return add_widgets;
} }
void add_init_windows() {
add_set_active_widgets(add_widgets->chkSoftRestrictionAdd, add_widgets->spiSevereRestrictionAdd, add_widgets->cmSevereRestrictionAdd);
add_set_active_widgets(add_widgets->chkSevereRestrictionAdd, add_widgets->spinSevereRestrictionAdd, add_widgets->cmbSevereRestrictionAdd);
add_set_active_widgets(add_widgets->chkPaddingFLAdd, add_widgets->spinPaddingFLAdd, add_widgets->cmbPaddingFLAdd);
add_set_active_widgets(add_widgets->chkCPULimitAdd, add_widgets->spinCPULimitAdd, add_widgets->lblCPULimitAdd);
}
void add_event(add_window *widgets) { void add_event(add_window *widgets) {
g_signal_connect(G_OBJECT(widgets->btnAddCancel),"clicked",G_CALLBACK(add_on_hide_subwindow),NULL); g_signal_connect(G_OBJECT(widgets->btnAddCancel),"clicked",G_CALLBACK(add_on_hide_subwindow),NULL);
g_signal_connect(G_OBJECT(widgets->Window), "destroy", G_CALLBACK(add_destroy), NULL); g_signal_connect(G_OBJECT(widgets->Window), "destroy", G_CALLBACK(add_destroy), NULL);
//g_signal_connect(G_OBJECT(widgets->chkSoftRestrictionAdd), "toggle", G_CALLBACK(add_set_active_widgets), widgets->spiSevereRestrictionAdd, widgets->cmSevereRestrictionAdd);
} }
void add_destroy(GtkWidget *self) { void add_destroy(GtkWidget *self) {
add_widgets = NULL; add_widgets = NULL;
} }
void add_set_active_widgets(GtkWidget *self, GtkWidget *entry, GtkWidget *label) {
gboolean active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self));
gtk_widget_set_sensitive(entry, active);
gtk_widget_set_sensitive(label, active);
}
void add_localization(add_window *widgets) { void add_localization(add_window *widgets) {
} }

@ -17,6 +17,22 @@ typedef struct {
GtkWidget* Window; GtkWidget* Window;
GtkWidget* btnSaveAddSave; GtkWidget* btnSaveAddSave;
GtkWidget* btnAddCancel; GtkWidget* btnAddCancel;
GtkWidget* chkSoftRestrictionAdd;
GtkWidget* spiSevereRestrictionAdd;
GtkWidget* cmSevereRestrictionAdd;
GtkWidget* chkSevereRestrictionAdd;
GtkWidget* spinSevereRestrictionAdd;
GtkWidget* cmbSevereRestrictionAdd;
GtkWidget* chkPaddingFLAdd;
GtkWidget* spinPaddingFLAdd;
GtkWidget* cmbPaddingFLAdd;
GtkWidget* chkCPULimitAdd;
GtkWidget* spinCPULimitAdd;
GtkWidget* lblCPULimitAdd;
} add_window; } add_window;
// Функции // Функции
@ -27,4 +43,6 @@ void add_on_hide_subwindow(GtkWidget *self);
add_window *get_widget_add(); add_window *get_widget_add();
void add_show(GtkWidget *self, char* glade_path); void add_show(GtkWidget *self, char* glade_path);
void add_destroy(GtkWidget *self); void add_destroy(GtkWidget *self);
void add_set_active_widgets(GtkWidget *self, GtkWidget *entry, GtkWidget *label);
void add_init_windows();
#endif #endif

@ -9,7 +9,24 @@ edit_window *edit_setup_window(char* glade_path){
edit_widgets->Window = yon_gtk_builder_get_widget(builder,"wndQuotasEdit"); edit_widgets->Window = yon_gtk_builder_get_widget(builder,"wndQuotasEdit");
edit_widgets->btnEditCancel = yon_gtk_builder_get_widget(builder,"btnEditCancel"); edit_widgets->btnEditCancel = yon_gtk_builder_get_widget(builder,"btnEditCancel");
edit_widgets->btnSaveEditSave = yon_gtk_builder_get_widget(builder,"btnSaveEditSave"); edit_widgets->btnSaveEditSave = yon_gtk_builder_get_widget(builder,"btnSaveEditSave");
edit_widgets->lblCPULimitEdit = yon_gtk_builder_get_widget(builder,"lblCPULimitEdit");
edit_widgets->spinCPULimitEdit = yon_gtk_builder_get_widget(builder,"spinCPULimitEdit");
edit_widgets->chkCPULimitEdit = yon_gtk_builder_get_widget(builder,"chkCPULimitEdit");
edit_widgets->chkPaddingFLEdit = yon_gtk_builder_get_widget(builder,"chkPaddingFLEdit");
edit_widgets->spinCPULimitEdit = yon_gtk_builder_get_widget(builder,"spinPaddingFLEdit");
edit_widgets->chkCPULimitEdit = yon_gtk_builder_get_widget(builder,"cmbPaddingFLEdit");
edit_widgets->chkSevereRestrictionEdit = yon_gtk_builder_get_widget(builder,"chkSevereRestrictionEdit");
edit_widgets->spinSevereRestrictionEdit = yon_gtk_builder_get_widget(builder,"spinSevereRestrictionEdit");
edit_widgets->cmbSevereRestrictionEdit = yon_gtk_builder_get_widget(builder,"cmbSevereRestrictionEdit");
edit_widgets->chkSoftRestrictionEdit = yon_gtk_builder_get_widget(builder,"chkSoftRestrictionEdit");
edit_widgets->spiSevereRestrictionEdit = yon_gtk_builder_get_widget(builder,"spiSevereRestrictionEdit");
edit_widgets->cmSevereRestrictionEdit = yon_gtk_builder_get_widget(builder,"cmSevereRestrictionEdit");
edit_event(edit_widgets); edit_event(edit_widgets);
//edit_init_windows();
} }
return edit_widgets; return edit_widgets;
} }
@ -46,3 +63,16 @@ void edit_show(GtkWidget *self, char* glade_path) {
} }
} }
void edit_init_windows() {
edit_set_active_widgets(edit_widgets->chkSoftRestrictionEdit, edit_widgets->spiSevereRestrictionEdit, edit_widgets->cmSevereRestrictionEdit);
edit_set_active_widgets(edit_widgets->chkSevereRestrictionEdit, edit_widgets->spinSevereRestrictionEdit, edit_widgets->cmbSevereRestrictionEdit);
edit_set_active_widgets(edit_widgets->chkPaddingFLEdit, edit_widgets->spinPaddingFLEdit, edit_widgets->cmbPaddingFLEdit);
edit_set_active_widgets(edit_widgets->chkCPULimitEdit, edit_widgets->spinCPULimitEdit, edit_widgets->lblCPULimitEdit);
}
void edit_set_active_widgets(GtkWidget *self, GtkWidget *entry, GtkWidget *label) {
gboolean active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self));
gtk_widget_set_sensitive(entry, active);
gtk_widget_set_sensitive(label, active);
}

@ -17,6 +17,22 @@ typedef struct {
GtkWidget* Window; GtkWidget* Window;
GtkWidget* btnSaveEditSave; GtkWidget* btnSaveEditSave;
GtkWidget* btnEditCancel; GtkWidget* btnEditCancel;
GtkWidget* chkSoftRestrictionEdit;
GtkWidget* spiSevereRestrictionEdit;
GtkWidget* cmSevereRestrictionEdit;
GtkWidget* chkSevereRestrictionEdit;
GtkWidget* spinSevereRestrictionEdit;
GtkWidget* cmbSevereRestrictionEdit;
GtkWidget* chkPaddingFLEdit;
GtkWidget* spinPaddingFLEdit;
GtkWidget* cmbPaddingFLEdit;
GtkWidget* chkCPULimitEdit;
GtkWidget* spinCPULimitEdit;
GtkWidget* lblCPULimitEdit;
} edit_window; } edit_window;
// Функции // Функции
@ -27,4 +43,6 @@ void edit_on_hide_subwindow(GtkWidget *self);
edit_window *get_widget_edit(); edit_window *get_widget_edit();
void edit_show(GtkWidget *self, char* glade_path); void edit_show(GtkWidget *self, char* glade_path);
void edit_destroy(GtkWidget *self); void edit_destroy(GtkWidget *self);
void edit_init_windows();
void edit_set_active_widgets(GtkWidget *self, GtkWidget *entry, GtkWidget *label);
#endif #endif

@ -1954,7 +1954,7 @@ limit
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<child> <child>
<object class="GtkCheckButton"> <object class="GtkCheckButton" id="chkSoftRestrictionAdd">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="receives-default">False</property> <property name="receives-default">False</property>
@ -1966,7 +1966,7 @@ limit
<property name="margin-bottom">5</property> <property name="margin-bottom">5</property>
<property name="draw-indicator">True</property> <property name="draw-indicator">True</property>
<child> <child>
<object class="GtkSpinButton"> <object class="GtkSpinButton" id="spiSevereRestrictionAdd">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
</object> </object>
@ -1979,7 +1979,7 @@ limit
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkComboBoxText"> <object class="GtkComboBoxText" id="cmSevereRestrictionAdd">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-left">5</property> <property name="margin-left">5</property>
@ -2038,7 +2038,7 @@ limit
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<child> <child>
<object class="GtkCheckButton"> <object class="GtkCheckButton" id="chkSevereRestrictionAdd">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="receives-default">False</property> <property name="receives-default">False</property>
@ -2050,7 +2050,7 @@ limit
<property name="margin-bottom">5</property> <property name="margin-bottom">5</property>
<property name="draw-indicator">True</property> <property name="draw-indicator">True</property>
<child> <child>
<object class="GtkSpinButton"> <object class="GtkSpinButton" id="spinSevereRestrictionAdd">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
</object> </object>
@ -2063,7 +2063,7 @@ limit
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkComboBoxText"> <object class="GtkComboBoxText" id="cmbSevereRestrictionAdd">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-left">5</property> <property name="margin-left">5</property>
@ -2143,7 +2143,7 @@ limit
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<child> <child>
<object class="GtkCheckButton"> <object class="GtkCheckButton" id="chkPaddingFLAdd">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="receives-default">False</property> <property name="receives-default">False</property>
@ -2155,7 +2155,7 @@ limit
<property name="margin-bottom">5</property> <property name="margin-bottom">5</property>
<property name="draw-indicator">True</property> <property name="draw-indicator">True</property>
<child> <child>
<object class="GtkSpinButton"> <object class="GtkSpinButton" id="spinPaddingFLAdd">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
</object> </object>
@ -2168,7 +2168,7 @@ limit
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkComboBoxText"> <object class="GtkComboBoxText" id="cmbPaddingFLAdd">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-left">5</property> <property name="margin-left">5</property>
@ -2226,11 +2226,11 @@ limit
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="left-padding">12</property> <property name="left-padding">12</property>
<child> <child>
<object class="GtkBox"> <object class="GtkBox" id="lblCPULimit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<child> <child>
<object class="GtkCheckButton"> <object class="GtkCheckButton" id="chkCPULimitAdd">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="receives-default">False</property> <property name="receives-default">False</property>
@ -2242,7 +2242,7 @@ limit
<property name="margin-bottom">5</property> <property name="margin-bottom">5</property>
<property name="draw-indicator">True</property> <property name="draw-indicator">True</property>
<child> <child>
<object class="GtkSpinButton"> <object class="GtkSpinButton" id="spinCPULimitAdd">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
</object> </object>
@ -2255,7 +2255,7 @@ limit
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lblCPULimitAdd">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-left">5</property> <property name="margin-left">5</property>
@ -2853,7 +2853,7 @@ limit
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<child> <child>
<object class="GtkCheckButton"> <object class="GtkCheckButton" id="chkSoftRestrictionEdit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="receives-default">False</property> <property name="receives-default">False</property>
@ -2865,7 +2865,7 @@ limit
<property name="margin-bottom">5</property> <property name="margin-bottom">5</property>
<property name="draw-indicator">True</property> <property name="draw-indicator">True</property>
<child> <child>
<object class="GtkSpinButton"> <object class="GtkSpinButton" id="spiSevereRestrictionEdit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
</object> </object>
@ -2878,7 +2878,7 @@ limit
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkComboBoxText"> <object class="GtkComboBoxText" id="cmSevereRestrictionEdit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-left">5</property> <property name="margin-left">5</property>
@ -2937,7 +2937,7 @@ limit
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<child> <child>
<object class="GtkCheckButton"> <object class="GtkCheckButton" id="chkSevereRestrictionEdit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="receives-default">False</property> <property name="receives-default">False</property>
@ -2949,7 +2949,7 @@ limit
<property name="margin-bottom">5</property> <property name="margin-bottom">5</property>
<property name="draw-indicator">True</property> <property name="draw-indicator">True</property>
<child> <child>
<object class="GtkSpinButton"> <object class="GtkSpinButton" id="spinSevereRestrictionEdit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
</object> </object>
@ -2962,7 +2962,7 @@ limit
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkComboBoxText"> <object class="GtkComboBoxText" id="cmbSevereRestrictionEdit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-left">5</property> <property name="margin-left">5</property>
@ -3042,7 +3042,7 @@ limit
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<child> <child>
<object class="GtkCheckButton"> <object class="GtkCheckButton" id="chkPaddingFLEdit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="receives-default">False</property> <property name="receives-default">False</property>
@ -3054,7 +3054,7 @@ limit
<property name="margin-bottom">5</property> <property name="margin-bottom">5</property>
<property name="draw-indicator">True</property> <property name="draw-indicator">True</property>
<child> <child>
<object class="GtkSpinButton"> <object class="GtkSpinButton" id="spinPaddingFLEdit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
</object> </object>
@ -3067,7 +3067,7 @@ limit
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkComboBoxText"> <object class="GtkComboBoxText" id="cmbPaddingFLEdit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-left">5</property> <property name="margin-left">5</property>
@ -3129,7 +3129,7 @@ limit
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<child> <child>
<object class="GtkCheckButton"> <object class="GtkCheckButton" id="chkCPULimitEdit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="receives-default">False</property> <property name="receives-default">False</property>
@ -3141,7 +3141,7 @@ limit
<property name="margin-bottom">5</property> <property name="margin-bottom">5</property>
<property name="draw-indicator">True</property> <property name="draw-indicator">True</property>
<child> <child>
<object class="GtkSpinButton"> <object class="GtkSpinButton" id="spinCPULimitEdit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
</object> </object>
@ -3154,7 +3154,7 @@ limit
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel" id="lblCPULimitEdit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-left">5</property> <property name="margin-left">5</property>

Loading…
Cancel
Save