예제 #1
0
파일: shortcuts.go 프로젝트: PMaynard/coyim
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)
}
예제 #2
0
파일: confgui.go 프로젝트: sqp/godock
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()
	}
}
예제 #3
0
파일: shortcuts.go 프로젝트: PMaynard/coyim
func (u *gtkUI) closeWindow(w *gtk.Window) {
	w.Hide()
}