diff --git a/src/Desktop.vala b/src/Desktop.vala index 49dcbac..57ebbdf 100644 --- a/src/Desktop.vala +++ b/src/Desktop.vala @@ -52,4 +52,9 @@ public class Tootle.Desktop { network.queue (msg); } + public static string fallback_icon (string normal, string fallback) { + var theme = Gtk.IconTheme.get_default (); + return theme.has_icon (normal) ? normal : fallback; + } + } diff --git a/src/Views/NotificationsView.vala b/src/Views/NotificationsView.vala index 5e35949..ab18dd4 100644 --- a/src/Views/NotificationsView.vala +++ b/src/Views/NotificationsView.vala @@ -5,23 +5,29 @@ public class Tootle.NotificationsView : AbstractView { public NotificationsView () { base (); - view.remove.connect (on_remove); - Tootle.accounts.switched.connect(on_account_changed); - Tootle.app.refresh.connect(on_refresh); - Tootle.network.notification.connect (prepend); + accounts.switched.connect(on_account_changed); + app.refresh.connect(on_refresh); + network.notification.connect (prepend); request (); } public override string get_icon () { - return "notification-symbolic"; + return get_notifications_icon (false); } public override string get_name () { return _("Notifications"); } + private string get_notifications_icon (bool has_new) { + if (has_new) + return Desktop.fallback_icon ("notification-new-symbolic", "user-available-symbolic"); + else + return Desktop.fallback_icon ("notification-symbolic", "user-invisible-symbolic"); + } + public void prepend (ref Notification notification) { append (ref notification, true); }