Format code

This commit is contained in:
2026-01-06 07:08:15 +00:00
parent 7f01f38436
commit 202e3ba6b1

46
main.go
View File

@@ -3,9 +3,12 @@ package main
import (
//core - required
"context"
_ "embed"
"encoding/xml"
"errors"
"fmt"
_ "image/jpeg"
_ "image/png"
"io"
"log"
"math/rand/v2"
@@ -13,9 +16,6 @@ import (
"os"
"strings"
"time"
_ "embed"
_ "image/png"
_ "image/jpeg"
// gui - required
"fyne.io/fyne/v2"
@@ -33,12 +33,12 @@ import (
"github.com/shreve/musicwand/pkg/mpris"
// xmpp - required
oasisSdk "github.com/sunglocto/oasis-sdk"
"mellium.im/xmpp/bookmarks"
"mellium.im/xmpp/jid"
"mellium.im/xmpp/muc"
"mellium.im/xmpp/stanza"
"mellium.im/xmpp/pubsub"
oasisSdk "github.com/sunglocto/oasis-sdk"
"mellium.im/xmpp/stanza"
// TODO: integrated theme switcher
)
@@ -1177,19 +1177,19 @@ func main() {
setNick = widget.NewButton("Set nick", func() {
go func() {
fyne.Do(func() {setNick.Disable()})
newNick := nickEntry.Text
bookmark.Nick = newNick
err := client.PublishBookmark(bookmark, context.TODO())
if err != nil {
fyne.Do(func() {
setNick.Enable()
dialog.ShowError(err, w)
})
return
}
client.RefreshBookmarks(false)
fyne.Do(func() {setNick.Enable()})
fyne.Do(func() { setNick.Disable() })
newNick := nickEntry.Text
bookmark.Nick = newNick
err := client.PublishBookmark(bookmark, context.TODO())
if err != nil {
fyne.Do(func() {
setNick.Enable()
dialog.ShowError(err, w)
})
return
}
client.RefreshBookmarks(false)
fyne.Do(func() { setNick.Enable() })
}()
})
@@ -1565,9 +1565,9 @@ func main() {
dialog.ShowError(err, w)
}
fyne.Do(func() {
AppTabs.Selected().Text = fmt.Sprintf("%s (disconnected)", AppTabs.Selected().Text)
AppTabs.Remove(ti)
delete(UITabs, activeChatJid)
AppTabs.Selected().Text = fmt.Sprintf("%s (disconnected)", AppTabs.Selected().Text)
AppTabs.Remove(ti)
delete(UITabs, activeChatJid)
})
}()
}
@@ -1580,8 +1580,6 @@ func main() {
}
}
AppTabs.OnUnselected = func(ti *container.TabItem) {
fmt.Println("hiding")
selectedScroller, ok := AppTabs.Selected().Content.(*widget.List)
@@ -1624,7 +1622,7 @@ func main() {
nameLabel.Truncation = fyne.TextTruncateEllipsis
memberLabel := widget.NewLabel(fmt.Sprintf("%d members ", len(tab.Members)))
memberLabel.Truncation = fyne.TextTruncateEllipsis
box := container.NewVBox(nameLabel, )
box := container.NewVBox(nameLabel)
chatSidebar.Objects = []fyne.CanvasObject{}
for name, p := range tab.Members {