Fix lag issues

This commit is contained in:
2026-04-30 14:55:17 +01:00
parent 7b63799f0b
commit 0bfb140dc7
5 changed files with 223 additions and 70 deletions
+73 -2
View File
@@ -73,9 +73,13 @@ func switchToTab(jid string, w *gtk.Window) {
i := 0
rangeOrdered(&mm, (func(k, v any) bool {
i++
u, ok := v.(stanza.Presence)
if !ok {
return true
}
userbox := gtk.NewBox(gtk.OrientationHorizontal, 2)
u := v.(stanza.Presence)
var mu MucUser
var ocu OccupantID
u.Get(&mu)
@@ -103,7 +107,7 @@ func switchToTab(jid string, w *gtk.Window) {
userbox.Append(nick_label)
var hats Hats
ok := u.Get(&hats)
ok = u.Get(&hats)
if ok {
for _, hat := range hats.Hats {
var val float64
@@ -531,3 +535,70 @@ func createIdenticon(word string) *gtk.Image { // This function generates an ide
return i
}
func jidBuilder(en *gtk.Entry) { // This function spawns a window that allows the user to interactively build a JID
// TODO: Localise this
win := gtk.NewWindow()
win.SetTitle("Build-A-JID")
win.SetDefaultSize(400, 1)
win.SetResizable(false)
box := gtk.NewBox(gtk.OrientationVertical, 2)
header := gtk.NewLabel("Build-A-JID")
header.AddCSSClass("author")
box.Append(header)
box.Append(gtk.NewLabel("All fields except for domain are optional"))
jid_builder := gtk.NewBox(gtk.OrientationHorizontal, 2)
localPartEntry := gtk.NewEntry()
localPartEntry.SetPlaceholderText("localpart")
jid_builder.Append(localPartEntry)
at_sign := gtk.NewLabel("@")
at_sign.AddCSSClass("author")
jid_builder.Append(at_sign)
domainEntry := gtk.NewEntry()
domainEntry.SetPlaceholderText("domain")
jid_builder.Append(domainEntry)
resource_sign := gtk.NewLabel("/")
resource_sign.AddCSSClass("author")
jid_builder.Append(resource_sign)
resourceEntry := gtk.NewEntry()
resourceEntry.SetPlaceholderText("resource")
jid_builder.Append(resourceEntry)
box.Append(jid_builder)
submit := gtk.NewButtonWithLabel(loadedLocale["submit"])
submit.ConnectClicked(func() {
localPart := localPartEntry.Text()
domain := domainEntry.Text()
resource := resourceEntry.Text()
at := "@"
slash := "/"
if localPart == "" {
at = ""
}
if resource == "" {
slash = ""
}
jid := localPart + at + domain + slash + resource
en.SetText(jid)
win.SetVisible(false)
})
box.Append(submit)
win.SetChild(box)
win.SetVisible(true)
}