Interfaces/Modules, can we actually include them? + Sortable

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?

-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/

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)

-pete


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/

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
to do:

[inside the destination treeview]

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|
#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!
true
end

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

So, 2 guess there are 3 questions:

  1. is there a better way to do this?
    If not:

  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.

Thanks,
Alex

On 8/13/07, Peter J. [email protected] wrote:

I’m not sure about the specific ruby error above, but in general, you
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
[email protected]
ruby-gnome2-devel-en List Signup and Options


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/