use gtk::{
gio::{SimpleAction, SimpleActionGroup},
prelude::{ActionMapExt, BoxExt, WidgetExt},
Box, Orientation,
};
use std::sync::Arc;
pub struct Widget {
gobject: Box,
}
impl Widget {
pub fn new_arc(
action_page_open: Arc<SimpleAction>,
name: &str,
navigation: &Box,
content: &Box,
) -> Arc<Self> {
let action_group = SimpleActionGroup::new();
action_group.add_action(action_page_open.as_ref());
let gobject = Box::builder()
.orientation(Orientation::Vertical)
.name(name)
.build();
gobject.append(navigation);
gobject.append(content);
gobject.insert_action_group("page", Some(&action_group));
Arc::new(Self { gobject })
}
pub fn gobject(&self) -> &Box {
&self.gobject
}
}