mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-03 21:50:27 +01:00
2007-11-15 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-setting-connection.h libnm-util/nm-setting-connection.c - Rename the 'name' property to 'id', because it conflicted with the NMSetting superclass' 'name' property. * libnm-util/nm-setting.c - (nm_setting_to_hash): serialize the 'name' property - (one_property_cb): ignore 'name' on deserialization of a connection * src/nm-device-802-11-wireless.c src/vpn-manager/nm-vpn-connection.c src/NetworkManagerPolicy.c - Fix up for NMSettingConnection 'name'->'id' changes git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3084 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
29c735dca4
commit
dcc6b2a9c0
7 changed files with 52 additions and 29 deletions
16
ChangeLog
16
ChangeLog
|
|
@ -1,3 +1,19 @@
|
|||
2007-11-15 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* libnm-util/nm-setting-connection.h
|
||||
libnm-util/nm-setting-connection.c
|
||||
- Rename the 'name' property to 'id', because it conflicted with the
|
||||
NMSetting superclass' 'name' property.
|
||||
|
||||
* libnm-util/nm-setting.c
|
||||
- (nm_setting_to_hash): serialize the 'name' property
|
||||
- (one_property_cb): ignore 'name' on deserialization of a connection
|
||||
|
||||
* src/nm-device-802-11-wireless.c
|
||||
src/vpn-manager/nm-vpn-connection.c
|
||||
src/NetworkManagerPolicy.c
|
||||
- Fix up for NMSettingConnection 'name'->'id' changes
|
||||
|
||||
2007-11-13 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* libnm-glib/nm-device-802-11-wireless.h
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ G_DEFINE_TYPE (NMSettingConnection, nm_setting_connection, NM_TYPE_SETTING)
|
|||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_NAME,
|
||||
PROP_ID,
|
||||
PROP_TYPE,
|
||||
PROP_AUTOCONNECT,
|
||||
PROP_TIMESTAMP,
|
||||
|
|
@ -34,7 +34,7 @@ verify (NMSetting *setting, GSList *all_settings)
|
|||
{
|
||||
NMSettingConnection *self = NM_SETTING_CONNECTION (setting);
|
||||
|
||||
if (!self->name || !strlen (self->name))
|
||||
if (!self->id || !strlen (self->id))
|
||||
return FALSE;
|
||||
|
||||
if (!self->type || !strlen (self->type))
|
||||
|
|
@ -60,7 +60,7 @@ finalize (GObject *object)
|
|||
{
|
||||
NMSettingConnection *self = NM_SETTING_CONNECTION (object);
|
||||
|
||||
g_free (self->name);
|
||||
g_free (self->id);
|
||||
g_free (self->type);
|
||||
|
||||
G_OBJECT_CLASS (nm_setting_connection_parent_class)->finalize (object);
|
||||
|
|
@ -73,9 +73,9 @@ set_property (GObject *object, guint prop_id,
|
|||
NMSettingConnection *setting = NM_SETTING_CONNECTION (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_NAME:
|
||||
g_free (setting->name);
|
||||
setting->name = g_value_dup_string (value);
|
||||
case PROP_ID:
|
||||
g_free (setting->id);
|
||||
setting->id = g_value_dup_string (value);
|
||||
break;
|
||||
case PROP_TYPE:
|
||||
g_free (setting->type);
|
||||
|
|
@ -100,8 +100,8 @@ get_property (GObject *object, guint prop_id,
|
|||
NMSettingConnection *setting = NM_SETTING_CONNECTION (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_NAME:
|
||||
g_value_set_string (value, setting->name);
|
||||
case PROP_ID:
|
||||
g_value_set_string (value, setting->id);
|
||||
break;
|
||||
case PROP_TYPE:
|
||||
g_value_set_string (value, setting->type);
|
||||
|
|
@ -132,10 +132,10 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class)
|
|||
|
||||
/* Properties */
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_NAME,
|
||||
g_param_spec_string (NM_SETTING_CONNECTION_NAME,
|
||||
"Name",
|
||||
"Connection name",
|
||||
(object_class, PROP_ID,
|
||||
g_param_spec_string (NM_SETTING_CONNECTION_ID,
|
||||
"ID",
|
||||
"User-readable connection identifier/name",
|
||||
NULL,
|
||||
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ G_BEGIN_DECLS
|
|||
|
||||
#define NM_SETTING_CONNECTION_SETTING_NAME "connection"
|
||||
|
||||
#define NM_SETTING_CONNECTION_NAME "name"
|
||||
#define NM_SETTING_CONNECTION_ID "id"
|
||||
#define NM_SETTING_CONNECTION_TYPE "type"
|
||||
#define NM_SETTING_CONNECTION_AUTOCONNECT "autoconnect"
|
||||
#define NM_SETTING_CONNECTION_TIMESTAMP "timestamp"
|
||||
|
|
@ -24,7 +24,7 @@ G_BEGIN_DECLS
|
|||
typedef struct {
|
||||
NMSetting parent;
|
||||
|
||||
char *name;
|
||||
char *id;
|
||||
char *type;
|
||||
gboolean autoconnect;
|
||||
guint64 timestamp;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,8 @@ nm_setting_to_hash (NMSetting *setting)
|
|||
for (i = 0; i < n_property_specs; i++) {
|
||||
GParamSpec *prop_spec = property_specs[i];
|
||||
|
||||
if (prop_spec->flags & NM_SETTING_PARAM_SERIALIZE) {
|
||||
if ( (prop_spec->flags & NM_SETTING_PARAM_SERIALIZE)
|
||||
|| !strcmp (prop_spec->name, NM_SETTING_NAME)) {
|
||||
GValue *value;
|
||||
|
||||
value = g_slice_new0 (GValue);
|
||||
|
|
@ -77,6 +78,12 @@ one_property_cb (gpointer key, gpointer val, gpointer user_data)
|
|||
GValue *dst_value = &info->params[info->n_params].value;
|
||||
GParamSpec *param_spec;
|
||||
|
||||
/* 'name' is special; since the caller already has to know the type of
|
||||
* the setting, 'name' gets ignored here.
|
||||
*/
|
||||
if (!strcmp (prop_name, NM_SETTING_NAME))
|
||||
return;
|
||||
|
||||
param_spec = g_object_class_find_property (info->class, prop_name);
|
||||
if (!param_spec || !(param_spec->flags & NM_SETTING_PARAM_SERIALIZE)) {
|
||||
/* Oh, we're so nice and only warn, maybe it should be a fatal error? */
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ static NMPolicy *global_policy;
|
|||
|
||||
|
||||
static const char *
|
||||
get_connection_name (NMConnection *connection)
|
||||
get_connection_id (NMConnection *connection)
|
||||
{
|
||||
NMSettingConnection *s_con;
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ get_connection_name (NMConnection *connection)
|
|||
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
|
||||
g_return_val_if_fail (s_con != NULL, NULL);
|
||||
|
||||
return s_con->name;
|
||||
return s_con->id;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -202,7 +202,7 @@ nm_policy_auto_get_best_device (NMPolicy *policy,
|
|||
nm_info ("AUTO: Best wired device = %s, best wireless device = %s, best connection name = '%s'",
|
||||
best_wired_dev ? nm_device_get_iface (NM_DEVICE (best_wired_dev)) : "(null)",
|
||||
best_wireless_dev ? nm_device_get_iface (NM_DEVICE (best_wireless_dev)) : "(null)",
|
||||
*connection ? get_connection_name (*connection) : "(none)");
|
||||
*connection ? get_connection_id (*connection) : "(none)");
|
||||
}
|
||||
|
||||
return *connection ? highest_priority_dev : NULL;
|
||||
|
|
@ -303,14 +303,14 @@ nm_policy_device_change_check (gpointer user_data)
|
|||
} else if (!old_dev && new_dev) {
|
||||
/* Activate new device */
|
||||
nm_info ("SWITCH: no current connection, found better connection '%s (%s)'.",
|
||||
connection ? get_connection_name (connection) : "(none)",
|
||||
connection ? get_connection_id (connection) : "(none)",
|
||||
nm_device_get_iface (new_dev));
|
||||
do_switch = TRUE;
|
||||
} else if (old_dev && !new_dev) {
|
||||
/* Terminate current connection */
|
||||
nm_info ("SWITCH: terminating current connection '%s (%s)' because it's"
|
||||
" no longer valid.",
|
||||
old_connection ? get_connection_name (old_connection) : "(none)",
|
||||
old_connection ? get_connection_id (old_connection) : "(none)",
|
||||
nm_device_get_iface (old_dev));
|
||||
do_switch = TRUE;
|
||||
} else if (old_dev && new_dev) {
|
||||
|
|
@ -325,9 +325,9 @@ nm_policy_device_change_check (gpointer user_data)
|
|||
if ((!old_user_requested || !old_has_link) && (new_dev != old_dev)) {
|
||||
nm_info ("SWITCH: found better connection '%s (%s)' than "
|
||||
" current connection '%s (%s)'.",
|
||||
connection ? get_connection_name (connection) : "(none)",
|
||||
connection ? get_connection_id (connection) : "(none)",
|
||||
nm_device_get_iface (new_dev),
|
||||
old_connection ? get_connection_name (old_connection) : "(none)",
|
||||
old_connection ? get_connection_id (old_connection) : "(none)",
|
||||
nm_device_get_iface (old_dev));
|
||||
do_switch = TRUE;
|
||||
}
|
||||
|
|
@ -352,9 +352,9 @@ nm_policy_device_change_check (gpointer user_data)
|
|||
" than current connection '%s/%s'. "
|
||||
"have_link=%d",
|
||||
nm_device_get_iface (new_dev),
|
||||
new_sc->name,
|
||||
new_sc->id,
|
||||
nm_device_get_iface (old_dev),
|
||||
old_sc->name,
|
||||
old_sc->id,
|
||||
old_has_link);
|
||||
do_switch = TRUE;
|
||||
}
|
||||
|
|
@ -427,7 +427,7 @@ device_state_changed (NMDevice *device, NMDeviceState state, gpointer user_data)
|
|||
/* Mark the connection invalid so it doesn't get automatically chosen */
|
||||
if (connection) {
|
||||
g_object_set_data (G_OBJECT (connection), INVALID_TAG, GUINT_TO_POINTER (TRUE));
|
||||
nm_info ("Marking connection '%s' invalid.", get_connection_name (connection));
|
||||
nm_info ("Marking connection '%s' invalid.", get_connection_id (connection));
|
||||
}
|
||||
} else if (state == NM_DEVICE_STATE_ACTIVATED) {
|
||||
/* Clear the invalid tag on the connection */
|
||||
|
|
|
|||
|
|
@ -2515,7 +2515,7 @@ real_act_stage2_config (NMDevice *dev)
|
|||
|
||||
nm_info ("Activation (%s/wireless): access point '%s' has security,"
|
||||
" but secrets are required.",
|
||||
iface, s_connection->name);
|
||||
iface, s_connection->id);
|
||||
|
||||
nm_device_state_changed (dev, NM_DEVICE_STATE_NEED_AUTH);
|
||||
|
||||
|
|
@ -2537,11 +2537,11 @@ real_act_stage2_config (NMDevice *dev)
|
|||
if (s_wireless->security) {
|
||||
nm_info ("Activation (%s/wireless): connection '%s' has security"
|
||||
", and secrets exist. No new secrets needed.",
|
||||
iface, s_connection->name);
|
||||
iface, s_connection->id);
|
||||
} else {
|
||||
nm_info ("Activation (%s/wireless): connection '%s' requires no "
|
||||
"security. No secrets needed.",
|
||||
iface, s_connection->name);
|
||||
iface, s_connection->id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -449,7 +449,7 @@ nm_vpn_connection_get_name (NMVPNConnection *connection)
|
|||
priv = NM_VPN_CONNECTION_GET_PRIVATE (connection);
|
||||
setting = (NMSettingConnection *) nm_connection_get_setting (priv->connection, NM_TYPE_SETTING_CONNECTION);
|
||||
|
||||
return setting->name;
|
||||
return setting->id;
|
||||
}
|
||||
|
||||
NMVPNConnectionState
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue