diff --git a/Makefile b/Makefile index 1306447..f4c8cb4 100644 --- a/Makefile +++ b/Makefile @@ -140,6 +140,7 @@ install: check uninstall @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}.reset-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" diff --git a/gresource.xml b/gresource.xml index 557ead6..23b9b6a 100644 --- a/gresource.xml +++ b/gresource.xml @@ -11,6 +11,7 @@ ubl-settings-logging-filechooser.glade ubl-settings-logging-logrotate-table.glade ubl-settings-logging-terminal.glade + ubl-settings-logging-saving.glade ubl-settings-logging.css diff --git a/icons/com.ublinux.ubl-settings-logging.reset-symbolic.svg b/icons/com.ublinux.ubl-settings-logging.reset-symbolic.svg new file mode 100644 index 0000000..e6b0263 --- /dev/null +++ b/icons/com.ublinux.ubl-settings-logging.reset-symbolic.svg @@ -0,0 +1,39 @@ + + + + + + + diff --git a/journals_list.csv b/journals_list.csv index 37454f0..727115a 100644 --- a/journals_list.csv +++ b/journals_list.csv @@ -1,13 +1,13 @@ Service_Name;Path_Log;Service_Description Acpid;/var/log/acpid;Log of work and requests to Acpid -Apache2;/var/log/apache2/error.log,/var/log/apache2/access.log;Log of work and requests to the web server +Apache2;/var/log/apache2/*.log;Log of work and requests to the web server Audit;/var/log/audit/audit.log;Audit log Authlog;/var/log/auth.log;Log of authorization procedures Cron;/var/log/syslog;Job scheduler log (cron) -CUPS;/var/log/cups/access_log,/var/log/cups/page_log,/var/log/cups/cups-pdf_log;Log of work and calls to the print server (cups) +CUPS;/var/log/cups/*;Log of work and calls to the print server (cups) Daemonlog;/var/log/daemon.log;Log of operation and access to system services -Samba;/var/log/samba/log.smbd,/var/log/samba/log.localhost,/var/log/samba/log.127.0.0.1,/var/log/samba/log.nmbd;Log of work and access to Samba -Postfix;/var/log/mail.log,/var/log/mail.info,/var/log/mail.warn,/var/log/mail.err;Postfix mail server log +Samba;/var/log/samba/*;Log of work and access to Samba +Postfix;/var/log/mail.*;Postfix mail server log Syslog;/var/log/syslog;System log -Xorg;/var/log/Xorg.0.log;X.org display server log +Xorg;/var/log/Xorg.*.log;X.org display server log Xsession;~/.xsession-errors;Graphics X session log \ No newline at end of file diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index c09ec59..0f52e90 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -50,6 +50,7 @@ set(DEPENDFILES ../ubl-settings-logging-logrotate-table.glade ../ubl-settings-logging-filechooser.glade ../ubl-settings-logging-terminal.glade + ../ubl-settings-logging-saving.glade ../gresource.xml ../ubl-settings-logging-banner.png ../ubl-settings-logging.css diff --git a/source/ubl-settings-logging.c b/source/ubl-settings-logging.c index 8dc83f3..6ec2246 100644 --- a/source/ubl-settings-logging.c +++ b/source/ubl-settings-logging.c @@ -26,6 +26,207 @@ void yon_open_browser(GtkWidget *self, char *link){ yon_ubl_browser_window_open(link,TITLE_LABEL); } +void on_save_window_parameter_switched(GtkCellRendererToggle *self, gchar *path, saving_window *window){ + GtkTreeIter iter; + if (gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(window->list),&iter,path)){ + gboolean is_active; + gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,0,&is_active,-1); + gtk_list_store_set(window->list,&iter,0,!is_active,-1); + } + +} + +void on_save_parameters(GtkWidget *self, saving_window *window){ + char *append_command = yon_char_unite("ubconfig --target ",main_config.load_mode==1?"global":"system"," set ",NULL); + char *remove_command = yon_char_unite("ubconfig --target ",main_config.load_mode==1?"global":"system"," remove ",NULL); + dictionary *final_append=NULL; + dictionary *final_remove=NULL; + GtkTreeIter iter; + int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&iter); + for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(window->list),&iter)){ + gboolean is_active,can_save; + char *parameter,*old_value,*new_value,*section; + gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,0,&is_active,1,¶meter,2,&old_value,3,&new_value,5,&can_save,6,§ion,-1); + if (is_active&&can_save){ + if(!yon_char_is_empty(parameter)){ + if (yon_char_is_empty(new_value)){ // empty new value - delete + if (yon_dictionary_get(&final_remove,section)){ + final_remove->data = yon_char_unite((char*)final_remove->data," ",parameter,NULL); + } else { + yon_dictionary_add_or_create_if_exists_with_data(final_remove,section, parameter); + } + } else { // non-empty new value - add + if (yon_dictionary_get(&final_append,section)){ + final_append->data=yon_char_unite((char*)final_append->data," ",yon_char_unite(parameter,"=\"",new_value,"\"",NULL),NULL); + } else { + yon_dictionary_add_or_create_if_exists_with_data(final_append,section, yon_char_unite(parameter,"=\"",new_value,"\"",NULL)); + } + } + } + } + } + dictionary *dict = NULL; + if (final_remove){ + for_dictionaries(dict,final_remove){ + char *final_command = yon_char_unite(remove_command," ",dict->key," ",(char*)dict->data,NULL); + system(final_command); + free(final_command); + } + } + if (final_append){ + for_dictionaries(dict,final_append){ + char *final_command = yon_char_unite(append_command," ",dict->key," ",(char*)dict->data,NULL); + system(final_command); + free(final_command); + } + } + on_close_subwindow(self,"SavingWindow"); +} + +saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){ + if (((type==YON_CONFIG_LOCAL&& main_config.load_mode==1)||(type==YON_CONFIG_GLOBAL&& main_config.load_mode==0))){ + yon_config_save_registered(path); + return NULL; + } else { + char *config_to_save = NULL; + if (type==YON_CONFIG_GLOBAL) config_to_save="global"; + else if (type==YON_CONFIG_LOCAL) config_to_save="system"; + else if (type==YON_CONFIG_BOTH) { + if (main_config.load_mode==1){ + config_to_save="global"; + yon_config_save_registered("system"); + } else if (main_config.load_mode==0){ + config_to_save="system"; + yon_config_save_registered("global"); + } + } + config_str config_compare=NULL; + int compare_size=0; + va_list args; + va_start(args,type); + char *cur_section = NULL; + dictionary *section_commands=NULL; + while ((cur_section=va_arg(args,char*))){ + char *cur_parameter = va_arg(args,char*); + yon_dictionary_add_or_create_if_exists_with_data(section_commands,cur_section,cur_parameter); + } + struct loaded_config { + dictionary *dict; + char *section; + }; + + struct loaded_config loaded; + loaded.dict = yon_dictionary_new(); + dictionary *dct; + for_dictionaries(dct,section_commands){ + char *command = yon_char_unite(ubconfig_load_command," ", config_to_save," get ", dct->key," ", yon_dictionary_get_data(dct,char*),NULL); + FILE *output = popen(command, "r"); + char **output_strings = NULL; + output_strings = malloc(sizeof(char*)); + int i = 0; + char str[4096]; + memset(str, 0, 4096); + while (fgets(str, 4096, output)) + { + if (!yon_char_is_empty(str)&& strcmp(str,"(null)\n")!=0) + { + char *final_str = yon_char_new(str); + char *key =yon_char_divide_search(final_str,"=",-1); + if (final_str[strlen(final_str)-1]=='\n')final_str[strlen(final_str)-1]='\0'; + yon_dictionary_add_or_create_if_exists_with_data(loaded.dict,NULL,yon_char_new(dct->key)); + yon_dictionary_add_or_create_if_exists_with_data(loaded.dict,key,yon_char_new(final_str)); + yon_char_parsed_add_or_create_if_exists(config_compare,&compare_size,yon_char_new(str)); + } + } + } + GtkBuilder *builder = gtk_builder_new_from_resource(glade_saving_path); + saving_window *window = malloc(sizeof(saving_window)); + window->Window = yon_gtk_builder_get_widget(builder,"Window"); + window->HeaderImage = yon_gtk_builder_get_widget(builder,"HeaderImage"); + window->HeaderTopic = yon_gtk_builder_get_widget(builder,"HeaderTopic"); + window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox"); + window->ParametersTree = yon_gtk_builder_get_widget(builder,"ParametersTree"); + window->SaveButton = yon_gtk_builder_get_widget(builder,"SaveButton"); + window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton"); + window->ToggleCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"ToggleCell")); + window->list = GTK_LIST_STORE(gtk_builder_get_object(builder,"liststore1")); + window->type=type; + gtk_window_set_title(GTK_WINDOW(window->Window),TITLE_LABEL); + 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_save_parameters),window); + g_signal_connect(G_OBJECT(window->ToggleCell),"toggled", G_CALLBACK(on_save_window_parameter_switched),window); + int config_size=0; + config_str config_strings = yon_config_get_all(&config_size); + if (config_strings){ + GtkTreeIter iter; + gtk_tree_view_set_model(GTK_TREE_VIEW(window->ParametersTree),NULL); + config_str compare_keys = NULL; + compare_keys = yon_char_parsed_copy(config_compare,compare_size); + int compare_keys_size=compare_size; + yon_char_parsed_divide_search_full(compare_keys,compare_keys_size,"=",-1); + int config_keys_size=0; + config_str config_keys = yon_config_get_all_keys(&config_keys_size); + int final_size=0; + GdkRGBA rgba; + rgba.alpha=0.8; + rgba.red=1; + rgba.blue=0.3; + rgba.green=0.65; + char *rgba_string = gdk_rgba_to_string(&rgba); + for (int i=0;ilist,&iter); + gtk_list_store_set(window->list,&iter,0,1,1,compare_keys[i],5,1,-1); + for (int j=0;jfirst,compare_keys[i])->prev->data; + gtk_list_store_set(window->list,&iter,2,compare_value,4,rgba_string,6,cur_section,-1); + } + free(compare_value); + free(compare_name); + } + + } + char *name,*value; + for (int i=0;ilist),&iter); + for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(window->list),&iter)){ + gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,1,&name,2,&value,-1); + if (!yon_char_is_empty(name)&&!strcmp(name,config_keys[i])){ + gtk_list_store_set(window->list,&iter,3,compare_value,4,NULL,6,section,-1); + if (!strcmp(value,compare_value)){ + gtk_list_store_set(window->list,&iter,0,0,5,0,-1); + } + found=1; + break; + } + } + if (!found){ + GtkTreeIter itar; + gtk_list_store_append(window->list,&itar); + gtk_list_store_set(window->list,&itar,0,1,1,compare_name,3,compare_value,5,1,6,section,-1); + } + free(compare_value); + free(compare_name); + } + free(rgba_string); + + gtk_tree_view_set_model(GTK_TREE_VIEW(window->ParametersTree),GTK_TREE_MODEL(window->list)); + } + + gtk_widget_show(window->Window); + return window; + + } + +} + /**on_open_documentation_confirmation(GtkWidget *self, char *link) * [EN] * Opens confirmation window for [link] link. @@ -145,12 +346,10 @@ void yon_logs_custom_save(main_window *widgets){ 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<5){ + gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(window->JournaldTree),0),1); + gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(window->JournaldTree),1),1); + gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(window->JournaldTree),2),1); 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); + log=strstr(log,":"); + if (log){ + log++; + log=strstr(log,":"); + } + if (log){ + log++; + log=strstr(log,":"); + } + if (log) + log++; + + if (log&&strcmp(log," ")){ + char *iden = yon_char_new(identifier); + identifier=yon_char_divide(iden,strlen(identifier)-(strlen(log)-1)); + free(iden); + } else continue; + + } else if (window->last_mode>=5){ + gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(window->JournaldTree),0),0); + gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(window->JournaldTree),1),0); + gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(window->JournaldTree),2),0); + gtk_list_store_set(window->list,&iter,3,log,-1); + continue; + } + if (!yon_char_is_empty(identifier)){ + int size; + config_str meta_data = yon_char_parse(identifier,&size," "); + if (meta_data){ + char *user = meta_data[3]; + char *process = meta_data[4]; + char *data = yon_char_unite(meta_data[0]," ",meta_data[1]," ",meta_data[2],NULL); + if(process[strlen(process)-1]==':') process[strlen(process)-1]='\0'; + + gtk_list_store_set(window->list,&iter,0,data,1,user, 2, process, 3,log,4,identifier,-1); + yon_char_parsed_free(meta_data,size); + } } - gtk_list_store_set(window->list,&iter,0,identifier,1,log,-1); free(temp); } } @@ -312,29 +549,63 @@ void on_inspector_update(GtkWidget *self, inspector_window *window){ GtkTextIter titer,titerend; config_str output; if (!strcmp(window->journal_name,"journald")){ + if(self!=window->UpdateButton){ + gtk_style_context_remove_class(gtk_widget_get_style_context(window->ShowKernelButton),"chosenOutline"); + gtk_style_context_remove_class(gtk_widget_get_style_context(window->NewMessagesButton),"chosenOutline"); + gtk_style_context_remove_class(gtk_widget_get_style_context(window->ShowAllBootsButton),"chosenOutline"); + gtk_style_context_remove_class(gtk_widget_get_style_context(window->ShowAllUnitsButton),"chosenOutline"); + gtk_style_context_remove_class(gtk_widget_get_style_context(window->ShowInitTreeButton),"chosenOutline"); + gtk_style_context_remove_class(gtk_widget_get_style_context(window->ShowPriorityButton),"chosenOutline"); + gtk_style_context_remove_class(gtk_widget_get_style_context(window->ShowSinceBootButton),"chosenOutline"); + gtk_widget_set_sensitive(window->ShowKernelButton,1); + gtk_widget_set_sensitive(window->NewMessagesButton,1); + gtk_widget_set_sensitive(window->ShowAllBootsButton,1); + gtk_widget_set_sensitive(window->ShowAllUnitsButton,1); + gtk_widget_set_sensitive(window->ShowInitTreeButton,1); + gtk_widget_set_sensitive(window->ShowPriorityButton,1); + gtk_widget_set_sensitive(window->ShowSinceBootButton,1); + } 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; + gtk_style_context_add_class(gtk_widget_get_style_context(window->ShowSinceBootButton),"chosenOutline"); + gtk_widget_set_sensitive(window->ShowSinceBootButton,0); } else if (self==window->NewMessagesButton){ window->last_mode=2; + gtk_style_context_add_class(gtk_widget_get_style_context(window->NewMessagesButton),"chosenOutline"); + gtk_widget_set_sensitive(window->NewMessagesButton,0); } else if (self==window->ShowKernelButton){ window->last_mode=3; + gtk_style_context_add_class(gtk_widget_get_style_context(window->ShowKernelButton),"chosenOutline"); + gtk_widget_set_sensitive(window->ShowKernelButton,0); } else if (self==window->ShowPriorityButton){ window->last_mode=4; + gtk_style_context_add_class(gtk_widget_get_style_context(window->ShowPriorityButton),"chosenOutline"); + gtk_widget_set_sensitive(window->ShowPriorityButton,0); } else if (self==window->ShowAllBootsButton){ window->last_mode=5; + gtk_style_context_add_class(gtk_widget_get_style_context(window->ShowAllBootsButton),"chosenOutline"); + gtk_widget_set_sensitive(window->ShowAllBootsButton,0); } else if (self==window->ShowAllUnitsButton){ window->last_mode=6; + gtk_style_context_add_class(gtk_widget_get_style_context(window->ShowAllUnitsButton),"chosenOutline"); + gtk_widget_set_sensitive(window->ShowAllUnitsButton,0); } else if (self==window->ShowInitTreeButton){ window->last_mode=7; + gtk_style_context_add_class(gtk_widget_get_style_context(window->ShowInitTreeButton),"chosenOutline"); + gtk_widget_set_sensitive(window->ShowInitTreeButton,0); + } + else if (window->last_mode==0){ + gtk_style_context_add_class(gtk_widget_get_style_context(window->ShowSinceBootButton),"chosenOutline"); + gtk_widget_set_sensitive(window->ShowSinceBootButton,0); } main_config.remove_thread=0; gtk_tree_view_set_model(GTK_TREE_VIEW(window->JournaldTree),GTK_TREE_MODEL(window->list)); @@ -389,8 +660,14 @@ GtkWidget *yon_inspector_add_terminal(inspector_window *window,char *page_name,i } -void on_inspector_close(GtkWidget *self){ +void on_inspector_close(GtkWidget *self, inspector_window *window){ main_config.remove_thread++; + GList *list = gtk_tree_view_get_columns(GTK_TREE_VIEW(window->JournaldTree)); + for (int i=0; i< g_list_length(list);i++){ + int value=gtk_tree_view_column_get_fixed_width((GtkTreeViewColumn*)g_list_nth_data(list,i)); + yon_window_config_add_instant_parameter(yon_char_append("inspectorcolumn",yon_char_from_int(i)),"window",&value,YON_TYPE_INT); + } + } void on_inspector_open(GtkWidget *self, main_window *widgets){ @@ -413,6 +690,14 @@ void on_inspector_open(GtkWidget *self, main_window *widgets){ 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); + GList *list = gtk_tree_view_get_columns(GTK_TREE_VIEW(window->JournaldTree)); + for (int i=0; i< g_list_length(list);i++){ + int value; + yon_window_config_get_parameter("window",yon_char_append("inspectorcolumn",yon_char_from_int(i)),&value,YON_TYPE_INT); + if (value) + gtk_tree_view_column_set_fixed_width((GtkTreeViewColumn*)g_list_nth_data(list,i),value); + } + g_list_free(list); GtkTreeIter iter; char *name; char *paths; @@ -430,17 +715,50 @@ void on_inspector_open(GtkWidget *self, main_window *widgets){ 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"); + config_str final=NULL; + int final_size=0; + for (int i=0;ijournal_size;i++){ + if (strstr(window->journal_paths[i],"*")){ + int cur_size=0; + char *cur_folder = yon_char_divide(window->journal_paths[i],yon_char_find_last(window->journal_paths[i],'/')); + config_str files = yon_dir_get_contents(cur_folder,&cur_size); + char *prearg = yon_char_divide_search(window->journal_paths[i],"*",-1); + for (int j=0;jjournal_paths[i])&&strstr(files[j],prearg)){ + if(!final) final = yon_char_parsed_new(&final_size,yon_char_unite(cur_folder,"/",files[j],NULL),NULL); + else final = yon_char_parsed_append(final,&final_size,yon_char_unite(cur_folder,"/",files[j],NULL)); + } + } + yon_char_parsed_free(files,cur_size); + } else { + if(!final) final = yon_char_parsed_new(&final_size,window->journal_paths[i],NULL); + else final = yon_char_parsed_append(final,&final_size,window->journal_paths[i]); + } + } + yon_char_parsed_free(window->journal_paths,window->journal_size); + window->journal_paths=final; + window->journal_size=final_size; 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); + if (window->journal_size==0){ + GtkWidget *terminal = yon_inspector_add_terminal(window,window->journal_name,0); + if (terminal){ + yon_dictionary_add_or_create_if_exists_with_data(window->terminals,window->journal_name,terminal); + } + } else { + for (int i=0;ijournal_size;i++){ + if (!access(window->journal_paths[i],F_OK)){ + GFile *file = g_file_new_for_path(window->journal_paths[i]); + GFileType type = g_file_query_file_type(file,G_FILE_QUERY_INFO_NONE,NULL); + if(type==G_FILE_TYPE_REGULAR) + yon_dictionary_add_or_create_if_exists_with_data(window->terminals,window->journal_paths[i],yon_inspector_add_terminal(window,window->journal_paths[i],1)); + } + else{ + GtkWidget *terminal = yon_inspector_add_terminal(window,window->journal_paths[i],0); + if (terminal) + yon_dictionary_add_or_create_if_exists_with_data(window->terminals,window->journal_paths[i],terminal); + } } } gtk_widget_hide(window->JournalActionsBox); @@ -456,51 +774,173 @@ void on_inspector_open(GtkWidget *self, main_window *widgets){ // Logrotate window +void on_logrotate_configuration_path_filechooser_selection_changed(GtkWidget *self, logrotate_filechooser_window *dialog){ + GFile *file = gtk_file_chooser_get_file(GTK_FILE_CHOOSER(dialog->FileChooser)); + GFileType type = g_file_query_file_type(file,G_FILE_QUERY_INFO_NONE, NULL); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->FileOrDirCheck))){ + if (type==G_FILE_TYPE_REGULAR){ + gtk_widget_set_sensitive(dialog->AcceptButton,0); + } else { + gtk_widget_set_sensitive(dialog->AcceptButton,1); + } + } else { + if (type==G_FILE_TYPE_REGULAR){ + gtk_widget_set_sensitive(dialog->AcceptButton,1); + } else { + gtk_widget_set_sensitive(dialog->AcceptButton,0); + } + } +} + +void on_logrotate_filechooser_file_dir_toggled(GtkWidget *self, logrotate_filechooser_window *dialog){ + on_logrotate_configuration_path_filechooser_selection_changed(NULL,dialog); +} + +void on_logrotate_configuration_path_filechooser_save_edit(GtkWidget *self, dictionary *dict){ + logrotate_configure_window *window = yon_dictionary_get_data(dict->first,logrotate_configure_window*); + logrotate_filechooser_window *dialog = yon_dictionary_get_data(dict->first->next,logrotate_filechooser_window*); + GtkTreeIter iter, itar; + GtkTreeModel *model = GTK_TREE_MODEL(window->list); + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(window->LogPathsTree)),&model,&iter)){ + char *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog->FileChooser)); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->FileOrDirCheck))){ + if (filename[strlen(filename)-1]!='/') filename = yon_char_append(filename,"/*"); + else filename = yon_char_append(filename,"*"); + } + int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&itar); + int deleted=0; + 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&&filename) + if (!strcmp(path,filename)&>k_tree_path_compare(gtk_tree_model_get_path(GTK_TREE_MODEL(window->list),&itar),gtk_tree_model_get_path(GTK_TREE_MODEL(window->list),&iter))){ + yon_ubl_status_list_store_highlight_incorrect(window->list,gtk_tree_iter_copy(&itar)); + yon_ubl_status_box_spawn(GTK_CONTAINER(dialog->StatusBox),REPEAT_PATHS_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + deleted=1; + } + } + if(!deleted){ + gtk_list_store_set(window->list,&iter,0,filename,-1); + on_close_subwindow(dialog->FileChooser,"FileDialog"); + } + } +} + +void on_logrotate_configuration_path_filechooser_save(GtkWidget *self, dictionary *dict){ + logrotate_configure_window *window = yon_dictionary_get_data(dict->first,logrotate_configure_window*); + 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)); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->FileOrDirCheck))){ + GFile *file = gtk_file_chooser_get_file(GTK_FILE_CHOOSER(dialog->FileChooser)); + GFileType type; + if(file) + type = g_file_query_file_type(file,G_FILE_QUERY_INFO_NONE, NULL); + if (!filename||(type == G_FILE_TYPE_REGULAR)){ + filename = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(dialog->FileChooser)); + } + if (filename[strlen(filename)-1]!='/') + filename=yon_char_append(filename,"/*"); + else + filename=yon_char_append(filename,"*"); + } + GtkTreeIter iter, itar; + int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&itar); + int deleted=0; + 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&&filename) + if (!strcmp(path,filename)){ + yon_ubl_status_list_store_highlight_incorrect(window->list,gtk_tree_iter_copy(&itar)); + yon_ubl_status_box_spawn(GTK_CONTAINER(dialog->StatusBox),REPEAT_PATHS_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + deleted=1; + } + } + if(!deleted){ + gtk_list_store_append(window->list,&iter); + gtk_list_store_set(window->list,&iter,0,filename,-1); + on_close_subwindow(dialog->FileChooser,"FileDialog"); + } +} + +void on_logrotate_configuration_path_filechooser_open(GtkWidget *self, logrotate_configure_window *window){ + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(window->list); + if (self==window->LogPathEditButton){ + if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(window->LogPathsTree)),&model,&iter)) + return; + } + GtkBuilder *builder = gtk_builder_new_from_resource(glade_filechooser_path); + logrotate_filechooser_window *dialog = malloc(sizeof(logrotate_filechooser_window)); + dialog->FileChooser = yon_gtk_builder_get_widget(builder,"FileChooser"); + 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"); + dialog->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox"); + yon_window_config_custom_window_set(GTK_WINDOW(dialog->FileChooser),"FileDialog"); + gtk_window_set_transient_for(GTK_WINDOW(dialog->FileChooser),GTK_WINDOW(window->MainWindow)); + GtkFileFilter *filter = gtk_file_filter_new(); + gtk_file_filter_add_pattern(filter,"*log*"); + gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog->FileChooser),filter); + + dictionary *dict = NULL; + gtk_window_set_title(GTK_WINDOW(dialog->FileChooser),TITLE_LABEL); + 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->CancelButton),"clicked",G_CALLBACK(on_close_subwindow),"FileDialog"); + if (self==window->LogPathAddButton) + g_signal_connect(G_OBJECT(dialog->AcceptButton),"clicked",G_CALLBACK(on_logrotate_configuration_path_filechooser_save),dict); + else if (self==window->LogPathEditButton) + g_signal_connect(G_OBJECT(dialog->AcceptButton),"clicked",G_CALLBACK(on_logrotate_configuration_path_filechooser_save_edit),dict); + g_signal_connect(G_OBJECT(dialog->FileChooser),"selection-changed",G_CALLBACK(on_logrotate_configuration_path_filechooser_selection_changed),dialog); + g_signal_connect(G_OBJECT(dialog->FileOrDirCheck),"toggled",G_CALLBACK(on_logrotate_filechooser_file_dir_toggled),dialog); + gtk_widget_show(dialog->FileChooser); +} + void on_logrotate_configuration_path_add(GtkWidget *self, logrotate_configure_window *window){ GtkTreeModel *model = GTK_TREE_MODEL(window->list); GtkTreeIter iter; gtk_list_store_append(window->list, &iter); GtkTreeViewColumn *column = gtk_tree_view_get_column(GTK_TREE_VIEW(window->LogPathsTree),0); GList *list = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - GValue *val = g_malloc0(sizeof(GValue)); - g_object_get_property(G_OBJECT(list->data),"editable",val); - g_value_set_boolean(val,1); - g_object_set_property(G_OBJECT(list->data),"editable",val); - free(val); + // GValue *val = g_malloc0(sizeof(GValue)); + // g_object_get_property(G_OBJECT(list->data),"editable",val); + // g_value_set_boolean(val,1); + // g_object_set_property(G_OBJECT(list->data),"editable",val); + // free(val); gtk_tree_view_set_cursor(GTK_TREE_VIEW(window->LogPathsTree),gtk_tree_model_get_path(model,&iter),column,1); } -void on_path_editing_done(GtkCellRendererText* self,gchar* path,gchar* new_text,logrotate_configure_window *window){ +void on_path_editing_done(GtkCellRendererText* self,gchar* gtkpath,gchar* new_text,logrotate_configure_window *window){ 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_iter(GTK_TREE_MODEL(window->list),&iter,gtk_tree_path_new_from_string(gtkpath)); gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,0,&cur_path,-1); + int deleted=0; if (!strcmp(new_text,"")||cur_path&&!strcmp(cur_path,"")) gtk_list_store_remove(window->list,&iter); 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) + int comp = gtk_tree_path_compare(gtk_tree_path_new_from_string(gtkpath),gtk_tree_model_get_path(GTK_TREE_MODEL(window->list),&itar)); + if (path&&new_text&& comp) if (!strcmp(path,new_text)){ yon_ubl_status_list_store_highlight_incorrect(window->list,gtk_tree_iter_copy(&itar)); + yon_ubl_status_list_store_highlight_incorrect(window->list,gtk_tree_iter_copy(&iter)); 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); - g_object_set_property(G_OBJECT(self),"editable",val); - free(val); + // GValue *val = g_malloc0(sizeof(GValue)); + // g_object_get_property(G_OBJECT(self),"editable",val); + // g_value_set_boolean(val,0); + // g_object_set_property(G_OBJECT(self),"editable",val); + // free(val); } void on_path_editing_cancel(GtkCellRendererText* self,logrotate_configure_window *window){ @@ -520,11 +960,11 @@ void on_logrotate_configuration_path_edit(GtkWidget *self, logrotate_configure_w if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(window->LogPathsTree)),&model,&iter)){ GtkTreeViewColumn *column = gtk_tree_view_get_column(GTK_TREE_VIEW(window->LogPathsTree),0); GList *list = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - GValue *val = g_malloc0(sizeof(GValue)); - g_object_get_property(G_OBJECT(list->data),"editable",val); - g_value_set_boolean(val,1); - g_object_set_property(G_OBJECT(list->data),"editable",val); - free(val); + // GValue *val = g_malloc0(sizeof(GValue)); + // g_object_get_property(G_OBJECT(list->data),"editable",val); + // g_value_set_boolean(val,1); + // g_object_set_property(G_OBJECT(list->data),"editable",val); + // free(val); gtk_tree_view_set_cursor(GTK_TREE_VIEW(window->LogPathsTree),gtk_tree_model_get_path(model,&iter),column,1); } } @@ -731,6 +1171,53 @@ void on_logrotate_period_check_toggled(GtkToggleButton *self,logrotate_configure } } +void on_logrotate_paths_cursor_changed(GtkWidget *self, logrotate_configure_window *window){ + GtkTreeModel *model = GTK_TREE_MODEL(window->list); + GtkTreeIter iter; + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(window->LogPathsTree)),&model,&iter)){ + gtk_widget_set_sensitive(window->LogPathEditButton,1); + gtk_widget_set_sensitive(window->LogPathRemoveButton,1); + } else { + gtk_widget_set_sensitive(window->LogPathEditButton,0); + gtk_widget_set_sensitive(window->LogPathRemoveButton,0); + + } +} + +int on_logrotate_check_repeats(GtkWidget *self, logrotate_configure_window *window){ + GtkTreeIter iter,*itar; + GtkTreeModel *model = GTK_TREE_MODEL(window->list); + char *chpath=NULL; + char *path=NULL; + int valid = gtk_tree_model_get_iter_first(model,&iter); + itar=gtk_tree_iter_copy(&iter); + for (;valid;valid = gtk_tree_model_iter_next(model,&iter)){ + gtk_tree_model_get(model,&iter,0,&chpath,-1); + int valid1 = gtk_tree_model_get_iter_first(model,itar); + for (;valid1;valid1=gtk_tree_model_iter_next(model,itar)){ + GtkTreePath *path_iter = gtk_tree_model_get_path(model,&iter); + GtkTreePath *path_itar = gtk_tree_model_get_path(model,itar); + if (gtk_tree_path_compare(path_iter,path_itar)){ + gtk_tree_model_get(model,itar,0,&path,-1); + if (!strcmp(path,chpath)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),REPEAT_PATHS_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_list_store_highlight_incorrect(window->list,itar); + GtkTreeIter *ittr = gtk_tree_iter_copy(&iter); + yon_ubl_status_list_store_highlight_incorrect(window->list,ittr); + + return 1; + } + free(path); + } + gtk_tree_path_free(path_iter); + gtk_tree_path_free(path_itar); + + } + + } + return 0; +} + 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*); @@ -790,6 +1277,7 @@ void on_logrotate_save(GtkWidget *self, dictionary *dict){ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); return; } + if (on_logrotate_check_repeats(NULL,window)==1) return; GtkTreeIter *lastiter; GtkTreeIter *lastitar; for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(window->list),&iter)){ @@ -992,7 +1480,8 @@ void on_logrotate_save(GtkWidget *self, dictionary *dict){ yon_window_config_erase_custom_parameter(window->paths,"description"); } GtkTreeIter iter; - yon_config_register(LOGROTATE(paths),"logging",commandline); + paths = yon_char_replace(paths,"\n",","); + yon_config_register(LOGROTATE(log_name),"logging",yon_char_unite(paths,":",commandline,NULL)); 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); @@ -1005,7 +1494,7 @@ void on_logrotate_save(GtkWidget *self, dictionary *dict){ } } -logrotate_configure_window *yon_logrotate_window_new(char *paths, logrotate_window *dialog){ +logrotate_configure_window *yon_logrotate_window_new(char *paths, logrotate_window *dialog, char *log_name){ logrotate_configure_window *window = malloc(sizeof(logrotate_configure_window)); GtkBuilder *builder = gtk_builder_new_from_resource(glade_logrotate_path); window->MainWindow=yon_gtk_builder_get_widget(builder,"MainWindow"); @@ -1081,7 +1570,7 @@ logrotate_configure_window *yon_logrotate_window_new(char *paths, logrotate_wind int sz; float finalsize=0.0; char *temp_paths = yon_char_new(paths); - config_str parsed_paths = yon_char_parse(temp_paths,&sz,","); + config_str parsed_paths = yon_char_parse(temp_paths,&sz,"\n"); free(temp_paths); temp_paths=NULL; for (int i=0;iSaveButton),"clicked",G_CALLBACK(on_logrotate_save),dict); g_signal_connect(G_OBJECT(window->PathCell),"edited",G_CALLBACK(on_path_editing_done),window); g_signal_connect(G_OBJECT(window->PathCell),"editing-canceled",G_CALLBACK(on_path_editing_cancel),window); - g_signal_connect(G_OBJECT(window->LogPathAddButton),"clicked",G_CALLBACK(on_logrotate_configuration_path_add),window); - g_signal_connect(G_OBJECT(window->LogPathEditButton),"clicked",G_CALLBACK(on_logrotate_configuration_path_edit),window); + g_signal_connect(G_OBJECT(window->LogPathAddButton),"clicked",G_CALLBACK(on_logrotate_configuration_path_filechooser_open),window); + g_signal_connect(G_OBJECT(window->LogPathEditButton),"clicked",G_CALLBACK(on_logrotate_configuration_path_filechooser_open),window); + // g_signal_connect(G_OBJECT(window->LogPathsTree),"changed",G_CALLBACK(on_logrotate_paths_done),window); g_signal_connect(G_OBJECT(window->LogPathRemoveButton),"clicked",G_CALLBACK(on_logrotate_configuration_path_remove),window); g_signal_connect(G_OBJECT(window->RotationPeriodCheck),"toggled",G_CALLBACK(on_logrotate_period_check_toggled),window); @@ -1145,6 +1635,8 @@ logrotate_configure_window *yon_logrotate_window_new(char *paths, logrotate_wind g_signal_connect(G_OBJECT(window->CreateLogButton),"clicked",G_CALLBACK(on_rules_open),window->CreateLogEntry); + g_signal_connect(G_OBJECT(window->LogPathsTree),"cursor-changed",G_CALLBACK(on_logrotate_paths_cursor_changed),window); + int usize=0; config_str users = yon_ubl_get_all_users(&usize); yon_gtk_combo_box_fill(window->CreateLogUserCombo,users,usize); @@ -1158,135 +1650,149 @@ logrotate_configure_window *yon_logrotate_window_new(char *paths, logrotate_wind if (paths){ int size; GtkTreeIter iter; - config_str parsed = yon_char_parse(paths,&size,","); + config_str parsed = yon_char_parse(paths,&size,"\n"); for (int i=0; ilist,&iter); gtk_list_store_set(window->list,&iter,0,parsed[i],-1); } yon_char_parsed_free(parsed,size); - char *parameters = yon_config_get_by_key(LOGROTATE(paths)); - if (parameters){ - parsed = yon_char_parse(parameters,&size,","); - for (int i=0;iRotationPeriodMainCombo),0); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->RotationPeriodCheck),1); - } else if (!strcmp(parsed[i],"daily")){ - gtk_combo_box_set_active(GTK_COMBO_BOX(window->RotationPeriodMainCombo),1); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->RotationPeriodCheck),1); - }else if (strstr(parsed[i],"weekly")){ - gtk_combo_box_set_active(GTK_COMBO_BOX(window->RotationPeriodMainCombo),2); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->RotationPeriodCheck),1); - int dayofweek = atoi(strstr(parsed[i]," ")+1); - if (dayofweek==0) dayofweek=7; - dayofweek--; - gtk_combo_box_set_active(GTK_COMBO_BOX(window->RotationPeriodAdditionalCombo),dayofweek); - }else if (!strcmp(parsed[i],"monthly")){ - gtk_combo_box_set_active(GTK_COMBO_BOX(window->RotationPeriodMainCombo),3); - }else if (!strcmp(parsed[i],"yearly")){ - gtk_combo_box_set_active(GTK_COMBO_BOX(window->RotationPeriodMainCombo),4); - }else if (!strcmp(parsed[i],"olddir")){ - char *value = strstr(parsed[i]," ")+1; - gtk_entry_set_text(GTK_ENTRY(window->FileAmountEntry),value); - gtk_combo_box_set_active(GTK_COMBO_BOX(window->FileAmountCombo),1); - }else if (!strcmp(parsed[i],"noolddir")){ - gtk_combo_box_set_active(GTK_COMBO_BOX(window->FileAmountCombo),2); - }else if (strstr(parsed[i],"su")){ - char *value = strstr(parsed[i]," ")+1; - char *nvalue = yon_char_divide_search(value," ",-1); - int us = yon_gtk_combo_box_text_find(window->RotationAtUserCombo,nvalue); - int gr = yon_gtk_combo_box_text_find(window->RotationAtGroupCombo,value); - gtk_combo_box_set_active(GTK_COMBO_BOX(window->RotationAtUserCombo),us); - gtk_combo_box_set_active(GTK_COMBO_BOX(window->RotationAtGroupCombo),gr); - }else if (!strcmp(parsed[i],"missingok")){ - gtk_combo_box_set_active(GTK_COMBO_BOX(window->ErrorProcessingCombo),1); - }else if (!strcmp(parsed[i],"nomissingok")){ - gtk_combo_box_set_active(GTK_COMBO_BOX(window->ErrorProcessingCombo),2); - }else if (!strcmp(parsed[i],"ifempty")){ - gtk_combo_box_set_active(GTK_COMBO_BOX(window->JournalEmptyCombo),1); - }else if (!strcmp(parsed[i],"notifempty")){ - gtk_combo_box_set_active(GTK_COMBO_BOX(window->JournalEmptyCombo),2); - }else if (strstr(parsed[i],"minage")){ - char *value = strstr(parsed[i]," ")+1; - gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->DoNotRotateYoungerSpin),atol(value)); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DoNotRotateYoungerCheck),1); - }else if (strstr(parsed[i],"maxage")){ - char *value = strstr(parsed[i]," ")+1; - gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->DeleteOlderSpin),atol(value)); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DeleteOlderCheck),1); - }else if (strstr(parsed[i],"minsize")){ - char *value = strstr(parsed[i]," ")+1; - gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->RotateSizeMaxAfterTimeSpin),atol(value)); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->RotateSizeMaxAfterTimeCheck),1); - gtk_combo_box_set_active(GTK_COMBO_BOX(window->RotateSizeMaxAfterTimeCombo),yon_size_get_int_from_letter(value[strlen(value)-1])); - }else if (strstr(parsed[i],"maxsize")){ - char *value = strstr(parsed[i]," ")+1; - 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 (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)); - gtk_combo_box_set_active(GTK_COMBO_BOX(window->JournalMaxSizeCombo),sizemod); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->JournalMaxSizeCheck),1); - }else if (!strcmp(parsed[i],"copytruncate")){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->CutCheck),1); - }else if (!strcmp(parsed[i],"compress")){ - gtk_combo_box_set_active(GTK_COMBO_BOX(window->CompressionCombo),1); - }else if (!strcmp(parsed[i],"nocompress")){ - gtk_combo_box_set_active(GTK_COMBO_BOX(window->CompressionCombo),2); - }else if (!strcmp(parsed[i],"delaycompress")){ - gtk_combo_box_set_active(GTK_COMBO_BOX(window->QueueCombo),1); - - }else if (!strcmp(parsed[i],"nodelaycompress")){ - gtk_combo_box_set_active(GTK_COMBO_BOX(window->QueueCombo),2); - }else if (strstr(parsed[i],"extension")){ - char *value = strstr(parsed[i]," ")+1; - gtk_combo_box_set_active(GTK_COMBO_BOX(window->SaveOriginalCombo),1); - gtk_entry_set_text(GTK_ENTRY(window->SaveOriginalEntry),value); - }else if (!strcmp(parsed[i],"dateext")){ - gtk_combo_box_set_active(GTK_COMBO_BOX(window->AddDateCombo),1); - }else if (strstr(parsed[i],"start")){ - char *value = strstr(parsed[i]," ")+1; - gtk_combo_box_set_active(GTK_COMBO_BOX(window->OldNumberCombo),1); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->OldNumberEntry),atol(value)); - }else if (!strcmp(parsed[i],"nomail")){ - gtk_combo_box_set_active(GTK_COMBO_BOX(window->EmailCombo),2); - }else if (strstr(parsed[i],"mail")){ - char *value = strstr(parsed[i]," ")+1; - gtk_entry_set_text(GTK_ENTRY(window->EmailEntry),value); - gtk_combo_box_set_active(GTK_COMBO_BOX(window->EmailCombo),1); - }else if (!strcmp(parsed[i],"mailfirst")){ - gtk_combo_box_set_active(GTK_COMBO_BOX(window->EmailContentsCombo),1); - }else if (!strcmp(parsed[i],"maillast")){ - gtk_combo_box_set_active(GTK_COMBO_BOX(window->EmailContentsCombo),2); - }else if (!strcmp(parsed[i],"sharedscripts")){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->SharedScenariosCheck),1); - }else if (strstr(parsed[i],"firstaction")){ - char *value = parsed[i+1]; - gtk_entry_set_text(GTK_ENTRY(window->CommandBeforeOnceEntry),value); - i++; - }else if (strstr(parsed[i],"lastaction")){ - char *value = parsed[i+1]; - gtk_entry_set_text(GTK_ENTRY(window->CommandAfterOnceEntry),value); - i++; - }else if (strstr(parsed[i],"prerotate")){ - char *value = parsed[i+1]; - gtk_entry_set_text(GTK_ENTRY(window->CommandBeforeEntry),value); - i++; - }else if (strstr(parsed[i],"postrotate")){ - char *value = parsed[i+1]; - gtk_entry_set_text(GTK_ENTRY(window->CommandAfterEntry),value); - i++; - }else if (!strcmp(parsed[i],"preremove")){ - char *value = parsed[i+1]; - gtk_entry_set_text(GTK_ENTRY(window->EndworkCommandEntry),value); - i++; - }else if (strstr(parsed[i],"rotate")){ - char *value = strstr(parsed[i]," ")+1; - gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->FileAmountSpin),atol(value)); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->FileAmountCheck),1); - }else if (!strcmp(parsed[i],"endscript")){ + if (log_name){ + char *parameters = yon_config_get_by_key(LOGROTATE(log_name)); + if (parameters){ + if(parameters[strlen(parameters)-1]=='\"') parameters[strlen(parameters)-1]='\0'; + parameters=strstr(parameters,":"); + if (parameters) parameters++; + parsed = yon_char_parse(parameters,&size,","); + for (int i=0;iRotationPeriodMainCombo),0); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->RotationPeriodCheck),1); + } else if (!strcmp(parsed[i],"daily")){ + gtk_combo_box_set_active(GTK_COMBO_BOX(window->RotationPeriodMainCombo),1); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->RotationPeriodCheck),1); + }else if (strstr(parsed[i],"weekly")){ + gtk_combo_box_set_active(GTK_COMBO_BOX(window->RotationPeriodMainCombo),2); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->RotationPeriodCheck),1); + int dayofweek = atoi(strstr(parsed[i]," ")+1); + if (dayofweek==0) dayofweek=7; + dayofweek--; + gtk_combo_box_set_active(GTK_COMBO_BOX(window->RotationPeriodAdditionalCombo),dayofweek); + }else if (!strcmp(parsed[i],"monthly")){ + gtk_combo_box_set_active(GTK_COMBO_BOX(window->RotationPeriodMainCombo),3); + }else if (!strcmp(parsed[i],"yearly")){ + gtk_combo_box_set_active(GTK_COMBO_BOX(window->RotationPeriodMainCombo),4); + }else if (!strcmp(parsed[i],"olddir")){ + char *value = strstr(parsed[i]," "); + if (value) value++; + gtk_entry_set_text(GTK_ENTRY(window->FileAmountEntry),value); + gtk_combo_box_set_active(GTK_COMBO_BOX(window->FileAmountCombo),1); + }else if (!strcmp(parsed[i],"noolddir")){ + gtk_combo_box_set_active(GTK_COMBO_BOX(window->FileAmountCombo),2); + }else if (strstr(parsed[i],"su")){ + char *value = strstr(parsed[i]," "); + if (value) value++; + char *nvalue = yon_char_divide_search(value," ",-1); + int us = yon_gtk_combo_box_text_find(window->RotationAtUserCombo,nvalue); + int gr = yon_gtk_combo_box_text_find(window->RotationAtGroupCombo,value); + gtk_combo_box_set_active(GTK_COMBO_BOX(window->RotationAtUserCombo),us); + gtk_combo_box_set_active(GTK_COMBO_BOX(window->RotationAtGroupCombo),gr); + }else if (!strcmp(parsed[i],"missingok")){ + gtk_combo_box_set_active(GTK_COMBO_BOX(window->ErrorProcessingCombo),1); + }else if (!strcmp(parsed[i],"nomissingok")){ + gtk_combo_box_set_active(GTK_COMBO_BOX(window->ErrorProcessingCombo),2); + }else if (!strcmp(parsed[i],"ifempty")){ + gtk_combo_box_set_active(GTK_COMBO_BOX(window->JournalEmptyCombo),1); + }else if (!strcmp(parsed[i],"notifempty")){ + gtk_combo_box_set_active(GTK_COMBO_BOX(window->JournalEmptyCombo),2); + }else if (strstr(parsed[i],"minage")){ + char *value = strstr(parsed[i]," "); + if (value) value++; + gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->DoNotRotateYoungerSpin),atol(value)); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DoNotRotateYoungerCheck),1); + }else if (strstr(parsed[i],"maxage")){ + char *value = strstr(parsed[i]," "); + if (value) value++; + gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->DeleteOlderSpin),atol(value)); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DeleteOlderCheck),1); + }else if (strstr(parsed[i],"minsize")){ + char *value = strstr(parsed[i]," "); + if (value) value++; + gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->RotateSizeMaxAfterTimeSpin),atol(value)); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->RotateSizeMaxAfterTimeCheck),1); + gtk_combo_box_set_active(GTK_COMBO_BOX(window->RotateSizeMaxAfterTimeCombo),yon_size_get_int_from_letter(value[strlen(value)-1])); + }else if (strstr(parsed[i],"maxsize")){ + char *value = strstr(parsed[i]," "); + if (value) value++; + 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 (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)); + gtk_combo_box_set_active(GTK_COMBO_BOX(window->JournalMaxSizeCombo),sizemod); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->JournalMaxSizeCheck),1); + }else if (!strcmp(parsed[i],"copytruncate")){ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->CutCheck),1); + }else if (!strcmp(parsed[i],"compress")){ + gtk_combo_box_set_active(GTK_COMBO_BOX(window->CompressionCombo),1); + }else if (!strcmp(parsed[i],"nocompress")){ + gtk_combo_box_set_active(GTK_COMBO_BOX(window->CompressionCombo),2); + }else if (!strcmp(parsed[i],"delaycompress")){ + gtk_combo_box_set_active(GTK_COMBO_BOX(window->QueueCombo),1); + + }else if (!strcmp(parsed[i],"nodelaycompress")){ + gtk_combo_box_set_active(GTK_COMBO_BOX(window->QueueCombo),2); + }else if (strstr(parsed[i],"extension")){ + char *value = strstr(parsed[i]," "); + if (value) value++; + gtk_combo_box_set_active(GTK_COMBO_BOX(window->SaveOriginalCombo),1); + gtk_entry_set_text(GTK_ENTRY(window->SaveOriginalEntry),value); + }else if (!strcmp(parsed[i],"dateext")){ + gtk_combo_box_set_active(GTK_COMBO_BOX(window->AddDateCombo),1); + }else if (strstr(parsed[i],"start")){ + char *value = strstr(parsed[i]," "); + if (value) value++; + gtk_combo_box_set_active(GTK_COMBO_BOX(window->OldNumberCombo),1); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->OldNumberEntry),atol(value)); + }else if (!strcmp(parsed[i],"mailfirst")){ + gtk_combo_box_set_active(GTK_COMBO_BOX(window->EmailContentsCombo),1); + }else if (!strcmp(parsed[i],"maillast")){ + gtk_combo_box_set_active(GTK_COMBO_BOX(window->EmailContentsCombo),2); + }else if (!strcmp(parsed[i],"nomail")){ + gtk_combo_box_set_active(GTK_COMBO_BOX(window->EmailCombo),2); + }else if (strstr(parsed[i],"mail")){ + char *value = strstr(parsed[i]," "); + if (value) value++; + gtk_entry_set_text(GTK_ENTRY(window->EmailEntry),value); + gtk_combo_box_set_active(GTK_COMBO_BOX(window->EmailCombo),1); + }else if (!strcmp(parsed[i],"sharedscripts")){ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->SharedScenariosCheck),1); + }else if (strstr(parsed[i],"firstaction")){ + char *value = parsed[i+1]; + gtk_entry_set_text(GTK_ENTRY(window->CommandBeforeOnceEntry),value); + i++; + }else if (strstr(parsed[i],"lastaction")){ + char *value = parsed[i+1]; + gtk_entry_set_text(GTK_ENTRY(window->CommandAfterOnceEntry),value); + i++; + }else if (strstr(parsed[i],"prerotate")){ + char *value = parsed[i+1]; + gtk_entry_set_text(GTK_ENTRY(window->CommandBeforeEntry),value); + i++; + }else if (strstr(parsed[i],"postrotate")){ + char *value = parsed[i+1]; + gtk_entry_set_text(GTK_ENTRY(window->CommandAfterEntry),value); + i++; + }else if (!strcmp(parsed[i],"preremove")){ + char *value = parsed[i+1]; + gtk_entry_set_text(GTK_ENTRY(window->EndworkCommandEntry),value); + i++; + }else if (strstr(parsed[i],"rotate")){ + char *value = strstr(parsed[i]," ")+1; + gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->FileAmountSpin),atol(value)); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->FileAmountCheck),1); + }else if (!strcmp(parsed[i],"endscript")){ + } } } } @@ -1296,7 +1802,7 @@ logrotate_configure_window *yon_logrotate_window_new(char *paths, logrotate_wind } void on_logrotate_add(GtkWidget *self, logrotate_window *dialog){ - logrotate_configure_window *window = yon_logrotate_window_new(NULL,NULL); + logrotate_configure_window *window = yon_logrotate_window_new(NULL,NULL,NULL); gtk_tree_selection_unselect_all(gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->MainTree))); gtk_window_set_transient_for(GTK_WINDOW(window->MainWindow),GTK_WINDOW(dialog->Window)); gtk_widget_show(window->MainWindow); @@ -1319,9 +1825,9 @@ void on_logrotate_edit(GtkWidget *self, logrotate_window *window){ for (int i=0;iMainWindow); gtk_tree_model_get(model,&iter,0,&name,1,&paths,2,&description,-1); + logrotate_configure_window *dialog = yon_logrotate_window_new(paths,window,name); + gtk_widget_show(dialog->MainWindow); 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); @@ -1337,9 +1843,8 @@ void on_logrotate_remove(GtkWidget *self, logrotate_window *window){ GtkTreeIter iter; if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(window->MainTree)),&model, &iter)){ char *paths; - gtk_tree_model_get(model,&iter,1,&paths,-1); + gtk_tree_model_get(model,&iter,0,&paths,-1); gtk_list_store_remove(main_config.logrotate_list,&iter); - yon_char_replace(paths,"\n",","); yon_config_remove_by_key(LOGROTATE(paths)); } } @@ -1375,8 +1880,9 @@ void on_logrotate_apps_configure(GtkWidget *self, logrotate_window *window){ gtk_list_store_append(main_config.logrotate_list,&itar); settings = yon_char_replace(settings,",\t",","); if (settings[0]==',') yon_char_divide_search(settings,",",-1); - yon_config_register(LOGROTATE(yon_char_replace(paths,"\n",",")),"logging",settings); gtk_list_store_set(main_config.logrotate_list,&itar,0,name,1,paths,-1); + paths = yon_char_replace(paths,"\n",","); + yon_config_register(LOGROTATE(name),"logging",yon_char_unite(paths,":",settings,NULL)); yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),SUCCESS_LABEL,5,BACKGROUND_IMAGE_SUCCESS_TYPE); } } @@ -1396,7 +1902,7 @@ void on_log_edit_logrotate_settings(GtkWidget *self, dictionary *dict){ GList *paths = gtk_container_get_children((GtkContainer*)g_list_nth_data(list,i)); pathse=yon_char_unite(pathse ? yon_char_append(pathse,","):"",gtk_entry_get_text((GtkEntry*)g_list_nth_data(paths,1)),NULL); } - logrotate_configure_window *dialog = yon_logrotate_window_new(pathse,NULL); + logrotate_configure_window *dialog = yon_logrotate_window_new(pathse,NULL,name); gtk_widget_show(dialog->MainWindow); gtk_entry_set_text(GTK_ENTRY(dialog->LogNameEntry),name); gtk_entry_set_text(GTK_ENTRY(dialog->LogDescriptionEntry),description); @@ -1826,7 +2332,7 @@ void on_log_save(GtkWidget *self, dictionary *dict){ if (!yon_char_is_empty(name)){ GtkTreeModel *model = GTK_TREE_MODEL(widgets->list); GtkTreeIter iter; - int stat; + int stat=0; 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)){ @@ -1853,10 +2359,13 @@ void on_log_save(GtkWidget *self, dictionary *dict){ 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); + char *nm; + gtk_tree_model_get(GTK_TREE_MODEL(widgets->list),&iter,0,&nm,3,&stat,-1); + stat = stat==0?0:stat==1?2:2; + gtk_list_store_set(widgets->list,&iter,3,stat,-1); } - gtk_list_store_set(widgets->list,&iter,0,name,1,pathse,2,&desc ? desc : "",-1); + gtk_list_store_set(widgets->list,&iter,0,name,1,pathse,2,&desc ? desc : "",3,stat,-1); + if (stat==2) gtk_widget_set_sensitive(widgets->RemoveButton,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); @@ -1913,16 +2422,81 @@ void on_log_path_remove(GtkWidget *self, add_log_window *window){ g_list_free(paths); } -void on_log_path_choose(GtkWidget *self,add_log_window *window){ - GtkWidget *dialog = gtk_file_chooser_dialog_new(TITLE_LABEL,GTK_WINDOW(window->MainWindow),GTK_FILE_CHOOSER_ACTION_OPEN,CANCEL_LABEL,GTK_RESPONSE_CANCEL,ACCEPT_LABEL,GTK_RESPONSE_ACCEPT,NULL); - gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog),"/"); - int response = gtk_dialog_run(GTK_DIALOG(dialog)); - if (response == GTK_RESPONSE_ACCEPT){ - GtkWidget *parent = gtk_widget_get_parent(self); - GList *list = gtk_container_get_children(GTK_CONTAINER(parent)); - gtk_entry_set_text((GtkEntry*)g_list_nth_data(list,1),gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog))); +void on_log_path_filechooser_selection_changed(GtkWidget *self, logrotate_filechooser_window *dialog){ + GFile *file = gtk_file_chooser_get_file(GTK_FILE_CHOOSER(dialog->FileChooser)); + GFileType type = g_file_query_file_type(file,G_FILE_QUERY_INFO_NONE, NULL); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->FileOrDirCheck))){ + if (type==G_FILE_TYPE_REGULAR){ + gtk_widget_set_sensitive(dialog->AcceptButton,0); + } else { + gtk_widget_set_sensitive(dialog->AcceptButton,1); + } + } else { + if (type==G_FILE_TYPE_REGULAR){ + gtk_widget_set_sensitive(dialog->AcceptButton,1); + } else { + gtk_widget_set_sensitive(dialog->AcceptButton,0); + } + } +} + +void on_log_path_filechooser_toggled(GtkWidget *self, logrotate_filechooser_window *dialog){ + on_log_path_filechooser_selection_changed(NULL,dialog); +} + +void on_log_path_filechooser_save(GtkWidget *self, dictionary *dict){ + GtkEntry *entry = yon_dictionary_get_data(dict->first,GtkEntry*); + 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)); + GFile *file = gtk_file_chooser_get_file(GTK_FILE_CHOOSER(dialog->FileChooser)); + if (!file){ + filename = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(dialog->FileChooser)); + if (filename[strlen(filename)-1]=='/') + filename = yon_char_append(filename,"*"); + else + filename = yon_char_append(filename,"/*"); + } else { + GFileType type = g_file_query_file_type(file,G_FILE_QUERY_INFO_NONE,NULL); + if (type==G_FILE_TYPE_DIRECTORY){ + if (filename[strlen(filename)-1]=='/') + filename = yon_char_append(filename,"*"); + else + filename = yon_char_append(filename,"/*"); + + } } - gtk_widget_destroy(dialog); + gtk_entry_set_text(entry,filename); + + on_close_subwindow(dialog->FileChooser,NULL); +} + +void on_log_path_filechooser_open(GtkWidget *self, GtkEntry *entry){ + GtkBuilder *builder = gtk_builder_new_from_resource(glade_filechooser_path); + logrotate_filechooser_window *dialog = malloc(sizeof(logrotate_filechooser_window)); + dialog->FileChooser = yon_gtk_builder_get_widget(builder,"FileChooser"); + 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"); + dialog->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox"); + yon_window_config_custom_window_set(GTK_WINDOW(dialog->FileChooser),"FileDialog"); + gtk_window_set_transient_for(GTK_WINDOW(dialog->FileChooser),GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(entry)))); + + dictionary *dict = NULL; + gtk_window_set_title(GTK_WINDOW(dialog->FileChooser),TITLE_LABEL); + yon_dictionary_add_or_create_if_exists_with_data(dict,"entry",entry); + yon_dictionary_add_or_create_if_exists_with_data(dict,"dialog",dialog); + + 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_log_path_filechooser_save),dict); + g_signal_connect(G_OBJECT(dialog->FileChooser),"selection-changed",G_CALLBACK(on_log_path_filechooser_selection_changed),dialog); + g_signal_connect(G_OBJECT(dialog->FileOrDirCheck),"toggled",G_CALLBACK(on_log_path_filechooser_toggled),dialog); + gtk_widget_show(dialog->FileChooser); +} + +void on_log_path_choose(GtkWidget *self,add_log_window *window){ + GtkWidget *parent = gtk_widget_get_parent(self); + GList *list = gtk_container_get_children(GTK_CONTAINER(parent)); + on_log_path_filechooser_open(NULL,(GtkEntry*)g_list_nth_data(list,1)); } void on_log_path_append(GtkWidget *self, add_log_window *window){ @@ -1933,15 +2507,29 @@ void on_log_path_append(GtkWidget *self, add_log_window *window){ if (box){ path_widgets = gtk_container_get_children(GTK_CONTAINER(box)); entry = (GtkWidget*)g_list_nth_data(path_widgets,1); + char *entry_path=(char*)gtk_entry_get_text(GTK_ENTRY(entry)); - if (!gtk_widget_get_sensitive(box)||!strcmp(gtk_entry_get_text(GTK_ENTRY(entry)),"")){ - return; - } else + if (!gtk_widget_get_sensitive(box)||!strcmp(entry_path,"")){ + return; + }else { + GList *list = gtk_container_get_children(GTK_CONTAINER(window->LogPathsBox)); + for (int i=0;iStatusBox),REPEATED_PATHS_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + return; + } + g_list_free(wids); + } + g_list_free(list); gtk_widget_hide(self); + } } GtkBuilder *builder = gtk_builder_new_from_resource(glade_add_path_path); GtkWidget *box_path = yon_gtk_builder_get_widget(builder,"PathBox"); - GtkWidget *entry_path = yon_gtk_builder_get_widget(builder,"PathEntry"); GtkWidget *AppendButton = yon_gtk_builder_get_widget(builder,"AppendButton"); GtkWidget *SearchButton = yon_gtk_builder_get_widget(builder,"SearchButton"); GtkWidget *RemoveButton = yon_gtk_builder_get_widget(builder,"RemoveButton"); @@ -2058,8 +2646,25 @@ void on_log_remove(GtkWidget *self, main_window *widgets){ 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)){ - gtk_list_store_remove(widgets->list,&iter); + int standard=0; + gtk_tree_model_get(model,&iter,3,&standard,-1); + if (standard==0) + gtk_list_store_remove(widgets->list,&iter); + if (standard==2){ + int stay_paths=0; + char *paths; + gtk_tree_model_get(model,&iter,1,&paths,4,&stay_paths,-1); + char *stay; + for (int i=0;ilist,&iter,1,paths,3,1,-1); + gtk_widget_set_sensitive(widgets->RemoveButton,0); + } } + yon_logs_custom_save(widgets); } // Main window @@ -2086,14 +2691,14 @@ void on_main_window_tree_selection_changed(GtkWidget *self,main_window *widgets) gboolean is_standard; gtk_tree_model_get(model,&iter,3,&is_standard,-1); gtk_widget_set_sensitive(widgets->AddButton,1); - if (!is_standard) + if (!is_standard||is_standard==2) gtk_widget_set_sensitive(widgets->RemoveButton,1); else gtk_widget_set_sensitive(widgets->RemoveButton,0); gtk_widget_set_sensitive(widgets->InspectButton,1); gtk_widget_set_sensitive(widgets->ConfigureButton,1); } else { - gtk_widget_set_sensitive(widgets->AddButton,0); + gtk_widget_set_sensitive(widgets->AddButton,1); gtk_widget_set_sensitive(widgets->RemoveButton,0); gtk_widget_set_sensitive(widgets->InspectButton,0); gtk_widget_set_sensitive(widgets->ConfigureButton,0); @@ -2265,6 +2870,7 @@ void config_init(){ 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; + main_config.load_mode=1; PolkitSubject *subject = NULL; @@ -2429,6 +3035,8 @@ main_window *setup_window(){ if (custom_watchers){ GtkTreeIter itar; for (int i=0;ilist,&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); + gtk_list_store_set(widgets->list,&iter,0,cur_watcher[0],1,cur_watcher[1],2,cur_watcher[2]?cur_watcher[2]:"",3,found ? 2 : 0,-1); yon_char_parsed_free(cur_watcher,cur_size); } } @@ -2461,7 +3069,6 @@ main_window *setup_window(){ // yon_window_config_add_custom_parameter(widgets->HeadInfoLabel,"head-text","label",YON_TYPE_STRING); /* Signal connection | Присоединение сигналов */ - g_signal_connect(G_OBJECT(widgets->Window), "destroy", G_CALLBACK(gtk_main_quit), NULL); g_signal_connect(G_OBJECT(widgets->DocumentationMenuItem),"activate",G_CALLBACK(on_open_documentation_confirmation),WIKI_LINK); g_signal_connect(G_OBJECT(widgets->AboutMenuItem),"activate",G_CALLBACK(on_about),NULL); g_signal_connect(G_OBJECT(widgets->InspectButton),"clicked",G_CALLBACK(on_inspector_open),widgets); diff --git a/source/ubl-settings-logging.h b/source/ubl-settings-logging.h index e31c4ac..2e0494e 100644 --- a/source/ubl-settings-logging.h +++ b/source/ubl-settings-logging.h @@ -33,6 +33,7 @@ #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 glade_saving_path "/com/ublinux/ui/ubl-settings-logging-saving.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) @@ -236,6 +237,7 @@ typedef struct { GtkWidget *FileOrDirCheck; GtkWidget *CancelButton; GtkWidget *AcceptButton; + GtkWidget *StatusBox; } logrotate_filechooser_window; typedef struct { @@ -356,4 +358,17 @@ typedef struct { char *paths; } logrotate_configure_window; +typedef struct { + GtkWidget *Window; + GtkWidget *HeaderTopic; + GtkWidget *HeaderImage; + GtkWidget *StatusBox; + GtkWidget *ParametersTree; + GtkCellRenderer *ToggleCell; + GtkWidget *CancelButton; + GtkWidget *SaveButton; + GtkListStore *list; + YON_CONFIG_TYPE type; +} saving_window; + main_window *setup_window(); \ No newline at end of file diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 95126f1..60c6e7b 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -37,6 +37,8 @@ #define GLOBAL_SAVE_SUCCESS_LABEL _("Global configuration saving succseeded.") #define LOCAL_SAVE_SUCCESS_LABEL _("Local configuration saving succseeded.") #define ACCEPT_LABEL _("Accept") + +#define CHOOSE_DIR_NOT_FILE_LABEL _("Choose directory instead of file") //ubl-settings-logging.glade #define JOURNALS_LABEL _("Journals") #define SERVICES_LABEL _("Services") @@ -55,6 +57,19 @@ #define AUTOSTART_LABEL _("Autostart") #define AUTOSTART_OFF_LABEL _("Switch autostart off") #define AUTOSTART_ON_LABEL _("Switch autostart on") +#define JOURNALD_DESCRIPTION_LABEL _("System event log") +#define ACPID_DESCRIPTION_LABEL _("Log of work and requests to Acpid") +#define APACHE_DESCRIPTION_LABEL _("Log of work and requests to the web server") +#define AUDIT_DESCRIPTION_LABEL _("Audit log") +#define AUTHLOG_DESCRIPTION_LABEL _("Log of authorization procedures") +#define CRON_DESCRIPTION_LABEL _("Job scheduler log (cron)") +#define CUPS_DESCRIPTION_LABEL _("Log of work and calls to the print server (cups)") +#define DAEMONOLOG_DESCRIPTION_LABEL _("Log of operation and access to system services") +#define SAMBA_DESCRIPTION_LABEL _("Log of work and access to Samba") +#define POSTFIX_DESCRIPTION_LABEL _("Postfix mail server log") +#define SYSLOG_DESCRIPTION_LABEL _("System log") +#define XORG_DESCRIPTION_LABEL _("X.org display server log") +#define XSESSION_DESCRIPTION_LABEL _("Graphics X session log") //ubl-settings-logging-inspector.glade #define TOOLTIP_BOOT_LABEL _("Show messages since the current system boot") @@ -65,6 +80,10 @@ #define ALL_UNITS_LABEL _("Show a list of all units, ordered by the time of their initialisation") #define TREE_INIT_LABEL _("Show tree of time-critical initialization unit chain") #define UPDATE_LABEL _("Update") +#define DATE_LABEL _("Date") +#define HOSTNAME_LABEL _("Hostname") +#define PROCESS_LABEL _("Process") +#define LOG_LABEL _("Log") //ubl-settings-logging-journald.glade #define JOURNAL_DESCRIPTION_LABEL _("Description:") @@ -187,7 +206,7 @@ //ubl-settings-logging-add.glade #define ADD_PATHS_LABEL _("Path (-s):") #define CONTROL_LABEL _("Control:") -#define LOG_LABEL _("Log file") +#define LOG_FILE_LABEL _("Log file") #define NAME_LABEL _("Name:") //ubl-settings-logging-rules.glade diff --git a/source/ubl-utils.c b/source/ubl-utils.c index 66ed085..f121652 100644 --- a/source/ubl-utils.c +++ b/source/ubl-utils.c @@ -2,12 +2,6 @@ // dictionary functions -/**yon_dictionary_new(): - * [EN] - * Creates and returns empty dictionary - * [RU] - * Создаёт и возвращает пустой словарь. - */ dictionary *yon_dictionary_new() { dictionary *dict = malloc(sizeof(dictionary)); @@ -20,24 +14,12 @@ dictionary *yon_dictionary_new() return dict; } -/**yon_dictionary_copy(dictionary *dict) - * [EN] - * - * [RU] - * Создаёт и возвращает копию элемента словаря [dict] -*/ dictionary *yon_dictinoary_copy(dictionary *dict){ dictionary *dct = yon_dictionary_new_with_data(dict->key,dict->data); dct->data_type= dict->data_type; return dct; } -/**yon_dictionary_copy_deep(dictionary *dict) - * [EN] - * - * [RU] - * Создаёт полную копию словаря [dict] и возвращает первый элемент -*/ dictionary *yon_dictionary_copy_deep(dictionary *dict){ dictionary *dct = NULL; dictionary *newone=NULL; @@ -48,69 +30,33 @@ dictionary *yon_dictionary_copy_deep(dictionary *dict){ return newone->first; } -/**int yon_dictionary_set_data(dictionary *dict, void *data) - * [EN] - * - * [RU] - * Установить элементу словаря [dict] значение [data] -*/ int yon_dictionary_set_data(dictionary *dict, void *data){ dict->data=data; } -/**int yon_dictionary_set_key(dictionary *dict, char *key) - * [EN] - * - * [RU] - * Изменяет ключ элемента словаря [dict] на [key] -*/ int yon_dictionary_set_key(dictionary *dict, char *key){ dict->key=key; return 1; } -/** int yon_dictionary_set(dictionary *dict, char *key, void *data) - * [EN] - * - * [RU] -* Устанавливает значение ключа элемента словаря [dict] на [key] и его данные на [data] -*/ int yon_dictionary_set(dictionary *dict, char *key, void *data){ dict->key=key; dict->data=data; return 1; } -/**int yon_dictionary_empty(dictionary *dict) - * [EN] - * - * [RU] - * Очищает элемент словаря [dict] от данных -*/ int yon_dictionary_empty(dictionary *dict){ dict->data=NULL; dict->data_type=DICTIONARY_OTHER_TYPE; return 1; } -/**yon_dictionary_switch_to_last(dictionary **dict) - * [EN] - * - * [RU] - * Переключает словарь [dict] на последний элемент. -*/ void yon_dictionary_switch_to_last(dictionary **dict) { dictionary *dct=NULL, *dact=*dict; for_dictionaries(dct,dact); } -/**yon_dictionary_create_conneced(dictionary *targetdict) - * [EN] - * - * [RU] - * Создаёт новый элемент словаря [targetdict] -*/ dictionary *yon_dictionary_append(dictionary *targetdict) { targetdict = yon_dictionary_get_last(targetdict); @@ -121,14 +67,6 @@ dictionary *yon_dictionary_append(dictionary *targetdict) return targetdict->next; } -/**yon_dictionary_get_last(dictionary *dict) - * [EN] - * - * [RU] - * Возвращает последний элемент словаря [dict]. - * В отличае от yon_dictionary_switch_to_last() - * словарь [dict] остаётся на прежнем элементе. -*/ dictionary *yon_dictionary_get_last(dictionary *dict) { if (dict->next){ @@ -138,14 +76,6 @@ dictionary *yon_dictionary_get_last(dictionary *dict) } else return dict; } -/**yon_dictionary_switch_places(dictionary *dict, int aim) - * [EN] - * - * [RU] - * Меняет элемент словаря [dict] местами с другим элементом. - * если [aim]<0 элемент меняется местами с левым элементом; - * если [aim]>0 элемент меняется местами с правым элементом; -*/ dictionary *yon_dictionary_swap(dictionary *dict, int aim) { if (aim < 0) @@ -247,13 +177,6 @@ dictionary *yon_dictionary_swap(dictionary *dict, int aim) } } -/**yon_dictionary_make_first(dictionary *dict) - * [EN] - * - * [RU] - * Устанавливает указатель первого элемента словаря [dict] - * на текущий элемент. Не использовать. -*/ void yon_dictionary_make_first(dictionary *dict) { for (dictionary *dct = dict->first; dct != NULL; dct = dct->next) @@ -262,12 +185,6 @@ void yon_dictionary_make_first(dictionary *dict) } } -/**yon_dictionary_make_nth(dictionary *dict, int nth) - * [EN] - * - * [RU] - * Перемещает элемент словаря [dict] на позицию [nth]. -*/ void yon_dictionary_make_nth(dictionary *dict, int nth) { dictionary *dct = dict->first; @@ -286,12 +203,6 @@ void yon_dictionary_make_nth(dictionary *dict, int nth) dct->prev = dict; } -/**yon_dictionary_create_with_data(char *key, void *data) - * [EN] - * - * [RU] - * Создаёт новый словарь с ключом [key] и указателем на данные [data] -*/ dictionary *yon_dictionary_new_with_data(char *key, void *data) { dictionary *dct = yon_dictionary_new(); @@ -301,12 +212,6 @@ dictionary *yon_dictionary_new_with_data(char *key, void *data) return dct; } -/** void *yon_dictionary_free_all(dictionary *dictionary,void *data_manipulation) - * [EN] - * Frees whole [dictionary] and activates [data_manipulation] function if not NULL with [dictionary]->data argument for each dictionary. - * [RU] - * Освобождает память для всех элементов словаря [dictionary] и активирует функцию [data_manipulation], если она была передана, с аргументом [dictionary]->data на каждый элемент словаря. -*/ void *yon_dictionary_free_all(dictionary *dictionary_to_free,void (*data_manipulation)(void*)){ dictionary *dict=NULL; for_dictionaries(dict,dictionary_to_free){ @@ -319,13 +224,6 @@ void *yon_dictionary_free_all(dictionary *dictionary_to_free,void (*data_manipul return NULL; } -/**yon_dictionary_create_with_data_connected(dictionary *dict, char *key, void *data) - * [EN] - * - * [RU] - * Создаёт новый элемент словаря, присоединяемый в конец словаря [dict] - * с ключом [key] и указателем на данные [data] -*/ dictionary *yon_dictionary_append_with_data(dictionary *dict, char *key, void *data) { dictionary *dct = yon_dictionary_append(dict); @@ -335,12 +233,6 @@ dictionary *yon_dictionary_append_with_data(dictionary *dict, char *key, void *d return dct; } -/**yon_dictionary_connect(dictionary *old, dictionary *toconnect) - * [EN] - * - * [RU] - * Присоединяет словарь [toconnect] в конец словаря [old]. -*/ dictionary *yon_dictionary_connect(dictionary *old, dictionary *toconnect) { dictionary *dict = yon_dictionary_get_last(old); @@ -350,33 +242,29 @@ dictionary *yon_dictionary_connect(dictionary *old, dictionary *toconnect) return toconnect; } -/**yon_dictionary_get(dictionary **dict, char *key) - * [EN] - * - * [RU] - * Возвращает элемент словаря [dict] с ключом [key]. - * Если такого элемента не было обнаружено, возвращается NULL -*/ +dictionary *yon_dictionary_merge(dictionary *dict1,dictionary *dict2){ + dictionary *dct = NULL; + for_dictionaries(dct,dict2){ + if (!yon_dictionary_get(&dict1,dct->key)) + yon_dictionary_connect(dict1,dct); + } + return dict1; +} + dictionary *yon_dictionary_get(dictionary **dict, char *key) { dictionary *dct = *dict; - for (dictionary *pointer = dct->first; pointer != NULL; pointer = pointer->next) - { - if (strcmp(pointer->key, key) == 0) - { - *dict = pointer; - return pointer; + if (dct){ + for (dictionary *pointer = dct->first; pointer != NULL; pointer = pointer->next){ + if (pointer->key&&strcmp(pointer->key, key) == 0){ + *dict = pointer; + return pointer; + } } } return NULL; } -/**yon_dictionary_rip(dictionary *dict) - * [EN] - * - * [RU] - * Вырезает элемент из словаря и возвращает вырезанный элемент. -*/ dictionary *yon_dictionary_rip(dictionary *dict) { if (!dict->next&&!dict->prev) return NULL; @@ -412,12 +300,6 @@ dictionary *yon_dictionary_rip(dictionary *dict) } } -/**yon_dictionary_get_nth(dictionary *dict, int place) - * [EN] - * - * [RU] - * Возвращает [place]-й элемент словаря [dict] -*/ dictionary *yon_dictionary_get_nth(dictionary *dict, int place) { if (dict){ @@ -444,10 +326,6 @@ int yon_char_find_last(char *source, char find){ return i; } -/**[EN] - * - * creates new char string by combining two char strings. - */ char *yon_char_append(char *source, char *append) { if (source && append) @@ -465,10 +343,6 @@ char *yon_char_append(char *source, char *append) return NULL; } -/**[EN] - * - * creates new char string by copying another char. - */ char *yon_char_new(char *chr) { if (chr){ @@ -480,12 +354,6 @@ char *yon_char_new(char *chr) return NULL; } -/**yon_char_unite(char *source, ...) - * [En] - * - * [RU] - * Объединяет строку [source] со всеми строками, написанными в [...] -*/ char *yon_char_unite(char *source, ...){ va_list arglist; char *new_char=NULL; @@ -501,10 +369,6 @@ char *yon_char_unite(char *source, ...){ return new_char; } -/**yon_cut(char *source, int size, int startpos) - * [EN] - * cuts source string by size length from startpos position. - */ char *yon_cut(char *source, int size, int startpos) { char *cut = NULL; @@ -514,31 +378,22 @@ char *yon_cut(char *source, int size, int startpos) return cut; } -/**yon_char_divide(char *source, int dividepos) - * [EN] - * divides source string in dividepos position, - * returning left part of divided string and - * inserting right part to source string. - */ char *yon_char_divide(char *source, int dividepos) { - char *cut = malloc(dividepos + 1); - memset(cut, 0, dividepos + 1); - memcpy(cut, source, dividepos); - char *left = malloc(strlen(source) - strlen(cut)); - memset(left, 0, strlen(source) - strlen(cut)); - memcpy(left, source + dividepos + 1, (strlen(source) - dividepos)); - memset(source, 0, strlen(source)); - memcpy(source, left, strlen(left)); - return cut; + if (source){ + char *cut = malloc(dividepos + 1); + memset(cut, 0, dividepos + 1); + memcpy(cut, source, dividepos); + char *left = malloc(strlen(source) - strlen(cut)); + memset(left, 0, strlen(source) - strlen(cut)); + memcpy(left, source + dividepos + 1, (strlen(source) - dividepos)); + memset(source, 0, strlen(source)); + memcpy(source, left, strlen(left)); + return cut; + } + return NULL; } -/**yon_char_find_count(char *source, char *find) - * [EN] - * - * [RU] - * Считает количество символов [find] в строке [source] -*/ int yon_char_find_count(char *source, char *find){ char *working_string=yon_char_new(source); int i=0; @@ -549,28 +404,9 @@ int yon_char_find_count(char *source, char *find){ if(strstr(rtn[j],find)) i++; } - printf("%d\n",i); return i; } -/**yon_char_divide_search(char *source, char *dividepos, int delete_divider) - * [EN] - * char *yon_char_divide_search(char *source, char *dividepos, int delete_divider) - * searches string [dividepos] in [source] string and divides it, - * returning left part of divided string and - * inserting right part to [source] string. - * if [delete_divider] is 0, left part will contain [delete_divider] substring, else - * if [delete_divider] is 1 it will stay in right part, else - * if [delete_divider] is -1 it will be deleted from string. - * - * [RU] - * char *yon_char_divide_search(char *source, char *dividepos, int delete_divider) - * Ищет строку [dividepos] в строке [source] и делит её в этом месте, - * возвращая левую часть разделённой строки и устанавливает в [source] правую часть. - * Если [delete_divider] равен 0, [dividepos] останется в левой строке, иначе - * если [delete_divider] равен 1, [dividepos] останется в правой строке, иначе - * если [delete_divider] равен -1, [dividepos] удаляется из строки. - */ char *yon_char_divide_search(char *source, char *dividepos, int delete_divider) { if (source&÷pos){ @@ -585,15 +421,6 @@ char *yon_char_divide_search(char *source, char *dividepos, int delete_divider) return source; } -/**yon_char_from_int(int int_to_convert) - * [EN] - * char *yon_char_from_int(int int_to_convert) - * converts int to char*. - * - * [RU] - * char *yon_char_from_int(int int_to_convert) - * Конвертирует int в char* - */ char *yon_char_from_int(int int_to_convert) { int i = 1; @@ -602,18 +429,12 @@ char *yon_char_from_int(int int_to_convert) { convert_check = convert_check / 10; } - char *ch = g_malloc0(i * sizeof(char) + 1); + char *ch = malloc(i * sizeof(char) + 1); + memset(ch,0,i * sizeof(char) + 1); sprintf(ch, "%d", int_to_convert); return ch; } -/**yon_char_from_float(int int_to_convert) - * [EN] - * converts float to char*. - * - * [RU] - * Конвертирует float в char* - */ char *yon_char_from_float(float int_to_convert) { int i = 1; @@ -622,18 +443,12 @@ char *yon_char_from_float(float int_to_convert) { convert_check = convert_check / 10; } - char *ch = g_malloc0((i + 9)* sizeof(char)); + char *ch = malloc((i + 9)* sizeof(char)); + memset(ch,0,(i + 9)* sizeof(char)); sprintf(ch, "%.2f", int_to_convert); return ch; } -/**yon_char_from_long(int int_to_convert) - * [EN] - * converts long to char*. - * - * [RU] - * Конвертирует long в char* - */ char *yon_char_from_long(long int_to_convert) { int i = 1; @@ -642,17 +457,12 @@ char *yon_char_from_long(long int_to_convert) { convert_check = convert_check / 10; } - char *ch = g_malloc0(i * sizeof(char) + 1); + char *ch = malloc(i * sizeof(char) + 1); + memset(ch,0,i * sizeof(char) + 1); sprintf(ch, "%ld", int_to_convert); return ch; } -/**yon_char_replace(char *source, char *find, char*replace) - * [EN] - * - * [RU] - * Заменяет в строке [source] все вхождения строки [find] на [replace] -*/ char *yon_char_replace(char *source, char *find, char*replace){ if (!strstr(replace,find)){ @@ -673,12 +483,6 @@ char *yon_char_replace(char *source, char *find, char*replace){ return source; } -/**yon_char_parse(char *parameters, int *size, char *divider) - * [EN] - * Parses string [parameters], divided by [divider], - * then returns parsed string array and sets [size] to - * size of returned array -*/ char **yon_char_parse(char *parameters, int *size, char *divider){ if (parameters){ char **string=NULL; @@ -698,13 +502,6 @@ char **yon_char_parse(char *parameters, int *size, char *divider){ return NULL; } -/**yon_char_parsed_rip(char **char_string, int *size, int item_to_delete) - * [EN] - * - * [RU] - * Удаляет элемент [item_to_delete] из массива строк [char_string], размера [size] - * Возвращает получившийся массив, в [size] загружается размер нового массива. -*/ char **yon_char_parsed_rip(char **char_string, int *size, int item_to_delete){ char **new_char_parsed=NULL; new_char_parsed=malloc(sizeof(char*)*((*size)-1)); @@ -724,14 +521,6 @@ char **yon_char_parsed_rip(char **char_string, int *size, int item_to_delete){ return new_char_parsed; } -/**yon_char_parsed_check_exist(char **parameters, int size, char *param) - * [EN] - * Checks if [parameters] string array of length [size] - * has [param] element; - * [RU] - * Проверяет есть ли в массиве строк [parameters], размера [size] - * элемент [param] -*/ int yon_char_parsed_check_exist(char **parameters, int size, char *param){ for (int i=0;i0){ + int final_size=0; + config_str final = yon_char_parsed_new(&final_size,to_copy[0],NULL); + for (int i=1;i0&&size2>0){ + *final_size=0; + config_str parsed_final = yon_char_parsed_new(final_size,array1[0],NULL); + for (int i=1;i0&&size2>0){ + *final_size=0; + int new_size=0; + config_str parsed_final = yon_char_parsed_new(final_size,array1[0],NULL); + for (int i=1;i0){ + for (int i=0;i0){ + for (int i=0;i0){ + dictionary *dict = NULL; + for (int i=0;i0){ + dictionary *dict = NULL; + for (int i=0;i1024;*size=*size+1){ @@ -927,131 +747,121 @@ float yon_size_convert_automatic(int bytes, int *size){ return byte_float; } -apps *yon_apps_scan_and_parse_desktops(int *sizef) -{ - int size = 0; - struct apps *applist; - { - DIR *directory = opendir(DesktopPath); - struct dirent *de; - while ((de = readdir(directory))) - { - FILE *file; - char *path = yon_char_append(DesktopPath, de->d_name); - file = fopen(path, "r"); - if (strlen(de->d_name) > 9) - { - char *extension = strstr(path, "."); - if (extension != NULL) - { - if (strcmp(extension, ".desktop") == 0) - { - apps tempapp; - GKeyFile *gfile = g_key_file_new(); - GError *err = NULL; - g_key_file_load_from_file(gfile, path, G_KEY_FILE_KEEP_TRANSLATIONS, NULL); - char *Type = g_key_file_get_string(gfile, "Desktop Entry", "Type", &err); - if (err) - { - printf("%s\n", err->message); - } - if (strcmp(Type, "Application") == 0) - tempapp.Type = 1; - else if (strcmp(Type, "pyApplication") == 0) - tempapp.Type = 2; - else - continue; - tempapp.Name = g_key_file_get_locale_string(gfile, "Desktop Entry", "Name", setlocale(LC_ALL, NULL), NULL); - if (tempapp.Name == NULL) - continue; - tempapp.Categories = g_key_file_get_string(gfile, "Desktop Entry", "Categories", NULL); - if (tempapp.Categories == NULL) - continue; - tempapp.Exec = g_key_file_get_string(gfile, "Desktop Entry", "Exec", NULL); - if (tempapp.Exec == NULL) - continue; - tempapp.Icon = g_key_file_get_string(gfile, "Desktop Entry", "Icon", NULL); - if (tempapp.Icon == NULL) - continue; - tempapp.Pluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "Pluggable", NULL); - if (!tempapp.Pluggable) - tempapp.Pluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "X-XfcePluggable", NULL); - if (tempapp.Pluggable) - tempapp.DualPluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "X-UBLPluggable", NULL); - if (g_key_file_get_boolean(gfile, "Desktop Entry", "X-UBL-SettingsManager-Hidden", NULL) == 0) - if (size == 0) - { - applist = (apps *)malloc(size + 1 * sizeof(apps)); - applist[0].Name = yon_char_new(tempapp.Name); - applist[0].Categories = yon_char_new(tempapp.Categories); - applist[0].Exec = yon_char_new(tempapp.Exec); - applist[0].Icon = yon_char_new(tempapp.Icon); - applist[0].Type = tempapp.Type; - applist[0].Pluggable = tempapp.Pluggable; - applist[0].DualPluggable = tempapp.DualPluggable; - size++; - } - else - { - applist = (apps *)realloc(applist, (size + 1) * sizeof(apps)); - applist[size].Name = yon_char_new(tempapp.Name); - applist[size].Categories = yon_char_new(tempapp.Categories); - applist[size].Exec = yon_char_new(tempapp.Exec); - applist[size].Icon = yon_char_new(tempapp.Icon); - applist[size].Pluggable = tempapp.Pluggable; - applist[size].DualPluggable = tempapp.DualPluggable; - applist[size].Type = tempapp.Type; - size++; - } - } - } - } - } - } - *sizef = size; - return applist; -}; - -void yon_apps_sort(apps *applist, int size) -{ - apps tmp; - if (size > 2) - { - for (int i = 1; i < size; i++) - { - for (int j = 1; j < size; j++) - { - if (strcmp(applist[j].Name, applist[j - 1].Name) < 0) - { - tmp = applist[j]; - applist[j] = applist[j - 1]; - applist[j - 1] = tmp; - }; - } - }; - } -}; - -apps *yon_apps_get_by_name(apps *applist, char *name, int size) -{ - for (int i = 0; i < size; i++) - { - if (strcmp(applist[i].Name, name) == 0) - return &applist[i]; - } - return NULL; -}; +// apps *yon_apps_scan_and_parse_desktops(int *sizef) +// { +// int size = 0; +// struct apps *applist; +// { +// DIR *directory = opendir(DesktopPath); +// struct dirent *de; +// while ((de = readdir(directory))) +// { +// FILE *file; +// char *path = yon_char_append(DesktopPath, de->d_name); +// file = fopen(path, "r"); +// if (strlen(de->d_name) > 9) +// { +// char *extension = strstr(path, "."); +// if (extension != NULL) +// { +// if (strcmp(extension, ".desktop") == 0) +// { +// apps tempapp; +// GKeyFile *gfile = g_key_file_new(); +// GError *err = NULL; +// g_key_file_load_from_file(gfile, path, G_KEY_FILE_KEEP_TRANSLATIONS, NULL); +// char *Type = g_key_file_get_string(gfile, "Desktop Entry", "Type", &err); +// if (err) +// { +// printf("%s\n", err->message); +// } +// if (strcmp(Type, "Application") == 0) +// tempapp.Type = 1; +// else if (strcmp(Type, "pyApplication") == 0) +// tempapp.Type = 2; +// else +// continue; +// tempapp.Name = g_key_file_get_locale_string(gfile, "Desktop Entry", "Name", setlocale(LC_ALL, NULL), NULL); +// if (tempapp.Name == NULL) +// continue; +// tempapp.Categories = g_key_file_get_string(gfile, "Desktop Entry", "Categories", NULL); +// if (tempapp.Categories == NULL) +// continue; +// tempapp.Exec = g_key_file_get_string(gfile, "Desktop Entry", "Exec", NULL); +// if (tempapp.Exec == NULL) +// continue; +// tempapp.Icon = g_key_file_get_string(gfile, "Desktop Entry", "Icon", NULL); +// if (tempapp.Icon == NULL) +// continue; +// tempapp.Pluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "Pluggable", NULL); +// if (!tempapp.Pluggable) +// tempapp.Pluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "X-XfcePluggable", NULL); +// if (tempapp.Pluggable) +// tempapp.DualPluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "X-UBLPluggable", NULL); +// if (g_key_file_get_boolean(gfile, "Desktop Entry", "X-UBL-SettingsManager-Hidden", NULL) == 0) +// if (size == 0) +// { +// applist = (apps *)malloc(size + 1 * sizeof(apps)); +// applist[0].Name = yon_char_new(tempapp.Name); +// applist[0].Categories = yon_char_new(tempapp.Categories); +// applist[0].Exec = yon_char_new(tempapp.Exec); +// applist[0].Icon = yon_char_new(tempapp.Icon); +// applist[0].Type = tempapp.Type; +// applist[0].Pluggable = tempapp.Pluggable; +// applist[0].DualPluggable = tempapp.DualPluggable; +// size++; +// } +// else +// { +// applist = (apps *)realloc(applist, (size + 1) * sizeof(apps)); +// applist[size].Name = yon_char_new(tempapp.Name); +// applist[size].Categories = yon_char_new(tempapp.Categories); +// applist[size].Exec = yon_char_new(tempapp.Exec); +// applist[size].Icon = yon_char_new(tempapp.Icon); +// applist[size].Pluggable = tempapp.Pluggable; +// applist[size].DualPluggable = tempapp.DualPluggable; +// applist[size].Type = tempapp.Type; +// size++; +// } +// } +// } +// } +// } +// } +// *sizef = size; +// return applist; +// }; + +// void yon_apps_sort(apps *applist, int size) +// { +// apps tmp; +// if (size > 2) +// { +// for (int i = 1; i < size; i++) +// { +// for (int j = 1; j < size; j++) +// { +// if (strcmp(applist[j].Name, applist[j - 1].Name) < 0) +// { +// tmp = applist[j]; +// applist[j] = applist[j - 1]; +// applist[j - 1] = tmp; +// }; +// } +// }; +// } +// }; + +// apps *yon_apps_get_by_name(apps *applist, char *name, int size) +// { +// for (int i = 0; i < size; i++) +// { +// if (strcmp(applist[i].Name, name) == 0) +// return &applist[i]; +// } +// return NULL; +// }; - -/** - * yon_dir_get_contents(char *dir_path, int *size) - * [EN] - * - * [RU] - * Проверяет существует ли папка [dir_path] и - * возвращает список всех вложенных файлов и папок, - * передавая в [size] длину списка. -*/ config_str yon_dir_get_contents(char *dir_path, int *size){ config_str dir = NULL; *size=0; @@ -1059,8 +869,8 @@ config_str yon_dir_get_contents(char *dir_path, int *size){ DIR *directory = opendir(dir_path); struct dirent *de; while ((de = readdir(directory))){ - if (dir) yon_char_parsed_append(dir,size,de->d_name); - else dir = yon_char_parsed_new(size,de->d_name,NULL); + if (dir) dir = yon_char_parsed_append(dir,size,yon_char_new(de->d_name)); + else dir = yon_char_parsed_new(size,yon_char_new(de->d_name),NULL); } closedir(directory); } @@ -1105,17 +915,10 @@ yon_config_parameter *yon_config_parameter_append_with_data(yon_config_parameter static yon_config_parameter *__yon__config__strings = NULL; #define check_config if(__yon__config__strings&&__yon__config__strings->data_type==DICTIONARY_CHAR_TYPE) -#define for_config dictionary temp = NULL; for_dictionary(temp,(dictionary*)__yon__config__strings) +#define for_config dictionary *temp = NULL; for_dictionaries(temp,(dictionary*)__yon__config__strings) #define yon_config_parameter_add_or_create_if_exists_with_data(dict,key,data) {if (!dict) dict=yon_config_parameter_new_with_data(key,data); \ else dict=yon_config_parameter_append_with_data(dict,key,data);} -/**yon_config_load_register(char *command) - * [EN] - * - * [RU] - * Выполняет команду [command]. - * Полученные данные парсятся и регистрируются в конфиг. -*/ int yon_config_load_register(YON_CONFIG_TYPE config_type,char *section,char *parameter, ...){ if (__yon__config__strings){ __yon__config__strings = yon_dictionary_free_all((dictionary*)__yon__config__strings,NULL); @@ -1160,12 +963,6 @@ int yon_config_load_register(YON_CONFIG_TYPE config_type,char *section,char *par else return 0; } -/**yon_config_remove_by_key(char *key) - * [EN] - * - * [RU] - * Удаляет параметр конфига по ключу [key] -*/ int yon_config_remove_by_key(char *key){ check_config{ dictionary *dict = yon_dictionary_get((dictionary**)&__yon__config__strings,key); @@ -1177,12 +974,6 @@ int yon_config_remove_by_key(char *key){ return 0; } -/**yon_config_remove_element(char *key, char *deleted) - * [EN] - * - * [RU] - * Удаляет элемент [deleted] из массива параметров с ключом [key] -*/ int yon_config_remove_element(char *key, char *deleted){ check_config{ yon_config_parameter *dict = (yon_config_parameter*)yon_dictionary_get((dictionary**)&__yon__config__strings,key); @@ -1204,12 +995,14 @@ int yon_config_remove_element(char *key, char *deleted){ } else return 0; } -/**yon_config_get_by_key(char *key) - * [EN] - * - * [RU] - * Возвращает значение параметра конфига с ключом [key] -*/ +void yon_config_set_status(int status){ + check_config{ + for_config{ + ((yon_config_parameter*)temp)->flag1=status; + } + } +} + void *yon_config_get_by_key(char *key){ check_config{ dictionary *dict = NULL; @@ -1222,6 +1015,18 @@ void *yon_config_get_by_key(char *key){ return NULL; } +char *yon_config_get_section_for_key(char *key){ + check_config{ + for_config{ + if (!yon_char_is_empty(temp->key)){ + if (!strcmp(temp->key,key)){ + return yon_char_new(((yon_config_parameter*)temp)->section); + } + } + } + } +} + void *yon_config_get_all_by_key(char *key, int *size){ check_config{ config_str ret_data=NULL; @@ -1237,31 +1042,19 @@ void *yon_config_get_all_by_key(char *key, int *size){ } } -/**yon_config_get_key_by_data(char *data) - * [EN] - * - * [RU] - * Возвращает ключ параметра конфига со значением [data]. - * Если параметр с таким значением не найден, возвращается NULL -*/ -char *yon_config_get_key_by_data(char *data){ +config_str yon_config_get_all_keys(int *size){ check_config{ - dictionary *dict = NULL; - for_dictionaries(dict, (dictionary*)__yon__config__strings){ - if (strcmp(((char*)dict->data),data)==0){ - return dict->key; - } + *size=0; + config_str final = NULL; + for_config{ + if (!final) final = yon_char_parsed_new(size,temp->key,NULL); + else final = yon_char_parsed_append(final,size,temp->key); } + return final; } return NULL; } -/**yon_config_set(char *key, void *data) - * [EN] - * - * [RU] - * Производит поиск по конфигу и заменяет значение параметра с ключом [key] на новое значение [data]; -*/ int yon_config_set(char *key, void *data){ check_config{ yon_config_parameter *dict = (yon_config_parameter*)yon_dictionary_get((dictionary**)&__yon__config__strings,key); @@ -1271,13 +1064,6 @@ int yon_config_set(char *key, void *data){ } else return 0; } - -/**yon_config_append(char *key, void *data) - * [EN] - * - * [RU] - * Производит поиск по конфигу и дополняет значение параметра с ключом [key] значением [data]; -*/ int yon_config_append(char *key, char *data){ check_config{ yon_config_parameter *dict = (yon_config_parameter*)yon_dictionary_get((dictionary**)&__yon__config__strings,key); @@ -1289,13 +1075,6 @@ int yon_config_append(char *key, char *data){ } else return 0; } - -/**yon_config_clean() - * [EN] - * Erase all parameters from config; - * [RU] - * Удаляет все параметры из конфига; -*/ int yon_config_clean(){ check_config{ __yon__config__strings = (yon_config_parameter*)yon_dictionary_free_all((dictionary*)__yon__config__strings, NULL); @@ -1304,31 +1083,21 @@ int yon_config_clean(){ else return 0; } -/**yon_config_register(char *key, void *data) - * [EN] - * - * [RU] - * Регистрирует новый параметр конфига. - * [key] - ключ параметра; - * [data] - значение параметра; -*/ void yon_config_register(char *key, char *config_section, void *data){ if (!__yon__config__strings||!yon_dictionary_get((dictionary**)&__yon__config__strings,key)){ yon_config_parameter_add_or_create_if_exists_with_data(__yon__config__strings,key,data); + __yon__config__strings->flag1=1; + } + else if (yon_dictionary_get((dictionary**)&__yon__config__strings,key)){ + if (data!=__yon__config__strings->data&&strcmp(__yon__config__strings->data,data)){ + __yon__config__strings->data=data; + __yon__config__strings->flag1=1; + } } - else if (yon_dictionary_get((dictionary**)&__yon__config__strings,key)) __yon__config__strings->data=data; __yon__config__strings->data_type=DICTIONARY_CHAR_TYPE; - __yon__config__strings->flag1=1; __yon__config__strings->section=yon_char_new(config_section); } -/**yon_config_load(char *command, int *str_len) - * [EN] - * - * [RU] - * Выполняет команду [command] и возвращает распаршеный результат выполнения команды. - * В [str_len] возвращается длина возвращаемого массива -*/ config_str yon_config_load(char *command, int *str_len){ FILE *output = popen(command, "r"); char **output_strings = NULL; @@ -1356,18 +1125,6 @@ config_str yon_config_load(char *command, int *str_len){ } } -/**int yon_config_save_registered(char *path) - * [EN] - * Saves config at [path] config. - * [path] can be: - * system - * global - * [RU] - * Сохраняет конфигурацию в [path] конфиг. - * [path] может быть - * system - локальный конфиг - * global - глобальный конфиг -*/ int yon_config_save_registered(char *path){ check_config{ dictionary *dct; @@ -1401,18 +1158,6 @@ int yon_config_save_registered(char *path){ } else return 1; } -/**int yon_config_force_save_registered(char *path, char *section) - * [EN] - * Force config to save at [path] config ignoring parameter save status. - * [path] can be: - * system - * global - * [RU] - * Принудительно сохраняет конфигурацию в [path] конфиг игнорируя статус параметра. - * [path] может быть - * system - локальный конфиг - * global - глобальный конфиг -*/ int yon_config_force_save_registered(char *path){ check_config{ dictionary *dct; @@ -1445,13 +1190,6 @@ int yon_config_force_save_registered(char *path){ } else return 1; } -/**yon_config_get_all(int *size) - * [EN] - * - * [RU] - * Возвращает массив со всеми параметрами конфига, оканчивающаяся NULL - * [size] - указатель, в который выгружается длина массива -*/ config_str yon_config_get_all(int *size){ check_config{ *size = 1; @@ -1469,14 +1207,6 @@ config_str yon_config_get_all(int *size){ } else return NULL; } -/**char *yon_config_get_parameter(config parameters, int size, char *param) - * [EN] - * Gets parameter [param] from parameter list [parameters] of size [size]; - * or NULL if nothing were found - * [RU] - * Возвращает параметр [param] из массива строк [parameters] размером [size] - * или NULL если такой не был найден -*/ char *yon_config_get_parameter(config_str parameters, int size, char *param) { if (param[0]==' ') @@ -1515,13 +1245,6 @@ config_str yon_file_open(char *file_path, int *size){ } } -/**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); @@ -1542,13 +1265,6 @@ int yon_file_create(char *path, char *name, int rules){ } } -/**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)){ @@ -1570,12 +1286,6 @@ int yon_file_create_full_path(char *path, int rules){ // terminal-using functions -/**yon_launch_app_with_arguments(char *name, char *args) - * [EN] - * Execute [command] in separate thread; - * [RU] - * Выполнить команду [command] в отдельном потоке; -*/ int yon_launch_app_with_arguments(char *name, char *args) { char *path = yon_char_unite("/usr/bin/", name, " ", args,NULL); @@ -1585,26 +1295,17 @@ int yon_launch_app_with_arguments(char *name, char *args) pthread_create(&thread_id, NULL, (void *)yon_launch, command); }; -/**yon_launch(char *command) - * [EN] - * Execute command [command] - * [RU] - * Выполнить команду [command] -*/ void yon_launch(char *command) { system(command); } -// Gtk functions -#ifdef __GTK_H__ -static render_data render; -#ifdef VTE_TERMINAL +static render_data render; static void child_ready(VteTerminal *terminal, GPid pid, GError *error, gpointer user_data) { @@ -1613,17 +1314,6 @@ static void child_ready(VteTerminal *terminal, GPid pid, GError *error, gpointer else vte_terminal_feed_child(VTE_TERMINAL(terminal),(char*)user_data,strlen((char*)user_data)); } -/** - * void yon_terminal_integrated_launch(GtkWidget *place_to_show, void *endwork_function, void* endwork_function_argument) - * [EN] - * launches terminal with specific [command], - * terminal is shown in [place_to_show] container, - * after terminal done its work [endwork_function] is called with [endwork_function_argument] argument. - * [RU] - * Запускает терминал с командой [command], - * терминал добавляется в контейнер [place_to_show] виджета, - * после завершения работы терминала вызывается функция [endwork_function] с аргументом [endwork_function_argument]. -*/ void yon_terminal_integrated_launch(GtkWidget *place_to_show, char* command, void *endwork_function, void* endwork_function_argument){ char **commands=new_arr(char*,2); gchar **envp = g_get_environ(); @@ -1669,16 +1359,6 @@ void yon_terminal_integrated_launch(GtkWidget *place_to_show, char* command, voi gtk_widget_show_all(terminal); } -/**yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *endwork_function, void* endwork_function_argument) - * [EN] - * launches terminal with specific [command], - * terminal is shown in [place_to_show] container, - * after terminal done its work [endwork_function] is called with [endwork_function_argument] argument. - * [RU] - * Запускает терминал с командой [command], - * терминал добавляется в контейнер [place_to_show] виджета, - * после завершения работы терминала вызывается функция [endwork_function] с аргументом [endwork_function_argument]. -*/ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *endwork_function, void* endwork_function_argument){ char **commands=new_arr(char*,2); gchar **envp = g_get_environ(); @@ -1721,7 +1401,6 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end vte_terminal_set_scroll_on_keystroke(VTE_TERMINAL(terminal), TRUE); gtk_widget_show_all(terminal); } -#endif // Window config functions @@ -1836,12 +1515,6 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end } } - /**yon_window_config_setup(GtkWindow *window) - * [EN] - * - * [RU] - * Устанавливает указатель на окно для отслеживания его положения и размера - */ void yon_window_config_setup(GtkWindow *window){ __yon_window_config_target_window = window; g_signal_connect(G_OBJECT(window),"delete-event",G_CALLBACK(yon_on_configured_window_destroy),NULL); @@ -1853,12 +1526,6 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end if(__yon_main_window_config.fullscreen ==1) gtk_window_maximize(__yon_window_config_target_window); } - /**yon_window_config_load(char *path) - * [EN] - * - * [RU] - * Загружает конфиг окна и инициализирует отслеживание его параметров - */ int yon_window_config_load(char *path){ __yon_window_config_file = g_key_file_new(); __yon_window_config_path=yon_char_new(path); @@ -1922,12 +1589,6 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end return key; } - /**yon_window_config_add_custom_parameter(GtkWidget *widget, char *param_name, char *widget_property) - * [EN] - * - * [RU] - * Добавляет параметр виджета [widget] по названию [widget_property] для отслеживания и сохраняет его в конфиг под ключом [param_name]. - */ void yon_window_config_add_listener(GtkWidget *widget, char *param_name, char *widget_property, enum YON_TYPE val_type){ __yon_listener_parameter *param = NULL; param = yon_remalloc(param,sizeof(__yon_listener_parameter)); @@ -2104,12 +1765,6 @@ GtkWidget *yon_ubl_menu_item_documentation_new(char *buttonname){ // other Gtk functions -/**yon_gtk_combo_box_fill(GtkWidget *combo, config_str parameters,int size) - * [EN] - * - * [RU] - * Добавляет в Комбобокс [combo] все строки из массива строк [parameters] размера [size] -*/ int yon_gtk_combo_box_fill(GtkWidget *combo, config_str parameters,int size){ if (combo&¶meters){ for (int i=0;i-1){ gtk_widget_hide(gtk_widget_get_toplevel(main_window)); @@ -2442,14 +2054,6 @@ void yon_ubl_setup_sockets(GtkWidget *main_window, GtkWidget *left_window, GtkWi } } -#ifdef WEBKIT_FOUND - -/**yon_ubl_browser_window_open(char *link, char *browser_window_name) - * [EN] - * Launches integrated browser window, named [browser_window_name] at header with [link]. - * [RU] - * Открывает встроенный браузер с именем [browser_window_name] и показываемой страницей по ссылке [link] -*/ void yon_ubl_browser_window_open(char *link, char *browser_window_name){ GtkWidget *browser=gtk_window_new(GTK_WINDOW_TOPLEVEL); GtkWidget *web_place=gtk_box_new(GTK_ORIENTATION_VERTICAL,0); @@ -2465,24 +2069,4 @@ void yon_ubl_browser_window_open(char *link, char *browser_window_name){ webkit_web_view_load_uri(WEBKIT_WEB_VIEW(WebView),link); gtk_box_pack_start(GTK_BOX(web_place),WebView,1,1,0); gtk_widget_show_all(browser); -} -#else - -/**yon_ubl_browser_window_open(char *link, char *browser_window_name) - * [EN] - * Launches browser with [link]. - * [browser_window_name] is't used. It's needed for compatibility with webkit version of that function. - * [RU] - * Открывает браузер со страницей по ссылке [link] - * [browser_window_name] не используется. Нужна для совместимости с webkit версией этой функции. -*/ -void yon_ubl_browser_window_open(char *link, char *browser_window_name){ - char *user=getenv("SUDO_USER"); - if (!user) - user=getlogin(); - char *command=yon_char_unite("sudo -u ",user," xdg-open ", link,NULL); - yon_launch_app(command); -} -#endif - -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/source/ubl-utils.h b/source/ubl-utils.h index 2fef789..ba77a7c 100644 --- a/source/ubl-utils.h +++ b/source/ubl-utils.h @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -23,7 +24,13 @@ #endif #define DesktopPath "/usr/share/applications/" -#define for_dictionaries(obj, obj1) for (obj = obj1->first; obj != NULL; obj = obj->next) +/**for_dictionaries(element, stack) + * [EN] + * + * [RU] + * Работает как for, но нужен для перечисления элементов словаря типа dictioary [stack]. Каждый цикл текущий элемент попадает в [element] +*/ +#define for_dictionaries(element, stack) for (element = stack->first; element != NULL; element = element->next) #define new(type) malloc(sizeof(type)) #define new_arr(type,size) malloc(sizeof(type)*size) @@ -32,9 +39,7 @@ typedef enum { - #ifdef __GTK_H__ DICTIONARY_GTK_WIDGETS_TYPE, - #endif DICTIONARY_OTHER_TYPE=0, DICTIONARY_CHAR_TYPE, DICTIONARY_INT_TYPE, @@ -42,6 +47,15 @@ typedef enum } DICT_TYPE; +/** + * Структура именованого списка. + * [key] - ключ элемента + * [data] - хранимое значение + * [next] - следующий элемент списка + * [prev] - предыдущий элемент списка + * [first] - первый элемент списка + * [data_type] - Тип значения в словаре +*/ typedef struct dictionary { char *key; @@ -68,6 +82,9 @@ typedef struct apps typedef char** config_str; +/**config(key) + * Возвращает элемент конфигурации ubconfig с ключом [key] или NULL если такого нет +*/ #define config(key) yon_config_get_by_key(key) #define yon_remalloc(pointer, size) (!pointer) ? malloc(size) : realloc(pointer, size) @@ -95,30 +112,173 @@ typedef char** config_str; #define yon_dictionary_add_or_create_if_exists_with_data(dict,key,data) {if (!dict) dict=yon_dictionary_new_with_data(key,data); \ else dict=yon_dictionary_append_with_data(dict,key,data);} +/**yon_dictionary_new(): + * [EN] + * Creates and returns empty dictionary + * [RU] + * Создаёт и возвращает пустой словарь. + */ dictionary *yon_dictionary_new(); +/**yon_dictionary_copy(dictionary *dict) + * [EN] + * + * [RU] + * Создаёт и возвращает копию элемента словаря [dict] +*/ +dictionary *yon_dictinoary_copy(dictionary *dict); + +/**yon_dictionary_copy_deep(dictionary *dict) + * [EN] + * + * [RU] + * Создаёт полную копию словаря [dict] и возвращает первый элемент +*/ +dictionary *yon_dictionary_copy_deep(dictionary *dict); + +/**int yon_dictionary_set_data(dictionary *dict, void *data) + * [EN] + * + * [RU] + * Установить элементу словаря [dict] значение [data] +*/ +int yon_dictionary_set_data(dictionary *dict, void *data); + +/**int yon_dictionary_set_key(dictionary *dict, char *key) + * [EN] + * + * [RU] + * Изменяет ключ элемента словаря [dict] на [key] +*/ +int yon_dictionary_set_key(dictionary *dict, char *key); + +/** int yon_dictionary_set(dictionary *dict, char *key, void *data) + * [EN] + * + * [RU] +* Устанавливает значение ключа элемента словаря [dict] на [key] и его данные на [data] +*/ +int yon_dictionary_set(dictionary *dict, char *key, void *data); + +/**int yon_dictionary_empty(dictionary *dict) + * [EN] + * + * [RU] + * Очищает элемент словаря [dict] от данных +*/ +int yon_dictionary_empty(dictionary *dict); + +/**yon_dictionary_switch_to_last(dictionary **dict) + * [EN] + * + * [RU] + * Переключает словарь [dict] на последний элемент. +*/ +void yon_dictionary_switch_to_last(dictionary **dict); + +/**yon_dictionary_create_conneced(dictionary *targetdict) + * [EN] + * + * [RU] + * Создаёт новый элемент словаря [targetdict] +*/ dictionary *yon_dictionary_append(dictionary *targetdict); +/**yon_dictionary_get_last(dictionary *dict) + * [EN] + * + * [RU] + * Возвращает последний элемент словаря [dict]. + * В отличае от yon_dictionary_switch_to_last() + * словарь [dict] остаётся на прежнем элементе. +*/ dictionary *yon_dictionary_get_last(dictionary *dict); +/**yon_dictionary_switch_places(dictionary *dict, int aim) + * [EN] + * + * [RU] + * Меняет элемент словаря [dict] местами с другим элементом. + * если [aim]<0 элемент меняется местами с левым элементом; + * если [aim]>0 элемент меняется местами с правым элементом; +*/ dictionary *yon_dictionary_swap(dictionary *dict, int aim); +/**yon_dictionary_make_first(dictionary *dict) + * [EN] + * + * [RU] + * Устанавливает указатель первого элемента словаря [dict] + * на текущий элемент. Не использовать. +*/ void yon_dictionary_make_first(dictionary *dict); +/**yon_dictionary_make_nth(dictionary *dict, int nth) + * [EN] + * + * [RU] + * Перемещает элемент словаря [dict] на позицию [nth]. +*/ void yon_dictionary_make_nth(dictionary *dict, int nth); +/**yon_dictionary_create_with_data(char *key, void *data) + * [EN] + * + * [RU] + * Создаёт новый словарь с ключом [key] и указателем на данные [data] +*/ dictionary *yon_dictionary_new_with_data(char *key, void *data); +/**yon_dictionary_create_with_data_connected(dictionary *dict, char *key, void *data) + * [EN] + * + * [RU] + * Создаёт новый элемент словаря, присоединяемый в конец словаря [dict] + * с ключом [key] и указателем на данные [data] +*/ dictionary *yon_dictionary_append_with_data(dictionary *dict, char *key, void *data); +/**yon_dictionary_connect(dictionary *old, dictionary *toconnect) + * [EN] + * + * [RU] + * Присоединяет словарь [toconnect] в конец словаря [old]. +*/ dictionary *yon_dictionary_connect(dictionary *old, dictionary *toconnect); +dictionary *yon_dictionary_merge(dictionary *dict1,dictionary *dict2); + +/**yon_dictionary_get(dictionary **dict, char *key) + * [EN] + * + * [RU] + * Возвращает элемент словаря [dict] с ключом [key]. + * Если такого элемента не было обнаружено, возвращается NULL +*/ dictionary *yon_dictionary_get(dictionary **dict, char *key); +/**yon_dictionary_rip(dictionary *dict) + * [EN] + * + * [RU] + * Вырезает элемент из словаря и возвращает вырезанный элемент. +*/ dictionary *yon_dictionary_rip(dictionary *dict); +/**yon_dictionary_get_nth(dictionary *dict, int place) + * [EN] + * + * [RU] + * Возвращает [place]-й элемент словаря [dict] +*/ dictionary *yon_dictionary_get_nth(dictionary *dict, int place); +/** void *yon_dictionary_free_all(dictionary *dictionary,void *data_manipulation) + * [EN] + * Frees whole [dictionary] and activates [data_manipulation] function if not NULL with [dictionary]->data argument for each dictionary. + * [RU] + * Освобождает память для всех элементов словаря [dictionary] и активирует функцию [data_manipulation], если она была передана, с аргументом [dictionary]->data на каждый элемент словаря. +*/ void *yon_dictionary_free_all(dictionary *dictionary,void (data_manipulation)(void*)); // char functions @@ -129,72 +289,296 @@ void *yon_dictionary_free_all(dictionary *dictionary,void (data_manipulation)(vo int yon_char_find_last(char *source, char find); +/**[EN] + * + * creates new char string by combining two char strings. + */ char *yon_char_append(char *source, char *append); +/**[EN] + * + * creates new char string by copying another char. + */ char *yon_char_new(char *chr); +/**yon_char_unite(char *source, ...) + * [En] + * + * [RU] + * Объединяет строку [source] со всеми строками, написанными в [...]. Последний элемент должен быть NULL +*/ char *yon_char_unite(char *source, ...); +/**yon_cut(char *source, int size, int startpos) + * [EN] + * cuts source string by size length from startpos position. + */ char *yon_cut(char *source, int size, int startpos); +/**yon_char_divide(char *source, int dividepos) + * [EN] + * divides source string in dividepos position, + * returning left part of divided string and + * inserting right part to source string. + */ char *yon_char_divide(char *source, int dividepos); +/**yon_char_divide_search(char *source, char *dividepos, int delete_divider) + * [EN] + * char *yon_char_divide_search(char *source, char *dividepos, int delete_divider) + * searches string [dividepos] in [source] string and divides it, + * returning left part of divided string and + * inserting right part to [source] string. + * if [delete_divider] is 0, left part will contain [delete_divider] substring, else + * if [delete_divider] is 1 it will stay in right part, else + * if [delete_divider] is -1 it will be deleted from string. + * + * [RU] + * char *yon_char_divide_search(char *source, char *dividepos, int delete_divider) + * Ищет строку [dividepos] в строке [source] и делит её в этом месте, + * возвращая левую часть разделённой строки и устанавливает в [source] правую часть. + * Если [delete_divider] равен 0, [dividepos] останется в левой строке, иначе + * если [delete_divider] равен 1, [dividepos] останется в правой строке, иначе + * если [delete_divider] равен -1, [dividepos] удаляется из строки. + */ char *yon_char_divide_search(char *source, char *dividepos, int delete_divider); +/**yon_char_from_int(int int_to_convert) + * [EN] + * char *yon_char_from_int(int int_to_convert) + * converts int to char*. + * + * [RU] + * char *yon_char_from_int(int int_to_convert) + * Конвертирует int в char* + */ char *yon_char_from_int(int int_to_convert); +/**yon_char_from_float(int int_to_convert) + * [EN] + * converts float to char*. + * + * [RU] + * Конвертирует float в char* + */ char *yon_char_from_float(float int_to_convert); +/**yon_char_from_long(int int_to_convert) + * [EN] + * converts long to char*. + * + * [RU] + * Конвертирует long в char* + */ char *yon_char_from_long(long int_to_convert); +/**yon_char_replace(char *source, char *find, char*replace) + * [EN] + * + * [RU] + * Заменяет в строке [source] все вхождения строки [find] на [replace] +*/ char *yon_char_replace(char *source, char *find, char*replace); +/**yon_char_parse(char *parameters, int *size, char *divider) + * [EN] + * Parses string [parameters], divided by [divider], + * then returns parsed string array and sets [size] to + * size of returned array +*/ char **yon_char_parse(char *parameters, int *size, char *divider); +#define yon_char_parsed_add_or_create_if_exists(parsed,size,data) {if (!parsed) parsed = yon_char_parsed_new(size,data,NULL);\ + else parsed = yon_char_parsed_append(parsed,size,data);} + +/**yon_char_parsed_rip(char **char_string, int *size, int item_to_delete) + * [EN] + * + * [RU] + * Удаляет элемент [item_to_delete] из массива строк [char_string], размера [size] + * Возвращает получившийся массив, в [size] загружается размер нового массива. +*/ char **yon_char_parsed_rip(char **char_string, int *size, int item_to_delete); +/**yon_char_parsed_check_exist(char **parameters, int size, char *param) + * [EN] + * Checks if [parameters] string array of length [size] + * has [param] element; + * [RU] + * Проверяет есть ли в массиве строк [parameters], размера [size] + * элемент [param] +*/ int yon_char_parsed_check_exist(char **parameters, int size, char *param); +/**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); +/**yon_char_find_count(char *source, char *find) + * [EN] + * + * [RU] + * Считает количество символов [find] в строке [source] +*/ int yon_char_find_count(char *source, char *find); +/**yon_char_parsed_includes_char_parsed (config_str source, config_str to_check, int source_size, int check_size) + * [EN] + * + * [RU] + * Проверяет, включает ли в себя [source] размера [source_size] + * массив строк [to_check] размера [check_size] +*/ int yon_char_parsed_includes_char_parsed (config_str source, config_str to_check, int source_size, int check_size); +/**yon_char_parsed_new (config_str old, int *old_size, ...) + * [EN] + * + * [RU] + * Создаёт новый массив строк. В [size] выгружается его размер + * [...] - неограниченное количество строк. +*/ config_str yon_char_parsed_new (int *size, ...); void yon_char_parsed_free(config_str source, int size); -void yon_char_parsed_copy(config_str *source, config_str *to_copy); +/**config_str yon_char_parsed_copy(config_str to_copy, int size) + * [EN] + * + * [RU] + * Возвращает копию массива строк [to_copy] размера [size] +*/ +config_str yon_char_parsed_copy(config_str to_copy, int size); +/**config_str yon_char_parsed_append(config_str parsed, int *size, char *string) + * [EN] + * Adds [string] at the end of [parsed] string array of [size] length. + * [RU] + * Добавляет строку [string] в конец массива строк [parsed] с длинной [size]. +*/ config_str yon_char_parsed_append(config_str parsed, int *size, char *string); +/**yon_char_parsed_merge(config_str array1, int size1, config_str array2, int size2, int *final_size) + * [EN] + * + * [RU] + * Объединяет два массива строк в один. + * [array1] - первый массив строк размера [size1] + * [array2] - второй массив строк размера [size2] + * [final_size] - указатель на целочисленную переменную в которую должен вернуться размер нового массива +*/ +config_str yon_char_parsed_merge(config_str array1, int size1, config_str array2, int size2, int *final_size); + +/**yon_char_parsed_merge_no_repeats(config_str array1, int size1, config_str array2, int size2, int *final_size) + * [EN] + * + * [RU] + * Объединяет два массива строк в один с предотвращением дублей. + * [array1] - первый массив строк размера [size1] + * [array2] - второй массив строк размера [size2] + * [final_size] - указатель на целочисленную переменную в которую должен вернуться размер нового массива +*/ +config_str yon_char_parsed_merge_no_repeats(config_str array1, int size1, config_str array2, int size2, int *final_size); + +int yon_char_parsed_divide_full(config_str parsed,int size,int divide_pos); + +int yon_char_parsed_divide_search_full(config_str parsed,int size,char *divide_pos, int delete_divider); + +dictionary *yon_char_parsed_convert_to_dictionary(config_str parsed, int size); + +dictionary *yon_char_parsed_convert_copy_to_dictionary(config_str parsed, int size); + +/**yon_ubl_check_root() + * [EN] + * + * [RU] + * Возвращает 1 если приложение было запущено от root +*/ int yon_ubl_check_root(); +/**yon_ubl_root_user_get() + * [EN] + * + * [RU] + * Возвращает имя пользователя. + * Если пользователь запустил приложение через root, выводится имя пользователя, запустившего приложение через root +*/ char *yon_ubl_root_user_get(); +/** yon_ubl_user_get_home_directory() + * [EN] + * + * [RU] + * Возвращает домашний каталог пользователя. + * Если пользователь открыл утилиту с правами суперпользователя, всё равно возвращает каталог пользователя, а не root +*/ char *yon_ubl_user_get_home_directory(); +/** yon_ubl_get_all_users(int *user_size) + * [EN] + * + * [RU] + * Возвращает массив всех пользователей в системе и записывает его размер в [user_size] +*/ config_str yon_ubl_get_all_users(int *user_size); // parsing functions +/** yon_size_convert_automatic(int bytes, int *size) + * [EN] + * + * [RU] + * Делит число [bytes] на 1024 пока оно не станет меньше 1024. + * Возвращает получившееся число и устанавливает [size] равным количеству делений. +*/ float yon_size_convert_automatic(int bytes, int *size); -config_str philos_list_user(int* size); - apps *yon_apps_scan_and_parse_desktops(int *sizef); void yon_apps_sort(apps *applist, int size); apps *yon_apps_get_by_name(apps *applist, char *name, int size); +/**yon_file_open(char *file_path, int *size) + * [EN] + * + * [RU] + * Открывает файл [file_path], возвращает содержимое в виде массива строк размера [size] +*/ config_str yon_file_open(char *file_path, int *size); +/**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); +/**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); +/** yon_dir_get_contents(char *dir_path, int *size) + * [EN] + * + * [RU] + * Проверяет существует ли папка [dir_path] и + * возвращает список всех вложенных файлов и папок, + * передавая в [size] длину списка. +*/ config_str yon_dir_get_contents(char *dir_path, int *size); //config functions @@ -202,121 +586,417 @@ config_str yon_dir_get_contents(char *dir_path, int *size); #define ubconfig_save_command "ubconfig" #define ubconfig_load_command "ubconfig --source" +/** + * Типы конфигураций ubconfig-а +*/ typedef enum { YON_CONFIG_LOCAL=0, YON_CONFIG_GLOBAL, YON_CONFIG_BOTH } YON_CONFIG_TYPE; +/**yon_config_load(char *command, int *str_len) + * [EN] + * + * [RU] + * Выполняет команду [command] и возвращает результат выполнения команды, разделяя на строки. + * В [str_len] возвращается длина возвращаемого массива +*/ config_str yon_config_load(char *command, int *str_len); +/**int yon_config_save_registered(char *path) + * [EN] + * Saves config at [path] config. + * [path] can be: + * system + * global + * [RU] + * Сохраняет конфигурацию в [path] конфиг. + * [path] может быть + * system - локальный конфиг + * global - глобальный конфиг +*/ int yon_config_save_registered(char *path); -int yon_config_force_save_registered(char *path); - +/**char *yon_config_get_parameter(config parameters, int size, char *param) + * [EN] + * Gets parameter [param] from parameter list [parameters] of size [size]; + * or NULL if nothing were found + * [RU] + * Возвращает параметр [param] из массива строк [parameters] размером [size] + * или NULL если такой не был найден +*/ char *yon_config_get_parameter(config_str parameters, int size, char *param); +/**yon_config_load_register(char *command) + * [EN] + * + * [RU] + * Выполняет команду [command]. + * Полученные данные парсятся и регистрируются в конфиг. +*/ int yon_config_load_register(YON_CONFIG_TYPE config_type,char *section,char *parameter, ...); +/**yon_config_remove_by_key(char *key) + * [EN] + * + * [RU] + * Удаляет параметр конфига по ключу [key] +*/ int yon_config_remove_by_key(char *key); -int yon_config_remove_by_data(void *data); - +/**yon_config_remove_element(char *key, char *deleted) + * [EN] + * + * [RU] + * Удаляет элемент [deleted] из массива параметров с ключом [key] +*/ int yon_config_remove_element(char *key, char *deleted); +void yon_config_set_status(int status); + +/**yon_config_get_key_by_key(char *data) + * [EN] + * + * [RU] + * Возвращает значение параметра конфига с ключом [key]. + * Если параметр с таким значением не найден, возвращается NULL +*/ void *yon_config_get_by_key(char *key); +char *yon_config_get_section_for_key(char *key); + +/**yon_config_get_all_by_key(char *data) + * [EN] + * + * [RU] + * Возвращает значение всех параметров конфига с ключом включающем строку [key]. + * Если параметр с таким значением не найден, возвращается NULL +*/ void *yon_config_get_all_by_key(char *key, int *size); -char *yon_config_get_key_by_data(char *data); +/**yon_config_get_all_keys(int *size) + * [EN] + * + * [RU] + * Возвращает массив с ключами всех параметров внутреннего конфига +*/ +config_str yon_config_get_all_keys(int *size); +/**yon_config_set(char *key, void *data) + * [EN] + * + * [RU] + * Производит поиск по конфигу и заменяет значение параметра с ключом [key] на новое значение [data]; +*/ int yon_config_set(char *key, void *data); +/**yon_config_append(char *key, void *data) + * [EN] + * + * [RU] + * Производит поиск по конфигу и дополняет значение параметра с ключом [key] значением [data]; +*/ +int yon_config_append(char *key, char *data); + +/**yon_config_clean() + * [EN] + * Erase all parameters from config; + * [RU] + * Удаляет все параметры из конфига; +*/ int yon_config_clean(); +/**yon_config_register(char *key, void *data) + * [EN] + * + * [RU] + * Регистрирует новый параметр конфига. + * [key] - ключ параметра; + * [data] - значение параметра; +*/ void yon_config_register(char *key, char* config_section, void *data); -config_str yon_config_get_all(); +/**int yon_config_force_save_registered(char *path, char *section) + * [EN] + * Force config to save at [path] config ignoring parameter save status. + * [path] can be: + * system + * global + * [RU] + * Принудительно сохраняет конфигурацию в [path] конфиг игнорируя статус параметра. + * [path] может быть + * system - локальный конфиг + * global - глобальный конфиг +*/ +int yon_config_force_save_registered(char *path); + +/**yon_config_get_all(int *size) + * [EN] + * + * [RU] + * Возвращает массив со всеми параметрами конфига, оканчивающаяся NULL + * [size] - указатель, в который выгружается длина массива +*/ +config_str yon_config_get_all(int *size); // terminal-using functions +/**yon_launch_app_with_arguments(char *name, char *args) + * [EN] + * Execute [command] in separate thread; + * [RU] + * Выполнить команду [command] в отдельном потоке; +*/ int yon_launch_app_with_arguments(char *name, char *args); +/**yon_launch(char *command) + * [EN] + * Execute command [command] + * [RU] + * Выполнить команду [command] +*/ void yon_launch(char *command); -// Gtk functions - #ifdef __GTK_H__ -#ifdef VTE_TERMINAL +/** + * void yon_terminal_integrated_launch(GtkWidget *place_to_show, void *endwork_function, void* endwork_function_argument) + * [EN] + * launches terminal with specific [command], + * terminal is shown in [place_to_show] container, + * after terminal done its work [endwork_function] is called with [endwork_function_argument] argument. + * [RU] + * Запускает терминал с командой [command], + * терминал добавляется в контейнер [place_to_show] виджета, + * после завершения работы терминала вызывается функция [endwork_function] с аргументом [endwork_function_argument]. +*/ void yon_terminal_integrated_launch(GtkWidget *place_to_show, char* command, void *endwork_function, void* endwork_function_argument); +/**yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *endwork_function, void* endwork_function_argument) + * [EN] + * launches terminal with specific [command], + * terminal is shown in [place_to_show] container, + * after terminal done its work [endwork_function] is called with [endwork_function_argument] argument. + * [RU] + * Запускает терминал с командой [command], + * терминал добавляется в контейнер [place_to_show] виджета, + * после завершения работы терминала вызывается функция [endwork_function] с аргументом [endwork_function_argument]. +*/ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *endwork_function, void* endwork_function_argument); -#endif - +/**YON_TYPE + * [EN] + * + * [RU] + * Типы, поддерживаемые функциями сохранения/загрузки конфигурации утилиты +*/ enum YON_TYPE{ YON_TYPE_STRING, YON_TYPE_STRING_LIST, YON_TYPE_INT, YON_TYPE_BOOLEAN, - YON_TYPE_OTHER -}; - -GtkWidget *yon_ubl_menu_item_about_new(char *buttonname); -GtkWidget *yon_ubl_menu_item_documentation_new(char *buttonname); + YON_TYPE_OTHER}; /**yon_gtk_builder_get_widget(builder, widget_name) * [EN] * Returns GtkWidget from GtkBuilder *[builder]. * [builder] is GtkBuilder*; * [widget_name] is id of widget; + * [RU] + * Возвращает виджет GtkWidget c id [widget_name] из [builder] */ #define yon_gtk_builder_get_widget(builder, widget_name) GTK_WIDGET(gtk_builder_get_object(builder, widget_name)) -typedef struct -{ - GtkWidget *Icon; - GtkWidget *Label; - GtkWidget *IconView; - GtkListStore *List; -} expander_icon_view; - +/**yon_window_config_setup(GtkWindow *window) + * [EN] + * + * [RU] + * Устанавливает указатель на окно для отслеживания его положения и размера +*/ void yon_window_config_setup(GtkWindow *window); +/**yon_window_config_load(char *path) + * [EN] + * + * [RU] + * Загружает конфиг окна и инициализирует отслеживание его параметров +*/ int yon_window_config_load(char *path); +/**yon_window_config_get_section(char *section, gsize *size) + * [EN] + * + * [RU] + * Возвращает все параметры раздела [section] конфига утилиты и записывает в [size] количество считанных параметров. +*/ config_str yon_window_config_get_section(char *section, gsize *size); +/**yon_window_config_add_custom_parameter(GtkWidget *widget, char *param_name, char *widget_property) + * [EN] + * + * [RU] + * Добавляет параметр виджета [widget] по названию [widget_property] для отслеживания и сохраняет его в конфиг под ключом [param_name]. +*/ void yon_window_config_add_listener(GtkWidget *widget, char *param_name, char *widget_property, enum YON_TYPE val_type); +/**yon_window_config_add_custom_parameter(char *param_name, char *section, void *tracked_value, enum YON_TYPE val_type) + * [EN] + * + * [RU] + * Добавить параметр в конфиг утилиты. + * Параметр [param_name] добавляется в раздел [section] конфига утилиты со значением [tracked value]. + * Тип указывается в [type] +*/ void yon_window_config_add_custom_parameter(char *param_name, char *section, void *tracked_value, enum YON_TYPE val_type); +void yon_window_config_add_instant_parameter(char *param_name, char *section, void *tracked_value, enum YON_TYPE val_type); + +/**yon_window_config_erase_custom_parameter(char *param_name, char *section) + * [EN] + * + * [RU] + * Удаляет параметр из конфига утилиты. + * Удаляет параметр [param_name] из раздела [section] конфига утилиты. +*/ void yon_window_config_erase_custom_parameter(char *param_name, char *section); +/**yon_window_config_get_parameter(char *section, char *config_parameter, void *return_value, enum YON_TYPE type) + * [EN] + * + * [RU] + * Возвращает параметр из конфига утилиты. + * Параметр [config_parameter] из раздела [section] возвращается в [return_value] + * Возвращаемый тип указывается в [type] +*/ int yon_window_config_get_parameter(char *section, char *config_parameter, void *return_value, enum YON_TYPE type); +/**yon_window_config_custom_window_setup(GtkWindow *window, char *window_name) + * [EN] + * + * [RU] + * Зарегистрировать окно [window] в конфиге утилиты под именем [window_name] +*/ void yon_window_config_custom_window_setup(GtkWindow *window, char *window_name); +/**yon_window_config_custom_window_set(GtkWindow *window, char *window_name) + * [EN] + * + * [RU] + * Загрузить и применить параметры окна [window], сохранёнными в конфигурации утилиты под именем [window_name] +*/ void yon_window_config_custom_window_get(GtkWindow *window, char *window_name); +/**yon_window_config_custom_window_set(GtkWindow *window, char *window_name) + * [EN] + * + * [RU] + * Сохранить параметры окна [window] в конфигурацию утилиты под именем [window_name] +*/ void yon_window_config_custom_window_set(GtkWindow *window, char *window_name); +int yon_gtk_icon_view_hide_empty(dictionary *icon_view_segment); + +/**yon_ubl_menu_item_documentation_new(char *buttonname) + * [EN] + * + * [RU] + * Создаёт элемент меню GtkMenu с текстом [buttonname]. Кнопка настроена для отображения диалогового окна информации об утилите +*/ +GtkWidget *yon_ubl_menu_item_about_new(char *buttonname); + +/**yon_ubl_menu_item_documentation_new(char *buttonname) + * [EN] + * + * [RU] + * Создаёт элемент меню GtkMenu с текстом [buttonname]. Кнопка настроена для отображения диалогового окна подтверждения перехода на страницу wiki +*/ +GtkWidget *yon_ubl_menu_item_documentation_new(char *buttonname); + +// other Gtk functions + +/**yon_gtk_combo_box_fill(GtkWidget *combo, config_str parameters,int size) + * [EN] + * + * [RU] + * Добавляет в Комбобокс [combo] все строки из массива строк [parameters] размера [size] +*/ int yon_gtk_combo_box_fill(GtkWidget *combo, char **parameters,int size); +/**yon_gtk_combo_box_text_find(GtkWidget *combo_box, char *text_to_find) + * [EN] + * + * [RU] + * Проивзодит поиск по GtkComboBoxText [combo_box] + * возвращает 1 если элемент [text_to_find] найден, иначе возвращает 0 +*/ int yon_gtk_combo_box_text_find(GtkWidget *combo_box, char *text_to_find); +/**yon_gtk_column_minimal_fixed_size_set(GtkTreeViewColumn *column) + * [EN] + * + * [RU] + * Установить минимальный размер колонки [column] равным размеру заголовка. +*/ void yon_gtk_column_minimal_fixed_size_set(GtkTreeViewColumn *column); -int yon_gtk_icon_view_hide_empty(dictionary *icon_view_segment); - +/**yon_dictionary_gtk_pack_start_multiple_widgets(GtkBox *destination, gboolean expand, gboolean fill, int padding, ...) + * [EN] + * + * [RU] + * Добвляет [destination] все виджеты, прописанные после [padding]. Добавление происходит с начала контейнера. + * [expand] - расширяемость выделенного для виджетов места + * [fill] - заполнять ли виджетом всё ему выделенное место + * [padding] - отступ од других элементов +*/ int yon_dictionary_gtk_pack_start_multiple_widgets(GtkBox *destination, gboolean expand, gboolean fill, int padding, ...); +/**yon_dictionary_gtk_pack_end_multiple_widgets(GtkBox *destination, gboolean expand, gboolean fill, int padding, ...) + * [EN] + * + * [RU] + * Добвляет в [destination] все виджеты, прописанные после [padding]. Добавление происходит с конца контейнера. + * [expand] - расширяемость выделенного для виджетов места + * [fill] - заполнять ли виджетом всё ему выделенное место + * [padding] - отступ од других элементов +*/ int yon_dictionary_gtk_pack_end_multiple_widgets(GtkBox *destination, gboolean expand, gboolean fill, int padding, ...); + +/**yon_gtk_widget_set_sensitive_from_toggle_button(GtkToggleButton *toggle, GtkWidget *target) + * [EN] + * + * [RU] + * Выставляет чуствительность виджета [target] в зависимости от состояния комбобокса [toggle]. + * Чувствительность виджета [target] повторяет статус чекбоска. +*/ void yon_gtk_widget_set_sensitive_from_toggle_button(GtkToggleButton *toggle, GtkWidget *target); + +/**yon_gtk_widget_set_sensitive_from_toggle_button_inversed(GtkToggleButton *toggle, GtkWidget *target) + * [EN] + * + * [RU] + * Выставляет чуствительность виджета [target] в зависимости от состояния чекбоска [toggle]. + * Если чекбокс вктивен, [target] становится нечувствительным и наоборот. +*/ void yon_gtk_widget_set_sensitive_from_toggle_button_inversed(GtkToggleButton *toggle, GtkWidget *target); + +/**yon_gtk_widget_set_sensitive_from_combo_box(GtkComboBox *toggle, GtkWidget *target); + * [EN] + * + * [RU] + * Выставляет чуствительность виджета [target] в зависимости от состояния комбобокса [toggle]. + * Если выбран первый элемент списка, [target] становится чувствительным, любое другое значение сделает его нечувствительным. +*/ void yon_gtk_widget_set_sensitive_from_combo_box(GtkComboBox *toggle, GtkWidget *target); + +/**yon_gtk_widget_set_sensitive_from_combo_box_inversed(GtkComboBox *toggle, GtkWidget *target); + * [EN] + * + * [RU] + * Выставляет чуствительность виджета [target] в зависимости от состояния комбобокса [toggle]. + * Если выбран первый элемент списка, [target] становится нечувствительным, любое другое значение сделает его чувствительным. +*/ void yon_gtk_widget_set_sensitive_from_combo_box_inversed(GtkComboBox *toggle, GtkWidget *target); typedef enum @@ -365,14 +1045,36 @@ int yon_ubl_status_box_setup(GtkWidget *icon, GtkWidget *box, GtkWidget *label); */ void yon_ubl_status_box_render(char *text, BACKGROUND_IMAGE_TYPE type); +/**yon_ubl_status_list_store_highlight_incorrect(GtkListStore *list, GtkTreeIter *iter) + * [EN] + * + * [RU] + * Подсвечивает красным цветом [widget] на 5 секунд +*/ void yon_ubl_status_highlight_incorrect(GtkWidget *widget); +/**yon_ubl_status_list_store_highlight_incorrect(GtkListStore *list, GtkTreeIter *iter) + * [EN] + * + * [RU] + * Подсвечивает красным цветом [iter] элемент списка [list] на 5 секунд +*/ 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); -#ifdef __cplusplus +/**yon_ubl_status_box_spawn(GtkContainer *container,char *display_text, int timeout,BACKGROUND_IMAGE_TYPE type); + * [EN] + * + * [RU] + * Создаёт статусную строку в контейнере [container], отображая текст [display_text]. + * Строка удаляется через [timeout] секунд. + * [type] - тип сообщения. Может быть: + * BACKGROUND_IMAGE_FAIL_TYPE (красный фон,иконка - восклицательный знак) + * или + * BACKGROUND_IMAGE_SUCCESS_TYPE (Жёлтный фон, иконка - галка) +*/ +void yon_ubl_status_box_spawn(GtkContainer *container,char *display_text, int timeout,BACKGROUND_IMAGE_TYPE type); /**yon_ubl_header_setup(overlay, head, image, imag_path) * [EN] @@ -388,10 +1090,9 @@ void yon_ubl_status_box_spawn(GtkContainer *container,char *display_text, int ti * [image] - виджет картинки для заднего фона; * [imag_path] - путь до картинки, загружаемой в [image] */ -#define yon_ubl_header_setup(overlay, head, image, imag_path) _yon_ubl_header_setup(GTK_WIDGET(overlay.gobj()), GTK_WIDGET(head.gobj()), GTK_WIDGET(image.gobj()), (char *)imag_path) -#else +#define yon_ubl_header_setup(overlay, head, image, imag_path) _yon_ubl_header_setup(GTK_WIDGET(overlay), GTK_WIDGET(head), GTK_WIDGET(image), (char *)imag_path) -/**yon_ubl_header_setup(overlay, head, image, imag_path) +/**yon_ubl_header_setup_resource(overlay, head, image, imag_path) * [EN] * Sets up header of app. * [overlay] is overlay for app header; @@ -403,22 +1104,40 @@ void yon_ubl_status_box_spawn(GtkContainer *container,char *display_text, int ti * [overlay] - оверлей заголовка приложения; * [head] - шапка заголовка, присоединяемая к [overlay] * [image] - виджет картинки для заднего фона; - * [imag_path] - путь до картинки, загружаемой в [image] + * [imag_path] - путь до картинки в ресурсах утилиты, загружаемой в [image] */ -#define yon_ubl_header_setup(overlay, head, image, imag_path) _yon_ubl_header_setup(GTK_WIDGET(overlay), GTK_WIDGET(head), GTK_WIDGET(image), (char *)imag_path) #define yon_ubl_header_setup_resource(overlay, head, image, imag_path) _yon_ubl_header_setup_resource(GTK_WIDGET(overlay), GTK_WIDGET(head), GTK_WIDGET(image), (char *)imag_path) -#endif void _yon_ubl_header_setup(GtkWidget *Overlay, GtkWidget *Head, GtkWidget *Image, char *image_path); void _yon_ubl_header_setup_resource(GtkWidget *Overlay, GtkWidget *Head, GtkWidget *Image, char *image_path); +/**yon_ubl_setup_sockets(GtkWidget *main_window, GtkWidget *left_window, GtkWidget *right_window, int socket_main_id, int socket_left_id, int socket_right_id) + * [EN] + * Set up plugs for using with GtkSockets insine ubl-settings-manager. + * [main_window] is container widget, which holds main application functionality. + * [left_window] is container widget, which holds widgets, have to be shown at left part of ubl-settings-manager header. + * [right_window] is container widget, which holds widgets, have to be shown at right part of ubl-settings-manager header. + * [socket_main_id] is id of socket for [main_window]. + * [socket_left_id] is id of socket for [left_window]. + * [socket_right_id] is id of socket for [right_window]. + * [RU] + * Настраивает плаги для работы с сокетами в утилите ubl-settings-manager. + * [main_window] - контейнер основного интерфейса приложения. + * [left_window] - контейнер для виджетов которые должны отображаться в левой части шапки ubl-settings-manager. + * [right_window] - контейнер для виджетов которые должны отображаться в правой части шапки ubl-settings-manager. + * [socket_main_id] - id сокета для [main_window]. + * [socket_left_id] - id сокета для [left_window]. + * [socket_right_id] - id сокета для [right_window]. +*/ void yon_ubl_setup_sockets(GtkWidget *main_window, GtkWidget *left_window, GtkWidget *right_window, int socket_main_id, int socket_left_id, int socket_right_id); -#ifdef WEBKIT_FOUND +/**yon_ubl_browser_window_open(char *link, char *browser_window_name) + * [EN] + * Launches integrated browser window, named [browser_window_name] at header with [link]. + * [RU] + * Открывает встроенный браузер с именем [browser_window_name] и показываемой страницей по ссылке [link] +*/ void yon_ubl_browser_window_open(char *link, char *browser_window_name); -#else -void yon_ubl_browser_window_open(char *link, char *browser_window_name); -#endif #endif #endif \ No newline at end of file diff --git a/ubl-settings-logging-filechooser.glade b/ubl-settings-logging-filechooser.glade index 3d0a484..84db281 100644 --- a/ubl-settings-logging-filechooser.glade +++ b/ubl-settings-logging-filechooser.glade @@ -1,7 +1,8 @@ - + + True False @@ -33,6 +34,7 @@ Choose directory instead of file + True True False True @@ -78,6 +80,21 @@ 0 + + + True + False + vertical + + + + + + False + True + 1 + + diff --git a/ubl-settings-logging-inspector.glade b/ubl-settings-logging-inspector.glade index 930eb37..ccb270a 100644 --- a/ubl-settings-logging-inspector.glade +++ b/ubl-settings-logging-inspector.glade @@ -59,6 +59,12 @@ + + + + + + @@ -265,15 +271,19 @@ True True liststore1 - False + 2 both - 0 + 4 + + + + True fixed - 175 + 100 75 - column + Date end @@ -286,7 +296,39 @@ - column + True + 125 + 75 + Hostname + + + end + + + 1 + + + + + + + True + 175 + 75 + Process + + + end + + + 2 + + + + + + + Log True @@ -294,7 +336,7 @@ 500 - 1 + 3 diff --git a/ubl-settings-logging-journald.glade b/ubl-settings-logging-journald.glade index dd6c3a4..598edb6 100644 --- a/ubl-settings-logging-journald.glade +++ b/ubl-settings-logging-journald.glade @@ -79,6 +79,11 @@ False emblem-ok-symbolic + + True + False + com.ublinux.ubl-settings-logging.reset-symbolic + 800 600 @@ -1062,9 +1067,4 @@ - - True - False - com.ublinux.ubl-settings-logging.funnel-symbolic - diff --git a/ubl-settings-logging-logrotate.glade b/ubl-settings-logging-logrotate.glade index c292f61..e32a1f2 100644 --- a/ubl-settings-logging-logrotate.glade +++ b/ubl-settings-logging-logrotate.glade @@ -259,6 +259,7 @@ True + False True True image3 @@ -291,6 +292,7 @@ True + False True True image6 @@ -329,7 +331,9 @@ Path - + + True + 2 1 diff --git a/ubl-settings-logging-saving.glade b/ubl-settings-logging-saving.glade new file mode 100644 index 0000000..6dfa9bb --- /dev/null +++ b/ubl-settings-logging-saving.glade @@ -0,0 +1,216 @@ + + + + + + + Save + True + True + False + True + + + True + False + process-stop-symbolic + + + True + False + emblem-ok-symbolic + + + + + + + + + + + + + + + + + + + + + 450 + 500 + False + True + com.ublinux.ubl-settings-logging + dialog + + + False + 5 + vertical + 5 + + + False + end + + + Cancel + True + True + True + image1 + + + True + True + 0 + + + + + Save + True + True + True + image2 + + + True + True + 1 + + + + + False + False + end + 0 + + + + + True + False + vertical + + + + + + False + True + 0 + + + + + True + True + in + + + True + True + liststore1 + + + none + + + + + Save + + + + 4 + 5 + 0 + + + + + + + Parameter + + + + 4 + 5 + 1 + + + + + + + Old value + + + + 4 + 5 + 2 + + + + + + + New value + + + + 4 + 5 + 3 + + + + + + + + + True + True + 1 + + + + + + + True + False + True + + + True + False + Logs and events + + + + + + + + True + False + 32 + com.ublinux.ubl-settings-logging + + + + + + + diff --git a/ubl-settings-logging.css b/ubl-settings-logging.css index 2f1e822..a08bca0 100644 --- a/ubl-settings-logging.css +++ b/ubl-settings-logging.css @@ -119,4 +119,11 @@ background:transparent; border-width: 2px; border-color: #ea9999; border-style:solid; +} + +.chosenOutline{ + transition: 0ms; + border-width: 2px; + border-color: #f3f0ac; + border-style:solid; } \ No newline at end of file diff --git a/ubl-settings-logging.glade b/ubl-settings-logging.glade index be7dea7..ac75bca 100644 --- a/ubl-settings-logging.glade +++ b/ubl-settings-logging.glade @@ -464,7 +464,7 @@ translated and supported by community. - + @@ -473,8 +473,8 @@ translated and supported by community. journald /var/log/journal/ System event log - True - 0 + 1 + 1 @@ -786,6 +786,7 @@ translated and supported by community. Log/Journal + center end 100 @@ -821,6 +822,7 @@ translated and supported by community. Description + center end 100 diff --git a/ubl-settings-logging.pot b/ubl-settings-logging.pot index 689c007..173a020 100644 --- a/ubl-settings-logging.pot +++ b/ubl-settings-logging.pot @@ -182,628 +182,655 @@ msgid "Accept" msgstr "" #: source/ubl-strings.h:41 +msgid "Choose directory instead of file" +msgstr "" + +#: source/ubl-strings.h:43 msgid "Journals" msgstr "" -#: source/ubl-strings.h:42 +#: source/ubl-strings.h:44 msgid "Services" msgstr "" -#: source/ubl-strings.h:43 +#: source/ubl-strings.h:45 msgid "Log/Journal" msgstr "" -#: source/ubl-strings.h:44 +#: source/ubl-strings.h:46 msgid "Path" msgstr "" -#: source/ubl-strings.h:45 +#: source/ubl-strings.h:47 msgid "Description" msgstr "" -#: source/ubl-strings.h:46 +#: source/ubl-strings.h:48 msgid "Inspect log" msgstr "" -#: source/ubl-strings.h:47 +#: source/ubl-strings.h:49 msgid "Configure log" msgstr "" -#: source/ubl-strings.h:48 +#: source/ubl-strings.h:50 msgid "Add log" msgstr "" -#: source/ubl-strings.h:49 +#: source/ubl-strings.h:51 msgid "Remove log" msgstr "" -#: source/ubl-strings.h:50 +#: source/ubl-strings.h:52 msgid "Stop service" msgstr "" -#: source/ubl-strings.h:51 +#: source/ubl-strings.h:53 msgid "Start service" msgstr "" -#: source/ubl-strings.h:52 +#: source/ubl-strings.h:54 msgid "Configure service" msgstr "" -#: source/ubl-strings.h:53 +#: source/ubl-strings.h:55 msgid "Status" msgstr "" -#: source/ubl-strings.h:54 +#: source/ubl-strings.h:56 msgid "Service" msgstr "" -#: source/ubl-strings.h:55 +#: source/ubl-strings.h:57 msgid "Autostart" msgstr "" -#: source/ubl-strings.h:56 +#: source/ubl-strings.h:58 msgid "Switch autostart off" msgstr "" -#: source/ubl-strings.h:57 +#: source/ubl-strings.h:59 msgid "Switch autostart on" msgstr "" #: source/ubl-strings.h:60 -msgid "Show messages since the current system boot" +msgid "System event log" msgstr "" #: source/ubl-strings.h:61 -msgid "Follow for new messages" +msgid "Log of work and requests to Acpid" msgstr "" #: source/ubl-strings.h:62 -msgid "Show kernel ring buffer" +msgid "Log of work and requests to the web server" msgstr "" #: source/ubl-strings.h:63 -msgid "Show only priority error messages, critical messages and warnings" +msgid "Audit log" msgstr "" #: source/ubl-strings.h:64 -msgid "Show all boots" +msgid "Log of authorization procedures" msgstr "" #: source/ubl-strings.h:65 -msgid "Show a list of all units, ordered by the time of their initialisation" +msgid "Job scheduler log (cron)" msgstr "" #: source/ubl-strings.h:66 -msgid "Show tree of time-critical initialization unit chain" +msgid "Log of work and calls to the print server (cups)" msgstr "" #: source/ubl-strings.h:67 -msgid "Update" +msgid "Log of operation and access to system services" +msgstr "" + +#: source/ubl-strings.h:68 +msgid "Log of work and access to Samba" +msgstr "" + +#: source/ubl-strings.h:69 +msgid "Postfix mail server log" msgstr "" #: source/ubl-strings.h:70 -msgid "Description:" +msgid "System log" msgstr "" #: source/ubl-strings.h:71 +msgid "X.org display server log" +msgstr "" + +#: source/ubl-strings.h:72 +msgid "Graphics X session log" +msgstr "" + +#: source/ubl-strings.h:75 +msgid "Show messages since the current system boot" +msgstr "" + +#: source/ubl-strings.h:76 +msgid "Follow for new messages" +msgstr "" + +#: source/ubl-strings.h:77 +msgid "Show kernel ring buffer" +msgstr "" + +#: source/ubl-strings.h:78 +msgid "Show only priority error messages, critical messages and warnings" +msgstr "" + +#: source/ubl-strings.h:79 +msgid "Show all boots" +msgstr "" + +#: source/ubl-strings.h:80 +msgid "Show a list of all units, ordered by the time of their initialisation" +msgstr "" + +#: source/ubl-strings.h:81 +msgid "Show tree of time-critical initialization unit chain" +msgstr "" + +#: source/ubl-strings.h:82 +msgid "Update" +msgstr "" + +#: source/ubl-strings.h:83 +msgid "Date" +msgstr "" + +#: source/ubl-strings.h:84 +msgid "Hostname" +msgstr "" + +#: source/ubl-strings.h:85 +msgid "Process" +msgstr "" + +#: source/ubl-strings.h:86 +msgid "Log" +msgstr "" + +#: source/ubl-strings.h:89 +msgid "Description:" +msgstr "" + +#: source/ubl-strings.h:90 msgid "Journal storage place:" msgstr "" -#: source/ubl-strings.h:72 source/ubl-strings.h:73 +#: source/ubl-strings.h:91 source/ubl-strings.h:92 msgid "Use compression:" msgstr "" -#: source/ubl-strings.h:74 +#: source/ubl-strings.h:93 msgid "Split journal files:" msgstr "" -#: source/ubl-strings.h:75 +#: source/ubl-strings.h:94 msgid "Log recording journal interval:" msgstr "" -#: source/ubl-strings.h:76 +#: source/ubl-strings.h:95 msgid "Records amount:" msgstr "" -#: source/ubl-strings.h:77 +#: source/ubl-strings.h:96 msgid "Maximum size of all logs:" msgstr "" -#: source/ubl-strings.h:78 +#: source/ubl-strings.h:97 msgid "Maximum size of rotation journal:" msgstr "" -#: source/ubl-strings.h:79 +#: source/ubl-strings.h:98 msgid "Leave free space at storage:" msgstr "" -#: source/ubl-strings.h:80 +#: source/ubl-strings.h:99 msgid "Redirect to console:" msgstr "" -#: source/ubl-strings.h:81 +#: source/ubl-strings.h:100 msgid "TTY:" msgstr "" -#: source/ubl-strings.h:82 +#: source/ubl-strings.h:101 msgid "Type of forwarded messages:" msgstr "" -#: source/ubl-strings.h:83 +#: source/ubl-strings.h:102 msgid "Journal configuration" msgstr "" -#: source/ubl-strings.h:84 +#: source/ubl-strings.h:103 msgid "Total log size:" msgstr "" -#: source/ubl-strings.h:85 +#: source/ubl-strings.h:104 msgid "Lower size to:" msgstr "" -#: source/ubl-strings.h:86 +#: source/ubl-strings.h:105 msgid "Apply" msgstr "" -#: source/ubl-strings.h:87 +#: source/ubl-strings.h:106 msgid "Statistics" msgstr "" -#: source/ubl-strings.h:88 +#: source/ubl-strings.h:107 msgid "Default" msgstr "" -#: source/ubl-strings.h:89 +#: source/ubl-strings.h:108 msgid "RAM" msgstr "" -#: source/ubl-strings.h:90 +#: source/ubl-strings.h:109 msgid "Drive" msgstr "" -#: source/ubl-strings.h:91 +#: source/ubl-strings.h:110 msgid "Auto" msgstr "" -#: source/ubl-strings.h:92 +#: source/ubl-strings.h:111 msgid "None" msgstr "" -#: source/ubl-strings.h:93 +#: source/ubl-strings.h:112 msgid "Yes" msgstr "" -#: source/ubl-strings.h:94 +#: source/ubl-strings.h:113 msgid "No" msgstr "" -#: source/ubl-strings.h:95 +#: source/ubl-strings.h:114 msgid "After" msgstr "" -#: source/ubl-strings.h:96 +#: source/ubl-strings.h:115 msgid "Kb" msgstr "" -#: source/ubl-strings.h:97 +#: source/ubl-strings.h:116 msgid "Mb" msgstr "" -#: source/ubl-strings.h:98 +#: source/ubl-strings.h:117 msgid "Gb" msgstr "" -#: source/ubl-strings.h:99 +#: source/ubl-strings.h:118 msgid "Minutes" msgstr "" -#: source/ubl-strings.h:100 +#: source/ubl-strings.h:119 msgid "Hours" msgstr "" -#: source/ubl-strings.h:101 +#: source/ubl-strings.h:120 msgid "Days" msgstr "" -#: source/ubl-strings.h:102 +#: source/ubl-strings.h:121 msgid "Weeks" msgstr "" -#: source/ubl-strings.h:103 +#: source/ubl-strings.h:122 msgid "Years" msgstr "" -#: source/ubl-strings.h:104 +#: source/ubl-strings.h:123 msgid "Reset" msgstr "" -#: source/ubl-strings.h:107 +#: source/ubl-strings.h:126 msgid "Log/Journal:" msgstr "" -#: source/ubl-strings.h:108 +#: source/ubl-strings.h:127 msgid "Paths to log and journals files" msgstr "" -#: source/ubl-strings.h:109 +#: source/ubl-strings.h:128 msgid "On" msgstr "" -#: source/ubl-strings.h:110 +#: source/ubl-strings.h:129 msgid "Off" msgstr "" -#: source/ubl-strings.h:111 source/ubl-strings.h:165 +#: source/ubl-strings.h:130 source/ubl-strings.h:184 msgid "Scenarios" msgstr "" -#: source/ubl-strings.h:112 source/ubl-strings.h:164 +#: source/ubl-strings.h:131 source/ubl-strings.h:183 msgid "Scenarios are running for each rotated journal" msgstr "" -#: source/ubl-strings.h:113 +#: source/ubl-strings.h:132 msgid "Command before rotation (one time):" msgstr "" -#: source/ubl-strings.h:114 +#: source/ubl-strings.h:133 msgid "Command after rotation (one time):" msgstr "" -#: source/ubl-strings.h:115 +#: source/ubl-strings.h:134 msgid "Command before rotation:" msgstr "" -#: source/ubl-strings.h:116 +#: source/ubl-strings.h:135 msgid "Command after rotation:" msgstr "" -#: source/ubl-strings.h:117 +#: source/ubl-strings.h:136 msgid "Rotation period:" msgstr "" -#: source/ubl-strings.h:118 +#: source/ubl-strings.h:137 msgid "Maximum size of file:" msgstr "" -#: source/ubl-strings.h:119 +#: source/ubl-strings.h:138 msgid "Checking frequency configuration" msgstr "" -#: source/ubl-strings.h:120 +#: source/ubl-strings.h:139 msgid "File amount:" msgstr "" -#: source/ubl-strings.h:121 +#: source/ubl-strings.h:140 msgid "Store at:" msgstr "" -#: source/ubl-strings.h:122 +#: source/ubl-strings.h:141 msgid "Rotation as user:" msgstr "" -#: source/ubl-strings.h:123 +#: source/ubl-strings.h:142 msgid "Rotation as group:" msgstr "" -#: source/ubl-strings.h:124 +#: source/ubl-strings.h:143 msgid "Rotation configuration" msgstr "" -#: source/ubl-strings.h:125 +#: source/ubl-strings.h:144 msgid "Error processing:" msgstr "" -#: source/ubl-strings.h:126 +#: source/ubl-strings.h:145 msgid "Rotation of jurnal even when it is empty:" msgstr "" -#: source/ubl-strings.h:127 +#: source/ubl-strings.h:146 msgid "Do not rotate journal younger than" msgstr "" -#: source/ubl-strings.h:128 +#: source/ubl-strings.h:147 msgid "days" msgstr "" -#: source/ubl-strings.h:129 +#: source/ubl-strings.h:148 msgid "Delete rotated journals older than" msgstr "" -#: source/ubl-strings.h:130 +#: source/ubl-strings.h:149 msgid "Rotate journals if size more than" msgstr "" -#: source/ubl-strings.h:131 +#: source/ubl-strings.h:150 msgid "but not earlier than the specified time interval" msgstr "" -#: source/ubl-strings.h:132 +#: source/ubl-strings.h:151 msgid "before specified time interval" msgstr "" -#: source/ubl-strings.h:133 +#: source/ubl-strings.h:152 msgid "File choosing configuration" msgstr "" -#: source/ubl-strings.h:134 +#: source/ubl-strings.h:153 msgid "Create log" msgstr "" -#: source/ubl-strings.h:135 +#: source/ubl-strings.h:154 msgid "as user:" msgstr "" -#: source/ubl-strings.h:136 +#: source/ubl-strings.h:155 msgid "as group:" msgstr "" -#: source/ubl-strings.h:137 +#: source/ubl-strings.h:156 msgid "rules:" msgstr "" -#: source/ubl-strings.h:138 +#: source/ubl-strings.h:157 msgid "" "Cut source journal fileafter copy creating instead of moving old journal " "file and creating new one" msgstr "" -#: source/ubl-strings.h:139 +#: source/ubl-strings.h:158 msgid "Files and directories configuration" msgstr "" -#: source/ubl-strings.h:140 +#: source/ubl-strings.h:159 msgid "Delay compression by one journal in queue:" msgstr "" -#: source/ubl-strings.h:141 +#: source/ubl-strings.h:160 msgid "Compression configuration" msgstr "" -#: source/ubl-strings.h:142 +#: source/ubl-strings.h:161 msgid "Save original log file after rotation if it has specified extension:" msgstr "" -#: source/ubl-strings.h:143 +#: source/ubl-strings.h:162 msgid "Add date of rotation before log header" msgstr "" -#: source/ubl-strings.h:144 +#: source/ubl-strings.h:163 msgid "Number from which numbering of old logs will begin" msgstr "" -#: source/ubl-strings.h:145 +#: source/ubl-strings.h:164 msgid "Filename configuration" msgstr "" -#: source/ubl-strings.h:146 +#: source/ubl-strings.h:165 msgid "Email after rotation:" msgstr "" -#: source/ubl-strings.h:147 +#: source/ubl-strings.h:166 msgid "adress:" msgstr "" -#: source/ubl-strings.h:148 +#: source/ubl-strings.h:167 msgid "contents:" msgstr "" -#: source/ubl-strings.h:149 source/ubl-strings.h:162 +#: source/ubl-strings.h:168 source/ubl-strings.h:181 msgid "Message configuration" msgstr "" -#: source/ubl-strings.h:150 +#: source/ubl-strings.h:169 msgid "Manual input:" msgstr "" -#: source/ubl-strings.h:151 +#: source/ubl-strings.h:170 msgid "Log (-s) size:" msgstr "" -#: source/ubl-strings.h:152 +#: source/ubl-strings.h:171 msgid "Same directory" msgstr "" -#: source/ubl-strings.h:153 +#: source/ubl-strings.h:172 msgid "Separate directory" msgstr "" -#: source/ubl-strings.h:154 +#: source/ubl-strings.h:173 msgid "Output errors if log file does not exist*" msgstr "" -#: source/ubl-strings.h:155 +#: source/ubl-strings.h:174 msgid "Do not output errors if log file does not exist" msgstr "" -#: source/ubl-strings.h:156 +#: source/ubl-strings.h:175 msgid "Do not output" msgstr "" -#: source/ubl-strings.h:157 +#: source/ubl-strings.h:176 msgid "Output errors" msgstr "" -#: source/ubl-strings.h:158 +#: source/ubl-strings.h:177 msgid "Send Email" msgstr "" -#: source/ubl-strings.h:159 +#: source/ubl-strings.h:178 msgid "Don't send Email" msgstr "" -#: source/ubl-strings.h:160 +#: source/ubl-strings.h:179 msgid "First rotated copy" msgstr "" -#: source/ubl-strings.h:161 +#: source/ubl-strings.h:180 msgid "Last rotated copy" msgstr "" -#: source/ubl-strings.h:163 +#: source/ubl-strings.h:182 msgid "Endwork command:" msgstr "" -#: source/ubl-strings.h:166 +#: source/ubl-strings.h:185 msgid "Hourly" msgstr "" -#: source/ubl-strings.h:167 +#: source/ubl-strings.h:186 msgid "Daily" msgstr "" -#: source/ubl-strings.h:168 +#: source/ubl-strings.h:187 msgid "Weekly*" msgstr "" -#: source/ubl-strings.h:169 +#: source/ubl-strings.h:188 msgid "Monthly" msgstr "" -#: source/ubl-strings.h:170 +#: source/ubl-strings.h:189 msgid "Yearly" msgstr "" -#: source/ubl-strings.h:171 +#: source/ubl-strings.h:190 msgid "Monday" msgstr "" -#: source/ubl-strings.h:172 +#: source/ubl-strings.h:191 msgid "Tuesday" msgstr "" -#: source/ubl-strings.h:173 +#: source/ubl-strings.h:192 msgid "Wednesday" msgstr "" -#: source/ubl-strings.h:174 +#: source/ubl-strings.h:193 msgid "Thursday" msgstr "" -#: source/ubl-strings.h:175 +#: source/ubl-strings.h:194 msgid "Friday" msgstr "" -#: source/ubl-strings.h:176 +#: source/ubl-strings.h:195 msgid "Saturday" msgstr "" -#: source/ubl-strings.h:177 +#: source/ubl-strings.h:196 msgid "Sunday*" msgstr "" -#: source/ubl-strings.h:178 +#: source/ubl-strings.h:197 msgid "Same record already exists" msgstr "" -#: source/ubl-strings.h:179 +#: source/ubl-strings.h:198 msgid "Empty important field" msgstr "" -#: source/ubl-strings.h:180 +#: source/ubl-strings.h:199 msgid "Repeating paths" msgstr "" -#: source/ubl-strings.h:181 +#: source/ubl-strings.h:200 msgid "Write down all important fields" msgstr "" -#: source/ubl-strings.h:184 +#: source/ubl-strings.h:203 msgid "System configuration" msgstr "" -#: source/ubl-strings.h:185 +#: source/ubl-strings.h:204 msgid "Applications configuration" msgstr "" -#: source/ubl-strings.h:188 +#: source/ubl-strings.h:207 msgid "Path (-s):" msgstr "" -#: source/ubl-strings.h:189 +#: source/ubl-strings.h:208 msgid "Control:" msgstr "" -#: source/ubl-strings.h:190 +#: source/ubl-strings.h:209 msgid "Log file" msgstr "" -#: source/ubl-strings.h:191 +#: source/ubl-strings.h:210 msgid "Name:" msgstr "" -#: source/ubl-strings.h:194 +#: source/ubl-strings.h:213 msgid "Owner rules" msgstr "" -#: source/ubl-strings.h:195 +#: source/ubl-strings.h:214 msgid "Group rules" msgstr "" -#: source/ubl-strings.h:196 +#: source/ubl-strings.h:215 msgid "Public rules" msgstr "" -#: source/ubl-strings.h:197 +#: source/ubl-strings.h:216 msgid "Read" msgstr "" -#: source/ubl-strings.h:198 +#: source/ubl-strings.h:217 msgid "Write" msgstr "" -#: source/ubl-strings.h:199 +#: source/ubl-strings.h:218 msgid "Execute" msgstr "" -#: source/ubl-strings.h:200 +#: source/ubl-strings.h:219 msgid "Value:" msgstr "" -#: source/ubl-strings.h:203 +#: source/ubl-strings.h:222 msgid ": no such file(s)" msgstr "" - -msgid "System event log rotation service" -msgstr "" - -msgid "System event log" -msgstr "" - -msgid "Service for collecting messages from system events of active network devices" -msgstr "" - -msgid "Log of work and requests to Acpid" -msgstr "" - -msgid "Log of work and requests to the web server" -msgstr "" - -msgid "Audit log" -msgstr "" - -msgid "Log of authorization procedures" -msgstr "" - -msgid "Job scheduler log (cron)" -msgstr "" - -msgid "Log of work and calls to the print server (cups)" -msgstr "" - -msgid "Log of operation and access to system services" -msgstr "" - -msgid "Log of work and access to Samba" -msgstr "" - -msgid "Postfix mail server log" -msgstr "" - -msgid "System log" -msgstr "" - -msgid "X.org display server log" -msgstr "" - -msgid "Graphics X session log" -msgstr "" diff --git a/ubl-settings-logging_ru.po b/ubl-settings-logging_ru.po index 908cb52..b26e531 100644 --- a/ubl-settings-logging_ru.po +++ b/ubl-settings-logging_ru.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ubl-settings-logging 1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-22 16:12+0600\n" +"POT-Creation-Date: 2023-12-11 17:41+0600\n" "PO-Revision-Date: 2023-01-01 00:00+0600\n" "Last-Translator: UBLinux Team \n" "Language-Team: Russian - UBLinux Team \n" @@ -186,372 +186,444 @@ msgid "Accept" msgstr "Принять" #: source/ubl-strings.h:41 +msgid "Choose directory instead of file" +msgstr "Выбрать папку вместо файла" + +#: source/ubl-strings.h:43 msgid "Journals" msgstr "Журналы" -#: source/ubl-strings.h:42 +#: source/ubl-strings.h:44 msgid "Services" msgstr "Сервисы" -#: source/ubl-strings.h:43 +#: source/ubl-strings.h:45 msgid "Log/Journal" msgstr "Лог/Журнал" -#: source/ubl-strings.h:44 +#: source/ubl-strings.h:46 msgid "Path" msgstr "Путь" -#: source/ubl-strings.h:45 +#: source/ubl-strings.h:47 msgid "Description" msgstr "Описание" -#: source/ubl-strings.h:46 +#: source/ubl-strings.h:48 msgid "Inspect log" msgstr "Просмотреть лог" -#: source/ubl-strings.h:47 +#: source/ubl-strings.h:49 msgid "Configure log" msgstr "Настроить лог" -#: source/ubl-strings.h:48 +#: source/ubl-strings.h:50 msgid "Add log" msgstr "Добавить лог" -#: source/ubl-strings.h:49 +#: source/ubl-strings.h:51 msgid "Remove log" msgstr "Удалить лог" -#: source/ubl-strings.h:50 +#: source/ubl-strings.h:52 msgid "Stop service" msgstr "Остановить сервис" -#: source/ubl-strings.h:51 +#: source/ubl-strings.h:53 msgid "Start service" msgstr "Запустить сервис" -#: source/ubl-strings.h:52 +#: source/ubl-strings.h:54 msgid "Configure service" msgstr "Настроить сервис" -#: source/ubl-strings.h:53 +#: source/ubl-strings.h:55 msgid "Status" msgstr "Статус" -#: source/ubl-strings.h:54 +#: source/ubl-strings.h:56 msgid "Service" msgstr "Сервис" -#: source/ubl-strings.h:55 +#: source/ubl-strings.h:57 msgid "Autostart" msgstr "Автозапуск" -#: source/ubl-strings.h:56 +#: source/ubl-strings.h:58 msgid "Switch autostart off" msgstr "Выключить автозапуск" -#: source/ubl-strings.h:57 +#: source/ubl-strings.h:59 msgid "Switch autostart on" msgstr "Включить автозапуск" #: source/ubl-strings.h:60 +msgid "System event log" +msgstr "Системный журнал событий" + +#: source/ubl-strings.h:61 +msgid "Log of work and requests to Acpid" +msgstr "Журнал работы и обращений к Acpid" + +#: source/ubl-strings.h:62 +msgid "Log of work and requests to the web server" +msgstr "Журнал работы и обращений к веб-серверу" + +#: source/ubl-strings.h:63 +msgid "Audit log" +msgstr "Журнал аудита (audit)" + +#: source/ubl-strings.h:64 +msgid "Log of authorization procedures" +msgstr "Журнал процедур авторизации" + +#: source/ubl-strings.h:65 +msgid "Job scheduler log (cron)" +msgstr "Журнал работы планировщика заданий (cron)" + +#: source/ubl-strings.h:66 +msgid "Log of work and calls to the print server (cups)" +msgstr "Журнал работы и обращений к серверу печати (cups)" + +#: source/ubl-strings.h:67 +msgid "Log of operation and access to system services" +msgstr "Журнал работы и обращения к службам системы" + +#: source/ubl-strings.h:68 +msgid "Log of work and access to Samba" +msgstr "Журнал работы и обращения к Samba" + +#: source/ubl-strings.h:69 +msgid "Postfix mail server log" +msgstr "Журнал почтового сервера Postfix" + +#: source/ubl-strings.h:70 +msgid "System log" +msgstr "Системный журнал" + +#: source/ubl-strings.h:71 +msgid "X.org display server log" +msgstr "Журнал работы дисплейного сервера X.org" + +#: source/ubl-strings.h:72 +msgid "Graphics X session log" +msgstr "Журнал сеансов графической системы X" + +#: source/ubl-strings.h:75 msgid "Show messages since the current system boot" msgstr "Показать сообщения с момента загрузки системы" -#: source/ubl-strings.h:61 +#: source/ubl-strings.h:76 msgid "Follow for new messages" msgstr "Следить за появлением новых сообщений" -#: source/ubl-strings.h:62 +#: source/ubl-strings.h:77 msgid "Show kernel ring buffer" msgstr "Показать кольцевой буфер ядра" -#: source/ubl-strings.h:63 +#: source/ubl-strings.h:78 msgid "Show only priority error messages, critical messages and warnings" msgstr "" "Показать только приоритетные сообщения об ошибках, критических сообщениях и " "предупреждениях" -#: source/ubl-strings.h:64 +#: source/ubl-strings.h:79 msgid "Show all boots" msgstr "Показать все загрузки в журнале" -#: source/ubl-strings.h:65 +#: source/ubl-strings.h:80 msgid "Show a list of all units, ordered by the time of their initialisation" msgstr "" "Показать список всех работающих юнитов, упорядоченных по времени их " "инициализации" -#: source/ubl-strings.h:66 +#: source/ubl-strings.h:81 msgid "Show tree of time-critical initialization unit chain" msgstr "Показать дерево критической по времени цепочки юнитов инициализации" -#: source/ubl-strings.h:67 +#: source/ubl-strings.h:82 msgid "Update" msgstr "Обновить" -#: source/ubl-strings.h:70 +#: source/ubl-strings.h:83 +msgid "Date" +msgstr "Дата" + +#: source/ubl-strings.h:84 +msgid "Hostname" +msgstr "Имя хоста" + +#: source/ubl-strings.h:85 +msgid "Process" +msgstr "Процесс" + +#: source/ubl-strings.h:86 +msgid "Log" +msgstr "Запись лога" + +#: source/ubl-strings.h:89 msgid "Description:" msgstr "Описание:" -#: source/ubl-strings.h:71 +#: source/ubl-strings.h:90 msgid "Journal storage place:" msgstr "Место хранения журнала:" -#: source/ubl-strings.h:72 source/ubl-strings.h:73 +#: source/ubl-strings.h:91 source/ubl-strings.h:92 msgid "Use compression:" msgstr "Использовать сжатие:" -#: source/ubl-strings.h:74 +#: source/ubl-strings.h:93 msgid "Split journal files:" msgstr "Разделять файлы журнала:" -#: source/ubl-strings.h:75 +#: source/ubl-strings.h:94 msgid "Log recording journal interval:" msgstr "Интервал записи журнала:" -#: source/ubl-strings.h:76 +#: source/ubl-strings.h:95 msgid "Records amount:" msgstr "Количество записей:" -#: source/ubl-strings.h:77 +#: source/ubl-strings.h:96 msgid "Maximum size of all logs:" msgstr "Максимальный размер всех журналов:" -#: source/ubl-strings.h:78 +#: source/ubl-strings.h:97 msgid "Maximum size of rotation journal:" msgstr "Максимальный размер журнала для ротации:" -#: source/ubl-strings.h:79 +#: source/ubl-strings.h:98 msgid "Leave free space at storage:" msgstr "Оставлять в хранилище свободным:" -#: source/ubl-strings.h:80 +#: source/ubl-strings.h:99 msgid "Redirect to console:" msgstr "Перенаправление в консоль:" -#: source/ubl-strings.h:81 +#: source/ubl-strings.h:100 msgid "TTY:" msgstr "TTY:" -#: source/ubl-strings.h:82 +#: source/ubl-strings.h:101 msgid "Type of forwarded messages:" msgstr "Тип перенаправляемых сообщений:" -#: source/ubl-strings.h:83 +#: source/ubl-strings.h:102 msgid "Journal configuration" msgstr "Настройка файла журнала" -#: source/ubl-strings.h:84 +#: source/ubl-strings.h:103 msgid "Total log size:" msgstr "Общий размер журналов:" -#: source/ubl-strings.h:85 +#: source/ubl-strings.h:104 msgid "Lower size to:" msgstr "Уменьшить размер до:" -#: source/ubl-strings.h:86 +#: source/ubl-strings.h:105 msgid "Apply" msgstr "Применить" -#: source/ubl-strings.h:87 +#: source/ubl-strings.h:106 msgid "Statistics" msgstr "Статистика" -#: source/ubl-strings.h:88 +#: source/ubl-strings.h:107 msgid "Default" msgstr "По умолчанию" -#: source/ubl-strings.h:89 +#: source/ubl-strings.h:108 msgid "RAM" msgstr "Оперативная память" -#: source/ubl-strings.h:90 +#: source/ubl-strings.h:109 msgid "Drive" msgstr "Диск" -#: source/ubl-strings.h:91 +#: source/ubl-strings.h:110 #, fuzzy msgid "Auto" msgstr "Автоматически" -#: source/ubl-strings.h:92 +#: source/ubl-strings.h:111 msgid "None" msgstr "Нет" -#: source/ubl-strings.h:93 +#: source/ubl-strings.h:112 msgid "Yes" msgstr "Да" -#: source/ubl-strings.h:94 +#: source/ubl-strings.h:113 msgid "No" msgstr "Нет" -#: source/ubl-strings.h:95 +#: source/ubl-strings.h:114 msgid "After" msgstr "После" -#: source/ubl-strings.h:96 +#: source/ubl-strings.h:115 msgid "Kb" msgstr "Кб" -#: source/ubl-strings.h:97 +#: source/ubl-strings.h:116 msgid "Mb" msgstr "Мб" -#: source/ubl-strings.h:98 +#: source/ubl-strings.h:117 msgid "Gb" msgstr "Гб" -#: source/ubl-strings.h:99 +#: source/ubl-strings.h:118 msgid "Minutes" msgstr "Минут" -#: source/ubl-strings.h:100 +#: source/ubl-strings.h:119 msgid "Hours" msgstr "Часов" -#: source/ubl-strings.h:101 +#: source/ubl-strings.h:120 msgid "Days" msgstr "Дней" -#: source/ubl-strings.h:102 +#: source/ubl-strings.h:121 #, fuzzy msgid "Weeks" msgstr "Недель" -#: source/ubl-strings.h:103 +#: source/ubl-strings.h:122 msgid "Years" msgstr "Лет" -#: source/ubl-strings.h:104 +#: source/ubl-strings.h:123 msgid "Reset" msgstr "По умлочанию" -#: source/ubl-strings.h:107 +#: source/ubl-strings.h:126 msgid "Log/Journal:" msgstr "Лог/Журнал:" -#: source/ubl-strings.h:108 +#: source/ubl-strings.h:127 msgid "Paths to log and journals files" msgstr "Пути к файлам лога/журнала" -#: source/ubl-strings.h:109 +#: source/ubl-strings.h:128 msgid "On" msgstr "Включено" -#: source/ubl-strings.h:110 +#: source/ubl-strings.h:129 msgid "Off" msgstr "Выключено" -#: source/ubl-strings.h:111 source/ubl-strings.h:165 +#: source/ubl-strings.h:130 source/ubl-strings.h:184 msgid "Scenarios" msgstr "Сценарии" -#: source/ubl-strings.h:112 source/ubl-strings.h:164 +#: source/ubl-strings.h:131 source/ubl-strings.h:183 msgid "Scenarios are running for each rotated journal" msgstr "Сценарии запускаются для каждого ротируемого журнала" -#: source/ubl-strings.h:113 +#: source/ubl-strings.h:132 msgid "Command before rotation (one time):" msgstr "Команда перед ротацией (один раз):" -#: source/ubl-strings.h:114 +#: source/ubl-strings.h:133 msgid "Command after rotation (one time):" msgstr "Команда после ротации (один раз):" -#: source/ubl-strings.h:115 +#: source/ubl-strings.h:134 msgid "Command before rotation:" msgstr "Команда перед ротацией:" -#: source/ubl-strings.h:116 +#: source/ubl-strings.h:135 msgid "Command after rotation:" msgstr "Команда после ротации:" -#: source/ubl-strings.h:117 +#: source/ubl-strings.h:136 msgid "Rotation period:" msgstr "Период ротации:" -#: source/ubl-strings.h:118 +#: source/ubl-strings.h:137 msgid "Maximum size of file:" msgstr "Максимальный размер файла:" -#: source/ubl-strings.h:119 +#: source/ubl-strings.h:138 msgid "Checking frequency configuration" msgstr "Настройки частоты проверки" -#: source/ubl-strings.h:120 +#: source/ubl-strings.h:139 msgid "File amount:" msgstr "Количество файлов:" -#: source/ubl-strings.h:121 +#: source/ubl-strings.h:140 msgid "Store at:" msgstr "Хранить в:" -#: source/ubl-strings.h:122 +#: source/ubl-strings.h:141 msgid "Rotation as user:" msgstr "Ротация от пользователя:" -#: source/ubl-strings.h:123 +#: source/ubl-strings.h:142 msgid "Rotation as group:" msgstr "Ротация от группы:" -#: source/ubl-strings.h:124 +#: source/ubl-strings.h:143 msgid "Rotation configuration" msgstr "Настройки ротации" -#: source/ubl-strings.h:125 +#: source/ubl-strings.h:144 msgid "Error processing:" msgstr "Обработка ошибок:" -#: source/ubl-strings.h:126 +#: source/ubl-strings.h:145 msgid "Rotation of jurnal even when it is empty:" msgstr "Ротация файла журнала даже если он пуст:" -#: source/ubl-strings.h:127 +#: source/ubl-strings.h:146 msgid "Do not rotate journal younger than" msgstr "Не ротировать журналы, возраст которых меньше" -#: source/ubl-strings.h:128 +#: source/ubl-strings.h:147 msgid "days" msgstr "дней" -#: source/ubl-strings.h:129 +#: source/ubl-strings.h:148 msgid "Delete rotated journals older than" msgstr "Удалить ротированные журналы старше" -#: source/ubl-strings.h:130 +#: source/ubl-strings.h:149 msgid "Rotate journals if size more than" msgstr "Ротация журналов, если размер превышает" -#: source/ubl-strings.h:131 +#: source/ubl-strings.h:150 msgid "but not earlier than the specified time interval" msgstr "но не раньше указанного интервала времени" -#: source/ubl-strings.h:132 +#: source/ubl-strings.h:151 msgid "before specified time interval" msgstr "до истечения указанного интервала времени" -#: source/ubl-strings.h:133 +#: source/ubl-strings.h:152 msgid "File choosing configuration" msgstr "Настройки выбора файла" -#: source/ubl-strings.h:134 +#: source/ubl-strings.h:153 msgid "Create log" msgstr "Создавать лог" -#: source/ubl-strings.h:135 +#: source/ubl-strings.h:154 msgid "as user:" msgstr "от пользователя:" -#: source/ubl-strings.h:136 +#: source/ubl-strings.h:155 msgid "as group:" msgstr "от группы:" -#: source/ubl-strings.h:137 +#: source/ubl-strings.h:156 msgid "rules:" msgstr "права:" -#: source/ubl-strings.h:138 +#: source/ubl-strings.h:157 msgid "" "Cut source journal fileafter copy creating instead of moving old journal " "file and creating new one" @@ -559,267 +631,229 @@ msgstr "" "После создания копии, обрезать исходный файл журнала взамен перемещения " "старого файла журнала и создания нового" -#: source/ubl-strings.h:139 +#: source/ubl-strings.h:158 msgid "Files and directories configuration" msgstr "Настройки файлов и папок" -#: source/ubl-strings.h:140 +#: source/ubl-strings.h:159 msgid "Delay compression by one journal in queue:" msgstr "Отложить сжание на один журнал в очереди:" -#: source/ubl-strings.h:141 +#: source/ubl-strings.h:160 msgid "Compression configuration" msgstr "Настройка сжатия" -#: source/ubl-strings.h:142 +#: source/ubl-strings.h:161 msgid "Save original log file after rotation if it has specified extension:" msgstr "" "Сохранять оригинальный лог после ротации, если у него указано расширение:" -#: source/ubl-strings.h:143 +#: source/ubl-strings.h:162 msgid "Add date of rotation before log header" msgstr "Добавлять дату ротации перед заголовком старого лога:" -#: source/ubl-strings.h:144 +#: source/ubl-strings.h:163 msgid "Number from which numbering of old logs will begin" msgstr "Номер, с которого будет начата нумерация старых логов:" -#: source/ubl-strings.h:145 +#: source/ubl-strings.h:164 msgid "Filename configuration" msgstr "Настройка имени файлов" -#: source/ubl-strings.h:146 +#: source/ubl-strings.h:165 msgid "Email after rotation:" msgstr "Отправка Email после ротации:" -#: source/ubl-strings.h:147 +#: source/ubl-strings.h:166 msgid "adress:" msgstr "на адрес:" -#: source/ubl-strings.h:148 +#: source/ubl-strings.h:167 msgid "contents:" msgstr "содержимое:" -#: source/ubl-strings.h:149 source/ubl-strings.h:162 +#: source/ubl-strings.h:168 source/ubl-strings.h:181 msgid "Message configuration" msgstr "Настройка сообщения" -#: source/ubl-strings.h:150 +#: source/ubl-strings.h:169 msgid "Manual input:" msgstr "Команды настройки" -#: source/ubl-strings.h:151 +#: source/ubl-strings.h:170 msgid "Log (-s) size:" msgstr "Общий размер лога (-ов):" -#: source/ubl-strings.h:152 +#: source/ubl-strings.h:171 msgid "Same directory" msgstr "Той же папке" -#: source/ubl-strings.h:153 +#: source/ubl-strings.h:172 msgid "Separate directory" msgstr "Другой папке" -#: source/ubl-strings.h:154 +#: source/ubl-strings.h:173 msgid "Output errors if log file does not exist*" msgstr "Выводить ошибки, если лог файла не существует*" -#: source/ubl-strings.h:155 +#: source/ubl-strings.h:174 msgid "Do not output errors if log file does not exist" msgstr "Не выводить ошибки, если лог файла не существует" -#: source/ubl-strings.h:156 +#: source/ubl-strings.h:175 msgid "Do not output" msgstr "Не выводить" -#: source/ubl-strings.h:157 +#: source/ubl-strings.h:176 msgid "Output errors" msgstr "Выводить ошибки" -#: source/ubl-strings.h:158 +#: source/ubl-strings.h:177 msgid "Send Email" msgstr "Отправлять Email" -#: source/ubl-strings.h:159 +#: source/ubl-strings.h:178 msgid "Don't send Email" msgstr "Не отправлять Email" -#: source/ubl-strings.h:160 +#: source/ubl-strings.h:179 msgid "First rotated copy" msgstr "Первая ротированная копия" -#: source/ubl-strings.h:161 +#: source/ubl-strings.h:180 msgid "Last rotated copy" msgstr "Последняя ротированная копия" -#: source/ubl-strings.h:163 +#: source/ubl-strings.h:182 msgid "Endwork command:" msgstr "Команда перед удалением файла журнала:" -#: source/ubl-strings.h:166 +#: source/ubl-strings.h:185 #, fuzzy msgid "Hourly" msgstr "Час" -#: source/ubl-strings.h:167 +#: source/ubl-strings.h:186 msgid "Daily" msgstr "День" -#: source/ubl-strings.h:168 +#: source/ubl-strings.h:187 msgid "Weekly*" msgstr "Неделя*" -#: source/ubl-strings.h:169 +#: source/ubl-strings.h:188 msgid "Monthly" msgstr "Месяц" -#: source/ubl-strings.h:170 +#: source/ubl-strings.h:189 msgid "Yearly" msgstr "Год" -#: source/ubl-strings.h:171 +#: source/ubl-strings.h:190 msgid "Monday" msgstr "Понедельник" -#: source/ubl-strings.h:172 +#: source/ubl-strings.h:191 msgid "Tuesday" msgstr "Вторник" -#: source/ubl-strings.h:173 +#: source/ubl-strings.h:192 msgid "Wednesday" msgstr "Среда" -#: source/ubl-strings.h:174 +#: source/ubl-strings.h:193 msgid "Thursday" msgstr "Четверг" -#: source/ubl-strings.h:175 +#: source/ubl-strings.h:194 msgid "Friday" msgstr "Пятница" -#: source/ubl-strings.h:176 +#: source/ubl-strings.h:195 msgid "Saturday" msgstr "Суббота" -#: source/ubl-strings.h:177 +#: source/ubl-strings.h:196 msgid "Sunday*" msgstr "Воскресенье*" -#: source/ubl-strings.h:178 +#: source/ubl-strings.h:197 msgid "Same record already exists" msgstr "Такая запись уже существует" -#: source/ubl-strings.h:179 +#: source/ubl-strings.h:198 msgid "Empty important field" msgstr "Важное поле не заполнено" -#: source/ubl-strings.h:180 +#: source/ubl-strings.h:199 msgid "Repeating paths" msgstr "Повторяющиеся пути" -#: source/ubl-strings.h:181 +#: source/ubl-strings.h:200 #, fuzzy msgid "Write down all important fields" msgstr "Введите все необходимые поля" -#: source/ubl-strings.h:184 +#: source/ubl-strings.h:203 msgid "System configuration" msgstr "Настройки системы" -#: source/ubl-strings.h:185 +#: source/ubl-strings.h:204 msgid "Applications configuration" msgstr "Настройки приложений" -#: source/ubl-strings.h:188 +#: source/ubl-strings.h:207 msgid "Path (-s):" msgstr "Путь (-и):" -#: source/ubl-strings.h:189 +#: source/ubl-strings.h:208 msgid "Control:" msgstr "Управление:" -#: source/ubl-strings.h:190 +#: source/ubl-strings.h:209 msgid "Log file" msgstr "Файл лога" -#: source/ubl-strings.h:191 +#: source/ubl-strings.h:210 msgid "Name:" msgstr "Имя:" -#: source/ubl-strings.h:194 +#: source/ubl-strings.h:213 msgid "Owner rules" msgstr "Правила владельца" -#: source/ubl-strings.h:195 +#: source/ubl-strings.h:214 msgid "Group rules" msgstr "Правила группы" -#: source/ubl-strings.h:196 +#: source/ubl-strings.h:215 msgid "Public rules" msgstr "Правила остальных" -#: source/ubl-strings.h:197 +#: source/ubl-strings.h:216 msgid "Read" msgstr "Чтение" -#: source/ubl-strings.h:198 +#: source/ubl-strings.h:217 msgid "Write" msgstr "Запись" -#: source/ubl-strings.h:199 +#: source/ubl-strings.h:218 msgid "Execute" msgstr "Исполнение" -#: source/ubl-strings.h:200 +#: source/ubl-strings.h:219 msgid "Value:" msgstr "Значение:" -#: source/ubl-strings.h:203 +#: source/ubl-strings.h:222 msgid ": no such file(s)" msgstr ": файл(ы) не найден(ы)" msgid "System event log rotation service" msgstr "Служба ротации системных журналов событий" -msgid "System event log" -msgstr "Системный журнал событий" - msgid "" -"Service for collecting messages from system events of active network devices" +"Service for collecting messages from system events of active network " +"devices" msgstr "Сервис сбора сообщений системных событий активных сетевых устройств" - -msgid "Log of work and requests to Acpid" -msgstr "Журнал работы и обращений к Acpid" - -msgid "Log of work and requests to the web server" -msgstr "Журнал работы и обращений к веб-серверу" - -msgid "Audit log" -msgstr "Журнал аудита (audit)" - -msgid "Log of authorization procedures" -msgstr "Журнал процедур авторизации" - -msgid "Job scheduler log (cron)" -msgstr "Журнал работы планировщика заданий (cron)" - -msgid "Log of work and calls to the print server (cups)" -msgstr "Журнал работы и обращений к серверу печати (cups)" - -msgid "Log of operation and access to system services" -msgstr "Журнал работы и обращения к службам системы" - -msgid "Log of work and access to Samba" -msgstr "Журнал работы и обращения к Samba" - -msgid "Postfix mail server log" -msgstr "Журнал почтового сервера Postfix" - -msgid "System log" -msgstr "Системный журнал" - -msgid "X.org display server log" -msgstr "Журнал работы дисплейного сервера X.org" - -msgid "Graphics X session log" -msgstr "Журнал сеансов графической системы X"