diff --git a/ChangeLog b/ChangeLog index 3235c43de..804679cc2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-01-21 Dan Williams + + * 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 * Cache last-known-good wireless authentication method in diff --git a/panel-applet/NMWirelessApplet.c b/panel-applet/NMWirelessApplet.c index bcbaf0691..6e6957e13 100644 --- a/panel-applet/NMWirelessApplet.c +++ b/panel-applet/NMWirelessApplet.c @@ -650,8 +650,8 @@ static void nmwa_menu_add_device_item (GtkWidget *menu, NetworkDevice *device, g { menu_item = nm_menu_wired_new (); nm_menu_wired_update (NM_MENU_WIRED (menu_item), device, n_devices); - if (applet->active_device == device) - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), TRUE); + if (applet->active_device == device) + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), TRUE); } else { diff --git a/panel-applet/NMWirelessApplet.h b/panel-applet/NMWirelessApplet.h index e49fa6b08..81263b13f 100644 --- a/panel-applet/NMWirelessApplet.h +++ b/panel-applet/NMWirelessApplet.h @@ -69,6 +69,7 @@ typedef struct int refcount; char *nm_device; int type; + gboolean link; char *nm_name; char *hal_name; char *udi; diff --git a/panel-applet/NMWirelessAppletDbus.c b/panel-applet/NMWirelessAppletDbus.c index 5fb0d8fc0..311f937fd 100644 --- a/panel-applet/NMWirelessAppletDbus.c +++ b/panel-applet/NMWirelessAppletDbus.c @@ -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 * @@ -971,6 +995,7 @@ static void nmwa_dbus_update_devices (NMWirelessApplet *applet) { dev->nm_device = g_strdup (devices[i]); 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->udi = nmwa_dbus_get_device_udi (applet, devices[i]); dev->hal_name = nmwa_dbus_get_hal_device_info (applet->connection, dev->udi); diff --git a/panel-applet/menu-info.c b/panel-applet/menu-info.c index c7c333bc1..c0dfa0d73 100644 --- a/panel-applet/menu-info.c +++ b/panel-applet/menu-info.c @@ -107,6 +107,7 @@ nm_menu_wired_update (NMMenuWired *menu_wired, text = g_strdup (_("Wired Network")); gtk_label_set_text (GTK_LABEL (menu_wired->label), text); + gtk_widget_set_sensitive (GTK_WIDGET (menu_wired), network->link); } diff --git a/src/NetworkManagerDevice.c b/src/NetworkManagerDevice.c index 01cbba83c..a26f9b88e 100644 --- a/src/NetworkManagerDevice.c +++ b/src/NetworkManagerDevice.c @@ -797,6 +797,7 @@ void nm_device_update_link_active (NMDevice *dev, gboolean check_mii) if (link != nm_device_get_link_active (dev)) { 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); } }