mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
activate history buttons
This commit is contained in:
parent
c35c2e9e2f
commit
3f5b4f9dfa
2 changed files with 49 additions and 12 deletions
|
|
@ -1,19 +1,38 @@
|
||||||
use gtk::{gio::SimpleAction, Button};
|
use gtk::{
|
||||||
|
gio::SimpleAction,
|
||||||
|
prelude::{ActionExt, ButtonExt},
|
||||||
|
Button,
|
||||||
|
};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
pub struct Back {
|
pub struct Back {
|
||||||
|
action_tab_page_navigation_history_back: Arc<SimpleAction>,
|
||||||
widget: Button,
|
widget: Button,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Back {
|
impl Back {
|
||||||
// Construct
|
// Construct
|
||||||
pub fn new(action_tab_page_navigation_history_back: Arc<SimpleAction>) -> Self {
|
pub fn new(action_tab_page_navigation_history_back: Arc<SimpleAction>) -> Self {
|
||||||
|
// Init widget
|
||||||
|
let widget = Button::builder()
|
||||||
|
.icon_name("go-previous-symbolic")
|
||||||
|
.tooltip_text("Back")
|
||||||
|
.sensitive(false)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// Init events
|
||||||
|
widget.connect_clicked({
|
||||||
|
let action_tab_page_navigation_history_back =
|
||||||
|
action_tab_page_navigation_history_back.clone();
|
||||||
|
move |_| {
|
||||||
|
action_tab_page_navigation_history_back.activate(None);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Return activated struct
|
||||||
Self {
|
Self {
|
||||||
widget: Button::builder()
|
action_tab_page_navigation_history_back,
|
||||||
.icon_name("go-previous-symbolic")
|
widget,
|
||||||
.tooltip_text("Back")
|
|
||||||
.sensitive(false)
|
|
||||||
.build(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,37 @@
|
||||||
use gtk::{gio::SimpleAction, Button};
|
use gtk::{
|
||||||
|
prelude::{ActionExt, ButtonExt},
|
||||||
|
{gio::SimpleAction, Button},
|
||||||
|
};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
pub struct Forward {
|
pub struct Forward {
|
||||||
|
action_tab_page_navigation_history_forward: Arc<SimpleAction>,
|
||||||
widget: Button,
|
widget: Button,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Forward {
|
impl Forward {
|
||||||
// Construct
|
// Construct
|
||||||
pub fn new(action_tab_page_navigation_history_forward: Arc<SimpleAction>) -> Self {
|
pub fn new(action_tab_page_navigation_history_forward: Arc<SimpleAction>) -> Self {
|
||||||
|
// Init widget
|
||||||
|
let widget = Button::builder()
|
||||||
|
.icon_name("go-next-symbolic")
|
||||||
|
.tooltip_text("Forward")
|
||||||
|
.sensitive(false)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// Init events
|
||||||
|
widget.connect_clicked({
|
||||||
|
let action_tab_page_navigation_history_forward =
|
||||||
|
action_tab_page_navigation_history_forward.clone();
|
||||||
|
move |_| {
|
||||||
|
action_tab_page_navigation_history_forward.activate(None);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Return activated struct
|
||||||
Self {
|
Self {
|
||||||
widget: Button::builder()
|
action_tab_page_navigation_history_forward,
|
||||||
.icon_name("go-next-symbolic")
|
widget,
|
||||||
.tooltip_text("Forward")
|
|
||||||
.sensitive(false)
|
|
||||||
.build(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue