mirror of
https://gitlab.gnome.org/World/tootle
synced 2025-02-08 15:48:41 +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);
|
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 () {
|
public NotificationsView () {
|
||||||
base ();
|
base ();
|
||||||
|
|
||||||
view.remove.connect (on_remove);
|
view.remove.connect (on_remove);
|
||||||
Tootle.accounts.switched.connect(on_account_changed);
|
accounts.switched.connect(on_account_changed);
|
||||||
Tootle.app.refresh.connect(on_refresh);
|
app.refresh.connect(on_refresh);
|
||||||
Tootle.network.notification.connect (prepend);
|
network.notification.connect (prepend);
|
||||||
|
|
||||||
request ();
|
request ();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string get_icon () {
|
public override string get_icon () {
|
||||||
return "notification-symbolic";
|
return get_notifications_icon (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string get_name () {
|
public override string get_name () {
|
||||||
return _("Notifications");
|
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) {
|
public void prepend (ref Notification notification) {
|
||||||
append (ref notification, true);
|
append (ref notification, true);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user