diff -ur clearlooks.org/src/clearlooks_style.c clearlooks/src/clearlooks_style.c --- clearlooks.org/src/clearlooks_style.c 2005-11-13 20:08:34.000000000 +0100 +++ clearlooks/src/clearlooks_style.c 2005-11-13 20:37:40.000000000 +0100 @@ -35,6 +35,9 @@ #ifdef HAVE_ANIMATION static GList *progressbars = NULL; static int timer_id = 0; +static GList *checks = NULL; +static gint8 checks_trans = 2; +static int checks_timer_id = 0; #endif static gint8 pboffset = 0; @@ -116,6 +119,66 @@ } #endif +#ifdef HAVE_ANIMATION +static void cl_checks_remove (gpointer data) +{ + if (g_list_find (checks, data) == NULL) + return; + + checks = g_list_remove (checks, data); + g_object_unref (data); + if (g_list_first(checks) == NULL) { + g_source_remove(checks_timer_id); + checks_timer_id = 0; + } +} + +static void cl_update_checks (gpointer data, gpointer user_data) +{ + if (data == NULL) + return; + if (checks_trans > 10) + cl_checks_remove(data); + + gtk_widget_queue_resize ((GtkWidget*)data); +} + +static gboolean cl_checks_known(gconstpointer data) +{ + return (g_list_find (checks, data) != NULL); +} + +static gboolean cl_checks_timer_func (gpointer data) +{ + g_list_foreach (checks, cl_update_checks, NULL); + + if (++checks_trans > 11) + checks_trans = 2; + return (g_list_first(checks) != NULL); +} + +static void cl_checks_add (gpointer data) +{ + if (!GTK_IS_CHECK_BUTTON (data)) + return; + + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data))) + checks_trans = 2; + else + return; + + if(!cl_checks_known(data)) + checks = g_list_append (checks, data); + else + return; + + g_object_ref (data); + g_signal_connect ((GObject*)data, "unrealize", G_CALLBACK (cl_checks_remove), data); + if (checks_timer_id == 0) + checks_timer_id = g_timeout_add (100, cl_checks_timer_func, NULL); +} +#endif + static void clearlooks_set_widget_parameters (const GtkWidget *widget, const GtkStyle *style, @@ -875,10 +938,24 @@ ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); CairoColor *border; CairoColor *dot; +#ifdef HAVE_ANIMATION + double trans; +#endif cairo_t *cr = clearlooks_begin_paint (window, area); cairo_pattern_t *pt; +#ifdef HAVE_ANIMATION + if(clearlooks_style->animation) + { + if (!cl_checks_known((gconstpointer)widget)) + g_signal_connect ((GObject*)widget, "toggled", G_CALLBACK (cl_checks_add), widget); + } + else + if (cl_checks_known((gconstpointer)widget)) + cl_checks_remove((gconstpointer)widget); +#endif + if (state_type == GTK_STATE_INSENSITIVE) { border = &clearlooks_style->colors.shade[2]; @@ -925,7 +1002,15 @@ cairo_curve_to (cr, 0.5 + (width*0.4), (height*0.7), 0.5 + (width*0.5), (height*0.4), 0.5 + (width*0.70), (height*0.25)); +#ifdef HAVE_ANIMATION + if ((checks_trans > 9)||(!cl_checks_known((gconstpointer)widget))) + trans = 1; + else + trans = (float)checks_trans/10; + cairo_set_source_rgba (cr, dot->r, dot->g, dot->b, trans); +#else cairo_set_source_rgb (cr, dot->r, dot->g, dot->b); +#endif cairo_stroke (cr); }