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