enshort constructions

This commit is contained in:
yggverse 2024-11-04 18:35:37 +02:00
parent 710093b161
commit 35491c3ef6
2 changed files with 19 additions and 15 deletions

View File

@ -242,20 +242,9 @@ impl Tab {
/// Reload page at `i32` position or selected page on `None` given
pub fn page_navigation_reload(&self, page_position: Option<i32>) {
match page_position {
Some(value) => {
if let Some(id) = self.widget.gobject().nth_page(value).keyword() {
if let Some(item) = self.index.borrow().get(&id) {
item.page_navigation_reload();
}
}
}
None => {
if let Some(id) = self.widget.current_page_keyword() {
if let Some(item) = self.index.borrow().get(&id) {
item.page_navigation_reload();
}
}
if let Some(id) = self.widget.page_keyword(page_position) {
if let Some(item) = self.index.borrow().get(&id) {
item.page_navigation_reload();
}
}
}

View File

@ -1,4 +1,4 @@
use adw::TabView;
use adw::{TabPage, TabView};
use gtk::{
gio::{Icon, MenuModel},
glib::GString,
@ -52,6 +52,21 @@ impl Widget {
let page = self.gobject.selected_page()?;
let id = page.keyword()?;
Some(id)
} // @TODO remove as deprecated
/// Get **keyword** for page position, `None` for selected page
/// * return `None` if requested page not found
pub fn page_keyword(&self, position: Option<i32>) -> Option<GString> {
self.page(position)?.keyword()
}
/// Get tab page by position, `None` for selected page
/// * return `None` if requested page not found
pub fn page(&self, position: Option<i32>) -> Option<TabPage> {
match position {
Some(value) => Some(self.gobject.nth_page(value)),
None => self.gobject.selected_page(),
}
}
pub fn gobject(&self) -> &TabView {