2007-08-28 Dan Williams <dcbw@redhat.com>

* src/nm-device.c
	  src/named-manager/nm-named-manager.c
	  src/named-manager/nm-named-manager.h
	  src/NetworkManager.c
	  src/vpn-manager/nm-vpn-manager.c
	  src/NetworkManagerMain.h
	  src/NetworkManagerSystem.c
		- Remove the named-manager object from NMData structure in preparation
		for NMData's timely death.  Make the NMNamedManager the singleton that
		it really is



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2739 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams
2007-08-28 15:00:00 +00:00
parent 7a8f33aa3d
commit 9194b61b8f
8 changed files with 48 additions and 16 deletions

View File

@@ -1,3 +1,16 @@
2007-08-28 Dan Williams <dcbw@redhat.com>
* src/nm-device.c
src/named-manager/nm-named-manager.c
src/named-manager/nm-named-manager.h
src/NetworkManager.c
src/vpn-manager/nm-vpn-manager.c
src/NetworkManagerMain.h
src/NetworkManagerSystem.c
- Remove the named-manager object from NMData structure in preparation
for NMData's timely death. Make the NMNamedManager the singleton that
it really is
2007-08-28 Dan Williams <dcbw@redhat.com>
Remove NMAPSecurity objects, they are replaced with flags on the APs for

View File

@@ -147,8 +147,6 @@ static void nm_data_free (NMData *data)
nm_ap_list_unref (data->allowed_ap_list);
nm_ap_list_unref (data->invalid_ap_list);
g_object_unref (data->named_manager);
g_slice_free (NMData, data);
}
@@ -303,6 +301,7 @@ main (int argc, char *argv[])
NMPolicy *policy;
NMHalManager *hal_manager = NULL;
NMVPNManager *vpn_manager = NULL;
NMNamedManager *named_mgr = NULL;
NMDBusManager * dbus_mgr;
DBusConnection *dbus_connection;
NMSupplicantManager * sup_mgr = NULL;
@@ -425,8 +424,8 @@ main (int argc, char *argv[])
goto done;
}
nm_data->named_manager = nm_named_manager_new ();
if (!nm_data->named_manager) {
named_mgr = nm_named_manager_get ();
if (!named_mgr) {
nm_warning ("Failed to start the named manager.");
goto done;
}

View File

@@ -34,8 +34,6 @@ typedef struct NMVPNManager NMVPNManager;
typedef struct NMData
{
NMNamedManager * named_manager;
struct NMAccessPointList *allowed_ap_list;
struct NMAccessPointList *invalid_ap_list;
} NMData;

View File

@@ -188,7 +188,7 @@ out:
*/
gboolean nm_system_device_set_from_ip4_config (NMDevice *dev)
{
NMData * app_data;
NMNamedManager * named_mgr;
NMIP4Config * config;
struct nl_handle * nlh = NULL;
struct rtnl_addr * addr = NULL;
@@ -196,9 +196,6 @@ gboolean nm_system_device_set_from_ip4_config (NMDevice *dev)
g_return_val_if_fail (dev != NULL, FALSE);
app_data = nm_device_get_app_data (dev);
g_return_val_if_fail (app_data != NULL, FALSE);
config = nm_device_get_ip4_config (dev);
g_return_val_if_fail (config != NULL, FALSE);
@@ -222,7 +219,9 @@ gboolean nm_system_device_set_from_ip4_config (NMDevice *dev)
sleep (1);
nm_system_device_set_ip4_route (dev, nm_ip4_config_get_gateway (config), 0, 0, nm_ip4_config_get_mss (config));
nm_named_manager_add_ip4_config (app_data->named_manager, config);
named_mgr = nm_named_manager_get ();
nm_named_manager_add_ip4_config (named_mgr, config);
g_object_unref (named_mgr);
return TRUE;
}

View File

@@ -79,6 +79,22 @@ struct NMNamedManagerPrivate {
};
NMNamedManager *
nm_named_manager_get (void)
{
static NMNamedManager * singleton = NULL;
if (!singleton) {
singleton = NM_NAMED_MANAGER (g_object_new (NM_TYPE_NAMED_MANAGER, NULL));
} else {
g_object_ref (singleton);
}
g_assert (singleton);
return singleton;
}
GQuark
nm_named_manager_error_quark (void)
{

View File

@@ -62,7 +62,7 @@ typedef struct {
GType nm_named_manager_get_type (void);
NMNamedManager * nm_named_manager_new (void);
NMNamedManager * nm_named_manager_get (void);
gboolean nm_named_manager_add_ip4_config (NMNamedManager *mgr, NMIP4Config *config);

View File

@@ -34,6 +34,7 @@
#include "NetworkManagerSystem.h"
#include "nm-dhcp-manager.h"
#include "nm-dbus-manager.h"
#include "nm-named-manager.h"
#include "nm-utils.h"
#include "autoip.h"
#include "nm-netlink.h"
@@ -1030,6 +1031,7 @@ nm_device_deactivate (NMDeviceInterface *device)
{
NMDevice *self = NM_DEVICE (device);
NMIP4Config * config;
NMNamedManager * named_mgr;
g_return_if_fail (self != NULL);
@@ -1038,10 +1040,11 @@ nm_device_deactivate (NMDeviceInterface *device)
nm_device_deactivate_quickly (self);
/* Remove any device nameservers and domains */
if ((config = nm_device_get_ip4_config (self)))
{
nm_named_manager_remove_ip4_config (self->priv->app_data->named_manager, config);
if ((config = nm_device_get_ip4_config (self))) {
named_mgr = nm_named_manager_get ();
nm_named_manager_remove_ip4_config (named_mgr, config);
nm_device_set_ip4_config (self, NULL);
g_object_unref (named_mgr);
}
/* Take out any entries in the routing table and any IP address the device had. */

View File

@@ -23,6 +23,7 @@
#include <string.h>
#include <dbus/dbus.h>
#include "nm-vpn-manager.h"
#include "nm-named-manager.h"
#include "NetworkManager.h"
#include "NetworkManagerMain.h"
#include "NetworkManagerDbus.h"
@@ -248,6 +249,7 @@ nm_vpn_manager_add_connection (NMVPNManager *manager,
NMVPNService * service;
DBusConnection * dbus_connection;
NMDBusManager * dbus_mgr = NULL;
NMNamedManager * named_mgr = NULL;
GSList * elt;
g_return_val_if_fail (manager != NULL, NULL);
@@ -266,10 +268,12 @@ nm_vpn_manager_add_connection (NMVPNManager *manager,
goto out;
}
named_mgr = nm_named_manager_get ();
connection = nm_vpn_connection_new (name,
user_name,
service_name,
manager->app_data->named_manager);
named_mgr);
g_object_unref (named_mgr);
if (!connection) {
nm_warning ("couldn't create VPN connecton for '%s (%s).",
name,