Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions src/Widgets/NotificationsList.vala
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class Notifications.NotificationsList : Granite.Bin {
list_store = new GLib.ListStore (typeof (Notification));

sort_list_model = new Gtk.SortListModel (list_store, new Gtk.CustomSorter ((GLib.CompareDataFunc<GLib.Object>) Notification.compare)) {
section_sorter = new Gtk.CustomSorter ((GLib.CompareDataFunc<GLib.Object>) section_func)
section_sorter = new Gtk.CustomSorter ((GLib.CompareDataFunc<GLib.Object>) section_compare)
};

var listbox = new Gtk.ListBox () {
Expand Down Expand Up @@ -76,19 +76,8 @@ public class Notifications.NotificationsList : Granite.Bin {
});
}

private static int section_func (Notification a, Notification b) {
unowned GLib.DateTime? time_a = app_datetime[a.desktop_id];
unowned GLib.DateTime? time_b = app_datetime[b.desktop_id];

if (time_a != null && time_b != null) {
return time_b.compare (time_a);
} else if (time_a != null) {
return -1;
} else if (time_b != null) {
return 1;
}

return 0;
private static int section_compare (Notification a, Notification b) {
return app_datetime[b.desktop_id].compare (app_datetime[a.desktop_id]);
}

private void header_func (Gtk.ListBoxRow row, Gtk.ListBoxRow? before) {
Expand Down
Loading