From 6c993474ce459120c8f92043ef2c19e07be11ca0 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 23 Oct 2023 18:12:15 +0600 Subject: [PATCH] Fixes --- source/ubl-settings-logging.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/source/ubl-settings-logging.c b/source/ubl-settings-logging.c index b89a994..50f8252 100644 --- a/source/ubl-settings-logging.c +++ b/source/ubl-settings-logging.c @@ -517,13 +517,13 @@ void on_journald_save(GtkWidget *self, journald_window *window){ char *storage; int storage_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->LogStorageCombo)); switch (storage_active){ - case 0: storage="auto"; + case 1: storage="auto"; break; - case 1: storage="volatile"; + case 2: storage="volatile"; break; - case 2: storage="persistent"; + case 3: storage="persistent"; break; - case 3: storage="none"; + case 4: storage="none"; break; } @@ -561,6 +561,10 @@ void on_journald_save(GtkWidget *self, journald_window *window){ } if (amount>0) yon_config_register(JOURNALD("RateLimitIntervalSec"),"logging",yon_char_from_long(interval)); + } else { + yon_config_remove_by_key(JOURNALD("RateLimitBurst")); + yon_config_remove_by_key(JOURNALD("RateLimitIntervalSec")); + } if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->LogSizeMaxCheck))){ @@ -572,7 +576,8 @@ void on_journald_save(GtkWidget *self, journald_window *window){ } if (logssize>0) yon_config_register(JOURNALD("SystemMaxUse"),"logging",yon_char_from_long(logssize)); - } + } else + yon_config_remove_by_key(JOURNALD("SystemMaxUse")); if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->RotationSizeMaxCheck))){ char * rotationMaxSize; @@ -582,7 +587,8 @@ void on_journald_save(GtkWidget *self, journald_window *window){ rotationMaxSize = yon_char_append(yon_char_from_long(maxsize),modif); if (maxsize>0) yon_config_register(JOURNALD("SystemMaxFileSize"),"logging",rotationMaxSize); - } + } else + yon_config_remove_by_key(JOURNALD("SystemMaxFileSize")); long storagefree; if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->LogFreeSpaceCheck))){ @@ -593,7 +599,8 @@ void on_journald_save(GtkWidget *self, journald_window *window){ if (storagefree>0) yon_config_register(JOURNALD("SystemKeepFree"),"logging",storagespace); - } + } else + yon_config_remove_by_key(JOURNALD("SystemKeepFree")); int consoleforwardactive = gtk_combo_box_get_active(GTK_COMBO_BOX(window->RedirectCombo)); char *confor=NULL; @@ -610,8 +617,10 @@ void on_journald_save(GtkWidget *self, journald_window *window){ int forwardempty = gtk_combo_box_get_active(GTK_COMBO_BOX(window->ForwardedTypeCombo)); - - yon_config_register(JOURNALD("Storage"),"logging",storage); + if (storage_active!=0) + yon_config_register(JOURNALD("Storage"),"logging",storage); + else + yon_config_remove_by_key(JOURNALD("Storage")); if (compress_active!=0) yon_config_register(JOURNALD("Compress"),"logging",compress); else