2008-05-28 Dan Williams <dcbw@redhat.com>

* libnm-util/nm-setting-wireless.c
	  libnm-util/nm-setting-wireless.h
		- (set_property, get_property, nm_setting_wireless_class_init): add the
			'adhoc-create' property, which when TRUE indicates that NM should
			create this connection as an adhoc wifi network if it's not found
			as an adhoc network during scanning.  Can be used to auto-create
			adhoc networks when used in combination with autoconnect.



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3697 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams 2008-05-28 21:30:53 +00:00
parent 622a3e3880
commit 0b52ca0ba1
3 changed files with 43 additions and 11 deletions

View file

@ -1,3 +1,13 @@
2008-05-28 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-setting-wireless.c
libnm-util/nm-setting-wireless.h
- (set_property, get_property, nm_setting_wireless_class_init): add the
'adhoc-create' property, which when TRUE indicates that NM should
create this connection as an adhoc wifi network if it's not found
as an adhoc network during scanning. Can be used to auto-create
adhoc networks when used in combination with autoconnect.
2008-05-28 Tambet Ingo <tambet@gmail.com>
Patch from Dennis Noordsij <dennis.noordsij@helsinki.fi>.

View file

@ -18,6 +18,7 @@ enum {
PROP_0,
PROP_SSID,
PROP_MODE,
PROP_ADHOC_CREATE,
PROP_BAND,
PROP_CHANNEL,
PROP_BSSID,
@ -225,6 +226,11 @@ verify (NMSetting *setting, GSList *all_settings)
return FALSE;
}
if (self->mode && strcmp (self->mode, "adhoc") && self->adhoc_create) {
g_warning ("Key 'adhoc-create' only valid with Ad-Hoc mode.");
return FALSE;
}
if (self->band && !nm_utils_string_in_list (self->band, valid_bands)) {
g_warning ("Invalid band. Should be either 'a' or 'bg'");
return FALSE;
@ -330,6 +336,9 @@ set_property (GObject *object, guint prop_id,
g_free (setting->mode);
setting->mode = g_value_dup_string (value);
break;
case PROP_ADHOC_CREATE:
setting->adhoc_create = g_value_get_boolean (value);
break;
case PROP_BAND:
g_free (setting->band);
setting->band = g_value_dup_string (value);
@ -383,6 +392,9 @@ get_property (GObject *object, guint prop_id,
case PROP_MODE:
g_value_set_string (value, setting->mode);
break;
case PROP_ADHOC_CREATE:
g_value_set_boolean (value, setting->adhoc_create);
break;
case PROP_BAND:
g_value_set_string (value, setting->band);
break;
@ -445,6 +457,14 @@ nm_setting_wireless_class_init (NMSettingWirelessClass *setting_class)
NULL,
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
g_object_class_install_property
(object_class, PROP_ADHOC_CREATE,
g_param_spec_boolean (NM_SETTING_WIRELESS_ADHOC_CREATE,
"Ad-Hoc Create",
"Ad-Hoc Create",
FALSE,
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
g_object_class_install_property
(object_class, PROP_BAND,
g_param_spec_string (NM_SETTING_WIRELESS_BAND,

View file

@ -17,23 +17,25 @@ G_BEGIN_DECLS
#define NM_SETTING_WIRELESS_SETTING_NAME "802-11-wireless"
#define NM_SETTING_WIRELESS_SSID "ssid"
#define NM_SETTING_WIRELESS_MODE "mode"
#define NM_SETTING_WIRELESS_BAND "band"
#define NM_SETTING_WIRELESS_CHANNEL "channel"
#define NM_SETTING_WIRELESS_BSSID "bssid"
#define NM_SETTING_WIRELESS_RATE "rate"
#define NM_SETTING_WIRELESS_TX_POWER "tx-power"
#define NM_SETTING_WIRELESS_MAC_ADDRESS "mac-address"
#define NM_SETTING_WIRELESS_MTU "mtu"
#define NM_SETTING_WIRELESS_SEEN_BSSIDS "seen-bssids"
#define NM_SETTING_WIRELESS_SEC "security"
#define NM_SETTING_WIRELESS_SSID "ssid"
#define NM_SETTING_WIRELESS_MODE "mode"
#define NM_SETTING_WIRELESS_ADHOC_CREATE "adhoc-create"
#define NM_SETTING_WIRELESS_BAND "band"
#define NM_SETTING_WIRELESS_CHANNEL "channel"
#define NM_SETTING_WIRELESS_BSSID "bssid"
#define NM_SETTING_WIRELESS_RATE "rate"
#define NM_SETTING_WIRELESS_TX_POWER "tx-power"
#define NM_SETTING_WIRELESS_MAC_ADDRESS "mac-address"
#define NM_SETTING_WIRELESS_MTU "mtu"
#define NM_SETTING_WIRELESS_SEEN_BSSIDS "seen-bssids"
#define NM_SETTING_WIRELESS_SEC "security"
typedef struct {
NMSetting parent;
GByteArray *ssid;
char *mode;
gboolean adhoc_create;
char *band;
guint32 channel;
GByteArray *bssid;