source: appstream-generator/build/girepo/glib/Messages.d @ 4841

Last change on this file since 4841 was 4841, checked in by Juanma, 2 years ago

Initial release

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