|
|
@ -514,11 +514,38 @@ void on_inspector_open(GtkWidget *self, main_window *widgets){
|
|
|
|
gtk_tree_model_get(model,&iter,0,&name,1,&paths,-1);
|
|
|
|
gtk_tree_model_get(model,&iter,0,&name,1,&paths,-1);
|
|
|
|
window->journal_name=name;
|
|
|
|
window->journal_name=name;
|
|
|
|
window->journal_paths=yon_char_parse(paths,&window->journal_size,"\n");
|
|
|
|
window->journal_paths=yon_char_parse(paths,&window->journal_size,"\n");
|
|
|
|
|
|
|
|
config_str final=NULL;
|
|
|
|
|
|
|
|
int final_size=0;
|
|
|
|
|
|
|
|
for (int i=0;i<window->journal_size;i++){
|
|
|
|
|
|
|
|
if (strstr(window->journal_paths[i],"*")){
|
|
|
|
|
|
|
|
int cur_size=0;
|
|
|
|
|
|
|
|
char *cur_folder = yon_char_divide(window->journal_paths[i],yon_char_find_last(window->journal_paths[i],'/'));
|
|
|
|
|
|
|
|
config_str files = yon_dir_get_contents(cur_folder,&cur_size);
|
|
|
|
|
|
|
|
yon_char_divide_search(window->journal_paths[i],"*",-1);
|
|
|
|
|
|
|
|
for (int j=0;j<cur_size;j++){
|
|
|
|
|
|
|
|
if(strstr(files[j],window->journal_paths[i])){
|
|
|
|
|
|
|
|
if(!final) final = yon_char_parsed_new(&final_size,yon_char_unite(cur_folder,"/",files[j],NULL),NULL);
|
|
|
|
|
|
|
|
final = yon_char_parsed_append(final,&final_size,yon_char_unite(cur_folder,"/",files[j],NULL));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
yon_char_parsed_free(files,cur_size);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if(!final) final = yon_char_parsed_new(&final_size,window->journal_paths[i],NULL);
|
|
|
|
|
|
|
|
final = yon_char_parsed_append(final,&final_size,window->journal_paths[i]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
yon_char_parsed_free(window->journal_paths,window->journal_size);
|
|
|
|
|
|
|
|
window->journal_paths=final;
|
|
|
|
|
|
|
|
window->journal_size=final_size;
|
|
|
|
|
|
|
|
// char *new_parsed = ;
|
|
|
|
window->terminals = NULL;
|
|
|
|
window->terminals = NULL;
|
|
|
|
if (strcmp(name,"journald")){
|
|
|
|
if (strcmp(name,"journald")){
|
|
|
|
window->last_mode=-1;
|
|
|
|
window->last_mode=-1;
|
|
|
|
for (int i=0;i<window->journal_size;i++){
|
|
|
|
for (int i=0;i<window->journal_size;i++){
|
|
|
|
if (!access(window->journal_paths[i],F_OK)||strstr(window->journal_paths[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));
|
|
|
|
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{
|
|
|
|
else{
|
|
|
@ -570,8 +597,8 @@ void on_logrotate_configuration_path_filechooser_save_edit(GtkWidget *self, dict
|
|
|
|
if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(window->LogPathsTree)),&model,&iter)){
|
|
|
|
if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(window->LogPathsTree)),&model,&iter)){
|
|
|
|
char *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog->FileChooser));
|
|
|
|
char *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog->FileChooser));
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->FileOrDirCheck))){
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->FileOrDirCheck))){
|
|
|
|
if (filename[strlen(filename)-1]!='/') filename = yon_char_append(filename,"/*.log");
|
|
|
|
if (filename[strlen(filename)-1]!='/') filename = yon_char_append(filename,"/*");
|
|
|
|
else filename = yon_char_append(filename,"*.log");
|
|
|
|
else filename = yon_char_append(filename,"*");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&itar);
|
|
|
|
int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&itar);
|
|
|
|
int deleted=0;
|
|
|
|
int deleted=0;
|
|
|
@ -605,9 +632,9 @@ void on_logrotate_configuration_path_filechooser_save(GtkWidget *self, dictionar
|
|
|
|
filename = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(dialog->FileChooser));
|
|
|
|
filename = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(dialog->FileChooser));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (filename[strlen(filename)-1]!='/')
|
|
|
|
if (filename[strlen(filename)-1]!='/')
|
|
|
|
filename=yon_char_append(filename,"/*.log");
|
|
|
|
filename=yon_char_append(filename,"/*");
|
|
|
|
else
|
|
|
|
else
|
|
|
|
filename=yon_char_append(filename,"*.log");
|
|
|
|
filename=yon_char_append(filename,"*");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// gtk_file_chooser_get_
|
|
|
|
// gtk_file_chooser_get_
|
|
|
|
GtkTreeIter iter, itar;
|
|
|
|
GtkTreeIter iter, itar;
|
|
|
@ -2183,16 +2210,16 @@ void on_log_path_filechooser_save(GtkWidget *self, dictionary *dict){
|
|
|
|
if (!file){
|
|
|
|
if (!file){
|
|
|
|
filename = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(dialog->FileChooser));
|
|
|
|
filename = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(dialog->FileChooser));
|
|
|
|
if (filename[strlen(filename)-1]=='/')
|
|
|
|
if (filename[strlen(filename)-1]=='/')
|
|
|
|
filename = yon_char_append(filename,"*.log");
|
|
|
|
filename = yon_char_append(filename,"*");
|
|
|
|
else
|
|
|
|
else
|
|
|
|
filename = yon_char_append(filename,"/*.log");
|
|
|
|
filename = yon_char_append(filename,"/*");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
GFileType type = g_file_query_file_type(file,G_FILE_QUERY_INFO_NONE,NULL);
|
|
|
|
GFileType type = g_file_query_file_type(file,G_FILE_QUERY_INFO_NONE,NULL);
|
|
|
|
if (type==G_FILE_TYPE_DIRECTORY){
|
|
|
|
if (type==G_FILE_TYPE_DIRECTORY){
|
|
|
|
if (filename[strlen(filename)-1]=='/')
|
|
|
|
if (filename[strlen(filename)-1]=='/')
|
|
|
|
filename = yon_char_append(filename,"*.log");
|
|
|
|
filename = yon_char_append(filename,"*");
|
|
|
|
else
|
|
|
|
else
|
|
|
|
filename = yon_char_append(filename,"/*.log");
|
|
|
|
filename = yon_char_append(filename,"/*");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|