|
|
|
@ -184,11 +184,13 @@ void yon_storage_config_update(storage_config_window *window){
|
|
|
|
const char *active = gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->StoragePathCombo));
|
|
|
|
const char *active = gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->StoragePathCombo));
|
|
|
|
if (active){
|
|
|
|
if (active){
|
|
|
|
storage_struct *storage = g_hash_table_lookup(window->storages_copy,active);
|
|
|
|
storage_struct *storage = g_hash_table_lookup(window->storages_copy,active);
|
|
|
|
GList *repos = g_hash_table_get_values(storage->repos);
|
|
|
|
int size;
|
|
|
|
|
|
|
|
config_str repo_keys = (config_str)g_hash_table_get_keys_as_array(storage->repos,&size);
|
|
|
|
|
|
|
|
qsort(repo_keys,size,sizeof(char*),yon_char_parsed_compare);
|
|
|
|
|
|
|
|
for (int i = 0;i<size;i++){
|
|
|
|
|
|
|
|
repo_struct *repos = g_hash_table_lookup(storage->repos,repo_keys[i]);
|
|
|
|
if (repos){
|
|
|
|
if (repos){
|
|
|
|
GList *iter;
|
|
|
|
repo_struct *cur_repo = repos;
|
|
|
|
for (iter = repos;iter;iter=iter->next){
|
|
|
|
|
|
|
|
repo_struct *cur_repo = (repo_struct*)iter->data;
|
|
|
|
|
|
|
|
storage_repo_block *cur_block = NULL;
|
|
|
|
storage_repo_block *cur_block = NULL;
|
|
|
|
cur_block = yon_storage_repo_block_new();
|
|
|
|
cur_block = yon_storage_repo_block_new();
|
|
|
|
g_object_set_data(G_OBJECT(cur_block->SignatureCombo),"repo_storage",cur_repo);
|
|
|
|
g_object_set_data(G_OBJECT(cur_block->SignatureCombo),"repo_storage",cur_repo);
|
|
|
|
@ -229,11 +231,32 @@ void yon_storage_remove(char *key, storage_struct *storage,void*){
|
|
|
|
yon_storage_sturct_free_full(storage);
|
|
|
|
yon_storage_sturct_free_full(storage);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int yon_char_parsed_compare(const void *a, const void *b){
|
|
|
|
|
|
|
|
const config_str str_a = (const config_str)a;
|
|
|
|
|
|
|
|
const config_str str_b = (const config_str)b;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return strcmp(*str_a,*str_b);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void on_storage_accept(GtkWidget *self, dictionary *dict){
|
|
|
|
void on_storage_accept(GtkWidget *self, dictionary *dict){
|
|
|
|
main_window *widgets = yon_dictionary_get_data(dict->first,main_window*);
|
|
|
|
main_window *widgets = yon_dictionary_get_data(dict->first,main_window*);
|
|
|
|
storage_config_window *window = yon_dictionary_get_data(dict->first->next,storage_config_window*);
|
|
|
|
storage_config_window *window = yon_dictionary_get_data(dict->first->next,storage_config_window*);
|
|
|
|
gtk_widget_destroy(window->MainWindow);
|
|
|
|
gtk_widget_destroy(window->MainWindow);
|
|
|
|
g_hash_table_foreach_remove(window->storages_copy,(GHRFunc)yon_storage_remove,NULL);
|
|
|
|
int size;
|
|
|
|
|
|
|
|
config_str keys = (config_str)g_hash_table_get_keys_as_array(window->storages_copy,&size);
|
|
|
|
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
|
|
|
|
int repos_size;
|
|
|
|
|
|
|
|
config_str repos = yon_char_parse(config(keys[i]),&repos_size,",");
|
|
|
|
|
|
|
|
qsort(repos,repos_size,sizeof(char*),yon_char_parsed_compare);
|
|
|
|
|
|
|
|
char *repos_string = yon_char_parsed_to_string(repos,repos_size,",");
|
|
|
|
|
|
|
|
yon_config_set(keys[i],repos_string);
|
|
|
|
|
|
|
|
free(repos_string);
|
|
|
|
|
|
|
|
yon_char_parsed_free(repos,repos_size);
|
|
|
|
|
|
|
|
yon_storage_remove(keys[i],g_hash_table_lookup(window->storages_copy,keys[i]),NULL);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
g_hash_table_remove_all(window->storages_copy);
|
|
|
|
|
|
|
|
// g_hash_table_foreach_remove(window->storages_copy,(GHRFunc)yon_storage_remove,NULL);
|
|
|
|
g_hash_table_unref(window->storages_copy);
|
|
|
|
g_hash_table_unref(window->storages_copy);
|
|
|
|
free(window);
|
|
|
|
free(window);
|
|
|
|
yon_interface_update(widgets);
|
|
|
|
yon_interface_update(widgets);
|
|
|
|
@ -281,6 +304,7 @@ storage_config_window *yon_storage_config_window_new(){
|
|
|
|
repo_struct *repo = (repo_struct*)iter2->data;
|
|
|
|
repo_struct *repo = (repo_struct*)iter2->data;
|
|
|
|
yon_char_parsed_add_or_create_if_exists(paths,&repos_size,repo->path);
|
|
|
|
yon_char_parsed_add_or_create_if_exists(paths,&repos_size,repo->path);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
qsort(paths,repos_size,sizeof(char*),yon_char_parsed_compare);
|
|
|
|
yon_config_register(storage->path,STORAGE_command,yon_char_parsed_to_string(paths,repos_size,","));
|
|
|
|
yon_config_register(storage->path,STORAGE_command,yon_char_parsed_to_string(paths,repos_size,","));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
|