Fixed 'log size' label and value height dismatch

pull/95/head
Ivan Yartsev 2 years ago
parent 64c6b5dfbb
commit 8ceb3b203e

@ -1591,6 +1591,7 @@ logrotate_configure_window *yon_logrotate_window_new(char *paths, logrotate_wind
}
config_str logsize = yon_config_load(logrotate_size_command(temp_paths),&sz);
for (int i=0;i<sz;i++){
if (logsize[i][strlen(logsize[i])-1]=='\n') logsize[i][strlen(logsize[i])-1]='\0';
finalsize+=atof(logsize[i]);
}
int sizenumber=0;
@ -2201,6 +2202,7 @@ journald_window *yon_journald_open(GtkWidget *self, main_window *widgets){
int sz;
config_str logsize = yon_config_load(journald_size_command,&sz);
if (logsize)
if (logsize[0][strlen(logsize[0])-1]=='\n') logsize[0][strlen(logsize[0])-1]='\0';
gtk_label_set_text(GTK_LABEL(window->LogSizeLabel),logsize[0]);
}
gtk_window_set_title(GTK_WINDOW(window->MainWindow),TITLE_LABEL);
@ -2598,10 +2600,35 @@ void on_log_edit(GtkWidget *self,main_window *widgets){
int sz;
config_str logsize = yon_config_load(journald_size_command,&sz);
if (logsize)
if (logsize[0][strlen(logsize[0])-1]=='\n') logsize[0][strlen(logsize[0])-1]='\0';
gtk_label_set_text(GTK_LABEL(window->LogSizeLabel),logsize[0]);
g_signal_connect(G_OBJECT(window->JournaldButton),"clicked", G_CALLBACK(on_journald_open),widgets);
g_signal_connect(G_OBJECT(window->JournaldButton),"clicked", G_CALLBACK(on_journald_open),widgets);
} else {
gtk_widget_hide(window->JournaldButton);
if (paths){
int sz;
float finalsize=0.0;
char *temp_paths = yon_char_new(paths);
config_str parsed_paths = yon_char_parse(temp_paths,&sz,"\n");
free(temp_paths);
temp_paths=NULL;
for (int i=0;i<sz;i++){
if (!access(parsed_paths[i],F_OK))
yon_char_unite(temp_paths ? yon_char_append(temp_paths," ") : "",parsed_paths[i],NULL);
}
if (!yon_char_is_empty(temp_paths)){
config_str logsize = yon_config_load(logrotate_size_command(temp_paths),&sz);
for (int i=0;i<sz;i++){
if (logsize[i][strlen(logsize[i])-1]=='\n') logsize[i][strlen(logsize[i])-1]='\0';
finalsize+=atof(logsize[i]);
}
int sizenumber=0;
finalsize = yon_size_convert_automatic(finalsize,&sizenumber);
char *fin = yon_char_from_float(finalsize);
gtk_label_set_text(GTK_LABEL(window->LogSizeLabel),yon_char_append(fin,yon_size_get_letter_from_int(sizenumber)));
gtk_widget_show(window->StatisticsFrame);
}
}
dictionary *dict = NULL;
yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets);
yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window);

@ -39,6 +39,7 @@
#define config_path yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL)
#define journals_list_path "/usr/share/ubl-settings-logging/csv/journals_list.csv"
#define services_list_path "/usr/share/ubl-settings-logging/csv/logging_services.csv"
#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)
@ -51,14 +52,14 @@
#define JOURNALD(key) yon_char_unite("JOURNALD[",key,"]",NULL)
#define LOGROTATE(key) yon_char_unite("LOGROTATE[",key,"]",NULL)
#define get_journal_output_command "clear;SYSTEMD_COLORS=false journalctl --no-pager"
#define get_journal_output_since_boot_command "clear;SYSTEMD_COLORS=false journalctl --no-pager -b"
#define get_journal_output_followed_command "clear;SYSTEMD_COLORS=false journalctl --no-pager -f"
#define get_journal_output_kernel_command "clear;SYSTEMD_COLORS=false journalctl --no-pager -k"
#define get_journal_output_prioritied_command "clear;SYSTEMD_COLORS=false journalctl --no-pager -p err..alert"
#define get_journal_all_boots_command "clear;SYSTEMD_COLORS=false journalctl --no-pager --list-boots"
#define get_journal_all_units_command "clear;SYSTEMD_COLORS=false systemd-analyze blame --no-pager"
#define get_journal_init_tree_command "clear;SYSTEMD_COLORS=false systemd-analyze critical-chain --no-pager"
#define get_journal_output_command "clear;journalctl --no-pager"
#define get_journal_output_since_boot_command "clear;journalctl --no-pager -b"
#define get_journal_output_followed_command "clear;journalctl --no-pager -f"
#define get_journal_output_kernel_command "clear;journalctl --no-pager -k"
#define get_journal_output_prioritied_command "clear;journalctl --no-pager -p err..alert"
#define get_journal_all_boots_command "clear;journalctl --no-pager --list-boots"
#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 group_list_path "/etc/group"

Loading…
Cancel
Save