this commit was sponsored by RAID SHADOW LEGENDS
This commit is contained in:
13
assets.go
13
assets.go
@@ -83,6 +83,10 @@ var hourglassB64 string = base64.StdEncoding.EncodeToString(hourglassBytes)
|
|||||||
var connectBytes []byte
|
var connectBytes []byte
|
||||||
var connectB64 string = base64.StdEncoding.EncodeToString(connectBytes)
|
var connectB64 string = base64.StdEncoding.EncodeToString(connectBytes)
|
||||||
|
|
||||||
|
//go:embed assets/comment.png
|
||||||
|
var commentBytes []byte
|
||||||
|
var commentB64 string = base64.StdEncoding.EncodeToString(commentBytes)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
||||||
loader := gdkpixbuf.NewPixbufLoader()
|
loader := gdkpixbuf.NewPixbufLoader()
|
||||||
@@ -235,4 +239,13 @@ func init() {
|
|||||||
loader.Close()
|
loader.Close()
|
||||||
|
|
||||||
clientAssets["connect"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
clientAssets["connect"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
||||||
|
|
||||||
|
|
||||||
|
loader = gdkpixbuf.NewPixbufLoader()
|
||||||
|
|
||||||
|
commentData, _ := base64.StdEncoding.DecodeString(commentB64)
|
||||||
|
loader.Write(commentData)
|
||||||
|
loader.Close()
|
||||||
|
|
||||||
|
clientAssets["comment"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
assets/comment.png
Normal file
BIN
assets/comment.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 413 B |
67
main.go
67
main.go
@@ -7,10 +7,10 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/diamondburned/gotk4/pkg/gdk/v4"
|
"github.com/diamondburned/gotk4/pkg/gdk/v4"
|
||||||
|
"github.com/diamondburned/gotk4/pkg/gdkpixbuf/v2"
|
||||||
"github.com/diamondburned/gotk4/pkg/gio/v2"
|
"github.com/diamondburned/gotk4/pkg/gio/v2"
|
||||||
"github.com/diamondburned/gotk4/pkg/glib/v2"
|
"github.com/diamondburned/gotk4/pkg/glib/v2"
|
||||||
"github.com/diamondburned/gotk4/pkg/gtk/v4"
|
"github.com/diamondburned/gotk4/pkg/gtk/v4"
|
||||||
"github.com/diamondburned/gotk4/pkg/gdkpixbuf/v2"
|
|
||||||
"github.com/gen2brain/beeep"
|
"github.com/gen2brain/beeep"
|
||||||
"github.com/go-analyze/charts"
|
"github.com/go-analyze/charts"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@@ -34,6 +34,10 @@ var empty_dialog *gtk.Image
|
|||||||
|
|
||||||
var connectionStatus *gtk.Label
|
var connectionStatus *gtk.Label
|
||||||
var connectionIcon *gtk.Image
|
var connectionIcon *gtk.Image
|
||||||
|
|
||||||
|
var mStatus *gtk.Label
|
||||||
|
var mIcon *gtk.Image
|
||||||
|
|
||||||
var pingStatus *gtk.Label
|
var pingStatus *gtk.Label
|
||||||
|
|
||||||
// var msgs *gtk.ListBox
|
// var msgs *gtk.ListBox
|
||||||
@@ -111,9 +115,9 @@ func main() {
|
|||||||
TransportConfiguration: xmpp.TransportConfiguration{
|
TransportConfiguration: xmpp.TransportConfiguration{
|
||||||
Address: loadedConfig.Server,
|
Address: loadedConfig.Server,
|
||||||
},
|
},
|
||||||
Jid: loadedConfig.Username + "/lambda." + str,
|
Jid: loadedConfig.Username + "/lambda." + str,
|
||||||
Credential: xmpp.Password(loadedConfig.Password),
|
Credential: xmpp.Password(loadedConfig.Password),
|
||||||
Insecure: loadedConfig.Insecure,
|
Insecure: loadedConfig.Insecure,
|
||||||
// StreamLogger: os.Stdout,
|
// StreamLogger: os.Stdout,
|
||||||
StreamManagementEnable: true,
|
StreamManagementEnable: true,
|
||||||
}
|
}
|
||||||
@@ -193,7 +197,8 @@ func main() {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
originator := jid.MustParse(m.From).Bare().String()
|
originator := JidMustParse(m.From).Bare()
|
||||||
|
mStatus.SetText(originator)
|
||||||
|
|
||||||
glib.IdleAdd(func() {
|
glib.IdleAdd(func() {
|
||||||
//uiQueue <- func() {
|
//uiQueue <- func() {
|
||||||
@@ -308,11 +313,14 @@ func main() {
|
|||||||
if ok {
|
if ok {
|
||||||
userdevices.Store(user, userUnit{})
|
userdevices.Store(user, userUnit{})
|
||||||
|
|
||||||
b := gtk.NewButtonWithLabel(user)
|
b := gtk.NewLabel(user)
|
||||||
b.ConnectClicked(func() {
|
gesture1 := gtk.NewGestureClick()
|
||||||
b.AddCSSClass("accent")
|
gesture1.SetButton(1)
|
||||||
|
gesture1.Connect("pressed", func() {
|
||||||
switchToTab(user, &window.Window)
|
switchToTab(user, &window.Window)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
b.AddController(gesture1)
|
||||||
menu.Append(b)
|
menu.Append(b)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -375,6 +383,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
connectionStatus.SetText(fmt.Sprintf("Connected as %s", JidMustParse(clientroot.Session.BindJid).Bare()))
|
connectionStatus.SetText(fmt.Sprintf("Connected as %s", JidMustParse(clientroot.Session.BindJid).Bare()))
|
||||||
|
connectionStatus.SetTooltipText(fmt.Sprintf("Binded JID: %s\nUsing TLS: %t", clientroot.Session.BindJid, clientroot.Session.TlsEnabled))
|
||||||
connectionIcon.SetFromPaintable(clientAssets["connect"])
|
connectionIcon.SetFromPaintable(clientAssets["connect"])
|
||||||
// Join rooms in bookmarks
|
// Join rooms in bookmarks
|
||||||
if loadedConfig.JoinBookmarks {
|
if loadedConfig.JoinBookmarks {
|
||||||
@@ -411,11 +420,14 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
createTab(jid, true)
|
createTab(jid, true)
|
||||||
b := gtk.NewButtonWithLabel(jid)
|
b := gtk.NewLabel(jid)
|
||||||
b.ConnectClicked(func() {
|
gesture1 := gtk.NewGestureClick()
|
||||||
b.AddCSSClass("accent")
|
gesture1.SetButton(1)
|
||||||
|
gesture1.Connect("pressed", func() {
|
||||||
switchToTab(jid, &window.Window)
|
switchToTab(jid, &window.Window)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
b.AddController(gesture1)
|
||||||
menu.Append(b)
|
menu.Append(b)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
@@ -604,11 +616,14 @@ func activate(app *gtk.Application) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
createTab(t, true)
|
createTab(t, true)
|
||||||
b := gtk.NewButtonWithLabel(t)
|
b := gtk.NewLabel(t)
|
||||||
b.ConnectClicked(func() {
|
gesture1 := gtk.NewGestureClick()
|
||||||
b.AddCSSClass("accent")
|
gesture1.SetButton(1)
|
||||||
|
gesture1.Connect("pressed", func() {
|
||||||
switchToTab(t, &window.Window)
|
switchToTab(t, &window.Window)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
b.AddController(gesture1)
|
||||||
menu.Append(b)
|
menu.Append(b)
|
||||||
}
|
}
|
||||||
win.SetVisible(false)
|
win.SetVisible(false)
|
||||||
@@ -650,6 +665,7 @@ func activate(app *gtk.Application) {
|
|||||||
|
|
||||||
cBox := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
cBox := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
||||||
connectionIcon = gtk.NewImageFromPaintable((clientAssets["disconnect"]))
|
connectionIcon = gtk.NewImageFromPaintable((clientAssets["disconnect"]))
|
||||||
|
connectionIcon.AddCSSClass("icon")
|
||||||
connectionStatus = gtk.NewLabel("Disconnected")
|
connectionStatus = gtk.NewLabel("Disconnected")
|
||||||
|
|
||||||
cBox.Append(connectionIcon)
|
cBox.Append(connectionIcon)
|
||||||
@@ -657,6 +673,25 @@ func activate(app *gtk.Application) {
|
|||||||
|
|
||||||
statBar.Append(cBox)
|
statBar.Append(cBox)
|
||||||
|
|
||||||
|
mBox := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
||||||
|
|
||||||
|
gesture1 := gtk.NewGestureClick()
|
||||||
|
gesture1.SetButton(1)
|
||||||
|
gesture1.Connect("pressed", func() {
|
||||||
|
current = mStatus.Text()
|
||||||
|
switchToTab(current, &window.Window)
|
||||||
|
})
|
||||||
|
|
||||||
|
mIcon = gtk.NewImageFromPaintable((clientAssets["comment"]))
|
||||||
|
mIcon.AddCSSClass("icon")
|
||||||
|
mStatus = gtk.NewLabel("-")
|
||||||
|
mStatus.AddController(gesture1)
|
||||||
|
|
||||||
|
cBox.Append(mIcon)
|
||||||
|
cBox.Append(mStatus)
|
||||||
|
|
||||||
|
statBar.Append(mBox)
|
||||||
|
|
||||||
pBox := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
pBox := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
||||||
pBox.SetTooltipText("Ping between you and your XMPP server\nRight-click to see graph")
|
pBox.SetTooltipText("Ping between you and your XMPP server\nRight-click to see graph")
|
||||||
gesture := gtk.NewGestureClick()
|
gesture := gtk.NewGestureClick()
|
||||||
@@ -715,7 +750,9 @@ func activate(app *gtk.Application) {
|
|||||||
pBox.Append(pingStatus)
|
pBox.Append(pingStatus)
|
||||||
statBar.Append(pBox)
|
statBar.Append(pBox)
|
||||||
|
|
||||||
box.Append(statBar)
|
scrollerStatBar := gtk.NewScrolledWindow()
|
||||||
|
scrollerStatBar.SetChild(statBar)
|
||||||
|
box.Append(scrollerStatBar)
|
||||||
|
|
||||||
// scroller.SetChild(empty_dialog)
|
// scroller.SetChild(empty_dialog)
|
||||||
scroller.SetChild(empty_dialog)
|
scroller.SetChild(empty_dialog)
|
||||||
|
|||||||
Reference in New Issue
Block a user