window: Mark Last Played as default sort mode
This commit is contained in:
@@ -49,6 +49,12 @@ template $Window: Adw.ApplicationWindow {
|
|||||||
section {
|
section {
|
||||||
label: _("Sort");
|
label: _("Sort");
|
||||||
|
|
||||||
|
item {
|
||||||
|
label: _("Last Played");
|
||||||
|
action: "win.sort";
|
||||||
|
target: "last_played";
|
||||||
|
}
|
||||||
|
|
||||||
item {
|
item {
|
||||||
label: _("A-Z");
|
label: _("A-Z");
|
||||||
action: "win.sort";
|
action: "win.sort";
|
||||||
@@ -72,12 +78,6 @@ template $Window: Adw.ApplicationWindow {
|
|||||||
action: "win.sort";
|
action: "win.sort";
|
||||||
target: "oldest";
|
target: "oldest";
|
||||||
}
|
}
|
||||||
|
|
||||||
item {
|
|
||||||
label: _("Last Played");
|
|
||||||
action: "win.sort";
|
|
||||||
target: "last_played";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
section {
|
section {
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ from cartridges.config import PREFIX, PROFILE
|
|||||||
from cartridges.games import Game
|
from cartridges.games import Game
|
||||||
|
|
||||||
SORT_MODES = {
|
SORT_MODES = {
|
||||||
|
"last_played": ("last-played", True),
|
||||||
"a-z": ("name", False),
|
"a-z": ("name", False),
|
||||||
"z-a": ("name", True),
|
"z-a": ("name", True),
|
||||||
"newest": ("added", False),
|
"newest": ("added", False),
|
||||||
"oldest": ("added", True),
|
"oldest": ("added", True),
|
||||||
"last_played": ("last-played", True),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -34,8 +34,8 @@ class Window(Adw.ApplicationWindow):
|
|||||||
search_text = GObject.Property(type=str)
|
search_text = GObject.Property(type=str)
|
||||||
show_hidden = GObject.Property(type=bool, default=False)
|
show_hidden = GObject.Property(type=bool, default=False)
|
||||||
|
|
||||||
_sort_prop = "name"
|
_sort_prop = "last-played"
|
||||||
_invert_sort = False
|
_invert_sort = True
|
||||||
|
|
||||||
@GObject.Property(type=Gio.ListStore)
|
@GObject.Property(type=Gio.ListStore)
|
||||||
def games(self) -> Gio.ListStore:
|
def games(self) -> Gio.ListStore:
|
||||||
@@ -55,7 +55,7 @@ class Window(Adw.ApplicationWindow):
|
|||||||
self.add_action(Gio.PropertyAction.new("show-hidden", self, "show-hidden"))
|
self.add_action(Gio.PropertyAction.new("show-hidden", self, "show-hidden"))
|
||||||
self.add_action_entries((
|
self.add_action_entries((
|
||||||
("search", lambda *_: self.search_entry.grab_focus()),
|
("search", lambda *_: self.search_entry.grab_focus()),
|
||||||
("sort", self._sort, "s", "'a-z'"),
|
("sort", self._sort, "s", "'last_played'"),
|
||||||
))
|
))
|
||||||
|
|
||||||
@Gtk.Template.Callback()
|
@Gtk.Template.Callback()
|
||||||
|
|||||||
Reference in New Issue
Block a user