Dynamicly styling a widget

Hi there,

I'm having a rough time figuring out how I can work with colors in Gtk+. I'll provide a rundown of what I'm trying to accomplish:

I'm going to have a TreeView which will have Eventboxes as children.

Each eventbox will have a property called 'course-type'. Based on this property, the eventbox should have a specific background color. 

Here's an example of what I'm trying to mimic:


My eventual goal is for my program to read a JSON file containing all of the course information, displaying it, and allowing the user to drag courses between years/quarters. After they're done the data can be read back and saved into a new file, or just overwrite the existing one.

However, first I need to figure out how to color my eventboxes based on the course_type property. If I could set the CSS class within the object writing the CSS to style it would be trivial; however, I don't see a way to do that.

Any suggestions on how to do it or possibly a better way to implement things to make writing this program easier? Thanks!


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]