create separated module for meta struct (according to development protocol)

This commit is contained in:
yggverse 2024-09-25 23:07:55 +03:00
parent 4608d96eff
commit 2ac2f60041
2 changed files with 29 additions and 18 deletions

View 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,
})
}
}

View File

@ -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 {