mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-28 20:14:13 +00:00
remove extra title member
This commit is contained in:
parent
176d24da4f
commit
054c30b238
@ -61,7 +61,7 @@ impl Client {
|
|||||||
// Reset widgets
|
// Reset widgets
|
||||||
self.subject.page.search.unset();
|
self.subject.page.search.unset();
|
||||||
self.subject.page.input.unset();
|
self.subject.page.input.unset();
|
||||||
self.subject.page.title.replace("Loading..".into());
|
self.subject.tab_page.set_title("Loading..");
|
||||||
self.subject
|
self.subject
|
||||||
.page
|
.page
|
||||||
.navigation
|
.navigation
|
||||||
@ -91,7 +91,7 @@ impl Client {
|
|||||||
status.set_description(Some(&format!(
|
status.set_description(Some(&format!(
|
||||||
"Scheme `{scheme}` yet not supported"
|
"Scheme `{scheme}` yet not supported"
|
||||||
)));
|
)));
|
||||||
subject.page.title.replace(status.title());
|
subject.tab_page.set_title(&status.title());
|
||||||
subject
|
subject
|
||||||
.page
|
.page
|
||||||
.navigation
|
.navigation
|
||||||
|
@ -129,8 +129,7 @@ impl Gemini {
|
|||||||
todo!()*/
|
todo!()*/
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
self.subject.tab_page.set_title("Titan input");
|
||||||
self.subject.page.title.replace("Titan input".into());
|
|
||||||
self.subject
|
self.subject
|
||||||
.page
|
.page
|
||||||
.navigation
|
.navigation
|
||||||
@ -199,7 +198,7 @@ fn handle(
|
|||||||
Some(1024),
|
Some(1024),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
subject.page.title.replace(title.into());
|
subject.tab_page.set_title(&title);
|
||||||
subject.page.navigation.request.widget.entry.set_progress_fraction(0.0);
|
subject.page.navigation.request.widget.entry.set_progress_fraction(0.0);
|
||||||
subject.tab_page.set_loading(false);
|
subject.tab_page.set_loading(false);
|
||||||
redirects.replace(0); // reset
|
redirects.replace(0); // reset
|
||||||
@ -271,7 +270,7 @@ fn handle(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
subject.page.title.replace(status.title());
|
subject.tab_page.set_title(&status.title());
|
||||||
subject.page.navigation.request.widget.entry.set_progress_fraction(0.0);
|
subject.page.navigation.request.widget.entry.set_progress_fraction(0.0);
|
||||||
subject.tab_page.set_loading(false);
|
subject.tab_page.set_loading(false);
|
||||||
redirects.replace(0); // reset
|
redirects.replace(0); // reset
|
||||||
@ -294,7 +293,7 @@ fn handle(
|
|||||||
subject.page.search.set(Some(widget.text_view));
|
subject.page.search.set(Some(widget.text_view));
|
||||||
|
|
||||||
// Update page meta
|
// Update page meta
|
||||||
subject.page.title.replace(match widget.meta.title {
|
subject.tab_page.set_title(&match widget.meta.title {
|
||||||
Some(title) => title.into(), // @TODO
|
Some(title) => title.into(), // @TODO
|
||||||
None => uri_to_title(&uri),
|
None => uri_to_title(&uri),
|
||||||
});
|
});
|
||||||
@ -313,7 +312,7 @@ fn handle(
|
|||||||
Err(e) => {
|
Err(e) => {
|
||||||
let status = subject.page.content.to_status_failure();
|
let status = subject.page.content.to_status_failure();
|
||||||
status.set_description(Some(&e.to_string()));
|
status.set_description(Some(&e.to_string()));
|
||||||
subject.page.title.replace(status.title());
|
subject.tab_page.set_title(&status.title());
|
||||||
subject.page.navigation.request.widget.entry.set_progress_fraction(0.0);
|
subject.page.navigation.request.widget.entry.set_progress_fraction(0.0);
|
||||||
subject.tab_page.set_loading(false);
|
subject.tab_page.set_loading(false);
|
||||||
redirects.replace(0); // reset
|
redirects.replace(0); // reset
|
||||||
@ -348,13 +347,13 @@ fn handle(
|
|||||||
move |result| {
|
move |result| {
|
||||||
match result {
|
match result {
|
||||||
Ok(buffer) => {
|
Ok(buffer) => {
|
||||||
subject.page.title.replace(uri_to_title(&uri));
|
subject.tab_page.set_title(&uri_to_title(&uri));
|
||||||
subject.page.content.to_image(&Texture::for_pixbuf(&buffer));
|
subject.page.content.to_image(&Texture::for_pixbuf(&buffer));
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
let status = subject.page.content.to_status_failure();
|
let status = subject.page.content.to_status_failure();
|
||||||
status.set_description(Some(e.message()));
|
status.set_description(Some(e.message()));
|
||||||
subject.page.title.replace(status.title());
|
subject.tab_page.set_title(&status.title());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
subject.page.navigation.request.widget.entry.set_progress_fraction(0.0);
|
subject.page.navigation.request.widget.entry.set_progress_fraction(0.0);
|
||||||
@ -367,7 +366,7 @@ fn handle(
|
|||||||
let status = subject.page.content.to_status_failure();
|
let status = subject.page.content.to_status_failure();
|
||||||
status.set_description(Some(&e.to_string()));
|
status.set_description(Some(&e.to_string()));
|
||||||
|
|
||||||
subject.page.title.replace(status.title());
|
subject.tab_page.set_title(&status.title());
|
||||||
subject.page.navigation.request.widget.entry.set_progress_fraction(0.0);
|
subject.page.navigation.request.widget.entry.set_progress_fraction(0.0);
|
||||||
subject.tab_page.set_loading(false);
|
subject.tab_page.set_loading(false);
|
||||||
redirects.replace(0); // reset
|
redirects.replace(0); // reset
|
||||||
@ -381,7 +380,7 @@ fn handle(
|
|||||||
.content
|
.content
|
||||||
.to_status_mime(mime, Some((&subject.page.tab_action, &uri)));
|
.to_status_mime(mime, Some((&subject.page.tab_action, &uri)));
|
||||||
status.set_description(Some(&format!("Content type `{mime}` yet not supported")));
|
status.set_description(Some(&format!("Content type `{mime}` yet not supported")));
|
||||||
subject.page.title.replace(status.title());
|
subject.tab_page.set_title(&status.title());
|
||||||
subject.page.navigation.request.widget.entry.set_progress_fraction(0.0);
|
subject.page.navigation.request.widget.entry.set_progress_fraction(0.0);
|
||||||
subject.tab_page.set_loading(false);
|
subject.tab_page.set_loading(false);
|
||||||
redirects.replace(0); // reset
|
redirects.replace(0); // reset
|
||||||
@ -390,7 +389,7 @@ fn handle(
|
|||||||
None => {
|
None => {
|
||||||
let status = subject.page.content.to_status_failure();
|
let status = subject.page.content.to_status_failure();
|
||||||
status.set_description(Some("MIME type not found"));
|
status.set_description(Some("MIME type not found"));
|
||||||
subject.page.title.replace(status.title());
|
subject.tab_page.set_title(&status.title());
|
||||||
subject.page.navigation.request.widget.entry.set_progress_fraction(0.0);
|
subject.page.navigation.request.widget.entry.set_progress_fraction(0.0);
|
||||||
subject.tab_page.set_loading(false);
|
subject.tab_page.set_loading(false);
|
||||||
redirects.replace(0); // reset
|
redirects.replace(0); // reset
|
||||||
@ -428,7 +427,7 @@ fn handle(
|
|||||||
if total > 5 {
|
if total > 5 {
|
||||||
let status = subject.page.content.to_status_failure();
|
let status = subject.page.content.to_status_failure();
|
||||||
status.set_description(Some("Redirection limit reached"));
|
status.set_description(Some("Redirection limit reached"));
|
||||||
subject.page.title.replace(status.title());
|
subject.tab_page.set_title(&status.title());
|
||||||
subject.page.navigation.request.widget.entry.set_progress_fraction(0.0);
|
subject.page.navigation.request.widget.entry.set_progress_fraction(0.0);
|
||||||
subject.tab_page.set_loading(false);
|
subject.tab_page.set_loading(false);
|
||||||
redirects.replace(0); // reset
|
redirects.replace(0); // reset
|
||||||
@ -439,7 +438,7 @@ fn handle(
|
|||||||
|| uri.host() != target.host() {
|
|| uri.host() != target.host() {
|
||||||
let status = subject.page.content.to_status_failure();
|
let status = subject.page.content.to_status_failure();
|
||||||
status.set_description(Some("External redirects not allowed by protocol specification"));
|
status.set_description(Some("External redirects not allowed by protocol specification"));
|
||||||
subject.page.title.replace(status.title());
|
subject.tab_page.set_title(&status.title());
|
||||||
subject.page.navigation.request.widget.entry.set_progress_fraction(0.0);
|
subject.page.navigation.request.widget.entry.set_progress_fraction(0.0);
|
||||||
subject.tab_page.set_loading(false);
|
subject.tab_page.set_loading(false);
|
||||||
redirects.replace(0); // reset
|
redirects.replace(0); // reset
|
||||||
@ -459,7 +458,7 @@ fn handle(
|
|||||||
Err(e) => {
|
Err(e) => {
|
||||||
let status = subject.page.content.to_status_failure();
|
let status = subject.page.content.to_status_failure();
|
||||||
status.set_description(Some(&e.to_string()));
|
status.set_description(Some(&e.to_string()));
|
||||||
subject.page.title.replace(status.title());
|
subject.tab_page.set_title(&status.title());
|
||||||
subject.page.navigation.request.widget.entry.set_progress_fraction(0.0);
|
subject.page.navigation.request.widget.entry.set_progress_fraction(0.0);
|
||||||
subject.tab_page.set_loading(false);
|
subject.tab_page.set_loading(false);
|
||||||
redirects.replace(0); // reset
|
redirects.replace(0); // reset
|
||||||
@ -468,7 +467,7 @@ fn handle(
|
|||||||
None => {
|
None => {
|
||||||
let status = subject.page.content.to_status_failure();
|
let status = subject.page.content.to_status_failure();
|
||||||
status.set_description(Some("Redirection target not found"));
|
status.set_description(Some("Redirection target not found"));
|
||||||
subject.page.title.replace(status.title());
|
subject.tab_page.set_title(&status.title());
|
||||||
subject.page.navigation.request.widget.entry.set_progress_fraction(0.0);
|
subject.page.navigation.request.widget.entry.set_progress_fraction(0.0);
|
||||||
subject.tab_page.set_loading(false);
|
subject.tab_page.set_loading(false);
|
||||||
redirects.replace(0); // reset
|
redirects.replace(0); // reset
|
||||||
@ -487,7 +486,7 @@ fn handle(
|
|||||||
None => response.meta.status.to_string(),
|
None => response.meta.status.to_string(),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
subject.page.title.replace(status.title());
|
subject.tab_page.set_title(&status.title());
|
||||||
subject.page.navigation.request.widget.entry.set_progress_fraction(0.0);
|
subject.page.navigation.request.widget.entry.set_progress_fraction(0.0);
|
||||||
subject.tab_page.set_loading(false);
|
subject.tab_page.set_loading(false);
|
||||||
redirects.replace(0); // reset
|
redirects.replace(0); // reset
|
||||||
@ -495,7 +494,7 @@ fn handle(
|
|||||||
status => {
|
status => {
|
||||||
let _status = subject.page.content.to_status_failure();
|
let _status = subject.page.content.to_status_failure();
|
||||||
_status.set_description(Some(&format!("Undefined status code `{status}`")));
|
_status.set_description(Some(&format!("Undefined status code `{status}`")));
|
||||||
subject.page.title.replace(_status.title());
|
subject.tab_page.set_title(&_status.title());
|
||||||
subject.page.navigation.request.widget.entry.set_progress_fraction(0.0);
|
subject.page.navigation.request.widget.entry.set_progress_fraction(0.0);
|
||||||
subject.tab_page.set_loading(false);
|
subject.tab_page.set_loading(false);
|
||||||
redirects.replace(0); // reset
|
redirects.replace(0); // reset
|
||||||
@ -505,7 +504,7 @@ fn handle(
|
|||||||
Err(e) => {
|
Err(e) => {
|
||||||
let status = subject.page.content.to_status_failure();
|
let status = subject.page.content.to_status_failure();
|
||||||
status.set_description(Some(&e.to_string()));
|
status.set_description(Some(&e.to_string()));
|
||||||
subject.page.title.replace(status.title());
|
subject.tab_page.set_title(&status.title());
|
||||||
subject.page.navigation.request.widget.entry.set_progress_fraction(0.0);
|
subject.page.navigation.request.widget.entry.set_progress_fraction(0.0);
|
||||||
subject.tab_page.set_loading(false);
|
subject.tab_page.set_loading(false);
|
||||||
redirects.replace(0); // reset
|
redirects.replace(0); // reset
|
||||||
|
@ -17,12 +17,11 @@ use super::{Action as TabAction, BrowserAction, Profile, WindowAction};
|
|||||||
|
|
||||||
use gtk::{glib::GString, prelude::EditableExt};
|
use gtk::{glib::GString, prelude::EditableExt};
|
||||||
use sqlite::Transaction;
|
use sqlite::Transaction;
|
||||||
use std::{cell::RefCell, rc::Rc};
|
use std::rc::Rc;
|
||||||
|
|
||||||
pub struct Page {
|
pub struct Page {
|
||||||
pub id: Rc<GString>,
|
pub id: Rc<GString>,
|
||||||
pub profile: Rc<Profile>,
|
pub profile: Rc<Profile>,
|
||||||
pub title: Rc<RefCell<GString>>,
|
|
||||||
// Actions
|
// Actions
|
||||||
pub browser_action: Rc<BrowserAction>,
|
pub browser_action: Rc<BrowserAction>,
|
||||||
pub tab_action: Rc<TabAction>,
|
pub tab_action: Rc<TabAction>,
|
||||||
@ -71,7 +70,6 @@ impl Page {
|
|||||||
Self {
|
Self {
|
||||||
id: id.clone(),
|
id: id.clone(),
|
||||||
profile: profile.clone(),
|
profile: profile.clone(),
|
||||||
title: Rc::new(RefCell::new("New page".into())),
|
|
||||||
// Actions
|
// Actions
|
||||||
browser_action: browser_action.clone(),
|
browser_action: browser_action.clone(),
|
||||||
tab_action: tab_action.clone(),
|
tab_action: tab_action.clone(),
|
||||||
@ -152,7 +150,6 @@ impl Page {
|
|||||||
Ok(records) => {
|
Ok(records) => {
|
||||||
for record in records {
|
for record in records {
|
||||||
// Restore self by last record
|
// Restore self by last record
|
||||||
self.title.replace(record.title.into());
|
|
||||||
// Delegate restore action to the item childs
|
// Delegate restore action to the item childs
|
||||||
self.navigation.restore(transaction, &record.id)?;
|
self.navigation.restore(transaction, &record.id)?;
|
||||||
// Make initial page history snap using `navigation` values restored
|
// Make initial page history snap using `navigation` values restored
|
||||||
@ -173,11 +170,7 @@ impl Page {
|
|||||||
transaction: &Transaction,
|
transaction: &Transaction,
|
||||||
app_browser_window_tab_item_id: i64,
|
app_browser_window_tab_item_id: i64,
|
||||||
) -> Result<(), String> {
|
) -> Result<(), String> {
|
||||||
match database::insert(
|
match database::insert(transaction, app_browser_window_tab_item_id) {
|
||||||
transaction,
|
|
||||||
app_browser_window_tab_item_id,
|
|
||||||
self.title.borrow().as_str(),
|
|
||||||
) {
|
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
let id = database::last_insert_id(transaction);
|
let id = database::last_insert_id(transaction);
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ use sqlite::{Error, Transaction};
|
|||||||
pub struct Table {
|
pub struct Table {
|
||||||
pub id: i64,
|
pub id: i64,
|
||||||
// pub app_browser_window_tab_item_id: i64, not in use,
|
// pub app_browser_window_tab_item_id: i64, not in use,
|
||||||
pub title: String,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn init(tx: &Transaction) -> Result<usize, Error> {
|
pub fn init(tx: &Transaction) -> Result<usize, Error> {
|
||||||
@ -12,7 +11,6 @@ pub fn init(tx: &Transaction) -> Result<usize, Error> {
|
|||||||
(
|
(
|
||||||
`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
`app_browser_window_tab_item_id` INTEGER NOT NULL,
|
`app_browser_window_tab_item_id` INTEGER NOT NULL,
|
||||||
`title` VARCHAR(1024),
|
|
||||||
|
|
||||||
FOREIGN KEY (`app_browser_window_tab_item_id`) REFERENCES `app_browser_window_tab_item`(`id`)
|
FOREIGN KEY (`app_browser_window_tab_item_id`) REFERENCES `app_browser_window_tab_item`(`id`)
|
||||||
)",
|
)",
|
||||||
@ -20,25 +18,19 @@ pub fn init(tx: &Transaction) -> Result<usize, Error> {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn insert(
|
pub fn insert(tx: &Transaction, app_browser_window_tab_item_id: i64) -> Result<usize, Error> {
|
||||||
tx: &Transaction,
|
|
||||||
app_browser_window_tab_item_id: i64,
|
|
||||||
title: &str,
|
|
||||||
) -> Result<usize, Error> {
|
|
||||||
tx.execute(
|
tx.execute(
|
||||||
"INSERT INTO `app_browser_window_tab_item_page` (
|
"INSERT INTO `app_browser_window_tab_item_page` (
|
||||||
`app_browser_window_tab_item_id`,
|
`app_browser_window_tab_item_id`
|
||||||
`title`
|
) VALUES (?)",
|
||||||
) VALUES (?, ?)",
|
[app_browser_window_tab_item_id],
|
||||||
(app_browser_window_tab_item_id, title),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn select(tx: &Transaction, app_browser_window_tab_item_id: i64) -> Result<Vec<Table>, Error> {
|
pub fn select(tx: &Transaction, app_browser_window_tab_item_id: i64) -> Result<Vec<Table>, Error> {
|
||||||
let mut stmt = tx.prepare(
|
let mut stmt = tx.prepare(
|
||||||
"SELECT `id`,
|
"SELECT `id`,
|
||||||
`app_browser_window_tab_item_id`,
|
`app_browser_window_tab_item_id`
|
||||||
`title`
|
|
||||||
FROM `app_browser_window_tab_item_page`
|
FROM `app_browser_window_tab_item_page`
|
||||||
WHERE `app_browser_window_tab_item_id` = ?",
|
WHERE `app_browser_window_tab_item_id` = ?",
|
||||||
)?;
|
)?;
|
||||||
@ -47,7 +39,6 @@ pub fn select(tx: &Transaction, app_browser_window_tab_item_id: i64) -> Result<V
|
|||||||
Ok(Table {
|
Ok(Table {
|
||||||
id: row.get(0)?,
|
id: row.get(0)?,
|
||||||
// app_browser_window_tab_item_id: row.get(1)?, not in use
|
// app_browser_window_tab_item_id: row.get(1)?, not in use
|
||||||
title: row.get(2)?,
|
|
||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user