1
0
Fork 0
mirror of https://github.com/diamondburned/cchat-gtk.git synced 2024-12-23 04:36:49 +00:00

Removed dead code; contents are no longer hyphenated

This commit is contained in:
diamondburned 2020-07-08 02:16:13 -07:00
parent 76d4b8d69a
commit a9f00e0477
2 changed files with 4 additions and 23 deletions

View file

@ -1,23 +0,0 @@
package gtkp
// #cgo pkg-config: gdk-3.0 gio-2.0 glib-2.0 gobject-2.0 gtk+-3.0
// #include <glib.h>
// #include <gtk/gtk.h>
// #include <pango/pango.h>
import "C"
import (
"unsafe"
"github.com/gotk3/gotk3/gtk"
)
func LabelNoHyphens(l *gtk.Label) {
attrlist := C.pango_attr_list_new()
defer C.pango_attr_list_unref(attrlist)
C.pango_attr_list_insert(attrlist, C.pango_attr_insert_hyphens_new(C.FALSE))
v := (*C.GtkLabel)(unsafe.Pointer(l.Native()))
C.gtk_label_set_attributes(v, attrlist)
}

View file

@ -4,6 +4,7 @@ import (
"time" "time"
"github.com/diamondburned/cchat" "github.com/diamondburned/cchat"
"github.com/diamondburned/cchat-gtk/internal/c/labelutils"
"github.com/diamondburned/cchat-gtk/internal/humanize" "github.com/diamondburned/cchat-gtk/internal/humanize"
"github.com/diamondburned/cchat-gtk/internal/ui/imgview" "github.com/diamondburned/cchat-gtk/internal/ui/imgview"
"github.com/diamondburned/cchat-gtk/internal/ui/primitives" "github.com/diamondburned/cchat-gtk/internal/ui/primitives"
@ -100,6 +101,9 @@ func NewEmptyContainer() *GenericContainer {
content.SetSelectable(true) content.SetSelectable(true)
content.Show() content.Show()
// Never insert hyphens on line breaks in the message content.
labelutils.AddAttr(content, labelutils.InsertHyphens(false))
// Add CSS classes. // Add CSS classes.
primitives.AddClass(ts, "message-time") primitives.AddClass(ts, "message-time")
primitives.AddClass(user, "message-author") primitives.AddClass(user, "message-author")