mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-03 14:42:10 +01:00
Add an example for g_on_error_query() usage. (#148716, Christian Persch)
2004-08-23 Matthias Clasen <mclasen@redhat.com> * glib/tmpl/warnings.sgml: Add an example for g_on_error_query() usage. (#148716, Christian Persch)
This commit is contained in:
parent
81f3c9dcc4
commit
66a18b3f64
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
@ -151,9 +151,34 @@ The macro can be turned off in final releases of code by defining
|
||||
<!-- ##### 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?
|
||||
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>.
|
||||
|
Loading…
x
Reference in New Issue
Block a user