mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 17:15:28 +00:00
create tab page on item construct
This commit is contained in:
parent
9b94304756
commit
2630fa9283
3 changed files with 40 additions and 8 deletions
25
src/app/browser/window/tab/item/widget.rs
Normal file
25
src/app/browser/window/tab/item/widget.rs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
use adw::{TabPage, TabView};
|
||||
use gtk::Box;
|
||||
use std::sync::Arc;
|
||||
|
||||
pub struct Widget {
|
||||
gobject: TabPage,
|
||||
}
|
||||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc(tab_view: &TabView, page: &Box, title: Option<&str>) -> Arc<Self> {
|
||||
let gobject = tab_view.append(page);
|
||||
|
||||
if let Some(value) = title {
|
||||
gobject.set_title(value);
|
||||
}
|
||||
|
||||
Arc::new(Self { gobject })
|
||||
}
|
||||
|
||||
// Getters
|
||||
pub fn gobject(&self) -> &TabPage {
|
||||
&self.gobject
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue