logo       

Re: TreeView row reordering with DND?: msg#00241

Subject: Re: TreeView row reordering with DND?
Zach Bean said:
> I'm having some trouble understanding how reordering TreeView rows works with
> drag and drop.

Erm, as i understand it, the drag and drop Just Works to keep the model and
the view in sync.  All the docs that i've found say something to the effect of
"If you want more sophisticated DND handling, do it yourself."  :-/


> I tried searching through the list archives, but didn't find
> anything that answered my question;

The search facility on lists.gnome.org is infamously broken.  Use google's
site directive, instead.


> This works just fine: it allows us to drag the rows around wherever we
> want.  We'd like to execute a callback whenever this happens to update
> the tree structure on disk so that the rows will stay in the same order
> between executions of the program.

Why track individual changes (which is where the pain is coming from)?  Why
not just sync your entire data structure to disk?

Incidentally, a slight modification of your program:

  use Data::Dumper;
  # in both row-inserted and row-deleted, $_[1] is a Gtk2::TreePath
  $ts->signal_connect (row_deleted =>
                       sub { print "deleted ".$_[1]->to_string."\n" });
  $ts->signal_connect (row_inserted =>
                       sub { print "inserted ".$_[1]->to_string."\n" });

shows that the new row is inserted before the old row is deleted.

  tetsuo:~$ perl ~/treeview_test.pl
  inserted 0:1
  deleted 0:3:0


Also, the bindings for these signals are provided by the standard gtk2-perl
mechanism (i.e., no custom marshalers), so whatever values are coming in are
what GTK+ gave us.

-- 
muppet <scott at asofyet dot org>


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe