|
|
|
@ -170,9 +170,14 @@ void update_loaded_logrotate(){
|
|
|
|
|
yon_char_divide_search_self(paths,"]",-1);
|
|
|
|
|
yon_window_config_get_parameter("description",paths,&desc,YON_TYPE_STRING);
|
|
|
|
|
yon_window_config_get_parameter("render_name",paths,&name,YON_TYPE_STRING);
|
|
|
|
|
paths = yon_char_replace(paths,",","\n");
|
|
|
|
|
char *parameters = strstr(loaded[i],":");
|
|
|
|
|
if(!parameters) continue;
|
|
|
|
|
char *paths_found=yon_char_divide(loaded[i],strlen(loaded[i])-strlen(parameters));
|
|
|
|
|
paths_found = yon_char_replace(paths_found,",","\n");
|
|
|
|
|
if(paths_found[0]=='\"') yon_char_divide(paths_found,0);
|
|
|
|
|
if(paths_found[strlen(paths_found)-1]=='\"') paths_found[strlen(paths_found)-1]='\"';
|
|
|
|
|
gtk_list_store_append(main_config.logrotate_list,&iter);
|
|
|
|
|
gtk_list_store_set(main_config.logrotate_list,&iter,0,name,1,paths,2,desc ? desc : "",-1);
|
|
|
|
|
gtk_list_store_set(main_config.logrotate_list,&iter,0,paths,1,paths_found,2,desc ? desc : "",-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1032,7 +1037,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);
|
|
|
|
@ -1045,7 +1051,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");
|
|
|
|
@ -1121,7 +1127,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;i<sz;i++){
|
|
|
|
@ -1200,135 +1206,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; i<size;i++){
|
|
|
|
|
gtk_list_store_append(window->list,&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;i<size;i++){
|
|
|
|
|
if (!strcmp(parsed[i],"hourly")){
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(window->RotationPeriodMainCombo),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;i<size;i++){
|
|
|
|
|
if (!strcmp(parsed[i],"hourly")){
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(window->RotationPeriodMainCombo),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")){
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1338,7 +1358,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);
|
|
|
|
@ -1361,9 +1381,9 @@ void on_logrotate_edit(GtkWidget *self, logrotate_window *window){
|
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
|
paths=yon_char_unite(paths ? yon_char_append(paths,","):"",path_parsed[i],NULL);
|
|
|
|
|
}
|
|
|
|
|
logrotate_configure_window *dialog = yon_logrotate_window_new(paths,window);
|
|
|
|
|
gtk_widget_show(dialog->MainWindow);
|
|
|
|
|
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);
|
|
|
|
@ -1379,7 +1399,7 @@ 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));
|
|
|
|
@ -1417,8 +1437,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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1438,7 +1459,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);
|
|
|
|
@ -2339,6 +2360,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;
|
|
|
|
|
|
|
|
|
|