diff --git a/gresource.xml b/gresource.xml
index bf9d603..f7a9968 100644
--- a/gresource.xml
+++ b/gresource.xml
@@ -7,6 +7,7 @@
ubl-settings-logging-inspector.glade
ubl-settings-logging-logrotate.glade
ubl-settings-logging-journald.glade
+ ubl-settings-logging-rules.glade
ubl-settings-logging-logrotate-table.glade
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index 48c020f..24aa362 100644
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -38,6 +38,7 @@ set(DEPENDFILES
../ubl-settings-logging.glade
../ubl-settings-logging-add.glade
../ubl-settings-logging-add-path.glade
+ ../ubl-settings-logging-rules.glade
../ubl-settings-logging-inspector.glade
../ubl-settings-logging-journald.glade
../ubl-settings-logging-logrotate.glade
diff --git a/source/ubl-settings-logging.c b/source/ubl-settings-logging.c
index ac34c9d..cd8a2c7 100644
--- a/source/ubl-settings-logging.c
+++ b/source/ubl-settings-logging.c
@@ -135,7 +135,7 @@ void update_loaded_logrotate(){
char *paths = yon_char_divide_search(loaded[i],"=",-1);
yon_char_divide(paths,strlen("LOGROTATE"));
yon_char_divide_search_self(paths,"]",-1);
- yon_char_replace(loaded[i],",","\n");
+ loaded[i] = yon_char_replace(loaded[i],",","\n");
gtk_list_store_append(main_config.logrotate_list,&iter);
gtk_list_store_set(main_config.logrotate_list,&iter,1,paths,-1);
}
@@ -153,12 +153,14 @@ void on_load_global(){
yon_load_proceed(YON_CONFIG_GLOBAL);
main_config.load_mode=0;
yon_ubl_status_box_render(GLOBAL_LOAD_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
+ update_loaded_logrotate();
}
void on_load_local(){
yon_load_proceed(YON_CONFIG_LOCAL);
main_config.load_mode=1;
yon_ubl_status_box_render(LOCAL_LOAD_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
+ update_loaded_logrotate();
}
@@ -184,13 +186,13 @@ void on_save_global_local(){
}
void on_save_global(){
- yon_save_proceed("system",YON_CONFIG_LOCAL);
+ yon_save_proceed("global",YON_CONFIG_LOCAL);
yon_ubl_status_box_render(LOCAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
}
void on_save_local(){
- yon_save_proceed("global",YON_CONFIG_GLOBAL);
+ yon_save_proceed("system",YON_CONFIG_GLOBAL);
yon_ubl_status_box_render(GLOBAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
}
@@ -697,8 +699,6 @@ logrotate_configure_window *yon_logrotate_window_new(char *paths, logrotate_wind
yon_char_parsed_free(parsed,size);
char *parameters = yon_config_get_by_key(LOGROTATE(paths));
if (parameters){
- parameters = yon_char_replace(parameters,",\t",",");
- if (parameters[0]==',') yon_char_divide_search(parameters,",",-1);
parsed = yon_char_parse(parameters,&size,",");
for (int i=0;iCommandBeforeOnceEntry),value);
// i++;
}else if (!strcmp(parsed[i],"endscript")){
- char *value = parsed[i+1];
- gtk_entry_set_text(GTK_ENTRY(window->EndworkCommandEntry),value);
- i++;
}
}
}
@@ -878,7 +875,7 @@ void on_logrotate_remove(GtkWidget *self, logrotate_window *window){
gtk_tree_model_get(model,&iter,1,&paths,-1);
gtk_list_store_remove(main_config.logrotate_list,&iter);
yon_char_replace(paths,"\n",",");
- yon_config_remove_by_key(paths);
+ yon_config_remove_by_key(LOGROTATE(paths));
}
}
@@ -891,6 +888,8 @@ void on_logrotate_apps_configure(GtkWidget *self, logrotate_window *window){
char *settings;
gtk_list_store_append(main_config.logrotate_list,&itar);
gtk_tree_model_get(model,&iter,0,&name,1,&paths,2,&settings,-1);
+ 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);
}
@@ -1505,7 +1504,7 @@ main_window *setup_window(){
services[i]=yon_char_divide_search(services[i],"\n",-1);
config_str log = yon_char_parse(services[i],&log_size,";");
gtk_list_store_append(widgets->ServicesList,&iter);
- gtk_list_store_set(widgets->ServicesList,&iter,0,0,1,0,2,log[0],3,log[1],-1);
+ gtk_list_store_set(widgets->ServicesList,&iter,0,1,1,1,2,log[0],3,log[1],-1);
}
}
config_str dirs = yon_config_load(logrotate_config_command,&dirs_size);
@@ -1554,6 +1553,13 @@ main_window *setup_window(){
g_signal_connect(G_OBJECT(widgets->ConfigureButton),"clicked",G_CALLBACK(on_log_edit),widgets);
g_signal_connect(G_OBJECT(widgets->RemoveButton),"clicked",G_CALLBACK(on_log_remove),widgets);
g_signal_connect(G_OBJECT(widgets->ServicesEditButton),"clicked",G_CALLBACK(on_service_edit),widgets);
+
+ g_signal_connect(G_OBJECT(widgets->SaveMenuItem),"activate",G_CALLBACK(on_save_global_local),NULL);
+ g_signal_connect(G_OBJECT(widgets->SaveGlobalMenuItem),"activate",G_CALLBACK(on_save_global),NULL);
+ g_signal_connect(G_OBJECT(widgets->SaveLocalMenuItem),"activate",G_CALLBACK(on_save_local),NULL);
+
+ g_signal_connect(G_OBJECT(widgets->LoadGlobalMenuItem),"activate",G_CALLBACK(on_load_global),NULL);
+ g_signal_connect(G_OBJECT(widgets->LoadLocalMenuItem),"activate",G_CALLBACK(on_load_local),NULL);
gtk_widget_show(widgets->Window);
@@ -1651,6 +1657,7 @@ int main(int argc, char *argv[]){
yon_window_config_setup(GTK_WINDOW(widgets->Window));
yon_load_proceed(YON_CONFIG_LOCAL);
yon_window_config_load(config_path);
+ yon_load_proceed(YON_CONFIG_LOCAL);
update_loaded_logrotate();
GtkCssProvider *css=gtk_css_provider_new();
gtk_css_provider_load_from_resource(css,CssPath);
diff --git a/source/ubl-utils.c b/source/ubl-utils.c
index 32460ab..29373da 100644
--- a/source/ubl-utils.c
+++ b/source/ubl-utils.c
@@ -1314,7 +1314,7 @@ int yon_config_save_registered(char *path){
if (((yon_config_parameter*)dct)->flag1==1){
((yon_config_parameter*)dct)->flag1=0;
if (sections_add&&yon_dictionary_get(§ions_add,((yon_config_parameter*)dct)->section)) sections_add->data=(void*)yon_char_unite(yon_dictionary_get_data(sections_add,char*)," ",dct->key,"=",yon_dictionary_get_data(dct,char*),NULL);
- else yon_dictionary_add_or_create_if_exists_with_data(sections_add,((yon_config_parameter*)dct)->section,yon_char_unite (ubconfig_save_command,path ? yon_char_append(" --target ",path):"", " set ", ((yon_config_parameter*)dct)->section, " ",dct->key,"=",yon_dictionary_get_data(dct,char*),NULL));
+ else yon_dictionary_add_or_create_if_exists_with_data(sections_add,((yon_config_parameter*)dct)->section,yon_char_unite (ubconfig_save_command,path ? yon_char_append(" --target ",path):"", " set ", ((yon_config_parameter*)dct)->section, " ",dct->key,"=\"",yon_dictionary_get_data(dct,char*),"\"",NULL));
} else if (((yon_config_parameter*)dct)->flag1==-1){
((yon_config_parameter*)dct)->flag1=0;
if (sections_remove&&yon_dictionary_get(§ions_remove,((yon_config_parameter*)dct)->section)) sections_remove->data=(void*)yon_char_unite(yon_dictionary_get_data(sections_remove,char*)," ",dct->key,NULL);
diff --git a/ubl-settings-logging-logrotate.glade b/ubl-settings-logging-logrotate.glade
index 2a16c16..637791d 100644
--- a/ubl-settings-logging-logrotate.glade
+++ b/ubl-settings-logging-logrotate.glade
@@ -387,1643 +387,1619 @@
-