diff --git a/source/libublsettingsui-gtk3.c b/source/libublsettingsui-gtk3.c index f4312d9..ffd1660 100644 --- a/source/libublsettingsui-gtk3.c +++ b/source/libublsettingsui-gtk3.c @@ -163,7 +163,7 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){ 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); + char *command = yon_char_unite(ubconfig_load_command," default get ", dct->key," ", yon_dictionary_get_data(dct,char*),NULL); FILE *output = popen(command, "r"); char **output_strings = NULL; output_strings = malloc(sizeof(char*)); @@ -183,6 +183,32 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){ } } } + 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'; + dictionary *found=NULL; + if (!(found=yon_dictionary_get(&loaded.dict,dct->key))){ + 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)); + } else{ + loaded.dict->data = final_str; + } + } + } + } GtkBuilder *builder = gtk_builder_new_from_resource(ui_glade_path_saving); template_saving_window *window = malloc(sizeof(template_saving_window)); window->Window = yon_gtk_builder_get_widget(builder,"Window");