compact mode
This commit is contained in:
+31
-9
@@ -17,6 +17,7 @@ import (
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
xmpp_color "mellium.im/xmpp/color"
|
||||
)
|
||||
|
||||
func generatePresenceWidget(p stanza.Packet) gtk.Widgetter {
|
||||
@@ -84,7 +85,13 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
||||
sid := StanzaID{}
|
||||
m.Get(&sid)
|
||||
|
||||
mainBox := gtk.NewBox(gtk.OrientationVertical, 10)
|
||||
padding := 10
|
||||
orientation := gtk.OrientationVertical
|
||||
if loadedConfig.CompactMode {
|
||||
padding = 5
|
||||
orientation = gtk.OrientationHorizontal
|
||||
}
|
||||
mainBox := gtk.NewBox(orientation, padding)
|
||||
gesture := gtk.NewGestureClick()
|
||||
gesture.SetButton(3) // Right click
|
||||
|
||||
@@ -141,18 +148,32 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
||||
ocu := OccupantID{}
|
||||
|
||||
m.Get(&ocu)
|
||||
//id := ocu.ID
|
||||
// if id == "" {
|
||||
id := JidMustParse(m.From).Resource
|
||||
// }
|
||||
|
||||
if loadedConfig.CompactMode {
|
||||
al := gtk.NewLabel(id)
|
||||
ycbcr := xmpp_color.String(id, 255, loadedConfig.CVD)
|
||||
r, g, b, _ := ycbcr.RGBA()
|
||||
hexcolor := fmt.Sprintf("#%02x%02x%02x", r, g, b)
|
||||
|
||||
al.SetMarkup(fmt.Sprintf("<span foreground='%s'>%s</span>", hexcolor, id))
|
||||
al.SetSelectable(true)
|
||||
al.SetVAlign(gtk.AlignStart)
|
||||
mainBox.Append(al)
|
||||
|
||||
mlabel := gtk.NewLabel(m.Body)
|
||||
|
||||
if m.Body == "" {
|
||||
mlabel.SetText(loadedLocale["noBodySet"])
|
||||
mlabel.AddCSSClass("visitor")
|
||||
}
|
||||
mlabel.SetWrap(true)
|
||||
mlabel.SetSelectable(true)
|
||||
// mlabel.SetHAlign(gtk.AlignFill)
|
||||
mainBox.Append(mlabel)
|
||||
} else {
|
||||
authorBox := gtk.NewBox(gtk.OrientationHorizontal, 10)
|
||||
|
||||
contentBox := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
||||
// im := newImageFromPath("debug.png")
|
||||
|
||||
// authorBox.Append(im)
|
||||
|
||||
n := JidMustParse(m.From).Resource
|
||||
if n == "" {
|
||||
n = JidMustParse(m.From).Resource
|
||||
@@ -279,6 +300,7 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
||||
|
||||
mainBox.Append(lp_box)
|
||||
}
|
||||
}
|
||||
|
||||
return mainBox
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user