mirror of
https://github.com/nwg-piotr/nwg-drawer.git
synced 2024-09-11 14:07:17 +03:00
add "image-missing" if icon undefined
This commit is contained in:
parent
aa266f51e1
commit
d80dea2612
@ -32,11 +32,15 @@ func setUpPinnedFlowBox() *gtk.FlowBox {
|
|||||||
entry := id2entry[desktopID]
|
entry := id2entry[desktopID]
|
||||||
|
|
||||||
btn, _ := gtk.ButtonNew()
|
btn, _ := gtk.ButtonNew()
|
||||||
pixbuf, _ := createPixbuf(entry.Icon, *iconSize)
|
|
||||||
img, err := gtk.ImageNewFromPixbuf(pixbuf)
|
var img *gtk.Image
|
||||||
if err != nil {
|
if entry.Icon != "" {
|
||||||
println(err, entry.Icon)
|
pixbuf, _ := createPixbuf(entry.Icon, *iconSize)
|
||||||
|
img, _ = gtk.ImageNewFromPixbuf(pixbuf)
|
||||||
|
} else {
|
||||||
|
img, _ = gtk.ImageNewFromIconName("image-missing", gtk.ICON_SIZE_INVALID)
|
||||||
}
|
}
|
||||||
|
|
||||||
btn.SetImage(img)
|
btn.SetImage(img)
|
||||||
btn.SetAlwaysShowImage(true)
|
btn.SetAlwaysShowImage(true)
|
||||||
btn.SetImagePosition(gtk.POS_TOP)
|
btn.SetImagePosition(gtk.POS_TOP)
|
||||||
@ -222,8 +226,14 @@ func flowBoxButton(entry desktopEntry) *gtk.Button {
|
|||||||
button, _ := gtk.ButtonNew()
|
button, _ := gtk.ButtonNew()
|
||||||
button.SetAlwaysShowImage(true)
|
button.SetAlwaysShowImage(true)
|
||||||
|
|
||||||
pixbuf, _ := createPixbuf(entry.Icon, *iconSize)
|
var img *gtk.Image
|
||||||
img, _ := gtk.ImageNewFromPixbuf(pixbuf)
|
if entry.Icon != "" {
|
||||||
|
pixbuf, _ := createPixbuf(entry.Icon, *iconSize)
|
||||||
|
img, _ = gtk.ImageNewFromPixbuf(pixbuf)
|
||||||
|
} else {
|
||||||
|
img, _ = gtk.ImageNewFromIconName("image-missing", gtk.ICON_SIZE_INVALID)
|
||||||
|
}
|
||||||
|
|
||||||
button.SetImage(img)
|
button.SetImage(img)
|
||||||
button.SetImagePosition(gtk.POS_TOP)
|
button.SetImagePosition(gtk.POS_TOP)
|
||||||
name := entry.NameLoc
|
name := entry.NameLoc
|
||||||
|
Loading…
Reference in New Issue
Block a user