Minimizing redrawing the disconnected popup
- From: Drew Moseley <dmoseley mvista com>
- To: networkmanager-list gnome org
- Subject: Minimizing redrawing the disconnected popup
- Date: Fri, 06 Mar 2009 15:15:46 -0700
Our system seems to get a lot of disconnected state changes due to the way the hardware is powered down. This resulted in the "Network Disconnected" popup being flashed on and off quite a bit. I have the following patch in nm-applet to ensure that it only gets popped up one time.
Comments?
Drew
diff --git a/src/applet.c b/src/applet.c
index 5801606..56ce49d 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -1669,15 +1669,21 @@ static void
foo_client_state_changed_cb (NMClient *client, GParamSpec *pspec, gpointer user_data)
{
NMApplet *applet = NM_APPLET (user_data);
+ static gboolean previously_connected = FALSE;
switch (nm_client_get_state (client)) {
+ case NM_STATE_CONNECTED:
+ previously_connected = TRUE;
+ break;
case NM_STATE_DISCONNECTED:
- applet_do_notify_with_pref (applet, _("Disconnected"),
- _("The network connection has been disconnected."),
- "nm-no-connection",
- PREF_DISABLE_DISCONNECTED_NOTIFICATIONS);
/* Fall through */
default:
+ if (previously_connected == TRUE)
+ applet_do_notify_with_pref (applet, _("Disconnected"),
+ _("The network connection has been disconnected."),
+ "nm-no-connection",
+ PREF_DISABLE_DISCONNECTED_NOTIFICATIONS);
+ previously_connected = FALSE;
break;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]