From 1801dd0dd9592d5b07a9f60a17e37229d0e19daf Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 3 Nov 2023 16:50:48 +0600 Subject: [PATCH] Fixed logrotate period interaction --- source/ubl-settings-logging.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/source/ubl-settings-logging.c b/source/ubl-settings-logging.c index 7ed3ddd..9bc3756 100644 --- a/source/ubl-settings-logging.c +++ b/source/ubl-settings-logging.c @@ -568,6 +568,17 @@ void on_filechooser_open(GtkWidget *self, logrotate_configure_window *window){ gtk_widget_show(dialog->FileChooser); } +void on_logrotate_period_check_toggled(GtkToggleButton *self,logrotate_configure_window *window){ + if (gtk_toggle_button_get_active(self)){ + if (gtk_combo_box_get_active(GTK_COMBO_BOX(window->RotationPeriodMainCombo))==2) gtk_widget_set_sensitive(window->RotationPeriodAdditionalCombo,1); + else gtk_widget_set_sensitive(window->RotationPeriodAdditionalCombo,0); + gtk_widget_set_sensitive(window->RotationPeriodMainCombo,1); + } else { + gtk_widget_set_sensitive(window->RotationPeriodMainCombo,0); + gtk_widget_set_sensitive(window->RotationPeriodAdditionalCombo,0); + } +} + void on_logrotate_save(GtkWidget *self, dictionary *dict){ logrotate_window *dialog = yon_dictionary_get_data(dict->first,logrotate_window*); logrotate_configure_window *window = yon_dictionary_get_data(dict->first->next,logrotate_configure_window*); @@ -926,8 +937,7 @@ logrotate_configure_window *yon_logrotate_window_new(char *paths, logrotate_wind g_signal_connect(G_OBJECT(window->LogPathEditButton),"clicked",G_CALLBACK(on_logrotate_configuration_path_edit),window); g_signal_connect(G_OBJECT(window->LogPathRemoveButton),"clicked",G_CALLBACK(on_logrotate_configuration_path_remove),window); - g_signal_connect(G_OBJECT(window->RotationPeriodCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),window->RotationPeriodAdditionalCombo); - g_signal_connect(G_OBJECT(window->RotationPeriodCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),window->RotationPeriodMainCombo); + g_signal_connect(G_OBJECT(window->RotationPeriodCheck),"toggled",G_CALLBACK(on_logrotate_period_check_toggled),window); g_signal_connect(G_OBJECT(window->JournalMaxSizeCheck),"clicked",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),window->JournalMaxSizeCombo); g_signal_connect(G_OBJECT(window->JournalMaxSizeCheck),"clicked",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),window->JournalMaxSizeSpin);