Exemple #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)
}
Exemple #2
0
func (*RealGtk) AcceleratorParse(acc string) (uint, gdki.ModifierType) {
	res, res2 := gtk.AcceleratorParse(acc)
	return res, gdki.ModifierType(res2)
}