From 1321ce1267932b727b64c8abb194e926f54ff169 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sat, 3 Nov 2018 15:54:01 +0100 Subject: 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. --- core/download-button.vala | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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; -- cgit v1.2.1