util

package
v0.0.0-...-fddd194 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AtoiDef

func AtoiDef(s string, def int) int

AtoiDef converts a string into an int, returning the given default value if conversion failed

func ClearChildren

func ClearChildren(container gtk.Container)

ClearChildren removes all container's children

func ConfirmDialog

func ConfirmDialog(parent gtk.IWindow, title, text string) bool

ConfirmDialog shows a confirmation message dialog

func Default

func Default(def string, value interface{}) string

Default returns a default value if no value is set

func EditDialog

func EditDialog(parent gtk.IWindow, title, value, okButton string) (string, bool)

EditDialog show a dialog with a single text entry

func EntryText

func EntryText(entry *gtk.Entry, def string) string

EntryText returns the text in an entry, or the default string if an error occurred

func ErrorDialog

func ErrorDialog(parent gtk.IWindow, text string)

ErrorDialog shows an error message dialog

func FormatSeconds

func FormatSeconds(seconds float64) string

FormatSeconds formats a number seconds as a string

func FormatSecondsStr

func FormatSecondsStr(seconds string) string

FormatSecondsStr formats a number seconds as a string given string input

func GetTextBufferText

func GetTextBufferText(buf *gtk.TextBuffer) (string, error)

GetTextBufferText returns the entire text stored in a text buffer

func IsStreamURI

func IsStreamURI(uri string) bool

IsStreamURI returns whether the given URI refers to an Internet stream

func ListBoxScrollToSelected

func ListBoxScrollToSelected(listBox *gtk.ListBox)

ListBoxScrollToSelected scrolls the provided list box so that the selected row is centered in the window

func MapAttrsToSlice

func MapAttrsToSlice(attrs []mpd.Attrs, attr string) []string

MapAttrsToSlice converts a list of Attrs into a string slice by extracting only the provided attribute

func MaxInt

func MaxInt(a, b int) int

func NewBoxToggleButton

func NewBoxToggleButton(box *gtk.Box, label, name, icon string, active bool, onClicked func()) *gtk.ToggleButton

NewBoxToggleButton creates, adds to a box and returns a new toggle button

func NewButton

func NewButton(label, tooltip, name, icon string, onClicked func()) *gtk.Button

NewButton creates and returns a new button

func NewLabel

func NewLabel(label string) *gtk.Label

NewLabel instantiates and returns a new label

func NewListBoxRow

func NewListBoxRow(listBox *gtk.ListBox, useMarkup bool, label, name, icon string, widgets ...gtk.IWidget) (*gtk.ListBoxRow, *gtk.Box, error)

NewListBoxRow adds a new row to the list box, a horizontal box, an image and a label to it listBox: list box instance useMarkup: whether label is markup label: text for the row name: name of the row icon: optional icon name for the row widgets: extra widgets to insert into the beginning of the row

func ParseFloatDef

func ParseFloatDef(s string, def float64) float64

ParseFloatDef converts a string into a float64, returning the given default value if conversion failed

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL