Exemple #1
0
func addLinks() *gtk.Box {
	linksData := []struct {
		uri     string
		label   string
		tooltip string
	}{{
		uri:   URLdockSite,
		label: "Cairo-Dock (2007-2014)", //GLDI_VERSION;
	}, {
		uri:     URLdockCode,
		label:   tran.Slate("Development site"),
		tooltip: tran.Slate("Find the latest version of Cairo-Dock here !"),
	}, {
		uri:     URLdockFlattr,
		label:   tran.Slate("Donate") + " (Flattr)",
		tooltip: tran.Slate("Support the people who spend countless hours to bring you the best dock ever."),
	}, {
		uri:     URLdockPayPal,
		label:   tran.Slate("Donate") + " (Paypal)",
		tooltip: tran.Slate("Support the people who spend countless hours to bring you the best dock ever."),
	}}

	box := newgtk.Box(gtk.ORIENTATION_VERTICAL, 0)
	for _, item := range linksData {
		link := newgtk.LinkButtonWithLabel(item.uri, item.label)
		box.PackStart(link, false, false, 0)
		if item.tooltip != "" {
			link.SetTooltipText(item.tooltip)
		}
	}
	return box
}
Exemple #2
0
// Link adds a link widget.
//
func Link(key *cftype.Key) {
	var text, link string
	if len(key.AuthorizedValues) > 0 {
		text = key.AuthorizedValues[0]
	} else {
		text = tran.Slate("link")
	}

	if len(key.AuthorizedValues) > 1 { // Custom keys have to use this input way.
		link = key.AuthorizedValues[1]
	} else {
		link = key.Value().String()
	}

	widget := newgtk.LinkButtonWithLabel(link, text)

	key.PackKeyWidget(key,
		func() interface{} { return widget.GetUri() },
		func(val interface{}) { widget.SetUri(val.(string)) },
		widget)
}