mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-02-10 18:34:14 +00:00
draft page reload action
This commit is contained in:
parent
4e0ec422ca
commit
fd73dc3d7c
@ -30,6 +30,10 @@ impl Main {
|
|||||||
self.tab.append(true);
|
self.tab.append(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn tab_page_reload(&self) {
|
||||||
|
self.tab.page_reload();
|
||||||
|
}
|
||||||
|
|
||||||
pub fn tab_close(&self) {
|
pub fn tab_close(&self) {
|
||||||
self.tab.close();
|
self.tab.close();
|
||||||
}
|
}
|
||||||
|
@ -120,6 +120,19 @@ impl Tab {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn page_reload(&self) {
|
||||||
|
// Get current page
|
||||||
|
if let Some(page_number) = self.widget.current_page() {
|
||||||
|
// Get default widget to extract it name as the ID for childs
|
||||||
|
if let Some(widget) = self.widget.nth_page(Some(page_number)) {
|
||||||
|
// Get page by widget ID
|
||||||
|
if let Some(page) = self.pages.borrow().get(&widget.widget_name()) {
|
||||||
|
page.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn update(&self) {
|
pub fn update(&self) {
|
||||||
// Get current page
|
// Get current page
|
||||||
if let Some(page_number) = self.widget.current_page() {
|
if let Some(page_number) = self.widget.current_page() {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use gtk::{Box, Orientation};
|
use gtk::{glib::GString, Box, Orientation};
|
||||||
|
|
||||||
pub struct Content {
|
pub struct Content {
|
||||||
widget: Box,
|
widget: Box,
|
||||||
@ -12,6 +12,11 @@ impl Content {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Actions
|
||||||
|
pub fn reload(&self, request_text: GString) {
|
||||||
|
// @TODO
|
||||||
|
}
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
pub fn widget(&self) -> &Box {
|
pub fn widget(&self) -> &Box {
|
||||||
&self.widget
|
&self.widget
|
||||||
|
@ -37,6 +37,10 @@ impl Page {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
|
pub fn reload(&self) {
|
||||||
|
self.content.reload(self.navigation.request_text());
|
||||||
|
}
|
||||||
|
|
||||||
pub fn update(&self) {
|
pub fn update(&self) {
|
||||||
self.navigation.update();
|
self.navigation.update();
|
||||||
// @TODO self.content.update();
|
// @TODO self.content.update();
|
||||||
|
@ -10,7 +10,7 @@ use history::History;
|
|||||||
use reload::Reload;
|
use reload::Reload;
|
||||||
use request::Request;
|
use request::Request;
|
||||||
|
|
||||||
use gtk::{prelude::BoxExt, Box, Orientation};
|
use gtk::{glib::GString, prelude::BoxExt, Box, Orientation};
|
||||||
|
|
||||||
pub struct Navigation {
|
pub struct Navigation {
|
||||||
// GTK
|
// GTK
|
||||||
@ -72,4 +72,8 @@ impl Navigation {
|
|||||||
pub fn widget(&self) -> &Box {
|
pub fn widget(&self) -> &Box {
|
||||||
&self.widget
|
&self.widget
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn request_text(&self) -> GString {
|
||||||
|
self.request.text()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
use gtk::{
|
use gtk::{
|
||||||
|
glib::GString,
|
||||||
prelude::{EditableExt, EntryExt, WidgetExt},
|
prelude::{EditableExt, EntryExt, WidgetExt},
|
||||||
Entry,
|
Entry,
|
||||||
};
|
};
|
||||||
@ -44,4 +45,8 @@ impl Request {
|
|||||||
pub fn is_empty(&self) -> bool {
|
pub fn is_empty(&self) -> bool {
|
||||||
0 == self.widget.text_length()
|
0 == self.widget.text_length()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn text(&self) -> GString {
|
||||||
|
self.widget.text()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,6 +71,14 @@ impl Browser {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.build(),
|
.build(),
|
||||||
|
ActionEntry::builder("tab_page_reload")
|
||||||
|
.activate({
|
||||||
|
let main = main.clone();
|
||||||
|
move |_, _, _| {
|
||||||
|
main.tab_page_reload();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.build(),
|
||||||
ActionEntry::builder("tab_close")
|
ActionEntry::builder("tab_close")
|
||||||
.activate({
|
.activate({
|
||||||
let main = main.clone();
|
let main = main.clone();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user