server

package
v0.0.0-...-6513b37 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2021 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const ChildrenMargin = 0 // refer to style.css

Variables

This section is empty.

Functions

func AssertUnhollow

func AssertUnhollow(hollower interface{ IsHollow() bool })

Types

type Children

type Children struct {
	gtk.Box
	Controller

	Rows []*ServerRow

	Parent traverse.Breadcrumber

	// Unreadable state for children rows to use. The parent row that has this
	// Children will bind a handler to this.
	traverse.Unreadable
	// contains filtered or unexported fields
}

Children is a children server with a reference to the parent. By default, a children will contain hollow rows. They are rows that do not yet have any widgets. This changes as soon as Row's Load is called.

func NewChildren

func NewChildren(p traverse.Breadcrumber, ctrl Controller) *Children

NewChildren creates a hollow children then immediately unhollows it.

func NewHollowChildren

func NewHollowChildren(p traverse.Breadcrumber, ctrl Controller) *Children

NewHollowChildren creates a hollow children, which is a children without any widgets.

func (*Children) ForceIcons

func (c *Children) ForceIcons()

ForceIcons forces all of the children's row to show icons.

func (*Children) Init

func (c *Children) Init()

Init ensures that the children container is not hollow. It does nothing after the first call. It does not actually populate the list with widgets. This is done for lazy loading. To load everything, call LoadAll after this.

Nothing but ServerRow should call this method.

func (*Children) IsHollow

func (c *Children) IsHollow() bool

func (*Children) LoadAll

func (c *Children) LoadAll()

LoadAll forces all children rows to be unhollowed (initialized). It does NOT check if the children container itself is hollow.

func (*Children) ParentBreadcrumb

func (c *Children) ParentBreadcrumb() traverse.Breadcrumber

func (*Children) Reset

func (c *Children) Reset()

Reset ensures that the children container is no longer hollow, then reset all states.

func (*Children) SetExpand

func (c *Children) SetExpand(expand bool)

SetExpand sets whether or not to expand the margin and show the labels.

func (*Children) SetServers

func (c *Children) SetServers(servers []cchat.Server)

SetServers is reserved for cchat.ServersContainer.

func (*Children) SetServersUnsafe

func (c *Children) SetServersUnsafe(servers []cchat.Server)

func (*Children) UpdateServer

func (c *Children) UpdateServer(update cchat.ServerUpdate)

func (*Children) UpdateServerUnsafe

func (c *Children) UpdateServerUnsafe(update cchat.ServerUpdate)

type Controller

type Controller interface {
	ClearMessenger()
	MessengerSelected(*ServerRow)
	// SelectColumnatedLister is called when the user clicks a server lister
	// with its with Columnate method returning true. If lister is nil, then the
	// impl should clear it.
	SelectColumnatedLister(*ServerRow, cchat.Lister)
}

type ParentController

type ParentController interface {
	Controller
	ForceIcons()
}

ParentController controls ServerRow's container, which is the Children struct.

type ServerRow

type ServerRow struct {
	*gtk.Box
	Button      *button.ToggleButton
	ActionsMenu *actions.Menu

	Server cchat.Server

	UnreadIndicator cchat.UnreadIndicator
	// contains filtered or unexported fields
}

func NewHollowServer

func NewHollowServer(p traverse.Breadcrumber, sv cchat.Server, ctrl ParentController) *ServerRow

NewHollowServer creates a new hollow ServerRow. It will automatically create hollow children containers and rows for the given server.

func (*ServerRow) Breadcrumb

func (r *ServerRow) Breadcrumb() string

func (*ServerRow) GetActive

func (r *ServerRow) GetActive() bool

func (*ServerRow) GetRevealChild

func (r *ServerRow) GetRevealChild() bool

GetRevealChild returns whether or not the server list is expanded, or always false if there is no server list.

func (*ServerRow) HasIcon

func (r *ServerRow) HasIcon() bool

HasIcon returns true if the current row has an icon.

func (*ServerRow) ID

func (r *ServerRow) ID() cchat.ID

ID returns the server ID.

func (*ServerRow) Init

func (r *ServerRow) Init()

Init brings the row out of the hollow state. It loads the children (if any), but this process does not make more widgets.

func (*ServerRow) IsActiveServerMessage

func (r *ServerRow) IsActiveServerMessage() bool

IsActiveServerMessage returns true if the row is currently selected AND it is a message row.

func (*ServerRow) IsHollow

func (r *ServerRow) IsHollow() bool

func (*ServerRow) Name

func (r *ServerRow) Name() rich.LabelStateStorer

Name returns the name state.

func (*ServerRow) ParentBreadcrumb

func (r *ServerRow) ParentBreadcrumb() traverse.Breadcrumber

func (*ServerRow) Reset

func (r *ServerRow) Reset()

Reset clears off all children servers. It's a no-op if there are none.

func (*ServerRow) SetDone

func (r *ServerRow) SetDone()

SetDone is shared between the parent struct and the children list. This is because both will use the same SetFailed.

func (*ServerRow) SetFailed

func (r *ServerRow) SetFailed(err error, retry func())

SetFailed is shared between the parent struct and the children list. This is because both of those errors share the same appearance, just different callbacks.

func (*ServerRow) SetHollowServerList

func (r *ServerRow) SetHollowServerList(list cchat.Lister, ctrl Controller)

SetHollowServerList sets the row to a hollow server list (children) and recursively create

func (*ServerRow) SetLoading

func (r *ServerRow) SetLoading()

SetLoading is called by the parent struct.

func (*ServerRow) SetRevealChild

func (r *ServerRow) SetRevealChild(reveal bool)

SetRevealChild reveals the list of servers. It does nothing if there are no servers, meaning if Row does not represent a ServerList.

func (*ServerRow) SetSelected

func (r *ServerRow) SetSelected(selected bool)

SetSelected is used for highlighting the current message server.

func (*ServerRow) SetShowLabel

func (r *ServerRow) SetShowLabel(showLabel bool)

SetShowLabel sets whether or not to show the button's (and its children's, if any)'s icons.

func (*ServerRow) SetUnread

func (r *ServerRow) SetUnread(unread, mentioned bool)

SetUnread is thread-safe.

func (*ServerRow) SetUnreadUnsafe

func (r *ServerRow) SetUnreadUnsafe(unread, mentioned bool)

func (*ServerRow) UseEmptyIcon

func (r *ServerRow) UseEmptyIcon()

UseEmptyIcon forces the row to show a placeholder icon.

Directories

Path Synopsis
Package traverse implements an extensible interface that allows children widgets to announce state changes to their parent container.
Package traverse implements an extensible interface that allows children widgets to announce state changes to their parent container.

Jump to

Keyboard shortcuts

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