gdbusnameowning.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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_NAME_OWNING_H__
  21. #define __G_DBUS_NAME_OWNING_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. * GBusAcquiredCallback:
  29. * @connection: The #GDBusConnection to a message bus.
  30. * @name: The name that is requested to be owned.
  31. * @user_data: User data passed to g_bus_own_name().
  32. *
  33. * Invoked when a connection to a message bus has been obtained.
  34. *
  35. * Since: 2.26
  36. */
  37. typedef void (*GBusAcquiredCallback) (GDBusConnection *connection,
  38. const gchar *name,
  39. gpointer user_data);
  40. /**
  41. * GBusNameAcquiredCallback:
  42. * @connection: The #GDBusConnection on which to acquired the name.
  43. * @name: The name being owned.
  44. * @user_data: User data passed to g_bus_own_name() or g_bus_own_name_on_connection().
  45. *
  46. * Invoked when the name is acquired.
  47. *
  48. * Since: 2.26
  49. */
  50. typedef void (*GBusNameAcquiredCallback) (GDBusConnection *connection,
  51. const gchar *name,
  52. gpointer user_data);
  53. /**
  54. * GBusNameLostCallback:
  55. * @connection: The #GDBusConnection on which to acquire the name or %NULL if
  56. * the connection was disconnected.
  57. * @name: The name being owned.
  58. * @user_data: User data passed to g_bus_own_name() or g_bus_own_name_on_connection().
  59. *
  60. * Invoked when the name is lost or @connection has been closed.
  61. *
  62. * Since: 2.26
  63. */
  64. typedef void (*GBusNameLostCallback) (GDBusConnection *connection,
  65. const gchar *name,
  66. gpointer user_data);
  67. GLIB_AVAILABLE_IN_ALL
  68. guint g_bus_own_name (GBusType bus_type,
  69. const gchar *name,
  70. GBusNameOwnerFlags flags,
  71. GBusAcquiredCallback bus_acquired_handler,
  72. GBusNameAcquiredCallback name_acquired_handler,
  73. GBusNameLostCallback name_lost_handler,
  74. gpointer user_data,
  75. GDestroyNotify user_data_free_func);
  76. GLIB_AVAILABLE_IN_ALL
  77. guint g_bus_own_name_on_connection (GDBusConnection *connection,
  78. const gchar *name,
  79. GBusNameOwnerFlags flags,
  80. GBusNameAcquiredCallback name_acquired_handler,
  81. GBusNameLostCallback name_lost_handler,
  82. gpointer user_data,
  83. GDestroyNotify user_data_free_func);
  84. GLIB_AVAILABLE_IN_ALL
  85. guint g_bus_own_name_with_closures (GBusType bus_type,
  86. const gchar *name,
  87. GBusNameOwnerFlags flags,
  88. GClosure *bus_acquired_closure,
  89. GClosure *name_acquired_closure,
  90. GClosure *name_lost_closure);
  91. GLIB_AVAILABLE_IN_ALL
  92. guint g_bus_own_name_on_connection_with_closures (
  93. GDBusConnection *connection,
  94. const gchar *name,
  95. GBusNameOwnerFlags flags,
  96. GClosure *name_acquired_closure,
  97. GClosure *name_lost_closure);
  98. GLIB_AVAILABLE_IN_ALL
  99. void g_bus_unown_name (guint owner_id);
  100. G_END_DECLS
  101. #endif /* __G_DBUS_NAME_OWNING_H__ */