File tree Expand file tree Collapse file tree 3 files changed +8
-9
lines changed
Expand file tree Collapse file tree 3 files changed +8
-9
lines changed Original file line number Diff line number Diff line change 1212 <lookup name =" notes" >listview</lookup >
1313 </binding >
1414 <property name =" sorter" >
15- <object class =" NotejotNoteSorter" />
15+ <object class =" NotejotNoteSorter" id = " sorter " />
1616 </property >
1717 </object >
1818 </property >
Original file line number Diff line number Diff line change @@ -52,6 +52,8 @@ namespace Notejot {
5252 public unowned Gtk . Overlay list_scroller;
5353 [GtkChild ]
5454 public unowned Gtk . Overlay glist_scroller;
55+ [GtkChild ]
56+ public unowned Gtk . Sorter sorter;
5557
5658 // Custom
5759 public MainWindow ? mw {get ; set ;}
@@ -173,6 +175,7 @@ namespace Notejot {
173175 [GtkCallback ]
174176 public void on_note_update_requested (Note note) {
175177 view_model. update_note (note);
178+ sorter. changed (Gtk . SorterChange . DIFFERENT );
176179 }
177180
178181 [GtkCallback ]
Original file line number Diff line number Diff line change @@ -21,14 +21,10 @@ class Notejot.NoteSorter : Gtk.Sorter {
2121 var note1 = item1 as Note ;
2222 var note2 = item2 as Note ;
2323
24- if (note1 == null || note2 == null )
25- return EQUAL ;
26-
27- if (note1. pinned || note2. pinned) {
28- return LARGER ;
29- } else {
30- return Gtk . Ordering . from_cmpfunc (note1. subtitle. collate (note2. subtitle));
31- }
24+ var comp = (int ) note2. pinned - (int ) note1. pinned;
25+ if (comp == 0 )
26+ comp = Gtk . Ordering . from_cmpfunc (note2. subtitle. collate(note1. subtitle));
27+ return comp;
3228 }
3329
3430 protected override Gtk .SorterOrder get_order () {
You can’t perform that action at this time.
0 commit comments