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() } }
// Tweak prepares a build tweak to add desktop class informations for a launcher. // func Tweak(build cftype.Grouper, source datatype.Source, selected datatype.DesktopClasser) func(cftype.Builder) { return func(build cftype.Builder) { // Create a key for the hidden existing Origin entry. keyOrigin := newkey.EmptyFull(cftype.DesktopEntry, "Origin") // Check if a launcher origin has been set (as a desktop class file location). keyOrigin.SetBuilder(build) origins := keyOrigin.Value().String() if origins == "" { return } // Prepare the desktop class widget. keyOrigin.SetMakeWidget(func(key *cftype.Key) { w := Widget(source, selected, origins) key.PackWidget(w, false, false, 0) }) // Add the key to the builder. build.AddKeys(cftype.DesktopEntry, newkey.Frame(cftype.DesktopEntry, "FrameOrigin", "", ""), // A frame to close the expander. keyOrigin) } }