RE: Missing API and API that needs improvements



On Thu, 2006-08-24 at 15:22 +0200, Philip Van Hoof wrote:
> On Thu, 2006-08-24 at 13:47 +0300, Dirk-Jan Binnema nokia com wrote:

> > You seem to like out-params... Can't they return the list as the
> > return value?

> No. Because then you can't choose the list implementation. Then it will
> always return the same list implementation (TnyList for example).
> 
> The developer might want to use a MySpecialListModel or like a
> TnyFolderListModel or a TnyAccountStoreModel in libtinymailui-gtk.
> 
> The list is owned and created by the client that needs the folders. It's
> not created by the framework that gets the items.
> 
> Look at the tny_folder_iface_get_headers API. It's exactly the same and
> it's the reason why it's possible to use a GtkTreeModel as list type
> without having to copy-over items to for example a GtkListModel type.

Oh and.. passing a GType with the method to tell it which list type it
should create, would be a solution for which you should be burned.

It will by the way not work in language bindings unless you do lots of
dirty tricks and hacks.

And hacks .. hacks is not what tinymail is about at all.

So you do:

class MySpecialListType implements TnyListIface 
{
	... 
}

MySpecialListType list = new MySpecialListType();
store.get_folders (list, query, ..);
MySpecialView view = new MySpecialView ();
view.Model = list;

Elegant, simple, clean, nice.


-- 
Philip Van Hoof, software developer at x-tend 
home: me at pvanhoof dot be 
gnome: pvanhoof at gnome dot org 
work: vanhoof at x-tend dot be 
http://www.pvanhoof.be - http://www.x-tend.be




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