diff --git a/source/libublsettingsui-gtk3-save.c b/source/libublsettingsui-gtk3-save.c index 316a9f3..370ff5e 100644 --- a/source/libublsettingsui-gtk3-save.c +++ b/source/libublsettingsui-gtk3-save.c @@ -70,6 +70,13 @@ struct loaded_config *yon_save_window_get_saved_parameters(template_saving_windo return final; } +// struct __yon_save_section{ +// int save_size; +// config_str save_config; +// int remove_size; +// config_str remove_config; +// } __yon_save_section; + config_str yon_loaded_config_convert_to_save_command(struct loaded_config *target, int *size,char *path){ (*size)=0; @@ -138,13 +145,24 @@ config_str yon_loaded_config_convert_to_save_command(struct loaded_config *targe for_dictionaries(current,sections){ char *dull_command = NULL; if (current->status>=0){ - dull_command = ubconfig_set_command_full(path,current->key,(char*)current->data); + dull_command = !commands?ubconfig_set_command_full(path,current->key,(char*)current->data):yon_char_unite("-- set ",current->key," ",(char*)current->data,NULL); } else { - dull_command = ubconfig_remove_command_full(path,current->key,(char*)current->data); + dull_command = !commands?ubconfig_remove_command_full(path,current->key,(char*)current->data):yon_char_unite("-- remove ",current->key," ",(char*)current->data, NULL); } yon_char_parsed_add_or_create_if_exists(commands,size,dull_command); free(dull_command); } + // struct yon_temp_command_sections *current; + // for_dictionaries(current,sections){ + // char *dull_command = NULL; + // if (current->status>=0){ + // dull_command = ubconfig_set_command_full(path,current->key,(char*)current->data); + // } else { + // dull_command = ubconfig_remove_command_full(path,current->key,(char*)current->data); + // } + // yon_char_parsed_add_or_create_if_exists(commands,size,dull_command); + // free(dull_command); + // } } return commands; } @@ -378,29 +396,38 @@ struct loaded_config *yon_config_convert_parameter(config_str parsed, int size){ for (int i=0;ikey=key; + loaded->key=yon_char_new(key); loaded->first=loaded; loaded->next=NULL; loaded->prev=NULL; - loaded->section=NULL; - loaded->data=value; + loaded->section=yon_char_new(section); + loaded->data=yon_char_new(value); } else { loaded->next = (struct loaded_config*)malloc(sizeof(struct loaded_config)); struct loaded_config *next=loaded->next; next->first=loaded->first; next->prev=loaded; - next->key=key; + next->key=yon_char_new(key); next->first=loaded->first; next->next=NULL; - next->section=NULL; - next->data=value; + next->section=yon_char_new(section); + next->data=yon_char_new(value); loaded=next; } + if (!yon_char_is_empty(value)) free(value); + if (!yon_char_is_empty(key)) free(key); + if (!yon_char_is_empty(section)) free(section); } return loaded; } @@ -464,7 +491,7 @@ struct loaded_config *yon_config_get_compared(char *command){ if (config&&size>0){ for (int i=0;itype!=YON_CONFIG_CUSTOM? yon_config_get_type_path(window->type):window->custom_save_path); yon_config_parameter_prepare_elements(commands,&size); - char *final_command = yon_char_parsed_to_string(commands,size,";"); + char *final_command = yon_char_parsed_to_string(commands,size," "); char *new_str_closed = yon_char_replace(final_command,"\n","\\n"); if (presave_function)