On Sat 20 Apr 2019 at 16:22:56 +0200, Detlef Graef wrote: > Hi, > > I'm having a look at this issue: > > https://gitlab.gnome.org/GNOME/pan/issues/77 > > I want to register a callback function for GMimeParserOptions: > > https://developer.gnome.org/gmime/stable/gmime-GMimeParserOptions.html#g-mime-parser-options-set-warning-callback > > with: > > g_mime_parser_options_set_warning_callback () > > Is it ok to define a function something like this: > > > GMimeParserWarningFunc warning_cb (gint64 offset, > GMimeParserWarning errcode, > const gchar *item, > gpointer user_data) > {
I think the signature of warning_cb would be
void warning_cb (gint64 offset,
GMimeParserWarning errcode,
const gchar *item,
gpointer user_data)
because GMimeParserWarningFunc is the type of the function, not of the
return value of the function.
> // do something with errcode
> }
>
> // -----------
>
> https://developer.gnome.org/gmime/stable/gmime-GMimeParserOptions.html#GMimeParserWarningFunc
>
>
> How do I pass the callback function warning_cb correctly?
>
> gpointer user_data = NULL;
> GMimeParserOptions *gmpo = g_mime_parser_options_new();
> g_mime_parser_options_set_warning_callback (gmpo, warning_cb, user_data);
That looks ok, going just by the docs as linked.
If you got a warning or error message from the compiler, it is probably
due to the wrong type of 'warning_cb'.
> Detlef
-Olaf.
--
___ Olaf 'Rhialto' Seibert -- "What good is a Ring of Power
\X/ rhialto/at/falu.nl -- if you're unable...to Speak." - Agent Elrond
signature.asc
Description: PGP signature
_______________________________________________ Pan-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/pan-users
