Navigation improvements - closes #80
This commit is contained in:
@@ -114,12 +114,12 @@ template DetailsWindow : Adw.Window {
|
|||||||
description: _("File to open or command to run when launching the game");
|
description: _("File to open or command to run when launching the game");
|
||||||
|
|
||||||
[header-suffix]
|
[header-suffix]
|
||||||
Gtk.MenuButton exec-info-button {
|
Gtk.MenuButton exec_info_button {
|
||||||
valign: center;
|
valign: center;
|
||||||
icon-name: "help-about-symbolic";
|
icon-name: "help-about-symbolic";
|
||||||
|
|
||||||
popover: Popover {
|
popover: Popover {
|
||||||
visible: bind exec-info-button.active bidirectional;
|
visible: bind exec_info_button.active bidirectional;
|
||||||
|
|
||||||
Label exec_info_label {
|
Label exec_info_label {
|
||||||
use-markup: true;
|
use-markup: true;
|
||||||
|
|||||||
@@ -9,6 +9,14 @@ Adw.StatusPage notice_no_results {
|
|||||||
valign: center;
|
valign: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Adw.StatusPage hidden_notice_no_results {
|
||||||
|
icon-name: "system-search-symbolic";
|
||||||
|
title: _("No Games Found");
|
||||||
|
description: _("Try a different search.");
|
||||||
|
vexpand: true;
|
||||||
|
valign: center;
|
||||||
|
}
|
||||||
|
|
||||||
Adw.StatusPage notice_empty {
|
Adw.StatusPage notice_empty {
|
||||||
icon-name: "applications-games-symbolic";
|
icon-name: "applications-games-symbolic";
|
||||||
title: _("No Games");
|
title: _("No Games");
|
||||||
@@ -250,6 +258,8 @@ template CartridgesWindow : Adw.ApplicationWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SearchBar search_bar {
|
SearchBar search_bar {
|
||||||
|
search-mode-enabled: bind search_button.active bidirectional;
|
||||||
|
key-capture-widget: library_view;
|
||||||
Adw.Clamp {
|
Adw.Clamp {
|
||||||
maximum-size: 500;
|
maximum-size: 500;
|
||||||
tightening-threshold: 500;
|
tightening-threshold: 500;
|
||||||
@@ -298,7 +308,7 @@ template CartridgesWindow : Adw.ApplicationWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[end]
|
[end]
|
||||||
MenuButton {
|
MenuButton hidden_primary_menu_button {
|
||||||
tooltip-text: _("Main Menu");
|
tooltip-text: _("Main Menu");
|
||||||
icon-name: "open-menu-symbolic";
|
icon-name: "open-menu-symbolic";
|
||||||
menu-model: primary_menu;
|
menu-model: primary_menu;
|
||||||
@@ -313,6 +323,8 @@ template CartridgesWindow : Adw.ApplicationWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SearchBar hidden_search_bar {
|
SearchBar hidden_search_bar {
|
||||||
|
search-mode-enabled: bind hidden_search_button.active bidirectional;
|
||||||
|
key-capture-widget: hidden_library_view;
|
||||||
Adw.Clamp {
|
Adw.Clamp {
|
||||||
maximum-size: 500;
|
maximum-size: 500;
|
||||||
tightening-threshold: 500;
|
tightening-threshold: 500;
|
||||||
|
|||||||
@@ -56,11 +56,13 @@ class CartridgesWindow(Adw.ApplicationWindow):
|
|||||||
details_view_last_played = Gtk.Template.Child()
|
details_view_last_played = Gtk.Template.Child()
|
||||||
details_view_hide_button = Gtk.Template.Child()
|
details_view_hide_button = Gtk.Template.Child()
|
||||||
|
|
||||||
|
hidden_primary_menu_button = Gtk.Template.Child()
|
||||||
hidden_library = Gtk.Template.Child()
|
hidden_library = Gtk.Template.Child()
|
||||||
hidden_library_view = Gtk.Template.Child()
|
hidden_library_view = Gtk.Template.Child()
|
||||||
hidden_scrolledwindow = Gtk.Template.Child()
|
hidden_scrolledwindow = Gtk.Template.Child()
|
||||||
hidden_library_bin = Gtk.Template.Child()
|
hidden_library_bin = Gtk.Template.Child()
|
||||||
hidden_notice_empty = Gtk.Template.Child()
|
hidden_notice_empty = Gtk.Template.Child()
|
||||||
|
hidden_notice_no_results = Gtk.Template.Child()
|
||||||
hidden_search_bar = Gtk.Template.Child()
|
hidden_search_bar = Gtk.Template.Child()
|
||||||
hidden_search_entry = Gtk.Template.Child()
|
hidden_search_entry = Gtk.Template.Child()
|
||||||
hidden_search_button = Gtk.Template.Child()
|
hidden_search_button = Gtk.Template.Child()
|
||||||
@@ -134,6 +136,10 @@ class CartridgesWindow(Adw.ApplicationWindow):
|
|||||||
else:
|
else:
|
||||||
Game(self, game).update()
|
Game(self, game).update()
|
||||||
|
|
||||||
|
# Connect search entries
|
||||||
|
self.search_bar.connect_entry(self.search_entry)
|
||||||
|
self.hidden_search_bar.connect_entry(self.hidden_search_entry)
|
||||||
|
|
||||||
# Connect signals
|
# Connect signals
|
||||||
self.search_entry.connect("search-changed", self.search_changed, False)
|
self.search_entry.connect("search-changed", self.search_changed, False)
|
||||||
self.hidden_search_entry.connect("search-changed", self.search_changed, True)
|
self.hidden_search_entry.connect("search-changed", self.search_changed, True)
|
||||||
@@ -158,7 +164,7 @@ class CartridgesWindow(Adw.ApplicationWindow):
|
|||||||
continue
|
continue
|
||||||
if game.hidden:
|
if game.hidden:
|
||||||
if game.filtered and hidden_child != self.hidden_scrolledwindow:
|
if game.filtered and hidden_child != self.hidden_scrolledwindow:
|
||||||
hidden_child = self.notice_no_results
|
hidden_child = self.hidden_notice_no_results
|
||||||
continue
|
continue
|
||||||
hidden_child = self.hidden_scrolledwindow
|
hidden_child = self.hidden_scrolledwindow
|
||||||
else:
|
else:
|
||||||
@@ -301,7 +307,7 @@ class CartridgesWindow(Adw.ApplicationWindow):
|
|||||||
else Gtk.StackTransitionType.OVER_LEFT
|
else Gtk.StackTransitionType.OVER_LEFT
|
||||||
)
|
)
|
||||||
|
|
||||||
if next_page == self.library_view or self.hidden_library_view:
|
if next_page in (self.library_view, self.hidden_library_view):
|
||||||
self.previous_page = next_page
|
self.previous_page = next_page
|
||||||
self.lookup_action("show_hidden").set_enabled(
|
self.lookup_action("show_hidden").set_enabled(
|
||||||
next_page == self.library_view
|
next_page == self.library_view
|
||||||
@@ -342,16 +348,13 @@ class CartridgesWindow(Adw.ApplicationWindow):
|
|||||||
if self.stack.get_visible_child() == self.library_view:
|
if self.stack.get_visible_child() == self.library_view:
|
||||||
search_bar = self.search_bar
|
search_bar = self.search_bar
|
||||||
search_entry = self.search_entry
|
search_entry = self.search_entry
|
||||||
search_button = self.search_button
|
|
||||||
elif self.stack.get_visible_child() == self.hidden_library_view:
|
elif self.stack.get_visible_child() == self.hidden_library_view:
|
||||||
search_bar = self.hidden_search_bar
|
search_bar = self.hidden_search_bar
|
||||||
search_entry = self.hidden_search_entry
|
search_entry = self.hidden_search_entry
|
||||||
search_button = self.hidden_search_button
|
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
|
||||||
search_bar.set_search_mode(not (search_mode := search_bar.get_search_mode()))
|
search_bar.set_search_mode(not (search_mode := search_bar.get_search_mode()))
|
||||||
search_button.set_active(not search_button.get_active())
|
|
||||||
|
|
||||||
if not search_mode:
|
if not search_mode:
|
||||||
self.set_focus(search_entry)
|
self.set_focus(search_entry)
|
||||||
@@ -386,5 +389,7 @@ class CartridgesWindow(Adw.ApplicationWindow):
|
|||||||
self.toasts.pop((game, undo))
|
self.toasts.pop((game, undo))
|
||||||
|
|
||||||
def on_open_menu_action(self, *_args):
|
def on_open_menu_action(self, *_args):
|
||||||
if self.stack.get_visible_child() != self.details_view:
|
if self.stack.get_visible_child() == self.library_view:
|
||||||
self.primary_menu_button.set_active(True)
|
self.primary_menu_button.popup()
|
||||||
|
elif self.stack.get_visible_child() == self.hidden_library_view:
|
||||||
|
self.hidden_primary_menu_button.popup()
|
||||||
|
|||||||
Reference in New Issue
Block a user