Re: Signals with gchar** arguments



Am Donnerstag, den 15.11.2007, 14:21 +0100 schrieb Alexander Larsson:
> On Thu, 2007-11-15 at 13:06 +0000, Emmanuele Bassi wrote:
> > On Thu, 2007-11-15 at 12:52 +0100, Mathias Hasselmann wrote:
> > 
> > >     static void
> > >     authenticate (SoupSession  *session, 
> > >                   /* other arguments... */
> > >                   gchar       **username,
> > >                   gchar       **password,
> > >                   gpointer      user_data)
> > >     {
> > >       /* ... */
> > > 
> > >       g_free (*username);
> > >       *username = g_strdup (lookup_username ());
> > > 
> > >       /* ... */
> > >     }
> > > 
> > > Notice that this use of "gchar**" arguments is different from the
> usage
> > > as "NULL terminated arrays of strings", aka. "G_TYPE_STRV".
> > 
> > this is probably the most evil use of signals I've seen in a while. ;-)
> > 
> > the SoupSession should really take a AuthenticateCallback function and
> > emit a signal on success or one on failure.
> 
> What gio does in the similar case of mounting is that GMountOperation
> gets a ask_for_password signal. Then the implementation of this gets to
> throw up some dialog and then it calls back into the GMountOperation
> when it knows the answer. This also allows the ask-for-password code to
> run async, and not having to recurse the mainloop (and generally be
> modal).

Sounds interesting, but guess I have to read your code to understand
what __exactly__ you mean.

Ciao,
Mathias
-- 
Mathias Hasselmann <mathias hasselmann gmx de>
http://taschenorakel.de/

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil



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