somehow sunglocto returned

This commit is contained in:
2026-04-26 10:40:13 +01:00
parent 69994d9856
commit fc0ed5ac2c
13 changed files with 407 additions and 68 deletions
+22 -3
View File
@@ -27,7 +27,7 @@ func scrollToBottomAfterUpdate(scrolledWindow *gtk.ScrolledWindow) {
})
}
func createTab(jid string, isMuc bool) bool {
func createTab(jid string, isMuc bool, name string) bool {
fmt.Println("Creating tab", jid, "isMuc:", isMuc)
_, ok := tabs.Load(jid)
_, uok := userdevices.Load(jid)
@@ -38,6 +38,7 @@ func createTab(jid string, isMuc bool) bool {
newTab.msgs = gtk.NewListBox()
newTab.msgs.SetVExpand(true)
newTab.msgs.SetShowSeparators(true)
newTab.name = name
newTab.msgs.Append(gtk.NewButtonWithLabel("Get past messages..."))
tabs.Store(jid, newTab)
@@ -58,7 +59,6 @@ func switchToTab(jid string, w *gtk.Window) {
scroller.SetChild(typed_tab.msgs)
typingStatus.SetText("")
if typed_tab.isMuc {
m, ok := mucmembers.Load(jid)
if !ok {
return
@@ -476,6 +476,9 @@ func switchToTab(jid string, w *gtk.Window) {
muci := getAvatar(jid, jid)
muci.SetPixelSize(80)
gen.Prepend(muci)
muc_name := gtk.NewLabel(typed_tab.name)
muc_name.AddCSSClass("author")
gen.Prepend(muc_name)
memberList.SetChild(gen)
} else {
memberList.SetChild(gtk.NewLabel(jid))
@@ -484,7 +487,23 @@ func switchToTab(jid string, w *gtk.Window) {
}
func showErrorDialog(err error) {
fmt.Println(err.Error())
err_win := gtk.NewWindow()
err_win.SetTitle("Error")
err_win.SetDefaultSize(400, 200)
err_win.SetResizable(false)
box := gtk.NewBox(gtk.OrientationVertical, 0)
err_label := gtk.NewLabel(err.Error())
err_label.SetSelectable(true)
box.Append(err_label)
close_btn := gtk.NewButtonWithLabel("Close")
close_btn.ConnectClicked(func() {
err_win.SetVisible(false)
})
box.Append(close_btn)
err_win.SetChild(box)
err_win.Present()
}
func createIdenticon(word string) *gtk.Image { // This function generates an identicon