mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 09:05:27 +00:00
handle bookmark toggle action results
This commit is contained in:
parent
a0c52f2ede
commit
0b44303023
6 changed files with 42 additions and 11 deletions
|
|
@ -1,11 +1,13 @@
|
|||
mod content;
|
||||
mod database;
|
||||
mod error;
|
||||
mod input;
|
||||
mod meta;
|
||||
mod navigation;
|
||||
mod widget;
|
||||
|
||||
use content::Content;
|
||||
use error::Error;
|
||||
use input::Input;
|
||||
use meta::{Meta, Status};
|
||||
use navigation::Navigation;
|
||||
|
|
@ -89,12 +91,19 @@ impl Page {
|
|||
|
||||
// Actions
|
||||
|
||||
/// Toggle bookmark for navigation request in profile database
|
||||
pub fn bookmark(&self) {
|
||||
self.profile
|
||||
/// Toggle bookmark for current `profile` by navigation request value
|
||||
/// * return `true` on bookmark created, `false` on deleted
|
||||
pub fn bookmark(&self) -> Result<bool, Error> {
|
||||
let result = match self
|
||||
.profile
|
||||
.bookmark
|
||||
.toggle(self.navigation.request().widget().gobject().text().as_str());
|
||||
.toggle(self.navigation.request().widget().gobject().text().as_str())
|
||||
{
|
||||
Ok(result) => Ok(result),
|
||||
Err(_) => Err(Error::Bookmark),
|
||||
};
|
||||
self.update();
|
||||
result
|
||||
}
|
||||
|
||||
/// Navigate home URL (parsed from current navigation entry)
|
||||
|
|
|
|||
4
src/app/browser/window/tab/item/page/error.rs
Normal file
4
src/app/browser/window/tab/item/page/error.rs
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
Bookmark,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue