format + allow closing
This commit is contained in:
+28
-31
@@ -92,46 +92,45 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
||||
popover.SetParent(mainBox)
|
||||
popover.SetHasArrow(false)
|
||||
|
||||
|
||||
gesture.Connect("pressed", func(n_press, x, y int) {
|
||||
rc_box := gtk.NewBox(gtk.OrientationVertical, 0)
|
||||
rc_box := gtk.NewBox(gtk.OrientationVertical, 0)
|
||||
|
||||
reactions := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
||||
reaction := []string{"👍", "👎", "♥️", "🤣", "💀"}
|
||||
for _, v := range reaction {
|
||||
like := gtk.NewButton()
|
||||
like.SetLabel(v)
|
||||
like.SetHExpand(true)
|
||||
like.ConnectClicked(func() {
|
||||
fmt.Println("licked") // TODO: Implement proper support for reactions via extension
|
||||
client.SendRaw(fmt.Sprintf(`
|
||||
reactions := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
||||
reaction := []string{"👍", "👎", "♥️", "🤣", "💀"}
|
||||
for _, v := range reaction {
|
||||
like := gtk.NewButton()
|
||||
like.SetLabel(v)
|
||||
like.SetHExpand(true)
|
||||
like.ConnectClicked(func() {
|
||||
fmt.Println("licked") // TODO: Implement proper support for reactions via extension
|
||||
client.SendRaw(fmt.Sprintf(`
|
||||
<message from='%s' to='%s' id='%s' type='%s'>
|
||||
<reactions id='%s' xmlns='urn:xmpp:reactions:0'>
|
||||
<reaction>%s</reaction>
|
||||
</reactions>
|
||||
</message>
|
||||
`, m.To, jid.MustParse(m.From).Bare().String(), uuid.New().String(), m.Type, sid.ID, v))
|
||||
})
|
||||
reactions.Append(like)
|
||||
}
|
||||
|
||||
rc_box.Append(reactions)
|
||||
|
||||
quote := gtk.NewButtonWithLabel("Quote")
|
||||
quote.ConnectClicked(func() {
|
||||
lines := strings.Split(m.Body, "\n")
|
||||
for i, line := range lines {
|
||||
quoteline := "> " + line
|
||||
lines[i] = quoteline
|
||||
})
|
||||
reactions.Append(like)
|
||||
}
|
||||
|
||||
newstr := strings.Join(lines, "\n") + "\n\n"
|
||||
rc_box.Append(reactions)
|
||||
|
||||
message_en.SetText(newstr)
|
||||
})
|
||||
rc_box.Append(quote)
|
||||
quote := gtk.NewButtonWithLabel("Quote")
|
||||
quote.ConnectClicked(func() {
|
||||
lines := strings.Split(m.Body, "\n")
|
||||
for i, line := range lines {
|
||||
quoteline := "> " + line
|
||||
lines[i] = quoteline
|
||||
}
|
||||
|
||||
popover.SetChild(rc_box)
|
||||
newstr := strings.Join(lines, "\n") + "\n\n"
|
||||
|
||||
message_en.SetText(newstr)
|
||||
})
|
||||
rc_box.Append(quote)
|
||||
|
||||
popover.SetChild(rc_box)
|
||||
rect := gdk.NewRectangle(x, y, 1, 1)
|
||||
popover.SetPointingTo(&rect)
|
||||
popover.Popup()
|
||||
@@ -233,7 +232,6 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
||||
mainBox.Append(authorBox)
|
||||
mainBox.Append(contentBox)
|
||||
|
||||
|
||||
oob := stanza.OOB{}
|
||||
ok = m.Get(&oob)
|
||||
if ok {
|
||||
@@ -315,7 +313,7 @@ func getAvatar(j, hash string) *gtk.Image { // TODO: This function probably shou
|
||||
invalidImages.Store(oghash, true)
|
||||
return createIdenticon(j, false)
|
||||
}
|
||||
i.AddCSSClass(loadedConfig.CVD.String() + "_CVD")
|
||||
// i.AddCSSClass(loadedConfig.CVD.String() + "_CVD")
|
||||
return i
|
||||
}
|
||||
|
||||
@@ -346,7 +344,6 @@ func getAvatar(j, hash string) *gtk.Image { // TODO: This function probably shou
|
||||
|
||||
base64_data := card.Photo.Binval
|
||||
if card.Photo.Binval == "" || ((card.Photo.Type == "image/svg+xml" || card.Photo.Type == "image/webp") && (runtime.GOOS == "windows" || runtime.GOOS == "netbsd")) {
|
||||
fmt.Println("Blocking image")
|
||||
invalidImages.Store(oghash, true)
|
||||
return createIdenticon(j, false)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user