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 gtkc.glib;
29 public  import gtkc.glibtypes;
30 
31 
32 /** */
33 public struct Messages
34 {
35 
36 	/**
37 	 * Prompts the user with
38 	 * `[E]xit, [H]alt, show [S]tack trace or [P]roceed`.
39 	 * This function is intended to be used for debugging use only.
40 	 * The following example shows how it can be used together with
41 	 * the g_log() functions.
42 	 *
43 	 * |[<!-- language="C" -->
44 	 * #include <glib.h>
45 	 *
46 	 * static void
47 	 * log_handler (const gchar   *log_domain,
48 	 * GLogLevelFlags log_level,
49 	 * const gchar   *message,
50 	 * gpointer       user_data)
51 	 * {
52 	 * g_log_default_handler (log_domain, log_level, message, user_data);
53 	 *
54 	 * g_on_error_query (MY_PROGRAM_NAME);
55 	 * }
56 	 *
57 	 * int
58 	 * main (int argc, char *argv[])
59 	 * {
60 	 * g_log_set_handler (MY_LOG_DOMAIN,
61 	 * G_LOG_LEVEL_WARNING |
62 	 * G_LOG_LEVEL_ERROR |
63 	 * G_LOG_LEVEL_CRITICAL,
64 	 * log_handler,
65 	 * NULL);
66 	 * ...
67 	 * ]|
68 	 *
69 	 * If "[E]xit" is selected, the application terminates with a call
70 	 * to _exit(0).
71 	 *
72 	 * If "[S]tack" trace is selected, g_on_error_stack_trace() is called.
73 	 * This invokes gdb, which attaches to the current process and shows
74 	 * a stack trace. The prompt is then shown again.
75 	 *
76 	 * If "[P]roceed" is selected, the function returns.
77 	 *
78 	 * This function may cause different actions on non-UNIX platforms.
79 	 *
80 	 * Params:
81 	 *     prgName = the program name, needed by gdb for the "[S]tack trace"
82 	 *         option. If @prg_name is %NULL, g_get_prgname() is called to get
83 	 *         the program name (which will work correctly if gdk_init() or
84 	 *         gtk_init() has been called)
85 	 */
86 	public static void onErrorQuery(string prgName)
87 	{
88 		g_on_error_query(Str.toStringz(prgName));
89 	}
90 
91 	/**
92 	 * Invokes gdb, which attaches to the current process and shows a
93 	 * stack trace. Called by g_on_error_query() when the "[S]tack trace"
94 	 * option is selected. You can get the current process's program name
95 	 * with g_get_prgname(), assuming that you have called gtk_init() or
96 	 * gdk_init().
97 	 *
98 	 * This function may cause different actions on non-UNIX platforms.
99 	 *
100 	 * Params:
101 	 *     prgName = the program name, needed by gdb for the "[S]tack trace"
102 	 *         option
103 	 */
104 	public static void onErrorStackTrace(string prgName)
105 	{
106 		g_on_error_stack_trace(Str.toStringz(prgName));
107 	}
108 
109 	/**
110 	 * Sets the print handler.
111 	 *
112 	 * Any messages passed to g_print() will be output via
113 	 * the new handler. The default handler simply outputs
114 	 * the message to stdout. By providing your own handler
115 	 * you can redirect the output, to a GTK+ widget or a
116 	 * log file for example.
117 	 *
118 	 * Params:
119 	 *     func = the new print handler
120 	 *
121 	 * Return: the old print handler
122 	 */
123 	public static GPrintFunc setPrintHandler(GPrintFunc func)
124 	{
125 		return g_set_print_handler(func);
126 	}
127 
128 	/**
129 	 * Sets the handler for printing error messages.
130 	 *
131 	 * Any messages passed to g_printerr() will be output via
132 	 * the new handler. The default handler simply outputs the
133 	 * message to stderr. By providing your own handler you can
134 	 * redirect the output, to a GTK+ widget or a log file for
135 	 * example.
136 	 *
137 	 * Params:
138 	 *     func = the new error message handler
139 	 *
140 	 * Return: the old error message handler
141 	 */
142 	public static GPrintFunc setPrinterrHandler(GPrintFunc func)
143 	{
144 		return g_set_printerr_handler(func);
145 	}
146 }