Documentation ¶
Index ¶
- Constants
- type Room
- type Section
- type State
- func (s *State) InvalidateAvatar(ctx context.Context)
- func (s *State) InvalidateName(ctx context.Context)
- func (s *State) InvalidateTopic(ctx context.Context)
- func (s *State) NotifyAvatar(f StateHandlerFunc) func()
- func (s *State) NotifyName(f StateHandlerFunc) func()
- func (s *State) NotifyTopic(f StateHandlerFunc) func()
- func (s *State) Subscribe() (unsub func())
- type StateChangeFuncs
- type StateHandlerFunc
- type StateHandlers
Constants ¶
const AvatarSize = 32
AvatarSize is the size in pixels of the avatar.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Room ¶
type Room struct { *State *gtk.ListBoxRow // contains filtered or unexported fields }
Room is a single room row.
func AddTo ¶
AddTo adds an empty room with the given ID to the given section Rooms created using this constructor will automatically update itself as soon as it's added into a parent, so the caller does not have to trigger the Invalidate methods.
func (*Room) Changed ¶
func (r *Room) Changed()
Changed invalidates the order of this room within the list.
func (*Room) InvalidatePreview ¶
InvalidatePreview invalidate the room's preview. It only queries the state.
func (*Room) Order ¶
Order returns the current room's order number, or -1 if the room doesn't have one.
type Section ¶
type Section interface { Tag() matrix.TagName Changed(*Room) Remove(*Room) Insert(*Room) OpenRoom(matrix.RoomID) OpenRoomInTab(matrix.RoomID) // MoveRoomToTag moves the room with the given ID to the given tag name. A // new section must be created if needed. MoveRoomToTag(src matrix.RoomID, tag matrix.TagName) bool }
Section is the controller interface that Room holds as its parent section.
type State ¶
type State struct { ID matrix.RoomID Name string Topic string Avatar matrix.URL // contains filtered or unexported fields }
State handles the room's internal state.
func (*State) InvalidateAvatar ¶
InvalidateAvatar invalidates the room's avatar.
func (*State) InvalidateName ¶
InvalidateName invalidates the room's name and refetches them from the state or API.
func (*State) InvalidateTopic ¶
InvalidateTopic invalidates the room's name and refetches them from the state or API.
func (*State) NotifyAvatar ¶
func (s *State) NotifyAvatar(f StateHandlerFunc) func()
NotifyAvatar calls f when Avatar is changed.
func (*State) NotifyName ¶
func (s *State) NotifyName(f StateHandlerFunc) func()
NotifyName calls f when Name is changed.
func (*State) NotifyTopic ¶
func (s *State) NotifyTopic(f StateHandlerFunc) func()
NotifyTopic calls f when Topic is changed.
type StateChangeFuncs ¶
type StateChangeFuncs struct { Name func(context.Context, State) Avatar func(context.Context, State) }
StateChangeFuncs contains functions that are called when the state is invalidated and sees a change in any of the fields.
type StateHandlerFunc ¶
StateHandlerFunc is a function called when something in the state changes.
type StateHandlers ¶
StateHandlers holds multiple state handlers.
func (*StateHandlers) Add ¶
func (h *StateHandlers) Add(fn StateHandlerFunc) func()
Add adds fn into the registry.