ahh, thanks! Works like a charm
Now, any idea how I make a treeview with a filter model a valid drag dest?
Right now I've got a hack working [with a global variable... which I don't want
[inside the destination treeview]
Gtk::Drag.dest_set(self, Gtk::Drag::DEST_DEFAULT_MOTION |
signal_connect("drag-data-received") do |w, dc, x, y, selectiondata, info, time|
#do some stuff with the global variable which
#points to the treeview which is the source, this way i can grab the selected
#data... but I'd rather not work that way!
signal_connect("drag-drop") do |w, dc, x, y, time|
Gtk::Drag.get_data(w, dc, dc.targets, time)
So, 2 guess there are 3 questions:
1) is there a better way to do this?
2) how do I get the selection data out of "selectiondata" in the signal handler
3) how do I stop the signal from propagating [as I always get this message after
I drag something:
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.
On 8/13/07, Peter Johanson <peter@...> wrote:
> On Sun, Aug 12, 2007 at 01:36:33PM -0700, Alex wrote:
> > so, every time I try to include a ruby gtk interface (like
> > TreeSortable) I get something like this:
> > ./database_display.rb:110:in `append_features': Not a subclass of
> > GLib::Instantiatable (TypeError)
> > For instance, I have a TreeView which uses a TreeModelFilter, but I
> > want to make the view sortable. How can I do that?
> I'm not sure about the specific ruby error above, but in general, you
> typically wrap the TreeModelFilter in a TreeModelSort to get a filtered
> view sortable:
> TreeModel (ListStore/TreeStore) -> TreeModelFilter -> TreeModelSort
> (make sure you do the sort *after* the filter)
> 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/
> ruby-gnome2-devel-en mailing list