2007-03-28 Tambet Ingo <tambet@ximian.com>

* src/supplicant-manager/nm-supplicant-config.c (get_hash_cb): Marshal the
	data to correct types instead of always using string.

	* src/NetworkManagerAP.c (get_property): AP is encrypted if capabilities does
	_not_ have NM_802_11_CAP_PROTO_NONE.
	(foreach_property_cb): Set AP capabilities if it's not set or if the protocol
	is not set.



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2507 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Tambet Ingo 2007-03-28 13:39:09 +00:00 committed by Tambet Ingo
parent d79895713d
commit 59d7210d4b
3 changed files with 42 additions and 5 deletions

View file

@ -1,3 +1,13 @@
2007-03-28 Tambet Ingo <tambet@ximian.com>
* src/supplicant-manager/nm-supplicant-config.c (get_hash_cb): Marshal the
data to correct types instead of always using string.
* src/NetworkManagerAP.c (get_property): AP is encrypted if capabilities does
_not_ have NM_802_11_CAP_PROTO_NONE.
(foreach_property_cb): Set AP capabilities if it's not set or if the protocol
is not set.
2007-03-27 Tambet Ingo <tambet@ximian.com>
* libnm-glib/Makefile.am: Fix the build issue.

View file

@ -192,7 +192,7 @@ get_property (GObject *object, guint prop_id,
g_value_set_uint (value, priv->capabilities);
break;
case PROP_ENCRYPTED:
g_value_set_boolean (value, priv->capabilities & NM_802_11_CAP_PROTO_NONE);
g_value_set_boolean (value, !(priv->capabilities & NM_802_11_CAP_PROTO_NONE));
break;
case PROP_ESSID:
g_value_set_string (value, priv->essid);
@ -467,7 +467,10 @@ foreach_property_cb (gpointer key, gpointer value, gpointer user_data)
}
if (val & IEEE80211_CAP_PRIVACY) {
if (nm_ap_get_capabilities (ap) & NM_802_11_CAP_PROTO_NONE)
guint cur_caps;
cur_caps = nm_ap_get_capabilities (ap);
if (cur_caps & NM_802_11_CAP_NONE || cur_caps & NM_802_11_CAP_PROTO_NONE)
nm_ap_add_capabilities_for_wep (ap);
}
}

View file

@ -20,7 +20,9 @@
*/
#include <string.h>
#include <stdlib.h>
#include <glib.h>
#include <dbus/dbus-glib.h>
#include "nm-supplicant-config.h"
#include "nm-supplicant-settings-verify.h"
@ -192,10 +194,29 @@ get_hash_cb (gpointer key, gpointer value, gpointer user_data)
{
ConfigOption *opt = (ConfigOption *) value;
GValue *variant;
GArray *array;
variant = g_slice_new0 (GValue);
g_value_init (variant, G_TYPE_STRING);
g_value_set_string (variant, opt->value);
switch (opt->type) {
case TYPE_INT:
g_value_init (variant, G_TYPE_INT);
g_value_set_int (variant, atoi (opt->value));
break;
case TYPE_BYTES:
array = g_array_new (TRUE, TRUE, sizeof (char));
g_array_append_vals (array, opt->value, opt->len);
g_value_init (variant, dbus_g_type_get_collection ("GArray", G_TYPE_CHAR));
g_value_set_boxed (variant, array);
break;
case TYPE_KEYWORD:
g_value_init (variant, G_TYPE_STRING);
g_value_set_string (variant, opt->value);
break;
default:
g_slice_free (GValue, variant);
return;
}
g_hash_table_insert ((GHashTable *) user_data, g_strdup (key), variant);
}
@ -203,7 +224,10 @@ get_hash_cb (gpointer key, gpointer value, gpointer user_data)
static void
destroy_hash_value (gpointer data)
{
g_slice_free (GValue, data);
GValue *value = (GValue *) data;
g_value_unset (value);
g_slice_free (GValue, value);
}
GHashTable *