Re: Drag'n'drop problems



On Mon, Sep 8, 2008 at 8:31 PM, John Coppens <john jcoppens com> wrote:
On Mon, 08 Sep 2008 11:03:39 -0600
Jeffrey Barish <jeff_barish earthlink net> wrote:
I was going to tell you that you are crazy, but when I tried putting
GTK_TREE_MODEL_ROW in my program in place of the arbitrary string that I
was using, I found that the behavior of my program changed to something
bizarre (I get too many signals).  So I am forced to agree that
GTK_TREE_MODEL_ROW is interpreted somewhere.  It's news to me.  I have
always used an arbitrary string that matches in the source and
destination specifications.

Thanks for that test - it does eliminate fears of other problems in my
program... In my case it was simple - with anything but
GTK_TREE_MODEL_ROW the drop callbacks are _not_ called at all. The
question is (for me, at least): where is the list of predefined values?

The GTK_TREE_MODEL_ROW target string is indeed interpreted somewhere
-- right inside GtkTreeView.  GtkTreeView has built-in support for
reordering a model (moving rows to another position in the same
model), which can be enabled via gtk_tree_view_set_reorderable().
This function will actually set up the tree view as a model drag
source and destination (via
gtk_tree_view_enable_model_drag_{source,dest}) and will specify a
target entry using GTK_TREE_MODEL_ROW as a target string.

Unfortunately the default implementations of the GtkTreeDragDest
interface that are in the GtkListStore and GtkTreeStore models can
only handle the GTK_TREE_MODEL_ROW target.  One of the things you can
try is subclass GtkListStore or GtkTreeStore and re-implement the
GtkTreeDragDest interface.  If that is not enough, I think another
thing that people tend to do is even override the default
implementation of drag and drop on the tree view widget.

This recent blog entry (and the preceding one) of Davyd may be of use:
http://davyd.livejournal.com/252082.html

I fully agree that the current implementation of drag and drop in tree
view is suboptimal, especially in terms of ease of use and
extensibility.  Over the summer I started on a rewrite of this, but as
University has started again I cannot really say when this will be
finished :)  But at least improvements are (finally) in the works.


regards,

-kris.



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