session

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: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IconSize = 42
	IconName = "face-plain-symbolic"
)
View Source
const FaceSize = 48 // gtk.ICON_SIZE_DIALOG
View Source
const ListWidth = 200

Variables

This section is empty.

Functions

func NewAddButton

func NewAddButton() *gtk.ListBoxRow

Types

type Controller

type Controller interface {
	Servicer

	// OnSessionDisconnect is called before a session is disconnected. This
	// function is used for cleanups.
	OnSessionDisconnect(*Row)
	// SessionSelected is called when the row is clicked. The parent container
	// should change the views to show this session's *Servers.
	SessionSelected(*Row)
	// ClearMessenger is called when a nil slice of servers is set.
	ClearMessenger(*Row)
	// MessengerSelected is called when a server that can display messages (aka
	// implements Messenger) is called.
	MessengerSelected(*Row, *server.ServerRow)
	// RestoreSession is called with the session ID to ask the controller to
	// restore it from keyring information.
	RestoreSession(*Row, string) // ID string, async
	// RemoveSession is called to ask the controller to remove the session from
	// the list of sessions.
	RemoveSession(*Row)
	// MoveSession is called to ask the controller to move the session to
	// somewhere else in the list of sessions.
	MoveSession(id, movingID string)
}

Controller extends server.Controller to add session parameters.

type List

type List struct {
	*gtk.ListBox
	// contains filtered or unexported fields
}

func NewList

func NewList(svcctrl ServiceController) *List

func (*List) AddSessionRow

func (sl *List) AddSessionRow(id string, row *Row)

AddSessionRow adds the given row as a session into the list.

func (*List) MoveSession

func (sl *List) MoveSession(targetID, movingID string)

MoveSession moves sessions around. This function must not touch the add button.

func (*List) RemoveSessionRow

func (sl *List) RemoveSessionRow(sessionID string) bool

func (*List) Session

func (sl *List) Session(id string) *Row

Session returns the session row with the given ID. A nil Row is returned if none is found.

func (*List) Sessions

func (sl *List) Sessions() []*Row

func (*List) UnselectAll

func (sl *List) UnselectAll()

type Row

type Row struct {
	*gtk.ListBoxRow

	Session cchat.Session // state; nilable

	Servers *Servers // accessed by View for the right view

	ActionsMenu *actions.Menu // session.*
	// contains filtered or unexported fields
}

Row represents a session row entry in the session List.

func New

func New(parent traverse.Breadcrumber, ses cchat.Session, ctrl Controller) *Row

func NewLoading

func NewLoading(parent traverse.Breadcrumber, id, name string, ctrl Controller) *Row

func (*Row) Activate

func (r *Row) Activate()

Activate executes whatever needs to be done. If the row has failed, then this method will reconnect. If the row is already loaded, then SessionSelected will be called.

func (*Row) Breadcrumb

func (r *Row) Breadcrumb() string

func (*Row) ClearMessenger

func (r *Row) ClearMessenger()

func (*Row) DisconnectSession

func (r *Row) DisconnectSession()

DisconnectSession disconnects the current session. It does nothing if the row does not have a session active.

func (*Row) ID

func (r *Row) ID() string

ID returns the session ID.

func (*Row) MessengerSelected

func (r *Row) MessengerSelected(sr *server.ServerRow)

func (*Row) Name

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

Name returns the session row's name container.

func (*Row) ParentBreadcrumb

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

func (*Row) ReconnectSession

func (r *Row) ReconnectSession()

ReconnectSession tries to reconnect with the keyring data. This is a slow method but it's also a very cold path.

func (*Row) RemoveSession

func (r *Row) RemoveSession()

RemoveSession removes itself from the session list.

func (*Row) Reset

func (r *Row) Reset()

Reset extends the server row's Reset function and resets additional states. It resets all states back to nil, but the session ID stays.

func (*Row) RestoreSession

func (r *Row) RestoreSession(res cchat.SessionRestorer, k keyring.Session)

func (*Row) SetFailed

func (r *Row) SetFailed(err error)

SetFailed sets the initial connect status to failed. Do note that session can have 2 types of loading: loading the session and loading the server list. This one sets the former.

func (*Row) SetLoading

func (r *Row) SetLoading()

SetLoading sets the session button to have a spinner circle. DO NOT CONFUSE THIS WITH THE SERVERS LOADING.

func (*Row) SetSession

func (r *Row) SetSession(ses cchat.Session)

SetSession binds the session and marks the row as ready. It extends SetDone.

func (*Row) ShowCommander

func (r *Row) ShowCommander()

ShowCommander shows the commander dialog, or it does nothing if session does not implement commander.

type Servers

type Servers struct {
	gtk.Stack
	SessionController

	// Main is the horizontal box containing the current struct's list of
	// servers columnated with the same level. The second item in the box should
	// be the selected server.
	Main *serverpane.Paned

	// Lister is the current lister belonging to this server.
	Lister cchat.Lister

	// Children is main's lhs.
	Children *server.Children

	// NextColumn is main's rhs.
	NextColumn *Servers // nil
	// contains filtered or unexported fields
}

Servers wraps around a list of servers inherited from Children to display a Lister in its own box instead of as a nested list. It's the container that's displayed on the right of the service sidebar.

func NewServers

func NewServers(p traverse.Breadcrumber, ctrl SessionController) *Servers

NewServers creates a new Servers instance that holds only the given column number and its children. Any servers with a different columnate ID will be in the children pane.

func (*Servers) Destroy

func (s *Servers) Destroy()

Destroy destroys and invalidates this instance permanently.

func (*Servers) IsLoading

func (s *Servers) IsLoading() bool

IsLoading returns true if the servers container is loading.

func (*Servers) Reset

func (s *Servers) Reset()

func (*Servers) SelectColumnatedLister

func (s *Servers) SelectColumnatedLister(srv *server.ServerRow, lst cchat.Lister)

SelectColumnatedLister is called by children servers to open up a server list on the right.

func (*Servers) SetList

func (s *Servers) SetList(slist cchat.Lister)

SetList indicates that the server list has been loaded. Unlike server.Children, this method will load immediately.

func (*Servers) SetServers

func (s *Servers) SetServers(servers []cchat.Server)

SetServers is reserved for cchat.ServersContainer.

func (*Servers) UpdateServer

func (s *Servers) UpdateServer(update cchat.ServerUpdate)

SetServers is reserved for cchat.ServersContainer.

type ServiceController

type ServiceController interface {
	SessionSelected(*Row)
	AuthenticateSession()
}

type Servicer

type Servicer interface {
	// Service asks the controller for its service.
	Service() cchat.Service
}

type SessionController

type SessionController interface {
	ClearMessenger()
	MessengerSelected(*server.ServerRow)
}

SessionController extends server.Controller to add needed methods that the specific top-level servers container needs.

Directories

Path Synopsis
traverse
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