guilds

package
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FolderSize     = 32
	FolderMiniSize = 16
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Folder

type Folder struct {
	*gtk.Box

	Button struct {
		*gtk.Overlay
		Pill   *sidebutton.Pill
		Folder *FolderButton
	}

	Revealer *gtk.Revealer
	GuildBox *gtk.Box
	Guilds   []*Guild
	// contains filtered or unexported fields
}

Folder is the widget containing the folder icon on top and a child list of guilds beneath it.

func NewFolder

func NewFolder(ctx context.Context) *Folder

NewFolder creates a new Folder.

func (*Folder) InvalidateUnread

func (f *Folder) InvalidateUnread()

InvalidateUnread invalidates the folder's unread state.

func (*Folder) Remove

func (f *Folder) Remove(id discord.GuildID)

Remove removes the given guild by its ID.

func (*Folder) Set

func (f *Folder) Set(folder *gateway.GuildFolder)

Set sets a fresh list of guilds.

func (*Folder) SetSelected

func (f *Folder) SetSelected(selected bool)

SetSelected sets the folder's selected state.

func (*Folder) Unselect

func (f *Folder) Unselect()

Unselect unselects the folder visually.

type FolderButton

type FolderButton struct {
	*gtk.Button
	// Main stack, switches between "guilds" and "folder"
	MainStack  *gtk.Stack
	GuildGrid  *gtk.Grid // contains 4 images always.
	FolderIcon *gtk.Image
	Images     [4]*onlineimage.Avatar // first 4 of folder.Guilds
	Mentions   *sidebutton.MentionsIndicator
	// contains filtered or unexported fields
}

FolderButton is the folder icon containing the four guild icons.

func NewFolderButton

func NewFolderButton(ctx context.Context) *FolderButton

NewFolderButton creates a new FolderButton.

func (*FolderButton) SetColor

func (b *FolderButton) SetColor(color discord.Color)

SetColor sets the color of the folder.

func (*FolderButton) SetIcons

func (b *FolderButton) SetIcons(guildIDs []discord.GuildID)

SetIcons sets the guild icons to be shown.

func (*FolderButton) SetRevealed

func (b *FolderButton) SetRevealed(revealed bool)

SetRevealed sets what the FolderButton should show depending on if the folder is revealed/opened or not.

type Guild

type Guild struct {
	*sidebutton.Button
	// contains filtered or unexported fields
}

Guild is a widget showing a single guild icon.

func NewGuild

func NewGuild(ctx context.Context, id discord.GuildID) *Guild

func (*Guild) ID

func (g *Guild) ID() discord.GuildID

ID returns the guild ID.

func (*Guild) Invalidate

func (g *Guild) Invalidate()

Invalidate invalidates and updates the state of the guild.

func (*Guild) InvalidateUnread

func (g *Guild) InvalidateUnread()

InvalidateUnread invalidates the guild's unread state.

func (*Guild) Name

func (g *Guild) Name() string

Name returns the guild's name.

func (*Guild) ParentFolder

func (g *Guild) ParentFolder() *Folder

ParentFolder returns the guild's parent folder.

func (*Guild) SetParentFolder

func (g *Guild) SetParentFolder(parent *Folder)

SetParentFolder sets the parent guild folder.

func (*Guild) SetUnavailable

func (g *Guild) SetUnavailable()

SetUnavailable sets the guild as unavailable. It stays unavailable until either Invalidate sees it or Update is called on it.

func (*Guild) Update

func (g *Guild) Update(guild *discord.Guild)

Update updates the guild with the given Discord object.

type View

type View struct {
	*gtk.Box
	Children []ViewChild
	// contains filtered or unexported fields
}

View contains a list of guilds and folders.

func NewView

func NewView(ctx context.Context) *View

NewView creates a new View.

func (*View) AddGuild

func (v *View) AddGuild(guild *discord.Guild)

AddGuild prepends a single guild into the view.

func (*View) Guild

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

Guild finds a guild inside View by its ID.

func (*View) Invalidate

func (v *View) Invalidate()

Invalidate invalidates the view and recreates everything. Use with care.

func (*View) InvalidateUnreads

func (v *View) InvalidateUnreads()

InvalidateUnreads invalidates the unread states of all guilds.

func (*View) RemoveGuild

func (v *View) RemoveGuild(id discord.GuildID) *Guild

RemoveGuild removes the given guild.

func (*View) SelectedGuildID

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

SelectedGuildID returns the selected guild ID, if any.

func (*View) SetFolders

func (v *View) SetFolders(folders []gateway.GuildFolder)

SetFolders sets the guild folders to use.

func (*View) SetGuilds

func (v *View) SetGuilds(guilds []discord.Guild)

SetGuilds sets the guilds shown.

func (*View) SetGuildsFromIDs

func (v *View) SetGuildsFromIDs(guildIDs []discord.GuildID)

SetGuildsFromIDs calls SetGuilds with guilds fetched from the state by the given ID list.

func (*View) SetSelectedGuild

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

SetSelectedGuild sets the selected guild. It does not propagate the selection to the sidebar.

func (*View) Unselect

func (v *View) Unselect()

Unselect unselects any guilds inside this guild view. Use this when the window is showing a channel that's not from any guild.

type ViewChild

type ViewChild interface {
	gtk.Widgetter
	// contains filtered or unexported methods
}

ViewChild is a child inside the guilds view. It is either a *Guild or a *Folder containing more *Guilds.

Jump to

Keyboard shortcuts

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