mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-06 05:00:15 +01:00
core: add nm_dbus_g_method_invocation_get_g_connection()
This method exists in dbus-glib >= 101, but if it doesn't, emulate it. See https://bugs.freedesktop.org/show_bug.cgi?id=55729
This commit is contained in:
parent
3c7f267fb9
commit
496534b9f4
3 changed files with 23 additions and 0 deletions
|
|
@ -212,6 +212,9 @@ PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.1 dbus-glib-1 >= 0.94)
|
|||
AC_SUBST(DBUS_CFLAGS)
|
||||
AC_SUBST(DBUS_LIBS)
|
||||
|
||||
AC_CHECK_LIB([dbus-glib-1], [dbus_g_method_invocation_get_g_connection], ac_have_gmi_get_con="1", ac_have_gmi_get_con="0")
|
||||
AC_DEFINE_UNQUOTED(HAVE_DBUS_GLIB_GMI_GET_CONNECTION, $ac_have_gmi_get_con, [Define if you have a dbus-glib with dbus_g_method_invocation_get_g_connection()])
|
||||
|
||||
PKG_CHECK_MODULES(GLIB, gio-unix-2.0 >= 2.32 gmodule-2.0)
|
||||
|
||||
dnl GLIB_VERSION_MIN_REQUIRED should match the version above.
|
||||
|
|
|
|||
|
|
@ -410,3 +410,18 @@ nm_dbus_manager_unregister_object (NMDBusManager *self, gpointer object)
|
|||
dbus_g_connection_unregister_g_object (priv->g_connection, G_OBJECT (object));
|
||||
}
|
||||
|
||||
#if !HAVE_DBUS_GLIB_GMI_GET_CONNECTION
|
||||
struct _HACKDBusGMethodInvocation {
|
||||
DBusGConnection *connection;
|
||||
/* ... */
|
||||
};
|
||||
|
||||
DBusGConnection *
|
||||
dbus_g_method_invocation_get_g_connection (DBusGMethodInvocation *context)
|
||||
{
|
||||
/* Evil hack; this method exists in dbus-glib >= 101, but if we don't
|
||||
* have that, emulate it.
|
||||
*/
|
||||
return ((struct _HACKDBusGMethodInvocation *) context)->connection;
|
||||
}
|
||||
#endif /* HAVE_DBUS_GLIB_GMI_GET_CONNECTION */
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#ifndef __NM_DBUS_MANAGER_H__
|
||||
#define __NM_DBUS_MANAGER_H__
|
||||
|
||||
#include <config.h>
|
||||
#include <glib-object.h>
|
||||
#include <dbus/dbus.h>
|
||||
#include <dbus/dbus-glib.h>
|
||||
|
|
@ -81,6 +82,10 @@ void nm_dbus_manager_register_object (NMDBusManager *self,
|
|||
|
||||
void nm_dbus_manager_unregister_object (NMDBusManager *self, gpointer object);
|
||||
|
||||
#if !HAVE_DBUS_GLIB_GMI_GET_CONNECTION
|
||||
DBusGConnection *dbus_g_method_invocation_get_g_connection (DBusGMethodInvocation *context);
|
||||
#endif
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __NM_DBUS_MANAGER_H__ */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue