Fixed log size showing

pull/129/head
Ivan Yartsev 6 months ago
parent 3812ccdc91
commit 80975539ca

@ -2338,7 +2338,6 @@ void on_log_edit(GtkWidget *,main_window *widgets){
g_signal_connect(G_OBJECT(window->CancelButton),"clicked", G_CALLBACK(on_subwindow_close),NULL);
yon_window_config_custom_window_get(GTK_WINDOW(window->MainWindow),"EditWindow");
gtk_widget_show(window->MainWindow);
gtk_widget_hide(window->StatisticsFrame);
char *name;
char *paths;
int size;
@ -2372,6 +2371,16 @@ void on_log_edit(GtkWidget *,main_window *widgets){
float finalsize=0.0;
char *temp_paths = yon_char_new(paths);
config_str parsed_paths = yon_char_parse(temp_paths,&sz,"\n");
int paths_size;
config_str paths_overall_size = yon_config_load(yon_debug_output("%s\n",get_file_folder_size(yon_char_parsed_to_string(parsed_paths,sz," "))),&paths_size);
char *overall = yon_char_divide_search(paths_overall_size[paths_size-1],"\t",-1);
yon_char_parsed_free(paths_overall_size,paths_size);
if (!yon_char_is_empty(overall)&&strcmp(overall,"0")){
gtk_label_set_text(GTK_LABEL(window->LogSizeLabel),overall);
} else {
gtk_label_set_text(GTK_LABEL(window->LogSizeLabel),NO_FILES_FOUND_LABEL);
}
free(temp_paths);
temp_paths=NULL;
for (int i=0;i<sz;i++){
@ -2380,10 +2389,12 @@ void on_log_edit(GtkWidget *,main_window *widgets){
else {
int mask_size=0;
char *mask = yon_char_new(parsed_paths[i]);
char *path_mask = yon_char_divide(mask,yon_char_find_last(mask,'/'));
config_str mask_found = yon_dir_get_by_mask(path_mask,mask,&mask_size);
for (int l=0;l<mask_size;l++){
temp_paths = yon_char_unite(temp_paths ? yon_char_append(temp_paths," ") : "",path_mask,"/",mask_found[l],NULL);
config_str mask_found = yon_config_load(get_all_files_in_path(mask),&mask_size);
if (mask_found){
for (int l=0;l<mask_size;l++){
yon_char_remove_last_symbol(mask_found[l],'\n');
temp_paths = yon_char_unite(temp_paths ? yon_char_append(temp_paths," ") : "",mask_found[l],NULL);
}
}
}
}

@ -44,7 +44,7 @@
#define logrotate_config_command "ls /etc/logrotate.d/ |sed -e 's/ */\\n/g'"
#define journald_size_command "journalctl --disk-usage | grep -oE \"[0-9]{1,}.[0-9]{1,}[A-Z]\""
#define logrotate_size_command(paths) yon_char_unite("du ",paths," |grep -oE '^[0-9]{1,}'",NULL)
#define logrotate_size_command(paths) yon_debug_output("%s\n",yon_char_unite("du ",paths," |grep -oE '^[0-9]{1,}'",NULL))
#define logrotate_config_path "/etc/logrotate.d/"
#define custom_logs_saving_file_path yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/logwatcher.csv",NULL)
@ -69,6 +69,9 @@
#define get_journal_all_units_command "clear;systemd-analyze blame --no-pager"
#define get_journal_init_tree_command "clear;systemd-analyze critical-chain --no-pager"
#define get_file_folder_size(path) yon_char_append("du -hsc ",path)
#define get_all_files_in_path(path) yon_char_append("find ",path)
#define group_list_path "/etc/group"
#define start_icon_name "com.ublinux.ubl-settings-logging.play-symbolic"

@ -191,6 +191,7 @@
#define LOG_FILE_LABEL _("Log file")
#define NAME_LABEL _("Name:")
#define TOTAL_LOG_SIZE_LABEL _("Log size:")
#define NO_FILES_FOUND_LABEL _("Journal/log files were not found")
//ubl-settings-logging-rules.glade
#define RULES_TITLE_LABEL _("Logs and events - rules")

Loading…
Cancel
Save