|
|
|
@ -41,6 +41,12 @@ 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_char_is_empty(main_config.last_selection)){
|
|
|
|
|
|
|
|
char *user_folder_path = yon_ubl_user_get_home_directory();
|
|
|
|
|
|
|
|
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog->MainFileChooser),user_folder_path);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog->MainFileChooser),main_config.last_selection);
|
|
|
|
|
|
|
|
}
|
|
|
|
if (yon_file_chooser_start(dialog)==GTK_RESPONSE_ACCEPT){
|
|
|
|
if (yon_file_chooser_start(dialog)==GTK_RESPONSE_ACCEPT){
|
|
|
|
char *filename = dialog->last_success_selection;
|
|
|
|
char *filename = dialog->last_success_selection;
|
|
|
|
int exist_size=0;
|
|
|
|
int exist_size=0;
|
|
|
|
@ -55,6 +61,8 @@ void on_storage_open(GtkWidget *self, storage_config_window *window){
|
|
|
|
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);
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(main_config.last_selection)) free(main_config.last_selection);
|
|
|
|
|
|
|
|
main_config.last_selection = 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,'/')));
|
|
|
|
g_hash_table_insert(window->storages_copy,storage->path,storage);
|
|
|
|
g_hash_table_insert(window->storages_copy,storage->path,storage);
|
|
|
|
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->StoragePathCombo),storage->path,storage->path);
|
|
|
|
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->StoragePathCombo),storage->path,storage->path);
|
|
|
|
@ -68,6 +76,12 @@ void on_storage_open(GtkWidget *self, storage_config_window *window){
|
|
|
|
|
|
|
|
|
|
|
|
void on_storage_create(GtkWidget *self, storage_config_window *window){
|
|
|
|
void on_storage_create(GtkWidget *self, storage_config_window *window){
|
|
|
|
filechooser_window *dialog = yon_file_chooser_window_new(GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER);
|
|
|
|
filechooser_window *dialog = yon_file_chooser_window_new(GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER);
|
|
|
|
|
|
|
|
if (yon_char_is_empty(main_config.last_selection)){
|
|
|
|
|
|
|
|
char *user_folder_path = yon_ubl_user_get_home_directory();
|
|
|
|
|
|
|
|
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog->MainFileChooser),user_folder_path);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog->MainFileChooser),main_config.last_selection);
|
|
|
|
|
|
|
|
}
|
|
|
|
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){
|
|
|
|
@ -84,6 +98,8 @@ void on_storage_create(GtkWidget *self, storage_config_window *window){
|
|
|
|
yon_char_parsed_free(exist_storages,exist_size);
|
|
|
|
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);
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(main_config.last_selection)) free(main_config.last_selection);
|
|
|
|
|
|
|
|
main_config.last_selection = 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,'/')));
|
|
|
|
g_hash_table_insert(window->storages_copy,storage->path,storage);
|
|
|
|
g_hash_table_insert(window->storages_copy,storage->path,storage);
|
|
|
|
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->StoragePathCombo),storage->path,storage->path);
|
|
|
|
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->StoragePathCombo),storage->path,storage->path);
|
|
|
|
|