Add general new tab settings
This commit is contained in:
@@ -5,6 +5,7 @@ mod download;
|
||||
mod error;
|
||||
mod history;
|
||||
mod identifiers;
|
||||
mod new_tab;
|
||||
mod plugin;
|
||||
mod profile;
|
||||
mod reading_list;
|
||||
@@ -28,6 +29,7 @@ pub use history::HistoryEntry;
|
||||
pub use identifiers::{
|
||||
BookmarkId, DownloadId, ProfileId, ReadingListId, SpaceId, SplitId, TabId, WebViewId,
|
||||
};
|
||||
pub use new_tab::NewTabDestination;
|
||||
pub use plugin::{
|
||||
PluginContributionPoint, PluginId, PluginManifest, PluginPermission, PluginPermissionRisk,
|
||||
PluginSignature, PluginSignatureAlgorithm,
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
use crate::{DomainError, UrlText};
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
|
||||
pub enum NewTabDestination {
|
||||
#[default]
|
||||
ElyNewTab,
|
||||
Bookmarks,
|
||||
ReadingList,
|
||||
}
|
||||
|
||||
impl NewTabDestination {
|
||||
pub const ALL: &[Self] = &[Self::ElyNewTab, Self::Bookmarks, Self::ReadingList];
|
||||
|
||||
#[must_use]
|
||||
pub fn name(self) -> &'static str {
|
||||
match self {
|
||||
Self::ElyNewTab => "ELY New Tab",
|
||||
Self::Bookmarks => "Bookmarks",
|
||||
Self::ReadingList => "Reading List",
|
||||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn detail(self) -> &'static str {
|
||||
match self {
|
||||
Self::ElyNewTab => "Open the quiet browser start surface.",
|
||||
Self::Bookmarks => "Open saved pages first.",
|
||||
Self::ReadingList => "Open the saved reading queue first.",
|
||||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn route(self) -> &'static str {
|
||||
match self {
|
||||
Self::ElyNewTab => "ely://new-tab",
|
||||
Self::Bookmarks => "ely://bookmarks",
|
||||
Self::ReadingList => "ely://reading-list",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn url(self) -> Result<UrlText, DomainError> {
|
||||
UrlText::parse(self.route())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user