Clean up NotificationsView
This commit is contained in:
parent
365e99b736
commit
a629ac5b18
|
@ -14,20 +14,13 @@ public class Tootle.NotificationsView : AbstractView {
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string get_icon () {
|
public override string get_icon () {
|
||||||
return get_notifications_icon (false);
|
return Desktop.fallback_icon ("notification-symbolic", "user-invisible-symbolic");
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
@ -41,7 +34,7 @@ public class Tootle.NotificationsView : AbstractView {
|
||||||
|
|
||||||
var widget = new NotificationWidget(notification);
|
var widget = new NotificationWidget(notification);
|
||||||
widget.separator = separator;
|
widget.separator = separator;
|
||||||
image.icon_name = "notification-new-symbolic";
|
image.icon_name = Desktop.fallback_icon ("notification-new-symbolic", "user-available-symbolic");
|
||||||
view.pack_start(separator, false, false, 0);
|
view.pack_start(separator, false, false, 0);
|
||||||
view.pack_start(widget, false, false, 0);
|
view.pack_start(widget, false, false, 0);
|
||||||
|
|
||||||
|
@ -84,11 +77,11 @@ public class Tootle.NotificationsView : AbstractView {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = "%s/api/v1/follow_requests".printf (Tootle.accounts.formal.instance);
|
var url = "%s/api/v1/follow_requests".printf (accounts.formal.instance);
|
||||||
var msg = new Soup.Message("GET", url);
|
var msg = new Soup.Message("GET", url);
|
||||||
Tootle.network.queue(msg, (sess, mess) => {
|
network.queue(msg, (sess, mess) => {
|
||||||
try{
|
try{
|
||||||
Tootle.network.parse_array (mess).foreach_element ((array, i, node) => {
|
network.parse_array (mess).foreach_element ((array, i, node) => {
|
||||||
var obj = node.get_object ();
|
var obj = node.get_object ();
|
||||||
if (obj != null){
|
if (obj != null){
|
||||||
var notification = Notification.parse_follow_request(obj);
|
var notification = Notification.parse_follow_request(obj);
|
||||||
|
@ -102,11 +95,11 @@ public class Tootle.NotificationsView : AbstractView {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var url2 = "%s/api/v1/notifications?limit=30".printf (Tootle.accounts.formal.instance);
|
var url2 = "%s/api/v1/notifications?limit=30".printf (accounts.formal.instance);
|
||||||
var msg2 = new Soup.Message("GET", url2);
|
var msg2 = new Soup.Message("GET", url2);
|
||||||
Tootle.network.queue(msg2, (sess, mess) => {
|
network.queue(msg2, (sess, mess) => {
|
||||||
try{
|
try{
|
||||||
Tootle.network.parse_array (mess).foreach_element ((array, i, node) => {
|
network.parse_array (mess).foreach_element ((array, i, node) => {
|
||||||
var obj = node.get_object ();
|
var obj = node.get_object ();
|
||||||
if (obj != null){
|
if (obj != null){
|
||||||
var notification = Notification.parse(obj);
|
var notification = Notification.parse(obj);
|
||||||
|
|
Loading…
Reference in New Issue