logo       
Google Custom Search
    AddThis Social Bookmark Button

Re: That GtkTreePath-as-boxed patch: msg#00112

Subject: Re: That GtkTreePath-as-boxed patch
Hm, the reason I made it that way in the first place was that the array it is/was at the time simply fails, or did. No idea now, it's a long time since I looked into it. If the path is a boxed object you can have (and my test script does have) $filter = $model->filter_new($path).

More to the point, in a single column with 3 entries:

$iter = $store->get_iter_first();
$path = $store->get_path($iter);
echo $path->to_string()."\n"; //  1
$path->next();                     //  2
$path->prev();                     //  1
$path->up(); // NULL (this is the parent branch, no possibility of going any further) $path->down(); // 0 (no sub-branches, but integer because sub-branches can be created)
$newiter = $store->get_iter($path);

worked in my test script following the change. If the path exists (ie it's not 0 or NULL) then $path alters its value as it 'moves around', so calling get_iter($path) when $path = 2 will return the appropriate iter so that you can do something with that cell. It makes it very simple to check exactly where you are, and it also makes it very simple to get to the next/previous cell or branch. You don't need the iter object in order to move around; you just call it when you need to access a cell. Because you have access to the value of the path itself, via to_string(), it's very straightforward to manipulate it programmatically.

NB I've a feeling the way iter_next() works has changed since I wrote this in October. $store->iter_next($iter); used to change the iter value directly rather than return it.

What kind of 'better way'?



No, you're not really traversing the tree with GtkTreePath. You still need to call get_iter($path) each time you want to get ahold of the iterator referring to the GtkTreePath. I am working on a better way. Perhaps, we should wait and see until it's ready and then decide whether we still want GtkTreePath as a boxed object.

-Andrei


On Feb 13, 2006, at 8:59 PM, Steph Fox wrote:

Ah wait, memory's flooding back now.

You're right, I did a test drive with a single function that calls it.

It's useful because it's an iterator in its own right, and having it exposed means you can traverse a tree 'from the inside' if you see what I mean.

----- Original Message ----- From: "Steph Fox" <steph@xxxxxxxx>
To: "Andrei Zmievski" <andrei@xxxxxxxxxxxxxx>
Cc: "PHP-GTK dev" <php-gtk-dev@xxxxxxxxxxxxx>
Sent: Tuesday, February 14, 2006 6:51 AM
Subject: Re: [PHP-GTK-DEV] That GtkTreePath-as-boxed patch


I already did, didn't I?

(I know I thought I had in the original patch anyway).

----- Original Message ----- From: "Andrei Zmievski" <andrei@xxxxxxxxxxxxxx>
To: "Steph Fox" <steph@xxxxxxxx>
Cc: "PHP-GTK dev" <php-gtk-dev@xxxxxxxxxxxxx>
Sent: Tuesday, February 14, 2006 5:42 AM
Subject: Re: [PHP-GTK-DEV] That GtkTreePath-as-boxed patch


All right, I reviewed. Basically, if you make GtkTreePath into a boxed object, then we have two ways of representing GtkTreePath when it's passed to functions: as a string and as a boxed object. There needs to be additional code to check for this and do the right thing, and that code will need to be generated (so more hacking in argtypes.php I think). If you're really sure that it will be useful, I'll hack it.

-Andrei


On Nov 2, 2005, at 1:10 PM, Steph Fox wrote:

Andrei, hi,

This is a much smaller patch now. Please review when you get a minute?

- Steph
<treepath.txt>
--
PHP-GTK Development Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


__________ NOD32 1.1380 (20060125) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com


--
PHP-GTK Development Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


__________ NOD32 1.1380 (20060125) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com



__________ NOD32 1.1380 (20060125) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com



--
PHP-GTK Development Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




<Prev in Thread] Current Thread [Next in Thread>