diff --git a/ChangeLog b/ChangeLog index 65660dbc57..c80bdded79 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-03-28 Tambet Ingo + + * 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 * libnm-glib/Makefile.am: Fix the build issue. diff --git a/src/NetworkManagerAP.c b/src/NetworkManagerAP.c index 1e563f516d..ab0ffe8343 100644 --- a/src/NetworkManagerAP.c +++ b/src/NetworkManagerAP.c @@ -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); } } diff --git a/src/supplicant-manager/nm-supplicant-config.c b/src/supplicant-manager/nm-supplicant-config.c index 09b0e015fc..b1086815cb 100644 --- a/src/supplicant-manager/nm-supplicant-config.c +++ b/src/supplicant-manager/nm-supplicant-config.c @@ -20,7 +20,9 @@ */ #include +#include #include +#include #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 *