--- NetworkManager-0.6.4/gnome/applet/applet.c.applet-redraw 2006-07-09 19:38:54.000000000 -0400 +++ NetworkManager-0.6.4/gnome/applet/applet.c 2006-09-04 22:53:54.000000000 -0400 @@ -2132,6 +2132,29 @@ /* + * nma_set_running + * + * Set whether NM is running to TRUE or FALSE. + * + */ +void nma_set_running (NMApplet *applet, gboolean running) +{ + if (running == applet->nm_running) + return; + + applet->nm_running = running; + + /* if NM became active, start drawing our icon, else stop drawing it */ + if (applet->nm_running && !applet->redraw_timeout_id) + applet->redraw_timeout_id = g_timeout_add (1000, (GSourceFunc) nma_redraw_timeout, applet); + else if (!applet->nm_running && applet->redraw_timeout_id) + { + g_source_remove (applet->redraw_timeout_id); + applet->redraw_timeout_id = 0; + } +} + +/* * nma_set_state * * Set the applet's state to one of the NMState enumerations. --- NetworkManager-0.6.4/gnome/applet/applet.h.applet-redraw 2006-05-11 17:30:34.000000000 -0400 +++ NetworkManager-0.6.4/gnome/applet/applet.h 2006-09-04 22:36:57.000000000 -0400 @@ -152,6 +152,7 @@ void nma_enable_wireless_set_active (NMApplet *applet); void nma_set_state (NMApplet *applet, NMState state); +void nma_set_running (NMApplet *applet, gboolean running); int nm_null_safe_strcmp (const char *s1, const char *s2); --- NetworkManager-0.6.4/gnome/applet/applet-dbus.c.applet-redraw 2006-03-22 16:17:07.000000000 -0500 +++ NetworkManager-0.6.4/gnome/applet/applet-dbus.c 2006-09-04 22:48:43.000000000 -0400 @@ -72,7 +72,7 @@ { dbus_connection_unref (applet->connection); applet->connection = NULL; - applet->nm_running = FALSE; + nma_set_running (applet, FALSE); } else if (dbus_message_is_signal (message, DBUS_INTERFACE_DBUS, "NameOwnerChanged")) { @@ -94,7 +94,7 @@ if (!old_owner_good && new_owner_good && !applet->nm_running) { /* NetworkManager started up */ - applet->nm_running = TRUE; + nma_set_running (applet, TRUE); nma_set_state (applet, NM_STATE_DISCONNECTED); nma_dbus_update_nm_state (applet); nma_dbus_update_devices (applet); @@ -103,7 +103,7 @@ } else if (old_owner_good && !new_owner_good) { - applet->nm_running = FALSE; + nma_set_running (applet, FALSE); nma_set_state (applet, NM_STATE_DISCONNECTED); nmi_passphrase_dialog_destroy (applet); } @@ -403,7 +403,7 @@ { if ((applet->connection = nma_dbus_init (applet))) { - applet->nm_running = nma_dbus_nm_is_running (applet->connection); + nma_set_running (applet, nma_dbus_nm_is_running (applet->connection)); if (applet->nm_running) { nma_set_state (applet, NM_STATE_DISCONNECTED); @@ -437,13 +437,13 @@ applet->connection = nma_dbus_init (applet); applet->nmi_methods = nmi_dbus_nmi_methods_setup (); - timeout_source = g_timeout_source_new (2000); + timeout_source = g_timeout_source_new (10000); g_source_set_callback (timeout_source, nma_dbus_connection_watcher, applet, NULL); g_source_attach (timeout_source, NULL); if (applet->connection && nma_dbus_nm_is_running (applet->connection)) { - applet->nm_running = TRUE; + nma_set_running (applet, TRUE); nma_dbus_update_nm_state (applet); nma_dbus_update_devices (applet); nma_dbus_update_dialup (applet);