Add affiliation medals

This commit is contained in:
2026-02-02 13:23:08 +00:00
parent 6cb8771994
commit 777df725b6
10 changed files with 117 additions and 13 deletions

View File

@@ -60,6 +60,7 @@ func switchToTab(jid string, w *gtk.Window) {
u.Get(&ocu)
nick_label := gtk.NewLabel(JidMustParse(u.From).Resource)
/*
affil_label := gtk.NewLabel("")
switch mu.MucUserItem.Affiliation {
case "owner":
@@ -71,14 +72,29 @@ func switchToTab(jid string, w *gtk.Window) {
case "none":
affil_label.SetText("-")
}
*/
nick_label.AddCSSClass(mu.MucUserItem.Role)
if mu.MucUserItem.Role == "visitor" {
nick_label.SetOpacity(0.5)
}
/*
affil_label.SetHAlign(gtk.AlignEnd)
affil_label.SetHExpand(true)
affil_label.AddCSSClass(mu.MucUserItem.Affiliation)
*/
userbox.SetTooltipText(fmt.Sprintf("%s\n%s\n%s\nRight-click for more information", u.From, mu.MucUserItem.Role, mu.MucUserItem.Affiliation))
userbox.Append(nick_label)
userbox.Append(affil_label)
// userbox.Append(affil_label)
medal := gtk.NewImageFromPaintable(clientAssets[mu.MucUserItem.Affiliation])
medal.SetHAlign(gtk.AlignEnd)
medal.SetHExpand(true)
userbox.Append(medal)
gesture := gtk.NewGestureClick()
gesture.SetButton(3) // Right click
@@ -88,6 +104,8 @@ func switchToTab(jid string, w *gtk.Window) {
win.SetDefaultSize(400, 400)
profile_box := gtk.NewBox(gtk.OrientationVertical, 0)
nick := gtk.NewLabel(JidMustParse(u.From).Resource)
win.SetTitle(JidMustParse(u.From).Resource)
nick.AddCSSClass("author")
profile_box.Append(nick)
profile_box.Append(gtk.NewLabel(u.From))