Re: Pan gmime-3 / Registering a callback function
Rhialto <[email protected]>
| Newsgroups | gmane.comp.gnome.apps.pan.user |
|---|---|
| Message-ID | <[email protected]> |
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
_______________________________________________
Pan-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/pan-users
signature.asc
(application/pgp-signature, 455 B)
-----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJcuy6tAAoJEJmJxkVhw/vTRHcH/3NdddkdirabPai6dwTFPknL DjK0xF+gDOnCXPnSWFcQTbEci3WL5sUQjxIpc4ieBtsCi8mLsV2HH1Ll5w1t3BeX vWp0cIP3VMb7OyDpZ9q3YQADNGOI8+lROnrUFiqkHKEJxAMBE+8SBwcrdfZXgoMI B2XoeWZ1lnQqp2cQgdLqCSql4LuYqx+gRb3+0LPB031K/yrNQL09INHQAkQ0ANtC Yo9W04QVTN+iZsQXPm3nNaZxBnKsN31uXaMuVDFbOiZ30UUu5PEIPaxfM2LnCWyx 5XV10sAhHNf3M2Mh8hrBF9Ki1L/kTluQ0PYj4OuHz5iKF2B0Gv29cAp1VPcxKQY= =AohH -----END PGP SIGNATURE-----