Add favorite limit settings

This commit is contained in:
2026-05-08 03:31:41 -04:00
parent e2d8b0cc6e
commit 569851eae9
7 changed files with 233 additions and 14 deletions
+3 -4
View File
@@ -11,8 +11,6 @@ use crate::{
use super::BrowserCore;
const DEFAULT_FAVORITE_LIMIT: usize = 12;
impl BrowserCore {
pub fn open_new_tab(&mut self) -> Result<TabId, CoreError> {
let url = self.new_tab_url()?;
@@ -227,9 +225,10 @@ impl BrowserCore {
let favorite_count = self.tabs.iter().filter(|tab| tab.flags().favorite).count();
let active_tab = self.tabs.get_mut(active_index).ok_or(CoreError::MissingActiveTab)?;
let next_favorite = !active_tab.flags().favorite;
let favorite_limit = self.favorite_limit.value();
if next_favorite && favorite_count >= DEFAULT_FAVORITE_LIMIT {
return Err(CoreError::FavoriteLimitReached { limit: DEFAULT_FAVORITE_LIMIT });
if next_favorite && favorite_count >= favorite_limit {
return Err(CoreError::FavoriteLimitReached { limit: favorite_limit });
}
active_tab.set_favorite(next_favorite);