|
|
|
@ -582,6 +582,7 @@ void on_logrotate_period_check_toggled(GtkToggleButton *self,logrotate_configure
|
|
|
|
void on_logrotate_save(GtkWidget *self, dictionary *dict){
|
|
|
|
void on_logrotate_save(GtkWidget *self, dictionary *dict){
|
|
|
|
logrotate_window *dialog = yon_dictionary_get_data(dict->first,logrotate_window*);
|
|
|
|
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*);
|
|
|
|
logrotate_configure_window *window = yon_dictionary_get_data(dict->first->next,logrotate_configure_window*);
|
|
|
|
|
|
|
|
char *log_name="";
|
|
|
|
char *paths="";
|
|
|
|
char *paths="";
|
|
|
|
char *period="";
|
|
|
|
char *period="";
|
|
|
|
char *size="";
|
|
|
|
char *size="";
|
|
|
|
@ -618,6 +619,13 @@ void on_logrotate_save(GtkWidget *self, dictionary *dict){
|
|
|
|
config_str found_paths_list=NULL;
|
|
|
|
config_str found_paths_list=NULL;
|
|
|
|
int found_paths=0;
|
|
|
|
int found_paths=0;
|
|
|
|
char *cur_check_paths;
|
|
|
|
char *cur_check_paths;
|
|
|
|
|
|
|
|
log_name = (char*)gtk_entry_get_text(GTK_ENTRY(window->LogNameEntry));
|
|
|
|
|
|
|
|
if (!strcmp(log_name,"")){
|
|
|
|
|
|
|
|
yon_ubl_status_highlight_incorrect(window->LogNameEntry);
|
|
|
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(main_config.logrotate_list),&iter);
|
|
|
|
int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(main_config.logrotate_list),&iter);
|
|
|
|
for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(main_config.logrotate_list),&iter)){
|
|
|
|
for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(main_config.logrotate_list),&iter)){
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(main_config.logrotate_list),&iter,1,&cur_check_paths,-1);
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(main_config.logrotate_list),&iter,1,&cur_check_paths,-1);
|
|
|
|
@ -625,6 +633,11 @@ void on_logrotate_save(GtkWidget *self, dictionary *dict){
|
|
|
|
else found_paths_list = yon_char_parsed_append(found_paths_list,&found_paths,cur_check_paths);
|
|
|
|
else found_paths_list = yon_char_parsed_append(found_paths_list,&found_paths,cur_check_paths);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&iter);
|
|
|
|
valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&iter);
|
|
|
|
|
|
|
|
if (!valid) {
|
|
|
|
|
|
|
|
yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(window->LogPathsTree));
|
|
|
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(window->list),&iter)){
|
|
|
|
for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(window->list),&iter)){
|
|
|
|
char *cur_path;
|
|
|
|
char *cur_path;
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,0,&cur_path,-1);
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,0,&cur_path,-1);
|
|
|
|
@ -634,12 +647,13 @@ void on_logrotate_save(GtkWidget *self, dictionary *dict){
|
|
|
|
path_amount++;
|
|
|
|
path_amount++;
|
|
|
|
paths = yon_char_unite(paths,strcmp(paths,"") ? "," : "", cur_path,NULL);
|
|
|
|
paths = yon_char_unite(paths,strcmp(paths,"") ? "," : "", cur_path,NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!window->paths)
|
|
|
|
if(!window->paths) {
|
|
|
|
if (matched==path_amount) {
|
|
|
|
if (matched==path_amount) {
|
|
|
|
yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(window->LogPathsTree));
|
|
|
|
yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(window->LogPathsTree));
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),REPEATED_PATHS_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),REPEATED_PATHS_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->RotationPeriodCheck))){
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->RotationPeriodCheck))){
|
|
|
|
int active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->RotationPeriodMainCombo));
|
|
|
|
int active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->RotationPeriodMainCombo));
|
|
|
|
switch (active){
|
|
|
|
switch (active){
|
|
|
|
@ -789,6 +803,11 @@ void on_logrotate_save(GtkWidget *self, dictionary *dict){
|
|
|
|
char *endwork = (char*)gtk_entry_get_text(GTK_ENTRY(window->EndworkCommandEntry));
|
|
|
|
char *endwork = (char*)gtk_entry_get_text(GTK_ENTRY(window->EndworkCommandEntry));
|
|
|
|
sharedscripts = "sharedscripts";
|
|
|
|
sharedscripts = "sharedscripts";
|
|
|
|
if (!yon_char_is_empty(before_once)) {
|
|
|
|
if (!yon_char_is_empty(before_once)) {
|
|
|
|
|
|
|
|
if (strcmp(before_once,",")){
|
|
|
|
|
|
|
|
yon_ubl_status_highlight_incorrect(window->CommandBeforeOnceEntry);
|
|
|
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
before_once = yon_char_replace(before_once,"\"","=--");
|
|
|
|
before_once = yon_char_replace(before_once,"\"","=--");
|
|
|
|
before_once = yon_char_replace(before_once,"=--","\\\"");
|
|
|
|
before_once = yon_char_replace(before_once,"=--","\\\"");
|
|
|
|
firstaction = yon_char_append("firstaction,",before_once);
|
|
|
|
firstaction = yon_char_append("firstaction,",before_once);
|
|
|
|
@ -834,7 +853,7 @@ void on_logrotate_save(GtkWidget *self, dictionary *dict){
|
|
|
|
gtk_list_store_append(main_config.logrotate_list,&iter);
|
|
|
|
gtk_list_store_append(main_config.logrotate_list,&iter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
paths=yon_char_replace(paths,",","\n");
|
|
|
|
paths=yon_char_replace(paths,",","\n");
|
|
|
|
gtk_list_store_set(main_config.logrotate_list,&iter,0,gtk_entry_get_text(GTK_ENTRY(window->LogNameEntry)),1,paths,2,gtk_entry_get_text(GTK_ENTRY(window->LogDescriptionEntry)),-1);
|
|
|
|
gtk_list_store_set(main_config.logrotate_list,&iter,0,log_name,1,paths,2,gtk_entry_get_text(GTK_ENTRY(window->LogDescriptionEntry)),-1);
|
|
|
|
on_close_subwindow(window->MainWindow);
|
|
|
|
on_close_subwindow(window->MainWindow);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|