1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module glib.Messages;
26 
27 private import glib.Str;
28 private import glib.c.functions;
29 public  import glib.c.types;
30 public  import gtkc.glibtypes;
31 
32 
33 /** */
34 public struct Messages
35 {
36 
37 	/**
38 	 * Prompts the user with
39 	 * `[E]xit, [H]alt, show [S]tack trace or [P]roceed`.
40 	 * This function is intended to be used for debugging use only.
41 	 * The following example shows how it can be used together with
42 	 * the g_log() functions.
43 	 *
44 	 * |[<!-- language="C" -->
45 	 * #include <glib.h>
46 	 *
47 	 * static void
48 	 * log_handler (const gchar   *log_domain,
49 	 * GLogLevelFlags log_level,
50 	 * const gchar   *message,
51 	 * gpointer       user_data)
52 	 * {
53 	 * g_log_default_handler (log_domain, log_level, message, user_data);
54 	 *
55 	 * g_on_error_query (MY_PROGRAM_NAME);
56 	 * }
57 	 *
58 	 * int
59 	 * main (int argc, char *argv[])
60 	 * {
61 	 * g_log_set_handler (MY_LOG_DOMAIN,
62 	 * G_LOG_LEVEL_WARNING |
63 	 * G_LOG_LEVEL_ERROR |
64 	 * G_LOG_LEVEL_CRITICAL,
65 	 * log_handler,
66 	 * NULL);
67 	 * ...
68 	 * ]|
69 	 *
70 	 * If "[E]xit" is selected, the application terminates with a call
71 	 * to _exit(0).
72 	 *
73 	 * If "[S]tack" trace is selected, g_on_error_stack_trace() is called.
74 	 * This invokes gdb, which attaches to the current process and shows
75 	 * a stack trace. The prompt is then shown again.
76 	 *
77 	 * If "[P]roceed" is selected, the function returns.
78 	 *
79 	 * This function may cause different actions on non-UNIX platforms.
80 	 *
81 	 * Params:
82 	 *     prgName = the program name, needed by gdb for the "[S]tack trace"
83 	 *         option. If @prg_name is %NULL, g_get_prgname() is called to get
84 	 *         the program name (which will work correctly if gdk_init() or
85 	 *         gtk_init() has been called)
86 	 */
87 	public static void onErrorQuery(string prgName)
88 	{
89 		g_on_error_query(Str.toStringz(prgName));
90 	}
91 
92 	/**
93 	 * Invokes gdb, which attaches to the current process and shows a
94 	 * stack trace. Called by g_on_error_query() when the "[S]tack trace"
95 	 * option is selected. You can get the current process's program name
96 	 * with g_get_prgname(), assuming that you have called gtk_init() or
97 	 * gdk_init().
98 	 *
99 	 * This function may cause different actions on non-UNIX platforms.
100 	 *
101 	 * Params:
102 	 *     prgName = the program name, needed by gdb for the "[S]tack trace"
103 	 *         option
104 	 */
105 	public static void onErrorStackTrace(string prgName)
106 	{
107 		g_on_error_stack_trace(Str.toStringz(prgName));
108 	}
109 
110 	/**
111 	 * Sets the print handler.
112 	 *
113 	 * Any messages passed to g_print() will be output via
114 	 * the new handler. The default handler simply outputs
115 	 * the message to stdout. By providing your own handler
116 	 * you can redirect the output, to a GTK+ widget or a
117 	 * log file for example.
118 	 *
119 	 * Params:
120 	 *     func = the new print handler
121 	 *
122 	 * Returns: the old print handler
123 	 */
124 	public static GPrintFunc setPrintHandler(GPrintFunc func)
125 	{
126 		return g_set_print_handler(func);
127 	}
128 
129 	/**
130 	 * Sets the handler for printing error messages.
131 	 *
132 	 * Any messages passed to g_printerr() will be output via
133 	 * the new handler. The default handler simply outputs the
134 	 * message to stderr. By providing your own handler you can
135 	 * redirect the output, to a GTK+ widget or a log file for
136 	 * example.
137 	 *
138 	 * Params:
139 	 *     func = the new error message handler
140 	 *
141 	 * Returns: the old error message handler
142 	 */
143 	public static GPrintFunc setPrinterrHandler(GPrintFunc func)
144 	{
145 		return g_set_printerr_handler(func);
146 	}
147 }