Open ghost opened 11 years ago
What OS do you use? CPU?
I use linux 3.5.0-17-generic 64bit on an AMD Athlon Neo
I have experienced this exact issue on a similar configuration. The problem must be in the third column of the list, where it should display an icon; when I changed it to the integer type the program compiled and ran without any errors.
edit: Actually, changing the type of the third column to anything but pixbuf makes it work; obviously, "makes it work" refers only to those programs that don't need images in their lists...
I had a problem with this too. I think it is something fishy with the gdkpixbuf.GetType() parameter. I was looking into it some time ago and I wonder if the "icon" type needs to be correctly registered with glib or something. I'm not sure as I am not a GTK expert, but it looks like go-gtk3 does something like that.
If you look at the init function in gdkpixbuf in go-gtk3 he does something like this
func init() { // Initialize G_TYPE_PIXBUF G_TYPE_PIXBUF = gobject.GType(C.gdk_pixbuf_get_type())
// Register Pixbuf type
gobject.RegisterCType(G_TYPE_PIXBUF, newPixbufFromNative)
gobject.RegisterGoType(G_TYPE_PIXBUF, nativeFromPixbuf)
// Initialize GdkInterp
GdkInterp.NEAREST = 0
GdkInterp.TILES = 1
GdkInterp.BILINEAR = 2
GdkInterp.HYPER = 3
}
I was hoping to get something out of that, but I never got to it
This is definetly related to the pixbuf. The following patch stops the demo from crashing for me:
diff --git a/example/listview/listview.go b/example/listview/listview.go
index 409d6c2..a556acc 100644
--- a/example/listview/listview.go
+++ b/example/listview/listview.go
@@ -4,7 +4,6 @@ import (
"os"
"unsafe"
- "github.com/mattn/go-gtk/gdkpixbuf"
"github.com/mattn/go-gtk/glib"
"github.com/mattn/go-gtk/gtk"
)
@@ -17,7 +16,7 @@ func main() {
swin := gtk.NewScrolledWindow(nil, nil)
- store := gtk.NewListStore(glib.G_TYPE_STRING, glib.G_TYPE_BOOL, gdkpixbuf.GetType())
+ store := gtk.NewListStore(glib.G_TYPE_STRING, glib.G_TYPE_BOOL)
treeview := gtk.NewTreeView()
swin.Add(treeview)
diff --git a/example/treeview/treeview.go b/example/treeview/treeview.go
index 802cf78..3618a79 100644
--- a/example/treeview/treeview.go
+++ b/example/treeview/treeview.go
@@ -1,7 +1,6 @@
package main
import (
- "github.com/mattn/go-gtk/gdkpixbuf"
"github.com/mattn/go-gtk/glib"
"github.com/mattn/go-gtk/gtk"
"os"
@@ -16,7 +15,7 @@ func main() {
swin := gtk.NewScrolledWindow(nil, nil)
- store := gtk.NewTreeStore(gdkpixbuf.GetType(), glib.G_TYPE_STRING)
+ store := gtk.NewTreeStore(glib.G_TYPE_STRING)
treeview := gtk.NewTreeView()
swin.Add(treeview)
At the listview example I get the Error:
At the treeview example I get the Error: