mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-08-31 08:52:14 +00:00
55 lines
1.1 KiB
Rust
55 lines
1.1 KiB
Rust
mod history;
|
|
mod home;
|
|
mod identity;
|
|
mod load;
|
|
mod reload;
|
|
|
|
use gtk::gio::SimpleAction;
|
|
use history::History;
|
|
use home::Home;
|
|
use identity::Identity;
|
|
use load::Load;
|
|
use reload::Reload;
|
|
|
|
use std::rc::Rc;
|
|
|
|
/// [SimpleActionGroup](https://docs.gtk.org/gio/class.SimpleActionGroup.html) wrapper for `Browser` actions
|
|
pub struct Action {
|
|
pub history: Rc<History>,
|
|
pub home: SimpleAction,
|
|
pub identity: SimpleAction,
|
|
pub load: Rc<Load>,
|
|
pub reload: SimpleAction,
|
|
}
|
|
|
|
impl Default for Action {
|
|
fn default() -> Self {
|
|
Self::new()
|
|
}
|
|
}
|
|
|
|
impl Action {
|
|
// Constructors
|
|
|
|
/// Create new `Self`
|
|
pub fn new() -> Self {
|
|
let home = SimpleAction::home();
|
|
let identity = SimpleAction::identity();
|
|
let load = Rc::new(Load::new());
|
|
let reload = SimpleAction::reload();
|
|
|
|
let history = Rc::new(History::build({
|
|
let load = load.clone();
|
|
move |request| load.activate(Some(&request), false, false)
|
|
}));
|
|
|
|
Self {
|
|
history,
|
|
home,
|
|
identity,
|
|
load,
|
|
reload,
|
|
}
|
|
}
|
|
}
|