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 meta;
|
||||
mod navigation;
|
||||
|
||||
use content::Content;
|
||||
use meta::{Meta, Mime};
|
||||
use navigation::Navigation;
|
||||
|
||||
use gtk::{
|
||||
@ -16,18 +18,6 @@ use gtk::{
|
||||
use std::{cell::RefCell, sync::Arc};
|
||||
|
||||
// Extras
|
||||
enum Mime {
|
||||
Undefined,
|
||||
TextGemini,
|
||||
TextPlain,
|
||||
}
|
||||
|
||||
struct Meta {
|
||||
title: GString,
|
||||
description: GString,
|
||||
mime: Mime,
|
||||
progress_fraction: f32,
|
||||
}
|
||||
|
||||
// Main
|
||||
pub struct Page {
|
||||
@ -57,12 +47,7 @@ impl Page {
|
||||
widget.append(content.widget());
|
||||
|
||||
// Init meta
|
||||
let meta = RefCell::new(Meta {
|
||||
title: GString::new(),
|
||||
description: GString::new(),
|
||||
mime: Mime::Undefined,
|
||||
progress_fraction: 0.0,
|
||||
});
|
||||
let meta = Meta::new();
|
||||
|
||||
// Result
|
||||
Arc::new(Self {
|
||||
|
Loading…
x
Reference in New Issue
Block a user