remove getImageFromIcon
This commit is contained in:
BIN
bin/nwg-drawer
BIN
bin/nwg-drawer
Binary file not shown.
@@ -11,20 +11,6 @@ import (
|
|||||||
"github.com/gotk3/gotk3/gtk"
|
"github.com/gotk3/gotk3/gtk"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getImageFromIcon(ico string) (img *gtk.Image, err error) {
|
|
||||||
var pixbuf *gdk.Pixbuf
|
|
||||||
if ico != "" {
|
|
||||||
pixbuf, err = createPixbuf(ico, *iconSize)
|
|
||||||
} else {
|
|
||||||
pixbuf, err = createPixbuf("image-missing", *iconSize)
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
pixbuf, _ = createPixbuf("unknown", *iconSize)
|
|
||||||
}
|
|
||||||
img, _ = gtk.ImageNewFromPixbuf(pixbuf)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func setUpPinnedFlowBox() *gtk.FlowBox {
|
func setUpPinnedFlowBox() *gtk.FlowBox {
|
||||||
if pinnedFlowBox != nil {
|
if pinnedFlowBox != nil {
|
||||||
pinnedFlowBox.Destroy()
|
pinnedFlowBox.Destroy()
|
||||||
@@ -48,10 +34,19 @@ func setUpPinnedFlowBox() *gtk.FlowBox {
|
|||||||
|
|
||||||
btn, _ := gtk.ButtonNew()
|
btn, _ := gtk.ButtonNew()
|
||||||
|
|
||||||
img, err := getImageFromIcon(entry.Icon)
|
var pixbuf *gdk.Pixbuf
|
||||||
|
var img *gtk.Image
|
||||||
|
var err error
|
||||||
|
if entry.Icon != "" {
|
||||||
|
pixbuf, err = createPixbuf(entry.Icon, *iconSize)
|
||||||
|
} else {
|
||||||
|
pixbuf, err = createPixbuf("image-missing", *iconSize)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
|
pixbuf, _ = createPixbuf("unknown", *iconSize)
|
||||||
}
|
}
|
||||||
|
img, _ = gtk.ImageNewFromPixbuf(pixbuf)
|
||||||
|
|
||||||
btn.SetImage(img)
|
btn.SetImage(img)
|
||||||
btn.SetAlwaysShowImage(true)
|
btn.SetAlwaysShowImage(true)
|
||||||
@@ -245,10 +240,19 @@ func flowBoxButton(entry desktopEntry) *gtk.Button {
|
|||||||
button, _ := gtk.ButtonNew()
|
button, _ := gtk.ButtonNew()
|
||||||
button.SetAlwaysShowImage(true)
|
button.SetAlwaysShowImage(true)
|
||||||
|
|
||||||
img, err := getImageFromIcon(entry.Icon)
|
var pixbuf *gdk.Pixbuf
|
||||||
|
var img *gtk.Image
|
||||||
|
var err error
|
||||||
|
if entry.Icon != "" {
|
||||||
|
pixbuf, err = createPixbuf(entry.Icon, *iconSize)
|
||||||
|
} else {
|
||||||
|
pixbuf, err = createPixbuf("image-missing", *iconSize)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
|
pixbuf, _ = createPixbuf("unknown", *iconSize)
|
||||||
}
|
}
|
||||||
|
img, _ = gtk.ImageNewFromPixbuf(pixbuf)
|
||||||
|
|
||||||
button.SetImage(img)
|
button.SetImage(img)
|
||||||
button.SetImagePosition(gtk.POS_TOP)
|
button.SetImagePosition(gtk.POS_TOP)
|
||||||
|
|||||||
Reference in New Issue
Block a user