2005-10-12 Christopher Aillon <caillon@redhat.com>

* gnome/applet/applet.c:
	Fix icon animation smoothness issues.  nmwa_redraw_timeout gets called
	every 1000ms.  It will unconditionally call nmwa_update_state which
	kills the existing animation timeout and registers a new one with a
	callback to draw a new frame every 100ms.  There are 11 connecting
	icon frames, so the last 2 frames kept getting dropped.  Only reset
	the animation timeout if we aren't animating.


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1020 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Christopher Aillon 2005-10-12 05:51:20 +00:00 committed by Chris Aillon
parent e91071bd2b
commit ac348beeea
2 changed files with 25 additions and 3 deletions

View file

@ -1,3 +1,13 @@
2005-10-12 Christopher Aillon <caillon@redhat.com>
* gnome/applet/applet.c:
Fix icon animation smoothness issues. nmwa_redraw_timeout gets called
every 1000ms. It will unconditionally call nmwa_update_state which
kills the existing animation timeout and registers a new one with a
callback to draw a new frame every 100ms. There are 11 connecting
icon frames, so the last 2 frames kept getting dropped. Only reset
the animation timeout if we aren't animating.
2005-10-11 Dan Williams <dcbw@redhat.com>
* gnome/applet/applet-dbus-devices.c

View file

@ -972,7 +972,7 @@ static GdkPixbuf * nmwa_act_stage_to_pixbuf (NMWirelessApplet *applet, NetworkDe
if (connecting_stage >= 0 && connecting_stage < NUM_CONNECTING_STAGES)
{
if (applet->animation_step > NUM_CONNECTING_FRAMES)
if (applet->animation_step >= NUM_CONNECTING_FRAMES)
applet->animation_step = 0;
pixbuf = applet->network_connecting_icons[connecting_stage][applet->animation_step];
@ -981,7 +981,7 @@ static GdkPixbuf * nmwa_act_stage_to_pixbuf (NMWirelessApplet *applet, NetworkDe
return pixbuf;
}
static void nmwa_update_state (NMWirelessApplet *applet);
/*
* animation_timeout
@ -1029,9 +1029,17 @@ static gboolean animation_timeout (NMWirelessApplet *applet)
if (applet->animation_step >= NUM_VPN_CONNECTING_FRAMES)
applet->animation_step = 0;
nmwa_set_icon (applet, pixbuf, applet->vpn_connecting_icons[applet->animation_step]);
applet->animation_step ++;
}
else
{
applet->animation_step = 0;
applet->animation_id = 0;
nmwa_update_state (applet);
return FALSE;
}
return TRUE;
}
@ -1141,7 +1149,10 @@ done:
applet->animation_step = 0;
if (applet->animation_id)
{
g_source_remove (applet->animation_id);
applet->animation_id = 0;
}
if (need_animation)
applet->animation_id = g_timeout_add (100, (GSourceFunc) animation_timeout, applet);
else
@ -1168,7 +1179,8 @@ done:
*/
static int nmwa_redraw_timeout (NMWirelessApplet *applet)
{
nmwa_update_state (applet);
if (!applet->animation_id)
nmwa_update_state (applet);
return (TRUE);
}