2005-01-21 Dan Williams <dcbw@redhat.com>

* panel-applet/NMWirelessApplet.[ch]
	  panel-applet/NMWirelessAppletDbus.c
	  panel-applet/menu-info.c
	  src/NetworkManagerDevice.c
		- Disable wired devices in the menu when they have no link.


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@389 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams
2005-01-21 19:54:18 +00:00
parent 9e154261fb
commit 594dbaecbf
6 changed files with 38 additions and 2 deletions

View File

@@ -1,3 +1,11 @@
2005-01-21 Dan Williams <dcbw@redhat.com>
* panel-applet/NMWirelessApplet.[ch]
panel-applet/NMWirelessAppletDbus.c
panel-applet/menu-info.c
src/NetworkManagerDevice.c
- Disable wired devices in the menu when they have no link.
2005-01-21 Dan Williams <dcbw@redhat.com> 2005-01-21 Dan Williams <dcbw@redhat.com>
* Cache last-known-good wireless authentication method in * Cache last-known-good wireless authentication method in

View File

@@ -650,8 +650,8 @@ static void nmwa_menu_add_device_item (GtkWidget *menu, NetworkDevice *device, g
{ {
menu_item = nm_menu_wired_new (); menu_item = nm_menu_wired_new ();
nm_menu_wired_update (NM_MENU_WIRED (menu_item), device, n_devices); nm_menu_wired_update (NM_MENU_WIRED (menu_item), device, n_devices);
if (applet->active_device == device) if (applet->active_device == device)
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), TRUE); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), TRUE);
} }
else else
{ {

View File

@@ -69,6 +69,7 @@ typedef struct
int refcount; int refcount;
char *nm_device; char *nm_device;
int type; int type;
gboolean link;
char *nm_name; char *nm_name;
char *hal_name; char *hal_name;
char *udi; char *udi;

View File

@@ -256,6 +256,30 @@ static int nmwa_dbus_get_device_type (NMWirelessApplet *applet, char *path, Appl
} }
/*
* nmwa_dbus_get_device_link_active
*
* Returns the device's link status
*
*/
static gboolean nmwa_dbus_get_device_link_active (NMWirelessApplet *applet, char *net_path)
{
gboolean link = FALSE;
switch (nmwa_dbus_call_nm_method (applet->connection, net_path, "getLinkActive", DBUS_TYPE_BOOLEAN, (void **)(&link), NULL))
{
case (RETURN_NO_NM):
applet->applet_state = APPLET_STATE_NO_NM;
break;
default:
break;
}
return (link);
}
/* /*
* nmwa_dbus_get_object_strength * nmwa_dbus_get_object_strength
* *
@@ -971,6 +995,7 @@ static void nmwa_dbus_update_devices (NMWirelessApplet *applet)
{ {
dev->nm_device = g_strdup (devices[i]); dev->nm_device = g_strdup (devices[i]);
dev->type = nmwa_dbus_get_device_type (applet, devices[i], APPLET_STATE_NO_CONNECTION); dev->type = nmwa_dbus_get_device_type (applet, devices[i], APPLET_STATE_NO_CONNECTION);
dev->link = nmwa_dbus_get_device_link_active (applet, devices[i]);
dev->nm_name = g_strdup (name); dev->nm_name = g_strdup (name);
dev->udi = nmwa_dbus_get_device_udi (applet, devices[i]); dev->udi = nmwa_dbus_get_device_udi (applet, devices[i]);
dev->hal_name = nmwa_dbus_get_hal_device_info (applet->connection, dev->udi); dev->hal_name = nmwa_dbus_get_hal_device_info (applet->connection, dev->udi);

View File

@@ -107,6 +107,7 @@ nm_menu_wired_update (NMMenuWired *menu_wired,
text = g_strdup (_("Wired Network")); text = g_strdup (_("Wired Network"));
gtk_label_set_text (GTK_LABEL (menu_wired->label), text); gtk_label_set_text (GTK_LABEL (menu_wired->label), text);
gtk_widget_set_sensitive (GTK_WIDGET (menu_wired), network->link);
} }

View File

@@ -797,6 +797,7 @@ void nm_device_update_link_active (NMDevice *dev, gboolean check_mii)
if (link != nm_device_get_link_active (dev)) if (link != nm_device_get_link_active (dev))
{ {
nm_device_set_link_active (dev, link); nm_device_set_link_active (dev, link);
nm_dbus_schedule_device_status_change (dev, DEVICE_STATUS_CHANGE);
nm_policy_schedule_state_update (dev->app_data); nm_policy_schedule_state_update (dev->app_data);
} }
} }