derekstavis / transmission

A GNOME 3.14 HIG-compliant Transmission
Other
56 stars 1 forks source link

Use Gtk.CSS to create a faux segmented progress bar for partial downloads #23

Open danirabbit opened 9 years ago

danirabbit commented 9 years ago

I'm not sure how to do this other than with some gtk.css trickery. The way I would do it is:

However, as long as the ".linked" style is respected for progress bars, themes that don't do anything special shouldn't even notice that anything has been done. So this should fall back rather gracefully.

Using a custom style sheet to force some kind of trough styling would work, but I would consider that super dirty and it will probably break the look and feel of every theme except the one you've chosen to imitate.

derekstavis commented 9 years ago

The two GtkProgressBars side by side approach would be my second bet, the first would be hacking into GtkProgressBar to allow multiple segments.

danirabbit commented 9 years ago

If that were possible in the gtk.progressbar API that would probably be nice. But that would be a rather long-term solution as you'd have to wait for the next version of Gtk before you could use it. While it's a little funky, using Gtk.CSS is something that you could ship immediately :)

thorsummoner commented 8 years ago

(This thread is a top Google hit for "segmented gtk progress bar") Generally speaking, multiple process-bars side-by-side seems like a very solid implementation, If I were doing it, I would probably extend gtk.Box with logic for variable number of progress bars and their width allocations if you want non-homogeneous bars. And then mock the Gtk.ProgressBar api in the extended class wither either discreet boxes: 3/5 boxes totally filed, 1 box showing current progress. or collective progress, 50% complete of three boxes would show one filled box, one half filled, and one empty.

Edit, Disclaimer, I don't understand the mechanism or premise of a css based solution to a segmented gkt progress bar.