gdbusnameowning.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /* GDBus - GLib D-Bus Library
  2. *
  3. * Copyright (C) 2008-2010 Red Hat, Inc.
  4. *
  5. * SPDX-License-Identifier: LGPL-2.1-or-later
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General
  18. * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
  19. *
  20. * Author: David Zeuthen <davidz@redhat.com>
  21. */
  22. #ifndef __G_DBUS_NAME_OWNING_H__
  23. #define __G_DBUS_NAME_OWNING_H__
  24. #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
  25. #error "Only <gio/gio.h> can be included directly."
  26. #endif
  27. #include <gio/giotypes.h>
  28. G_BEGIN_DECLS
  29. /**
  30. * GBusAcquiredCallback:
  31. * @connection: The #GDBusConnection to a message bus.
  32. * @name: The name that is requested to be owned.
  33. * @user_data: User data passed to g_bus_own_name().
  34. *
  35. * Invoked when a connection to a message bus has been obtained.
  36. *
  37. * Since: 2.26
  38. */
  39. typedef void (*GBusAcquiredCallback) (GDBusConnection *connection,
  40. const gchar *name,
  41. gpointer user_data);
  42. /**
  43. * GBusNameAcquiredCallback:
  44. * @connection: The #GDBusConnection on which to acquired the name.
  45. * @name: The name being owned.
  46. * @user_data: User data passed to g_bus_own_name() or g_bus_own_name_on_connection().
  47. *
  48. * Invoked when the name is acquired.
  49. *
  50. * Since: 2.26
  51. */
  52. typedef void (*GBusNameAcquiredCallback) (GDBusConnection *connection,
  53. const gchar *name,
  54. gpointer user_data);
  55. /**
  56. * GBusNameLostCallback:
  57. * @connection: The #GDBusConnection on which to acquire the name or %NULL if
  58. * the connection was disconnected.
  59. * @name: The name being owned.
  60. * @user_data: User data passed to g_bus_own_name() or g_bus_own_name_on_connection().
  61. *
  62. * Invoked when the name is lost or @connection has been closed.
  63. *
  64. * Since: 2.26
  65. */
  66. typedef void (*GBusNameLostCallback) (GDBusConnection *connection,
  67. const gchar *name,
  68. gpointer user_data);
  69. GIO_AVAILABLE_IN_ALL
  70. guint g_bus_own_name (GBusType bus_type,
  71. const gchar *name,
  72. GBusNameOwnerFlags flags,
  73. GBusAcquiredCallback bus_acquired_handler,
  74. GBusNameAcquiredCallback name_acquired_handler,
  75. GBusNameLostCallback name_lost_handler,
  76. gpointer user_data,
  77. GDestroyNotify user_data_free_func);
  78. GIO_AVAILABLE_IN_ALL
  79. guint g_bus_own_name_on_connection (GDBusConnection *connection,
  80. const gchar *name,
  81. GBusNameOwnerFlags flags,
  82. GBusNameAcquiredCallback name_acquired_handler,
  83. GBusNameLostCallback name_lost_handler,
  84. gpointer user_data,
  85. GDestroyNotify user_data_free_func);
  86. GIO_AVAILABLE_IN_ALL
  87. guint g_bus_own_name_with_closures (GBusType bus_type,
  88. const gchar *name,
  89. GBusNameOwnerFlags flags,
  90. GClosure *bus_acquired_closure,
  91. GClosure *name_acquired_closure,
  92. GClosure *name_lost_closure);
  93. GIO_AVAILABLE_IN_ALL
  94. guint g_bus_own_name_on_connection_with_closures (
  95. GDBusConnection *connection,
  96. const gchar *name,
  97. GBusNameOwnerFlags flags,
  98. GClosure *name_acquired_closure,
  99. GClosure *name_lost_closure);
  100. GIO_AVAILABLE_IN_ALL
  101. void g_bus_unown_name (guint owner_id);
  102. G_END_DECLS
  103. #endif /* __G_DBUS_NAME_OWNING_H__ */