Exemplo n.º 1
0
// New creates a ConfCore widget to edit the main cairo-dock config.
//
func New(data cftype.Source, log cdtype.Logger, switcher *pageswitch.Switcher, btn btnaction.Tune) *ConfCore {
	paned := newgtk.Paned(gtk.ORIENTATION_HORIZONTAL)

	widget := &ConfCore{
		Paned:    *paned,
		switcher: switcher,
		btn:      btn,
		data:     data,
		log:      log,
	}
	widget.list = NewList(widget, log)
	widget.Pack1(widget.list, true, true)

	widget.SetPosition(panedPosition)
	return widget
}
Exemplo n.º 2
0
// New creates a GuiIcons widget to edit cairo-dock icons config.
//
func New(data cftype.Source, log cdtype.Logger, switcher *pageswitch.Switcher, btn btnaction.Tune) *GuiIcons {
	paned := newgtk.Paned(gtk.ORIENTATION_HORIZONTAL)
	widget := &GuiIcons{
		Paned:    *paned,
		switcher: switcher,
		btn:      btn,
		data:     data,
		log:      log,
	}
	widget.icons = NewList(widget, log)

	up := newgtk.ButtonFromIconName("go-up", gtk.ICON_SIZE_BUTTON)
	down := newgtk.ButtonFromIconName("go-down", gtk.ICON_SIZE_BUTTON)
	remove := newgtk.ButtonFromIconName("list-remove", gtk.ICON_SIZE_BUTTON)

	boxLeft := newgtk.Box(gtk.ORIENTATION_VERTICAL, 0)
	boxBtns := newgtk.Box(gtk.ORIENTATION_HORIZONTAL, 0)
	boxLeft.PackStart(widget.icons, true, true, 0)
	boxLeft.PackStart(boxBtns, false, false, 0)
	boxBtns.PackStart(up, false, false, 0)
	boxBtns.PackStart(down, false, false, 0)
	boxBtns.PackEnd(remove, false, false, 0)

	widget.Pack1(boxLeft, true, true)

	widget.SetPosition(listIconsWidth) // Paned position = list icons width.

	up.Connect("clicked", widget.actionSelected(datatype.Iconer.MoveBeforePrevious))
	down.Connect("clicked", widget.actionSelected(datatype.Iconer.MoveAfterNext))
	remove.Connect("clicked", widget.actionSelected(datatype.Iconer.RemoveFromDock))

	// widget.icons.Connect("row-inserted", func() { log.Info("row inserted") })
	// widget.icons.Connect("row-deleted", func() { log.Info("row deleted") })

	return widget
}