forked from aparoksha/adwaita-swift
Update navigation titles in navigation split view
This commit is contained in:
parent
7900a4cb77
commit
079fa02755
@ -60,6 +60,9 @@ public struct NavigationSplitView: AdwaitaWidget {
|
|||||||
let storage = ViewStorage(splitView?.opaque(), content: content)
|
let storage = ViewStorage(splitView?.opaque(), content: content)
|
||||||
update(storage, data: data, updateProperties: true, type: type)
|
update(storage, data: data, updateProperties: true, type: type)
|
||||||
|
|
||||||
|
storage.fields["sidebar-page"] = sidebarPage?.opaque()
|
||||||
|
storage.fields["main-page"] = mainPage?.opaque()
|
||||||
|
|
||||||
storage.notify(name: "show-content") {
|
storage.notify(name: "show-content") {
|
||||||
showContent?.wrappedValue = adw_navigation_split_view_get_show_content(storage.opaquePointer) != 0
|
showContent?.wrappedValue = adw_navigation_split_view_get_show_content(storage.opaquePointer) != 0
|
||||||
}
|
}
|
||||||
@ -79,13 +82,19 @@ public struct NavigationSplitView: AdwaitaWidget {
|
|||||||
updateProperties: Bool,
|
updateProperties: Bool,
|
||||||
type: Data.Type
|
type: Data.Type
|
||||||
) where Data: ViewRenderData {
|
) where Data: ViewRenderData {
|
||||||
if let storage = storage.content[contentID]?[safe: 0] {
|
if let cStorage = storage.content[contentID]?[safe: 0] {
|
||||||
content
|
content
|
||||||
.updateStorage(storage, data: data, updateProperties: updateProperties, type: type)
|
.updateStorage(cStorage, data: data, updateProperties: updateProperties, type: type)
|
||||||
|
if updateProperties, let mainPage = storage.fields["main-page"] as? OpaquePointer {
|
||||||
|
adw_navigation_page_set_title(mainPage.cast(), cStorage.fields[.navigationLabel] as? String ?? "")
|
||||||
}
|
}
|
||||||
if let storage = storage.content[sidebarID]?[safe: 0] {
|
}
|
||||||
|
if let sStorage = storage.content[sidebarID]?[safe: 0] {
|
||||||
sidebar
|
sidebar
|
||||||
.updateStorage(storage, data: data, updateProperties: updateProperties, type: type)
|
.updateStorage(sStorage, data: data, updateProperties: updateProperties, type: type)
|
||||||
|
if updateProperties, let sidebarPage = storage.fields["sidebar-page"] as? OpaquePointer {
|
||||||
|
adw_navigation_page_set_title(sidebarPage.cast(), sStorage.fields[.navigationLabel] as? String ?? "")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
guard updateProperties else {
|
guard updateProperties else {
|
||||||
return
|
return
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user