gdbuserror.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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, see <http://www.gnu.org/licenses/>.
  17. *
  18. * Author: David Zeuthen <[email protected]>
  19. */
  20. #ifndef __G_DBUS_ERROR_H__
  21. #define __G_DBUS_ERROR_H__
  22. #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
  23. #error "Only <gio/gio.h> can be included directly."
  24. #endif
  25. #include <gio/giotypes.h>
  26. G_BEGIN_DECLS
  27. /**
  28. * G_DBUS_ERROR:
  29. *
  30. * Error domain for errors generated by a remote message bus. Errors
  31. * in this domain will be from the #GDBusError enumeration. See
  32. * #GError for more information on error domains.
  33. *
  34. * Note that errors in this error domain is intended only for
  35. * returning errors from a remote message bus process. Errors
  36. * generated locally in-process by e.g. #GDBusConnection is from the
  37. * %G_IO_ERROR domain.
  38. *
  39. * Since: 2.26
  40. */
  41. #define G_DBUS_ERROR g_dbus_error_quark()
  42. GLIB_AVAILABLE_IN_ALL
  43. GQuark g_dbus_error_quark (void);
  44. /* Used by applications to check, get and strip the D-Bus error name */
  45. GLIB_AVAILABLE_IN_ALL
  46. gboolean g_dbus_error_is_remote_error (const GError *error);
  47. GLIB_AVAILABLE_IN_ALL
  48. gchar *g_dbus_error_get_remote_error (const GError *error);
  49. GLIB_AVAILABLE_IN_ALL
  50. gboolean g_dbus_error_strip_remote_error (GError *error);
  51. /**
  52. * GDBusErrorEntry:
  53. * @error_code: An error code.
  54. * @dbus_error_name: The D-Bus error name to associate with @error_code.
  55. *
  56. * Struct used in g_dbus_error_register_error_domain().
  57. *
  58. * Since: 2.26
  59. */
  60. struct _GDBusErrorEntry
  61. {
  62. gint error_code;
  63. const gchar *dbus_error_name;
  64. };
  65. GLIB_AVAILABLE_IN_ALL
  66. gboolean g_dbus_error_register_error (GQuark error_domain,
  67. gint error_code,
  68. const gchar *dbus_error_name);
  69. GLIB_AVAILABLE_IN_ALL
  70. gboolean g_dbus_error_unregister_error (GQuark error_domain,
  71. gint error_code,
  72. const gchar *dbus_error_name);
  73. GLIB_AVAILABLE_IN_ALL
  74. void g_dbus_error_register_error_domain (const gchar *error_domain_quark_name,
  75. volatile gsize *quark_volatile,
  76. const GDBusErrorEntry *entries,
  77. guint num_entries);
  78. /* Only used by object mappings to map back and forth to GError */
  79. GLIB_AVAILABLE_IN_ALL
  80. GError *g_dbus_error_new_for_dbus_error (const gchar *dbus_error_name,
  81. const gchar *dbus_error_message);
  82. GLIB_AVAILABLE_IN_ALL
  83. void g_dbus_error_set_dbus_error (GError **error,
  84. const gchar *dbus_error_name,
  85. const gchar *dbus_error_message,
  86. const gchar *format,
  87. ...) G_GNUC_PRINTF(4, 5);
  88. GLIB_AVAILABLE_IN_ALL
  89. void g_dbus_error_set_dbus_error_valist (GError **error,
  90. const gchar *dbus_error_name,
  91. const gchar *dbus_error_message,
  92. const gchar *format,
  93. va_list var_args) G_GNUC_PRINTF(4, 0);
  94. GLIB_AVAILABLE_IN_ALL
  95. gchar *g_dbus_error_encode_gerror (const GError *error);
  96. G_END_DECLS
  97. #endif /* __G_DBUS_ERROR_H__ */