Merge pull request #63 from nwg-piotr/fix62

Fixes accidental crash on trimming long descriptions
This commit is contained in:
Piotr Miller
2022-05-16 22:27:54 +02:00
committed by GitHub
2 changed files with 5 additions and 5 deletions

View File

@@ -21,7 +21,7 @@ import (
"github.com/gotk3/gotk3/gtk" "github.com/gotk3/gotk3/gtk"
) )
const version = "0.3.0" const version = "0.3.1"
var ( var (
appDirs []string appDirs []string

View File

@@ -248,8 +248,8 @@ func flowBoxButton(entry desktopEntry) *gtk.Button {
button.SetImagePosition(gtk.POS_TOP) button.SetImagePosition(gtk.POS_TOP)
name := entry.NameLoc name := entry.NameLoc
if len(name) > 20 { if len(name) > 20 {
r := []rune(name) r := []rune(name[:17])
name = string(r[:17]) name = string(r)
name = fmt.Sprintf("%s…", name) name = fmt.Sprintf("%s…", name)
} }
button.SetLabel(name) button.SetLabel(name)
@@ -259,8 +259,8 @@ func flowBoxButton(entry desktopEntry) *gtk.Button {
terminal := entry.Terminal terminal := entry.Terminal
desc := entry.CommentLoc desc := entry.CommentLoc
if len(desc) > 120 { if len(desc) > 120 {
r := []rune(desc) r := []rune(desc[:117])
desc = string(r[:117]) desc = string(r)
desc = fmt.Sprintf("%s…", desc) desc = fmt.Sprintf("%s…", desc)
} }
button.Connect("button-release-event", func(btn *gtk.Button, e *gdk.Event) bool { button.Connect("button-release-event", func(btn *gtk.Button, e *gdk.Event) bool {