This commit is contained in:
2026-05-01 21:05:14 +01:00
parent 0bfb140dc7
commit 5bcf0eda0b
2 changed files with 26 additions and 12 deletions
+19 -7
View File
@@ -40,8 +40,10 @@ var connectionIcon *gtk.Image
var mStatus *gtk.Label
var mIcon *gtk.Image
/*
var sStatus *gtk.Label
var sIcon *gtk.Image
*/
var typingStatus *gtk.Label
@@ -381,7 +383,9 @@ func main() {
if ok {
typed_tab.msgs.Append(b)
scrollToBottomAfterUpdate(scroller)
if current == muc {
scrollToBottomAfterUpdate(scroller)
}
} else {
fmt.Println("Got message when the tab does not exist!")
}
@@ -477,29 +481,35 @@ func main() {
}()
// Throughput
/*
var oldsize int64
var newsize int64
var diff float64
go func() {
for {
time.Sleep(1 * time.Second)
glib.IdleAdd(func() {
time.Sleep(5 * time.Second)
stat, err := xmlLog.Stat()
if err != nil {
panic(err)
}
newsize = stat.Size()
diff := float64(newsize-oldsize) / 1000
diff = float64(newsize-oldsize) / 1000
ic := clientAssets["car"]
if diff >= 25 {
ic = clientAssets["car_high"]
}
glib.IdleAdd(func() {
sStatus.SetText(fmt.Sprintf("%.2f%s", diff, loadedLocale["KBPerSecond"]))
sIcon.SetFromPaintable(ic)
})
oldsize = newsize
}
}()
*/
glib.IdleAdd(func() {
connectionStatus.SetText(fmt.Sprintf("%s%s", loadedLocale["connectedAs"], JidMustParse(clientroot.Session.BindJid).Bare()))
@@ -572,7 +582,7 @@ func main() {
joinMuc(client, clientroot.Session.BindJid, jid, nick, password)
createTab(jid, true, name)
glib.IdleAdd(func() {
b := gtk.NewLabel(jid)
b := gtk.NewLabel(name)
gesture1 := gtk.NewGestureClick()
gesture1.SetButton(1)
gesture1.Connect("pressed", func() {
@@ -810,7 +820,7 @@ func activate(app *gtk.Application) {
}
createTab(t, true, n)
b := gtk.NewLabel(t)
b := gtk.NewLabel(n)
gesture1 := gtk.NewGestureClick()
gesture1.SetButton(1)
gesture1.Connect("pressed", func() {
@@ -1089,6 +1099,7 @@ func activate(app *gtk.Application) {
pBox.Append(pingStatus)
statBar.Append(pBox)
/*
sBox := gtk.NewBox(gtk.OrientationHorizontal, 0)
sIcon = gtk.NewImageFromPaintable(clientAssets["car"])
sIcon.AddCSSClass("icon")
@@ -1097,6 +1108,7 @@ func activate(app *gtk.Application) {
sBox.Append(sStatus)
sStatus.SetTooltipText(loadedLocale["throughputTooltip"])
statBar.Append(sBox)
*/
scrollerStatBar := gtk.NewScrolledWindow()
scrollerStatBar.SetChild(statBar)
@@ -1180,7 +1192,7 @@ func activate(app *gtk.Application) {
err := sendMessage(client, current, message_type, t, "", "", exts)
if err != nil {
panic(err) // TODO: Show error message via GTK
showErrorDialog(err)
}
message_en.SetText("")
scrollToBottomAfterUpdate(scroller)