Fix bug causing activated navigation sidebar row to not match visible page on startup

This commit is contained in:
heliguy
2024-11-07 20:36:34 -05:00
parent 2fd24f3399
commit 51857648fc
2 changed files with 8 additions and 8 deletions

View File

@@ -7,10 +7,10 @@ template $WarehouseWindow: Adw.ApplicationWindow {
default-width: 921; default-width: 921;
default-height: 450; default-height: 450;
Adw.Breakpoint main_breakpoint { Adw.Breakpoint main_breakpoint {
condition ("min-width: 865") condition ("max-width: 865")
setters { setters {
main_split.collapsed: false; main_split.collapsed: true;
main_split.max-sidebar-width: 999999999; main_split.min-sidebar-width: 0.2;
} }
} }
content: content:
@@ -28,9 +28,9 @@ template $WarehouseWindow: Adw.ApplicationWindow {
} }
} }
Adw.OverlaySplitView main_split { Adw.OverlaySplitView main_split {
collapsed: true; collapsed: false;
show-sidebar: true; show-sidebar: true;
sidebar-width-fraction: 0.2; sidebar-width-fraction: 999999999;
min-sidebar-width: 250; min-sidebar-width: 250;
sidebar: sidebar:
Adw.NavigationPage { Adw.NavigationPage {

View File

@@ -89,12 +89,13 @@ class WarehouseWindow(Adw.ApplicationWindow):
self.refresh_button.set_sensitive(True) self.refresh_button.set_sensitive(True)
def navigation_handler(self, _, row): def navigation_handler(self, _, row):
if self.main_split.get_collapsed():
self.main_split.set_show_sidebar(False)
row = row.get_child() row = row.get_child()
page = self.pages[row] page = self.pages[row]
self.stack.set_visible_child(page) self.stack.set_visible_child(page)
self.settings.set_string("page-shown", page.page_name) self.settings.set_string("page-shown", page.page_name)
if self.main_split.get_collapsed():
self.main_split.set_show_sidebar(False)
def activate_row(self, nav_row): def activate_row(self, nav_row):
idx = 0 idx = 0
@@ -102,7 +103,6 @@ class WarehouseWindow(Adw.ApplicationWindow):
idx += 1 idx += 1
if row.get_child() is nav_row: if row.get_child() is nav_row:
row.activate() row.activate()
nav_row.grab_focus()
break break
def show_saved_page(self): def show_saved_page(self):