Commit 76ef803c authored by Dan Williams's avatar Dan Williams
Browse files

2005-07-27 Dan Williams <dcbw@redhat.com>

	* src/nm-dbus-nm.c
	  src/nm-dbus-net.c
		- Random cleanups of spacing

	* gnome/applet/applet.h
	  gnome/applet/other-network-dialog.c
	  gnome/applet/passphrase-dialog.c
		- Conslidate usage of NMWAEncryptionKeyTypes enum

	Patch from Bill Moss:
		- Make Other Wireless Networks work again with encryption keys


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@814 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
parent d66b15bc
2005-07-27 Dan Williams <dcbw@redhat.com>
* src/nm-dbus-nm.c
src/nm-dbus-net.c
- Random cleanups of spacing
* gnome/applet/applet.h
gnome/applet/other-network-dialog.c
gnome/applet/passphrase-dialog.c
- Conslidate usage of NMWAEncryptionKeyTypes enum
Patch from Bill Moss:
- Make Other Wireless Networks work again with encryption keys
2005-07-26 Dan Williams <dcbw@redhat.com>
Patch from Steev <steev@steev.net>:
......
......@@ -988,7 +988,7 @@ void nmwa_dbus_device_remove_one_device (NMWirelessApplet *applet, const char *d
*
*/
void nmwa_dbus_set_device (DBusConnection *connection, NetworkDevice *dev, const char *essid,
NMEncKeyType key_type, const char *passphrase)
const NMEncKeyType key_type, const char *passphrase)
{
DBusMessage *message;
......@@ -1001,7 +1001,7 @@ void nmwa_dbus_set_device (DBusConnection *connection, NetworkDevice *dev, const
if (network_device_is_wireless (dev) && essid)
{
nm_info ("Forcing device '%s' and network '%s' %s passphrase\n", dev_path, essid, passphrase ? "with" : "without");
int tmp_key_type = (int)key_type;
if (passphrase == NULL)
passphrase = "";
......@@ -1009,7 +1009,7 @@ void nmwa_dbus_set_device (DBusConnection *connection, NetworkDevice *dev, const
dbus_message_append_args (message, DBUS_TYPE_OBJECT_PATH, &dev_path,
DBUS_TYPE_STRING, &essid,
DBUS_TYPE_STRING, &passphrase,
DBUS_TYPE_INT32, &key_type,
DBUS_TYPE_INT32, &tmp_key_type,
DBUS_TYPE_INVALID);
}
else
......
......@@ -95,11 +95,12 @@ static DBusMessage * nmi_dbus_get_key_for_network (NMWirelessApplet *applet, DBu
* Alert NetworkManager of the new user key
*
*/
void nmi_dbus_return_user_key (DBusConnection *connection, DBusMessage *message, const char *passphrase, const int key_type)
void nmi_dbus_return_user_key (DBusConnection *connection, DBusMessage *message, const char *passphrase, const NMEncKeyType key_type)
{
DBusMessage * reply;
const char * dev_path;
const char * net_path;
const int tmp_key_type = (int)key_type;
g_return_if_fail (connection != NULL);
g_return_if_fail (passphrase != NULL);
......@@ -110,7 +111,7 @@ void nmi_dbus_return_user_key (DBusConnection *connection, DBusMessage *message,
return;
}
dbus_message_append_args (reply, DBUS_TYPE_STRING, &passphrase, DBUS_TYPE_INT32, &key_type, DBUS_TYPE_INVALID);
dbus_message_append_args (reply, DBUS_TYPE_STRING, &passphrase, DBUS_TYPE_INT32, &tmp_key_type, DBUS_TYPE_INVALID);
dbus_connection_send (connection, reply, NULL);
dbus_message_unref (reply);
}
......
......@@ -26,10 +26,11 @@
#include <dbus/dbus.h>
#include "nm-device.h"
#include "wireless-network.h"
#include "NetworkManager.h"
DBusHandlerResult nmi_dbus_info_message_handler (DBusConnection *connection, DBusMessage *message, void *user_data);
void nmi_dbus_return_user_key (DBusConnection *connection, DBusMessage *message, const char *passphrase, const int key_type);
void nmi_dbus_return_user_key (DBusConnection *connection, DBusMessage *message, const char *passphrase, const NMEncKeyType key_type);
void nmi_dbus_signal_update_scan_method (DBusConnection *connection);
......
......@@ -45,6 +45,14 @@
typedef struct VPNConnection VPNConnection;
enum NMWAEncryptionKeyTypes
{
KEY_TYPE_128_BIT_PASSPHRASE = 0,
KEY_TYPE_ASCII_KEY = 1,
KEY_TYPE_HEX_KEY = 2
};
#define NM_TYPE_WIRELESS_APPLET (nmwa_get_type())
#define NM_WIRELESS_APPLET(object) (G_TYPE_CHECK_INSTANCE_CAST((object), NM_TYPE_WIRELESS_APPLET, NMWirelessApplet))
#define NM_WIRELESS_APPLET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), NM_TYPE_WIRELESS_APPLET, NMWirelessAppletClass))
......
......@@ -43,12 +43,6 @@
#include "applet-dbus-devices.h"
#include "other-network-dialog.h"
enum NMWAEncryptionKeyTypes
{
KEY_TYPE_128_BIT_PASSPHRASE = 0,
KEY_TYPE_ASCII_KEY = 1,
KEY_TYPE_HEX_KEY = 2
};
static void update_button_cb (GtkWidget *widget, GladeXML *xml)
{
......@@ -217,6 +211,7 @@ static GtkDialog *nmwa_other_network_dialog_init (GladeXML *xml, NMWirelessApple
essid_entry = glade_xml_get_widget (xml, "essid_entry");
button = glade_xml_get_widget (xml, "ok_button");
gtk_widget_grab_default (GTK_WIDGET (button));
gtk_widget_grab_focus (essid_entry);
gtk_entry_set_text (GTK_ENTRY (essid_entry), "");
......
......@@ -36,14 +36,7 @@
#include "applet-dbus-info.h"
#include "passphrase-dialog.h"
#include "nm-utils.h"
enum NMIPassphraseDialogKeyTypes
{
KEY_TYPE_128_BIT_PASSPHRASE = 0,
KEY_TYPE_ASCII_KEY = 1,
KEY_TYPE_HEX_KEY = 2
};
#include "NetworkManager.h"
static GladeXML *get_dialog_xml (GtkWidget *dialog)
{
......@@ -194,13 +187,12 @@ static void nmi_passphrase_dialog_ok_clicked (GtkWidget *ok_button, gpointer use
GladeXML * dialog_xml;
GtkEntry * entry;
GtkComboBox * key_type_combo;
int key_type;
const char * passphrase;
NetworkDevice * dev = g_object_get_data (G_OBJECT (dialog), "device");
WirelessNetwork * net = g_object_get_data (G_OBJECT (dialog), "network");
DBusMessage * message = g_object_get_data (G_OBJECT (dialog), "dbus-message");
char * key = NULL;
int key_type_return = NM_ENC_TYPE_UNKNOWN;
NMEncKeyType key_type_return = NM_ENC_TYPE_UNKNOWN;
GConfEntry * gconf_entry;
char * escaped_network;
......@@ -208,10 +200,9 @@ static void nmi_passphrase_dialog_ok_clicked (GtkWidget *ok_button, gpointer use
entry = GTK_ENTRY (glade_xml_get_widget (dialog_xml, "passphrase_entry"));
key_type_combo = GTK_COMBO_BOX (glade_xml_get_widget (dialog_xml, "key_type_combo"));
key_type = gtk_combo_box_get_active (key_type_combo);
passphrase = gtk_entry_get_text (entry);
switch (key_type)
switch (gtk_combo_box_get_active (key_type_combo))
{
case KEY_TYPE_128_BIT_PASSPHRASE:
key_type_return = NM_ENC_TYPE_128_BIT_PASSPHRASE;
......
......@@ -102,11 +102,11 @@ static DBusMessage *nm_dbus_net_get_name (DBusConnection *connection, DBusMessag
g_return_val_if_fail (data && data->data && data->dev && data->ap && connection && message, NULL);
if ((reply = dbus_message_new_method_return (message))) {
const char *essid;
essid = nm_ap_get_essid (data->ap);
if ((reply = dbus_message_new_method_return (message)))
{
const char *essid = nm_ap_get_essid (data->ap);
dbus_message_append_args (reply, DBUS_TYPE_STRING, &essid, DBUS_TYPE_INVALID);
}
}
return reply;
}
......
......@@ -31,6 +31,7 @@
#include "NetworkManagerDbusUtils.h"
#include "NetworkManagerUtils.h"
#include "NetworkManagerPolicy.h"
#include "NetworkManager.h"
/*
......@@ -117,9 +118,9 @@ static DBusMessage *nm_dbus_nm_set_active_device (DBusConnection *connection, DB
NMDevice * dev = NULL;
DBusMessage * reply = NULL;
char * dev_path = NULL;
const char * essid = NULL;
const char * key = NULL;
const int key_type = -1;
char * essid = NULL;
char * key = NULL;
int key_type = -1;
NMActRequest * req = NULL;
NMAccessPoint * ap = NULL;
......@@ -167,7 +168,7 @@ static DBusMessage *nm_dbus_nm_set_active_device (DBusConnection *connection, DB
nm_schedule_state_change_signal_broadcast (data->data);
if (nm_device_is_wireless (dev))
ap = nm_device_wireless_get_activation_ap (dev, essid, key, key_type);
ap = nm_device_wireless_get_activation_ap (dev, essid, key, (NMEncKeyType)key_type);
nm_policy_schedule_device_activation (nm_act_request_new (data->data, dev, ap, TRUE));
out:
......@@ -182,14 +183,14 @@ out:
*/
static DBusMessage *nm_dbus_nm_create_wireless_network (DBusConnection *connection, DBusMessage *message, NMDbusCBData *data)
{
NMDevice *dev = NULL;
DBusMessage *reply = NULL;
char *dev_path = NULL;
NMAccessPoint *new_ap = NULL;
char *network = NULL;
char *key = NULL;
int key_type = -1;
DBusError error;
NMDevice * dev = NULL;
DBusMessage * reply = NULL;
char * dev_path = NULL;
NMAccessPoint * new_ap = NULL;
char * network = NULL;
char * key = NULL;
int key_type = -1;
DBusError error;
g_return_val_if_fail (connection != NULL, NULL);
g_return_val_if_fail (message != NULL, NULL);
......@@ -205,7 +206,7 @@ static DBusMessage *nm_dbus_nm_create_wireless_network (DBusConnection *connecti
{
reply = nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "InvalidArguments",
"NetworkManager::createWirelessNetwork called with invalid arguments.");
return (reply);
return reply;
} else nm_info ("Creating network '%s' on device '%s'.", network, dev_path);
dev_path = nm_dbus_unescape_object_path (dev_path);
......@@ -215,7 +216,7 @@ static DBusMessage *nm_dbus_nm_create_wireless_network (DBusConnection *connecti
{
reply = nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "DeviceNotFound",
"The requested network device does not exist.");
return (reply);
return reply;
}
nm_device_ref (dev);
......@@ -231,10 +232,10 @@ static DBusMessage *nm_dbus_nm_create_wireless_network (DBusConnection *connecti
/* Fill in the description of the network to create */
nm_ap_set_essid (new_ap, network);
if (nm_is_enc_key_valid (key, key_type))
if (nm_is_enc_key_valid (key, (NMEncKeyType)key_type))
{
nm_ap_set_encrypted (new_ap, TRUE);
nm_ap_set_enc_key_source (new_ap, key, key_type);
nm_ap_set_enc_key_source (new_ap, key, (NMEncKeyType)key_type);
nm_ap_set_auth_method (new_ap, NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM);
}
nm_ap_set_mode (new_ap, NETWORK_MODE_ADHOC);
......@@ -244,7 +245,7 @@ static DBusMessage *nm_dbus_nm_create_wireless_network (DBusConnection *connecti
out:
nm_device_unref (dev);
return (reply);
return reply;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment