Cleaning & better dialogs

This commit is contained in:
Crom (Thibaut CHARLES) 2015-03-13 09:58:17 +01:00
parent 9926b68c26
commit f899a72a85

View File

@ -115,7 +115,6 @@ class Window : MainWindow{
save(tree); save(tree);
}); });
buttonSaveAs.addOnClicked((Button){ buttonSaveAs.addOnClicked((Button){
import gtk.Dialog;
import gtk.FileChooserDialog; import gtk.FileChooserDialog;
auto fc = new FileChooserDialog("Save 2DA as", window, FileChooserAction.SAVE); auto fc = new FileChooserDialog("Save 2DA as", window, FileChooserAction.SAVE);
@ -131,18 +130,17 @@ class Window : MainWindow{
}); });
buttonOpen.addOnClicked((Button){ buttonOpen.addOnClicked((Button){
import gtk.Dialog;
import gtk.FileChooserDialog; import gtk.FileChooserDialog;
auto fc = new FileChooserDialog("Open 2DA", window, FileChooserAction.OPEN); auto fc = new FileChooserDialog("Open 2DA", window, FileChooserAction.OPEN);
fc.setSelectMultiple(false); fc.setSelectMultiple(false);
fc.setCurrentFolder(openedFile!=""? dirName(openedFile) : getcwd()); fc.setCurrentFolder(openedFile!=""? dirName(openedFile) : getcwd());
auto res = fc.run(); auto res = fc.run();
if(res==GtkResponseType.OK){
string filename = fc.getFilename(); string filename = fc.getFilename();
open(filename, tree);
}
fc.destroy(); fc.destroy();
if(res==GtkResponseType.OK)
open(filename, tree);
}); });
buttonInsert.addOnClicked((Button){ buttonInsert.addOnClicked((Button){