service

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

Documentation

Index

Constants

View Source
const IconSize = 42

Variables

This section is empty.

Functions

This section is empty.

Types

type AppMenu

type AppMenu struct {
	gtk.MenuButton
}

func NewAppMenu

func NewAppMenu() *AppMenu

func (*AppMenu) SetSizeRequest

func (a *AppMenu) SetSizeRequest(w, h int)

type Controller

type Controller interface {
	// SessionSelected is called when
	SessionSelected(svc *Service, srow *session.Row)
	// ClearMessenger is called when a nil slice of servers is set.
	ClearMessenger(*session.Row)
	// MessengerSelected is wrapped around session's MessengerSelected.
	MessengerSelected(*session.Row, *server.ServerRow)
	// AuthenticateSession is called to spawn the authentication dialog.
	AuthenticateSession(*List, *Service)
	// OnSessionRemove is called to remove a session. This should also clear out
	// the message view in the parent package.
	OnSessionRemove(*Service, *session.Row)
	// OnSessionDisconnect is here to satisfy session's controller.
	OnSessionDisconnect(*Service, *session.Row)
}
type Header struct {
	handy.HeaderBar

	MenuModel *glib.MenuModel

	AppMenu *AppMenu
	SvcName *gtk.Label
	SesMenu *actions.MenuButton
}

func NewHeader

func NewHeader() *Header

func (*Header) AppMenuBindSize

func (h *Header) AppMenuBindSize(c sizeBinder)

func (*Header) SetBreadcrumber

func (h *Header) SetBreadcrumber(b traverse.Breadcrumber)

func (*Header) SetSessionMenu

func (h *Header) SetSessionMenu(s *session.Row)

type List

type List struct {
	*gtk.ScrolledWindow

	// same methods as ListController
	ViewController

	ListBox  *gtk.Box
	Services []*Service // TODO: collision check
}

List is a list of services. Each service is a revealer that contains sessions.

func NewList

func NewList(vctl ViewController) *List

func (*List) AddService

func (sl *List) AddService(svc cchat.Service)

func (*List) AuthenticateSession

func (sl *List) AuthenticateSession(svc *Service)

func (*List) MoveService

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

func (*List) OnSessionDisconnect

func (sl *List) OnSessionDisconnect(svc *Service, row *session.Row)

func (*List) OnSessionRemove

func (sl *List) OnSessionRemove(svc *Service, row *session.Row)

func (*List) SetSizeRequest

func (sl *List) SetSizeRequest(w, h int)

type ListController

type ListController interface {
	// ClearMessenger is called when a nil slice of servers is set.
	ClearMessenger(*session.Row)
	// MessengerSelected is called when a server message row is clicked.
	MessengerSelected(*session.Row, *server.ServerRow)
	// SessionSelected tells the view to change the session view.
	SessionSelected(*Service, *session.Row)
	// AuthenticateSession tells View to call to the parent's authenticator.
	AuthenticateSession(*Service)
	// MoveService tells the view to shift the service to before the target.
	MoveService(id, targetID string)

	OnSessionRemove(*Service, *session.Row)
	OnSessionDisconnect(*Service, *session.Row)
}

type Service

type Service struct {
	ListController

	*gtk.Box
	Button *gtk.ToggleButton
	Icon   *roundimage.StillImage
	Menu   *actions.Menu

	BodyRev  *gtk.Revealer // revealed
	BodyList *session.List // not really supposed to be here

	Name         rich.NameContainer
	Configurator cchat.Configurator
	// contains filtered or unexported fields
}

Service holds everything that a single service has.

func NewService

func NewService(svc cchat.Service, svclctrl ListController) *Service

func (*Service) AddLoadingSession

func (s *Service) AddLoadingSession(id, name string) *session.Row

func (*Service) AddSession

func (s *Service) AddSession(ses cchat.Session) *session.Row

AddSession adds the given session. It returns nil if the session already exists with the given ID.

func (*Service) AuthenticateSession

func (s *Service) AuthenticateSession()

func (*Service) Breadcrumb

func (s *Service) Breadcrumb() string

func (*Service) GetRevealChild

func (s *Service) GetRevealChild() bool

GetRevealChild gets whether or not the service is revealing all sessions.

func (*Service) ID

func (s *Service) ID() string

func (*Service) MoveSession

func (s *Service) MoveSession(id, movingID string)

func (*Service) OnSessionDisconnect

func (s *Service) OnSessionDisconnect(row *session.Row)

func (*Service) ParentBreadcrumb

func (s *Service) ParentBreadcrumb() traverse.Breadcrumber

func (*Service) RemoveSession

func (s *Service) RemoveSession(row *session.Row)

func (*Service) RestoreSession

func (s *Service) RestoreSession(row *session.Row, id string)

func (*Service) SaveAllSessions

func (s *Service) SaveAllSessions()

func (*Service) Service

func (s *Service) Service() cchat.Service

func (*Service) SessionSelected

func (s *Service) SessionSelected(srow *session.Row)

func (*Service) SetRevealChild

func (s *Service) SetRevealChild(reveal bool)

SetRevealChild sets whether or not the service should reveal all sessions.

type View

type View struct {
	*gtk.Box

	Header *Header

	BottomPane *gtk.Box // 2 panes, but left-most hard-coded
	Controller          // inherit main controller

	Services   *List
	ServerView *gtk.ScrolledWindow
}

func NewView

func NewView(ctrller Controller) *View

func (*View) AddService

func (v *View) AddService(svc cchat.Service)

func (*View) MessengerSelected

func (v *View) MessengerSelected(srow *session.Row, srv *server.ServerRow)

MessengerSelected is called when a row is selected. It updates the header then calls the application's RowSelected method.

func (*View) OnSessionDisconnect

func (v *View) OnSessionDisconnect(s *Service, r *session.Row)

func (*View) OnSessionRemove

func (v *View) OnSessionRemove(s *Service, r *session.Row)

func (*View) SessionSelected

func (v *View) SessionSelected(svc *Service, srow *session.Row)

SessionSelected calls the right-side server view to change.

TODO: think of how to change. Maybe use a stack? Maybe use a box that we remove and re-add? does animation matter?

type ViewController

type ViewController interface {
	ClearMessenger(*session.Row)
	MessengerSelected(*session.Row, *server.ServerRow)
	SessionSelected(*Service, *session.Row)
	AuthenticateSession(*List, *Service)
	OnSessionRemove(*Service, *session.Row)
	OnSessionDisconnect(*Service, *session.Row)
}

Directories

Path Synopsis
Package config contains UI widgets and renderers for cchat's Configurator interface.
Package config contains UI widgets and renderers for cchat's Configurator interface.
server/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