|
|
|
|
@ -3,6 +3,39 @@
|
|
|
|
|
|
|
|
|
|
// // storage-configure window section
|
|
|
|
|
|
|
|
|
|
void yon_storage_open_add_repos(char *storage_path, storage_config_window *window){
|
|
|
|
|
int size;
|
|
|
|
|
config_str repos = yon_file_list_dirs(storage_path,&size);
|
|
|
|
|
|
|
|
|
|
storage_struct *storage = g_hash_table_lookup(window->storages_copy,storage_path);
|
|
|
|
|
if (size){
|
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
|
char *repo_name = repos[i];
|
|
|
|
|
if (g_hash_table_lookup(storage->repos,repo_name)){
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),ALREADY_EXIST_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
yon_ubl_status_highlight_incorrect(window->AddEntry);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
char *new_repo = yon_char_new(repo_name);
|
|
|
|
|
repo_struct *repo = yon_repo_struct_new();
|
|
|
|
|
storage_repo_block *block = yon_storage_repo_block_new();
|
|
|
|
|
g_object_set_data(G_OBJECT(block->SignatureCombo),"repo_storage",repo);
|
|
|
|
|
g_object_set_data(G_OBJECT(block->SignatureCombo),"window",window);
|
|
|
|
|
g_object_set_data(G_OBJECT(block->RepoRemoveButton),"window",window);
|
|
|
|
|
repo->name=new_repo;
|
|
|
|
|
block->repo_name=new_repo;
|
|
|
|
|
repo->path = yon_char_unite(storage_path,"/",new_repo,NULL);
|
|
|
|
|
repo->storage_path = yon_char_new(storage_path);
|
|
|
|
|
yon_config_append_element(storage->path,(char*)repo->path,",");
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(block->RepoNameEntry),new_repo);
|
|
|
|
|
gtk_box_pack_start(GTK_BOX(window->ReposBox),block->MainBox,0,0,0);
|
|
|
|
|
g_hash_table_insert(storage->repos,repo->name,repo);
|
|
|
|
|
// yon_storage_struct_add_repo(storage,repo);
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->AddEntry),"");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_storage_open(GtkWidget *self, storage_config_window *window){
|
|
|
|
|
|
|
|
|
|
filechooser_window *dialog = yon_file_chooser_window_new(GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
|
|
|
|
|
@ -17,6 +50,7 @@ void on_storage_open(GtkWidget *self, storage_config_window *window){
|
|
|
|
|
while (gtk_events_pending()) gtk_main_iteration();
|
|
|
|
|
gtk_combo_box_set_active_id(GTK_COMBO_BOX(window->StoragePathCombo),storage->path);
|
|
|
|
|
yon_config_register(storage->path,STORAGE_command,"");
|
|
|
|
|
yon_storage_open_add_repos(storage->path,window);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|