+2004-08-23 Matthias Clasen <mclasen@redhat.com>
+
+ * glib/tmpl/warnings.sgml: Add an example for
+ g_on_error_query() usage. (#148716, Christian Persch)
+
2004-08-12 Matthias Clasen <mclasen@redhat.com>
* glib/tmpl/threads.sgml: Document the necessity to call
<!-- ##### FUNCTION g_on_error_query ##### -->
<para>
Prompts the user with <computeroutput>[E]xit, [H]alt, show [S]tack trace or [P]roceed</computeroutput>.
-This function is intended to be used for debugging use only.
-FIXME: How do you set it up?
-</para>
+This function is intended to be used for debugging use only. The following
+example shows how it can be used together with the g_log() functions.
+</para>
+<informalexample><programlisting>
+#include <glib.h>
+
+static void
+log_handler (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *message,
+ gpointer user_data)
+{
+ g_log_default_handler (log_domain, log_level, message, user_data);
+
+ g_on_error_query (MY_PROGRAM_NAME);
+}
+
+int main (int argc, char *argv[])
+{
+ g_log_set_handler (MY_LOG_DOMAIN,
+ G_LOG_LEVEL_WARNING |
+ G_LOG_LEVEL_ERROR |
+ G_LOG_LEVEL_CRITICAL,
+ log_handler,
+ NULL);
+
+ /* ... */
+</programlisting></informalexample>
<para>
If [E]xit is selected, the application terminates with a call to
<function>_exit(0)</function>.