RE: TnyAccountTreeModel is now a TnyListIface



Hi Philip, 

>-----Original Message-----
>From: tinymail-devel-list-bounces gnome org 
>[mailto:tinymail-devel-list-bounces gnome org] On Behalf Of 
>ext Philip Van Hoof
>Sent: Wednesday, July 05, 2006 12:54
>To: tinymail-devel-list gnome org
>Subject: TnyAccountTreeModel is now a TnyListIface
>
>The TnyAccounTreeModel now implements both GtkTreeModelIface 
>and TnyListIface (so it's a lot like the TnyMsgHeaderListModel).
>
>This means coding something like this works:
>
>GtkTreeModel *mailbox_model = tny_account_tree_model_new (); 
>TnyListIface *accounts = TNY_LIST_IFACE (mailbox_model);
>
>tny_account_store_iface_get_accounts (account_store, accounts,
>	TNY_ACCOUNT_STORE_IFACE_STORE_ACCOUNTS);
>
>gtk_tree_view_set_model (GTK_TREE_VIEW (priv->mailbox_view), 
>		mailbox_model);
>
>
>It should also be possible to iterate the accounts and stuff like that.
>But this hasn't yet been tested a lot. Feel free to help me 
>debug the work that has been done in this area. Not all of it 
>was simple code, yadi yada.

Hmmm.... I am not too happy with the Iterator API; it requires 
too many lines and checking for 'has_first', 'has_next'. The loops
are not looking very elegant.

Wouldn't it be more elegant to mimic (say) C++ iterators? Ie.

TnyIteratorIface *iter;

for (iter = tny_list_begin (my_list); iter != tny_list_end (my_list); 
     iter = tny_list_next (list, iter)) {

	MyFoo *foo = MY_FOO (tny_list_item(iter))
	/* do something with foo */
}

As iters are really only pointers somewhere in the list, it shouldn't
be necessary to explicitely create/unref them (they don't need to be
full gobjects, which makes 'm faster too).

I'll look into the implementation tomorrow....

Best wishes,
Dirk.




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