|
|
|
@ -42,7 +42,16 @@ void on_storage_open(GtkWidget *self, storage_config_window *window){
|
|
|
|
filechooser_window *dialog = yon_file_chooser_window_new(GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
|
|
|
|
filechooser_window *dialog = yon_file_chooser_window_new(GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
|
|
|
|
yon_gtk_window_setup(GTK_WINDOW(dialog->Window),GTK_WINDOW(window->MainWindow),OPEN_EXISTING_TOOLTIP_LABEL,icon_path,"file_chooser_window");
|
|
|
|
yon_gtk_window_setup(GTK_WINDOW(dialog->Window),GTK_WINDOW(window->MainWindow),OPEN_EXISTING_TOOLTIP_LABEL,icon_path,"file_chooser_window");
|
|
|
|
if (yon_file_chooser_start(dialog)==GTK_RESPONSE_ACCEPT){
|
|
|
|
if (yon_file_chooser_start(dialog)==GTK_RESPONSE_ACCEPT){
|
|
|
|
char *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog->MainFileChooser));
|
|
|
|
char *filename = dialog->last_success_selection;
|
|
|
|
|
|
|
|
int exist_size=0;
|
|
|
|
|
|
|
|
config_str exist_storages = (config_str)g_hash_table_get_keys_as_array(main_config.storages,&exist_size);
|
|
|
|
|
|
|
|
for (int i=0;i<exist_size;i++){
|
|
|
|
|
|
|
|
if (strstr(filename,exist_storages[i])){
|
|
|
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),INSIDE_STORAGE_ERROR_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
yon_char_parsed_free(exist_storages,exist_size);
|
|
|
|
storage_struct *storage = yon_storage_struct_new();
|
|
|
|
storage_struct *storage = yon_storage_struct_new();
|
|
|
|
storage->path=dialog->last_success_selection;
|
|
|
|
storage->path=dialog->last_success_selection;
|
|
|
|
storage->name = yon_char_new(storage->path);
|
|
|
|
storage->name = yon_char_new(storage->path);
|
|
|
|
@ -62,7 +71,17 @@ void on_storage_create(GtkWidget *self, storage_config_window *window){
|
|
|
|
yon_gtk_window_setup(GTK_WINDOW(dialog->Window),GTK_WINDOW(window->MainWindow),CREATE_NEW_STORAGE_LABEL,icon_path,"file_chooser_window");
|
|
|
|
yon_gtk_window_setup(GTK_WINDOW(dialog->Window),GTK_WINDOW(window->MainWindow),CREATE_NEW_STORAGE_LABEL,icon_path,"file_chooser_window");
|
|
|
|
gtk_button_set_label(GTK_BUTTON(dialog->SaveButton),yon_char_get_localised_from_lib(CREATE_NEW_TOOLTIP_LABEL));
|
|
|
|
gtk_button_set_label(GTK_BUTTON(dialog->SaveButton),yon_char_get_localised_from_lib(CREATE_NEW_TOOLTIP_LABEL));
|
|
|
|
if (yon_file_chooser_start(dialog)==GTK_RESPONSE_APPLY){
|
|
|
|
if (yon_file_chooser_start(dialog)==GTK_RESPONSE_APPLY){
|
|
|
|
|
|
|
|
int exist_size=0;
|
|
|
|
|
|
|
|
config_str exist_storages = (config_str)g_hash_table_get_keys_as_array(main_config.storages,&exist_size);
|
|
|
|
|
|
|
|
for (int i=0;i<exist_size;i++){
|
|
|
|
|
|
|
|
if (strstr(dialog->last_success_selection,exist_storages[i])){
|
|
|
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),INSIDE_STORAGE_ERROR_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
storage_struct *storage = yon_storage_struct_new();
|
|
|
|
storage_struct *storage = yon_storage_struct_new();
|
|
|
|
|
|
|
|
yon_char_parsed_free(exist_storages,exist_size);
|
|
|
|
storage->path=dialog->last_success_selection;
|
|
|
|
storage->path=dialog->last_success_selection;
|
|
|
|
storage->name = yon_char_new(storage->path);
|
|
|
|
storage->name = yon_char_new(storage->path);
|
|
|
|
free(yon_char_divide(storage->name,yon_char_find_last(storage->name,'/')));
|
|
|
|
free(yon_char_divide(storage->name,yon_char_find_last(storage->name,'/')));
|
|
|
|
|