move strip_prefix getter to request api

This commit is contained in:
yggverse 2024-12-11 15:50:04 +02:00
parent 4e0797bd6e
commit 6f038539d6
3 changed files with 17 additions and 19 deletions

View file

@ -5,7 +5,7 @@ use widget::Widget;
use crate::app::browser::{window::tab::item::Action as TabAction, Action as BrowserAction};
use gtk::{
glib::{Uri, UriFlags},
glib::{GString, Uri, UriFlags},
prelude::EditableExt,
};
use sqlite::Transaction;
@ -96,6 +96,20 @@ impl Request {
_ => None,
}
}
pub fn strip_prefix(&self) -> GString {
let mut text = self.widget.entry.text();
if let Some(postfix) = text.strip_prefix("source:") {
text = postfix.into()
};
if let Some(postfix) = text.strip_prefix("download:") {
text = postfix.into()
};
text
}
}
// Tools