|
|
|
|
@ -70,6 +70,23 @@ void on_file_chooser_exit(GtkWidget *, filechooser_window *){
|
|
|
|
|
__yon_filechooser_window = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_file_chooser_check_root(GtkWidget *, filechooser_window *window){
|
|
|
|
|
char *cur_path = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(window->MainFileChooser));
|
|
|
|
|
if (!yon_char_is_empty(window->root)&&!strstr(cur_path,window->root)) gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(window->MainFileChooser),window->root);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_file_chooser_set_root(filechooser_window *window, char *root_path){
|
|
|
|
|
window->root = yon_char_new(root_path);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->MainFileChooser),"current-folder-changed",G_CALLBACK(on_file_chooser_check_root),window);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_file_chooser_remove_root(filechooser_window *window, char *root_path){
|
|
|
|
|
if (!yon_char_is_empty(window->root)) free(window->root);
|
|
|
|
|
window->root=NULL;
|
|
|
|
|
g_signal_handlers_disconnect_by_func(G_OBJECT(window->MainFileChooser),G_CALLBACK(on_file_chooser_check_root),window);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
filechooser_window *yon_file_chooser_window_new(GtkFileChooserAction action){
|
|
|
|
|
if (!__yon_filechooser_window){
|
|
|
|
|
filechooser_window *window = malloc(sizeof(filechooser_window));
|
|
|
|
|
@ -84,6 +101,8 @@ filechooser_window *yon_file_chooser_window_new(GtkFileChooserAction action){
|
|
|
|
|
window->ChooseFolderCheck = yon_gtk_builder_get_widget(builder,"ChooseFolderCheck");
|
|
|
|
|
window->last_any_selection=NULL;
|
|
|
|
|
window->last_success_selection=NULL;
|
|
|
|
|
window->root=NULL;
|
|
|
|
|
g_signal_connect(G_OBJECT(window->ChooseFolderCheck),"toggled",G_CALLBACK(on_file_chooser_selected),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->MainFileChooser),"selection-changed",G_CALLBACK(on_file_chooser_selected),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_file_chooser_cancel),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->SaveButton),"clicked",G_CALLBACK(on_file_chooser_accept),window);
|
|
|
|
|
|