mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-03-06 09:20:46 +01:00
dbus-manager: add nm_dbus_manager_setup() function for testing
This commit is contained in:
parent
99465a34ca
commit
9b16e85ece
2 changed files with 17 additions and 8 deletions
|
|
@ -85,20 +85,28 @@ NMDBusManager *
|
|||
nm_dbus_manager_get (void)
|
||||
{
|
||||
if (G_UNLIKELY (!singleton_instance)) {
|
||||
static char already_created = FALSE;
|
||||
|
||||
g_assert (!already_created);
|
||||
already_created = TRUE;
|
||||
singleton_instance = g_object_new (NM_TYPE_DBUS_MANAGER, NULL);
|
||||
g_assert (singleton_instance);
|
||||
nm_singleton_instance_weak_ref_register ();
|
||||
nm_log_dbg (LOGD_CORE, "create %s singleton (%p)", "NMDBusManager", singleton_instance);
|
||||
nm_dbus_manager_setup (g_object_new (NM_TYPE_DBUS_MANAGER, NULL));
|
||||
if (!nm_dbus_manager_init_bus (singleton_instance))
|
||||
start_reconnection_timeout (singleton_instance);
|
||||
}
|
||||
return singleton_instance;
|
||||
}
|
||||
|
||||
void
|
||||
nm_dbus_manager_setup (NMDBusManager *instance)
|
||||
{
|
||||
static char already_setup = FALSE;
|
||||
|
||||
g_assert (NM_IS_DBUS_MANAGER (instance));
|
||||
g_assert (!already_setup);
|
||||
g_assert (!singleton_instance);
|
||||
|
||||
already_setup = TRUE;
|
||||
singleton_instance = instance;
|
||||
nm_singleton_instance_weak_ref_register ();
|
||||
nm_log_dbg (LOGD_CORE, "create %s singleton (%p)", "NMDBusManager", singleton_instance);
|
||||
}
|
||||
|
||||
/**************************************************************/
|
||||
|
||||
struct _PrivateServer {
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ typedef struct {
|
|||
GType nm_dbus_manager_get_type (void);
|
||||
|
||||
NMDBusManager * nm_dbus_manager_get (void);
|
||||
void nm_dbus_manager_setup (NMDBusManager *instance);
|
||||
|
||||
char * nm_dbus_manager_get_name_owner (NMDBusManager *self,
|
||||
const char *name,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue