channels

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const ChannelsWidth = bannerWidth

Variables

This section is empty.

Functions

This section is empty.

Types

type Banner struct {
	*gtk.Overlay
	Shadows *gtk.Box
	Picture *onlineimage.Picture
	// contains filtered or unexported fields
}

Banner is the guild banner display on top of the channel view.

func NewBanner

func NewBanner(ctx context.Context, guildID discord.GuildID) *Banner

NewBanner creates a new Banner.

func (*Banner) HasBanner

func (b *Banner) HasBanner() bool

HasBanner returns true if the banner is visible.

func (*Banner) Invalidate

func (b *Banner) Invalidate()

Invalidate invalidates and updates the Banner image.

func (*Banner) SetScrollOpacity added in v0.0.2

func (b *Banner) SetScrollOpacity(scrollY float64) (scrolled bool)

SetScrollOpacity sets the opacity of the shadow depending on the scroll level. If the scroll goes past the banner, then scrolled is true.

func (*Banner) SetURL

func (b *Banner) SetURL(url string)

type BaseChannelNode

type BaseChannelNode struct {
	// contains filtered or unexported fields
}

BaseChannelNode is the base of all channel nodes. It implements the Node interface and contains common information that all channels have.

func (*BaseChannelNode) ID

ID implements Node.

func (*BaseChannelNode) TreePath

func (n *BaseChannelNode) TreePath() *gtk.TreePath

TreePath implements Node.

func (*BaseChannelNode) Update

func (n *BaseChannelNode) Update(ch *discord.Channel)

Update implements Node. It does nothing.

type CategoryNode

type CategoryNode struct {
	BaseChannelNode
	// contains filtered or unexported fields
}

CategoryNode is a category node.

func (*CategoryNode) Update

func (n *CategoryNode) Update(ch *discord.Channel)

type ChannelNode

type ChannelNode struct {
	BaseChannelNode
	// contains filtered or unexported fields
}

ChannelNode is a regular text channel node.

func (*ChannelNode) SetUnread

func (n *ChannelNode) SetUnread(unread ningen.UnreadIndication)

SetUnread sets whether the channel is unread and mentioned.

func (*ChannelNode) Update

func (n *ChannelNode) Update(ch *discord.Channel)

type ForumNode added in v0.0.5

type ForumNode struct {
	BaseChannelNode
}

ForumNode is a node indicating a Discord forum.

func (*ForumNode) SetUnread added in v0.0.5

func (n *ForumNode) SetUnread(unread ningen.UnreadIndication)

func (*ForumNode) Update added in v0.0.5

func (n *ForumNode) Update(ch *discord.Channel)

type GuildTree

type GuildTree struct {
	*gtk.TreeStore
	// contains filtered or unexported fields
}

GuildTree is the channel tree that holds the state of all channels.

func NewGuildTree

func NewGuildTree(ctx context.Context) *GuildTree

NewGuildTree creates a new GuildTree.

func (*GuildTree) Add

func (t *GuildTree) Add(channels []discord.Channel)

Add adds the given list of channels into the guild tree.

func (*GuildTree) Has

func (t *GuildTree) Has(id discord.ChannelID) bool

Has returns true if the guild tree has the given channel.

func (*GuildTree) Node

func (t *GuildTree) Node(id discord.ChannelID) Node

Node quickly looks up the channel tree for a node.

func (*GuildTree) NodeFromIter

func (t *GuildTree) NodeFromIter(iter *gtk.TreeIter) Node

NodeFromIter returns the channel from the given TreeIter.

func (*GuildTree) NodeFromPath

func (t *GuildTree) NodeFromPath(path *gtk.TreePath) Node

NodeFromPath quickly looks up the channel tree for a node from the given tree path.

func (*GuildTree) Remove

func (t *GuildTree) Remove(id discord.ChannelID)

Remove removes the channel node with the given ID.

func (*GuildTree) SetUnread

func (t *GuildTree) SetUnread(id discord.ChannelID, unread ningen.UnreadIndication)

SetUnread marks the given channel as read or unread.

func (*GuildTree) UpdateChannel

func (t *GuildTree) UpdateChannel(id discord.ChannelID)

UpdateChannel updates the channel node with the given ID, or if the node is not known, then it does nothing.

func (*GuildTree) UpdateUnread

func (t *GuildTree) UpdateUnread(id discord.ChannelID)

UpdateUnread updates the unread state of the channel with the given ID.

type Node

type Node interface {
	// ID is the ID of the channel node.
	ID() discord.ChannelID
	// Update passes the new Channel object into the Node for it to update its
	// own information.
	Update(*discord.Channel)
	// TreePath is the tree path pointing to the channel node.
	TreePath() *gtk.TreePath
}

Node describes a channel node in the channel tree.

type Opener added in v0.0.7

type Opener interface {
	OpenChannel(discord.ChannelID)
}

Opener is the parent controller that View controls.

type ThreadNode

type ThreadNode struct {
	BaseChannelNode
}

ThreadNode is a node indicating a Discord thread.

func (*ThreadNode) SetUnread

func (n *ThreadNode) SetUnread(unread ningen.UnreadIndication)

func (*ThreadNode) Update

func (n *ThreadNode) Update(ch *discord.Channel)

type View

type View struct {
	*adaptive.LoadablePage
	Overlay *gtk.Overlay // covers whole

	Header struct {
		*gtk.WindowHandle
		Box  *gtk.Box
		Name *gtk.Label
	}

	Scroll *gtk.ScrolledWindow
	Child  struct {
		*gtk.Box
		Banner *Banner
		Tree   *gtk.TreeView
	}
	// contains filtered or unexported fields
}

View holds the entire channel sidebar containing all the categories, channels and threads.

func NewView

func NewView(ctx context.Context, ctrl Opener, guildID discord.GuildID) *View

NewView creates a new View.

func (*View) GuildID

func (v *View) GuildID() discord.GuildID

GuildID returns the view's guild ID.

func (*View) InvalidateChannels

func (v *View) InvalidateChannels()

InvalidateChannels invalidates the channels list.

func (*View) InvalidateHeader

func (v *View) InvalidateHeader()

InvalidateHeader invalidates the guild name and banner.

func (*View) SelectChannel

func (v *View) SelectChannel(chID discord.ChannelID)

SelectChannel selects a known channel. If none is known, then it is selected later when the list is changed or never selected if the user selects something else.

type VoiceChannelNode added in v0.0.3

type VoiceChannelNode struct {
	BaseChannelNode
	// contains filtered or unexported fields
}

func (*VoiceChannelNode) Update added in v0.0.3

func (n *VoiceChannelNode) Update(ch *discord.Channel)

Jump to

Keyboard shortcuts

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