Re: [Vala] error: "missing generic type arguments"
- From: Evan Nemerson <evan coeus-group com>
- To: Andrea Pretto <aprettz yahoo it>
- Cc: "vala-list gnome org" <vala-list gnome org>
- Subject: Re: [Vala] error: "missing generic type arguments"
- Date: Sat, 24 Sep 2011 13:08:13 -0700
On Thu, 2011-09-22 at 18:22 +0100, Andrea Pretto wrote:
Hello,
I have downloaded a code sample for drag&drop on gtk, but I get an error compiling it:
private bool on_drag_drop (Widget widget, DragContext context, int x, int y, uint time) {
if (context.targets != null) {
Atom target_type = (Atom) (context.targets.nth_data (0)); // THIS GIVE ERROR !!!!
stderr.printf("data %s\n", target_type.name());
// Request the data
//Gtk.drag_get_data (widget, context, target_type, time);
}
The error is "missing generic type arguments".
context is of type Gdk.DragContext and context.targets is a List<Gdk.Atom>.
I have no idea on how to fix that.
I'am using valac 0.8.1 on debia squeeze.
In 0.8.1 there were no type arguments on Gdk.DragContext.targets... they
were added on 2010-07-17 [1], but 0.8.1 was released on 2010-04-21.
Updating Vala is probably not a bad idea (lots of bugs like this have
been fixed in the past 17 months), but you should be able to work around
this issue by doing something like this:
unowned GLib.List<Gdk.Atom> targets =
(GLib.List<Gdk.Atom>) (context.targets);
Gdk.Atom target_type = targets.nth_data (0);
Or, if you want to avoid the extra variable:
Gdk.Atom target_type =
((GLib.List<Gdk.Atom>) (context.targets)).nth_data (0);
-Evan
[1]
http://git.gnome.org/browse/vala/commit/?id=26b892aab2e9c8df7d7736410244a6b3563da82e
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]