Re: [Vala] cannot create instance of abstract (non-instantiatable) type `GtkBox'



On Sun, 2012-06-03 at 16:47 -0400, Ronaldo Nascimento wrote:
When I use Glade 3.12 to create a vertical box, it saves it as GtkBox.
However at runtime it crashes vala with:

It isn't Vala that is crashing.

(nwars:9024): GLib-GObject-WARNING **: cannot create instance of abstract
(non-instantiatable) type `GtkBox'

It sounds like you are using GTK+ 2 in your project but Glade is
targeting GTK+ 3.  Either figure out how to get Glade to target GTK+ 2
or change your build system to use gtk+-3.0 instead of gtk+-2.0.

When I look at the XML the entry for the offending GtkBox is:
<object class="GtkBox" id="box1">

However if I re-do it in Glade 2 the entry for the VBox is:
<object class="GtkVBox" id="vbox1">

Is vala not ready for Gtk+3?

Lots of projects written in Vala use GTK+ 3 quite happily.  Your problem
is that you're actually using GTK+ 2.

I used vala-gen-project to create this mess.

I've never really used vala-gen-project, but a cursory look at
http://gitorious.org/vala-toys/vala-toys/trees/master/gen-project/templates doesn't seem to show any support 
for GTK+ 3.  When you selected your project did you choose "Gtk+ 2.0 Application"?  If so, it hardly seems 
surprising that the resulting application is using gtk+-2.0, not gtk+-3.0.

IIRC (and I could be wrong) vala-gen-project creates an autotools-based
build system.  You'll need to replace gtk+-2.0 with gtk+-3.0 in
configure.ac and any relevant Makefile.am (generally just the one in
your source subdirectory, which is probably called either "src" or the
name of your project).


-Evan




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]