Example #1
0
func connectShortcut(accel string, w *gtk.Window, action func(*gtk.Window)) {
	g, _ := gtk.AccelGroupNew()
	key, mod := gtk.AcceleratorParse(accel)

	// Do not remove the closure here - there is a limitation
	// in gtk that makes it necessary to have different functions for different accelerator groups
	g.Connect(key, mod, gtk.ACCEL_VISIBLE, func() {
		action(w)
	})

	w.AddAccelGroup(g)
}
Example #2
0
func packWindow(win *gtk.Window, source vdata.Sourcer, build cftype.Grouper) func() {
	return func() {
		win.SetDefaultSize(winWidth, winHeight)
		win.SetTitle(winTitle)
		win.SetIconFromFile(source.AppIcon())
		win.Connect("destroy", gtk.MainQuit)

		// widgets.
		box := newgtk.Box(gtk.ORIENTATION_VERTICAL, 0)
		source.SetBox(box)

		menu := confmenu.New(source)
		switcher := pageswitch.New()
		w := build.BuildAll(switcher)

		btnAdd := btnaction.New(menu.Save)
		btnAdd.SetTest()

		btnHack := newgtk.ButtonWithLabel("Hack")
		btnHack.Connect("clicked", func() { build.KeyWalk(vdata.TestValues) })

		menu.PackStart(switcher, false, false, 0)
		menu.PackEnd(btnHack, false, false, 0)
		win.Add(box)
		box.PackStart(menu, false, false, 0)
		box.PackStart(w, true, true, 0)
		win.ShowAll()
	}
}
Example #3
0
func (u *gtkUI) closeWindow(w *gtk.Window) {
	w.Hide()
}