From 568116b8644255e04759190d3ad764f858398646 Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Mon, 4 Nov 2013 14:40:18 +0100 Subject: Biome editor is now opened by a button in the sidebar --- main.go | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/main.go b/main.go index e4c3767..b1ae1ad 100644 --- a/main.go +++ b/main.go @@ -79,6 +79,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. dlg.Destroy() } +func (g *GUI) biomeEditor() { + ed := NewBiomeInfoEditor(g.biomes) + rv := ed.Run() + ed.Destroy() + if rv == gtk.RESPONSE_OK { + g.biomes = ed.Biomes() + g.updateBiomeInfo() + } +} + func (g *GUI) mkMenuBar() *gtk.MenuBar { menubar := gtk.NewMenuBar() @@ -107,24 +117,6 @@ func (g *GUI) mkMenuBar() *gtk.MenuBar { fileMenuItem.SetSubmenu(fileMenu) menubar.Append(fileMenuItem) - prefMenu := gtk.NewMenu() - - confbiomes := gtk.NewMenuItemWithLabel("Configure Biomes") - confbiomes.Connect("activate", func() { - ed := NewBiomeInfoEditor(g.biomes) - rv := ed.Run() - ed.Destroy() - if rv == gtk.RESPONSE_OK { - g.biomes = ed.Biomes() - g.updateBiomeInfo() - } - }) - prefMenu.Append(confbiomes) - - prefMenuItem := gtk.NewMenuItemWithLabel("Preferences") - prefMenuItem.SetSubmenu(prefMenu) - menubar.Append(prefMenuItem) - helpMenu := gtk.NewMenu() controls := gtk.NewMenuItemWithLabel("Controls") @@ -216,7 +208,14 @@ func (g *GUI) mkSidebar() *gtk.ScrolledWindow { sbVBox.PackStart(drawHBox, false, false, 3) sbVBox.PackStart(gtk.NewHSeparator(), false, false, 3) - sbVBox.PackStart(labelCustomFont("Biomes", "Sans Bold 14"), false, false, 3) + bioHeaderHBox := gtk.NewHBox(false, 0) + bioHeaderHBox.PackStart(labelCustomFont("Biomes", "Sans Bold 14"), true, false, 0) + editBiomesBtn := gtk.NewButton() + editBiomesBtn.Add(gtk.NewImageFromStock(gtk.STOCK_EDIT, gtk.ICON_SIZE_SMALL_TOOLBAR)) + editBiomesBtn.Connect("clicked", g.biomeEditor) + editBiomesBtn.SetTooltipText("Configure Biomes") + bioHeaderHBox.PackStart(editBiomesBtn, false, false, 0) + sbVBox.PackStart(bioHeaderHBox, false, false, 3) g.bioVBoxWrap = gtk.NewVBox(false, 0) g.bioVBox = gtk.NewVBox(false, 0) -- cgit v1.2.3-70-g09d2