Re: Signals with gchar** arguments
- From: Alexander Larsson <alexl redhat com>
- To: Emmanuele Bassi <ebassi gmail com>
- Cc: gtk-devel-list gnome org
- Subject: Re: Signals with gchar** arguments
- Date: Thu, 15 Nov 2007 14:21:20 +0100
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).
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]