Re: TnyStatus, the new way of getting status information



On Mon, 2007-04-23 at 21:36 +0200, Murray Cumming wrote:
> On Mon, 2007-04-23 at 21:23 +0200, Philip Van Hoof wrote:
> > A brand new status API is available, called TnyStatus.
> > 
> > It works exactly like GError and you get a status instance in each
> > TnyStatusCallback.
> > 
> > The status->position, status->of_total, status->code, status->domain and
> > status->message are the members that you want to use.
> > 
> > You even have a tny_status_get_percentage to make your life dead-easy.
> > 
> > The online API docs have been updated too
> 
> I'm sure you have your reasons for not using GError, but what are they,
> out of interest?

I started with simply C-style inheriting GError, like this:

TnyStatus { GError parent; }

But I figured that I also needed a position and a of_total member.

At some point I had a structure like this:

TnyStatus { GError parent;  gint position, of_total; }

And I had all the methods adapted to first call g_error_* on the parent
and then take care of the position and of_total members.

The end result was more or less an equal amount of code of the current,
but much more of a mess. 

So the reason was actually to make it more easy and less prone to
implementation changes of the GError infrastructure.

But indeed, at first I had the idea to simply reuse GError for this.



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







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