Commit aea83cfb authored by John Palmieri's avatar John Palmieri

Wed Oct 13 John (J5) Palmieri <johnp@redhat.com>

        * info-daemon/NetworkManagerInfo.c (nmi_spawn_notification_icon): Stop respawning
        if the notification icon crashes 5 times within 5 seconds of each respawn


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@221 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
parent dea7d568
Wed Oct 13 John (J5) Palmieri <johnp@redhat.com>
* info-daemon/NetworkManagerInfo.c (nmi_spawn_notification_icon): Stop respawning
if the notification icon crashes 5 times within 5 seconds of each respawn
Tue Oct 12 22:53:04 2004 Jonathan Blandford <jrb@redhat.com>
* panel-applet/NMWirelessApplet.c (nmwa_update_state): remove
......
......@@ -109,19 +109,45 @@ nmi_spawn_notification_icon (NMIAppInfo *info)
if (info->notification_icon_watch != NULL)
g_source_remove (info->notification_icon_watch);
/*spawn the panel notification icon*/
if (!g_spawn_async (NULL,
notification_icon_cmd,
NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL,
&(info->notification_icon_pid),
&error))
if (info->notification_icon_respawn_timer == NULL)
info->notification_icon_respawn_timer = g_timer_new();
else
{
g_warning ("Could not spawn NetworkManager's notification icon (%s)", error->message);
g_error_free (error);
gdouble elapsed_time;
gulong dummy;
elapsed_time = g_timer_elapsed (info->notification_icon_respawn_timer, &dummy);
/*5 seconds between respawns*/
if (elapsed_time > 5)
info->notification_icon_respawn_counter = 0;
else
info->notification_icon_respawn_counter++;
}
else
info->notification_icon_watch = g_child_watch_add (info->notification_icon_pid, on_icon_exit_callback, info);
g_timer_start (info->notification_icon_respawn_timer);
/*spawn the panel notification icon unless it has crashed numerous times within a time frame*/
if (info->notification_icon_respawn_counter < 5)
{
if (!g_spawn_async (NULL,
notification_icon_cmd,
NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL,
&(info->notification_icon_pid),
&error))
{
g_warning ("Could not spawn NetworkManager's notification icon (%s)", error->message);
g_error_free (error);
}
else
{
info->notification_icon_watch = g_child_watch_add (info->notification_icon_pid, on_icon_exit_callback, info);
}
} else {
g_timer_destroy (info->notification_icon_respawn_timer);
info->notification_icon_respawn_timer = NULL;
}
}
#endif
......
......@@ -49,6 +49,8 @@ struct NMIAppInfo
*/
GPid notification_icon_pid;
guint notification_icon_watch;
guint notification_icon_respawn_counter;
GTimer *notification_icon_respawn_timer;
GSource *shutdown_timeout;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment