From 11a1c2f8d872cb0ef24f093b2f1e042efca186c4 Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Sun, 18 Aug 2013 12:37:19 +0200 Subject: Menu item "Save" is now deactivated, if no map is loaded. --- main.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 44c72fd..f334507 100644 --- a/main.go +++ b/main.go @@ -16,6 +16,8 @@ type GUI struct { showbiomes *gtk.CheckButton fixSnowIce *gtk.CheckButton + menuitemSave *gtk.MenuItem + statusContext uint lastStatus string @@ -38,7 +40,9 @@ func (g *GUI) openWorld(path string) { dlg.Destroy() } - go g.mapw.SetRegion(region) + g.menuitemSave.SetSensitive(true) + + g.mapw.SetRegion(region) } func (g *GUI) aboutDlg() { @@ -85,9 +89,10 @@ func (g *GUI) mkMenuBar() *gtk.MenuBar { fileMenu.Append(quickopenItem) } - save := gtk.NewMenuItemWithLabel("Save") - save.Connect("activate", g.save) - fileMenu.Append(save) + g.menuitemSave = gtk.NewMenuItemWithLabel("Save") + g.menuitemSave.Connect("activate", g.save) + g.menuitemSave.SetSensitive(false) + fileMenu.Append(g.menuitemSave) quit := gtk.NewMenuItemWithLabel("Quit") quit.Connect("activate", g.exitApp) -- cgit v1.2.3-70-g09d2