mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-28 20:14:13 +00:00
enshort constructions
This commit is contained in:
parent
710093b161
commit
35491c3ef6
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user