I’m currently working on a sequenced sound editor in C#, and I’m currently trying to set the colours of each progress bar to match each track colour, so it can work as a visualiser, as seen here:
So I tried to do exactly what was written in C from this file in their repo (rather than write a completely separate CSS file), and reimplemented it in C#:
And… it didn’t work, unfortunately, it froze the entire application instead.
Do I really have to write a CSS file with the .css extension? Because I want to just implement the CSS formatted code as a string instead, just like I’m trying to do above.
I totally agree with this, as this is the solution I would’ve chosen if it couldn’t work out the way I intended for it to work.
That definitely sounds like something I could attempt to do in the future, should I attempt to tweak around with the progress bar.
Ah okay, so both of them should work, that’s good to know.
I did actually use the 600 constant (or as it is in Gir.Core, Gtk.Constants.STYLE_PROVIDER_PRIORITY_APPLICATION), but the application still froze.
And I agree too, it is quite tricky getting something that’s already implemented to work with multiple colours. It would be much more easier for me to just paint it with DrawingArea and CairoContext.
This was the setup that I have of the timer, source and context:
private void ConfigureTimer()
{
var timer = GLib.Timer.New(); // Creates a new timer variable
var context = GLib.MainContext.GetThreadDefault(); // Reads the main context default thread
var source = GLib.Functions.TimeoutSourceNew(1); // Creates and configures the timeout interval at 1 microsecond, so it updates in real time
source.SetCallback(TrackTimerCallback); // Sets the callback for the timer interval to be used on
var microsec = (ulong)source.Attach(context); // Configures the microseconds based on attaching the GLib MainContext thread
timer.Elapsed(ref microsec); // Adds the pointer to the configured microseconds source
timer.Start(); // Starts the timer
}