From cbe6cc487068c486c008e240b66beeaa0b08cfe4 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 11 Dec 2023 17:20:13 +0600 Subject: [PATCH] Fixed empty screen if nothing were found --- source/ubl-settings-logging.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/source/ubl-settings-logging.c b/source/ubl-settings-logging.c index 866b64c..26f1fdf 100644 --- a/source/ubl-settings-logging.c +++ b/source/ubl-settings-logging.c @@ -540,17 +540,24 @@ void on_inspector_open(GtkWidget *self, main_window *widgets){ window->terminals = NULL; if (strcmp(name,"journald")){ window->last_mode=-1; - for (int i=0;ijournal_size;i++){ - if (!access(window->journal_paths[i],F_OK)){ - GFile *file = g_file_new_for_path(window->journal_paths[i]); - GFileType type = g_file_query_file_type(file,G_FILE_QUERY_INFO_NONE,NULL); - if(type==G_FILE_TYPE_REGULAR) - yon_dictionary_add_or_create_if_exists_with_data(window->terminals,window->journal_paths[i],yon_inspector_add_terminal(window,window->journal_paths[i],1)); - } - else{ - GtkWidget *terminal = yon_inspector_add_terminal(window,window->journal_paths[i],0); - if (terminal) - yon_dictionary_add_or_create_if_exists_with_data(window->terminals,window->journal_paths[i],terminal); + if (window->journal_size==0){ + GtkWidget *terminal = yon_inspector_add_terminal(window,window->journal_name,0); + if (terminal){ + yon_dictionary_add_or_create_if_exists_with_data(window->terminals,window->journal_name,terminal); + } + } else { + for (int i=0;ijournal_size;i++){ + if (!access(window->journal_paths[i],F_OK)){ + GFile *file = g_file_new_for_path(window->journal_paths[i]); + GFileType type = g_file_query_file_type(file,G_FILE_QUERY_INFO_NONE,NULL); + if(type==G_FILE_TYPE_REGULAR) + yon_dictionary_add_or_create_if_exists_with_data(window->terminals,window->journal_paths[i],yon_inspector_add_terminal(window,window->journal_paths[i],1)); + } + else{ + GtkWidget *terminal = yon_inspector_add_terminal(window,window->journal_paths[i],0); + if (terminal) + yon_dictionary_add_or_create_if_exists_with_data(window->terminals,window->journal_paths[i],terminal); + } } } gtk_widget_hide(window->JournalActionsBox);