Commit 6e376fa3 authored by Dan Williams's avatar Dan Williams

2004-10-14 Dan Williams <dcbw@redhat.com>

	* panel-applet/NMWirelessAppletDbus.[ch]
		- Expose network_device_[un]ref()
		- Expose wireless_network_[un]ref()
		- (wireless_network_new_with_essid): new function, create and return
			a wireless network with a particular essid

	* panel-applet/NMWirelessApplet.c
		- Hook up the "other network" dialog to do something


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@227 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
parent 4db14d05
2004-10-14 Dan Williams <dcbw@redhat.com>
* panel-applet/NMWirelessAppletDbus.[ch]
- Expose network_device_[un]ref()
- Expose wireless_network_[un]ref()
- (wireless_network_new_with_essid): new function, create and return
a wireless network with a particular essid
* panel-applet/NMWirelessApplet.c
- Hook up the "other network" dialog to do something
Wed Oct 13 19:31:53 2004 Jonathan Blandford <jrb@redhat.com>
* panel-applet/NMWirelessApplet.c: Add an essid dialog. It
......
......@@ -483,7 +483,6 @@ static void nmwa_toplevel_menu_activate (GtkWidget *menu, NMWirelessApplet *appl
static void nmwa_menu_add_separator_item (GtkWidget *menu)
{
GtkWidget *menu_item;
menu_item = gtk_separator_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
gtk_widget_show (menu_item);
......@@ -594,10 +593,10 @@ custom_essid_item_selected (GtkWidget *menu_item, NMWirelessApplet *applet)
GtkWidget *entry;
GtkWidget *button;
GladeXML *xml;
char *essid;
gint response;
gint n_wireless_interfaces = 0;
GSList *element;
NetworkDevice *default_dev = NULL;
glade_file = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_DATADIR,
"NetworkManagerNotification/essid.glade",
......@@ -638,7 +637,14 @@ custom_essid_item_selected (GtkWidget *menu_item, NMWirelessApplet *applet)
g_assert (dev);
if (dev->type == DEVICE_TYPE_WIRELESS_ETHERNET)
n_wireless_interfaces++;
{
if (!default_dev)
{
default_dev = dev;
network_device_ref (default_dev);
}
n_wireless_interfaces++;
}
}
if (n_wireless_interfaces < 1)
{
......@@ -670,8 +676,24 @@ custom_essid_item_selected (GtkWidget *menu_item, NMWirelessApplet *applet)
if (response == GTK_RESPONSE_OK)
{
essid = gtk_entry_get_text (GTK_ENTRY (entry));
/* FIXME: actually set the essid... */
char *essid;
if ((essid = gtk_entry_get_text (GTK_ENTRY (entry))))
{
WirelessNetwork *net = wireless_network_new_with_essid (essid);
/* FIXME: allow picking of the wireless device, we currently just
* use the first one found in our device list.
*
* FIXME: default_dev might have gone away by the time the dialog
* gets dismissed and we get here...
*/
if (net)
{
nmwa_dbus_set_device (applet->connection, default_dev, net);
network_device_unref (default_dev);
wireless_network_unref (net);
}
}
}
gtk_widget_destroy (dialog);
......
......@@ -715,7 +715,7 @@ fprintf( stderr, "Forcing device '%s'\n", dev->nm_device);
* Increment the reference count of the wireless network
*
*/
static void wireless_network_ref (WirelessNetwork *net)
void wireless_network_ref (WirelessNetwork *net)
{
g_return_if_fail (net != NULL);
......@@ -729,7 +729,7 @@ static void wireless_network_ref (WirelessNetwork *net)
* Unrefs (and possibly frees) the representation of a wireless network
*
*/
static void wireless_network_unref (WirelessNetwork *net)
void wireless_network_unref (WirelessNetwork *net)
{
g_return_if_fail (net != NULL);
......@@ -760,6 +760,25 @@ WirelessNetwork *wireless_network_new (void)
}
/*
* wireless_network_new_with_essid
*
* Create a new wireless network structure
*
*/
WirelessNetwork *wireless_network_new_with_essid (const char *essid)
{
WirelessNetwork *net = NULL;
g_return_val_if_fail (essid != NULL, NULL);
if ((net = wireless_network_new()))
net->essid = g_strdup (essid);
return (net);
}
/*
* wireless_network_copy
*
......@@ -806,7 +825,7 @@ static void network_device_free_wireless_network_list (NetworkDevice *dev)
* Increment the reference count of the network device
*
*/
static void network_device_ref (NetworkDevice *dev)
void network_device_ref (NetworkDevice *dev)
{
g_return_if_fail (dev != NULL);
......@@ -820,7 +839,7 @@ static void network_device_ref (NetworkDevice *dev)
* Unrefs (and possibly frees) the representation of a network device
*
*/
static void network_device_unref (NetworkDevice *dev)
void network_device_unref (NetworkDevice *dev)
{
g_return_if_fail (dev != NULL);
......
......@@ -42,9 +42,15 @@ enum
DEVICE_TYPE_WIRELESS_ETHERNET
};
gpointer nmwa_dbus_worker (gpointer user_data);
gpointer nmwa_dbus_worker (gpointer user_data);
void nmwa_dbus_set_device (DBusConnection *connection, const NetworkDevice *dev,
const WirelessNetwork *network);
void nmwa_dbus_set_device (DBusConnection *connection, const NetworkDevice *dev,
const WirelessNetwork *network);
WirelessNetwork * wireless_network_new_with_essid (const char *essid);
void wireless_network_unref (WirelessNetwork *net);
void network_device_ref (NetworkDevice *dev);
void network_device_unref (NetworkDevice *dev);
#endif
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