Solving "Download bar can get wider than Midori window"
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Midori Web Browser |
Fix Released
|
Undecided
|
Walther |
Bug Description
This has been reported in different parts before, as launchpad bug #719033 and #715079, for example. However, I've delved into this issue for the past several hours to understand what is happening.
In a way, I think the problem is using a toolbar to store the downloadbar. I don't think toolbars were designed to dynamically grow beyond the size of the window. And Midori will not use the "Arrow" style to enable extra entries to appear there (in fact, downloads don't appear there if I try using that).
To keep the download bar as a single line in the status-bar, then there are two choices:
- Shrink the individual download buttons as much as needed to make them all fit.
- Remove old downloads when adding a new one makes the downloadbar be larger than the containing window.
I tried approach number one, but it turns out the download files will not let themselves be shrunk because GtkProgressBars have this style property:
The "min-horizontal
The minimum horizontal width of the progress bar.
Allowed values: >= 1
Default value: 150
Since 2.14
That default causes the download items to not shrink further (in fact, the call to gtk_widget_
"Use gtk_widget_
Documentation seems sparse on how to properly use these functions, so I gave up on that front. Maybe somebody else will want to look at it.
Instead, I decided to tackle approach number two. After adding a new download, a function is called to compare the requested size of the downloadBar versus the window's width. If the downloadBar does not fits, then the last completed download is removed. I added a configuration switch that allows users to choose that ALL completed downloads should be removed, not just the last one.
There is one drawback to this implementation, it does not allows disabling the new setting. I am not sure how we can implement tri-state switches. Maybe the real solution is to ALSO implement part 1, and set a more reasonably minimum width for progress bars.
I am open to suggestions on what could be done with this patch. I do think that a feature to "auto remove cleared downloads when the bar is full" would be welcomed amongst more than a few users, on the very least.
tags: | added: downloads |
Changed in midori: | |
status: | Fix Committed → Fix Released |
Walther, the solution works fine for me. I don't think the preference is very useful to be honest, if you don't want to see downloads you may as well hide the transferbar to the same effect. The attached patch omits the preference.
Please tell me a full name and email address so I can credit you properly in the commit (if you prefer via PM).