Re: [Vala] Gtk drag and drop



Mark Dewey wrote:
I'm trying to make it so I can drag a file from Nautilus onto my opened
program window (GTK) and have it open the file when I drop it.

I tried this:
this.connect("drag_drop", this.dropDrag);
(and other similar things)

But at runtime, I got the following error (and it didn't work):
(reader:9573): GLib-GObject-WARNING **: IA__g_object_connect: invalid
signal spec "Gdk.drag_drop"

Someone suggested trying "drag-drop" instead, but that didn't work
either. I got the "drag_drop" things from Python Gtk code, since I
couldn't find documentation on the string version from Vala. Any ideas
what I'm supposed to do? Do you have a better solution than what I'm
trying (I'm not even sure if it's the right way)?

Vala has syntax support for signals with static type checking. In Vala
you don't connect signals via strings:

  this.drag_drop.connect (on_drag_drop);

You can connect a method with this signature to the "drag_drop" signal:

  bool on_drag_drop (Widget widget, DragContext context,
                     int x, int y, uint time) {
      // ...
  }


Best regards,

Frederik



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