diff --git a/ChangeLog b/ChangeLog index 02d97f35a9..691d6984a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-11-02 Robert Love + + * gnome/applet/applet.c: add nmwa_enable_wireless_set_active(). + * gnome/applet/applet-dbus-devices.c: invoke the new function + nmwa_enable_wireless_set_active() to ensure that the state of the 'Enable Wireless' checkbox matches the daemon's state. This is a + concern because the daemon remembers the state. + 2005-11-02 Robert Love * gnome/applet/applet.c: Make menu item "Enable Wireless" not "Wireless diff --git a/gnome/applet/applet-dbus-devices.c b/gnome/applet/applet-dbus-devices.c index 6cd6fcf63d..889a85e3f7 100644 --- a/gnome/applet/applet-dbus-devices.c +++ b/gnome/applet/applet-dbus-devices.c @@ -118,7 +118,11 @@ static void nmwa_dbus_update_wireless_enabled_cb (DBusPendingCall *pcall, void * } if (dbus_message_get_args (reply, NULL, DBUS_TYPE_BOOLEAN, &wireless_enabled, DBUS_TYPE_INVALID)) + { applet->wireless_enabled = wireless_enabled; + nmwa_enable_wireless_set_active (applet); + } + dbus_message_unref (reply); out: diff --git a/gnome/applet/applet.c b/gnome/applet/applet.c index e81943643d..4a93439796 100644 --- a/gnome/applet/applet.c +++ b/gnome/applet/applet.c @@ -2050,6 +2050,17 @@ static void nmwa_context_menu_update (NMWirelessApplet *applet) gtk_widget_hide (applet->stop_wireless_item); } +/* + * nmwa_enable_wireless_set_active + * + * Set the 'Enable Wireless' menu item state to match the daemon's last DBUS + * message. We cannot just do this at menu creation time because the DBUS + * message might not have been sent yet. + */ +void nmwa_enable_wireless_set_active (NMWirelessApplet *applet) +{ + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (applet->stop_wireless_item), applet->wireless_enabled); +} /* * nmwa_context_menu_create @@ -2069,11 +2080,11 @@ static GtkWidget *nmwa_context_menu_create (NMWirelessApplet *applet) /* 'Enable Wireless' item */ applet->stop_wireless_item = gtk_check_menu_item_new_with_mnemonic (_("Enable _Wireless")); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (applet->stop_wireless_item), TRUE); + nmwa_enable_wireless_set_active (applet); g_signal_connect (G_OBJECT (applet->stop_wireless_item), "activate", G_CALLBACK (nmwa_set_wireless_enabled_cb), applet); gtk_menu_shell_append (GTK_MENU_SHELL (menu), applet->stop_wireless_item); - /* Connection Information item */ + /* 'Connection Information' item */ applet->info_menu_item = gtk_image_menu_item_new_with_mnemonic (_("Connection _Information")); g_signal_connect (G_OBJECT (applet->info_menu_item), "activate", G_CALLBACK (nmwa_show_info_cb), applet); image = gtk_image_new_from_stock (GTK_STOCK_INFO, GTK_ICON_SIZE_MENU); diff --git a/gnome/applet/applet.h b/gnome/applet/applet.h index c397de1fd1..e7c17150be 100644 --- a/gnome/applet/applet.h +++ b/gnome/applet/applet.h @@ -145,6 +145,8 @@ void nmwa_schedule_vpn_login_banner_dialog (NMWirelessApplet *applet, const c NetworkDevice * nmwa_get_first_active_device (GSList *dev_list); VPNConnection * nmwa_get_first_active_vpn_connection (NMWirelessApplet *applet); +void nmwa_enable_wireless_set_active (NMWirelessApplet *applet); + int nm_null_safe_strcmp (const char *s1, const char *s2); #endif