Fix: empty openning, minimum size, app renaming when open file
This commit is contained in:
parent
f93488a975
commit
25b97424a5
20
source/app.d
20
source/app.d
@ -21,7 +21,6 @@ import gtk.Button;
|
||||
|
||||
|
||||
|
||||
|
||||
void main(string[] args)
|
||||
{
|
||||
Main.init(args);
|
||||
@ -31,6 +30,7 @@ void main(string[] args)
|
||||
|
||||
auto cont = new VBox(false, 0);
|
||||
window.add(cont);
|
||||
cont.setSizeRequest(0, 100);
|
||||
|
||||
auto buttonSave = new Button("document-save-symbolic", GtkIconSize.MENU);
|
||||
auto buttonOpen = new Button("document-open-symbolic", GtkIconSize.MENU);
|
||||
@ -55,12 +55,10 @@ void main(string[] args)
|
||||
auto header = new HeaderBar();
|
||||
window.setTitlebar(header);
|
||||
header.setTitle("2DAEdit");
|
||||
header.setSubtitle(args[1]);
|
||||
header.setProperty("show-close-button", true);
|
||||
|
||||
header.packStart(buttonOpen);
|
||||
header.packEnd(buttonSave);
|
||||
|
||||
}
|
||||
|
||||
//TreeView to display database
|
||||
@ -88,14 +86,16 @@ void main(string[] args)
|
||||
auto res = fc.run();
|
||||
if(res==GtkResponseType.OK){
|
||||
string filename = fc.getFilename();
|
||||
Open(filename, tree);
|
||||
version(Windows) Open(filename, tree, cast(Object)window);
|
||||
else Open(filename, tree, cast(Object)header);
|
||||
}
|
||||
fc.destroy();
|
||||
});
|
||||
|
||||
//Open if exists
|
||||
if(exists(args[1])){
|
||||
Open(args[1], tree);
|
||||
if(args.length>=2 && exists(args[1])){
|
||||
version(Windows) Open(args[1], tree, cast(Object)window);
|
||||
else Open(args[1], tree, cast(Object)header);
|
||||
}
|
||||
|
||||
window.showAll();
|
||||
@ -121,10 +121,16 @@ void Save(ref TreeView tree){
|
||||
|
||||
}
|
||||
|
||||
void Open(string file, ref TreeView tree){
|
||||
void Open(string file, ref TreeView tree, Object header){
|
||||
|
||||
auto twoda = new TwoDA(file);
|
||||
|
||||
version(Windows) (cast(Window)header).setTitle(file);
|
||||
else{
|
||||
import gtk.HeaderBar;
|
||||
(cast(HeaderBar)header).setSubtitle(file);
|
||||
}
|
||||
|
||||
//Delete old store
|
||||
auto oldstore = cast(ListStore)tree.getModel();
|
||||
if(oldstore !is null)
|
||||
|
Loading…
Reference in New Issue
Block a user