diff --git a/src/Widgets/NotificationsList.vala b/src/Widgets/NotificationsList.vala index b0cc647c..2b1bde1c 100644 --- a/src/Widgets/NotificationsList.vala +++ b/src/Widgets/NotificationsList.vala @@ -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) Notification.compare)) { - section_sorter = new Gtk.CustomSorter ((GLib.CompareDataFunc) section_func) + section_sorter = new Gtk.CustomSorter ((GLib.CompareDataFunc) section_compare) }; var listbox = new Gtk.ListBox () { @@ -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) {