Re: Enabling drag destination



On Tue, 22 Nov 2011 14:44:55 +0100
Florian Max <florian muellner gmail com> wrote:
> On Tue, Nov 22, 2011 at 1:22 PM, Chris Vine
> <chris cvine freeserve co uk>wrote:
> 
> > I did check this out before posting and with
> > gobject-introspection-1.30.0 it doesn't work for the same reason
> > that constructing a Gtk.TargetEntry object doesn't work, namely
> > that this;
> >
> > var targets = new Gtk.TargetList();
> >
> > generates this error in gjs:
> >
> > Unable to construct boxed type TargetList since it has no zero-args
> > <constructor>, can only wrap an existing one"
> >
> 
> You should be able to work around this by doing
> 
> var targets = Gtk.TargetList.new(entries);

Thanks.  Could you expand on this?  With gjs-1.30.0, the following
segfaults without any other message:

  var target1 = Gtk.TargetEntry.new("text/plain", 0, 0);
  var target2 = Gtk.TargetEntry.new("STRING", 0, 0);
  var targets = Gtk.TargetList.new([target1, target2]);

The following (with only one target) doesn't segfault until you hit
Gtk.Widget.drag_dest_set(), when it segfaults without any other message:

  var target1 = Gtk.TargetEntry.new("text/plain", 0, 0);
  var targets = Gtk.TargetList.new([target1]);
  drop_box.drag_dest_set(Gtk.DestDefaults.ALL,
                         targets,
                         targets.length,
                         Gdk.DragAction.COPY);

'drop_box' here is a Gtk.EventBox.

Chris


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