mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-02-05 07:54:14 +00:00
create separated module for meta struct (according to development protocol)
This commit is contained in:
parent
4608d96eff
commit
2ac2f60041
26
src/browser/main/tab/page/meta.rs
Normal file
26
src/browser/main/tab/page/meta.rs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
use gtk::glib::GString;
|
||||||
|
use std::cell::RefCell;
|
||||||
|
|
||||||
|
pub enum Mime {
|
||||||
|
Undefined,
|
||||||
|
TextGemini,
|
||||||
|
TextPlain,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Meta {
|
||||||
|
pub title: GString,
|
||||||
|
pub description: GString,
|
||||||
|
pub mime: Mime,
|
||||||
|
pub progress_fraction: f32,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Meta {
|
||||||
|
pub fn new() -> RefCell<Meta> {
|
||||||
|
RefCell::new(Self {
|
||||||
|
title: GString::new(),
|
||||||
|
description: GString::new(),
|
||||||
|
mime: Mime::Undefined,
|
||||||
|
progress_fraction: 0.0,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,9 @@
|
|||||||
mod content;
|
mod content;
|
||||||
|
mod meta;
|
||||||
mod navigation;
|
mod navigation;
|
||||||
|
|
||||||
use content::Content;
|
use content::Content;
|
||||||
|
use meta::{Meta, Mime};
|
||||||
use navigation::Navigation;
|
use navigation::Navigation;
|
||||||
|
|
||||||
use gtk::{
|
use gtk::{
|
||||||
@ -16,18 +18,6 @@ use gtk::{
|
|||||||
use std::{cell::RefCell, sync::Arc};
|
use std::{cell::RefCell, sync::Arc};
|
||||||
|
|
||||||
// Extras
|
// Extras
|
||||||
enum Mime {
|
|
||||||
Undefined,
|
|
||||||
TextGemini,
|
|
||||||
TextPlain,
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Meta {
|
|
||||||
title: GString,
|
|
||||||
description: GString,
|
|
||||||
mime: Mime,
|
|
||||||
progress_fraction: f32,
|
|
||||||
}
|
|
||||||
|
|
||||||
// Main
|
// Main
|
||||||
pub struct Page {
|
pub struct Page {
|
||||||
@ -57,12 +47,7 @@ impl Page {
|
|||||||
widget.append(content.widget());
|
widget.append(content.widget());
|
||||||
|
|
||||||
// Init meta
|
// Init meta
|
||||||
let meta = RefCell::new(Meta {
|
let meta = Meta::new();
|
||||||
title: GString::new(),
|
|
||||||
description: GString::new(),
|
|
||||||
mime: Mime::Undefined,
|
|
||||||
progress_fraction: 0.0,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Result
|
// Result
|
||||||
Arc::new(Self {
|
Arc::new(Self {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user