@@ -123,25 +123,19 @@ public static class OpenFolderDialog
123123 if ( Gtk . Global . IsSupported )
124124 {
125125 string ? result ;
126- Gtk . Application . Init ( ) ; // spins a main loop
127- try
128- {
129- using Gtk . FileChooserNative dlg = new (
130- "Open a folder" , null ,
131- Gtk . FileChooserAction . SelectFolder , "Open" , "Cancel" ) ;
126+ Gtk . Application . Init ( ) ;
132127
133- if ( dlg . Run ( ) == ( int ) Gtk . ResponseType . Accept )
134- {
135- result = dlg . Filename ;
136- }
137- else
138- {
139- result = null ; // User canceled the dialog
140- }
128+ using Gtk . FileChooserNative dlg = new (
129+ "Open a folder" , null ,
130+ Gtk . FileChooserAction . SelectFolder , "Open" , "Cancel" ) ;
131+
132+ if ( dlg . Run ( ) == ( int ) Gtk . ResponseType . Accept )
133+ {
134+ result = dlg . Filename ;
141135 }
142- finally
136+ else
143137 {
144- //Gtk.Application.Quit() ; // stops the main loop
138+ result = null ; // User canceled the dialog
145139 }
146140
147141 return Task . FromResult ( result ) ;
@@ -212,27 +206,21 @@ public static class OpenFolderDialog
212206 if ( Gtk . Global . IsSupported )
213207 {
214208 string [ ] ? result ;
215- Gtk . Application . Init ( ) ; // spins a main loop
216- try
217- {
218- using Gtk . FileChooserNative dlg = new (
219- "Open folders" , null ,
220- Gtk . FileChooserAction . SelectFolder , "Open" , "Cancel" ) ;
209+ Gtk . Application . Init ( ) ;
221210
222- dlg . SelectMultiple = true ; // Allow multiple folder selection
211+ using Gtk . FileChooserNative dlg = new (
212+ "Open folders" , null ,
213+ Gtk . FileChooserAction . SelectFolder , "Open" , "Cancel" ) ;
223214
224- if ( dlg . Run ( ) == ( int ) Gtk . ResponseType . Accept )
225- {
226- result = dlg . Filenames ;
227- }
228- else
229- {
230- result = null ; // User canceled the dialog
231- }
215+ dlg . SelectMultiple = true ; // Allow multiple folder selection
216+
217+ if ( dlg . Run ( ) == ( int ) Gtk . ResponseType . Accept )
218+ {
219+ result = dlg . Filenames ;
232220 }
233- finally
221+ else
234222 {
235- //Gtk.Application.Quit() ; // stops the main loop
223+ result = null ; // User canceled the dialog
236224 }
237225
238226 return Task . FromResult ( result ) ;
0 commit comments