mirror of
https://gitlab.gnome.org/World/tootle
synced 2025-02-02 00:46:48 +01:00
Fallback header notifications icon (#20)
This commit is contained in:
parent
86e4215270
commit
708e6d6566
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user