diff --git a/Makefile b/Makefile index 7e06a54..1306447 100644 --- a/Makefile +++ b/Makefile @@ -139,6 +139,7 @@ install: check uninstall @install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/actions/" "icons/com.ublinux.${PKGNAME}.trash-symbolic.svg" @install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/actions/" "icons/com.ublinux.${PKGNAME}.sort-symbolic.svg" @install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/actions/" "icons/com.ublinux.${PKGNAME}.sync-symbolic.svg" + @install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/actions/" "icons/com.ublinux.${PKGNAME}.funnel-symbolic.svg" @install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/actions/" "icons/com.ublinux.${PKGNAME}.generic1-symbolic.svg" @install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/actions/" "icons/com.ublinux.${PKGNAME}.generic2-symbolic.svg" @@ -150,6 +151,7 @@ install: check uninstall @install -Dm644 -t "${DESTDIR}/usr/share/${PKGNAME}/csv/" "journals_list.csv" @install -Dm644 -t "${DESTDIR}/usr/share/${PKGNAME}/csv/" "logging_services.csv" @install -Dm644 -t "${DESTDIR}/usr/share/polkit-1/actions/" "${CMAKE_BUILD_DIR}/com.ublinux.${PKGNAME}${PKGIDENT}.policy" + @install -Dm644 -t "${DESTDIR}/usr/share/polkit-1/actions/" "com.ublinux.${PKGNAME}.auth.policy" @if [ -z ${DESTDIR} ]; then \ [ -d "${DESTDIR}/usr/share/icons/hicolor/" ] && gtk-update-icon-cache -fiq "${DESTDIR}/usr/share/icons/hicolor/" &>/dev/null || true; \ update-desktop-database --quiet &>/dev/null || true; \ diff --git a/com.ublinux.ubl-settings-logging.auth.policy b/com.ublinux.ubl-settings-logging.auth.policy new file mode 100644 index 0000000..846ebeb --- /dev/null +++ b/com.ublinux.ubl-settings-logging.auth.policy @@ -0,0 +1,23 @@ + + + + + UBLinux + https://ublinux.ru + + + Run ubl-settings-logging as root + Запуск утилиты ubl-settings-logging с правами root + Authentication is required to run ubl-settings-logging + Требуется авторизация для запуска утилиты ubl-settings-logging с правами root + + auth_admin + auth_admin + auth_admin_keep + + /usr/bin/pkexec + + + diff --git a/gresource.xml b/gresource.xml index 1f26a40..557ead6 100644 --- a/gresource.xml +++ b/gresource.xml @@ -10,6 +10,7 @@ ubl-settings-logging-rules.glade ubl-settings-logging-filechooser.glade ubl-settings-logging-logrotate-table.glade + ubl-settings-logging-terminal.glade ubl-settings-logging.css diff --git a/icons/com.ublinux.ubl-settings-logging.funnel-symbolic.svg b/icons/com.ublinux.ubl-settings-logging.funnel-symbolic.svg new file mode 100644 index 0000000..4aec04a --- /dev/null +++ b/icons/com.ublinux.ubl-settings-logging.funnel-symbolic.svg @@ -0,0 +1,45 @@ + + + + + + + + + + diff --git a/logging_services.csv b/logging_services.csv index 98be66d..5db9f91 100644 --- a/logging_services.csv +++ b/logging_services.csv @@ -1,5 +1,5 @@ Service_Name;Service_Description;command_start;command_stop;command_enable;command_disable;command_status journald;System event log;systemctl start systemd-journald.service;systemctl stop systemd-journald.service;ubconfig set config SERVICESSTART+=systemd-journald.service;ubconfig set config SERVICESSTART-=systemd-journald.service;systemctl status systemd-journald.service -logrotate;System event log rotation service;systemctl start logrotate.timer;systemctl stop logrotate.timer,systemctl stop logrotate.service;ubconfig set config SERVICESNOSTART-=,logrotate.timer;ubconfig set config SERVICESNOSTART+=,logrotate.timer;systemctl status logrotate.service +logrotate;System event log rotation service;systemctl start logrotate.timer;systemctl stop logrotate.timer logrotate.service;ubconfig set config SERVICESNOSTART-=,logrotate.timer;ubconfig set config SERVICESNOSTART+=,logrotate.timer;systemctl status logrotate.service #metalog;System event log;systemctl start metalog.service;systemctl stop metalog.service;ubconfig set config SERVICESSTART+=metalog.service;ubconfig set config SERVICESSTART-=metalog.service;systemctl status metalog.service #syslog-ng;Service for collecting messages from system events of active network devices;systemctl start syslog-ng.service;systemctl stop syslog-ng.service;ubconfig set config SERVICESSTART+=syslog-ng.service;ubconfig set config SERVICESSTART-=syslog-ng.service;systemctl status syslog-ng.service \ No newline at end of file diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 87c4d28..c09ec59 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -13,6 +13,11 @@ include_directories(${VTE291_INCLUDE_DIRS}) link_directories(${VTE291_LIBRARY_DIRS}) add_definitions(${VTE291_CFLAGS_OTHER}) +pkg_check_modules(POLKIT REQUIRED polkit-agent-1) +include_directories(${POLKIT_INCLUDE_DIRS}) +link_directories(${POLKIT_LIBRARY_DIRS}) +add_definitions(${POLKIT_CFLAGS_OTHER}) + find_library(WEBKIT_LIBRARIES_FOUND webkit2gtk-4.0 webkit2gtk-web-extension-4.0) option(WEBKIT_FOUND "No" OFF) @@ -44,6 +49,7 @@ set(DEPENDFILES ../ubl-settings-logging-logrotate.glade ../ubl-settings-logging-logrotate-table.glade ../ubl-settings-logging-filechooser.glade + ../ubl-settings-logging-terminal.glade ../gresource.xml ../ubl-settings-logging-banner.png ../ubl-settings-logging.css @@ -89,7 +95,8 @@ set(SOURCE_FILES set(LIBRARIES ${GTK_LIBRARIES} ${WEBKIT_LIBRARIES} - ${VTE291_LIBRARIES} + ${VTE291_LIBRARIES} + ${POLKIT_LIBRARIES} pthread) diff --git a/source/ubl-settings-logging.c b/source/ubl-settings-logging.c index dce0000..8dc83f3 100644 --- a/source/ubl-settings-logging.c +++ b/source/ubl-settings-logging.c @@ -10,7 +10,9 @@ config main_config; * [RU] * Закрывает окно, в котором расположен виджет [self]. */ -void on_close_subwindow(GtkWidget *self){ +void on_close_subwindow(GtkWidget *self, char *window){ + if(window) + yon_window_config_custom_window_set(GTK_WINDOW(gtk_widget_get_toplevel(self)),window); gtk_widget_destroy(gtk_widget_get_toplevel(self)); } @@ -125,25 +127,59 @@ int yon_size_get_int_from_letter(char size){ //functions +void yon_polkit_authorized_action(GCallback *func){ + +} + +void yon_logs_custom_save(main_window *widgets){ + GtkTreeIter iter; + char *name; + char *description; + char *paths; + int standard; + int standard_paths; + int size=0; + int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->list),&iter); + char *final_strings=NULL; + for (;valid;valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(widgets->list),&iter)){ + gtk_tree_model_get(GTK_TREE_MODEL(widgets->list),&iter,0,&name,1,&paths,2,&description,3,&standard,4,&standard_paths,-1); + if (paths){ + if (standard!=1){ + for (int i=0;ilast_mode){ + case 0: + fl = popen(get_journal_output_command,"r"); + break; + case 1: + fl = popen(get_journal_output_since_boot_command,"r"); + break; + case 2: + fl = popen(get_journal_output_followed_command,"r"); + break; + case 3: + fl = popen(get_journal_output_kernel_command,"r"); + break; + case 4: + fl = popen(get_journal_output_prioritied_command,"r"); + break; + case 5: + fl = popen(get_journal_all_boots_command,"r"); + break; + case 6: + fl = popen(get_journal_all_units_command,"r"); + break; + case 7: + fl = popen(get_journal_init_tree_command,"r"); + break; + } + char *output = g_malloc0(sizeof(char)*4096); + GtkTreeIter iter; + main_config.remove_thread=0; + fd_set fds; + struct timeval tv; + int fd = fileno(fl); + while (main_config.remove_thread==0){ + FD_ZERO(&fds); + FD_SET(fd, &fds); + tv.tv_sec = 1; + tv.tv_usec = 0; + if(select(fd + 1, &fds, NULL, NULL, &tv)){ + output = fgets(output,4092,fl); + if((output)){ + if(strcmp(output,"")){ + gtk_list_store_append(window->list, &iter); + + char *identifier=""; + char *temp = yon_char_new(output); + char *log=temp; + if (strstr(log,"\033[H\033[2J\033[3")) + yon_char_divide(log,strlen("\033[H\033[2J\033[3")); + log = yon_char_divide_search(log,"\n",-1); + if (window->last_mode<5){ + identifier = log; + log=strstr(log,":")+1; + log=strstr(log,":")+1; + log=strstr(log,":")+1; + char *iden = yon_char_new(identifier); + identifier=yon_char_divide(iden,strlen(identifier)-strlen(log)-1); + free(iden); + } + gtk_list_store_set(window->list,&iter,0,identifier,1,log,-1); + free(temp); + } + } + } + } + main_config.inspector_thread=0; + pclose(fl); +} + void on_inspector_update(GtkWidget *self, inspector_window *window){ int size; GtkTextIter titer,titerend; config_str output; if (!strcmp(window->journal_name,"journald")){ - if (self==window->UpdateButton){ - switch(window->last_mode){ - case 0: - yon_terminal_integrated_start(window->LoggingTerminal, get_journal_output_command,NULL,NULL); - break; - case 1: - yon_terminal_integrated_start(window->LoggingTerminal, get_journal_output_since_boot_command,NULL,NULL); - break; - case 2: - yon_terminal_integrated_start(window->LoggingTerminal, get_journal_output_followed_command,NULL,NULL); - break; - case 3: - yon_terminal_integrated_start(window->LoggingTerminal, get_journal_output_kernel_command,NULL,NULL); - break; - case 4: - yon_terminal_integrated_start(window->LoggingTerminal, get_journal_output_prioritied_command,NULL,NULL); - break; - case 5: - yon_terminal_integrated_start(window->LoggingTerminal, get_journal_all_boots_command,NULL,NULL); - break; - case 6: - yon_terminal_integrated_start(window->LoggingTerminal, get_journal_all_units_command,NULL,NULL); - break; - case 7: - yon_terminal_integrated_start(window->LoggingTerminal, get_journal_init_tree_command,NULL,NULL); - break; - } - } + GtkWidget *terminal = (GtkWidget*)window->terminals->first->data; + gtk_widget_hide(window->LoggingNotebook); + gtk_widget_show(gtk_widget_get_parent(window->JournaldTree)); if (self==window->ShowSinceBootButton){ window->last_mode=1; - yon_terminal_integrated_start(window->LoggingTerminal, get_journal_output_since_boot_command,NULL,NULL); } - if (self==window->NewMessagesButton){ + else if (self==window->NewMessagesButton){ window->last_mode=2; - yon_terminal_integrated_start(window->LoggingTerminal, get_journal_output_followed_command,NULL,NULL); } - if (self==window->ShowKernelButton){ + else if (self==window->ShowKernelButton){ window->last_mode=3; - yon_terminal_integrated_start(window->LoggingTerminal, get_journal_output_kernel_command,NULL,NULL); } - if (self==window->ShowPriorityButton){ + else if (self==window->ShowPriorityButton){ window->last_mode=4; - yon_terminal_integrated_start(window->LoggingTerminal, get_journal_output_prioritied_command,NULL,NULL); } - if (self==window->ShowAllBootsButton){ + else if (self==window->ShowAllBootsButton){ window->last_mode=5; - yon_terminal_integrated_start(window->LoggingTerminal, get_journal_all_boots_command,NULL,NULL); } - if (self==window->ShowAllUnitsButton){ + else if (self==window->ShowAllUnitsButton){ window->last_mode=6; - yon_terminal_integrated_start(window->LoggingTerminal, get_journal_all_units_command,NULL,NULL); } - if (self==window->ShowInitTreeButton){ + else if (self==window->ShowInitTreeButton){ window->last_mode=7; - yon_terminal_integrated_start(window->LoggingTerminal, get_journal_init_tree_command,NULL,NULL); } + main_config.remove_thread=0; + gtk_tree_view_set_model(GTK_TREE_VIEW(window->JournaldTree),GTK_TREE_MODEL(window->list)); + gtk_list_store_clear(window->list); + gtk_tree_view_set_model(GTK_TREE_VIEW(window->JournaldTree),GTK_TREE_MODEL(window->list)); + if (main_config.inspector_thread){ + main_config.remove_thread=1; + pthread_join(main_config.inspector_thread,NULL); + } + pthread_create(&main_config.inspector_thread, NULL, (void *)on_inspector_jornald_read_async, window); } else { - window->journal_paths = yon_char_replace(window->journal_paths,"\n"," "); - yon_terminal_integrated_start(window->LoggingTerminal,yon_char_unite("cat ",window->journal_paths,NULL),NULL,NULL); + if (window->terminals){ + gtk_widget_hide(gtk_widget_get_parent(window->JournaldTree)); + gtk_widget_show(window->LoggingNotebook); + dictionary *dict=NULL; + for_dictionaries (dict,window->terminals){ + GtkWidget *terminal = (GtkWidget*)dict->data; + yon_terminal_integrated_start(terminal,yon_char_unite("cat ",dict->key,NULL),NULL,NULL); + } } + } + +} + +GtkWidget *yon_inspector_add_terminal(inspector_window *window,char *page_name,int mode){ + GtkBuilder *builder = gtk_builder_new_from_resource(glade_terminal_path); + GtkWidget *box = yon_gtk_builder_get_widget(builder,"TerminalBox"); + GtkWidget *terminal = yon_gtk_builder_get_widget(builder,"LoggingTerminal"); + GtkWidget *unfound_label = yon_gtk_builder_get_widget(builder,"UnfoundLabel"); + GtkWidget *label = gtk_label_new(page_name); + gtk_notebook_append_page(GTK_NOTEBOOK(window->LoggingNotebook),box,label); + if (mode){ + GdkRGBA rgba; + rgba.alpha=1; + rgba.red=0.95; + rgba.green=0.95; + rgba.blue=0.95; + vte_terminal_set_color_cursor(VTE_TERMINAL(terminal),&rgba); + vte_terminal_set_color_background(VTE_TERMINAL(terminal),&rgba); + rgba.red=0; + rgba.green=0; + rgba.blue=0; + vte_terminal_set_color_foreground(VTE_TERMINAL(terminal),&rgba); + return terminal; + } else { + gtk_widget_destroy(terminal); + gtk_widget_show(unfound_label); + char *label_text = yon_char_append(page_name,PATH_NOT_FOUND_LABEL); + gtk_label_set_text(GTK_LABEL(unfound_label),label_text); + return NULL; + } + +} + +void on_inspector_close(GtkWidget *self){ + main_config.remove_thread++; } void on_inspector_open(GtkWidget *self, main_window *widgets){ @@ -278,25 +404,19 @@ void on_inspector_open(GtkWidget *self, main_window *widgets){ window->ShowAllBootsButton=yon_gtk_builder_get_widget(builder,"ShowAllBootsButton"); window->ShowAllUnitsButton=yon_gtk_builder_get_widget(builder,"ShowAllUnitsButton"); window->ShowInitTreeButton=yon_gtk_builder_get_widget(builder,"ShowInitTreeButton"); + window->LoggingNotebook=yon_gtk_builder_get_widget(builder,"MainNotebook"); window->UpdateButton=yon_gtk_builder_get_widget(builder,"UpdateButton"); - window->LoggingTerminal=yon_gtk_builder_get_widget(builder,"LoggingTerminal"); window->JournalActionsBox=yon_gtk_builder_get_widget(builder,"JournalActionsBox"); + window->JournaldTree=yon_gtk_builder_get_widget(builder,"JournaldTree"); + window->list=GTK_LIST_STORE(gtk_builder_get_object(builder,"liststore1")); + yon_window_config_custom_window_setup(GTK_WINDOW(window->MainWindow),"InspectorWindow"); gtk_window_set_title(GTK_WINDOW(window->MainWindow),TITLE_LABEL); gtk_window_set_transient_for(GTK_WINDOW(window->MainWindow),GTK_WINDOW(widgets->Window)); GtkTreeModel *model = GTK_TREE_MODEL(widgets->list); GtkTreeIter iter; char *name; char *paths; - GdkRGBA rgba; - rgba.alpha=1; - rgba.red=0.95; - rgba.green=0.95; - rgba.blue=0.95; - vte_terminal_set_color_background(VTE_TERMINAL(window->LoggingTerminal),&rgba); - rgba.red=0; - rgba.green=0; - rgba.blue=0; - vte_terminal_set_color_foreground(VTE_TERMINAL(window->LoggingTerminal),&rgba); + g_signal_connect(G_OBJECT(window->MainWindow),"destroy", G_CALLBACK(on_inspector_close),window); g_signal_connect(G_OBJECT(window->UpdateButton),"clicked", G_CALLBACK(on_inspector_update),window); g_signal_connect(G_OBJECT(window->ShowKernelButton),"clicked", G_CALLBACK(on_inspector_update),window); g_signal_connect(G_OBJECT(window->NewMessagesButton),"clicked", G_CALLBACK(on_inspector_update),window); @@ -305,16 +425,30 @@ void on_inspector_open(GtkWidget *self, main_window *widgets){ g_signal_connect(G_OBJECT(window->ShowAllBootsButton),"clicked", G_CALLBACK(on_inspector_update),window); g_signal_connect(G_OBJECT(window->ShowAllUnitsButton),"clicked", G_CALLBACK(on_inspector_update),window); g_signal_connect(G_OBJECT(window->ShowInitTreeButton),"clicked", G_CALLBACK(on_inspector_update),window); + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->MainTree)),&model,&iter)){ gtk_tree_model_get(model,&iter,0,&name,1,&paths,-1); + window->journal_name=name; + window->journal_paths=yon_char_parse(paths,&window->journal_size,"\n"); + 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)){ + 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); } else { window->last_mode=0; + yon_dictionary_add_or_create_if_exists_with_data(window->terminals,"Journald",yon_inspector_add_terminal(window,"Journald",1)); } - window->journal_name=name; - window->journal_paths=paths; + on_inspector_update(window->UpdateButton,window); gtk_widget_show(window->MainWindow); } @@ -337,15 +471,31 @@ void on_logrotate_configuration_path_add(GtkWidget *self, logrotate_configure_wi } void on_path_editing_done(GtkCellRendererText* self,gchar* path,gchar* new_text,logrotate_configure_window *window){ - GtkTreeIter iter; + GtkTreeIter iter, itar; char *cur_path; gtk_tree_model_get_iter(GTK_TREE_MODEL(window->list),&iter,gtk_tree_path_new_from_string(path)); gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,0,&cur_path,-1); - if (cur_path&&!strcmp(cur_path,"")&&!strcmp(new_text,"")) + if (!strcmp(new_text,"")||cur_path&&!strcmp(cur_path,"")) gtk_list_store_remove(window->list,&iter); - else if (new_text&&strcmp(new_text,"")) - gtk_list_store_set(window->list,&iter,0,new_text,-1); + else if (new_text&&strcmp(new_text,"")){ + int deleted=0; + int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&itar); + for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(window->list),&itar)){ + char *path; + gtk_tree_model_get(GTK_TREE_MODEL(window->list),&itar,0,&path,-1); + if (path&&new_text) + if (!strcmp(path,new_text)){ + yon_ubl_status_list_store_highlight_incorrect(window->list,gtk_tree_iter_copy(&itar)); + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),REPEAT_PATHS_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + gtk_list_store_remove(window->list,&iter); + deleted=1; + } + } + if (!deleted) + gtk_list_store_set(window->list,&iter,0,new_text,-1); + + } GValue *val = g_malloc0(sizeof(GValue)); g_object_get_property(G_OBJECT(self),"editable",val); g_value_set_boolean(val,0); @@ -455,7 +605,7 @@ void on_rules_accept(GtkWidget *self, dictionary *dict){ !public_read&&public_write&&public_exec ? 3 : \ 0; gtk_entry_set_text(entry,yon_char_unite(yon_char_from_int(owner),yon_char_from_int(group),yon_char_from_int(public),NULL)); - gtk_widget_destroy(window->Window); + on_close_subwindow(window->Window,"RulesWindow"); } void on_rules_update(GtkWidget *self, logrotate_rules_window *window){ @@ -513,11 +663,12 @@ void on_rules_open(GtkWidget *self,GtkEntry *entry){ window->FinalEntry=yon_gtk_builder_get_widget(builder,"FinalEntry"); window->CancelButton=yon_gtk_builder_get_widget(builder,"CancelButton"); window->SaveButton=yon_gtk_builder_get_widget(builder,"SaveButton"); + yon_window_config_custom_window_set(GTK_WINDOW(window->Window),"RulesWindow"); gtk_window_set_title(GTK_WINDOW(window->Window),TITLE_LABEL); dictionary *dict = NULL; yon_dictionary_add_or_create_if_exists_with_data(dict,"entry",entry); yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); - g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_close_subwindow),NULL); + g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_close_subwindow),"RulesWindow"); g_signal_connect(G_OBJECT(window->SaveButton),"clicked",G_CALLBACK(on_rules_accept),dict); g_signal_connect(G_OBJECT(window->UserReadCheck),"toggled",G_CALLBACK(on_rules_update),window); @@ -546,7 +697,7 @@ void on_filechooser_save(GtkWidget *self, dictionary *dict){ logrotate_filechooser_window *dialog = yon_dictionary_get_data(dict->first->next,logrotate_filechooser_window*); char *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog->FileChooser)); gtk_entry_set_text(GTK_ENTRY(window->FileAmountEntry),filename); - gtk_widget_destroy(dialog->FileChooser); + on_close_subwindow(dialog->FileChooser,"FileDialog"); } void on_filechooser_open(GtkWidget *self, logrotate_configure_window *window){ @@ -556,6 +707,7 @@ void on_filechooser_open(GtkWidget *self, logrotate_configure_window *window){ dialog->FileOrDirCheck = yon_gtk_builder_get_widget(builder,"FileOrDirCheck"); dialog->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton"); dialog->AcceptButton = yon_gtk_builder_get_widget(builder,"AcceptButton"); + yon_window_config_custom_window_set(GTK_WINDOW(dialog->FileChooser),"FileDialog"); gtk_window_set_transient_for(GTK_WINDOW(window->MainWindow),GTK_WINDOW(window->MainWindow)); dictionary *dict = NULL; @@ -563,7 +715,7 @@ void on_filechooser_open(GtkWidget *self, logrotate_configure_window *window){ yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); yon_dictionary_add_or_create_if_exists_with_data(dict,"dialog",dialog); g_signal_connect(G_OBJECT(dialog->FileOrDirCheck),"toggled",G_CALLBACK(on_filechooser_mode_switch),dialog); - g_signal_connect(G_OBJECT(dialog->CancelButton),"clicked",G_CALLBACK(on_close_subwindow),NULL); + g_signal_connect(G_OBJECT(dialog->CancelButton),"clicked",G_CALLBACK(on_close_subwindow),"FileDialog"); g_signal_connect(G_OBJECT(dialog->AcceptButton),"clicked",G_CALLBACK(on_filechooser_save),dict); gtk_widget_show(dialog->FileChooser); } @@ -582,6 +734,7 @@ void on_logrotate_period_check_toggled(GtkToggleButton *self,logrotate_configure void on_logrotate_save(GtkWidget *self, dictionary *dict){ logrotate_window *dialog = yon_dictionary_get_data(dict->first,logrotate_window*); logrotate_configure_window *window = yon_dictionary_get_data(dict->first->next,logrotate_configure_window*); + char *log_name=""; char *paths=""; char *period=""; char *size=""; @@ -618,6 +771,13 @@ void on_logrotate_save(GtkWidget *self, dictionary *dict){ config_str found_paths_list=NULL; int found_paths=0; char *cur_check_paths; + log_name = (char*)gtk_entry_get_text(GTK_ENTRY(window->LogNameEntry)); + if (!strcmp(log_name,"")){ + yon_ubl_status_highlight_incorrect(window->LogNameEntry); + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + return; + } + int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(main_config.logrotate_list),&iter); for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(main_config.logrotate_list),&iter)){ gtk_tree_model_get(GTK_TREE_MODEL(main_config.logrotate_list),&iter,1,&cur_check_paths,-1); @@ -625,6 +785,13 @@ void on_logrotate_save(GtkWidget *self, dictionary *dict){ else found_paths_list = yon_char_parsed_append(found_paths_list,&found_paths,cur_check_paths); } valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&iter); + if (!valid) { + yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(window->LogPathsTree)); + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + return; + } + GtkTreeIter *lastiter; + GtkTreeIter *lastitar; for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(window->list),&iter)){ char *cur_path; gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,0,&cur_path,-1); @@ -633,13 +800,16 @@ void on_logrotate_save(GtkWidget *self, dictionary *dict){ } path_amount++; paths = yon_char_unite(paths,strcmp(paths,"") ? "," : "", cur_path,NULL); + lastiter=gtk_tree_iter_copy(&iter); + lastitar=gtk_tree_iter_copy(&iter); } - if(!window->paths) + if(!window->paths) { if (matched==path_amount) { yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(window->LogPathsTree)); yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),REPEATED_PATHS_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); return; } + } if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->RotationPeriodCheck))){ int active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->RotationPeriodMainCombo)); switch (active){ @@ -720,11 +890,6 @@ void on_logrotate_save(GtkWidget *self, dictionary *dict){ maxsize = yon_char_unite("maxsize ", yon_char_from_long(value),yon_size_get_letter_from_int(last),NULL); } - // int create_log_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->CreateLogCombo)); - // if (create_log_active){ - // if (create_log_active==2) - // } - copytruncate = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->CutCheck)) ? "copytruncate" : ""; int compression_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->CompressionCombo)); @@ -829,13 +994,14 @@ void on_logrotate_save(GtkWidget *self, dictionary *dict){ GtkTreeIter iter; yon_config_register(LOGROTATE(paths),"logging",commandline); 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); if (!dialog||!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->MainTree)),&model,&iter)){ gtk_list_store_append(main_config.logrotate_list,&iter); } paths=yon_char_replace(paths,",","\n"); - gtk_list_store_set(main_config.logrotate_list,&iter,0,gtk_entry_get_text(GTK_ENTRY(window->LogNameEntry)),1,paths,2,gtk_entry_get_text(GTK_ENTRY(window->LogDescriptionEntry)),-1); - on_close_subwindow(window->MainWindow); + gtk_list_store_set(main_config.logrotate_list,&iter,0,log_name,1,paths,2,gtk_entry_get_text(GTK_ENTRY(window->LogDescriptionEntry)),-1); + on_close_subwindow(window->MainWindow,"LogrotateWindow"); } } @@ -904,6 +1070,8 @@ logrotate_configure_window *yon_logrotate_window_new(char *paths, logrotate_wind window->CommandAfterEntry=yon_gtk_builder_get_widget(builder,"CommandAfterEntry"); window->EndworkCommandEntry=yon_gtk_builder_get_widget(builder,"EndworkCommandEntry"); window->StatusBox=yon_gtk_builder_get_widget(builder,"StatusBox"); + + yon_window_config_custom_window_get(GTK_WINDOW(window->MainWindow),"LogrotateWindow"); gtk_window_set_title(GTK_WINDOW(window->MainWindow),TITLE_LABEL); if (dialog) gtk_window_set_transient_for(GTK_WINDOW(window->MainWindow),GTK_WINDOW(dialog->Window)); @@ -926,8 +1094,6 @@ logrotate_configure_window *yon_logrotate_window_new(char *paths, logrotate_wind int sizenumber=0; finalsize = yon_size_convert_automatic(finalsize,&sizenumber); char *fin = yon_char_from_float(finalsize); - char *unw = strstr(fin,",")+3; - fin = yon_char_divide(fin,strlen(fin)-strlen(unw)); gtk_label_set_text(GTK_LABEL(window->LogSizeLabel),yon_char_append(fin,yon_size_get_letter_from_int(sizenumber))); } @@ -1058,10 +1224,6 @@ logrotate_configure_window *yon_logrotate_window_new(char *paths, logrotate_wind gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->RotateSizeMaxBeforeTimeSpin),atol(value)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->RotateSizeMaxBeforeTimeCheck),1); gtk_combo_box_set_active(GTK_COMBO_BOX(window->RotateSizeMaxBeforeTimeCombo),yon_size_get_int_from_letter(value[strlen(value)-1])); - // }else if (!strcmp(parsed[i],"create")){ - // - // }else if (!strcmp(parsed[i],"nocreate")){ - // }else if (strstr(parsed[i],"size")){ int sizemod = yon_size_get_int_from_letter(parsed[i][strlen(parsed[i])-1]); gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->JournalMaxSizeSpin),atol(strstr(parsed[i], " ")+1)); @@ -1163,9 +1325,7 @@ void on_logrotate_edit(GtkWidget *self, logrotate_window *window){ gtk_entry_set_text(GTK_ENTRY(dialog->LogNameEntry),name ? name : ""); gtk_entry_set_text(GTK_ENTRY(dialog->LogDescriptionEntry),description ? description : ""); gtk_widget_set_can_focus(dialog->LogNameEntry,0); - // gtk_widget_set_can_focus(dialog->LogDescriptionEntry,0); gtk_entry_set_has_frame(GTK_ENTRY(dialog->LogNameEntry),0); - // gtk_entry_set_has_frame(GTK_ENTRY(dialog->LogDescriptionEntry),0); gtk_style_context_add_class(gtk_widget_get_style_context(dialog->LogNameEntry),"nobackground"); gtk_style_context_add_class(gtk_widget_get_style_context(dialog->LogDescriptionEntry),"nobackground"); } @@ -1289,13 +1449,14 @@ void on_logrotate_tab_open(GtkWidget *self, main_window *widgets){ window->AddButton = yon_gtk_builder_get_widget(builder,"AddButton"); window->RemoveButton = yon_gtk_builder_get_widget(builder,"RemoveButton"); window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox"); + yon_window_config_custom_window_get(GTK_WINDOW(window->Window),"LogrotateTabWindow"); gtk_window_set_title(GTK_WINDOW(window->Window),TITLE_LABEL); gtk_tree_view_set_model(GTK_TREE_VIEW(window->MainTree),GTK_TREE_MODEL(main_config.logrotate_list)); gtk_tree_view_set_model(GTK_TREE_VIEW(window->AppsMainTree),GTK_TREE_MODEL(main_config.logrotate_apps_list)); - g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_close_subwindow),NULL); - g_signal_connect(G_OBJECT(window->SaveButton),"clicked",G_CALLBACK(on_close_subwindow),NULL); + g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_close_subwindow),"LogrotateTabWindow"); + g_signal_connect(G_OBJECT(window->SaveButton),"clicked",G_CALLBACK(on_close_subwindow),"LogrotateTabWindow"); g_signal_connect(G_OBJECT(window->AddButton),"clicked",G_CALLBACK(on_logrotate_add),window); g_signal_connect(G_OBJECT(window->RemoveButton),"clicked",G_CALLBACK(on_logrotate_remove),window); g_signal_connect(G_OBJECT(window->ConfigureButton),"clicked",G_CALLBACK(on_logrotate_edit),window); @@ -1318,6 +1479,36 @@ void yon_combo_compress_check(GtkComboBox *self, journald_window *window){ } } +void on_journald_reset(GtkWidget *self, journald_window *window){ + gtk_combo_box_set_active(GTK_COMBO_BOX(window->LogStorageCombo),0); + gtk_combo_box_set_active(GTK_COMBO_BOX(window->LogCompressionCombo),0); + gtk_combo_box_set_active(GTK_COMBO_BOX(window->RedirectCombo),0); + gtk_combo_box_set_active(GTK_COMBO_BOX(window->LowerSizeCombo),0); + gtk_combo_box_set_active(GTK_COMBO_BOX(window->LowerTimeCombo),0); + gtk_combo_box_set_active(GTK_COMBO_BOX(window->LogStorageCombo),0); + gtk_combo_box_set_active(GTK_COMBO_BOX(window->LogFreeSpaceCombo),0); + gtk_combo_box_set_active(GTK_COMBO_BOX(window->ForwardedTypeCombo),0); + gtk_combo_box_set_active(GTK_COMBO_BOX(window->RotationSizeMaxCombo),0); + gtk_combo_box_set_active(GTK_COMBO_BOX(window->LogCompressionSizeCombo),0); + gtk_combo_box_set_active(GTK_COMBO_BOX(window->DivideJournalFilesCombo),0); + gtk_combo_box_set_active(GTK_COMBO_BOX(window->LogSizeMaxCombo),0); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->LogSizeMaxCheck),0); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->LogIntervalCheck),0); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->LogFreeSpaceCheck),0); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->RotationSizeMaxCheck),0); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->LogIntervalAmountCheck),0); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->LogSizeMaxSpin),0); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->LogIntervalSpin),0); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->LogFreeSpaceSpin),0); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->RotationSizeMaxSpin),0); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->LogIntervalAmountSpin),0); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->LogCompressionEntry),0); + gtk_entry_set_text(GTK_ENTRY(window->RedirectTTYEntry),""); + + gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->LowerSizeEntry),0); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->LowerTimeEntry),0); +} + void on_journald_save(GtkWidget *self, journald_window *window){ char *storage; int storage_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->LogStorageCombo)); @@ -1374,18 +1565,10 @@ void on_journald_save(GtkWidget *self, journald_window *window){ } if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->LogSizeMaxCheck))){ - long logssize=-1; + 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)); - for (int i=0;i0){ - float val; - int size; - val = yon_size_convert_automatic(logssize,&size); - yon_config_register(JOURNALD("SystemMaxUse"),"logging",yon_char_append(yon_char_from_float(val),yon_size_get_letter_from_int(size))); - } + yon_config_register(JOURNALD("SystemMaxUse"),"logging",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")); @@ -1417,7 +1600,7 @@ void on_journald_save(GtkWidget *self, journald_window *window){ char *TTY=NULL; if (consoleforwardactive == 1){ confor = "yes"; - TTY = (char*)gtk_entry_get_text(GTK_ENTRY(window->RedirectTTYEntry)); + TTY = yon_char_new((char*)gtk_entry_get_text(GTK_ENTRY(window->RedirectTTYEntry))); if (yon_char_is_empty(TTY)) consoleforwardactive=0; } @@ -1439,15 +1622,18 @@ void on_journald_save(GtkWidget *self, journald_window *window){ yon_config_register(JOURNALD("SplitMode"),"logging",splitmode); else yon_config_remove_by_key(JOURNALD("SplitMode")); - if (consoleforwardactive != 0) + if (consoleforwardactive != 0){ yon_config_register(JOURNALD("ForwardToConsole"),"logging",confor); - else + yon_config_register(JOURNALD("TTYPath"),"logging",TTY); + } else { yon_config_remove_by_key(JOURNALD("ForwardToConsole")); + yon_config_register(JOURNALD("TTYPath"),"logging",TTY); + } if (forwardempty!=0) yon_config_register(JOURNALD("MaxLevelConsole"),"logging",yon_char_from_int(forwardempty-1)); else yon_config_remove_by_key(JOURNALD("MaxLevelConsole")); - on_close_subwindow(window->MainWindow); + on_close_subwindow(window->MainWindow,"JournaldWindow"); } journald_window *yon_journald_open(GtkWidget *self, main_window *widgets){ @@ -1456,6 +1642,7 @@ journald_window *yon_journald_open(GtkWidget *self, main_window *widgets){ window->MainWindow=yon_gtk_builder_get_widget(builder,"MainWindow"); window->CancelButton=yon_gtk_builder_get_widget(builder,"CancelButton"); window->SaveButton=yon_gtk_builder_get_widget(builder,"SaveButton"); + window->ResetButton=yon_gtk_builder_get_widget(builder,"ResetButton"); window->LogNameLabel=yon_gtk_builder_get_widget(builder,"LogNameEntry"); window->LogDescriptionLabel=yon_gtk_builder_get_widget(builder,"LogDescriptionEntry"); window->LogStorageCombo=yon_gtk_builder_get_widget(builder,"LogStorageCombo"); @@ -1488,16 +1675,20 @@ journald_window *yon_journald_open(GtkWidget *self, main_window *widgets){ window->LowerTimeButton=yon_gtk_builder_get_widget(builder,"LowerTimeButton"); window->headerTopic=yon_gtk_builder_get_widget(builder,"headerTopic"); + yon_window_config_custom_window_get(GTK_WINDOW(window->MainWindow),"JournaldWindow"); + gtk_window_set_transient_for(GTK_WINDOW(window->MainWindow),GTK_WINDOW(widgets->Window)); { int sz; config_str logsize = yon_config_load(journald_size_command,&sz); - gtk_label_set_text(GTK_LABEL(window->LogSizeLabel),logsize[0]); + if (logsize) + gtk_label_set_text(GTK_LABEL(window->LogSizeLabel),logsize[0]); } gtk_window_set_title(GTK_WINDOW(window->MainWindow),TITLE_LABEL); - g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_close_subwindow),NULL); + g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_close_subwindow),"JournaldWindow"); g_signal_connect(G_OBJECT(window->SaveButton),"clicked",G_CALLBACK(on_journald_save),window); + g_signal_connect(G_OBJECT(window->ResetButton),"clicked",G_CALLBACK(on_journald_reset),window); g_signal_connect(G_OBJECT(window->LogIntervalCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),window->LogIntervalSpin); g_signal_connect(G_OBJECT(window->LogIntervalCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),window->LogIntervalAmountCheck); @@ -1608,7 +1799,26 @@ void on_log_save(GtkWidget *self, dictionary *dict){ char *pathse=NULL; for (int i=0;iLogPathsBox); + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + return; + } + config_str paths_parsed = yon_char_parse(pathse,&paths_size,"\n"); + if (yon_char_parsed_check_repeats(paths_parsed,paths_size,&fo,&so)){ + GList *list = gtk_container_get_children(GTK_CONTAINER(window->LogPathsBox)); + yon_ubl_status_highlight_incorrect((GtkWidget*)g_list_nth_data(list,so)); + yon_ubl_status_highlight_incorrect((GtkWidget*)g_list_nth_data(list,fo)); + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),REPEAT_PATHS_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + return; } GtkTreeIter iter; char *name = (char*)gtk_entry_get_text(GTK_ENTRY(window->NameEntry)); @@ -1616,11 +1826,44 @@ void on_log_save(GtkWidget *self, dictionary *dict){ if (!yon_char_is_empty(name)){ GtkTreeModel *model = GTK_TREE_MODEL(widgets->list); GtkTreeIter iter; - if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->MainTree)),&model,&iter)) + int stat; + if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->MainTree)),&model,&iter)){ + int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->list),&iter); + for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(widgets->list),&iter)){ + char *paths=NULL; + char *name; + gtk_tree_model_get(GTK_TREE_MODEL(widgets->list),&iter,0,&name,1,&paths,-1); + if (!strcmp(gtk_entry_get_text(GTK_ENTRY(window->NameEntry)),name)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),REPEATED_PATHS_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(window->NameEntry); + return; + } + int paths_size=0; + config_str paths_parsed = yon_char_parse(paths,&paths_size,"\n"); + int pathse_size=0; + config_str pathse_parsed = yon_char_parse(pathse,&pathse_size,"\n"); + if (yon_char_parsed_includes_char_parsed(pathse_parsed,paths_parsed,pathse_size,paths_size)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),REPEATED_PATHS_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + return; + } + } gtk_list_store_append(widgets->list,&iter); + gtk_list_store_set(widgets->list,&iter,3,0,-1); + gtk_list_store_set(widgets->list,&iter,0,name,1,pathse,2,&desc ? desc : "",3,0,-1); + yon_window_config_custom_window_set(GTK_WINDOW(window->MainWindow),"AddWindow"); + } else { + yon_window_config_custom_window_set(GTK_WINDOW(window->MainWindow),"EditWindow"); + gtk_tree_model_get(GTK_TREE_MODEL(widgets->list),&iter,3,&stat,-1); + gtk_list_store_set(widgets->list,&iter,3,stat==0?0:stat==1?2:2,-1); + } gtk_list_store_set(widgets->list,&iter,0,name,1,pathse,2,&desc ? desc : "",-1); + } else { + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),WRITE_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(window->NameEntry); + return; } - on_close_subwindow(self); + yon_logs_custom_save(widgets); + on_close_subwindow(self,NULL); } add_log_window *on_add_open(main_window *widgets){ @@ -1640,12 +1883,12 @@ add_log_window *on_add_open(main_window *widgets){ window->ControlSectionBox=yon_gtk_builder_get_widget(builder,"ControlSectionBox"); window->LogPathsBox=yon_gtk_builder_get_widget(builder,"LogPathsBox"); window->NameEntry=yon_gtk_builder_get_widget(builder,"NameEntry"); + window->StatusBox=yon_gtk_builder_get_widget(builder,"StatusBox"); gtk_window_set_title(GTK_WINDOW(window->MainWindow),TITLE_LABEL); gtk_window_set_transient_for(GTK_WINDOW(window->MainWindow),GTK_WINDOW(widgets->Window)); 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); - g_signal_connect(G_OBJECT(window->CancelButton),"clicked", G_CALLBACK(on_close_subwindow),NULL); g_signal_connect(G_OBJECT(window->SaveButton),"clicked", G_CALLBACK(on_log_save),dict); return window; } @@ -1713,6 +1956,8 @@ void on_log_add(GtkWidget *self, main_window *widgets){ GtkTreeModel *model = GTK_TREE_MODEL(widgets->list); GtkTreeIter iter; add_log_window *window = on_add_open(widgets); + yon_window_config_custom_window_get(GTK_WINDOW(window->MainWindow),"AddWindow"); + g_signal_connect(G_OBJECT(window->CancelButton),"clicked", G_CALLBACK(on_close_subwindow),"AddWindow"); gtk_tree_selection_unselect_all(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->MainTree))); gtk_widget_show(window->MainWindow); gtk_widget_hide(window->StatisticsFrame); @@ -1725,6 +1970,8 @@ void on_log_edit(GtkWidget *self,main_window *widgets){ GtkTreeIter iter; if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->MainTree)),&model,&iter)){ add_log_window *window = on_add_open(widgets); + g_signal_connect(G_OBJECT(window->CancelButton),"clicked", G_CALLBACK(on_close_subwindow),"EditWindow"); + yon_window_config_custom_window_get(GTK_WINDOW(window->MainWindow),"EditWindow"); gtk_widget_show(window->MainWindow); gtk_widget_hide(window->StatisticsFrame); char *name; @@ -1735,14 +1982,22 @@ void on_log_edit(GtkWidget *self,main_window *widgets){ int protect; gtk_tree_model_get(model,&iter,0,&name,1,&paths,2,&description,3,&is_standard,4,&protect,-1); gtk_entry_set_text(GTK_ENTRY(window->NameEntry),name); + if(getuid()!=0){ + gtk_widget_set_sensitive(window->SyslogButton,0); + gtk_widget_set_sensitive(window->MetalogButton,0); + gtk_widget_set_sensitive(window->JournaldButton,0); + gtk_widget_set_sensitive(window->LogrotateButton,0); + } if (!strcmp(name,"journald")){ gtk_widget_hide(window->LogrotateButton); gtk_widget_hide(window->MetalogButton); gtk_widget_hide(window->SyslogButton); gtk_widget_show(window->StatisticsFrame); + int sz; config_str logsize = yon_config_load(journald_size_command,&sz); - gtk_label_set_text(GTK_LABEL(window->LogSizeLabel),logsize[0]); + if (logsize) + gtk_label_set_text(GTK_LABEL(window->LogSizeLabel),logsize[0]); g_signal_connect(G_OBJECT(window->JournaldButton),"clicked", G_CALLBACK(on_journald_open),widgets); } else { gtk_widget_hide(window->JournaldButton); @@ -1750,8 +2005,6 @@ void on_log_edit(GtkWidget *self,main_window *widgets){ yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets); yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); g_signal_connect(G_OBJECT(window->LogrotateButton),"clicked", G_CALLBACK(on_log_edit_logrotate_settings),dict); - // g_signal_connect(G_OBJECT(window->MetalogButton),"clicked", G_CALLBACK(on_log),widgets); - // g_signal_connect(G_OBJECT(window->SyslogButton),"clicked", G_CALLBACK(yon_journald_open),widgets); } window->log_name=name; gtk_entry_set_text(GTK_ENTRY(window->LogDescriptionEntry),description ? description : ""); @@ -1767,14 +2020,17 @@ void on_log_edit(GtkWidget *self,main_window *widgets){ GtkWidget *RemoveButton = yon_gtk_builder_get_widget(builder,"RemoveButton"); if (protectedLogPathsBox),box,0,0,5); last = AppendButton; @@ -1847,6 +2103,13 @@ void on_main_window_tree_selection_changed(GtkWidget *self,main_window *widgets) void on_main_window_services_tree_selection_changed(GtkWidget *self,main_window *widgets){ GtkTreeModel *model = GTK_TREE_MODEL(widgets->ServicesList); GtkTreeIter iter; + if (getuid()!=0){ + gtk_widget_set_sensitive(widgets->ServicesEditButton,0); + gtk_widget_set_sensitive(widgets->ServicesEnableDisableButton,0); + gtk_widget_set_sensitive(widgets->ServicesStartStopButton,0); + return; + } + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->ServicesTree)),&model,&iter)){ gboolean is_active; gboolean is_enabled; @@ -1934,6 +2197,57 @@ void on_enable_disable_clicked(GtkButton *self, main_window *widgets){ // standard functions +void on_permissions_changed(){ + if (g_permission_get_allowed(main_config.permissions)){ + PolkitAuthority *auth = polkit_authority_get_sync(NULL,NULL); + PolkitSubject *subject; + pid_t parent_pid; + parent_pid = getppid (); + subject = polkit_unix_process_new_for_owner (parent_pid,0,getuid()); + PolkitDetails *dets = polkit_details_new(); + if (polkit_authority_check_authorization_sync(auth,subject,"com.ublinux.ubl-settings-logging",dets,POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION,NULL,NULL)){ + printf("Allowed\n"); + char *command[] = {"/bin/pkexec","/bin/echo","1", NULL}; + gchar *standard_output = NULL; + gchar *standard_error = NULL; + gint exit_status = -1; + + GError *error = NULL; + gboolean success = g_spawn_sync( + NULL, + command, + NULL, + G_SPAWN_DEFAULT, + NULL, + NULL, + &standard_output, + &standard_error, + NULL, + &error + ); + + if (success) { + if (standard_output != NULL) { + printf("Output: %s\n", standard_output); + g_free(standard_output); + } + if (standard_error != NULL) { + printf("Error output: %s\n", standard_error); + g_free(standard_error); + } + printf("Exit status: %d\n", exit_status); + } else { + g_printerr("Error running command: %s\n", error->message); + g_error_free(error); + } + } else { + if (g_permission_get_can_acquire(main_config.permissions)){ + g_permission_acquire(main_config.permissions,NULL,NULL); + } + } + } +} + void config_init(){ main_config.always_open_documentation=0; main_config.win_height=0; @@ -1950,6 +2264,19 @@ void config_init(){ main_config.lock_save_local=0; main_config.logrotate_list = gtk_list_store_new(3,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING); main_config.logrotate_apps_list = gtk_list_store_new(3,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING); + main_config.remove_thread=-1; + + PolkitSubject *subject = NULL; + + pid_t parent_pid; + parent_pid = getppid (); + if (parent_pid == 1) + { + g_printerr ("Parent process was reaped by init(1)\n"); + } + subject = polkit_unix_process_new_for_owner (parent_pid,0,getuid()); + main_config.permissions = polkit_permission_new_sync("com.ublinux.ubl-settings-logging",subject,NULL,NULL); + g_signal_connect(G_OBJECT(main_config.permissions),"notify::allowed",G_CALLBACK(on_permissions_changed),NULL); } main_window *setup_window(){ @@ -1996,8 +2323,10 @@ main_window *setup_window(){ widgets->list = GTK_LIST_STORE(gtk_builder_get_object(builder,"liststore1")); widgets->ServicesList = GTK_LIST_STORE(gtk_builder_get_object(builder,"ServicesList")); + widgets->UpgradePermissionsMenuItem = yon_gtk_builder_get_widget(builder,"UpgradePermissionsMenuItem"); + widgets->MainTree = yon_gtk_builder_get_widget(builder,"MainTree"); - + gtk_window_set_title(GTK_WINDOW(widgets->Window),TITLE_LABEL); GtkWidget *menu = yon_gtk_builder_get_widget(builder,"menu2"); @@ -2029,7 +2358,9 @@ main_window *setup_window(){ config_str log = yon_char_parse(journals[i],&log_size,";"); log[1] = yon_char_replace(log[1],",","\n"); gtk_list_store_append(widgets->list,&iter); - free(yon_char_parse(log[1],&psize,"\n")); + config_str sfafa = yon_char_parse(log[1],&psize,"\n"); + if (sfafa) + free(sfafa); gtk_list_store_set(widgets->list,&iter,0,log[0],1,log[1],2,_(log[2]),3,1,4,psize,-1); } config_str services = yon_file_open(services_list_path,&service_size); @@ -2039,7 +2370,6 @@ main_window *setup_window(){ services[i]=yon_char_divide_search(services[i],"\n",-1); config_str log = yon_char_parse(services[i],&log_size,";"); gtk_list_store_append(widgets->ServicesList,&iter); - // yon_config_load gtk_list_store_set(widgets->ServicesList,&iter,0,1,1,1,2,log[0],3,_(log[1]),4,log[2],5,log[3],6,log[4],7,log[5],8,log[6],-1); } } @@ -2082,13 +2412,11 @@ main_window *setup_window(){ GList *list = gtk_tree_view_get_columns(GTK_TREE_VIEW(widgets->MainTree)); for (int i=0; iServicesTree)); for (int i=0; ilist),&iter); + for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(widgets->list),&iter)){ + gtk_tree_model_get(GTK_TREE_MODEL(widgets->list),&iter,0,&cur_name,-1); + if (!strcmp(cur_name,cur_watcher[0])){ + found=1; + break; + } + } + if (!found) + gtk_list_store_append(widgets->list,&iter); + cur_watcher[1] = yon_char_replace(cur_watcher[1],",","\n"); + gtk_list_store_set(widgets->list,&iter,0,cur_watcher[0],1,cur_watcher[1],2,cur_watcher[2]?cur_watcher[2]:"",-1); + yon_char_parsed_free(cur_watcher,cur_size); + } + } + } else { + if (access(custom_logs_saving_file_path,F_OK)){ + yon_file_create_full_path(custom_logs_saving_file_path,0777); + } + FILE *fl = fopen(custom_logs_saving_file_path,"w"); + fclose(fl); + } /* Widget registration for config monitoring | Регистрация виджетов для мониторинга конфига */ // yon_window_config_add_custom_parameter(widgets->HeadInfoLabel,"head-text","label",YON_TYPE_STRING); @@ -2116,6 +2477,8 @@ main_window *setup_window(){ g_signal_connect(G_OBJECT(widgets->LoadGlobalMenuItem),"activate",G_CALLBACK(on_load_global),NULL); g_signal_connect(G_OBJECT(widgets->LoadLocalMenuItem),"activate",G_CALLBACK(on_load_local),NULL); + g_signal_connect(G_OBJECT(widgets->UpgradePermissionsMenuItem),"activate",G_CALLBACK(on_permissions_changed),NULL); + g_signal_connect(G_OBJECT(widgets->MainTree),"cursor-changed",G_CALLBACK(on_main_window_tree_selection_changed),widgets); g_signal_connect(G_OBJECT(widgets->ServicesTree),"cursor-changed",G_CALLBACK(on_main_window_services_tree_selection_changed),widgets); @@ -2126,10 +2489,11 @@ main_window *setup_window(){ return widgets; } -int main(int argc, char *argv[]){ +int main(int argc, char *argv[], char **envp){ local=setlocale(LC_ALL, ""); textdomain (LocaleName); config_init(); + main_config.envp=envp; int option_index=0; int show_help=0; int debug_mode=0; @@ -2149,7 +2513,7 @@ int main(int argc, char *argv[]){ { NULL, 0, NULL, 0 } }; for (int i=0;i #include #include +#include #include #include "../compile/ubl-cmake.h" #ifdef WEBKIT_FOUND #include #endif #include "ubl-strings.h" +#include #define WIKI_LINK "https://wiki.ublinux.ru/ru/Программное_обеспечение/Программы_и_утилиты/Все/ubl-settings-logging" @@ -30,6 +32,7 @@ #define glade_logrotate_table_path "/com/ublinux/ui/ubl-settings-logging-logrotate-table.glade" #define glade_rules_path "/com/ublinux/ui/ubl-settings-logging-rules.glade" #define glade_filechooser_path "/com/ublinux/ui/ubl-settings-logging-filechooser.glade" +#define glade_terminal_path "/com/ublinux/ui/ubl-settings-logging-terminal.glade" #define banner_path "/com/ublinux/images/ubl-settings-logging-banner.png" #define CssPath "/com/ublinux/css/ubl-settings-logging.css" #define config_path yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL) @@ -39,6 +42,7 @@ #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_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) #define LocalePath "/usr/share/locale" #define LocaleName "ubl-settings-logging" @@ -46,14 +50,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;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 --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" +#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 group_list_path "/etc/group" @@ -69,6 +73,7 @@ string version_application; char *local; typedef struct { + char **envp; int always_open_documentation; int win_pos_x; int win_pos_y; @@ -88,8 +93,16 @@ typedef struct { GtkListStore *logrotate_list; GtkListStore *logrotate_apps_list; + config_str groups; int groups_size; + + config_str *saved_logs; + + GPermission *permissions; + + pthread_t inspector_thread; + int remove_thread; } config; typedef struct { @@ -136,6 +149,8 @@ typedef struct { GtkWidget *ServicesEnableDisableButton; GtkListStore *list; GtkListStore *ServicesList; + GtkWidget *UpgradePermissionsMenuItem; + GtkWidget *PermissionsLock; // Custom } main_window; @@ -154,6 +169,7 @@ typedef struct { typedef struct { GtkWidget *MainWindow; + GtkWidget *StatusBox; GtkWidget *adjustment1; GtkWidget *adjustment2; GtkWidget *CancelButton; @@ -176,21 +192,25 @@ typedef struct { } add_log_window; typedef struct { -GtkWidget *MainWindow; -GtkWidget *plugBox; -GtkWidget *ShowSinceBootButton; -GtkWidget *NewMessagesButton; -GtkWidget *ShowKernelButton; -GtkWidget *ShowPriorityButton; -GtkWidget *UpdateButton; -GtkWidget *ShowAllBootsButton; -GtkWidget *ShowAllUnitsButton; -GtkWidget *ShowInitTreeButton; -GtkWidget *LoggingTerminal; -GtkWidget *JournalActionsBox; -int last_mode; -char *journal_name; -char *journal_paths; + GtkWidget *MainWindow; + GtkWidget *plugBox; + GtkWidget *ShowSinceBootButton; + GtkWidget *NewMessagesButton; + GtkWidget *ShowKernelButton; + GtkWidget *ShowPriorityButton; + GtkWidget *UpdateButton; + GtkWidget *ShowAllBootsButton; + GtkWidget *ShowAllUnitsButton; + GtkWidget *ShowInitTreeButton; + GtkWidget *LoggingNotebook; + GtkWidget *JournalActionsBox; + GtkListStore *list; + GtkWidget *JournaldTree; + dictionary *terminals; + int last_mode; + char *journal_name; + int journal_size; +config_str journal_paths; } inspector_window; @@ -235,6 +255,7 @@ typedef struct { GtkWidget *MainWindow; GtkWidget *CancelButton; GtkWidget *SaveButton; + GtkWidget *ResetButton; GtkWidget *LogNameLabel; GtkWidget *LogDescriptionLabel; GtkWidget *LogStorageCombo; diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 1548a3f..95126f1 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -101,6 +101,7 @@ #define DAYS_LABEL _("Days") #define WEEKS_LABEL _("Weeks") #define YEARS_LABEL _("Years") +#define RESET_LABEL _("Reset") //ubl-settings-logging-logrotate.glade #define LOGROTATE_LOG_JOURNAL_TAB_LABEL _("Log/Journal:") @@ -175,6 +176,9 @@ #define SATURDAY_LABEL _("Saturday") #define SUNDAY_LABEL _("Sunday*") #define REPEATED_PATHS_LABEL _("Same record already exists") +#define EMPTY_IMPORTANT_LABEL _("Empty important field") +#define REPEAT_PATHS_LABEL _("Repeating paths") +#define WRITE_IMPORTANT_LABEL _("Write down all important fields") //ubl-settings-logging-logrotate-table.glade #define SYSTEM_CONFIGURATION_LABEL _("System configuration") @@ -184,4 +188,16 @@ #define ADD_PATHS_LABEL _("Path (-s):") #define CONTROL_LABEL _("Control:") #define LOG_LABEL _("Log file") -#define NAME_LABEL _("Name:") \ No newline at end of file +#define NAME_LABEL _("Name:") + +//ubl-settings-logging-rules.glade +#define OWNER_LABEL _("Owner rules") +#define GROUP_LABEL _("Group rules") +#define PUBLIC_LABEL _("Public rules") +#define READ_LABEL _("Read") +#define WRITE_LABEL _("Write") +#define EXECUTE_LABEL _("Execute") +#define VALUE_LABEL _("Value:") + +//ubl-settings-logging-terminal.glade +#define PATH_NOT_FOUND_LABEL _(": no such file(s)") \ No newline at end of file diff --git a/source/ubl-utils.c b/source/ubl-utils.c index c7b87c4..66ed085 100644 --- a/source/ubl-utils.c +++ b/source/ubl-utils.c @@ -622,8 +622,8 @@ char *yon_char_from_float(float int_to_convert) { convert_check = convert_check / 10; } - char *ch = g_malloc0(i * sizeof(char) + 1); - sprintf(ch, "%f", int_to_convert); + char *ch = g_malloc0((i + 9)* sizeof(char)); + sprintf(ch, "%.2f", int_to_convert); return ch; } @@ -680,24 +680,22 @@ char *yon_char_replace(char *source, char *find, char*replace){ * size of returned array */ char **yon_char_parse(char *parameters, int *size, char *divider){ - char **string=NULL; - int i=1; - string=malloc(sizeof(char*)); - char *paramline=yon_char_new(parameters); - char *param; - while ((param=yon_char_divide_search(paramline,divider,1))){ - string=realloc(string,sizeof(char*)*i); - string[i-1]=yon_char_new(param); - i++; - if (strcmp(param,paramline)==0) break; - } - // string=realloc(string,sizeof(char*)*i); - // string[i-1]=yon_char_new(paramline); - // i++; - // printf("%d\n",i); - *size=i-1; - return string; - + if (parameters){ + char **string=NULL; + *size=0; + char *paramline=yon_char_new(parameters); + char *param = strstr(paramline,divider); + for (;param;param=strstr(paramline,divider)){ + string = yon_remalloc(string,sizeof(char*)*((*size)+1)); + string[(*size)]=yon_char_divide(paramline,strlen(paramline)-strlen(param)); + *size=(*size)+1; + } + string = yon_remalloc(string,sizeof(char*)*((*size)+1)); + string[(*size)]=paramline; + (*size)+=1; + return string; + } + return NULL; } /**yon_char_parsed_rip(char **char_string, int *size, int item_to_delete) @@ -746,6 +744,30 @@ int yon_char_parsed_check_exist(char **parameters, int size, char *param){ return -1; } +/**yon_char_parsed_check_repeats(char **parameters, int size) + * [EN] + * Checks if [parameters] string array of length [size] + * has repeated elements; + * [RU] + * Проверяет есть ли в массиве строк [parameters], размера [size] + * повторения +*/ +int yon_char_parsed_check_repeats(char **parameters, int size, int *first_overlap, int *second_overlap){ + if (parameters){ + *first_overlap=0; + *second_overlap=0; + for ((*first_overlap)=0;(*first_overlap)key,key)==0){ + if (strcmp(dict->key,key)==0&&((yon_config_parameter*)dict)->flag1!=-1){ return dict->data; } } @@ -1205,7 +1227,7 @@ void *yon_config_get_all_by_key(char *key, int *size){ config_str ret_data=NULL; dictionary *dict = NULL; for_dictionaries(dict, (dictionary*)__yon__config__strings){ - if (strstr(dict->key,key)) { + if (strstr(dict->key,key)&&((yon_config_parameter*)dict)->flag1!=-1) { char *ret_string = yon_char_unite(dict->key,"=",(char*)dict->data,NULL); if (ret_data) ret_data = yon_char_parsed_append(ret_data,size,ret_string); else ret_data = yon_char_parsed_new(size,ret_string,NULL); @@ -1334,12 +1356,17 @@ config_str yon_config_load(char *command, int *str_len){ } } -/**int yon_config_save_registered(char *path, char *section) +/**int yon_config_save_registered(char *path) * [EN] - * Saves config with [command] + * Saves config at [path] config. + * [path] can be: + * system + * global * [RU] - * Выполняет команду [command], добавляя в конец все записи конфига в таком виде: - * [ПАРАМЕТР1]="[значения1]" [ПАРАМЕТР2]="[значения2]" + * Сохраняет конфигурацию в [path] конфиг. + * [path] может быть + * system - локальный конфиг + * global - глобальный конфиг */ int yon_config_save_registered(char *path){ check_config{ @@ -1350,7 +1377,7 @@ int yon_config_save_registered(char *path){ if (dct->data&&strcmp(yon_dictionary_get_data(dct,char*),"")!=0){ if (((yon_config_parameter*)dct)->flag1==1){ ((yon_config_parameter*)dct)->flag1=0; - if (sections_add&&yon_dictionary_get(§ions_add,((yon_config_parameter*)dct)->section)) sections_add->data=(void*)yon_char_unite(yon_dictionary_get_data(sections_add,char*)," ",dct->key,"=",yon_dictionary_get_data(dct,char*),NULL); + if (sections_add&&yon_dictionary_get(§ions_add,((yon_config_parameter*)dct)->section)) sections_add->data=(void*)yon_char_unite(yon_dictionary_get_data(sections_add,char*)," ",dct->key,"=\"",yon_dictionary_get_data(dct,char*),"\"",NULL); else yon_dictionary_add_or_create_if_exists_with_data(sections_add,((yon_config_parameter*)dct)->section,yon_char_unite (ubconfig_save_command,path ? yon_char_append(" --target ",path):"", " set ", ((yon_config_parameter*)dct)->section, " ",dct->key,"=\"",yon_dictionary_get_data(dct,char*),"\"",NULL)); } else if (((yon_config_parameter*)dct)->flag1==-1){ ((yon_config_parameter*)dct)->flag1=0; @@ -1376,10 +1403,15 @@ int yon_config_save_registered(char *path){ /**int yon_config_force_save_registered(char *path, char *section) * [EN] - * Saves config with [command] + * Force config to save at [path] config ignoring parameter save status. + * [path] can be: + * system + * global * [RU] - * Выполняет команду [command], добавляя в конец все записи конфига в таком виде: - * [ПАРАМЕТР1]="[значения1]" [ПАРАМЕТР2]="[значения2]" + * Принудительно сохраняет конфигурацию в [path] конфиг игнорируя статус параметра. + * [path] может быть + * system - локальный конфиг + * global - глобальный конфиг */ int yon_config_force_save_registered(char *path){ check_config{ @@ -1389,7 +1421,7 @@ int yon_config_force_save_registered(char *path){ for_dictionaries(dct,(dictionary*)__yon__config__strings){ if (dct->data&&strcmp(yon_dictionary_get_data(dct,char*),"")!=0){ if (((yon_config_parameter*)dct)->flag1==1||((yon_config_parameter*)dct)->flag1==0){ - if (sections_add&&yon_dictionary_get(§ions_add,((yon_config_parameter*)dct)->section)) sections_add->data=(void*)yon_char_unite(yon_dictionary_get_data(sections_add,char*)," ",dct->key,"=",yon_dictionary_get_data(dct,char*),NULL); + if (sections_add&&yon_dictionary_get(§ions_add,((yon_config_parameter*)dct)->section)) sections_add->data=(void*)yon_char_unite(yon_dictionary_get_data(sections_add,char*)," ",dct->key,"=\"",yon_dictionary_get_data(dct,char*),"\"",NULL); else yon_dictionary_add_or_create_if_exists_with_data(sections_add,((yon_config_parameter*)dct)->section,yon_char_unite (ubconfig_save_command,path ? yon_char_append(" --target ",path):"", " set ", ((yon_config_parameter*)dct)->section, " ",dct->key,"=\"",yon_dictionary_get_data(dct,char*),"\"",NULL)); } else if (((yon_config_parameter*)dct)->flag1==-1){ if (sections_remove&&yon_dictionary_get(§ions_remove,((yon_config_parameter*)dct)->section)) sections_remove->data=(void*)yon_char_unite(yon_dictionary_get_data(sections_remove,char*)," ",dct->key,NULL); @@ -1481,7 +1513,60 @@ config_str yon_file_open(char *file_path, int *size){ } return final_string; } -} +} + +/**yon_file_create(char *path, char *name, int rules) + * [EN] + * + * [RU] + * Создать файл с названием [name], находящимся по пути [path] + * С правами доступа [rules] (от 0000 до 0777) +*/ +int yon_file_create(char *path, char *name, int rules){ + if (path&&name){ + char *full_path = yon_char_unite(path,"/",name,NULL); + if (access(full_path,F_OK)){ + FILE *fl = fopen(full_path,"w"); + if (fl){ + chmod(full_path,rules); + fclose(fl); + return 1; + } else { + return 0; + } + } else { + return -1; + } + } else { + return 0; + } +} + +/**yon_file_create_full_path(char *path, char *name, int rules) + * [EN] + * + * [RU] + * Создать файл по пути [path] + * С правами доступа [rules] (от 0000 до 0777) +*/ +int yon_file_create_full_path(char *path, int rules){ + if (path){ + if (access(path,F_OK)){ + FILE *fl = fopen(path,"w"); + if (fl){ + chmod(path,rules); + fclose(fl); + return 1; + } else { + return 0; + } + } else { + return -1; + } + } else { + return 0; + } +} // terminal-using functions @@ -1552,8 +1637,7 @@ void yon_terminal_integrated_launch(GtkWidget *place_to_show, char* command, voi VtePty *pty = vte_pty_new_sync(VTE_PTY_DEFAULT,NULL,NULL); vte_terminal_set_pty(VTE_TERMINAL(terminal),pty); gtk_container_add(GTK_CONTAINER(place_to_show),terminal); - char *install_command=yon_char_unite("tput cup 0 0 && tput ed; ",command," ; sleep 5;exit 0","\n",NULL); - printf("%s\n",install_command); + char *install_command=yon_char_unite("clear;tput cup 0 0 && tput ed; ",command," ; sleep 5;exit 0","\n",NULL); if(endwork_function) g_signal_connect(G_OBJECT(terminal), "child-exited", G_CALLBACK(endwork_function), endwork_function_argument); vte_terminal_spawn_async(VTE_TERMINAL(terminal), @@ -1606,7 +1690,7 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end vte_terminal_set_size(VTE_TERMINAL(terminal),10,15); VtePty *pty = vte_pty_new_sync(VTE_PTY_DEFAULT,NULL,NULL); vte_terminal_set_pty(VTE_TERMINAL(terminal),pty); - char *install_command=yon_char_unite("tput cup 0 0 && tput ed; ",command," ; sleep 5;exit 0","\n",NULL); + char *install_command=yon_char_unite("clear;tput cup 0 0 && tput ed; ",command," ; sleep 5; stty -echo; unset PS1","\n",NULL); if(endwork_function) g_signal_connect(G_OBJECT(terminal), "child-exited", G_CALLBACK(endwork_function), endwork_function_argument); vte_terminal_spawn_async(VTE_TERMINAL(terminal), @@ -1679,6 +1763,11 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end g_key_file_set_integer(__yon_window_config_file,"window","WindowHeight",__yon_main_window_config.height); g_key_file_set_integer(__yon_window_config_file,"window","fullscreen",__yon_main_window_config.fullscreen); dictionary *dict=NULL; + if (__yon_main_window_config.deleted_parameters) + for_dictionaries(dict,__yon_main_window_config.deleted_parameters){ + __yon_custom_parameter *param = yon_dictionary_get_data(dict,__yon_custom_parameter*); + g_key_file_remove_key(__yon_window_config_file,param->section,param->parameter_name,NULL); + } if (__yon_main_window_config.custom_listeners) for_dictionaries(dict,__yon_main_window_config.custom_listeners){ __yon_listener_parameter *param = yon_dictionary_get_data(dict,__yon_listener_parameter*); @@ -1714,11 +1803,7 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end break; } } - if (__yon_main_window_config.deleted_parameters) - for_dictionaries(dict,__yon_main_window_config.deleted_parameters){ - __yon_custom_parameter *param = yon_dictionary_get_data(dict,__yon_custom_parameter*); - g_key_file_remove_key(__yon_window_config_file,param->section,param->parameter_name,NULL); - } + g_key_file_save_to_file(__yon_window_config_file,__yon_window_config_path,NULL); } @@ -1787,6 +1872,7 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end } FILE *fp; fp=fopen(__yon_window_config_path,"w"); + chmod(__yon_window_config_path,0777); fclose(fp); g_key_file_load_from_file(__yon_window_config_file,__yon_window_config_path,G_KEY_FILE_NONE,NULL); } @@ -1868,6 +1954,17 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end } } + void yon_window_config_add_instant_parameter(char *param_name, char *section, void *tracked_value, enum YON_TYPE val_type){ + switch (val_type){ + case YON_TYPE_BOOLEAN: g_key_file_set_boolean(__yon_window_config_file,section,param_name,*((gboolean*)tracked_value)); + break; + case YON_TYPE_INT: g_key_file_set_integer(__yon_window_config_file,section,param_name,*((int*)tracked_value)); + break; + case YON_TYPE_STRING: g_key_file_set_string(__yon_window_config_file,section,param_name,(char*)tracked_value); + break; + } + } + void yon_window_config_erase_custom_parameter(char *param_name, char *section){ __yon_custom_parameter *param = NULL; param = yon_remalloc(param,sizeof(__yon_custom_parameter)); @@ -1901,6 +1998,81 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end } } + void yon_on_window_config_custom_window_destroy(GtkWindow *window, char *window_name){ + if (!gtk_window_is_maximized(window)){ + int height=0; + int width=0; + int X=0; + int Y=0; + gtk_window_get_position(window,&X,&Y); + yon_window_config_add_instant_parameter(yon_char_append(window_name,"PosX"),"window",&X,YON_TYPE_INT); + yon_window_config_add_instant_parameter(yon_char_append(window_name,"PosY"),"window",&Y,YON_TYPE_INT); + + } + } + + void yon_on_window_config_custom_window_resize(GtkWindow *window, char *window_name){ + if (!gtk_window_is_maximized(window)){ + int height=0; + int width=0; + int X=0; + int Y=0; + gtk_window_get_size(window,&width,&height); + gtk_window_get_position(window,&X,&Y); + yon_window_config_add_instant_parameter(yon_char_append(window_name,"Width"),"window",&width,YON_TYPE_INT); + yon_window_config_add_instant_parameter(yon_char_append(window_name,"Height"),"window",&height,YON_TYPE_INT); + yon_window_config_add_instant_parameter(yon_char_append(window_name,"PosX"),"window",&X,YON_TYPE_INT); + yon_window_config_add_instant_parameter(yon_char_append(window_name,"PosY"),"window",&Y,YON_TYPE_INT); + } + + } + + void yon_window_config_custom_window_setup(GtkWindow *window, char *window_name){ + int height=0; + int width=0; + int X=0; + int Y=0; + yon_window_config_get_parameter("window",yon_char_append(window_name,"Width"),&width,YON_TYPE_INT); + yon_window_config_get_parameter("window",yon_char_append(window_name,"Height"),&height,YON_TYPE_INT); + yon_window_config_get_parameter("window",yon_char_append(window_name,"PosX"),&X,YON_TYPE_INT); + yon_window_config_get_parameter("window",yon_char_append(window_name,"PosY"),&Y,YON_TYPE_INT); + if (width&&height) + gtk_window_resize(window,width,height); + if (X&&Y) + gtk_window_move(window,X,Y); + char *signals_window_name = yon_char_new(window_name); + g_signal_connect(G_OBJECT(window),"check-resize",G_CALLBACK(yon_on_window_config_custom_window_resize),signals_window_name); + g_signal_connect(G_OBJECT(window),"delete-event",G_CALLBACK(yon_on_window_config_custom_window_destroy),signals_window_name); + } + + void yon_window_config_custom_window_get(GtkWindow *window, char *window_name){ + int height=0; + int width=0; + int X=0; + int Y=0; + yon_window_config_get_parameter("window",yon_char_append(window_name,"Width"),&width,YON_TYPE_INT); + yon_window_config_get_parameter("window",yon_char_append(window_name,"Height"),&height,YON_TYPE_INT); + yon_window_config_get_parameter("window",yon_char_append(window_name,"PosX"),&X,YON_TYPE_INT); + yon_window_config_get_parameter("window",yon_char_append(window_name,"PosY"),&Y,YON_TYPE_INT); + if (width&&height) + gtk_window_resize(window,width,height); + if (X&&Y) + gtk_window_move(window,X,Y); + } + + void yon_window_config_custom_window_set(GtkWindow *window, char *window_name){ + int height=0; + int width=0; + int X=0; + int Y=0; + gtk_window_get_size(window,&width,&height); + gtk_window_get_position(window,&X,&Y); + yon_window_config_add_instant_parameter(yon_char_append(window_name,"Width"),"window",&width,YON_TYPE_INT); + yon_window_config_add_instant_parameter(yon_char_append(window_name,"Height"),"window",&height,YON_TYPE_INT); + yon_window_config_add_instant_parameter(yon_char_append(window_name,"PosX"),"window",&X,YON_TYPE_INT); + yon_window_config_add_instant_parameter(yon_char_append(window_name,"PosY"),"window",&Y,YON_TYPE_INT); + } + GtkWidget *yon_ubl_menu_item_about_new(char *buttonname){ GtkWidget *menu_item = gtk_menu_item_new(); gtk_style_context_add_class(gtk_widget_get_style_context(menu_item),"menuitembottom"); @@ -2092,6 +2264,30 @@ void yon_ubl_status_highlight_incorrect(GtkWidget *widget){ GThread *thread = g_thread_new(NULL,(GThreadFunc)_yon_ubl_status_highlight_incorrect,widget); } +void _yon_ubl_status_list_store_highlight_incorrect(GtkWidget **widget_pack){ + GtkListStore *list = (GtkListStore*)widget_pack[0]; + GtkTreeIter *iter = (GtkTreeIter*)widget_pack[1]; + GdkRGBA rgba,rgba2; + rgba.alpha=1; + rgba.blue=153.0/255.0; + rgba.green=153.0/255.0; + rgba.red=234.0/255.0; + rgba2.alpha=1; + rgba2.blue=0; + rgba2.green=0; + rgba2.red=0; + gtk_list_store_set(list,iter,1,gdk_rgba_to_string(&rgba2),2,gdk_rgba_to_string(&rgba),-1); + sleep(5); + gtk_list_store_set(list,iter,1,NULL,2,NULL,-1); +} + +void yon_ubl_status_list_store_highlight_incorrect(GtkListStore *list, GtkTreeIter *iter){ + GtkWidget **pack = malloc(sizeof(GtkWidget *)*2); + pack[0]=(GtkWidget*)list; + pack[1]=(GtkWidget*)iter; + GThread *thread = g_thread_new(NULL,(GThreadFunc)_yon_ubl_status_list_store_highlight_incorrect,pack); +} + struct temp_statusbox { int times; GtkWidget *revealer; @@ -2099,7 +2295,7 @@ struct temp_statusbox { void _yon_ubl_status_box_timed_remove(struct temp_statusbox *statusstruct){ sleep(statusstruct->times); - if (statusstruct->revealer){ + if (status_thread_busy){ gtk_revealer_set_reveal_child(GTK_REVEALER(statusstruct->revealer),0); sleep(1); gtk_widget_destroy(statusstruct->revealer); @@ -2108,6 +2304,10 @@ void _yon_ubl_status_box_timed_remove(struct temp_statusbox *statusstruct){ status_thread_busy=0; } +void __yon_ubl_status_box_destroyed(){ + status_thread_busy=0; +} + void yon_ubl_status_box_spawn(GtkContainer *container,char *display_text, int timeout,BACKGROUND_IMAGE_TYPE type){ if (!status_thread_busy){ GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5); @@ -2121,6 +2321,7 @@ void yon_ubl_status_box_spawn(GtkContainer *container,char *display_text, int ti gtk_widget_show_all(revealer); gtk_revealer_set_reveal_child(GTK_REVEALER(revealer),1); + g_signal_connect(G_OBJECT(revealer),"destroy", G_CALLBACK(__yon_ubl_status_box_destroyed),NULL); gtk_widget_set_margin_bottom(label,9); gtk_widget_set_margin_top(label,9); diff --git a/source/ubl-utils.h b/source/ubl-utils.h index d488149..2fef789 100644 --- a/source/ubl-utils.h +++ b/source/ubl-utils.h @@ -15,6 +15,7 @@ #include #include #include +#include #include "../compile/ubl-cmake.h" #ifdef WEBKIT_FOUND @@ -154,6 +155,8 @@ char **yon_char_parsed_rip(char **char_string, int *size, int item_to_delete); int yon_char_parsed_check_exist(char **parameters, int size, char *param); +int yon_char_parsed_check_repeats(char **parameters, int size, int *first_overlap, int *second_overlap); + int yon_char_find_count(char *source, char *find); int yon_char_parsed_includes_char_parsed (config_str source, config_str to_check, int source_size, int check_size); @@ -188,6 +191,10 @@ apps *yon_apps_get_by_name(apps *applist, char *name, int size); config_str yon_file_open(char *file_path, int *size); +int yon_file_create(char *path, char *name, int rules); + +int yon_file_create_full_path(char *path, int rules); + config_str yon_dir_get_contents(char *dir_path, int *size); //config functions @@ -288,6 +295,12 @@ void yon_window_config_erase_custom_parameter(char *param_name, char *section); int yon_window_config_get_parameter(char *section, char *config_parameter, void *return_value, enum YON_TYPE type); +void yon_window_config_custom_window_setup(GtkWindow *window, char *window_name); + +void yon_window_config_custom_window_get(GtkWindow *window, char *window_name); + +void yon_window_config_custom_window_set(GtkWindow *window, char *window_name); + int yon_gtk_combo_box_fill(GtkWidget *combo, char **parameters,int size); int yon_gtk_combo_box_text_find(GtkWidget *combo_box, char *text_to_find); @@ -354,6 +367,8 @@ void yon_ubl_status_box_render(char *text, BACKGROUND_IMAGE_TYPE type); void yon_ubl_status_highlight_incorrect(GtkWidget *widget); +void yon_ubl_status_list_store_highlight_incorrect(GtkListStore *list, GtkTreeIter *iter); + static int status_thread_busy; void yon_ubl_status_box_spawn(GtkContainer *container,char *display_text, int timeout,BACKGROUND_IMAGE_TYPE type); diff --git a/ubl-settings-logging-add.glade b/ubl-settings-logging-add.glade index 27a9496..17d09b7 100644 --- a/ubl-settings-logging-add.glade +++ b/ubl-settings-logging-add.glade @@ -3,6 +3,13 @@ + + + + + + + 1024 1 @@ -28,26 +35,6 @@ False emblem-ok-symbolic - - True - False - com.ublinux.ubl-settings-logging.sort-symbolic - - - True - False - com.ublinux.ubl-settings-logging.sort-symbolic - - - True - False - com.ublinux.ubl-settings-logging.sort-symbolic - - - True - False - com.ublinux.ubl-settings-logging.sort-symbolic - 450 False @@ -57,9 +44,6 @@ False - 5 - 5 - 5 5 vertical 5 @@ -103,29 +87,161 @@ 0 + + + True + False + vertical + + + + + + False + True + 0 + + True False + 5 + 5 vertical 5 - + + True + False + 0.019999999552965164 + in + + + True + False + 5 + 12 + 5 + 5 + + + True + False + 5 + + + True + False + Log size: + 0 + + + False + True + 0 + + + + + True + False + 0.0 Mb + + + True + True + 1 + + + + + + + + + True + False + Statistics + + + + + False + True + end + 0 + + + + True False vertical 5 - + True False + vertical 5 - + True False - Log/Journal: - 0 + 5 + + + True + False + Log/Journal: + 0 + + + False + True + 0 + + + + + True + False + 0 + False + + Log file + + + + True + True + 1 + + + + + True + False + Name: + + + False + True + 2 + + + + + True + True + + + False + True + 3 + + False @@ -134,14 +250,34 @@ - + True - False - 0 - False - - Log file - + True + never + in + 150 + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + + + True + False + vertical + + + + + + + True @@ -150,10 +286,34 @@ - + True False - Name: + 5 + + + True + False + Description: + 0 + + + False + True + 0 + + + + + True + True + + + True + True + 1 + + False @@ -161,80 +321,65 @@ 2 - - - True - True - - - False - True - 3 - - - False + True True 0 + + + True + True + 1 + + + + + True + False + 5 - + True - True - never - in - 150 - - - True - False - 5 - 5 - 5 - 5 - - - True - False - vertical - - - - - - - + False + Control: + 0 - True + False True - 1 + 0 True False - 5 + 19 - + + Logrotate True - False - Description: - 0 + True + True + image5 - False + True True 0 - + + Metalog True + False True + True + image7 True @@ -242,196 +387,67 @@ 1 - - - False - True - 2 - - - - - True - True - 0 - - - - - True - True - 0 - - - - - True - False - 5 - 5 - - - False - True - 1 - - - - - True - False - 5 - - - True - False - Control: - 0 - - - False - True - 0 - - - - - True - False - 19 - - - Logrotate - True - True - True - image5 - - - True - True - 0 - - - - - Metalog - True - False - True - True - image7 - - - True - True - 1 - - - - - Syslog-ng - True - False - True - True - image6 - - - True - True - 2 - - - - - Journald - True - True - True - image8 - - - False - True - 3 - - - - - True - True - 4 - - - - - False - True - 2 - - - - - True - False - 0.019999999552965164 - in - - - True - False - 5 - 12 - 5 - 5 - - - True - False - 5 - + + Syslog-ng True - False - Log size: - 0 + False + True + True + image6 - False + True True - 0 + 2 - + + Journald True - False - 0.0 Mb + True + True + image8 - True + False True - 1 + 3 + + True + True + 4 + + + False + True + 2 + - - + + True False - Statistics + 5 + 5 + + False + True + 3 + False True - end - 4 + 1 @@ -476,11 +492,24 @@ - - - - - - + + True + False + com.ublinux.ubl-settings-logging.sort-symbolic + + + True + False + com.ublinux.ubl-settings-logging.sort-symbolic + + + True + False + com.ublinux.ubl-settings-logging.sort-symbolic + + + True + False + com.ublinux.ubl-settings-logging.sort-symbolic diff --git a/ubl-settings-logging-filechooser.glade b/ubl-settings-logging-filechooser.glade index 28ddce1..3d0a484 100644 --- a/ubl-settings-logging-filechooser.glade +++ b/ubl-settings-logging-filechooser.glade @@ -33,7 +33,6 @@ Choose directory instead of file - True True False True diff --git a/ubl-settings-logging-inspector.glade b/ubl-settings-logging-inspector.glade index f935238..930eb37 100644 --- a/ubl-settings-logging-inspector.glade +++ b/ubl-settings-logging-inspector.glade @@ -2,7 +2,6 @@ - 100 @@ -14,11 +13,6 @@ 1 10 - - 100 - 1 - 10 - True False @@ -59,10 +53,19 @@ False com.ublinux.ubl-settings-logging.generic7-symbolic + + + + + + + + 800 600 False + True 800 600 com.ublinux.ubl-settings-logging @@ -242,16 +245,10 @@ - + True - False - natural - adjustment3 - natural - UTF-8 - 0 - True - False + True + True True @@ -260,14 +257,53 @@ - - True - False - vertical - adjustment3 + + True + in + + + True + True + liststore1 + False + both + 0 + + + fixed + 175 + 75 + column + + + end + + + 0 + + + + + + + column + True + + + word + 500 + + + 1 + + + + + + - False + True True 2 @@ -321,5 +357,4 @@ - diff --git a/ubl-settings-logging-journald.glade b/ubl-settings-logging-journald.glade index c48b5f4..dd6c3a4 100644 --- a/ubl-settings-logging-journald.glade +++ b/ubl-settings-logging-journald.glade @@ -94,6 +94,7 @@ 5 5 vertical + 5 True @@ -963,6 +964,20 @@ False end 5 + + + Reset + True + True + True + image5 + + + False + True + 0 + + Cancel @@ -974,7 +989,7 @@ True True - 0 + 1 @@ -988,7 +1003,7 @@ True True - 1 + 2 @@ -1047,4 +1062,9 @@ + + True + False + com.ublinux.ubl-settings-logging.funnel-symbolic + diff --git a/ubl-settings-logging-logrotate.glade b/ubl-settings-logging-logrotate.glade index 2b13c77..c292f61 100644 --- a/ubl-settings-logging-logrotate.glade +++ b/ubl-settings-logging-logrotate.glade @@ -92,6 +92,10 @@ + + + + @@ -318,12 +322,17 @@ True liststore1 False + + + Path + 2 + 1 0 diff --git a/ubl-settings-logging-rules.glade b/ubl-settings-logging-rules.glade index 3b1f097..4f3633f 100644 --- a/ubl-settings-logging-rules.glade +++ b/ubl-settings-logging-rules.glade @@ -1,7 +1,8 @@ - + + True False diff --git a/ubl-settings-logging-terminal.glade b/ubl-settings-logging-terminal.glade new file mode 100644 index 0000000..c4f33b0 --- /dev/null +++ b/ubl-settings-logging-terminal.glade @@ -0,0 +1,77 @@ + + + + + + + 100 + 1 + 10 + + + True + False + + + True + False + vertical + + + True + True + natural + adjustment3 + natural + off + underline + UTF-8 + True + 0 + True + False + + + True + True + 0 + + + + + False + Label + 0.019999999552965164 + + + + + + + False + True + 1 + + + + + True + True + 0 + + + + + True + False + vertical + adjustment3 + + + False + True + 1 + + + + diff --git a/ubl-settings-logging.glade b/ubl-settings-logging.glade index f254aa1..be7dea7 100644 --- a/ubl-settings-logging.glade +++ b/ubl-settings-logging.glade @@ -473,7 +473,7 @@ translated and supported by community. journald /var/log/journal/ System event log - False + True 0 @@ -508,6 +508,12 @@ translated and supported by community. False False False + + + False + Upgrade permissions to root + + True @@ -719,7 +725,6 @@ translated and supported by community. True - False True True Add log @@ -1043,6 +1048,7 @@ translated and supported by community. True False + 5 True diff --git a/ubl-settings-logging.pot b/ubl-settings-logging.pot index 1601a18..689c007 100644 --- a/ubl-settings-logging.pot +++ b/ubl-settings-logging.pot @@ -413,304 +413,356 @@ msgstr "" msgid "Years" msgstr "" -#: source/ubl-strings.h:106 -msgid "Log/Journal:" +#: source/ubl-strings.h:104 +msgid "Reset" msgstr "" #: source/ubl-strings.h:107 -msgid "Paths to log and journals files" +msgid "Log/Journal:" msgstr "" #: source/ubl-strings.h:108 -msgid "On" +msgid "Paths to log and journals files" msgstr "" #: source/ubl-strings.h:109 +msgid "On" +msgstr "" + +#: source/ubl-strings.h:110 msgid "Off" msgstr "" -#: source/ubl-strings.h:110 source/ubl-strings.h:164 +#: source/ubl-strings.h:111 source/ubl-strings.h:165 msgid "Scenarios" msgstr "" -#: source/ubl-strings.h:111 source/ubl-strings.h:163 +#: source/ubl-strings.h:112 source/ubl-strings.h:164 msgid "Scenarios are running for each rotated journal" msgstr "" -#: source/ubl-strings.h:112 +#: source/ubl-strings.h:113 msgid "Command before rotation (one time):" msgstr "" -#: source/ubl-strings.h:113 +#: source/ubl-strings.h:114 msgid "Command after rotation (one time):" msgstr "" -#: source/ubl-strings.h:114 +#: source/ubl-strings.h:115 msgid "Command before rotation:" msgstr "" -#: source/ubl-strings.h:115 +#: source/ubl-strings.h:116 msgid "Command after rotation:" msgstr "" -#: source/ubl-strings.h:116 +#: source/ubl-strings.h:117 msgid "Rotation period:" msgstr "" -#: source/ubl-strings.h:117 +#: source/ubl-strings.h:118 msgid "Maximum size of file:" msgstr "" -#: source/ubl-strings.h:118 +#: source/ubl-strings.h:119 msgid "Checking frequency configuration" msgstr "" -#: source/ubl-strings.h:119 +#: source/ubl-strings.h:120 msgid "File amount:" msgstr "" -#: source/ubl-strings.h:120 +#: source/ubl-strings.h:121 msgid "Store at:" msgstr "" -#: source/ubl-strings.h:121 +#: source/ubl-strings.h:122 msgid "Rotation as user:" msgstr "" -#: source/ubl-strings.h:122 +#: source/ubl-strings.h:123 msgid "Rotation as group:" msgstr "" -#: source/ubl-strings.h:123 +#: source/ubl-strings.h:124 msgid "Rotation configuration" msgstr "" -#: source/ubl-strings.h:124 +#: source/ubl-strings.h:125 msgid "Error processing:" msgstr "" -#: source/ubl-strings.h:125 +#: source/ubl-strings.h:126 msgid "Rotation of jurnal even when it is empty:" msgstr "" -#: source/ubl-strings.h:126 +#: source/ubl-strings.h:127 msgid "Do not rotate journal younger than" msgstr "" -#: source/ubl-strings.h:127 +#: source/ubl-strings.h:128 msgid "days" msgstr "" -#: source/ubl-strings.h:128 +#: source/ubl-strings.h:129 msgid "Delete rotated journals older than" msgstr "" -#: source/ubl-strings.h:129 +#: source/ubl-strings.h:130 msgid "Rotate journals if size more than" msgstr "" -#: source/ubl-strings.h:130 +#: source/ubl-strings.h:131 msgid "but not earlier than the specified time interval" msgstr "" -#: source/ubl-strings.h:131 +#: source/ubl-strings.h:132 msgid "before specified time interval" msgstr "" -#: source/ubl-strings.h:132 +#: source/ubl-strings.h:133 msgid "File choosing configuration" msgstr "" -#: source/ubl-strings.h:133 +#: source/ubl-strings.h:134 msgid "Create log" msgstr "" -#: source/ubl-strings.h:134 +#: source/ubl-strings.h:135 msgid "as user:" msgstr "" -#: source/ubl-strings.h:135 +#: source/ubl-strings.h:136 msgid "as group:" msgstr "" -#: source/ubl-strings.h:136 +#: source/ubl-strings.h:137 msgid "rules:" msgstr "" -#: source/ubl-strings.h:137 +#: source/ubl-strings.h:138 msgid "" "Cut source journal fileafter copy creating instead of moving old journal " "file and creating new one" msgstr "" -#: source/ubl-strings.h:138 +#: source/ubl-strings.h:139 msgid "Files and directories configuration" msgstr "" -#: source/ubl-strings.h:139 +#: source/ubl-strings.h:140 msgid "Delay compression by one journal in queue:" msgstr "" -#: source/ubl-strings.h:140 +#: source/ubl-strings.h:141 msgid "Compression configuration" msgstr "" -#: source/ubl-strings.h:141 +#: source/ubl-strings.h:142 msgid "Save original log file after rotation if it has specified extension:" msgstr "" -#: source/ubl-strings.h:142 +#: source/ubl-strings.h:143 msgid "Add date of rotation before log header" msgstr "" -#: source/ubl-strings.h:143 +#: source/ubl-strings.h:144 msgid "Number from which numbering of old logs will begin" msgstr "" -#: source/ubl-strings.h:144 +#: source/ubl-strings.h:145 msgid "Filename configuration" msgstr "" -#: source/ubl-strings.h:145 +#: source/ubl-strings.h:146 msgid "Email after rotation:" msgstr "" -#: source/ubl-strings.h:146 +#: source/ubl-strings.h:147 msgid "adress:" msgstr "" -#: source/ubl-strings.h:147 +#: source/ubl-strings.h:148 msgid "contents:" msgstr "" -#: source/ubl-strings.h:148 source/ubl-strings.h:161 +#: source/ubl-strings.h:149 source/ubl-strings.h:162 msgid "Message configuration" msgstr "" -#: source/ubl-strings.h:149 +#: source/ubl-strings.h:150 msgid "Manual input:" msgstr "" -#: source/ubl-strings.h:150 +#: source/ubl-strings.h:151 msgid "Log (-s) size:" msgstr "" -#: source/ubl-strings.h:151 +#: source/ubl-strings.h:152 msgid "Same directory" msgstr "" -#: source/ubl-strings.h:152 +#: source/ubl-strings.h:153 msgid "Separate directory" msgstr "" -#: source/ubl-strings.h:153 +#: source/ubl-strings.h:154 msgid "Output errors if log file does not exist*" msgstr "" -#: source/ubl-strings.h:154 +#: source/ubl-strings.h:155 msgid "Do not output errors if log file does not exist" msgstr "" -#: source/ubl-strings.h:155 +#: source/ubl-strings.h:156 msgid "Do not output" msgstr "" -#: source/ubl-strings.h:156 +#: source/ubl-strings.h:157 msgid "Output errors" msgstr "" -#: source/ubl-strings.h:157 +#: source/ubl-strings.h:158 msgid "Send Email" msgstr "" -#: source/ubl-strings.h:158 +#: source/ubl-strings.h:159 msgid "Don't send Email" msgstr "" -#: source/ubl-strings.h:159 +#: source/ubl-strings.h:160 msgid "First rotated copy" msgstr "" -#: source/ubl-strings.h:160 +#: source/ubl-strings.h:161 msgid "Last rotated copy" msgstr "" -#: source/ubl-strings.h:162 +#: source/ubl-strings.h:163 msgid "Endwork command:" msgstr "" -#: source/ubl-strings.h:165 +#: source/ubl-strings.h:166 msgid "Hourly" msgstr "" -#: source/ubl-strings.h:166 +#: source/ubl-strings.h:167 msgid "Daily" msgstr "" -#: source/ubl-strings.h:167 +#: source/ubl-strings.h:168 msgid "Weekly*" msgstr "" -#: source/ubl-strings.h:168 +#: source/ubl-strings.h:169 msgid "Monthly" msgstr "" -#: source/ubl-strings.h:169 +#: source/ubl-strings.h:170 msgid "Yearly" msgstr "" -#: source/ubl-strings.h:170 +#: source/ubl-strings.h:171 msgid "Monday" msgstr "" -#: source/ubl-strings.h:171 +#: source/ubl-strings.h:172 msgid "Tuesday" msgstr "" -#: source/ubl-strings.h:172 +#: source/ubl-strings.h:173 msgid "Wednesday" msgstr "" -#: source/ubl-strings.h:173 +#: source/ubl-strings.h:174 msgid "Thursday" msgstr "" -#: source/ubl-strings.h:174 +#: source/ubl-strings.h:175 msgid "Friday" msgstr "" -#: source/ubl-strings.h:175 +#: source/ubl-strings.h:176 msgid "Saturday" msgstr "" -#: source/ubl-strings.h:176 +#: source/ubl-strings.h:177 msgid "Sunday*" msgstr "" +#: source/ubl-strings.h:178 +msgid "Same record already exists" +msgstr "" + #: source/ubl-strings.h:179 -msgid "System configuration" +msgid "Empty important field" msgstr "" #: source/ubl-strings.h:180 +msgid "Repeating paths" +msgstr "" + +#: source/ubl-strings.h:181 +msgid "Write down all important fields" +msgstr "" + +#: source/ubl-strings.h:184 +msgid "System configuration" +msgstr "" + +#: source/ubl-strings.h:185 msgid "Applications configuration" msgstr "" -#: source/ubl-strings.h:183 +#: source/ubl-strings.h:188 msgid "Path (-s):" msgstr "" -#: source/ubl-strings.h:184 +#: source/ubl-strings.h:189 msgid "Control:" msgstr "" -#: source/ubl-strings.h:185 +#: source/ubl-strings.h:190 msgid "Log file" msgstr "" -#: source/ubl-strings.h:186 +#: source/ubl-strings.h:191 msgid "Name:" msgstr "" +#: source/ubl-strings.h:194 +msgid "Owner rules" +msgstr "" + +#: source/ubl-strings.h:195 +msgid "Group rules" +msgstr "" + +#: source/ubl-strings.h:196 +msgid "Public rules" +msgstr "" + +#: source/ubl-strings.h:197 +msgid "Read" +msgstr "" + +#: source/ubl-strings.h:198 +msgid "Write" +msgstr "" + +#: source/ubl-strings.h:199 +msgid "Execute" +msgstr "" + +#: source/ubl-strings.h:200 +msgid "Value:" +msgstr "" + +#: source/ubl-strings.h:203 +msgid ": no such file(s)" +msgstr "" + msgid "System event log rotation service" msgstr "" diff --git a/ubl-settings-logging_ru.po b/ubl-settings-logging_ru.po index a6d2aa8..908cb52 100644 --- a/ubl-settings-logging_ru.po +++ b/ubl-settings-logging_ru.po @@ -423,131 +423,135 @@ msgstr "Недель" msgid "Years" msgstr "Лет" -#: source/ubl-strings.h:106 +#: source/ubl-strings.h:104 +msgid "Reset" +msgstr "По умлочанию" + +#: source/ubl-strings.h:107 msgid "Log/Journal:" msgstr "Лог/Журнал:" -#: source/ubl-strings.h:107 +#: source/ubl-strings.h:108 msgid "Paths to log and journals files" msgstr "Пути к файлам лога/журнала" -#: source/ubl-strings.h:108 +#: source/ubl-strings.h:109 msgid "On" msgstr "Включено" -#: source/ubl-strings.h:109 +#: source/ubl-strings.h:110 msgid "Off" msgstr "Выключено" -#: source/ubl-strings.h:110 source/ubl-strings.h:164 +#: source/ubl-strings.h:111 source/ubl-strings.h:165 msgid "Scenarios" msgstr "Сценарии" -#: source/ubl-strings.h:111 source/ubl-strings.h:163 +#: source/ubl-strings.h:112 source/ubl-strings.h:164 msgid "Scenarios are running for each rotated journal" msgstr "Сценарии запускаются для каждого ротируемого журнала" -#: source/ubl-strings.h:112 +#: source/ubl-strings.h:113 msgid "Command before rotation (one time):" msgstr "Команда перед ротацией (один раз):" -#: source/ubl-strings.h:113 +#: source/ubl-strings.h:114 msgid "Command after rotation (one time):" msgstr "Команда после ротации (один раз):" -#: source/ubl-strings.h:114 +#: source/ubl-strings.h:115 msgid "Command before rotation:" msgstr "Команда перед ротацией:" -#: source/ubl-strings.h:115 +#: source/ubl-strings.h:116 msgid "Command after rotation:" msgstr "Команда после ротации:" -#: source/ubl-strings.h:116 +#: source/ubl-strings.h:117 msgid "Rotation period:" msgstr "Период ротации:" -#: source/ubl-strings.h:117 +#: source/ubl-strings.h:118 msgid "Maximum size of file:" msgstr "Максимальный размер файла:" -#: source/ubl-strings.h:118 +#: source/ubl-strings.h:119 msgid "Checking frequency configuration" msgstr "Настройки частоты проверки" -#: source/ubl-strings.h:119 +#: source/ubl-strings.h:120 msgid "File amount:" msgstr "Количество файлов:" -#: source/ubl-strings.h:120 +#: source/ubl-strings.h:121 msgid "Store at:" msgstr "Хранить в:" -#: source/ubl-strings.h:121 +#: source/ubl-strings.h:122 msgid "Rotation as user:" msgstr "Ротация от пользователя:" -#: source/ubl-strings.h:122 +#: source/ubl-strings.h:123 msgid "Rotation as group:" msgstr "Ротация от группы:" -#: source/ubl-strings.h:123 +#: source/ubl-strings.h:124 msgid "Rotation configuration" msgstr "Настройки ротации" -#: source/ubl-strings.h:124 +#: source/ubl-strings.h:125 msgid "Error processing:" msgstr "Обработка ошибок:" -#: source/ubl-strings.h:125 +#: source/ubl-strings.h:126 msgid "Rotation of jurnal even when it is empty:" msgstr "Ротация файла журнала даже если он пуст:" -#: source/ubl-strings.h:126 +#: source/ubl-strings.h:127 msgid "Do not rotate journal younger than" msgstr "Не ротировать журналы, возраст которых меньше" -#: source/ubl-strings.h:127 +#: source/ubl-strings.h:128 msgid "days" msgstr "дней" -#: source/ubl-strings.h:128 +#: source/ubl-strings.h:129 msgid "Delete rotated journals older than" msgstr "Удалить ротированные журналы старше" -#: source/ubl-strings.h:129 +#: source/ubl-strings.h:130 msgid "Rotate journals if size more than" msgstr "Ротация журналов, если размер превышает" -#: source/ubl-strings.h:130 +#: source/ubl-strings.h:131 msgid "but not earlier than the specified time interval" msgstr "но не раньше указанного интервала времени" -#: source/ubl-strings.h:131 +#: source/ubl-strings.h:132 msgid "before specified time interval" msgstr "до истечения указанного интервала времени" -#: source/ubl-strings.h:132 +#: source/ubl-strings.h:133 msgid "File choosing configuration" msgstr "Настройки выбора файла" -#: source/ubl-strings.h:133 +#: source/ubl-strings.h:134 msgid "Create log" msgstr "Создавать лог" -#: source/ubl-strings.h:134 +#: source/ubl-strings.h:135 msgid "as user:" msgstr "от пользователя:" -#: source/ubl-strings.h:135 +#: source/ubl-strings.h:136 msgid "as group:" msgstr "от группы:" -#: source/ubl-strings.h:136 +#: source/ubl-strings.h:137 msgid "rules:" msgstr "права:" -#: source/ubl-strings.h:137 +#: source/ubl-strings.h:138 msgid "" "Cut source journal fileafter copy creating instead of moving old journal " "file and creating new one" @@ -555,176 +559,225 @@ msgstr "" "После создания копии, обрезать исходный файл журнала взамен перемещения " "старого файла журнала и создания нового" -#: source/ubl-strings.h:138 +#: source/ubl-strings.h:139 msgid "Files and directories configuration" msgstr "Настройки файлов и папок" -#: source/ubl-strings.h:139 +#: source/ubl-strings.h:140 msgid "Delay compression by one journal in queue:" msgstr "Отложить сжание на один журнал в очереди:" -#: source/ubl-strings.h:140 +#: source/ubl-strings.h:141 msgid "Compression configuration" msgstr "Настройка сжатия" -#: source/ubl-strings.h:141 +#: source/ubl-strings.h:142 msgid "Save original log file after rotation if it has specified extension:" msgstr "" "Сохранять оригинальный лог после ротации, если у него указано расширение:" -#: source/ubl-strings.h:142 +#: source/ubl-strings.h:143 msgid "Add date of rotation before log header" msgstr "Добавлять дату ротации перед заголовком старого лога:" -#: source/ubl-strings.h:143 +#: source/ubl-strings.h:144 msgid "Number from which numbering of old logs will begin" msgstr "Номер, с которого будет начата нумерация старых логов:" -#: source/ubl-strings.h:144 +#: source/ubl-strings.h:145 msgid "Filename configuration" msgstr "Настройка имени файлов" -#: source/ubl-strings.h:145 +#: source/ubl-strings.h:146 msgid "Email after rotation:" msgstr "Отправка Email после ротации:" -#: source/ubl-strings.h:146 +#: source/ubl-strings.h:147 msgid "adress:" msgstr "на адрес:" -#: source/ubl-strings.h:147 +#: source/ubl-strings.h:148 msgid "contents:" msgstr "содержимое:" -#: source/ubl-strings.h:148 source/ubl-strings.h:161 +#: source/ubl-strings.h:149 source/ubl-strings.h:162 msgid "Message configuration" msgstr "Настройка сообщения" -#: source/ubl-strings.h:149 +#: source/ubl-strings.h:150 msgid "Manual input:" msgstr "Команды настройки" -#: source/ubl-strings.h:150 +#: source/ubl-strings.h:151 msgid "Log (-s) size:" msgstr "Общий размер лога (-ов):" -#: source/ubl-strings.h:151 +#: source/ubl-strings.h:152 msgid "Same directory" msgstr "Той же папке" -#: source/ubl-strings.h:152 +#: source/ubl-strings.h:153 msgid "Separate directory" msgstr "Другой папке" -#: source/ubl-strings.h:153 +#: source/ubl-strings.h:154 msgid "Output errors if log file does not exist*" msgstr "Выводить ошибки, если лог файла не существует*" -#: source/ubl-strings.h:154 +#: source/ubl-strings.h:155 msgid "Do not output errors if log file does not exist" msgstr "Не выводить ошибки, если лог файла не существует" -#: source/ubl-strings.h:155 +#: source/ubl-strings.h:156 msgid "Do not output" msgstr "Не выводить" -#: source/ubl-strings.h:156 +#: source/ubl-strings.h:157 msgid "Output errors" msgstr "Выводить ошибки" -#: source/ubl-strings.h:157 +#: source/ubl-strings.h:158 msgid "Send Email" msgstr "Отправлять Email" -#: source/ubl-strings.h:158 +#: source/ubl-strings.h:159 msgid "Don't send Email" msgstr "Не отправлять Email" -#: source/ubl-strings.h:159 +#: source/ubl-strings.h:160 msgid "First rotated copy" msgstr "Первая ротированная копия" -#: source/ubl-strings.h:160 +#: source/ubl-strings.h:161 msgid "Last rotated copy" msgstr "Последняя ротированная копия" -#: source/ubl-strings.h:162 +#: source/ubl-strings.h:163 msgid "Endwork command:" msgstr "Команда перед удалением файла журнала:" -#: source/ubl-strings.h:165 +#: source/ubl-strings.h:166 #, fuzzy msgid "Hourly" msgstr "Час" -#: source/ubl-strings.h:166 +#: source/ubl-strings.h:167 msgid "Daily" msgstr "День" -#: source/ubl-strings.h:167 +#: source/ubl-strings.h:168 msgid "Weekly*" msgstr "Неделя*" -#: source/ubl-strings.h:168 +#: source/ubl-strings.h:169 msgid "Monthly" msgstr "Месяц" -#: source/ubl-strings.h:169 +#: source/ubl-strings.h:170 msgid "Yearly" msgstr "Год" -#: source/ubl-strings.h:170 +#: source/ubl-strings.h:171 msgid "Monday" msgstr "Понедельник" -#: source/ubl-strings.h:171 +#: source/ubl-strings.h:172 msgid "Tuesday" msgstr "Вторник" -#: source/ubl-strings.h:172 +#: source/ubl-strings.h:173 msgid "Wednesday" msgstr "Среда" -#: source/ubl-strings.h:173 +#: source/ubl-strings.h:174 msgid "Thursday" msgstr "Четверг" -#: source/ubl-strings.h:174 +#: source/ubl-strings.h:175 msgid "Friday" msgstr "Пятница" -#: source/ubl-strings.h:175 +#: source/ubl-strings.h:176 msgid "Saturday" msgstr "Суббота" -#: source/ubl-strings.h:176 +#: source/ubl-strings.h:177 msgid "Sunday*" msgstr "Воскресенье*" +#: source/ubl-strings.h:178 +msgid "Same record already exists" +msgstr "Такая запись уже существует" + #: source/ubl-strings.h:179 +msgid "Empty important field" +msgstr "Важное поле не заполнено" + +#: source/ubl-strings.h:180 +msgid "Repeating paths" +msgstr "Повторяющиеся пути" + +#: source/ubl-strings.h:181 +#, fuzzy +msgid "Write down all important fields" +msgstr "Введите все необходимые поля" + +#: source/ubl-strings.h:184 msgid "System configuration" msgstr "Настройки системы" -#: source/ubl-strings.h:180 +#: source/ubl-strings.h:185 msgid "Applications configuration" msgstr "Настройки приложений" -#: source/ubl-strings.h:183 +#: source/ubl-strings.h:188 msgid "Path (-s):" msgstr "Путь (-и):" -#: source/ubl-strings.h:184 +#: source/ubl-strings.h:189 msgid "Control:" msgstr "Управление:" -#: source/ubl-strings.h:185 +#: source/ubl-strings.h:190 msgid "Log file" msgstr "Файл лога" -#: source/ubl-strings.h:186 +#: source/ubl-strings.h:191 msgid "Name:" msgstr "Имя:" +#: source/ubl-strings.h:194 +msgid "Owner rules" +msgstr "Правила владельца" + +#: source/ubl-strings.h:195 +msgid "Group rules" +msgstr "Правила группы" + +#: source/ubl-strings.h:196 +msgid "Public rules" +msgstr "Правила остальных" + +#: source/ubl-strings.h:197 +msgid "Read" +msgstr "Чтение" + +#: source/ubl-strings.h:198 +msgid "Write" +msgstr "Запись" + +#: source/ubl-strings.h:199 +msgid "Execute" +msgstr "Исполнение" + +#: source/ubl-strings.h:200 +msgid "Value:" +msgstr "Значение:" + +#: source/ubl-strings.h:203 +msgid ": no such file(s)" +msgstr ": файл(ы) не найден(ы)" + msgid "System event log rotation service" msgstr "Служба ротации системных журналов событий"