diff options
author | Christian Dywan <christian@twotoasts.de> | 2018-11-03 15:54:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-03 15:54:01 +0100 |
commit | 1321ce1267932b727b64c8abb194e926f54ff169 (patch) | |
tree | 74e4c979de831da5d27332cde98230cdcd329888 | |
parent | d51b56075a9f175be958902db1c24186ecf183e5 (diff) | |
download | midori-git-1321ce1267932b727b64c8abb194e926f54ff169.tar.gz |
Highlight finished download(s) via style class (#149)
![screenshot from 2018-11-01 16-07-25](https://user-images.githubusercontent.com/1204189/47860187-438cf180-ddf0-11e8-9733-c8fed7e1419c.png)
After looking at the downloads popover the style class is removed and no longer visually demanding attention.
I thought the "needs-attention" style class might be appropriate here but it doesn't seem to work since it's only an animation, so I opted for the "suggested action" instead.
-rw-r--r-- | core/download-button.vala | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/core/download-button.vala b/core/download-button.vala index 485b78b0..7bac8041 100644 --- a/core/download-button.vala +++ b/core/download-button.vala @@ -13,6 +13,7 @@ namespace Midori { [GtkTemplate (ui = "/ui/download-button.ui")] public class DownloadButton : Gtk.Button { public virtual signal void show_downloads () { + get_style_context ().remove_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); popover.show (); } @@ -40,7 +41,11 @@ namespace Midori { if (download.destination != null && download.destination.has_prefix (cache)) { return; } - model.append (new DownloadItem.with_download (download)); + var item = new DownloadItem.with_download (download); + item.finished.connect (() => { + get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); + }); + model.append (item); } public Gtk.Widget create_row (Object item) { @@ -79,6 +84,7 @@ namespace Midori { loading = false; } } + public signal void finished (); construct { notify["filename"].connect ((pspec) => { @@ -104,6 +110,7 @@ namespace Midori { download.finished.connect (() => { download = null; loading = false; + finished (); }); download.failed.connect ((error) => { loading = false; |