Forum: Ruby-Gnome 2 drag and drop between treeviews

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
195c58db2ff6f8b8b0d2e74e9430a62e?d=identicon&s=25 Alex (Guest)
on 2007-07-31 21:54
(Received via mailing list)
I want to enable drag and drop between two different tree views.. one
treeview actually uses a treefiltermodel, which I guess doesn't
implement the dragdest interface..

I enabled dragging from the one treeview:

@treeview.enable_model_drag_source(Gdk::Window::BUTTON1_MASK,
    DND_TAG_TO_AUDIO_WORK,
    Gdk::DragContext::ACTION_COPY)

and in the other treeview [the one i want to be the dest] i've tried
both:

enable_model_drag_dest(DND_TAG_TO_AUDIO_WORK,
    Gdk::DragContext::ACTION_COPY)

signal_connect("drag_data_received") { |*args|
  puts "got"
  true
}

and

Gtk::Drag.dest_set(self, Gtk::Drag::DEST_DEFAULT_MOTION |
                   Gtk::Drag::DEST_DEFAULT_HIGHLIGHT,
                   DND_TAG_TO_AUDIO_WORK,
                   Gdk::DragContext::ACTION_COPY)

signal_connect("drag-data-received") do |w, dc, x, y, selectiondata,
info, time|
  dc.targets.each do |target|
    if target.name == "test" ||
      selectiondata.type == Gdk::Selection::TYPE_STRING
      puts selectiondata.data
    else
      puts "got"
    end
  end
  true
end

signal_connect("drag-drop") do |w, dc, x, y, time|
  Gtk::Drag.get_data(w, dc, dc.targets[0], time)
  true
end

each method gives me "got" on the console when I drop something, but I
also see
this printed:
   Gtk-WARNING **:You must override the default 'drag_data_received'
handler on GtkTreeView when using models that don't support the
GtkTreeDragDest interface and enabling drag-and-drop. The simplest way
to do this is to connect to 'drag_data_received' and call
g_signal_stop_emission_by_name() in your signal handler to prevent the
default handler from running. Look at the source code for the default
handler in gtktreeview.c to get an idea what your handler should do.
(gtktreeview.c is in the GTK source code.) If you're using GTK from a
language other than C, there may be a more natural way to override
default handlers, e.g. via derivation.


Basically, I'm wondering what the best way to do this is, and how do I
get rid
of this warning?

-Alex

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
This topic is locked and can not be replied to.