2006-01-27 Robert Love <rml@novell.com>

* gnome/applet/passphrase-dialog.c: If wsm_set_capabilities() returns
	  FALSE, we have no security options for this dialog, so we throw up
	  an error dialog instead of a broken passphrase dialog.  Fixes
	  Novell #138404.
	* gnome/applet/wireless-security-manager.c,
	  gnome/applet/wireless-security-manager.h: If wsm_set_capabilities()
	  does not add any security options, not even none, print a warning
	  and return FALSE.  This let's functions constructed a dialog bail
	  out if the device's capabilities and the network's requirements have
	  zero overlap.


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1404 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Robert Love 2006-01-30 17:28:22 +00:00 committed by Robert Love
parent 95baaac2f7
commit 1ca336c741
4 changed files with 49 additions and 10 deletions

View file

@ -1,3 +1,16 @@
2006-01-27 Robert Love <rml@novell.com>
* gnome/applet/passphrase-dialog.c: If wsm_set_capabilities() returns
FALSE, we have no security options for this dialog, so we throw up
an error dialog instead of a broken passphrase dialog. Fixes
Novell #138404.
* gnome/applet/wireless-security-manager.c,
gnome/applet/wireless-security-manager.h: If wsm_set_capabilities()
does not add any security options, not even none, print a warning
and return FALSE. This let's functions constructed a dialog bail
out if the device's capabilities and the network's requirements have
zero overlap.
2006-01-27 Robert Love <rml@novell.com>
* configure.in: Require wpa_supplicant. Detect location of binary and

View file

@ -201,15 +201,38 @@ nmi_passphrase_dialog_new (NMWirelessApplet *applet,
g_return_val_if_fail (net != NULL, NULL);
g_return_val_if_fail (message != NULL, NULL);
wsm = wsm_new (applet->glade_file);
caps = network_device_get_type_capabilities (dev);
caps &= wireless_network_get_capabilities (net);
if (!wsm_set_capabilities (wsm, caps))
{
GtkWidget *error_dialog;
error_dialog = gtk_message_dialog_new_with_markup (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
"<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s",
_("Error connecting to wireless network"),
_("The requested wireless network requires security capabilities unsupported by your hardware."));
gtk_window_present (GTK_WINDOW (error_dialog));
g_signal_connect_swapped (error_dialog, "response", G_CALLBACK (gtk_widget_destroy), error_dialog);
wsm_free (wsm);
return NULL;
}
if (!(xml = glade_xml_new (applet->glade_file, "passphrase_dialog", NULL)))
{
nmwa_schedule_warning_dialog (applet, _("The NetworkManager Applet could not find some required resources (the glade file was not found)."));
wsm_free (wsm);
return NULL;
}
dialog = glade_xml_get_widget (xml, "passphrase_dialog");
gtk_widget_hide (dialog);
g_object_set_data (G_OBJECT (dialog), "wireless-security-manager", (gpointer) wsm);
g_object_set_data (G_OBJECT (dialog), "glade-xml", xml);
g_object_set_data (G_OBJECT (dialog), "applet", applet);
g_object_set_data (G_OBJECT (dialog), "uid", GINT_TO_POINTER (uid));
@ -233,13 +256,6 @@ nmi_passphrase_dialog_new (NMWirelessApplet *applet,
gtk_widget_set_sensitive (GTK_WIDGET (ok_button), FALSE);
wsm = wsm_new (applet->glade_file);
g_object_set_data (G_OBJECT (dialog), "wireless-security-manager", (gpointer) wsm);
caps = network_device_get_type_capabilities (dev);
caps &= wireless_network_get_capabilities (net);
wsm_set_capabilities (wsm, caps);
security_combo = GTK_COMBO_BOX (glade_xml_get_widget (xml, "security_combo"));
wsm_update_combo (wsm, security_combo);

View file

@ -27,6 +27,7 @@
#include "NetworkManager.h"
#include "wireless-security-manager.h"
#include "wireless-security-option.h"
#include "nm-utils.h"
#include "wso-none.h"
#include "wso-private.h"
@ -55,11 +56,12 @@ WirelessSecurityManager * wsm_new (const char * glade_file)
}
void wsm_set_capabilities (WirelessSecurityManager *wsm, guint32 capabilities)
gboolean wsm_set_capabilities (WirelessSecurityManager *wsm, guint32 capabilities)
{
WirelessSecurityOption * opt;
gboolean ret = TRUE;
g_return_if_fail (wsm != NULL);
g_return_val_if_fail (wsm != NULL, FALSE);
/* Free previous options */
g_slist_foreach (wsm->options, (GFunc) wso_free, NULL);
@ -96,6 +98,14 @@ void wsm_set_capabilities (WirelessSecurityManager *wsm, guint32 capabilities)
if ((opt = wso_wpa_psk_new (wsm->glade_file, capabilities, TRUE)))
wsm->options = g_slist_append (wsm->options, opt);
}
if (!wsm->options)
{
nm_warning ("capabilities='%x' and did not match any protocals, not even none!", capabilities);
ret = FALSE;
}
return ret;
}
#define NAME_COLUMN 0

View file

@ -33,7 +33,7 @@ WirelessSecurityManager * wsm_new (const char * glade_file);
void wsm_free (WirelessSecurityManager *wsm);
void wsm_set_capabilities (WirelessSecurityManager *wsm, guint32 capabilities);
gboolean wsm_set_capabilities (WirelessSecurityManager *wsm, guint32 capabilities);
void wsm_update_combo (WirelessSecurityManager *wsm, GtkComboBox *combo);