mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-03-21 16:50:43 +01:00
libnm/tests: add nmtstc_nm_client_new()
This commit is contained in:
parent
bdfcf02da3
commit
56880fbe69
2 changed files with 43 additions and 0 deletions
|
|
@ -64,3 +64,11 @@ NMDevice * nmtstc_service_add_wired_device (NMTstcServiceInfo *sinfo,
|
|||
|
||||
#endif /* NM_NETWORKMANAGER_COMPILATION_LIB */
|
||||
|
||||
#if ((NETWORKMANAGER_COMPILATION) == NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY)
|
||||
|
||||
#include "nm-client.h"
|
||||
|
||||
NMClient *nmtstc_nm_client_new (void);
|
||||
|
||||
#endif /* NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY */
|
||||
|
||||
|
|
|
|||
|
|
@ -236,3 +236,38 @@ nmtstc_service_add_wired_device (NMTstcServiceInfo *sinfo, NMClient *client,
|
|||
}
|
||||
|
||||
#endif /* NM_NETWORKMANAGER_COMPILATION_LIB */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#if ((NETWORKMANAGER_COMPILATION) == NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY)
|
||||
|
||||
NMClient *
|
||||
nmtstc_nm_client_new (void)
|
||||
{
|
||||
NMClient *client;
|
||||
DBusGConnection *bus;
|
||||
GError *error = NULL;
|
||||
gboolean success;
|
||||
|
||||
bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (bus);
|
||||
|
||||
client = g_object_new (NM_TYPE_CLIENT,
|
||||
NM_OBJECT_DBUS_CONNECTION, bus,
|
||||
NM_OBJECT_DBUS_PATH, NM_DBUS_PATH,
|
||||
NULL);
|
||||
g_assert (client != NULL);
|
||||
|
||||
dbus_g_connection_unref (bus);
|
||||
|
||||
success = g_initable_init (G_INITABLE (client), NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (success == TRUE);
|
||||
|
||||
return client;
|
||||
}
|
||||
|
||||
#endif /* NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue