Re: Directory/file browser as TreeView




On Sep 28, 2006, at 1:42 AM, Ratcliffe, Jeffrey (Peters) wrote:

(having to store the directory path as a hidden
column seems rather hackish to me - but I couldn't work out how to get
the
parent from an iter)

       treeiter = $tree_model->iter_parent ($child)

Thanks. I must be blind. But on reflection, what I already did is certainly faster than walking back up the tree every time the path needs to be checked.

It's a tradeoff of time and space. The iterators may take slightly longer (i've never timed it), but storing the paths definitely takes more space. And really, asking an iter for its parent doesn't take long at all.


use constant TRUE  => 1;
use constant FALSE => 0;

use Glib qw(TRUE FALSE);

OK. I had always assumed that this:
1. loaded Glib, taking time and memory.
2. amounted to the same thing anyway.

Glib is already loaded when you use Gtk2. The difference here is that you're modifying your script's symbol table from Glib's import instead of with constant. And other gtk2-perl modules use Glib's TRUE and FALSE definitions, so your version is actually taking more time and space. ;-)

Also, Glib actually defines FALSE as the empty string, to behave more like perl itself, so they're not *exactly* the same.

But, in the end, no, it doesn't *really* matter, but that's why we do it.




--
To me, "hajime" means "the man standing opposite you is about to hit you with a stick".
  -- Ian Malpass, speaking of the Japanese word for "the beginning"




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