From 026a7d228b877ce0844d22421eaea90bc8b1c30e Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 18 Aug 2025 10:59:42 +0600 Subject: [PATCH] Commands fixes --- source/ubl-settings-logging.c | 26 +++++++++++++------------- source/ubl-settings-logging.h | 4 +++- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/source/ubl-settings-logging.c b/source/ubl-settings-logging.c index 1066de3..0e09d77 100644 --- a/source/ubl-settings-logging.c +++ b/source/ubl-settings-logging.c @@ -1350,7 +1350,7 @@ void on_logrotate_save(GtkWidget *, dictionary *dict){ } GtkTreeIter iter; paths = yon_char_replace(paths,"\n",","); - yon_config_register(LOGROTATE(log_name),"logging",yon_char_unite(paths,":",commandline,NULL)); + yon_config_register(LOGROTATE(log_name),LOGROTATE_parameter_command(log_name),yon_char_unite(paths,":",commandline,NULL)); yon_window_config_add_custom_parameter(paths,"description",yon_char_new((char*)gtk_entry_get_text(GTK_ENTRY(window->LogDescriptionEntry))),YON_TYPE_STRING); yon_window_config_add_custom_parameter(paths,"render_name",yon_char_new((char*)gtk_entry_get_text(GTK_ENTRY(window->LogNameEntry))),YON_TYPE_STRING); GtkTreeModel *model = GTK_TREE_MODEL(main_config.logrotate_list); @@ -1843,7 +1843,7 @@ void on_logrotate_apps_configure(GtkWidget *, logrotate_window *window){ if (settings[0]==',') yon_char_divide_search(settings,",",-1); gtk_list_store_set(main_config.logrotate_list,&itar,0,name,1,paths,-1); paths = yon_char_replace(paths,"\n",","); - yon_config_register(LOGROTATE(name),"logging",yon_char_unite(paths,":",settings,NULL)); + yon_config_register(LOGROTATE(name),LOGROTATE_parameter_command(name),yon_char_unite(paths,":",settings,NULL)); textdomain(template_ui_LocaleName); yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),SUCCESS_LABEL,5,BACKGROUND_IMAGE_SUCCESS_TYPE); textdomain(LocaleName); @@ -2046,10 +2046,10 @@ void on_journald_save(GtkWidget *, journald_window *window){ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->LogIntervalAmountCheck))){ amount = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->LogIntervalAmountSpin)); if (amount>0) - yon_config_register(JOURNALD("RateLimitBurst"),"logging",yon_char_from_long(amount)); + yon_config_register(JOURNALD("RateLimitBurst"),JOURNALD_parameter_command("RateLimitBurst"),yon_char_from_long(amount)); } if (interval>0) - yon_config_register(JOURNALD("RateLimitIntervalSec"),"logging",yon_char_from_long(interval)); + yon_config_register(JOURNALD("RateLimitIntervalSec"),JOURNALD_parameter_command("RateLimitIntervalSec"),yon_char_from_long(interval)); } else { yon_config_remove_by_key(JOURNALD("RateLimitBurst")); yon_config_remove_by_key(JOURNALD("RateLimitIntervalSec")); @@ -2060,7 +2060,7 @@ void on_journald_save(GtkWidget *, journald_window *window){ long logssize=0; logssize = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->LogSizeMaxSpin)); int log_size_mod = gtk_combo_box_get_active(GTK_COMBO_BOX(window->LogSizeMaxCombo)); - yon_config_register(JOURNALD("SystemMaxUse"),"logging",yon_char_append(yon_char_from_long(logssize),yon_size_get_letter_from_int(log_size_mod))); + yon_config_register(JOURNALD("SystemMaxUse"),JOURNALD_parameter_command("SystemMaxUse"),yon_char_append(yon_char_from_long(logssize),yon_size_get_letter_from_int(log_size_mod))); } else yon_config_remove_by_key(JOURNALD("SystemMaxUse")); @@ -2071,7 +2071,7 @@ void on_journald_save(GtkWidget *, journald_window *window){ char *modif = yon_size_get_letter_from_int(gtk_combo_box_get_active(GTK_COMBO_BOX(window->RotationSizeMaxCombo))); rotationMaxSize = yon_char_append(yon_char_from_long(maxsize),modif); if (maxsize>0) - yon_config_register(JOURNALD("SystemMaxFileSize"),"logging",rotationMaxSize); + yon_config_register(JOURNALD("SystemMaxFileSize"),JOURNALD_parameter_command("SystemMaxFileSize"),rotationMaxSize); } else yon_config_remove_by_key(JOURNALD("SystemMaxFileSize")); @@ -2083,7 +2083,7 @@ void on_journald_save(GtkWidget *, journald_window *window){ storagespace = yon_char_append(yon_char_from_long(storagefree),modif); if (storagefree>0) - yon_config_register(JOURNALD("SystemKeepFree"),"logging",storagespace); + yon_config_register(JOURNALD("SystemKeepFree"),JOURNALD_parameter_command("SystemKeepFree"),storagespace); } else yon_config_remove_by_key(JOURNALD("SystemKeepFree")); @@ -2103,26 +2103,26 @@ void on_journald_save(GtkWidget *, journald_window *window){ int forwardempty = gtk_combo_box_get_active(GTK_COMBO_BOX(window->ForwardedTypeCombo)); if (storage_active!=0) - yon_config_register(JOURNALD("Storage"),"logging",storage); + yon_config_register(JOURNALD("Storage"),JOURNALD_parameter_command("Storage"),storage); else yon_config_remove_by_key(JOURNALD("Storage")); if (compress_active!=0) - yon_config_register(JOURNALD("Compress"),"logging",compress); + yon_config_register(JOURNALD("Compress"),JOURNALD_parameter_command("Compress"),compress); else yon_config_remove_by_key(JOURNALD("Compress")); if (splitmode_active!=0) - yon_config_register(JOURNALD("SplitMode"),"logging",splitmode); + yon_config_register(JOURNALD("SplitMode"),JOURNALD_parameter_command("SplitMode"),splitmode); else yon_config_remove_by_key(JOURNALD("SplitMode")); if (consoleforwardactive != 0){ - yon_config_register(JOURNALD("ForwardToConsole"),"logging",confor); - yon_config_register(JOURNALD("TTYPath"),"logging",TTY); + yon_config_register(JOURNALD("ForwardToConsole"),JOURNALD_parameter_command("ForwardToConsole"),confor); + yon_config_register(JOURNALD("TTYPath"),JOURNALD_parameter_command("TTYPath"),TTY); } else { yon_config_remove_by_key(JOURNALD("ForwardToConsole")); yon_config_remove_by_key(JOURNALD("TTYPath")); } if (forwardempty!=0) - yon_config_register(JOURNALD("MaxLevelConsole"),"logging",yon_char_from_int(forwardempty-1)); + yon_config_register(JOURNALD("MaxLevelConsole"),JOURNALD_parameter_command("MaxLevelConsole"),yon_char_from_int(forwardempty-1)); else yon_config_remove_by_key(JOURNALD("MaxLevelConsole")); on_subwindow_close(window->MainWindow); diff --git a/source/ubl-settings-logging.h b/source/ubl-settings-logging.h index 8408391..26b6914 100644 --- a/source/ubl-settings-logging.h +++ b/source/ubl-settings-logging.h @@ -53,14 +53,16 @@ #define LocalePath "/usr/share/locale" #define LocaleName "ubl-settings-logging" -#define config_get_command(source) yon_char_unite("ubconfig --source ",source," get logging LOGROTATE[*] JOURNALD[*]",NULL) +#define config_get_command(source) yon_char_unite("ubconfig --source ",source," get [logging] LOGROTATE[*] JOURNALD[*]",NULL) #define config_get_default_command "" #define config_get_global_only_parameters "" #define config_get_local_only_parameters "" #define JOURNALD(key) yon_char_unite("JOURNALD[",key,"]",NULL) +#define JOURNALD_parameter_command(target) yon_char_unite("ubconfig --source system get [logging] JOURNALD[",target,"]",NULL) #define LOGROTATE(key) yon_char_unite("LOGROTATE[",key,"]",NULL) +#define LOGROTATE_parameter_command(target) yon_char_unite("ubconfig --source system get [logging] LOGROTATE[",target,"]",NULL) #define get_journal_output_command "clear;journalctl --no-pager" #define get_journal_output_since_boot_command "clear;journalctl --no-pager -b"