--- clearlooks_style.c.old 2005-11-18 19:24:53.000000000 +0100 +++ clearlooks_style.c 2005-11-18 21:24:18.000000000 +0100 @@ -98,8 +98,8 @@ { Widget_Animation *my_value = value; - if ((data == NULL) || (value == NULL)) - return; + if ((data == NULL) || (value == NULL)|| (my_value->max_frames ==0)) + return FALSE; if (--(my_value->frame) < 0) { @@ -108,8 +108,12 @@ else if(my_value->loop == 1) { //animation is done - g_free((Widget_Animation*)value); - return TRUE; + //g_free((Widget_Animation*)value); + //return TRUE; + my_value->loop = 0; + my_value->max_frames = 0; + my_value->frame = 0; + return FALSE; } else if (my_value->loop > 1) { @@ -157,22 +161,21 @@ { Widget_Animation *value; - /* object already in the list, not adding twice */ - if(cl_async_animation_lookup(data)) - return; - if(async_widgets == NULL) async_widgets = g_hash_table_new(g_direct_hash, g_direct_equal); - value = g_new(Widget_Animation, sizeof(Widget_Animation)); + if((value =cl_async_animation_lookup(data))==NULL) + { + value = g_new(Widget_Animation, sizeof(Widget_Animation)); + g_hash_table_insert (async_widgets, data, value); + g_signal_connect ((GObject*)data, "unrealize", G_CALLBACK (cl_async_animation_remove), data); + } value->frame = count; value->max_frames= count; value->loop = loop; - g_hash_table_insert (async_widgets, data, value); - g_object_ref (data); - g_signal_connect ((GObject*)data, "unrealize", G_CALLBACK (cl_async_animation_remove), data); + g_object_ref (data); if (async_widget_timer_id == 0) async_widget_timer_id = g_timeout_add (100, cl_async_animation_timer_func, NULL); @@ -191,6 +194,10 @@ static void cl_checkbox_toggle (gpointer data) { + Widget_Animation *value; + if(((value = cl_async_animation_lookup(data))!= NULL)&&(value->frame < value->max_frames)) + value->frame = value->max_frames - value->frame; + cl_async_animation_add(data,5,1); } @@ -914,7 +921,11 @@ #ifdef HAVE_ANIMATION if(clearlooks_style->animation && !cl_async_animation_lookup((gconstpointer)widget)) + { + cl_async_animation_add(widget,0,0); g_signal_connect ((GObject*)widget, "toggled", G_CALLBACK (cl_checkbox_toggle), widget); + } + #endif if (state_type == GTK_STATE_INSENSITIVE) @@ -999,7 +1010,10 @@ #ifdef HAVE_ANIMATION if(clearlooks_style->animation && !cl_async_animation_lookup((gconstpointer)widget)) + { + cl_async_animation_add(widget,0,0); g_signal_connect ((GObject*)widget, "toggled", G_CALLBACK (cl_checkbox_toggle), widget); + } #endif if (state_type == GTK_STATE_INSENSITIVE) @@ -1425,15 +1439,7 @@ if(async_widgets != NULL) { g_hash_table_foreach_remove(async_widgets, cl_disconnect, NULL); - //g_hash_table_destroy(async_widgets); - } - /* - if (async_widget_timer_id != 0) - { - g_source_remove(async_widget_timer_id); - async_widget_timer_id = 0; } - */ #endif /* HAVE_ANIMATION */ }