libxfcegui4 dialogs

Benedikt Meurer Benedikt.Meurer at unix-ag.uni-siegen.de
Wed Mar 12 15:07:54 CET 2003


On Wed, 12, Mar 2003, Jasper Huijsmans wrote:

> On Wed, 12 Mar 2003 14:04:50 +0100
> Benedikt Meurer <Benedikt.Meurer at unix-ag.uni-siegen.de> wrote:
> 
> > On Wed, 12, Mar 2003, Jasper Huijsmans wrote:
> > 
> > > On Wed, 12 Mar 2003 13:07:53 +0100
> > > Benedikt Meurer <Benedikt.Meurer at unix-ag.uni-siegen.de> wrote:
> > > 
> > > > Hello Jasper,
> > > > 
> > > > I'd like to replace the show_{error,info,warning} functions in
> > > > libxfcegui4 with the following functions:
> > > > [...]
> > 
> > > If it's only convenience for having to do a g_strdup_printf() before
> > > the dialog I think it's overkill, if it's more sophisticated with
> > > error numbers and such, I think it won't help us much since many of
> > > the error's in xfce4 come from gtk and are encapsulated by a GError
> > > * anyway.
> > 
> > Good point. I think you're right. So the functions should be something
> > like that:
> > 
> > 	xfce_err(const GError *, const gchar *, ...)
> > 	and so on...
> > 
> 
> Well, I think that's not really necessary. Just use gerror->messsage.
> You could do it and allow it to be NULL, but I don't think it buys you
> much.

Ok, the xfce_{err,verr,warn,vwarn} functions can be dropped.

> > > I'm not pricipally against it, it's just that I want to make sure we
> > > keep things as simple as possible. Basically, what I'm saying is I'd
> > > only like to add stuff that solves a problem now, or makes things
> > > easier now, or reduces duplication or something. I don't want to
> > > have things that may be very useful in the future or the equivalent
> > > of the Java class library incorporated with xfce ;-)(ok, so that's a
> > > tiny bit over the top :-))
> > 
> > The functions themselve are quite simple: the functions without the
> > 'v' simply call the corresponding 'v'-functions. The 'v'-functions
> > format the string and call a static popup_message()-function.
> > 
> 
> Right, so the v-functions are just implementation details, not part of
> the exported API. That's better.

No, its available to the application too, cause there might be some
cases where this is usefull to have (yeah, its in the future, not yet,
but in german you'd say: "Vorsorge ist besser als Nachsorge" ;-).

> How would the x and non-x versions be used then (/me is ignorant,
> please enlighten me)?

The x-functions can be dropped.

> > Its intended to reduce redundant code all over the Xfce modules (now
> > :), and to make life a bit easier, since this really safes a call to
> > g_strdup_printf() which in turn has really a large overhead for simple
> > string formating.
> > 
> > The xfce_*() functions will use a static message buffer to reduce the
> > g_strdup overhead (and therefore unneccessary memory fragmentation).
> 
> hmm, there was some talk about this earlier, where people said they
> preferred dynamic memory allocation. I am not qualified to comment on
> this, though.

It has two significant disadvantages: a) it is slower and b) it causes
unneccessary memory fragmentation.

So, now we have to following functions left:

	xfce_err()
	xfce_verr()
	xfce_warn()
	xfce_vwarn()
	xfce_info()
	xfce_vinfo()

regards,
Benedikt

-- 
Those who do not understand Unix are condemned to reinvent it, poorly.
    -- Henry Spencer



More information about the Xfce4-dev mailing list