Add G_GNUC_PRINTF on all functions with format strings
[platform/upstream/glib.git] / gio / gdbuserror.h
1 /* GDBus - GLib D-Bus Library
2  *
3  * Copyright (C) 2008-2010 Red Hat, Inc.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library 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 GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General
16  * Public License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18  * Boston, MA 02111-1307, USA.
19  *
20  * Author: David Zeuthen <davidz@redhat.com>
21  */
22
23 #ifndef __G_DBUS_ERROR_H__
24 #define __G_DBUS_ERROR_H__
25
26 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
27 #error "Only <gio/gio.h> can be included directly."
28 #endif
29
30 #include <gio/giotypes.h>
31
32 G_BEGIN_DECLS
33
34 /**
35  * G_DBUS_ERROR:
36  *
37  * Error domain for errors generated by a remote message bus. Errors
38  * in this domain will be from the #GDBusError enumeration.  See
39  * #GError for more information on error domains.
40  *
41  * Note that errors in this error domain is intended only for
42  * returning errors from a remote message bus process. Errors
43  * generated locally in-process by e.g. #GDBusConnection is from the
44  * %G_IO_ERROR domain.
45  *
46  * Since: 2.26
47  */
48 #define G_DBUS_ERROR g_dbus_error_quark()
49
50 GQuark g_dbus_error_quark (void);
51
52 /* Used by applications to check, get and strip the D-Bus error name */
53 gboolean g_dbus_error_is_remote_error       (const GError    *error);
54 gchar   *g_dbus_error_get_remote_error      (const GError    *error);
55 gboolean g_dbus_error_strip_remote_error    (GError          *error);
56
57 /**
58  * GDBusErrorEntry:
59  * @error_code: An error code.
60  * @dbus_error_name: The D-Bus error name to associate with @error_code.
61  *
62  * Struct used in g_dbus_error_register_error_domain().
63  *
64  * Since: 2.26
65  */
66 struct _GDBusErrorEntry
67 {
68   gint         error_code;
69   const gchar *dbus_error_name;
70 };
71
72 gboolean g_dbus_error_register_error        (GQuark                 error_domain,
73                                              gint                   error_code,
74                                              const gchar           *dbus_error_name);
75 gboolean g_dbus_error_unregister_error      (GQuark                 error_domain,
76                                              gint                   error_code,
77                                              const gchar           *dbus_error_name);
78 void     g_dbus_error_register_error_domain (const gchar           *error_domain_quark_name,
79                                              volatile gsize        *quark_volatile,
80                                              const GDBusErrorEntry *entries,
81                                              guint                  num_entries);
82
83 /* Only used by object mappings to map back and forth to GError */
84 GError  *g_dbus_error_new_for_dbus_error    (const gchar     *dbus_error_name,
85                                              const gchar     *dbus_error_message);
86 void     g_dbus_error_set_dbus_error        (GError         **error,
87                                              const gchar     *dbus_error_name,
88                                              const gchar     *dbus_error_message,
89                                              const gchar     *format,
90                                              ...) G_GNUC_PRINTF(4, 5);
91 void     g_dbus_error_set_dbus_error_valist (GError         **error,
92                                              const gchar     *dbus_error_name,
93                                              const gchar     *dbus_error_message,
94                                              const gchar     *format,
95                                              va_list          var_args) G_GNUC_PRINTF(4, 0);
96 gchar   *g_dbus_error_encode_gerror         (const GError    *error);
97
98 G_END_DECLS
99
100 #endif /* __G_DBUS_ERROR_H__ */