dbus: add nm_dbus_manager_get_dbus_connection() helper

The NMDBusManager owns a reference to the system bus. Expose it, so we
can use it. Note that g_bus_get() -- as alternative to get the systembus
singleton -- is asynchronous, and g_bus_get_sync() has an API that makes
one wonder what it does. Since we already have a reference to the connection
object we want to use, expose it.
This commit is contained in:
Thomas Haller 2018-12-01 14:32:16 +01:00
parent ade753d06f
commit 703178f5ca
2 changed files with 10 additions and 0 deletions

View file

@ -1470,6 +1470,14 @@ static const GDBusInterfaceInfo interface_info_objmgr = NM_DEFINE_GDBUS_INTERFAC
/*****************************************************************************/
GDBusConnection *
nm_dbus_manager_get_dbus_connection (NMDBusManager *self)
{
g_return_val_if_fail (NM_IS_DBUS_MANAGER (self), NULL);
return NM_DBUS_MANAGER_GET_PRIVATE (self)->connection;
}
void
nm_dbus_manager_start (NMDBusManager *self,
NMDBusManagerSetPropertyHandler set_property_handler,

View file

@ -51,6 +51,8 @@ typedef void (*NMDBusManagerSetPropertyHandler) (NMDBusObject *obj,
gboolean nm_dbus_manager_acquire_bus (NMDBusManager *self);
GDBusConnection *nm_dbus_manager_get_dbus_connection (NMDBusManager *self);
void nm_dbus_manager_start (NMDBusManager *self,
NMDBusManagerSetPropertyHandler set_property_handler,
gpointer set_property_handler_data);