Ejemplo n.º 1
0
// New creates a dock shortkeys management widget.
//
func New(control cftype.Source, log cdtype.Logger, btn btnaction.Tune) *Shortkeys {
	builder := buildhelp.NewFromBytes(confshortkeysXML())

	widget := &Shortkeys{
		ScrolledWindow: *builder.GetScrolledWindow("widget"),
		model:          builder.GetListStore("model"),
		tree:           builder.GetTreeView("tree"),
		selection:      builder.GetTreeSelection("selection"),
		control:        control,
		btn:            btn,
		log:            log,
		rows:           make(map[*gtk.TreeIter]cdglobal.Shortkeyer),
	}

	rend := builder.GetCellRendererText("cellrenderertextShortkey")

	if len(builder.Errors) > 0 {
		for _, e := range builder.Errors {
			log.Err(e, "build confshortkeys")
		}
		return nil
	}

	// The user is allowed to edit the shortcut text. This will handle the new text.
	rend.Connect("edited", widget.onManualEdit)

	widget.Load()
	return widget
}
Ejemplo n.º 2
0
// NewList creates cairo-dock main config pages list.
//
func NewList(control controlItems, log cdtype.Logger) *List {
	builder := buildhelp.NewFromBytes(confcoreXML())

	widget := &List{
		ScrolledWindow: *builder.GetScrolledWindow("widget"),
		model:          builder.GetListStore("model"),
		tree:           builder.GetTreeView("tree"),
		selection:      builder.GetTreeSelection("selection"),
		control:        control,
		log:            log,
		rows:           make(map[string]*row),
	}

	if len(builder.Errors) > 0 {
		for _, e := range builder.Errors {
			log.Err(e, "build confcore list")
		}
		return nil
	}

	// Action: Treeview Select line.
	widget.selection.Connect("changed", widget.onSelectionChanged)

	return widget
}