summaryrefslogtreecommitdiff
path: root/src/settings
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2013-05-23 14:11:25 -0300
committerDan Winship <danw@gnome.org>2013-08-05 09:53:55 -0400
commitceda4d828445e80e74912a3cc052b457d5bbb8ca (patch)
treee8d71e2893174f8ba66fd0f179f529a91d04826e /src/settings
parent99ea3783bd276813a86c8f28a5a3d42e3662f1b2 (diff)
downloadNetworkManager-danw/devicemanager.tar.gz
core: add NMDeviceManagerdanw/devicemanager
Add an NMDeviceManager interface, implemented by NMManager, and exposing its device-keeping-track-of functionality for use by other parts of the code. Make NMSettings use this rather than having special methods that NMManager calls when devices change, and make NMDeviceOlpcMesh use this rather than calling methods on the NMManager directly. Also, remove the unused nm_manager_get_device_by_master().
Diffstat (limited to 'src/settings')
-rw-r--r--src/settings/nm-settings.c20
-rw-r--r--src/settings/nm-settings.h4
2 files changed, 15 insertions, 9 deletions
diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c
index 9ea9f644fc..48d12427df 100644
--- a/src/settings/nm-settings.c
+++ b/src/settings/nm-settings.c
@@ -68,6 +68,7 @@
#include "nm-settings-utils.h"
#include "nm-connection-provider.h"
#include "nm-config.h"
+#include "nm-device-manager.h"
/* LINKER CRACKROCK */
#define EXPORT(sym) void * __export_##sym = &sym;
@@ -123,7 +124,6 @@ G_DEFINE_TYPE_EXTENDED (NMSettings, nm_settings, G_TYPE_OBJECT, 0,
typedef struct {
NMDBusManager *dbus_mgr;
-
NMAgentManager *agent_mgr;
NMConfig *config;
@@ -1481,8 +1481,8 @@ default_wired_try_update (NMDefaultWiredConnection *wired,
g_object_unref (wired);
}
-void
-nm_settings_device_added (NMSettings *self, NMDevice *device)
+static void
+device_added (NMDeviceManager *device_mgr, NMDevice *device, NMSettings *self)
{
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
NMDefaultWiredConnection *wired;
@@ -1525,8 +1525,8 @@ nm_settings_device_added (NMSettings *self, NMDevice *device)
g_object_set_data (G_OBJECT (device), DEFAULT_WIRED_TAG, wired);
}
-void
-nm_settings_device_removed (NMSettings *self, NMDevice *device)
+static void
+device_removed (NMDeviceManager *device_mgr, NMDevice *device, NMSettings *self)
{
NMDefaultWiredConnection *connection;
@@ -1650,6 +1650,11 @@ nm_settings_new (GError **error)
priv->config = nm_config_get ();
priv->dbus_mgr = nm_dbus_manager_get ();
+ g_signal_connect (nm_device_manager_get (), NM_DM_SIGNAL_DEVICE_ADDED,
+ G_CALLBACK (device_added), self);
+ g_signal_connect (nm_device_manager_get (), NM_DM_SIGNAL_DEVICE_REMOVED,
+ G_CALLBACK (device_removed), self);
+
/* Load the plugins; fail if a plugin is not found. */
if (!load_plugins (self, nm_config_get_plugins (priv->config), error)) {
g_object_unref (self);
@@ -1701,6 +1706,11 @@ dispose (GObject *object)
priv->dbus_mgr = NULL;
+ g_signal_handlers_disconnect_by_func (nm_device_manager_get (),
+ G_CALLBACK (device_added), self);
+ g_signal_handlers_disconnect_by_func (nm_device_manager_get (),
+ G_CALLBACK (device_removed), self);
+
g_object_unref (priv->session_monitor);
g_object_unref (priv->agent_mgr);
diff --git a/src/settings/nm-settings.h b/src/settings/nm-settings.h
index ba8153ec8a..a7f6dbe582 100644
--- a/src/settings/nm-settings.h
+++ b/src/settings/nm-settings.h
@@ -118,8 +118,4 @@ const GSList *nm_settings_get_unmanaged_specs (NMSettings *self);
char *nm_settings_get_hostname (NMSettings *self);
-void nm_settings_device_added (NMSettings *self, NMDevice *device);
-
-void nm_settings_device_removed (NMSettings *self, NMDevice *device);
-
#endif /* __NM_SETTINGS_H__ */