Commit d45c1b84 authored by Thomas Haller's avatar Thomas Haller

core: declare nm_supplicant_manager_get() using NM_DEFINE_SINGLETON_GETTER()

parent d8887019
......@@ -946,7 +946,7 @@ nm_8021x_stage2_config (NMDeviceEthernet *self, NMDeviceStateReason *reason)
}
if (!priv->supplicant.mgr)
priv->supplicant.mgr = nm_supplicant_manager_get ();
priv->supplicant.mgr = g_object_ref (nm_supplicant_manager_get ());
/* If we need secrets, get them */
setting_name = nm_connection_need_secrets (connection, NULL);
......
......@@ -224,8 +224,7 @@ constructor (GType type,
_LOGI (LOGD_HW | LOGD_WIFI, "driver supports Access Point (AP) mode");
/* Connect to the supplicant manager */
priv->sup_mgr = nm_supplicant_manager_get ();
g_assert (priv->sup_mgr);
priv->sup_mgr = g_object_ref (nm_supplicant_manager_get ());
return object;
}
......
......@@ -47,7 +47,7 @@
#include "nm-manager.h"
#include "nm-linux-platform.h"
#include "nm-dbus-manager.h"
#include "nm-supplicant-manager.h"
#include "nm-device.h"
#include "nm-dhcp-manager.h"
#include "nm-logging.h"
#include "nm-config.h"
......@@ -201,7 +201,6 @@ main (int argc, char *argv[])
gboolean success, show_version = FALSE;
NMManager *manager = NULL;
gs_unref_object NMDBusManager *dbus_mgr = NULL;
gs_unref_object NMSupplicantManager *sup_mgr = NULL;
gs_unref_object NMSettings *settings = NULL;
gs_unref_object NMConfig *config = NULL;
GError *error = NULL;
......@@ -414,10 +413,6 @@ main (int argc, char *argv[])
goto done;
}
/* Initialize the supplicant manager */
sup_mgr = nm_supplicant_manager_get ();
g_assert (sup_mgr != NULL);
if (!nm_dbus_manager_get_connection (dbus_mgr)) {
#if HAVE_DBUS_GLIB_100
nm_log_warn (LOGD_CORE, "Failed to connect to D-Bus; only private bus is available");
......
......@@ -301,19 +301,7 @@ name_owner_changed (NMDBusManager *dbus_mgr,
/*******************************************************************/
NMSupplicantManager *
nm_supplicant_manager_get (void)
{
static NMSupplicantManager *singleton = NULL;
if (!singleton)
singleton = NM_SUPPLICANT_MANAGER (g_object_new (NM_TYPE_SUPPLICANT_MANAGER, NULL));
else
g_object_ref (singleton);
g_assert (singleton);
return singleton;
}
NM_DEFINE_SINGLETON_GETTER (NMSupplicantManager, nm_supplicant_manager_get, NM_TYPE_SUPPLICANT_MANAGER);
static void
nm_supplicant_manager_init (NMSupplicantManager *self)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment